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

module: cjs-module-lexer@0.4.2 big endian fix #35634

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/cjs-module-lexer/dist/lexer.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/cjs-module-lexer/dist/lexer.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deps/cjs-module-lexer/package.json
@@ -1,6 +1,6 @@
{
"name": "cjs-module-lexer",
"version": "0.4.0",
"version": "0.4.2",
"description": "Lexes CommonJS modules, returning their named exports metadata",
"main": "lexer.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion doc/api/esm.md
Expand Up @@ -1282,7 +1282,7 @@ success!
[`transformSource` hook]: #esm_transformsource_source_context_defaulttransformsource
[`string`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
[`util.TextDecoder`]: util.md#util_class_util_textdecoder
[cjs-module-lexer]: https://github.com/guybedford/cjs-module-lexer/tree/0.4.0
[cjs-module-lexer]: https://github.com/guybedford/cjs-module-lexer/tree/0.4.2
[special scheme]: https://url.spec.whatwg.org/#special-scheme
[the official standard format]: https://tc39.github.io/ecma262/#sec-modules
[transpiler loader example]: #esm_transpiler_loader
14 changes: 4 additions & 10 deletions lib/internal/modules/esm/translators.js
Expand Up @@ -60,20 +60,14 @@ const { emitWarningSync } = require('internal/process/warning');

let cjsParse;
async function initCJSParse() {
if (typeof WebAssembly !== 'undefined') {
if (typeof WebAssembly === 'undefined') {
cjsParse = require('internal/deps/cjs-module-lexer/lexer');
} else {
const { parse, init } =
require('internal/deps/cjs-module-lexer/dist/lexer');
await init();
let exports;
try {
({ exports } = parse('exports.a=1'));
if (exports.length === 1) {
cjsParse = parse;
return;
}
} catch {}
cjsParse = parse;
}
cjsParse = require('internal/deps/cjs-module-lexer/lexer');
}

const translators = new SafeMap();
Expand Down