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

Bun is not building the tree-sitter language package #7518

Open
m-paternostro opened this issue Dec 7, 2023 · 3 comments
Open

Bun is not building the tree-sitter language package #7518

m-paternostro opened this issue Dec 7, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@m-paternostro
Copy link

What version of Bun is running?

1.0.15

What platform is your computer?

Darwin 23.1.0 x86_64 i386

What steps can reproduce the bug?

The easiest way to reproduce this issue is to run bun i with the following package.json

{
  "name": "mycoolproject",
  "module": "index.ts",
  "type": "module",
  "scripts": {
    "start": "bun run index.ts"
  },
  "trustedDependencies": [
    "tree-sitter",
    "tree-sitter-java"
  ],
  "dependencies": {
    "tree-sitter": "^0.20.6",
    "tree-sitter-java": "^0.20.2"
  },
  "peerDependencies": {
    "typescript": "^5.3.2"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^6.13.2",
    "@typescript-eslint/parser": "^6.13.2",
    "bun-types": "^1.0.15",
    "eslint-config-prettier": "^9.1.0",
    "eslint-import-resolver-typescript": "^3.6.1",
    "eslint-import-resolver-typescript-bun": "^0.0.66",
    "eslint-plugin-import": "^2.29.0",
    "eslint-plugin-simple-import-sort": "^10.0.0",
    "prettier": "^3.1.0"
  }
}

What is the expected behavior?

Using npm i, the tree-sitter-java module is built and then everything works. More precisely, after the installation with npm, the directory node_modules/tree-sitter-java/build is available.

What do you see instead?

After installing the dependencies with bun i, the node_modules/tree-sitter-java/build is not available, which seems to indicate that the installation has not triggered this module to be built (as it happens with npm). Notice that I have added both modules as trustedDependencies

As a result, the tests that pass with npm fail in bun:

❯ bun test     
bun test v1.0.15 (b3bdf22e)

lib/tests/languages/java/import.test.ts:
error: Cannot find module "../../build/Release/tree_sitter_java_binding" from "/Users/me/mycoolproject/codegraph2/node_modules/tree-sitter-java/bindings/node/index.js"

 0 pass
 1 fail
Ran 1 tests across 1 files. [23.00ms]

Additional information

No response

@m-paternostro m-paternostro added the bug Something isn't working label Dec 7, 2023
@amaanq
Copy link

amaanq commented Feb 16, 2024

doesn't feel like a bun issue, did you actually build the binding with bun install or something like that? The tree_sitter_java_binding is built by node-gyp so you could also just run node-gyp build

@di-sukharev
Copy link

how do you even run this?

when i import tree-sitter bindings and run them in bun context i get this

@nicolasembleton
Copy link

how do you even run this?

when i import tree-sitter bindings and run them in bun context i get this

Yes, I have the same problem. I hope the missing flag gets implemented soon. Would love to get tree-sitter working on Bun. Still need to rely on NodeJS for that specific one.

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

No branches or pull requests

4 participants