Skip to content

Commit a55286d

Browse files
nodejs-github-botmarco-ippolito
authored andcommitted
deps: update cjs-module-lexer to 1.3.0
1 parent dc05a59 commit a55286d

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

deps/cjs-module-lexer/dist/lexer.js

Lines changed: 4 additions & 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: 4 additions & 2 deletions
Large diffs are not rendered by default.

deps/cjs-module-lexer/lexer.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,10 @@ function codePointAtLast (bPos) {
11491149
return ch;
11501150
}
11511151

1152+
function esmSyntaxErr (msg) {
1153+
return Object.assign(new Error(msg), { code: 'ERR_LEXER_ESM_SYNTAX' });
1154+
}
1155+
11521156
function throwIfImportStatement () {
11531157
const startPos = pos;
11541158
pos += 6;
@@ -1160,7 +1164,7 @@ function throwIfImportStatement () {
11601164
return;
11611165
// import.meta
11621166
case 46/*.*/:
1163-
throw new Error('Unexpected import.meta in CJS module.');
1167+
throw esmSyntaxErr('Unexpected import.meta in CJS module.');
11641168

11651169
default:
11661170
// no space after "import" -> not an import keyword
@@ -1176,7 +1180,7 @@ function throwIfImportStatement () {
11761180
return;
11771181
}
11781182
// import statements are a syntax error in CommonJS
1179-
throw new Error('Unexpected import statement in CJS module.');
1183+
throw esmSyntaxErr('Unexpected import statement in CJS module.');
11801184
}
11811185
}
11821186

@@ -1186,7 +1190,7 @@ function throwIfExportStatement () {
11861190
const ch = commentWhitespace();
11871191
if (pos === curPos && !isPunctuator(ch))
11881192
return;
1189-
throw new Error('Unexpected export statement in CJS module.');
1193+
throw esmSyntaxErr('Unexpected export statement in CJS module.');
11901194
}
11911195

11921196
function commentWhitespace () {

deps/cjs-module-lexer/package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cjs-module-lexer",
3-
"version": "1.2.3",
3+
"version": "1.3.0",
44
"description": "Lexes CommonJS modules, returning their named exports metadata",
55
"main": "lexer.js",
66
"exports": {
@@ -13,22 +13,21 @@
1313
"types": "lexer.d.ts",
1414
"scripts": {
1515
"test-js": "mocha -b -u tdd test/*.js",
16-
"test-wasm": "WASM=1 mocha -b -u tdd test/*.js",
16+
"test-wasm": "cross-env WASM=1 mocha -b -u tdd test/*.js",
1717
"test": "npm run test-wasm && npm run test-js",
1818
"bench": "node --expose-gc bench/index.mjs",
19-
"build": "node build.js && babel dist/lexer.mjs | terser -o dist/lexer.js",
19+
"build": "node build.js",
2020
"build-wasm": "make lib/lexer.wasm && node build.js",
21+
"prepublishOnly": "make && npm run build",
2122
"footprint": "npm run build && cat dist/lexer.js | gzip -9f | wc -c"
2223
},
2324
"author": "Guy Bedford",
2425
"license": "MIT",
2526
"devDependencies": {
26-
"@babel/cli": "^7.5.5",
27-
"@babel/core": "^7.5.5",
28-
"@babel/plugin-transform-modules-commonjs": "^7.5.0",
27+
"cross-env": "^7.0.3",
28+
"esbuild": "^0.19.12",
2929
"kleur": "^2.0.2",
30-
"mocha": "^9.1.3",
31-
"terser": "^4.1.4"
30+
"mocha": "^9.1.3"
3231
},
3332
"files": [
3433
"dist",
@@ -42,4 +41,4 @@
4241
"url": "https://github.com/nodejs/cjs-module-lexer/issues"
4342
},
4443
"homepage": "https://github.com/nodejs/cjs-module-lexer#readme"
45-
}
44+
}

src/cjs_module_lexer_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// Refer to tools/dep_updaters/update-cjs-module-lexer.sh
33
#ifndef SRC_CJS_MODULE_LEXER_VERSION_H_
44
#define SRC_CJS_MODULE_LEXER_VERSION_H_
5-
#define CJS_MODULE_LEXER_VERSION "1.2.3"
5+
#define CJS_MODULE_LEXER_VERSION "1.3.0"
66
#endif // SRC_CJS_MODULE_LEXER_VERSION_H_

0 commit comments

Comments
 (0)