feat(install)!: generate from json instead of requiring node

Problem: Many parsers require node/npm to evaluate the `grammar.js`
before being able to generate a parser from it.

Solution: Generate from `grammar.json` instead, which is fully resolved.
Drops `node` and `npm` as (optional) requirements for nvim-treesitter.

Note that this requires parsers to commit the generated json iff the
grammar requires evaluation (which is currently the case for all tracked
languages).
This commit is contained in:
Christian Clason 2024-04-18 09:44:38 +02:00
parent 943a91baf3
commit 6d3a9b6ebd
10 changed files with 502 additions and 484 deletions

View file

@ -37,16 +37,8 @@ local function install_health()
)
end
if vim.fn.executable('node') == 0 then
health.warn('`node` executable not found (only needed for `:TSInstallFromGrammar`.')
else
local result = assert(vim.system({ 'node', '--version' }):wait().stdout)
local version = vim.split(result, '\n')[1]
health.ok('`node` found ' .. version .. ' (only needed for `:TSInstallFromGrammar`)')
end
if vim.fn.executable('git') == 0 then
health.error(
health.warn(
'`git` executable not found.',
'Install it with your package manager and check that your `$PATH` is set correctly.'
)