thread-language 0.1.1

Language definitions and parsers for Thread
Documentation
# SPDX-FileCopyrightText: 2025 Knitli Inc. <knitli@knit.li>
# SPDX-FileContributor: Adam Poulemanos <adam@knit.li>
# SPDX-License-Identifier: MIT OR Apache-2.0

[package]
name = "thread-language"
version = "0.1.1"
edition.workspace = true
rust-version.workspace = true
description = "Language definitions and parsers for Thread"
readme = "README.md"
repository.workspace = true
license = "AGPL-3.0-or-later AND MIT"
keywords = ["ast", "codemod", "languages"]
categories.workspace = true
include.workspace = true

[[bench]]
harness = false
name = "performance"

[[bench]]
harness = false
name = "extension_matching"

[[bench]]
harness = false
name = "performance_improvements"

[dependencies]
aho-corasick = { workspace = true }
cfg-if = { workspace = true }
ignore = { workspace = true }
mimalloc = { workspace = true, optional = true }
serde = { workspace = true }
thread-ast-engine = { workspace = true }
thread-utilities = { workspace = true, default-features = false, features = [
  "hashers",
] }
tree-sitter = { workspace = true }
tree-sitter-bash = { version = "0.25.0", optional = true }
tree-sitter-c = { version = "0.24.1", optional = true }
tree-sitter-c-sharp = { version = "0.23.1", optional = true }
tree-sitter-cpp = { version = "0.23.4", optional = true }
tree-sitter-css = { version = "0.25.0", optional = true }
tree-sitter-elixir = { version = "0.3.4", optional = true }
tree-sitter-go = { version = "0.25.0", optional = true }
tree-sitter-haskell = { version = "0.23.1", optional = true }
tree-sitter-hcl = { version = "1.1.0", optional = true }
tree-sitter-html = { version = "0.23.2", optional = true }
tree-sitter-java = { version = "0.23.5", optional = true }
tree-sitter-javascript = { version = "0.25.0", optional = true }
tree-sitter-json = { version = "0.24.8", optional = true }
tree-sitter-kotlin = { package = "tree-sitter-kotlin-sg", version = "0.4.0", optional = true }
tree-sitter-lua = { version = "0.4.1", optional = true }
tree-sitter-nix = { version = "0.3.0", optional = true }
tree-sitter-php = { version = "0.24.2", optional = true }
tree-sitter-python = { version = "0.25.0", optional = true }
tree-sitter-ruby = { version = "0.23.1", optional = true }
tree-sitter-rust = { version = "0.24.0", optional = true }
tree-sitter-scala = { version = "0.24.0", optional = true }
tree-sitter-solidity = { version = "1.2.13", optional = true }
tree-sitter-swift = { version = "0.7.1", optional = true }
tree-sitter-typescript = { version = "0.23.2", optional = true }
tree-sitter-yaml = { version = "0.7.1", optional = true }

[dev-dependencies]
criterion = { version = "0.8.2", features = ["html_reports"] }
thread-ast-engine = { workspace = true, features = ["matching", "parsing"] }

[build-dependencies]
cc = "1.2.30"

[features]
default = ["all-parsers", "mimalloc", "tree-sitter-parsing"]
#! Important: `all-parsers` feature enables all tree-sitter parsers
# Language groups
all-parsers = [
  "bash",
  "c",
  "cpp",
  "csharp",
  "css",
  "elixir",
  "go",
  "haskell",
  "hcl",
  "html",
  "html-embedded",
  "java",
  "javascript",
  "json",
  "kotlin",
  "lua",
  "nix",
  "php",
  "python",
  "ruby",
  "rust",
  "scala",
  "solidity",
  "swift",
  "tree-sitter-parsing",
  "tsx",
  "typescript",
  "yaml",
]
# Individual language features
bash = ["tree-sitter-bash", "tree-sitter-parsing"]
c = ["tree-sitter-c", "tree-sitter-parsing"]
cpp = ["tree-sitter-cpp", "tree-sitter-parsing"]
csharp = ["tree-sitter-c-sharp", "tree-sitter-parsing"]
css = ["tree-sitter-css", "tree-sitter-parsing"]
css-napi = ["napi-environment", "tree-sitter-css"]
elixir = ["tree-sitter-elixir", "tree-sitter-parsing"]
go = ["tree-sitter-go", "tree-sitter-parsing"]
haskell = ["tree-sitter-haskell", "tree-sitter-parsing"]
hcl = ["tree-sitter-hcl", "tree-sitter-parsing"]
html = ["tree-sitter-html", "tree-sitter-parsing"]
html-embedded = [
  "css",
  "html",
  "javascript",
  "matching",
  "tree-sitter-parsing",
  "tsx",
  "typescript"
]
html-napi = ["napi-environment", "tree-sitter-html"]
java = ["tree-sitter-java", "tree-sitter-parsing"]
javascript = ["tree-sitter-javascript", "tree-sitter-parsing"]
javascript-napi = ["napi-environment", "tree-sitter-javascript"]
json = ["tree-sitter-json", "tree-sitter-parsing"]
kotlin = ["tree-sitter-kotlin", "tree-sitter-parsing"]
lua = ["tree-sitter-lua", "tree-sitter-parsing"]
matching = ["thread-ast-engine/matching", "tree-sitter-parsing"]
mimalloc = ["dep:mimalloc"]
napi-compatible = [
  "css-napi",
  "html-napi",
  "javascript-napi",
  "tsx-napi",
  "typescript-napi",
]
# =============== Important NAPI Information ============
# Thread does **not** currently support NAPI builds.
# We've included this from our fork of `ast-grep-language`, in case someone wants to build from it.
# We may eventually add the capability, but it's not currently planned.
# Pull requests welcome.
#! Important: `napi-environment` feature disables the tree-sitter parser
#! Tree-sitter cannot build for NAPI-WASM
#! (that's Node API -- wasm for nodejs environments)
napi-environment = []
nix = ["tree-sitter-nix", "tree-sitter-parsing"]
no-enabled-langs = []
php = ["tree-sitter-parsing", "tree-sitter-php"]
profiling = []
python = ["tree-sitter-parsing", "tree-sitter-python"]
ruby = ["tree-sitter-parsing", "tree-sitter-ruby"]
rust = ["tree-sitter-parsing", "tree-sitter-rust"]
scala = ["tree-sitter-parsing", "tree-sitter-scala"]
solidity = ["tree-sitter-parsing", "tree-sitter-solidity"]
swift = ["tree-sitter-parsing", "tree-sitter-swift"]
tree-sitter-parsing = ["thread-ast-engine/parsing"]
tsx = ["tree-sitter-parsing", "tree-sitter-typescript"]
tsx-napi = ["napi-environment", "tree-sitter-typescript"]
typescript = ["tree-sitter-parsing", "tree-sitter-typescript"]
typescript-napi = ["napi-environment", "tree-sitter-typescript"]
worker = ["thread-ast-engine/worker", "thread-utilities/worker"]
yaml = ["tree-sitter-parsing", "tree-sitter-yaml"]