feat(install): remove node requirement

* supported parsers _must_ commit at least `grammar.json`
* set `TREE_SITTER_JS_RUNTIME=native` when generating parser to use
  built-in quickjs instead of node (requires tree-sitter 0.26)
This commit is contained in:
Christian Clason 2025-10-29 18:36:39 +01:00 committed by Christian Clason
parent a3b489680f
commit fd2880e8bc
6 changed files with 337 additions and 351 deletions

View file

@ -65,15 +65,6 @@ local function install_health()
end
end
do -- node check
local node = check_exe('node')
if node then
health.ok(string.format('node %s (%s)', node.version, node.path))
else
health.error('node not found')
end
end
do -- curl+tar check
local tar = check_exe('tar')
if tar then

View file

@ -182,7 +182,7 @@ local function do_generate(logger, repo, compile_location)
'--abi',
tostring(vim.treesitter.language_version),
from_json and 'src/grammar.json' or nil,
}, { cwd = compile_location })
}, { cwd = compile_location, env = { TREE_SITTER_JS_RUNTIME = 'native' } })
if r.code > 0 then
return logger:error('Error during "tree-sitter generate": %s', r.stderr)
end