deps: update cjs-module-lexer to 2.1.1

PR-URL: https://github.com/nodejs/node/pull/60646
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Node.js GitHub Bot 2025-11-15 08:35:49 +00:00 committed by GitHub
parent 4a868fd9c5
commit 44ed25a94b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 26 additions and 15 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -137,8 +137,10 @@ function parseSource (cjsSource) {
pos += 4;
if (source.charCodeAt(pos) === 40/*(*/) {
openTokenPosStack[openTokenDepth++] = lastTokenPos;
if (source.charCodeAt(++pos) === 114/*r*/)
if (source.charCodeAt(pos + 1) === 114/*r*/) {
pos++;
tryParseRequire(ExportStar);
}
}
}
lastTokenPos = pos;
@ -288,7 +290,7 @@ function tryBacktrackAddStarExportBinding (bPos) {
// `Object.` `prototype.`? hasOwnProperty.call(` IDENTIFIER `, ` IDENTIFIER$2 `)`
function tryParseObjectHasOwnProperty (it_id) {
ch = commentWhitespace();
let ch = commentWhitespace();
if (ch !== 79/*O*/ || !source.startsWith('bject', pos + 1)) return false;
pos += 6;
ch = commentWhitespace();

View File

@ -1,5 +1,5 @@
WASM2WAT := ../wabt/bin/wasm2wat
WASM_OPT := ../binaryen/bin/wasm-opt
WASM2WAT ?= ../wabt/bin/wasm2wat
WASM_OPT ?= ../binaryen/bin/wasm-opt
.PHONY: optimize clean
@ -12,5 +12,8 @@ lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c | lib/
lib/:
@mkdir -p $@
optimize: lib/lexer.wasm
$(WASM_OPT) -Oz --enable-bulk-memory --strip-debug lib/lexer.wasm -o lib/lexer.wasm
clean:
$(RM) lib/*

View File

@ -2,7 +2,7 @@
const WASM_BUILDER_CONTAINER = 'ghcr.io/nodejs/wasm-builder@sha256:975f391d907e42a75b8c72eb77c782181e941608687d4d8694c3e9df415a0970' // v0.0.9
const WASM_OPT = './wasm-opt'
const WASM_OPT = process.env.WASM_OPT || './wasm-opt'
const { execSync } = require('node:child_process')
const { writeFileSync, readFileSync, existsSync, mkdirSync } = require('node:fs')

View File

@ -137,8 +137,10 @@ function parseSource (cjsSource) {
pos += 4;
if (source.charCodeAt(pos) === 40/*(*/) {
openTokenPosStack[openTokenDepth++] = lastTokenPos;
if (source.charCodeAt(++pos) === 114/*r*/)
if (source.charCodeAt(pos + 1) === 114/*r*/) {
pos++;
tryParseRequire(ExportStar);
}
}
}
lastTokenPos = pos;
@ -288,7 +290,7 @@ function tryBacktrackAddStarExportBinding (bPos) {
// `Object.` `prototype.`? hasOwnProperty.call(` IDENTIFIER `, ` IDENTIFIER$2 `)`
function tryParseObjectHasOwnProperty (it_id) {
ch = commentWhitespace();
let ch = commentWhitespace();
if (ch !== 79/*O*/ || !source.startsWith('bject', pos + 1)) return false;
pos += 6;
ch = commentWhitespace();

Binary file not shown.

View File

@ -1,12 +1,12 @@
{
"name": "cjs-module-lexer",
"version": "2.1.0",
"version": "2.1.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cjs-module-lexer",
"version": "2.1.0",
"version": "2.1.1",
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.5.5",
@ -86,6 +86,7 @@
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.5.tgz",
"integrity": "sha512-SBuTAjg91A3eKOvD+bPEz3LlhHZRNu1nFOVts9lzDJTXshHTjII0BAtDS3Y2DAkdZdDKWVZGVwkDfc4Clxn1dg==",
"dev": true,
"peer": true,
"dependencies": {
"@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.22.5",
@ -554,6 +555,7 @@
"url": "https://github.com/sponsors/ai"
}
],
"peer": true,
"dependencies": {
"caniuse-lite": "^1.0.30001489",
"electron-to-chromium": "^1.4.411",

View File

@ -1,6 +1,6 @@
{
"name": "cjs-module-lexer",
"version": "2.1.0",
"version": "2.1.1",
"description": "Lexes CommonJS modules, returning their named exports metadata",
"main": "lexer.js",
"exports": {

View File

@ -120,8 +120,10 @@ uint32_t parseCJS (uint16_t* _source, uint32_t _sourceLen, void (*_addExport)(co
pos += 4;
if (*pos == '(') {
openTokenPosStack[openTokenDepth++] = lastTokenPos;
if (*(++pos) == 'r')
if (*(pos + 1) == 'r') {
pos++;
tryParseRequire(ExportStar);
}
}
}
lastTokenPos = pos;

View File

@ -2,5 +2,5 @@
// Refer to tools/dep_updaters/update-cjs-module-lexer.sh
#ifndef SRC_CJS_MODULE_LEXER_VERSION_H_
#define SRC_CJS_MODULE_LEXER_VERSION_H_
#define CJS_MODULE_LEXER_VERSION "2.1.0"
#define CJS_MODULE_LEXER_VERSION "2.1.1"
#endif // SRC_CJS_MODULE_LEXER_VERSION_H_