Skip to content

fix(parser-adapter-yaml-1-2): use WebTreeSitter for Node.js lexical analysis#5139

Open
glowcloud wants to merge 3 commits intomainfrom
fix/swg-18591--nodejs-lexical-analysis
Open

fix(parser-adapter-yaml-1-2): use WebTreeSitter for Node.js lexical analysis#5139
glowcloud wants to merge 3 commits intomainfrom
fix/swg-18591--nodejs-lexical-analysis

Conversation

@glowcloud
Copy link
Contributor

@glowcloud glowcloud commented Mar 18, 2026

Fixes an issue where using ApiDOM in non-browser environments would still cause the error fixed in #5045 by switching to using web-tree-sitter instead of tree-sitter in Node.js adapter.

Note that this could have a negative impact on performance in Node.js environments, at least from taking a look at the documentation for web-tree-sitter:
web-tree-sitter

TODO:

  • fix an issue with import.meta.url in CommonJS modules

@glowcloud glowcloud self-assigned this Mar 18, 2026
@glowcloud glowcloud added the bug Something isn't working label Mar 18, 2026
@glowcloud glowcloud marked this pull request as ready for review March 19, 2026 07:04
// acquire lock
parserInitLock = Parser.init()
.then(() => Parser.Language.load(treeSitterYaml))
.then((jsonLanguage) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.then((jsonLanguage) => {
.then((yamlLanguage) => {

Comment on lines +28 to +32
} else if (parser === null) {
throw new ApiDOMError(
'Error while initializing web-tree-sitter and loading tree-sitter-yaml grammar.',
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this statement be reached?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants