From 05de8da29bd4dada26ba01f31b23a2dc7e4f3614 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sun, 8 Sep 2024 00:31:44 +0000 Subject: [PATCH 1/2] deps: update cjs-module-lexer to 1.4.1 --- deps/cjs-module-lexer/dist/lexer.js | 2 +- deps/cjs-module-lexer/dist/lexer.mjs | 4 +- deps/cjs-module-lexer/lexer.js | 2886 +++++++++++++------------- deps/cjs-module-lexer/package.json | 2 +- src/cjs_module_lexer_version.h | 2 +- 5 files changed, 1448 insertions(+), 1448 deletions(-) diff --git a/deps/cjs-module-lexer/dist/lexer.js b/deps/cjs-module-lexer/dist/lexer.js index 9767c1347e65fc..7c9b7124ae224d 100644 --- a/deps/cjs-module-lexer/dist/lexer.js +++ b/deps/cjs-module-lexer/dist/lexer.js @@ -1 +1 @@ -"use strict";exports.init=init;exports.initSync=initSync;exports.parse=parse;let A;const Q=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(g,I="@"){if(!A)throw new Error("Not initialized");const D=g.length+1,N=(A.__heap_base.value||A.__heap_base)+4*D-A.memory.buffer.byteLength;N>0&&A.memory.grow(Math.ceil(N/65536));const k=A.sa(D);(Q?C:E)(g,new Uint16Array(A.memory.buffer,k,D));const w=A.parseCJS(k,g.length,0,0,0);if(w){const Q=new Error(`Parse error ${I}${A.e()}:${g.slice(0,A.e()).split("\n").length}:${A.e()-g.lastIndexOf("\n",A.e()-1)}`);throw Object.assign(Q,{idx:A.e()}),5!==w&&6!==w&&7!==w||Object.assign(Q,{code:"ERR_LEXER_ESM_SYNTAX"}),Q}let H=new Set,J=new Set,o=new Set;for(;A.rre();){const Q=B(g.slice(A.res(),A.ree()));Q&&J.add(Q)}for(;A.ru();)o.add(B(g.slice(A.us(),A.ue())));for(;A.re();){let Q=B(g.slice(A.es(),A.ee()));void 0===Q||o.has(Q)||H.add(Q)}return{exports:[...H],reexports:[...J]}}function B(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const Q=(0,eval)(A);for(let A=0;A>>8}}function C(A,Q){const B=A.length;let E=0;for(;EA.charCodeAt(0)):Buffer.from(A,"base64")}let I;function init(){return I||(I=(async()=>{const Q=await WebAssembly.compile(g()),{exports:B}=await WebAssembly.instantiate(Q);A=B})())}function initSync(){if(A)return;const Q=new WebAssembly.Module(g()),{exports:B}=new WebAssembly.Instance(Q);A=B} \ No newline at end of file +"use strict";exports.init=init;exports.initSync=initSync;exports.parse=parse;let A;const Q=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(g,I="@"){if(!A)throw new Error("Not initialized");const D=g.length+1,N=(A.__heap_base.value||A.__heap_base)+4*D-A.memory.buffer.byteLength;N>0&&A.memory.grow(Math.ceil(N/65536));const k=A.sa(D);(Q?C:E)(g,new Uint16Array(A.memory.buffer,k,D));const w=A.parseCJS(k,g.length,0,0,0);if(w){const Q=new Error(`Parse error ${I}${A.e()}:${g.slice(0,A.e()).split("\n").length}:${A.e()-g.lastIndexOf("\n",A.e()-1)}`);throw Object.assign(Q,{idx:A.e()}),5!==w&&6!==w&&7!==w||Object.assign(Q,{code:"ERR_LEXER_ESM_SYNTAX"}),Q}let H=new Set,J=new Set,o=new Set;for(;A.rre();){const Q=B(g.slice(A.res(),A.ree()));Q&&J.add(Q)}for(;A.ru();)o.add(B(g.slice(A.us(),A.ue())));for(;A.re();){let Q=B(g.slice(A.es(),A.ee()));void 0===Q||o.has(Q)||H.add(Q)}return{exports:[...H],reexports:[...J]}}function B(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const Q=(0,eval)(A);for(let A=0;A>>8}}function C(A,Q){const B=A.length;let E=0;for(;EA.charCodeAt(0))}let I;function init(){return I||(I=(async()=>{const Q=await WebAssembly.compile(g()),{exports:B}=await WebAssembly.instantiate(Q);A=B})())}function initSync(){if(A)return;const Q=new WebAssembly.Module(g()),{exports:B}=new WebAssembly.Instance(Q);A=B} \ No newline at end of file diff --git a/deps/cjs-module-lexer/dist/lexer.mjs b/deps/cjs-module-lexer/dist/lexer.mjs index 3884f1e687cbba..964b74cfa781b6 100644 --- a/deps/cjs-module-lexer/dist/lexer.mjs +++ b/deps/cjs-module-lexer/dist/lexer.mjs @@ -1,2 +1,2 @@ -/* cjs-module-lexer 1.4.0 */ -let A;const Q=1===new Uint8Array(new Uint16Array([1]).buffer)[0];export function parse(g,I="@"){if(!A)throw new Error("Not initialized");const D=g.length+1,N=(A.__heap_base.value||A.__heap_base)+4*D-A.memory.buffer.byteLength;N>0&&A.memory.grow(Math.ceil(N/65536));const k=A.sa(D);(Q?C:E)(g,new Uint16Array(A.memory.buffer,k,D));const w=A.parseCJS(k,g.length,0,0,0);if(w){const Q=new Error(`Parse error ${I}${A.e()}:${g.slice(0,A.e()).split("\n").length}:${A.e()-g.lastIndexOf("\n",A.e()-1)}`);throw Object.assign(Q,{idx:A.e()}),5!==w&&6!==w&&7!==w||Object.assign(Q,{code:"ERR_LEXER_ESM_SYNTAX"}),Q}let H=new Set,J=new Set,o=new Set;for(;A.rre();){const Q=B(g.slice(A.res(),A.ree()));Q&&J.add(Q)}for(;A.ru();)o.add(B(g.slice(A.us(),A.ue())));for(;A.re();){let Q=B(g.slice(A.es(),A.ee()));void 0===Q||o.has(Q)||H.add(Q)}return{exports:[...H],reexports:[...J]}}function B(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const Q=(0,eval)(A);for(let A=0;A>>8}}function C(A,Q){const B=A.length;let E=0;for(;EA.charCodeAt(0)):Buffer.from(A,"base64")}let I;export function init(){return I||(I=(async()=>{const Q=await WebAssembly.compile(g()),{exports:B}=await WebAssembly.instantiate(Q);A=B})())}export function initSync(){if(A)return;const Q=new WebAssembly.Module(g()),{exports:B}=new WebAssembly.Instance(Q);A=B} \ No newline at end of file +/* cjs-module-lexer 1.4.1 */ +let A;const Q=1===new Uint8Array(new Uint16Array([1]).buffer)[0];export function parse(g,I="@"){if(!A)throw new Error("Not initialized");const D=g.length+1,N=(A.__heap_base.value||A.__heap_base)+4*D-A.memory.buffer.byteLength;N>0&&A.memory.grow(Math.ceil(N/65536));const k=A.sa(D);(Q?C:E)(g,new Uint16Array(A.memory.buffer,k,D));const w=A.parseCJS(k,g.length,0,0,0);if(w){const Q=new Error(`Parse error ${I}${A.e()}:${g.slice(0,A.e()).split("\n").length}:${A.e()-g.lastIndexOf("\n",A.e()-1)}`);throw Object.assign(Q,{idx:A.e()}),5!==w&&6!==w&&7!==w||Object.assign(Q,{code:"ERR_LEXER_ESM_SYNTAX"}),Q}let H=new Set,J=new Set,o=new Set;for(;A.rre();){const Q=B(g.slice(A.res(),A.ree()));Q&&J.add(Q)}for(;A.ru();)o.add(B(g.slice(A.us(),A.ue())));for(;A.re();){let Q=B(g.slice(A.es(),A.ee()));void 0===Q||o.has(Q)||H.add(Q)}return{exports:[...H],reexports:[...J]}}function B(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const Q=(0,eval)(A);for(let A=0;A>>8}}function C(A,Q){const B=A.length;let E=0;for(;EA.charCodeAt(0))}let I;export function init(){return I||(I=(async()=>{const Q=await WebAssembly.compile(g()),{exports:B}=await WebAssembly.instantiate(Q);A=B})())}export function initSync(){if(A)return;const Q=new WebAssembly.Module(g()),{exports:B}=new WebAssembly.Instance(Q);A=B} \ No newline at end of file diff --git a/deps/cjs-module-lexer/lexer.js b/deps/cjs-module-lexer/lexer.js index aaf7dde807f98e..b31cef22bdceb9 100644 --- a/deps/cjs-module-lexer/lexer.js +++ b/deps/cjs-module-lexer/lexer.js @@ -1,1443 +1,1443 @@ -let source, pos, end; -let openTokenDepth, - templateDepth, - lastTokenPos, - lastSlashWasDivision, - templateStack, - templateStackDepth, - openTokenPosStack, - openClassPosStack, - nextBraceIsClass, - starExportMap, - lastStarExportSpecifier, - _exports, - unsafeGetters, - reexports; - -function resetState () { - openTokenDepth = 0; - templateDepth = -1; - lastTokenPos = -1; - lastSlashWasDivision = false; - templateStack = new Array(1024); - templateStackDepth = 0; - openTokenPosStack = new Array(1024); - openClassPosStack = new Array(1024); - nextBraceIsClass = false; - starExportMap = Object.create(null); - lastStarExportSpecifier = null; - - _exports = new Set(); - unsafeGetters = new Set(); - reexports = new Set(); -} - -// RequireType -const Import = 0; -const ExportAssign = 1; -const ExportStar = 2; - -function parseCJS (source, name = '@') { - resetState(); - try { - parseSource(source); - } - catch (e) { - e.message += `\n at ${name}:${source.slice(0, pos).split('\n').length}:${pos - source.lastIndexOf('\n', pos - 1)}`; - e.loc = pos; - throw e; - } - const result = { exports: [..._exports].filter(expt => expt !== undefined && !unsafeGetters.has(expt)), reexports: [...reexports].filter(reexpt => reexpt !== undefined) }; - resetState(); - return result; -} - -function decode (str) { - if (str[0] === '"' || str[0] === '\'') { - try { - const decoded = (0, eval)(str); - // Filter to exclude non-matching UTF-16 surrogate strings - for (let i = 0; i < decoded.length; i++) { - const surrogatePrefix = decoded.charCodeAt(i) & 0xFC00; - if (surrogatePrefix < 0xD800) { - // Not a surrogate - continue; - } - else if (surrogatePrefix === 0xD800) { - // Validate surrogate pair - if ((decoded.charCodeAt(++i) & 0xFC00) !== 0xDC00) - return; - } - else { - // Out-of-range surrogate code (above 0xD800) - return; - } - } - return decoded; - } - catch {} - } - else { - return str; - } -} - -function parseSource (cjsSource) { - source = cjsSource; - pos = -1; - end = source.length - 1; - let ch = 0; - - // Handle #! - if (source.charCodeAt(0) === 35/*#*/ && source.charCodeAt(1) === 33/*!*/) { - if (source.length === 2) - return true; - pos += 2; - while (pos++ < end) { - ch = source.charCodeAt(pos); - if (ch === 10/*\n*/ || ch === 13/*\r*/) - break; - } - } - - while (pos++ < end) { - ch = source.charCodeAt(pos); - - if (ch === 32 || ch < 14 && ch > 8) - continue; - - if (openTokenDepth === 0) { - switch (ch) { - case 105/*i*/: - if (source.startsWith('mport', pos + 1) && keywordStart(pos)) - throwIfImportStatement(); - lastTokenPos = pos; - continue; - case 114/*r*/: - const startPos = pos; - if (tryParseRequire(Import) && keywordStart(startPos)) - tryBacktrackAddStarExportBinding(startPos - 1); - lastTokenPos = pos; - continue; - case 95/*_*/: - if (source.startsWith('interopRequireWildcard', pos + 1) && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) { - const startPos = pos; - pos += 23; - if (source.charCodeAt(pos) === 40/*(*/) { - pos++; - openTokenPosStack[openTokenDepth++] = lastTokenPos; - if (tryParseRequire(Import) && keywordStart(startPos)) { - tryBacktrackAddStarExportBinding(startPos - 1); - } - } - } - else if (source.startsWith('_export', pos + 1) && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) { - pos += 8; - if (source.startsWith('Star', pos)) - pos += 4; - if (source.charCodeAt(pos) === 40/*(*/) { - openTokenPosStack[openTokenDepth++] = lastTokenPos; - if (source.charCodeAt(++pos) === 114/*r*/) - tryParseRequire(ExportStar); - } - } - lastTokenPos = pos; - continue; - } - } - - switch (ch) { - case 101/*e*/: - if (source.startsWith('xport', pos + 1) && keywordStart(pos)) { - if (source.charCodeAt(pos + 6) === 115/*s*/) - tryParseExportsDotAssign(false); - else if (openTokenDepth === 0) - throwIfExportStatement(); - } - break; - case 99/*c*/: - if (keywordStart(pos) && source.startsWith('lass', pos + 1) && isBrOrWs(source.charCodeAt(pos + 5))) - nextBraceIsClass = true; - break; - case 109/*m*/: - if (source.startsWith('odule', pos + 1) && keywordStart(pos)) - tryParseModuleExportsDotAssign(); - break; - case 79/*O*/: - if (source.startsWith('bject', pos + 1) && keywordStart(pos)) - tryParseObjectDefineOrKeys(openTokenDepth === 0); - break; - case 40/*(*/: - openTokenPosStack[openTokenDepth++] = lastTokenPos; - break; - case 41/*)*/: - if (openTokenDepth === 0) - throw new Error('Unexpected closing bracket.'); - openTokenDepth--; - break; - case 123/*{*/: - openClassPosStack[openTokenDepth] = nextBraceIsClass; - nextBraceIsClass = false; - openTokenPosStack[openTokenDepth++] = lastTokenPos; - break; - case 125/*}*/: - if (openTokenDepth === 0) - throw new Error('Unexpected closing brace.'); - if (openTokenDepth-- === templateDepth) { - templateDepth = templateStack[--templateStackDepth]; - templateString(); - } - else { - if (templateDepth !== -1 && openTokenDepth < templateDepth) - throw new Error('Unexpected closing brace.'); - } - break; - case 60/*>*/: - // TODO: