Skip to content

Commit 44ed25a

Browse files
deps: update cjs-module-lexer to 2.1.1
PR-URL: #60646 Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 4a868fd commit 44ed25a

File tree

11 files changed

+26
-15
lines changed

11 files changed

+26
-15
lines changed

β€Ždeps/cjs-module-lexer/dist/lexer.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždeps/cjs-module-lexer/dist/lexer.mjsβ€Ž

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

β€Ždeps/cjs-module-lexer/lexer.jsβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ function parseSource (cjsSource) {
137137
pos += 4;
138138
if (source.charCodeAt(pos) === 40/*(*/) {
139139
openTokenPosStack[openTokenDepth++] = lastTokenPos;
140-
if (source.charCodeAt(++pos) === 114/*r*/)
140+
if (source.charCodeAt(pos + 1) === 114/*r*/) {
141+
pos++;
141142
tryParseRequire(ExportStar);
143+
}
142144
}
143145
}
144146
lastTokenPos = pos;
@@ -288,7 +290,7 @@ function tryBacktrackAddStarExportBinding (bPos) {
288290

289291
// `Object.` `prototype.`? hasOwnProperty.call(` IDENTIFIER `, ` IDENTIFIER$2 `)`
290292
function tryParseObjectHasOwnProperty (it_id) {
291-
ch = commentWhitespace();
293+
let ch = commentWhitespace();
292294
if (ch !== 79/*O*/ || !source.startsWith('bject', pos + 1)) return false;
293295
pos += 6;
294296
ch = commentWhitespace();

β€Ždeps/cjs-module-lexer/src/Makefileβ€Ž

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
WASM2WAT := ../wabt/bin/wasm2wat
2-
WASM_OPT := ../binaryen/bin/wasm-opt
1+
WASM2WAT ?= ../wabt/bin/wasm2wat
2+
WASM_OPT ?= ../binaryen/bin/wasm-opt
33

44
.PHONY: optimize clean
55

@@ -12,5 +12,8 @@ lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c | lib/
1212
lib/:
1313
@mkdir -p $@
1414

15+
optimize: lib/lexer.wasm
16+
$(WASM_OPT) -Oz --enable-bulk-memory --strip-debug lib/lexer.wasm -o lib/lexer.wasm
17+
1518
clean:
1619
$(RM) lib/*

β€Ždeps/cjs-module-lexer/src/build/wasm.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const WASM_BUILDER_CONTAINER = 'ghcr.io/nodejs/wasm-builder@sha256:975f391d907e42a75b8c72eb77c782181e941608687d4d8694c3e9df415a0970' // v0.0.9
44

5-
const WASM_OPT = './wasm-opt'
5+
const WASM_OPT = process.env.WASM_OPT || './wasm-opt'
66

77
const { execSync } = require('node:child_process')
88
const { writeFileSync, readFileSync, existsSync, mkdirSync } = require('node:fs')

β€Ždeps/cjs-module-lexer/src/lexer.jsβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ function parseSource (cjsSource) {
137137
pos += 4;
138138
if (source.charCodeAt(pos) === 40/*(*/) {
139139
openTokenPosStack[openTokenDepth++] = lastTokenPos;
140-
if (source.charCodeAt(++pos) === 114/*r*/)
140+
if (source.charCodeAt(pos + 1) === 114/*r*/) {
141+
pos++;
141142
tryParseRequire(ExportStar);
143+
}
142144
}
143145
}
144146
lastTokenPos = pos;
@@ -288,7 +290,7 @@ function tryBacktrackAddStarExportBinding (bPos) {
288290

289291
// `Object.` `prototype.`? hasOwnProperty.call(` IDENTIFIER `, ` IDENTIFIER$2 `)`
290292
function tryParseObjectHasOwnProperty (it_id) {
291-
ch = commentWhitespace();
293+
let ch = commentWhitespace();
292294
if (ch !== 79/*O*/ || !source.startsWith('bject', pos + 1)) return false;
293295
pos += 6;
294296
ch = commentWhitespace();
0 Bytes
Binary file not shown.

β€Ždeps/cjs-module-lexer/src/package-lock.jsonβ€Ž

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždeps/cjs-module-lexer/src/package.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cjs-module-lexer",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "Lexes CommonJS modules, returning their named exports metadata",
55
"main": "lexer.js",
66
"exports": {

β€Ždeps/cjs-module-lexer/src/src/lexer.cβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@ uint32_t parseCJS (uint16_t* _source, uint32_t _sourceLen, void (*_addExport)(co
120120
pos += 4;
121121
if (*pos == '(') {
122122
openTokenPosStack[openTokenDepth++] = lastTokenPos;
123-
if (*(++pos) == 'r')
123+
if (*(pos + 1) == 'r') {
124+
pos++;
124125
tryParseRequire(ExportStar);
126+
}
125127
}
126128
}
127129
lastTokenPos = pos;

0 commit comments

Comments
Β (0)