Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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.

6 changes: 4 additions & 2 deletions deps/cjs-module-lexer/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
7 changes: 5 additions & 2 deletions deps/cjs-module-lexer/src/Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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/*
2 changes: 1 addition & 1 deletion deps/cjs-module-lexer/src/build/wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 4 additions & 2 deletions deps/cjs-module-lexer/src/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Binary file modified deps/cjs-module-lexer/src/lib/lexer.wasm
Binary file not shown.
6 changes: 4 additions & 2 deletions deps/cjs-module-lexer/src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion deps/cjs-module-lexer/src/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 3 additions & 1 deletion deps/cjs-module-lexer/src/src/lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/cjs_module_lexer_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Loading