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

Some node api may be broken in 1.44.2 ? #24209

Closed
Xuhv opened this issue Jun 14, 2024 · 1 comment · Fixed by #24220
Closed

Some node api may be broken in 1.44.2 ? #24209

Xuhv opened this issue Jun 14, 2024 · 1 comment · Fixed by #24220
Assignees
Labels
needs investigation requires further investigation before determining if it is an issue or not node native extension related to the node-api (.node)

Comments

@Xuhv
Copy link

Xuhv commented Jun 14, 2024

Version: Deno 1.44.2

I have some code like this

import { Features, transform } from "npm:lightningcss@1.24.1";

console.log(transform({
    filename: "x.ts",
    cssModules: true,
    code: new TextEncoder().encode(`.X { color: red; }`),
    include: Features.Nesting,
}));

With deno 1.44.1 and before, it works fine. but with 1.44.2, it throws an error

error: Uncaught (in promise) Error
console.log(transform({
            ^

lightningcss is a native library written in rust, so I guess the problem is related to node api.

@lucacasonato lucacasonato added needs investigation requires further investigation before determining if it is an issue or not node native extension related to the node-api (.node) labels Jun 14, 2024
@devsnek
Copy link
Member

devsnek commented Jun 15, 2024

@Xuhv it looks like you'll need to use Buffer.from() for the code data you're passing. I'll work on getting a better fix for this into the next patch release.

sbmsr pushed a commit to sbmsr/deno-1 that referenced this issue Jul 2, 2024
- add fallback impls of external string apis which always copy. after
upstream changes to rusty_v8 we can support non-copying api as well.
- `napi_get_buffer_data` needs to work on all TypedArray instances.
  - Fixes: denoland#24209
- `target_defaults.default_configuration` is used by some modules to
find the corresponding node file from node-gyp
- `node_api_get_module_filename` expects the filename to be a `file:`
url.
zebreus pushed a commit to zebreus/deno that referenced this issue Jul 8, 2024
- add fallback impls of external string apis which always copy. after
upstream changes to rusty_v8 we can support non-copying api as well.
- `napi_get_buffer_data` needs to work on all TypedArray instances.
  - Fixes: denoland#24209
- `target_defaults.default_configuration` is used by some modules to
find the corresponding node file from node-gyp
- `node_api_get_module_filename` expects the filename to be a `file:`
url.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs investigation requires further investigation before determining if it is an issue or not node native extension related to the node-api (.node)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants