Skip to content

Commit

Permalink
Vendor tree-sitter-facade and tree-sitter-web-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
Erin van der Veen committed Jan 25, 2024
1 parent 492a7f4 commit 1c0fdc0
Show file tree
Hide file tree
Showing 34 changed files with 4,112 additions and 75 deletions.
93 changes: 67 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ readme = "README.md"
license = "MIT"

[workspace]
members = ["topiary", "topiary-cli", "topiary-queries", "topiary-playground", "topiary-config"]
members = ["topiary", "topiary-cli", "topiary-queries", "topiary-playground", "topiary-config", "topiary-web-tree-sitter-sys", "topiary-tree-sitter-facade"]
default-members = [ "topiary", "topiary-cli" ]
exclude = ["samples"]
resolver = "2"

Expand Down Expand Up @@ -47,20 +48,20 @@ env_logger = "0.10"
futures = "0.3.28"
indoc = "2.0"
itertools = "0.11"
js-sys = "0.3"
log = "0.4"
predicates = "3.0"
pretty_assertions = "1.3"
prettydiff = { version = "0.6.4", default-features = false }
regex = "1.8.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tempfile = "3.5"
test-log = "0.2.11"
test-log = "0.2"
tokio = "1.32"
tokio-test = "0.4"
toml = "0.7"
tree-sitter = "0.20"
tree-sitter-bash = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "1b0321ee85701d5036c334a6f04761cdc672e64c" }
tree-sitter-facade = { git = "https://github.com/tweag/tree-sitter-facade" }
tree-sitter-json = { git = "https://github.com/tree-sitter/tree-sitter-json.git" }
tree-sitter-nickel = { git = "https://github.com/nickel-lang/tree-sitter-nickel", rev = "091b5dcc7d138901bcc162da9409c0bb626c0d27" }
tree-sitter-ocaml = { git = "https://github.com/tree-sitter/tree-sitter-ocaml.git" }
Expand All @@ -70,8 +71,9 @@ tree-sitter-rust = { git = "https://github.com/tree-sitter/tree-sitter-rust.git"
tree-sitter-toml = { git = "https://github.com/tree-sitter/tree-sitter-toml.git" }
unescape = "0.1"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4.34"
web-tree-sitter = { git = "https://github.com/ErinvanderVeen/web-tree-sitter-sys.git", branch = "wasm-bindgen-minor-version", default-features = false, package = "web-tree-sitter-sys" }
wasm-bindgen-futures = "0.4"
wasm-bindgen-test = "0.3"
web-sys = "0.3"

[patch."https://github.com/tweag/web-tree-sitter-sys"]
web-tree-sitter = { git = "https://github.com/ErinvanderVeen/web-tree-sitter-sys.git", branch = "wasm-bindgen-minor-version", package = "web-tree-sitter-sys" }
topiary-web-tree-sitter-sys.path = "./topiary-web-tree-sitter-sys"
topiary-tree-sitter-facade.path = "./topiary-tree-sitter-facade"
2 changes: 2 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ let
"topiary-config"
"topiary-playground"
"topiary-queries"
"topiary-tree-sitter-facade"
"topiary-web-tree-sitter-sys"
];
};

Expand Down
2 changes: 1 addition & 1 deletion topiary-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ toml = { workspace = true }
topiary = { path = "../topiary" }
topiary-config = { path = "../topiary-config" }
topiary-queries = { path = "../topiary-queries" }
tree-sitter-facade = { workspace = true }
topiary-tree-sitter-facade = { workspace = true }

tree-sitter-json = { workspace = true }
tree-sitter-rust = { workspace = true }
Expand Down
31 changes: 14 additions & 17 deletions topiary-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,19 @@ readme.workspace = true
license.workspace = true

[dependencies]
directories = { workspace = true }
indoc = { workspace = true }
itertools = { workspace = true }
log = { workspace = true }
directories.workspace = true
indoc.workspace = true
itertools.workspace = true
log.workspace = true
serde = { workspace = true, features = ["derive"] }
toml = { workspace = true }
toml.workspace = true

tree-sitter-facade = { workspace = true }
tree-sitter-json = { workspace = true }
tree-sitter-rust = { workspace = true }
tree-sitter-toml = { workspace = true }
tree-sitter-bash = { workspace = true }
tree-sitter-nickel = { workspace = true }
tree-sitter-query = { workspace = true }
tree-sitter-ocaml = { workspace = true }
tree-sitter-ocamllex = { workspace = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
web-tree-sitter = { workspace = true, features = ["web"] }
topiary-tree-sitter-facade.workspace = true
tree-sitter-json.workspace = true
tree-sitter-rust.workspace = true
tree-sitter-toml.workspace = true
tree-sitter-bash.workspace = true
tree-sitter-nickel.workspace = true
tree-sitter-query.workspace = true
tree-sitter-ocaml.workspace = true
tree-sitter-ocamllex.workspace = true
6 changes: 3 additions & 3 deletions topiary-config/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub enum TopiaryConfigError {
#[cfg(not(wasm))]
IoError(io::Error),
Missing,
TreeSitterFacade(tree_sitter_facade::LanguageError),
TreeSitterFacade(topiary_tree_sitter_facade::LanguageError),
}

impl fmt::Display for TopiaryConfigError {
Expand Down Expand Up @@ -48,8 +48,8 @@ impl From<io::Error> for TopiaryConfigError {
}
}

impl From<tree_sitter_facade::LanguageError> for TopiaryConfigError {
fn from(e: tree_sitter_facade::LanguageError) -> Self {
impl From<topiary_tree_sitter_facade::LanguageError> for TopiaryConfigError {
fn from(e: topiary_tree_sitter_facade::LanguageError) -> Self {
Self::TreeSitterFacade(e)
}
}
Expand Down
2 changes: 1 addition & 1 deletion topiary-config/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl Language {
}

#[cfg(not(target_arch = "wasm32"))]
pub fn grammar(&self) -> TopiaryConfigResult<tree_sitter_facade::Language> {
pub fn grammar(&self) -> TopiaryConfigResult<topiary_tree_sitter_facade::Language> {
Ok(match self.name.as_str() {
"bash" => tree_sitter_bash::language(),
"json" => tree_sitter_json::language(),
Expand Down
8 changes: 4 additions & 4 deletions topiary-playground/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ crate-type = ["cdylib"]
[dependencies]
topiary = { path = "../topiary" }
topiary-config = { path = "../topiary-config" }
tree-sitter-facade = { workspace = true }
wasm-bindgen = { workspace = true }
wasm-bindgen-futures = { workspace = true }
topiary-tree-sitter-facade.workspace = true
wasm-bindgen.workspace = true
wasm-bindgen-futures.workspace = true

[build-dependencies]
itertools = { workspace = true }
itertools.workspace = true
topiary = { path = "../topiary" }
23 changes: 23 additions & 0 deletions topiary-tree-sitter-facade/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "topiary-tree-sitter-facade"
authors = ["<herringtondarkholme@users.noreply.github.com>"]
license = "Apache-2.0 WITH LLVM-exception"
version.workspace = true
edition.workspace = true
homepage.workspace = true
repository.workspace = true
documentation.workspace = true
readme.workspace = true

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tree-sitter.workspace = true

[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys.workspace = true
wasm-bindgen = { workspace = true, features = ["strict-macro"] }
web-sys.workspace = true
topiary-web-tree-sitter-sys.workspace = true

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-futures.workspace = true
wasm-bindgen-test.workspace = true
1 change: 1 addition & 0 deletions topiary-tree-sitter-facade/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Loading

0 comments on commit 1c0fdc0

Please sign in to comment.