From 8076284f9ec383dd5e9c72467cd97aee1bfae9d5 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Mon, 24 Feb 2025 19:53:37 -0500 Subject: [PATCH] deps: update cjs-module-lexer to 2.1.0 PR-URL: https://github.com/nodejs/node/pull/57180 Reviewed-By: Chemi Atlow Reviewed-By: Rafael Gonzaga --- deps/cjs-module-lexer/README.md | 19 +++++++++++++++++++ deps/cjs-module-lexer/dist/lexer.mjs | 2 +- deps/cjs-module-lexer/src/README.md | 19 +++++++++++++++++++ deps/cjs-module-lexer/src/build/Makefile | 21 ++++++++++++++++----- deps/cjs-module-lexer/src/package-lock.json | 4 ++-- deps/cjs-module-lexer/src/package.json | 2 +- src/cjs_module_lexer_version.h | 2 +- 7 files changed, 59 insertions(+), 10 deletions(-) diff --git a/deps/cjs-module-lexer/README.md b/deps/cjs-module-lexer/README.md index cc7ca50cc72243..addf5edc6b1193 100644 --- a/deps/cjs-module-lexer/README.md +++ b/deps/cjs-module-lexer/README.md @@ -456,6 +456,25 @@ If you need to build lib/lexer.wat (optional) you must first install [wabt](https://github.com/WebAssembly/wabt) as a sibling folder to this project. The wat file is then build by running `make lib/lexer.wat` +### Creating a Release +These are the steps to create and publish a release. You will need docker +installed as well as having installed [wabt](https://github.com/WebAssembly/wabt) +as outlined above: + +- [ ] Figure out if the release should be semver patch, minor or major based on the changes since + the last release and determine the new version. +- [ ] Update the package.json version, and run a full build and test + - npm install + - npm run build + - npm run test +- [ ] Commit and tag the changes, pushing up to main and the tag + - For example + - `git tag -a 1.4.2 -m "1.4.2"` + - `git push origin tag 1.4.2` +- [ ] Create the GitHub release +- [ ] Run npm publish from an account with access (asking somebody with access + the nodejs-foundation account is an option if you don't have access. + ### License MIT diff --git a/deps/cjs-module-lexer/dist/lexer.mjs b/deps/cjs-module-lexer/dist/lexer.mjs index 806bb46287259d..b6f5fb548bb73f 100644 --- a/deps/cjs-module-lexer/dist/lexer.mjs +++ b/deps/cjs-module-lexer/dist/lexer.mjs @@ -1,2 +1,2 @@ -/* cjs-module-lexer 2.0.0 */ +/* cjs-module-lexer 2.1.0 */ let A;const B=1===new Uint8Array(new Uint16Array([1]).buffer)[0];export function parse(I,C="@"){if(!A)throw new Error("Not initialized");const w=I.length+1,D=(A.__heap_base.value||A.__heap_base)+4*w-A.memory.buffer.byteLength;D>0&&A.memory.grow(Math.ceil(D/65536));const G=A.sa(w);(B?g:E)(I,new Uint16Array(A.memory.buffer,G,w));const S=A.parseCJS(G,I.length,0,0,0);if(S){const B=new Error(`Parse error ${C}${A.e()}:${I.slice(0,A.e()).split("\n").length}:${A.e()-I.lastIndexOf("\n",A.e()-1)}`);throw Object.assign(B,{idx:A.e()}),5!==S&&6!==S&&7!==S||Object.assign(B,{code:"ERR_LEXER_ESM_SYNTAX"}),B}let R=new Set,o=new Set,H=new Set;for(;A.rre();){const B=Q(I.slice(A.res(),A.ree()));B&&o.add(B)}for(;A.ru();)H.add(Q(I.slice(A.us(),A.ue())));for(;A.re();){let B=Q(I.slice(A.es(),A.ee()));void 0===B||H.has(B)||R.add(B)}return{exports:[...R],reexports:[...o]}}function Q(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const B=(0,eval)(A);for(let A=0;A>>8}}function g(A,B){const Q=A.length;let E=0;for(;EA.charCodeAt(0))}let C;export function init(){return C||(C=(async()=>{const B=await WebAssembly.compile(I()),{exports:Q}=await WebAssembly.instantiate(B);A=Q})())}export function initSync(){if(A)return;const B=new WebAssembly.Module(I()),{exports:Q}=new WebAssembly.Instance(B);A=Q} \ No newline at end of file diff --git a/deps/cjs-module-lexer/src/README.md b/deps/cjs-module-lexer/src/README.md index cc7ca50cc72243..addf5edc6b1193 100755 --- a/deps/cjs-module-lexer/src/README.md +++ b/deps/cjs-module-lexer/src/README.md @@ -456,6 +456,25 @@ If you need to build lib/lexer.wat (optional) you must first install [wabt](https://github.com/WebAssembly/wabt) as a sibling folder to this project. The wat file is then build by running `make lib/lexer.wat` +### Creating a Release +These are the steps to create and publish a release. You will need docker +installed as well as having installed [wabt](https://github.com/WebAssembly/wabt) +as outlined above: + +- [ ] Figure out if the release should be semver patch, minor or major based on the changes since + the last release and determine the new version. +- [ ] Update the package.json version, and run a full build and test + - npm install + - npm run build + - npm run test +- [ ] Commit and tag the changes, pushing up to main and the tag + - For example + - `git tag -a 1.4.2 -m "1.4.2"` + - `git push origin tag 1.4.2` +- [ ] Create the GitHub release +- [ ] Run npm publish from an account with access (asking somebody with access + the nodejs-foundation account is an option if you don't have access. + ### License MIT diff --git a/deps/cjs-module-lexer/src/build/Makefile b/deps/cjs-module-lexer/src/build/Makefile index f13c390b8cdb96..b8e96d82534f7d 100755 --- a/deps/cjs-module-lexer/src/build/Makefile +++ b/deps/cjs-module-lexer/src/build/Makefile @@ -1,10 +1,21 @@ +# These flags depend on the system and may be overridden +WASM_CC := clang +WASM_CFLAGS := --sysroot=/usr/share/wasi-sysroot +WASM_LDFLAGS := -nostartfiles + +# These are project-specific and are expected to be kept intact +WASM_TARGET := -target wasm32-unknown-wasi +WASM_EXTRA_CFLAGS := -I include-wasm/ -Wno-logical-op-parentheses -Wno-parentheses -Oz +WASM_EXTRA_LDFLAGS := -Wl,-z,stack-size=13312,--no-entry,--compress-relocations,--strip-all +WASM_EXTRA_LDFLAGS += -Wl,--export=__heap_base,--export=parseCJS,--export=sa +WASM_EXTRA_LDFLAGS += -Wl,--export=e,--export=re,--export=es,--export=ee +WASM_EXTRA_LDFLAGS += -Wl,--export=rre,--export=ree,--export=res,--export=ru,--export=us,--export=ue + lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c @mkdir -p lib - clang --sysroot=/usr/share/wasi-sysroot -target wasm32-unknown-wasi src/lexer.c -I include-wasm -o lib/lexer.wasm -nostartfiles \ - -Wl,-z,stack-size=13312,--no-entry,--compress-relocations,--strip-all,--export=__heap_base,\ - --export=parseCJS,--export=sa,--export=e,--export=re,--export=es,--export=ee,--export=rre,--export=ree,--export=res,--export=ru,--export=us,--export=ue \ - -Wno-logical-op-parentheses -Wno-parentheses \ - -Oz + $(WASM_CC) $(WASM_CFLAGS) $(WASM_TARGET) $(WASM_EXTRA_CFLAGS) \ + src/lexer.c -o lib/lexer.wasm \ + $(WASM_LDFLAGS) $(WASM_EXTRA_LDFLAGS) optimize: lib/lexer.wasm ${WASM_OPT} -Oz lib/lexer.wasm -o lib/lexer.wasm diff --git a/deps/cjs-module-lexer/src/package-lock.json b/deps/cjs-module-lexer/src/package-lock.json index 3c5f50d681e7b3..e8de2e3e921611 100644 --- a/deps/cjs-module-lexer/src/package-lock.json +++ b/deps/cjs-module-lexer/src/package-lock.json @@ -1,12 +1,12 @@ { "name": "cjs-module-lexer", - "version": "2.0.0", + "version": "2.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cjs-module-lexer", - "version": "2.0.0", + "version": "2.1.0", "license": "MIT", "devDependencies": { "@babel/cli": "^7.5.5", diff --git a/deps/cjs-module-lexer/src/package.json b/deps/cjs-module-lexer/src/package.json index d59353db6da501..9ef0db81e12b46 100755 --- a/deps/cjs-module-lexer/src/package.json +++ b/deps/cjs-module-lexer/src/package.json @@ -1,6 +1,6 @@ { "name": "cjs-module-lexer", - "version": "2.0.0", + "version": "2.1.0", "description": "Lexes CommonJS modules, returning their named exports metadata", "main": "lexer.js", "exports": { diff --git a/src/cjs_module_lexer_version.h b/src/cjs_module_lexer_version.h index da33536cce1b80..8d754aadde0121 100644 --- a/src/cjs_module_lexer_version.h +++ b/src/cjs_module_lexer_version.h @@ -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.0.0" +#define CJS_MODULE_LEXER_VERSION "2.1.0" #endif // SRC_CJS_MODULE_LEXER_VERSION_H_