diff options
author | Luca Casonato <hello@lcas.dev> | 2024-06-08 18:36:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-08 18:36:13 +0200 |
commit | c1f23c578881b85ae79b524a60160d8f4fb7151b (patch) | |
tree | c6c945fb4b42cd4ac6fae7135c7ad1039630a34e /tests/specs/npm/lossy_utf8_script_from_cjs/main.mjs | |
parent | 22d34f7012c48a25435b38c0c306085c614bbea7 (diff) |
fix(ext/node): lossy UTF-8 read node_modules files (#24140)
Previously various reads of files in `node_modules` would error on
invalid UTF-8. These were cases involving:
- reading package.json from Rust
- reading package.json from JS
- reading CommonJS files from JS
- reading CommonJS files from Rust (for ESM translation)
- reading ESM files from Rust
Diffstat (limited to 'tests/specs/npm/lossy_utf8_script_from_cjs/main.mjs')
-rw-r--r-- | tests/specs/npm/lossy_utf8_script_from_cjs/main.mjs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/specs/npm/lossy_utf8_script_from_cjs/main.mjs b/tests/specs/npm/lossy_utf8_script_from_cjs/main.mjs new file mode 100644 index 000000000..a9e70adfb --- /dev/null +++ b/tests/specs/npm/lossy_utf8_script_from_cjs/main.mjs @@ -0,0 +1,10 @@ +import { createRequire } from "node:module"; + +// Import this so that deno_graph knows to download this file. +if (false) import("npm:@denotest/lossy-utf8-script@1.0.0"); + +const require = createRequire(import.meta.url); + +const mod = require("@denotest/lossy-utf8-script"); + +console.log(mod); |