- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3.5k
 
Open
Labels
bugSomething isn't workingSomething isn't workingnapiCompatibility with the native layer of Node.jsCompatibility with the native layer of Node.jsnode.jsCompatibility with Node.js APIsCompatibility with Node.js APIs
Description
What version of Bun is running?
0.7.4
What platform is your computer?
Linux 6.4.10-zen2-1-zen x86_64 unknown
What steps can reproduce the bug?
Create empty project, install both tree-sitter and tree-sitter-javascript with npm
type this into index.ts
const Parser = require('tree-sitter');
const JavaScript = require('tree-sitter-javascript');
const parser = new Parser();
parser.setLanguage(JavaScript);
const sourceCode = 'let x = 1; console.log(x);';
const tree = parser.parse(sourceCode);
console.log(tree.rootNode.toString());run the file
What is the expected behavior?
When executed with node on index.cjs
(program (lexical_declaration (variable_declarator name: (identifier) value: (number))) (expression_statement (call_expression function: (member_expression object: (identifier) property: (p roperty_identifier)) arguments: (arguments (identifier)))))
What do you see instead?
1 | (function (id){"use strict";var cached=@requireMap.@get(id);const last5=id.substring(id.length-5);if(cached)return cached.exports;if(last5===".json"){var fs=globalThis[Symbol.for("_fs")
]||[email protected](),exports=JSON.parse(fs.readFileSync(id,"utf8"));return @requireMap.@set(id,@createCommonJSModule(id,exports,!0)),exports}else if(last5===".node"){const module=@createCommonJSMo
dule(id,{},!0);return process.dlopen(module,id),@requireMap.@set(id,module),module.exports}else if(last5===".toml"){var fs=globalThis[Symbol.for("_fs")]||[email protected](),[email protected](
fs.readFileSync(id,"utf8"));return @requireMap.@set(id,@createCommonJSModule(id,exports,!0)),exports}else{var exports=@requireESM(id);const cachedModule=@requireMap.@get(id);if(cachedModule
)return cachedModule.exports;return @requireMap.@set(id,@createCommonJSModule(id,exports,!0)),exports}})
                       ^
TypeError: /home/jani/tests/node_modules/tree-sitter/build/Release/tree_sitter_runtime_binding.node: undefined symbol: _ZN2v812BackingStore12EmptyDeleterEPvmS1_
      at internalRequire (:1:20)
      at /home/jani/tests/node_modules/tree-sitter/index.js:3:2
      at globalThis (/home/jani/tests/node_modules/tree-sitter/index.js:708:28)
      at require (:1:20)
      at /home/jani/tests/index.ts:1:6
      at globalThis (/home/jani/tests/index.ts:10:36)
Additional information
No response
bconnorwhite, eliellis and youssefhussein
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingnapiCompatibility with the native layer of Node.jsCompatibility with the native layer of Node.jsnode.jsCompatibility with Node.js APIsCompatibility with Node.js APIs