FS#71160 - [tree-sitter] nodejs and clang/gcc should be optional dependencies

Attached to Project: Community Packages
Opened by Douglas Creager (dcreager) - Monday, 07 June 2021, 14:58 GMT
Last edited by Daniel M. Capella (polyzen) - Wednesday, 17 May 2023, 05:35 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Daniel M. Capella (polyzen)
Filipe Laíns (FFY00)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The tree-sitter package installs the `tree-sitter` command-line program, which contains several useful subcommands for writing and using programming language parsers. Some of these subcommands have additional dependencies [1], which are not currently listed in tree-sitter's Arch package.

[1] https://tree-sitter.github.io/tree-sitter/creating-parsers#dependencies

The `tree-sitter generate` subcommand generates the C implementation of a particular language's parser from its grammar definition. The grammars are written in a JavaScript DSL, and this subcommand shells out to `node` to execute the DSL. Per the documentation, nodejs >= 6.0 is needed. (No additional JS packages are required, just the node runtime.)

Several subcommands (including `tree-sitter parse` and `tree-sitter tags`) look for grammar definitions in a user-configurable location, and will generate and compile the grammars on the fly if needed. This requires a C compiler. Is there a generic "C compiler" pseudo-package that we could list as a dependency? If not we could list gcc and/or clang specifically.

In all of the above, the tree-sitter command should fail gracefully if the required programs are not available, which suggests that these should all be listed as optional dependencies.

This task depends upon

Closed by  Daniel M. Capella (polyzen)
Wednesday, 17 May 2023, 05:35 GMT
Reason for closing:  Implemented
Additional comments about closing:  nodejs optdep added in 0.20.8-3
Comment by Daniel M. Capella (polyzen) - Friday, 12 May 2023, 06:25 GMT Comment by Daniel M. Capella (polyzen) - Wednesday, 17 May 2023, 05:23 GMT
Considering the package currently already depends on gcc-libs, I don't know if it's worth adding a clang optdep.