Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(bindings)!: convert node bindings to NAPI #3077

Merged
merged 7 commits into from Feb 27, 2024

Conversation

segevfiner
Copy link
Contributor

This is a breaking change that accompanys tree-sitter/node-tree-sitter#190 and should only be merged along with it, with a proper strategy for how to update languages.

We need to consider how we are going to release such a thing as language authors will have to know to regenarate or modify those files...

@ObserverOfTime
Copy link
Member

ObserverOfTime commented Feb 25, 2024

Rust and Python will also have breaking changes soon, so it's fine to break Node as well.
Keep in mind that you will have to rebase once #2438 is merged since it also edits the bindings.

One question: how would binding.cc look like for multi-language parsers (e.g. typescript)?

@segevfiner
Copy link
Contributor Author

Just Object::New and do the same, and just set those objects on exports, instead of directly treating exports as a language. exports is just a plain object and is there for convenience and you can really return anything.

@ObserverOfTime ObserverOfTime changed the title Convert language bindings to NAPI refactor(bindings)!: convert node bindings to NAPI Feb 26, 2024
Co-authored-by: Boris Verkhovskiy <boris.verk@gmail.com>
Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
@amaanq amaanq merged commit e87cf7e into tree-sitter:master Feb 27, 2024
12 of 13 checks passed
@github-actions github-actions bot removed the request for review from ObserverOfTime February 27, 2024 22:06
@amaanq
Copy link
Member

amaanq commented Feb 27, 2024

thanks @segevfiner, I'll try and help out/review the PR in node-ts as well

@segevfiner
Copy link
Contributor Author

Just note that as it stands this will only work with node-tree-sitter with that PR merged as there is no backwards or forwards compatibility in place. So be sure to merge it before releasing this.

@amaanq
Copy link
Member

amaanq commented Feb 27, 2024

Yeah I know, we're not gonna have a release until then

@ObserverOfTime
Copy link
Member

Just note that as it stands this will only work with node-tree-sitter with that PR merged as there is no backwards or forwards compatibility in place.

I did add forwards compatibility. The CLI will replace the old bindings with the new ones.

@segevfiner
Copy link
Contributor Author

I mean for importing the grammars in the node bindings. The non-napi node bindings can't import napi grammars and vice versa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants