build(loader): make dependencies optional (#1638)

The `tree-sitter-loader` crate currently always pulls
`tree-sitter-highlight` and `tree-sitter-tags` as dependencies.
However, apart from the tree-sitter CLI, most clients will not need both
of these libraries.

This commit makes the dependencies optional, but still includes them by
default in order not to break the backward compatibility.
This commit is contained in:
Guillaume Bertholon 2024-07-28 09:59:21 +02:00 committed by GitHub
parent 76456919ae
commit 1c7b518b9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 51 additions and 13 deletions

View file

@ -14,6 +14,9 @@ categories.workspace = true
[features]
wasm = ["tree-sitter/wasm"]
# TODO: For backward compatibility these must be enabled by default,
# consider removing for the next semver incompatible release
default = ["tree-sitter-highlight", "tree-sitter-tags"]
[dependencies]
anyhow.workspace = true
@ -28,6 +31,6 @@ serde.workspace = true
serde_json.workspace = true
tempfile.workspace = true
tree-sitter.workspace = true
tree-sitter-highlight.workspace = true
tree-sitter-tags.workspace = true
tree-sitter = {workspace = true}
tree-sitter-highlight = {workspace = true, optional = true}
tree-sitter-tags = {workspace = true, optional = true}