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

🐛 @biomejs/js-api not compatible with @biomejs/wasm-nodejs 1.9.0 #3881

Closed
1 task done
ericrafalovsky opened this issue Sep 13, 2024 · 8 comments · Fixed by #4111 or WomB0ComB0/portfolio#159
Closed
1 task done

Comments

@ericrafalovsky
Copy link

Environment information

CLI:
  Version:                      1.9.0
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v21.7.3"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/9.7.0"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              true
  Organize imports disabled:    true
  VCS disabled:                 true

Workspace:
  Open Documents:               0

What happened?

The latest versions of biomejs/js-api (0.6.2) and @biomejs/wasm-nodejs (1.9.0) appear to be incompatible.

When trying an example similar to that in the README

import { Biome, Distribution } from "@biomejs/js-api";

Biome.create({
	distribution: Distribution.NODE, 
}).then(biome => {
    const formatted = biome.formatContent("function f   (a, b) { return a == b; }", {
        filePath: "example.js",
    });
})

it crashes with an error of the form: Error: missing field kind. This does not happen with @biomejs/wasm-nodejs 1.8.3. and appears to be a compatibility issue.

I see that biomejs/js-api "is currently in alpha" and perhaps it's expected for it to not be compatible with the latest releases of @biomejs/wasm-nodejs / @biomejs/biome?

Expected result

It should not throw an error

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@sleewoo
Copy link

sleewoo commented Sep 14, 2024

though biomejs/js-api currently in alpha, it worked pretty well last couple months.
sadly broken with 1.9.0 release

@pnodet
Copy link
Contributor

pnodet commented Sep 21, 2024

Running into this issue as well.

Can it be improved by having a CI release the biomejs/js-api package when other pkg are released?

@dyc3
Copy link
Contributor

dyc3 commented Sep 21, 2024

I think the main problem is that we don't have any integration tests for it. PRs welcome.

@axetroy
Copy link

axetroy commented Sep 22, 2024

Is there any temporary solution for this before a new version is released with a fix? (Not downgrade)

@dyc3
Copy link
Contributor

dyc3 commented Sep 22, 2024

Sorry, I don't think so. You are welcome to help improve the situation though.

@sleewoo
Copy link

sleewoo commented Oct 1, 2024

@ematipico thanks for fix.
but still getting same error

@ericrafalovsky did you test with latest release 1.9.3?

WasmError
    at Function.fromError (node_modules/.pnpm/@biomejs+js-api@0.6.2_@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/js-api/src/wasm.ts:75:10)
    at wrapError (node_modules/.pnpm/@biomejs+js-api@0.6.2_@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/js-api/src/wasm.ts:85:19)
    at Biome.tryCatchWrapper (node_modules/.pnpm/@biomejs+js-api@0.6.2_@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/js-api/src/index.ts:149:19)
    at Biome.withFile (node_modules/.pnpm/@biomejs+js-api@0.6.2_@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/js-api/src/index.ts:158:15)
    at Biome.formatContent (node_modules/.pnpm/@biomejs+js-api@0.6.2_@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/js-api/src/index.ts:195:15)
    at formatSourceCode (packages/dev-utils/src/format.ts:16:13)
    at renderWithFormat (packages/dev-utils/src/render.ts:23:10)
    at worker (packages/dev-utils/src/file-generator.ts:48:21)
    at generateFile (packages/dev-utils/src/file-generator.ts:73:13)
    at typesGenerator (packages/pgxt-cli/src/plugins/types/index.ts:30:15) {
  stackTrace: Error: Error: missing field `kind`
      at module.exports.__wbg_new_796382978dfd4fb0 (node_modules/.pnpm/@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/wasm-nodejs/biome_wasm.js:907:17)
      at wasm://wasm/035fb09e:wasm-function[12718]:0xb0dabf
      at wasm://wasm/035fb09e:wasm-function[7538]:0x9f2591
      at wasm://wasm/035fb09e:wasm-function[3113]:0x76da64
      at Workspace.openFile (node_modules/.pnpm/@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/wasm-nodejs/biome_wasm.js:382:18)
      at <anonymous> (node_modules/.pnpm/@biomejs+js-api@0.6.2_@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/js-api/src/index.ts:163:19)
      at Biome.tryCatchWrapper (node_modules/.pnpm/@biomejs+js-api@0.6.2_@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/js-api/src/index.ts:147:11)
      at Biome.withFile (node_modules/.pnpm/@biomejs+js-api@0.6.2_@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/js-api/src/index.ts:158:15)
      at Biome.formatContent (node_modules/.pnpm/@biomejs+js-api@0.6.2_@biomejs+wasm-nodejs@1.9.3/node_modules/@biomejs/js-api/src/index.ts:195:15)
      at formatSourceCode (packages/dev-utils/src/format.ts:16:13)

@ematipico
Copy link
Member

This hasn't bee released yet

@sleewoo
Copy link

sleewoo commented Oct 18, 2024

this is fixed now,
thanks

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