From 0b804b1a70fab3cfd610be0eea19b07c0db12e70 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Tue, 27 Oct 2026 17:42:06 +0100 Subject: [PATCH 1/5] feat(lexer): detect Webpack entry exports in extended mode Scanning every factory in a Webpack bundle reports internal names alongside the published entry's exports. Extended mode now follows recognized Webpack startup and reexport patterns to exclude unrelated factory exports. Refs: https://github.com/nodejs/cjs-module-lexer/issues/88 Signed-off-by: Ruben Bridgewater --- README.md | 10 +- build/Makefile | 2 +- include-wasm/cjs-module-lexer.h | 4 +- lexer.js | 305 +- lib/lexer.wasm | Bin 28959 -> 40106 bytes lib/lexer.wat | 24939 ++++++++++++++--------- src/lexer.c | 526 +- test/fixtures/webpack/LICENSE | 22 + test/fixtures/webpack/jest-watcher.cjs | 556 + test/webpack.js | 302 + 10 files changed, 16897 insertions(+), 9769 deletions(-) create mode 100644 test/fixtures/webpack/LICENSE create mode 100644 test/fixtures/webpack/jest-watcher.cjs create mode 100644 test/webpack.js diff --git a/README.md b/README.md index 7e6f695..0e86515 100755 --- a/README.md +++ b/README.md @@ -112,9 +112,17 @@ The same limitation applies to `Object.defineProperties`. Direct reexport assignments contribute all detected dependencies instead of only the last assignment. Object spreads of `require('literal')` contribute reexports, but named properties with require-valued expressions do not. +Extended mode recognizes Webpack assignments through `__webpack_exports__` and getter maps in `__webpack_require__.d`. +For object-shaped `__webpack_modules__` tables, a literal startup module ID selects the entry factory. +Detection follows internal whole-module reexports and supported star reexports, which exclude `default` and `__esModule`. +An inlined entry can instead initialize `__webpack_exports__` with an object literal. +Unrelated factories do not contribute names when the bundle publishes the recognized entry. +Unrecognized startup expressions and unresolved internal reexports retain candidate detection. + The result contains syntactic candidates, which can include non-enumerable properties, throwing getters, and unreachable assignments. Extended mode does not apply the default getter side-effect veto. -It does not resolve bindings or aliases, evaluate computed names, or determine runtime control flow. +It recognizes Webpack factory parameters but does not generally resolve bindings or aliases. +It does not evaluate computed names or determine runtime control flow. Names created by dynamic expressions can therefore remain undetected, and shadowed identifiers can produce false positives. Division and regular-expression detection remains heuristic. diff --git a/build/Makefile b/build/Makefile index 3a29c0c..809b50f 100755 --- a/build/Makefile +++ b/build/Makefile @@ -21,7 +21,7 @@ lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c $(WASM_LDFLAGS) $(WASM_EXTRA_LDFLAGS) optimize: lib/lexer.wasm - ${WASM_OPT} -Oz lib/lexer.wasm -o lib/lexer.wasm + ${WASM_OPT} -Oz --enable-bulk-memory --strip-debug lib/lexer.wasm -o lib/lexer.wasm clean: rm lib/* diff --git a/include-wasm/cjs-module-lexer.h b/include-wasm/cjs-module-lexer.h index 77911fe..262f92a 100755 --- a/include-wasm/cjs-module-lexer.h +++ b/include-wasm/cjs-module-lexer.h @@ -197,8 +197,8 @@ void tryParseLiteralExports (); void readExportDefinition (); void readExportProperty (); bool readExportsOrModuleDotExports (uint16_t ch); -void tryParseModuleExportsDotAssign (); -void tryParseExportsDotAssign (bool assign); +void tryParseModuleExportsDotAssign (uint32_t length); +void tryParseExportsDotAssign (bool assign, uint32_t length); void tryParseObjectDefineOrKeys (bool keys); bool identifier (uint16_t ch); diff --git a/lexer.js b/lexer.js index 2217554..08d762a 100755 --- a/lexer.js +++ b/lexer.js @@ -1,8 +1,10 @@ let source, pos, end; let extended, exportObjectPos; +let webpack; const STACK_DEPTH = 2048; const ClassToken = 1; const ExportObjectToken = 2; +const WebpackTableToken = 4; const templateStack = new Array(1024); const openTokenPosStack = new Array(1024); const openTokenTypeStack = new Array(1024); @@ -27,6 +29,7 @@ function resetState () { templateStackDepth = 0; nextBraceIsClass = false; allowMinifiedEnumerable = false; + webpack = undefined; starExportMap = Object.create(null); lastStarExportSpecifier = null; @@ -78,6 +81,7 @@ function parseCJS (source, name = '@', options) { error.loc = pos; throw error; } + if (webpack) finishWebpack(); const result = { exports: [..._exports].filter(expt => expt !== undefined && !unsafeGetters.has(expt)), reexports: [...reexports].filter(reexpt => reexpt !== undefined) }; resetState(); return result; @@ -116,6 +120,7 @@ function decode (str) { /** @param {string} cjsSource */ function parseSource (cjsSource) { + const extendedMode = extended; source = cjsSource; pos = -1; end = source.length - 1; @@ -139,7 +144,13 @@ function parseSource (cjsSource) { if (ch === 32 || ch < 14 && ch > 8) continue; - if (openTokenDepth === 0) { + if (extendedMode && keywordStart(pos) && readWebpackToken(ch)) { + skipTokenRun(); + lastTokenPos = pos; + continue; + } + + if (openTokenDepth === 0 || extendedMode && webpack?.current?.depth === openTokenDepth) { switch (ch) { case 105/*i*/: if (source.startsWith('mport', pos + 1) && keywordStart(pos)) @@ -207,25 +218,28 @@ function parseSource (cjsSource) { break; case 79/*O*/: if (source.startsWith('bject', pos + 1) && keywordStart(pos)) - tryParseObjectDefineOrKeys(openTokenDepth === 0); + tryParseObjectDefineOrKeys(openTokenDepth === 0 || extendedMode && + (webpack?.current ? webpack.current.depth === openTokenDepth : webpack?.inline)); skipTokenRun(); break; case 40/*(*/: pushOpenToken(lastTokenPos); break; case 91/*[*/: - if (extended) { + if (extendedMode) { pushOpenToken(lastTokenPos); } break; case 93/*]*/: - if (extended) { + if (extendedMode) { if (openTokenDepth === 0) throw new Error('Unexpected closing bracket.'); openTokenDepth--; } break; case 44/*,*/: - if (extended && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & ExportObjectToken)) + if (extendedMode && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & WebpackTableToken)) + readWebpackFactory(); + if (extendedMode && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & ExportObjectToken)) readExportProperty(); break; case 41/*)*/: @@ -237,15 +251,32 @@ function parseSource (cjsSource) { pushOpenToken(lastTokenPos); openTokenTypeStack[openTokenDepth - 1] = nextBraceIsClass ? ClassToken : 0; nextBraceIsClass = false; - if (extended && pos === exportObjectPos) { + if (extendedMode && pos === exportObjectPos) { openTokenTypeStack[openTokenDepth - 1] |= ExportObjectToken; exportObjectPos = -1; readExportProperty(); } + if (extendedMode && pos === webpack?.tablePos) { + openTokenTypeStack[openTokenDepth - 1] |= WebpackTableToken; + readWebpackFactory(); + } + else if (extendedMode && pos === webpack?.factoryPos) { + webpack.current = webpack.pending; + webpack.current.depth = openTokenDepth; + _exports = webpack.current.exports ??= new Set(); + reexports = webpack.current.reexports ??= new Set(); + starExportMap = Object.create(null); + } break; case 125/*}*/: if (openTokenDepth === 0) throw new Error('Unexpected closing brace.'); + if (extendedMode && webpack?.current?.depth === openTokenDepth) { + webpack.current = undefined; + _exports = webpack.exports; + reexports = webpack.reexports; + starExportMap = webpack.starExportMap; + } if (openTokenDepth-- === templateDepth) { templateDepth = templateStack[--templateStackDepth]; templateString(); @@ -286,7 +317,7 @@ function parseSource (cjsSource) { lastToken === 41/*)*/ && isParenKeyword(openTokenPosStack[openTokenDepth]) || lastToken === 125/*}*/ && (isExpressionTerminator(openTokenPosStack[openTokenDepth]) || (openTokenTypeStack[openTokenDepth] & ClassToken) || - extended && isStatementBrace(openTokenPosStack[openTokenDepth], openTokenDepth)) || + extendedMode && isStatementBrace(openTokenPosStack[openTokenDepth], openTokenDepth)) || lastToken === 47/*/*/ && lastSlashWasDivision || isExpressionKeyword(lastTokenPos) || !lastToken) { @@ -316,6 +347,218 @@ function parseSource (cjsSource) { throw new Error('Unterminated braces.'); } +/** @param {number} ch */ +function readWebpackToken (ch) { + const current = webpack?.current; + const target = current?.target; + if (target && source.startsWith(target, pos) && !isIdentifierChar(source.codePointAt(pos + target.length), true)) { + tryParseExportsDotAssign(false, target.length); + return true; + } + if (current?.module && source.startsWith(current.module, pos) && + !isIdentifierChar(source.codePointAt(pos + current.module.length), true)) { + tryParseModuleExportsDotAssign(current.module.length); + return true; + } + if (ch !== 95/*_*/) return false; + if (source.startsWith('__webpack_modules__', pos) && + !isIdentifierChar(source.codePointAt(pos + 19), true)) { + const start = pos; + pos += 19; + if (commentWhitespace() === 61/*=*/) { + pos++; + let next = commentWhitespace(); + if (next === 40/*(*/) next = readExportExpressionStart(); + if (next === 123/*{*/) { + if (!webpack) { + webpack = { modules: new Map(), exports: _exports, reexports, + starExportMap, inlineDependencies: [], tablePos: pos, factoryPos: -1, published: false }; + } else { + webpack.invalid = true; + } + } + } + pos = start; + return false; + } + if (source.startsWith('__webpack_exports__', pos) && + !isIdentifierChar(source.codePointAt(pos + 19), true)) { + const start = pos; + if (webpack && !current) { + pos += 19; + if (commentWhitespace() === 61/*=*/) { + pos++; + const ch = commentWhitespace(); + webpack.inline = ch === 123; + webpack.entry = undefined; + const entry = readWebpackCall(); + if (entry !== undefined) webpack.entry = entry; + } + } + pos = start; + tryParseExportsDotAssign(false, 19); + return true; + } + if (!source.startsWith('__webpack_require__', pos) || + isIdentifierChar(source.codePointAt(pos + 19), true)) return false; + const start = pos; + if (current ? openTokenDepth === current.depth : webpack?.inline) { + const id = readWebpackCall(); + if (id !== undefined) { + lastStarExportSpecifier = { webpack: id }; + tryBacktrackAddStarExportBinding(start - 1); + return true; + } + } + pos = start + 19; + if (commentWhitespace() === 46/*.*/) { + pos++; + if (commentWhitespace() === 100/*d*/) { + pos++; + if (commentWhitespace() === 40/*(*/) { + pos++; + if (readExportsOrModuleDotExports(commentWhitespace()) && commentWhitespace() === 44/*,*/) { + pos++; + if (commentWhitespace() === 123/*{*/) exportObjectPos = pos; + } + } + } + } + pos = start; + return false; +} + +function readWebpackId () { + const ch = commentWhitespace(); + const start = pos; + if (ch === 34/*"*/ || ch === 39/*'*/) { + stringLiteral(ch); + return decode(source.slice(start, ++pos)); + } + if (ch >= 48 && ch <= 57) { + while (source.charCodeAt(pos) >= 48 && source.charCodeAt(pos) <= 57) pos++; + return source.slice(start, pos); + } + if (identifier()) return source.slice(start, pos); +} + +function readWebpackCall () { + const start = pos; + if (source.startsWith('__webpack_require__', pos)) { + pos += 19; + if (commentWhitespace() === 40/*(*/) { + pos++; + const ch = commentWhitespace(); + const id = ch === 34 || ch === 39 || ch >= 48 && ch <= 57 ? readWebpackId() : undefined; + if (id !== undefined && commentWhitespace() === 41/*)*/) { + pos++; + const ch = commentWhitespace(); + if (pos > end || ch === 59 || ch === 44 || ch === 41 || ch === 125) return id; + } + } + } + pos = start; +} + +function readWebpackFactory () { + const start = pos; + pos++; + const id = readWebpackId(); + if (id !== undefined && commentWhitespace() === 58/*:*/) { + pos++; + let ch = commentWhitespace(); + if (ch === 40/*(*/) { + const opening = pos; + pos++; + ch = commentWhitespace(); + if (ch !== 40/*(*/ && !(ch === 102 && source.startsWith('function', pos))) { + pos = opening; + ch = 40; + } + } + const fn = ch === 102/*f*/ && source.startsWith('function', pos); + if (fn) { + pos += 8; + ch = commentWhitespace(); + } + if (ch === 40/*(*/) { + pos++; + let module, target; + ch = commentWhitespace(); + if (ch !== 41) module = readWebpackId(); + ch = commentWhitespace(); + if (ch === 44) { + pos++; + target = readWebpackId(); + ch = commentWhitespace(); + if (ch === 44) { + pos++; + readWebpackId(); + ch = commentWhitespace(); + } + } + if (ch === 41) { + pos++; + ch = commentWhitespace(); + if (!fn && ch === 61 && source.charCodeAt(pos + 1) === 62) { + pos += 2; + ch = commentWhitespace(); + } + if (ch === 123) { + webpack.factoryPos = pos; + const existing = webpack.modules.get(id); + if (existing) { + webpack.invalid = true; + existing.target = target; + existing.module = module; + webpack.pending = existing; + } else { + webpack.pending = { target, module, dependencies: [] }; + webpack.modules.set(id, webpack.pending); + } + } + } + } + } + if (id !== undefined && webpack.factoryPos <= start) webpack.invalid = true; + pos = start; +} + +function finishWebpack () { + const names = new Set(_exports); + const dependencies = new Set(reexports); + const queue = []; + const recognized = webpack.published && (webpack.entry !== undefined || webpack.inline) && !webpack.invalid; + if (recognized) { + if (webpack.entry !== undefined) queue.push({ id: webpack.entry, star: false }); + else for (const dependency of webpack.inlineDependencies) queue.push(dependency); + const visited = new Map(); + for (let i = 0; i < queue.length; i++) { + const { id, star } = queue[i]; + const module = webpack.modules.get(id); + if (!module) { webpack.invalid = true; break; } + const flag = star ? 1 : 2; + if ((visited.get(id) ?? 0) & flag) continue; + visited.set(id, (visited.get(id) ?? 0) | flag); + for (const name of module.exports) { + if (!star || name !== 'default' && name !== '__esModule') names.add(name); + } + for (const dependency of module.reexports) dependencies.add(dependency); + for (const dependency of module.dependencies) + queue.push({ id: dependency.id, star: star || dependency.star }); + } + } + if (!recognized || webpack.invalid) { + for (const module of webpack.modules.values()) { + for (const name of module.exports ?? []) names.add(name); + for (const dependency of module.reexports ?? []) dependencies.add(dependency); + } + } + _exports = names; + reexports = dependencies; +} + +/** @param {number} bPos */ function tryBacktrackAddStarExportBinding (bPos) { while (source.charCodeAt(bPos) === 32/* */ && bPos >= 0) bPos--; @@ -910,7 +1153,11 @@ function tryParseObjectDefineOrKeys (keys) { const starExportSpecifier = starExportMap[id]; if (starExportSpecifier) { - reexports.add(decode(starExportSpecifier)); + if (typeof starExportSpecifier === 'object') + (webpack.current?.dependencies ?? webpack.inlineDependencies) + .push({ id: starExportSpecifier.webpack, star: true }); + else + reexports.add(decode(starExportSpecifier)); pos = revertPos; return; } @@ -923,8 +1170,15 @@ function tryParseObjectDefineOrKeys (keys) { function readExportsOrModuleDotExports (ch) { const revertPos = pos; - if (ch === 109/*m*/ && source.startsWith('odule', pos + 1)) { - pos += 6; + const target = extended && (webpack?.current?.target ?? '__webpack_exports__'); + if (target && source.startsWith(target, pos) && !isIdentifierChar(source.codePointAt(pos + target.length), true)) { + pos += target.length; + return true; + } + const module = extended && webpack?.current?.module; + if (module && source.startsWith(module, pos) && !isIdentifierChar(source.codePointAt(pos + module.length), true) || + ch === 109/*m*/ && source.startsWith('odule', pos + 1)) { + pos += module && source.startsWith(module, pos) ? module.length : 6; ch = commentWhitespace(); if (ch !== 46/*.*/) { pos = revertPos; @@ -943,8 +1197,9 @@ function readExportsOrModuleDotExports (ch) { } } -function tryParseModuleExportsDotAssign () { - pos += 6; +/** @param {number} [length] */ +function tryParseModuleExportsDotAssign (length = 6) { + pos += length; const revertPos = pos - 1; let ch = commentWhitespace(); if (ch === 46/*.*/) { @@ -959,8 +1214,12 @@ function tryParseModuleExportsDotAssign () { } /** @param {boolean} assign */ -function tryParseExportsDotAssign (assign) { - pos += 7; +/** + * @param {boolean} assign + * @param {number} [length] + */ +function tryParseExportsDotAssign (assign, length = 7) { + pos += length; const revertPos = pos - 1; let ch = commentWhitespace(); switch (ch) { @@ -1004,6 +1263,24 @@ function tryParseExportsDotAssign (assign) { pos++; ch = commentWhitespace(); if (extended) { + if (ch === 95/*_*/) { + const start = pos; + const id = readWebpackCall(); + if (webpack && id !== undefined) { + if (webpack.current) webpack.current.dependencies.push({ id, star: false }); + else { webpack.entry = id; webpack.published = true; } + } + pos = start; + if (webpack && !webpack.current && source.startsWith('__webpack_exports__', pos) && + !isIdentifierChar(source.codePointAt(pos + 19), true)) { + pos += 19; + const next = commentWhitespace(); + if (pos > end || next === 59 || next === 44 || next === 41 || next === 125) + webpack.published = true; + else + webpack.invalid = true; + } + } if (ch === 40/*(*/) ch = readExportExpressionStart(); if (ch === 123/*{*/) exportObjectPos = pos; else if (ch === 114/*r*/) tryParseRequire(ExportAssign); diff --git a/lib/lexer.wasm b/lib/lexer.wasm index fd7050af5d28867e4b123c01bb484ff15fc7f724..7a20eda90d9e7ac99c0ec3eb4dde87d8893eb281 100755 GIT binary patch literal 40106 zcmds=eY~Ajb?2X#bIv{Yo^x*wNyy7hNS<>D5EMvM1O;ER<0pv``OulpbmpHKbv{j7 zb6YhRbZm>{2Bb3DDx$U6T8UFfl#xzot;1N6fUnh3Q?-g3Ybc0XUw9FbH_d#1Ywdkr z?!BSXTL0*UC(nBJv!Av1UVH7e*IIk+eX^Ha_#1haW%+sS7Z-c?W-re7=6he9aq%Qb zDcOq~d+m>e5`bHNN%rEJ(tyY8oq?8=mCrbPtjwBO)&Oyt)$^h#%key~<+XaPmg}!p ztLJ%H=DbROjfqxC>MQa_qh97&-dIxX&BMV*^48wWZez1c8o#mYH(oybn?=@o(Tjd< z*GpdUqW|`i3wM=yap6m{jrp$Z)MD3#*^`Q0yRs*jvw)}Z@2>3h;*}R>XB4m8m2E0! zcV(N)S^j-WG5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cZL1ir ztLx1T|8ehsdg;sd{^G*RFWb9t#jhuevM=3xIh#rK=7CksBuO&Tn(&+n&on%zc;=)w z=}gjZkY-6wBeke>I?oE}{E#;ARGTwMHPYE6^`X4*2uGDPK~leJdk*OjNy|y`eSB`B zY?AbIB-OcqJ{vqwBMGnYyqP4N!mpq33a6gpLw)F{_bW+ir>F3&C+#GS@~!s~zvQx; z^bC^v626k8Uxy@|>L(`2Lw!fN=y?`NZB=I-No7wbjrODdCAVqP%Sq2CJ(KiQlFH*# za`|@L!-0>VB2qz$^aC0${~9ax`Dl-RsrXc2)fH~_r+TlUyb3S}Ed0VN zol-j`)%j&`{wtnpI~$(rS2*<3Gv)=Wp2kj3{qz)WJ$Hns>M2EiiSIQxRWITZEz0XB zIM#b19jcDzo!-Z%brbiK8*tD)K^Kub%4pH`E)+YTJYiw8s7_}FJLk}DWdq@>yPA(JcV~7 zfx86u+ zajf)|3{>}7q`1DS&)+18KFLbINN1F{p8Bb+lEzbYN9!pc-@kx\02\00\00\03\00\00\00\09\00\00\00\09\00\00\00r\01\00\00\01\00\00\00\9a\00\00\00\0a\00\00\00\b0\00\00\00\02\00\00\006\00\00\00\0e\00\00\00 \00\00\00\09\00\00\00\10\00\00\00\03\00\00\00.\00\00\00\0a\00\00\006\00\00\00\09\00\00\00\07\00\00\00\02\00\00\00%\00\00\00\0d\00\00\00\02\00\00\00\09\00\00\00\06\00\00\00\01\00\00\00-\00\00\00\00\00\00\00\0d\00\00\00\02\00\00\001\00\00\00\0d\00\00\00\09\00\00\00\03\00\00\00\02\00\00\00\0b\00\00\00S\00\00\00\0b\00\00\00\07\00\00\00\00\00\00\00\a1\00\00\00\0b\00\00\00\06\00\00\00\09\00\00\00\07\00\00\00\03\00\00\008\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\02\00\00\00\0a\00\00\00\00\00\00\00\0b\00\00\00\01\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\04\00\00\00\c1\00\00\00\11\00\00\00\0a\00\00\00\09\00\00\00\05\00\00\00\00\00\00\00R\00\00\00\13\00\00\00\0d\00\00\00\09\00\00\00\d6\00\00\00\06\00\00\00\03\00\00\00\08\00\00\00\1c\00\00\00\01\00\00\00S\00\00\00\10\00\00\00\10\00\00\00\09\00\00\00R\00\00\00\0c\00\00\00\09\00\00\00\09\00\00\00T\00\00\00\0e\00\00\00\05\00\00\00\09\00\00\00\f3\00\00\00\0e\00\00\00\a6\00\00\00\09\00\00\00G\00\00\00\05\00\00\00\02\00\00\00\01\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\0d\00\00\00\09\00\00\00x\00\00\00\06\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\00\00\00\00\1d\00\00\00\09\00\00\00)\00\00\00\06\00\00\00\02\00\00\00\03\00\00\00\09\00\00\00\00\00\00\00\0a\00\00\00\0a\00\00\00/\00\00\00\0f\00\00\00\96\01\00\00\07\00\00\00\02\00\00\00\07\00\00\00\11\00\00\00\09\00\00\009\00\00\00\15\00\00\00\02\00\00\00\0d\00\00\00{\00\00\00\05\00\00\00\04\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\00\00\00\00\09\00\00\00\09\00\00\001\00\00\00\04\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\09\00\00\00\09\00\00\00J\01\00\00\03\00\00\00jK\00\00\09\00\00\00\87\00\00\00\04\00\00\00<\00\00\00\06\00\00\00\1a\00\00\00\09\00\00\00\f6\03\00\00\00\00\00\00\02\00\00\006\00\00\00\08\00\00\00\03\00\00\00R\00\00\00\00\00\00\00\0c\00\00\00\01\00\00\00\acL\00\00\01\00\00\00\c7\14\00\00\04\00\00\00\04\00\00\00\05\00\00\00\09\00\00\00\07\00\00\00\03\00\00\00\06\00\00\00\1f\00\00\00\03\00\00\00\95\00\00\00\02\00\00\00\8a\05\00\001\00\00\00\01\02\00\006\00\00\00\05\00\00\001\00\00\00\09\00\00\00\00\00\00\00\0f\00\00\00\00\00\00\00\17\00\00\00\04\00\00\00\02\00\00\00\0e\00\00\00Q\05\00\00\06\00\00\00\02\00\00\00\10\00\00\00\03\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\06\01\00\00\06\00\00\00\0a\00\00\00\09\00\00\00\a3\01\00\00\0d\00\00\00\d7\05\00\00\06\00\00\00n\00\00\00\06\00\00\00\06\00\00\00\09\00\00\00\97\12\00\00\09\00\00\00\07\05\0c\00\ef") - (data (;2;) (i32.const 4024) "p|\00\00\01\00\00\00\02\00\00\00\03")) + (data (;1;) (i32.const 1076) "\0b\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00\12\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\0e\00\00\00\03\00\00\00\0d\00\00\00#\00\00\00z\00\00\00F\00\00\004\00\00\00\0c\01\00\00\1c\00\00\00\04\00\00\000\00\00\000\00\00\00\1f\00\00\00\0e\00\00\00\1d\00\00\00\06\00\00\00%\00\00\00\0b\00\00\00\1d\00\00\00\03\00\00\00#\00\00\00\05\00\00\00\07\00\00\00\02\00\00\00\04\00\00\00+\00\00\00\9d\00\00\00\13\00\00\00#\00\00\00\05\00\00\00#\00\00\00\05\00\00\00'\00\00\00\09\00\00\003\00\00\00\9d\00\00\006\01\00\00\0a\00\00\00\15\00\00\00\0b\00\00\00\07\00\00\00\99\00\00\00\05\00\00\00\03\00\00\00\00\00\00\00\02\00\00\00+\00\00\00\02\00\00\00\01\00\00\00\04\00\00\00\00\00\00\00\03\00\00\00\16\00\00\00\0b\00\00\00\16\00\00\00\0a\00\00\00\1e\00\00\00B\00\00\00\12\00\00\00\02\00\00\00\01\00\00\00\0b\00\00\00\15\00\00\00\0b\00\00\00\19\00\00\00G\00\00\007\00\00\00\07\00\00\00\01\00\00\00A\00\00\00\00\00\00\00\10\00\00\00\03\00\00\00\02\00\00\00\02\00\00\00\02\00\00\00\1c\00\00\00+\00\00\00\1c\00\00\00\04\00\00\00\1c\00\00\00$\00\00\00\07\00\00\00\02\00\00\00\1b\00\00\00\1c\00\00\005\00\00\00\0b\00\00\00\15\00\00\00\0b\00\00\00\12\00\00\00\0e\00\00\00\11\00\00\00o\00\00\00H\00\00\008\00\00\002\00\00\00\0e\00\00\002\00\00\00\0e\00\00\00#\00\00\00]\01\00\00)\00\00\00\07\00\00\00\01\00\00\00O\00\00\00\1c\00\00\00\0b\00\00\00\00\00\00\00\09\00\00\00\15\00\00\00k\00\00\00\14\00\00\00\1c\00\00\00\16\00\00\00\0d\00\00\004\00\00\00L\00\00\00,\00\00\00!\00\00\00\18\00\00\00\1b\00\00\00#\00\00\00\1e\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\09\00\00\00\22\00\00\00\04\00\00\00\00\00\00\00\0d\00\00\00/\00\00\00\0f\00\00\00\03\00\00\00\16\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00$\00\00\00\11\00\00\00\02\00\00\00\18\00\00\00U\00\00\00\06\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\0e\00\00\00\02\00\00\00\09\00\00\00\08\00\00\00.\00\00\00'\00\00\00\07\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\15\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\04\00\00\00\00\00\00\00\13\00\00\00\00\00\00\00\0d\00\00\00\04\00\00\00\9f\00\00\004\00\00\00\13\00\00\00\03\00\00\00\15\00\00\00\02\00\00\00\1f\00\00\00/\00\00\00\15\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\b9\00\00\00.\00\00\00*\00\00\00\03\00\00\00%\00\00\00/\00\00\00\15\00\00\00\00\00\00\00<\00\00\00*\00\00\00\0e\00\00\00\00\00\00\00H\00\00\00\1a\00\00\00\e6\00\00\00+\00\00\00u\00\00\00?\00\00\00 \00\00\00\07\00\00\00\03\00\00\00\00\00\00\00\03\00\00\00\07\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\17\00\00\00\10\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00_\00\00\00\07\00\00\00\03\00\00\00&\00\00\00\11\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\1d\00\00\00\00\00\00\00\0b\00\00\00'\00\00\00\08\00\00\00\00\00\00\00\16\00\00\00\00\00\00\00\0c\00\00\00-\00\00\00\14\00\00\00\00\00\00\00#\00\00\008\00\00\00\08\01\00\00\08\00\00\00\02\00\00\00$\00\00\00\12\00\00\00\00\00\00\002\00\00\00\1d\00\00\00q\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00%\00\00\00\16\00\00\00\00\00\00\00\1a\00\00\00\05\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\1f\00\00\00\0f\00\00\00\00\00\00\00H\01\00\00\12\00\00\00\be\00\00\00\00\00\00\00P\00\00\00\99\03\00\00g\00\00\00n\00\00\00\12\00\00\00\c3\00\00\00\bd\0a\00\00.\04\00\00\d2\0f\00\00F\02\00\00\ba!\00\008\02\00\00\08\00\00\00\1e\00\00\00r\00\00\00\1d\00\00\00\13\00\00\00/\00\00\00\11\00\00\00\03\00\00\00 \00\00\00\14\00\00\00\06\00\00\00\12\00\00\00\b1\02\00\00?\00\00\00\81\00\00\00J\00\00\00\06\00\00\00\00\00\00\00C\00\00\00\0c\00\00\00A\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\1d\00\00\00\f7\17\00\00\09\00\00\00\d5\04\00\00+\00\00\00\08\00\00\00\f8\22\00\00\1e\01\00\002\00\00\00\02\00\00\00\12\00\00\00\03\00\00\00\09\00\00\00\8b\01\00\00\05\09\00\00j\00\00\00\06\00\00\00\0c\00\00\00\04\00\00\00\08\00\00\00\08\00\00\00\09\00\00\00g\17\00\00T\00\00\00\02\00\00\00F\00\00\00\02\00\00\00\01\00\00\00\03\00\00\00\00\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\0b\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00@\00\00\00\02\00\00\00\03\00\00\00\03\00\00\00\07\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\1b\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\04\00\00\00\02\00\00\00\00\00\00\00\04\00\00\00\06\00\00\00\02\00\00\00S\01\00\00\03\00\00\00\18\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\07\00\00\005\09\00\00,\00\00\00\0b\00\00\00\06\00\00\00\11\00\00\00\00\00\00\00r\01\00\00+\00\00\00\15\05\00\00\c4\00\00\00<\00\00\00C\00\00\00\08\00\00\00\00\00\00\00\b5\04\00\00\03\00\00\00\02\00\00\00\1a\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\02\00\00\00\09\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\07\00\00\00\00\00\00\00\05\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\02\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\09\00\00\00\02\00\00\00\10\00\00\00\06\00\00\00\02\00\00\00\02\00\00\00\04\00\00\00\02\00\00\00\10\00\00\00E\11\00\00\dd\a6\00\00#\00\00\004\10\00\00\0c\00\00\00\dd\00\00\00\03\00\00\00\81\16\00\00\0f\00\00\000\1d\00\00 \0c\00\00\1d\02\00\00\e3\05\00\00J\13\00\00\fd\01\00\00\00\00\00\00\e3\00\00\00\00\00\00\00\96\00\00\00\04\00\00\00&\01\00\00\09\00\00\00X\05\00\00\02\00\00\00\02\00\00\00\01\00\00\00\06\00\00\00\03\00\00\00)\00\00\00\02\00\00\00\05\00\00\00\00\00\00\00\a6\00\00\00\01\00\00\00>\02\00\00\03\00\00\00\09\00\00\00\09\00\00\00r\01\00\00\01\00\00\00\9a\00\00\00\0a\00\00\00\b0\00\00\00\02\00\00\006\00\00\00\0e\00\00\00 \00\00\00\09\00\00\00\10\00\00\00\03\00\00\00.\00\00\00\0a\00\00\006\00\00\00\09\00\00\00\07\00\00\00\02\00\00\00%\00\00\00\0d\00\00\00\02\00\00\00\09\00\00\00\06\00\00\00\01\00\00\00-\00\00\00\00\00\00\00\0d\00\00\00\02\00\00\001\00\00\00\0d\00\00\00\09\00\00\00\03\00\00\00\02\00\00\00\0b\00\00\00S\00\00\00\0b\00\00\00\07\00\00\00\00\00\00\00\a1\00\00\00\0b\00\00\00\06\00\00\00\09\00\00\00\07\00\00\00\03\00\00\008\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\02\00\00\00\0a\00\00\00\00\00\00\00\0b\00\00\00\01\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\04\00\00\00\c1\00\00\00\11\00\00\00\0a\00\00\00\09\00\00\00\05\00\00\00\00\00\00\00R\00\00\00\13\00\00\00\0d\00\00\00\09\00\00\00\d6\00\00\00\06\00\00\00\03\00\00\00\08\00\00\00\1c\00\00\00\01\00\00\00S\00\00\00\10\00\00\00\10\00\00\00\09\00\00\00R\00\00\00\0c\00\00\00\09\00\00\00\09\00\00\00T\00\00\00\0e\00\00\00\05\00\00\00\09\00\00\00\f3\00\00\00\0e\00\00\00\a6\00\00\00\09\00\00\00G\00\00\00\05\00\00\00\02\00\00\00\01\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\0d\00\00\00\09\00\00\00x\00\00\00\06\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\00\00\00\00\1d\00\00\00\09\00\00\00)\00\00\00\06\00\00\00\02\00\00\00\03\00\00\00\09\00\00\00\00\00\00\00\0a\00\00\00\0a\00\00\00/\00\00\00\0f\00\00\00\96\01\00\00\07\00\00\00\02\00\00\00\07\00\00\00\11\00\00\00\09\00\00\009\00\00\00\15\00\00\00\02\00\00\00\0d\00\00\00{\00\00\00\05\00\00\00\04\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\00\00\00\00\09\00\00\00\09\00\00\001\00\00\00\04\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\09\00\00\00\09\00\00\00J\01\00\00\03\00\00\00jK\00\00\09\00\00\00\87\00\00\00\04\00\00\00<\00\00\00\06\00\00\00\1a\00\00\00\09\00\00\00\f6\03\00\00\00\00\00\00\02\00\00\006\00\00\00\08\00\00\00\03\00\00\00R\00\00\00\00\00\00\00\0c\00\00\00\01\00\00\00\acL\00\00\01\00\00\00\c7\14\00\00\04\00\00\00\04\00\00\00\05\00\00\00\09\00\00\00\07\00\00\00\03\00\00\00\06\00\00\00\1f\00\00\00\03\00\00\00\95\00\00\00\02\00\00\00\8a\05\00\001\00\00\00\01\02\00\006\00\00\00\05\00\00\001\00\00\00\09\00\00\00\00\00\00\00\0f\00\00\00\00\00\00\00\17\00\00\00\04\00\00\00\02\00\00\00\0e\00\00\00Q\05\00\00\06\00\00\00\02\00\00\00\10\00\00\00\03\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\06\01\00\00\06\00\00\00\0a\00\00\00\09\00\00\00\a3\01\00\00\0d\00\00\00\d7\05\00\00\06\00\00\00n\00\00\00\06\00\00\00\06\00\00\00\09\00\00\00\97\12\00\00\09\00\00\00\07\05\0c\00\ef\00\00\00d\00e\00f\00a\00u\00l\00t") + (data (;2;) (i32.const 4048) "_\00_\00e\00s\00M\00o\00d\00u\00l\00e\00\08\00\00\00\0a\00\00\00\0c\00\00\00\0a\00\00\00\0a\00\00\00\0a\00\00\00\0a\00\00\00\0a\00\00\00\0d\00\00\00\09\00\00\00\0b") + (data (;3;) (i32.const 4112) "@}\00\00\03\00\00\00\04\00\00\00\05")) diff --git a/src/lexer.c b/src/lexer.c index dab3336..0a14224 100755 --- a/src/lexer.c +++ b/src/lexer.c @@ -6,7 +6,7 @@ const uint16_t __empty_char = '\0'; const uint16_t* EMPTY_CHAR = &__empty_char; // tracked depth of template and brackets #define STACK_DEPTH 2048 -enum TokenType { ClassToken = 1, ExportObjectToken = 2 }; +enum TokenType { ClassToken = 1, ExportObjectToken = 2, WebpackTableToken = 4 }; const uint16_t* source; bool lastSlashWasDivision; @@ -24,6 +24,53 @@ bool allowMinifiedEnumerable; static bool extended; static uint16_t* exportObjectPos; +typedef struct WebpackDependency { + const uint16_t* start; + const uint16_t* end; + bool star; + struct WebpackDependency* next; +} WebpackDependency; + +typedef struct WebpackModule { + const uint16_t* start; + const uint16_t* end; + const uint16_t* target; + uint32_t targetLength; + const uint16_t* module; + uint32_t moduleLength; + uint32_t hash; + uint32_t depth; + uint8_t visited; + uint8_t requested; + bool queued; + Slice* exports; + Slice* exportsTail; + Slice* reexports; + Slice* reexportsTail; + Slice* imports; + Slice* importsTail; + WebpackDependency* dependencies; + WebpackDependency* dependenciesTail; + struct WebpackModule* next; + struct WebpackModule* bucketNext; + struct WebpackModule* queueNext; +} WebpackModule; + +static uint16_t* webpackTablePos; +static uint16_t* webpackFactoryPos; +static const uint16_t* webpackEntryStart; +static const uint16_t* webpackEntryEnd; +static WebpackModule* webpackModules; +static WebpackModule* webpackModulesTail; +static WebpackModule* webpackCurrent; +static WebpackModule* webpackPending; +static WebpackModule webpackInlineRoot; +static WebpackModule** webpackBuckets; +static uint32_t webpackCapacity, webpackCount; +static bool webpackPublished, webpackInvalid, webpackInline; +static void (*webpackAddExport)(const uint16_t*, const uint16_t*); +static void (*webpackAddReexport)(const uint16_t*, const uint16_t*); + uint16_t* lastReexportStart; uint16_t* lastReexportEnd; @@ -48,6 +95,365 @@ void (*clearReexports)(); static bool isStatementBrace (uint16_t* curPos, uint16_t depth); static uint16_t readExportExpressionStart (); +static bool readWebpackToken (uint16_t ch); +static void readWebpackFactory (); +static void finishWebpack (); +static void captureWebpackExport (const uint16_t* start, const uint16_t* end); +static void captureWebpackReexport (const uint16_t* start, const uint16_t* end); +static void addWebpackDependency (const uint16_t* start, const uint16_t* end, bool star); +static bool readWebpackCall (const uint16_t** start, const uint16_t** end); + +typedef struct WebpackText { + const uint16_t* pos; + const uint16_t* end; + uint16_t pending; +} WebpackText; + +static WebpackText webpackText (const uint16_t* start, const uint16_t* end) { + if (start < end && (*start == '\'' || *start == '"')) { start++; end--; } + return (WebpackText){ start, end, 0 }; +} + +static uint32_t readWebpackUnit (WebpackText* text) { + if (text->pending) { + uint32_t unit = text->pending; + text->pending = 0; + return unit; + } + while (text->pos < text->end) { + uint32_t unit = *text->pos++; + if (unit != '\\' || text->pos == text->end) return unit; + unit = *text->pos++; + if (unit == '\n' || unit == '\r') { + if (unit == '\r' && text->pos < text->end && *text->pos == '\n') text->pos++; + continue; + } + if (unit == 'u' || unit == 'x') { + uint32_t count = unit == 'u' ? 4 : 2; + bool braces = unit == 'u' && text->pos < text->end && *text->pos == '{'; + if (braces) { text->pos++; count = 6; } + unit = 0; + while (count-- && text->pos < text->end && *text->pos != '}') { + uint16_t digit = *text->pos++; + unit = unit * 16 + (digit <= '9' ? digit - '0' : (digit | 32) - 'a' + 10); + } + if (braces && text->pos < text->end && *text->pos == '}') text->pos++; + if (unit > 0xffff) { + text->pending = 0xdc00 + ((unit - 0x10000) & 0x3ff); + unit = 0xd800 + ((unit - 0x10000) >> 10); + } + } + else if (unit >= '0' && unit <= '7') { + unit -= '0'; + for (uint32_t i = 0; i < 2 && text->pos < text->end && *text->pos >= '0' && + *text->pos <= '7' && unit * 8 + *text->pos - '0' <= 255; i++) + unit = unit * 8 + *text->pos++ - '0'; + } + else { + switch (unit) { + case 'n': unit = '\n'; break; + case 'r': unit = '\r'; break; + case 't': unit = '\t'; break; + case 'b': unit = '\b'; break; + case 'f': unit = '\f'; break; + case 'v': unit = '\v'; break; + } + } + return unit; + } + return UINT32_MAX; +} + +static uint32_t webpackHash (const uint16_t* start, const uint16_t* end) { + WebpackText text = webpackText(start, end); + uint32_t hash = 2166136261u, unit; + while ((unit = readWebpackUnit(&text)) != UINT32_MAX) hash = (hash ^ unit) * 16777619u; + return hash; +} + +static bool webpackEqual (const uint16_t* start, const uint16_t* end, + const uint16_t* other, const uint16_t* otherEnd) { + WebpackText left = webpackText(start, end), right = webpackText(other, otherEnd); + uint32_t unit; + do { + unit = readWebpackUnit(&left); + if (unit != readWebpackUnit(&right)) return false; + } while (unit != UINT32_MAX); + return true; +} + +static WebpackModule* findWebpackModule (const uint16_t* start, const uint16_t* end) { + if (!webpackCapacity) return NULL; + uint32_t hash = webpackHash(start, end); + for (WebpackModule* module = webpackBuckets[hash & (webpackCapacity - 1)]; module; module = module->bucketNext) + if (module->hash == hash && webpackEqual(start, end, module->start, module->end)) return module; + return NULL; +} + +static WebpackModule* createWebpackModule (const uint16_t* start, const uint16_t* end) { + if (!webpackCapacity || webpackCount == webpackCapacity / 2) { + if (webpackCapacity > UINT32_MAX / 2 / sizeof(WebpackModule*)) { + syntaxError(12); + return NULL; + } + webpackCapacity = webpackCapacity ? webpackCapacity * 2 : 16; + size_t bytes = webpackCapacity * sizeof(WebpackModule*); + ensureAnalysisCapacity(bytes); + webpackBuckets = (WebpackModule**)(uintptr_t)analysis_head; + analysis_head += bytes; + for (uint32_t i = 0; i < webpackCapacity; i++) webpackBuckets[i] = NULL; + for (WebpackModule* module = webpackModules; module; module = module->next) { + uint32_t bucket = module->hash & (webpackCapacity - 1); + module->bucketNext = webpackBuckets[bucket]; + webpackBuckets[bucket] = module; + } + } + if (findWebpackModule(start, end)) webpackInvalid = true; + ensureAnalysisCapacity(sizeof(WebpackModule)); + WebpackModule* module = (WebpackModule*)(uintptr_t)analysis_head; + analysis_head += sizeof(WebpackModule); + *module = (WebpackModule){ .start = start, .end = end, .hash = webpackHash(start, end) }; + uint32_t bucket = module->hash & (webpackCapacity - 1); + module->bucketNext = webpackBuckets[bucket]; + webpackBuckets[bucket] = module; + if (webpackModulesTail) webpackModulesTail->next = module; + else webpackModules = module; + webpackModulesTail = module; + webpackCount++; + return module; +} + +static void captureWebpackSlice (const uint16_t* start, const uint16_t* end, Slice** first, Slice** last) { + ensureAnalysisCapacity(sizeof(Slice)); + Slice* slice = (Slice*)(uintptr_t)analysis_head; + analysis_head += sizeof(Slice); + *slice = (Slice){ start, end, NULL }; + if (*last) (*last)->next = slice; + else *first = slice; + *last = slice; +} + +static void captureWebpackExport (const uint16_t* start, const uint16_t* end) { + captureWebpackSlice(start, end, &webpackCurrent->exports, &webpackCurrent->exportsTail); +} + +static void captureWebpackReexport (const uint16_t* start, const uint16_t* end) { + captureWebpackSlice(start, end, &webpackCurrent->reexports, &webpackCurrent->reexportsTail); +} + +static void addWebpackDependency (const uint16_t* start, const uint16_t* end, bool star) { + WebpackModule* owner = webpackCurrent ? webpackCurrent : &webpackInlineRoot; + ensureAnalysisCapacity(sizeof(WebpackDependency)); + WebpackDependency* dependency = (WebpackDependency*)(uintptr_t)analysis_head; + analysis_head += sizeof(WebpackDependency); + *dependency = (WebpackDependency){ start, end, star, NULL }; + if (owner->dependenciesTail) owner->dependenciesTail->next = dependency; + else owner->dependencies = dependency; + owner->dependenciesTail = dependency; +} + +static bool readWebpackId (const uint16_t** start, const uint16_t** finish) { + uint16_t ch = commentWhitespace(); + *start = pos; + if (ch == '\'' || ch == '"') { stringLiteral(ch); pos++; } + else if (ch >= '0' && ch <= '9') { while (*pos >= '0' && *pos <= '9') pos++; } + else if (!identifier(ch)) return false; + *finish = pos; + return !error; +} + +static bool readWebpackCall (const uint16_t** start, const uint16_t** finish) { + uint16_t* revert = pos; + if (str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'r', 'e', 'q', 'u', 'i', 'r', 'e', '_', '_')) { + pos += 19; + if (commentWhitespace() == '(') { + pos++; + uint16_t ch = commentWhitespace(); + if ((ch == '\'' || ch == '"' || ch >= '0' && ch <= '9') && + readWebpackId(start, finish) && commentWhitespace() == ')') { + pos++; + ch = commentWhitespace(); + if (pos > end || ch == ';' || ch == ',' || ch == ')' || ch == '}') return true; + } + } + } + pos = revert; + return false; +} + +static uint32_t webpackCharAt (const uint16_t* at) { + if (at > end) return 0; + uint16_t ch = *at; + return (ch & 0xfc00) == 0xd800 ? (((ch & 0x3ff) << 10) | (*(at + 1) & 0x3ff)) + 0x10000 : ch; +} + +static bool matchesWebpackBinding (const uint16_t* binding, uint32_t length) { + return binding && (size_t)(end - pos + 1) >= length && *pos == *binding && + memcmp(pos, binding, length * sizeof(uint16_t)) == 0 && !isIdentifierChar(webpackCharAt(pos + length)); +} + +static bool readWebpackToken (uint16_t ch) { + if (webpackCurrent) { + if (matchesWebpackBinding(webpackCurrent->target, webpackCurrent->targetLength)) { + tryParseExportsDotAssign(false, webpackCurrent->targetLength); + return true; + } + if (matchesWebpackBinding(webpackCurrent->module, webpackCurrent->moduleLength)) { + tryParseModuleExportsDotAssign(webpackCurrent->moduleLength); + return true; + } + } + if (ch != '_') return false; + uint16_t* start = pos; + if (str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'm', 'o', 'd', 'u', 'l', 'e', 's', '_', '_') && + !isIdentifierChar(webpackCharAt(pos + 19))) { + pos += 19; + if (commentWhitespace() == '=') { + pos++; + uint16_t next = commentWhitespace(); + if (next == '(') next = readExportExpressionStart(); + if (next == '{') { + if (webpackTablePos) webpackInvalid = true; + else webpackTablePos = pos; + } + } + pos = start; + return false; + } + if (str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'e', 'x', 'p', 'o', 'r', 't', 's', '_', '_') && + !isIdentifierChar(webpackCharAt(pos + 19))) { + if (webpackTablePos && !webpackCurrent) { + pos += 19; + if (commentWhitespace() == '=') { + pos++; + webpackInline = commentWhitespace() == '{'; + webpackEntryStart = webpackEntryEnd = NULL; + const uint16_t *id, *idEnd; + if (readWebpackCall(&id, &idEnd)) { webpackEntryStart = id; webpackEntryEnd = idEnd; } + } + } + pos = start; + tryParseExportsDotAssign(false, 19); + return true; + } + if (!str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'r', 'e', 'q', 'u', 'i', 'r', 'e', '_', '_') || + isIdentifierChar(webpackCharAt(pos + 19))) return false; + if ((webpackCurrent ? openTokenDepth == webpackCurrent->depth : webpackInline) && + readWebpackCall(&starExportBinding_.specifier_start, &starExportBinding_.specifier_end)) { + WebpackModule* owner = webpackCurrent ? webpackCurrent : &webpackInlineRoot; + captureWebpackSlice(starExportBinding_.specifier_start, starExportBinding_.specifier_end, + &owner->imports, &owner->importsTail); + tryBacktrackAddStarExportBinding(start - 1); + return true; + } + pos = start + 19; + if (commentWhitespace() == '.') { + pos++; + if (commentWhitespace() == 'd') { + pos++; + if (commentWhitespace() == '(') { + pos++; + if (readExportsOrModuleDotExports(commentWhitespace()) && commentWhitespace() == ',') { + pos++; + if (commentWhitespace() == '{') exportObjectPos = pos; + } + } + } + } + pos = start; + return false; +} + +static void readWebpackFactory () { + uint16_t* revert = pos; + const uint16_t *id, *idEnd, *module = NULL, *moduleEnd = NULL, *target = NULL, *targetEnd = NULL, *ignored, *ignoredEnd; + pos++; + bool found = readWebpackId(&id, &idEnd); + if (found && commentWhitespace() == ':') { + pos++; + uint16_t ch = commentWhitespace(); + if (ch == '(') { + uint16_t* opening = pos++; + ch = commentWhitespace(); + if (ch != '(' && !(ch == 'f' && str_eq7(pos + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n'))) { pos = opening; ch = '('; } + } + bool fn = ch == 'f' && str_eq7(pos + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n'); + if (fn) { pos += 8; ch = commentWhitespace(); } + if (ch == '(') { + pos++; + if (commentWhitespace() != ')') readWebpackId(&module, &moduleEnd); + ch = commentWhitespace(); + if (ch == ',') { + pos++; + readWebpackId(&target, &targetEnd); + ch = commentWhitespace(); + if (ch == ',') { pos++; readWebpackId(&ignored, &ignoredEnd); ch = commentWhitespace(); } + } + if (ch == ')') { + pos++; + ch = commentWhitespace(); + if (!fn && ch == '=' && *(pos + 1) == '>') { pos += 2; ch = commentWhitespace(); } + if (ch == '{') { + webpackFactoryPos = pos; + webpackPending = createWebpackModule(id, idEnd); + if (webpackPending) { + webpackPending->target = target; + webpackPending->targetLength = target ? targetEnd - target : 0; + webpackPending->module = module; + webpackPending->moduleLength = module ? moduleEnd - module : 0; + } + } + } + } + } + if (found && (!webpackFactoryPos || webpackFactoryPos <= revert)) webpackInvalid = true; + if (!error) pos = revert; +} + +static void finishWebpack () { + WebpackModule* first = NULL; + WebpackModule* last = NULL; + if (webpackPublished && (webpackEntryStart || webpackInline) && !webpackInvalid) { + first = last = webpackEntryStart ? findWebpackModule(webpackEntryStart, webpackEntryEnd) : &webpackInlineRoot; + if (!first) webpackInvalid = true; + else { first->requested = 2; first->queued = true; } + } + while (first && !webpackInvalid) { + WebpackModule* module = first; + first = first->queueNext; + if (!first) last = NULL; + module->queued = false; + uint8_t flag = module->requested & 2 ? 2 : 1; + if (module->visited & flag) continue; + module->visited |= flag; + static const uint16_t defaultName[] = { 'd', 'e', 'f', 'a', 'u', 'l', 't' }; + static const uint16_t esModuleName[] = { '_', '_', 'e', 's', 'M', 'o', 'd', 'u', 'l', 'e' }; + for (Slice* slice = module->exports; slice; slice = slice->next) + if (flag == 2 || !webpackEqual(slice->start, slice->end, defaultName, defaultName + 7) && + !webpackEqual(slice->start, slice->end, esModuleName, esModuleName + 10)) + webpackAddExport(slice->start, slice->end); + for (Slice* slice = module->reexports; slice; slice = slice->next) + webpackAddReexport(slice->start, slice->end); + for (WebpackDependency* dependency = module->dependencies; dependency; dependency = dependency->next) { + WebpackModule* target = findWebpackModule(dependency->start, dependency->end); + if (!target) { webpackInvalid = true; break; } + uint8_t requested = flag == 1 || dependency->star ? 1 : 2; + target->requested |= requested; + if (target->queued || target->visited & requested) continue; + target->queued = true; + target->queueNext = NULL; + if (last) last->queueNext = target; + else first = target; + last = target; + } + } + if (!webpackPublished || !webpackEntryStart && !webpackInline || webpackInvalid) { + for (WebpackModule* module = webpackModules; module; module = module->next) { + for (Slice* slice = module->exports; slice; slice = slice->next) webpackAddExport(slice->start, slice->end); + for (Slice* slice = module->reexports; slice; slice = slice->next) webpackAddReexport(slice->start, slice->end); + } + } +} static inline __attribute__((always_inline)) bool isTokenRunChar (uint16_t ch) { return (uint16_t)((ch | 32) - 'a') < 26 || (uint16_t)(ch - '0') < 10 || @@ -80,11 +486,13 @@ uint32_t parseCJS (uint16_t* _source, uint32_t _sourceLen, void (*_addExport)(co } // Note: parsing is based on the _assumption_ that the source is already valid -uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_addExport)(const uint16_t*, const uint16_t*), void (*_addReexport)(const uint16_t*, const uint16_t*), void (*_addUnsafeGetter)(const uint16_t*, const uint16_t*), void (*_clearReexports)(), uint32_t options) { +static __attribute__((always_inline)) uint32_t parseCJSMode (uint16_t* _source, uint32_t _sourceLen, void (*_addExport)(const uint16_t*, const uint16_t*), void (*_addReexport)(const uint16_t*, const uint16_t*), void (*_addUnsafeGetter)(const uint16_t*, const uint16_t*), void (*_clearReexports)(), uint32_t options, bool extendedMode) { + if (addExport == captureWebpackExport) addExport = webpackAddExport; + if (addReexport == captureWebpackReexport) addReexport = webpackAddReexport; source = _source; sourceLen = _sourceLen; allowMinifiedEnumerable = (options & 1) != 0; - extended = (options & 2) != 0; + extended = extendedMode; if (_addExport) addExport = _addExport; if (_addReexport) @@ -105,6 +513,18 @@ uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_ad lastStarExport = NULL; nextBraceIsClass = false; exportObjectPos = 0; + webpackTablePos = NULL; + if (extendedMode) { + webpackTablePos = webpackFactoryPos = NULL; + webpackEntryStart = webpackEntryEnd = NULL; + webpackModules = webpackModulesTail = webpackCurrent = webpackPending = NULL; + webpackBuckets = NULL; + webpackCapacity = webpackCount = 0; + webpackPublished = webpackInvalid = webpackInline = false; + webpackInlineRoot = (WebpackModule){0}; + webpackAddExport = addExport; + webpackAddReexport = addReexport; + } pos = (uint16_t*)(source - 1); uint16_t ch = '\0'; @@ -128,7 +548,10 @@ uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_ad if (ch == 32 || ch < 14 && ch > 8) continue; - if (openTokenDepth == 0) { + if (extendedMode && keywordStart(pos) && readWebpackToken(ch)) + goto skipTokenRun; + + if (openTokenDepth == 0 || extendedMode && webpackCurrent && webpackCurrent->depth == openTokenDepth) { switch (ch) { case 'i': if (str_eq5(pos + 1, 'm', 'p', 'o', 'r', 't') && keywordStart(pos)) @@ -173,7 +596,7 @@ uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_ad case 'e': if (str_eq5(pos + 1, 'x', 'p', 'o', 'r', 't') && keywordStart(pos)) { if (*(pos + 6) == 's') - tryParseExportsDotAssign(false); + tryParseExportsDotAssign(false, 7); else if (openTokenDepth == 0) throwIfExportStatement(); } @@ -184,29 +607,32 @@ uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_ad goto skipTokenRun; case 'm': if (str_eq5(pos + 1, 'o', 'd', 'u', 'l', 'e') && keywordStart(pos)) - tryParseModuleExportsDotAssign(); + tryParseModuleExportsDotAssign(6); goto skipTokenRun; case 'O': if (str_eq5(pos + 1, 'b', 'j', 'e', 'c', 't') && keywordStart(pos)) - tryParseObjectDefineOrKeys(openTokenDepth == 0); + tryParseObjectDefineOrKeys(openTokenDepth == 0 || extendedMode && + (webpackCurrent ? webpackCurrent->depth == openTokenDepth : webpackInline)); goto skipTokenRun; case '(': if (!pushOpenToken(lastTokenPos)) return error; break; case '[': - if (extended && !pushOpenToken(lastTokenPos)) + if (extendedMode && !pushOpenToken(lastTokenPos)) return error; break; case ']': - if (extended) { + if (extendedMode) { if (openTokenDepth == 0) return syntaxError(8), error; openTokenDepth--; } break; case ',': - if (extended && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & ExportObjectToken)) + if (extendedMode && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & WebpackTableToken)) + readWebpackFactory(); + if (extendedMode && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & ExportObjectToken)) readExportProperty(); break; case ')': @@ -219,15 +645,32 @@ uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_ad return error; openTokenTypeStack[openTokenDepth - 1] = nextBraceIsClass ? ClassToken : 0; nextBraceIsClass = false; - if (extended && pos == exportObjectPos) { + if (extendedMode && pos == exportObjectPos) { openTokenTypeStack[openTokenDepth - 1] |= ExportObjectToken; exportObjectPos = 0; readExportProperty(); } + if (extendedMode && pos == webpackTablePos) { + openTokenTypeStack[openTokenDepth - 1] |= WebpackTableToken; + readWebpackFactory(); + } + else if (extendedMode && pos == webpackFactoryPos) { + webpackCurrent = webpackPending; + webpackCurrent->depth = openTokenDepth; + firstStarExport = lastStarExport = NULL; + addExport = captureWebpackExport; + addReexport = captureWebpackReexport; + } break; case '}': if (openTokenDepth == 0) return syntaxError(2), error; + if (extendedMode && webpackCurrent && webpackCurrent->depth == openTokenDepth) { + webpackCurrent = NULL; + firstStarExport = lastStarExport = NULL; + addExport = webpackAddExport; + addReexport = webpackAddReexport; + } if (openTokenDepth-- == templateDepth) { templateDepth = templateStack[--templateStackDepth]; templateString(); @@ -268,7 +711,7 @@ uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_ad lastToken == ')' && isParenKeyword(openTokenPosStack[openTokenDepth]) || lastToken == '}' && (isExpressionTerminator(openTokenPosStack[openTokenDepth]) || (openTokenTypeStack[openTokenDepth] & ClassToken) || - extended && isStatementBrace(openTokenPosStack[openTokenDepth], openTokenDepth)) || + extendedMode && isStatementBrace(openTokenPosStack[openTokenDepth], openTokenDepth)) || lastToken == '/' && lastSlashWasDivision || isExpressionKeyword(lastTokenPos) || !lastToken) { @@ -302,10 +745,17 @@ uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_ad return error; } + if (webpackTablePos) finishWebpack(); // success return 0; } +uint32_t parseCJSWithOptions (uint16_t* source, uint32_t sourceLen, void (*addExport)(const uint16_t*, const uint16_t*), void (*addReexport)(const uint16_t*, const uint16_t*), void (*addUnsafeGetter)(const uint16_t*, const uint16_t*), void (*clearReexports)(), uint32_t options) { + if (options & 2) + return parseCJSMode(source, sourceLen, addExport, addReexport, addUnsafeGetter, clearReexports, options, true); + return parseCJSMode(source, sourceLen, addExport, addReexport, addUnsafeGetter, clearReexports, options, false); +} + void tryBacktrackAddStarExportBinding (uint16_t* bPos) { while (*bPos == ' ' && bPos > source) bPos--; @@ -914,7 +1364,16 @@ void tryParseObjectDefineOrKeys (bool keys) { while (binding) { if (id_len == binding->id_end - binding->id_start && 0 == memcmp(id_start, binding->id_start, id_len * sizeof(uint16_t))) { - addReexport(binding->specifier_start, binding->specifier_end); + bool internal = false; + if (extended) { + WebpackModule* owner = webpackCurrent ? webpackCurrent : &webpackInlineRoot; + for (Slice* slice = owner->imports; slice; slice = slice->next) + if (slice->start == binding->specifier_start) { internal = true; break; } + } + if (internal) + addWebpackDependency(binding->specifier_start, binding->specifier_end, true); + else + addReexport(binding->specifier_start, binding->specifier_end); pos = revertPos; return; } @@ -929,8 +1388,18 @@ void tryParseObjectDefineOrKeys (bool keys) { bool readExportsOrModuleDotExports (uint16_t ch) { uint16_t* revertPos = pos; - if (ch == 'm' && str_eq5(pos + 1, 'o', 'd', 'u', 'l', 'e')) { - pos += 6; + if (extended) { + if (webpackCurrent && matchesWebpackBinding(webpackCurrent->target, webpackCurrent->targetLength)) { + pos += webpackCurrent->targetLength; + return true; + } + if (!webpackCurrent && ch == '_' && + str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'e', 'x', 'p', 'o', 'r', 't', 's', '_', '_') && + !isIdentifierChar(webpackCharAt(pos + 19))) { pos += 19; return true; } + } + bool moduleAlias = extended && webpackCurrent && matchesWebpackBinding(webpackCurrent->module, webpackCurrent->moduleLength); + if (moduleAlias || ch == 'm' && str_eq5(pos + 1, 'o', 'd', 'u', 'l', 'e')) { + pos += moduleAlias ? webpackCurrent->moduleLength : 6; ch = commentWhitespace(); if (ch != '.') { pos = revertPos; @@ -949,23 +1418,23 @@ bool readExportsOrModuleDotExports (uint16_t ch) { } } -void tryParseModuleExportsDotAssign () { - pos += 6; +void tryParseModuleExportsDotAssign (uint32_t length) { + pos += length; uint16_t* revertPos = pos - 1; uint16_t ch = commentWhitespace(); if (ch == '.') { pos++; ch = commentWhitespace(); if (ch == 'e' && str_eq6(pos + 1, 'x', 'p', 'o', 'r', 't', 's')) { - tryParseExportsDotAssign(true); + tryParseExportsDotAssign(true, 7); return; } } pos = revertPos; } -void tryParseExportsDotAssign (bool assign) { - pos += 7; +void tryParseExportsDotAssign (bool assign, uint32_t length) { + pos += length; uint16_t* revertPos = pos - 1; uint16_t ch = commentWhitespace(); switch (ch) { @@ -1008,6 +1477,23 @@ void tryParseExportsDotAssign (bool assign) { pos++; ch = commentWhitespace(); if (extended) { + if (ch == '_') { + uint16_t* start = pos; + const uint16_t *id, *idEnd; + if (webpackTablePos && readWebpackCall(&id, &idEnd)) { + if (webpackCurrent) addWebpackDependency(id, idEnd, false); + else { webpackEntryStart = id; webpackEntryEnd = idEnd; webpackPublished = true; } + } + pos = start; + if (webpackTablePos && !webpackCurrent && + str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'e', 'x', 'p', 'o', 'r', 't', 's', '_', '_') && + !isIdentifierChar(webpackCharAt(pos + 19))) { + pos += 19; + uint16_t next = commentWhitespace(); + if (pos > end || next == ';' || next == ',' || next == ')' || next == '}') webpackPublished = true; + else webpackInvalid = true; + } + } if (ch == '(') ch = readExportExpressionStart(); if (ch == '{') exportObjectPos = pos; else if (ch == 'r') tryParseRequire(ExportAssign); diff --git a/test/fixtures/webpack/LICENSE b/test/fixtures/webpack/LICENSE new file mode 100644 index 0000000..b862434 --- /dev/null +++ b/test/fixtures/webpack/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. +Copyright Contributors to the Jest project. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/test/fixtures/webpack/jest-watcher.cjs b/test/fixtures/webpack/jest-watcher.cjs new file mode 100644 index 0000000..6795cc0 --- /dev/null +++ b/test/fixtures/webpack/jest-watcher.cjs @@ -0,0 +1,556 @@ +/*! + * /** + * * Copyright (c) Meta Platforms, Inc. and affiliates. + * * + * * This source code is licensed under the MIT license found in the + * * LICENSE file in the root directory of this source tree. + * * / + */ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/BaseWatchPlugin.ts": +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +class BaseWatchPlugin { + _stdin; + _stdout; + constructor({ + stdin, + stdout + }) { + this._stdin = stdin; + this._stdout = stdout; + } + + // eslint-disable-next-line @typescript-eslint/no-empty-function + apply(_hooks) {} + getUsageInfo(_globalConfig) { + return null; + } + + // eslint-disable-next-line @typescript-eslint/no-empty-function + onKey(_key) {} + run(_globalConfig, _updateConfigAndRun) { + return Promise.resolve(); + } +} +var _default = exports["default"] = BaseWatchPlugin; + +/***/ }), + +/***/ "./src/JestHooks.ts": +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +class JestHooks { + _listeners; + _subscriber; + _emitter; + constructor() { + this._listeners = { + onFileChange: [], + onTestRunComplete: [], + shouldRunTestSuite: [] + }; + this._subscriber = { + onFileChange: fn => { + this._listeners.onFileChange.push(fn); + }, + onTestRunComplete: fn => { + this._listeners.onTestRunComplete.push(fn); + }, + shouldRunTestSuite: fn => { + this._listeners.shouldRunTestSuite.push(fn); + } + }; + this._emitter = { + onFileChange: fs => { + for (const listener of this._listeners.onFileChange) listener(fs); + }, + onTestRunComplete: results => { + for (const listener of this._listeners.onTestRunComplete) listener(results); + }, + shouldRunTestSuite: async testSuiteInfo => { + const result = await Promise.all(this._listeners.shouldRunTestSuite.map(listener => listener(testSuiteInfo))); + return result.every(Boolean); + } + }; + } + isUsed(hook) { + return this._listeners[hook]?.length > 0; + } + getSubscriber() { + return this._subscriber; + } + getEmitter() { + return this._emitter; + } +} +var _default = exports["default"] = JestHooks; + +/***/ }), + +/***/ "./src/PatternPrompt.ts": +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +function _ansiEscapes() { + const data = _interopRequireDefault(require("ansi-escapes")); + _ansiEscapes = function () { + return data; + }; + return data; +} +function _chalk() { + const data = _interopRequireDefault(require("chalk")); + _chalk = function () { + return data; + }; + return data; +} +function _jestUtil() { + const data = require("jest-util"); + _jestUtil = function () { + return data; + }; + return data; +} +function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +const { + CLEAR +} = _jestUtil().specialChars; +const usage = entity => `\n${_chalk().default.bold('Pattern Mode Usage')}\n` + ` ${_chalk().default.dim('\u203A Press')} Esc ${_chalk().default.dim('to exit pattern mode.')}\n` + ` ${_chalk().default.dim('\u203A Press')} Enter ` + `${_chalk().default.dim(`to filter by a ${entity} regex pattern.`)}\n` + '\n'; +const usageRows = usage('').split('\n').length; +class PatternPrompt { + _currentUsageRows; + constructor(_pipe, _prompt, _entityName = '') { + this._pipe = _pipe; + this._prompt = _prompt; + this._entityName = _entityName; + this._currentUsageRows = usageRows; + } + run(onSuccess, onCancel, options) { + this._pipe.write(_ansiEscapes().default.cursorHide); + this._pipe.write(CLEAR); + if (typeof options?.header === 'string' && options.header) { + this._pipe.write(`${options.header}\n`); + this._currentUsageRows = usageRows + options.header.split('\n').length; + } else { + this._currentUsageRows = usageRows; + } + this._pipe.write(usage(this._entityName)); + this._pipe.write(_ansiEscapes().default.cursorShow); + this._prompt.enter(this._onChange.bind(this), onSuccess, onCancel); + } + _onChange(_pattern, _options) { + this._pipe.write(_ansiEscapes().default.eraseLine); + this._pipe.write(_ansiEscapes().default.cursorLeft); + } +} +exports["default"] = PatternPrompt; + +/***/ }), + +/***/ "./src/TestWatcher.ts": +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +function _emittery() { + const data = _interopRequireDefault(require("emittery")); + _emittery = function () { + return data; + }; + return data; +} +function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +class TestWatcher extends _emittery().default { + state; + _isWatchMode; + constructor({ + isWatchMode + }) { + super(); + this.state = { + interrupted: false + }; + this._isWatchMode = isWatchMode; + } + async setState(state) { + Object.assign(this.state, state); + await this.emit('change', this.state); + } + isInterrupted() { + return this.state.interrupted; + } + isWatchMode() { + return this._isWatchMode; + } +} +exports["default"] = TestWatcher; + +/***/ }), + +/***/ "./src/constants.ts": +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.KEYS = void 0; +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +const isWindows = process.platform === 'win32'; +const KEYS = exports.KEYS = { + ARROW_DOWN: '\u001B[B', + ARROW_LEFT: '\u001B[D', + ARROW_RIGHT: '\u001B[C', + ARROW_UP: '\u001B[A', + BACKSPACE: Buffer.from(isWindows ? '08' : '7f', 'hex').toString(), + CONTROL_C: '\u0003', + CONTROL_D: '\u0004', + CONTROL_U: '\u0015', + ENTER: '\r', + ESCAPE: '\u001B' +}; + +/***/ }), + +/***/ "./src/index.ts": +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +var _exportNames = { + BaseWatchPlugin: true, + JestHook: true, + PatternPrompt: true, + TestWatcher: true, + Prompt: true +}; +Object.defineProperty(exports, "BaseWatchPlugin", ({ + enumerable: true, + get: function () { + return _BaseWatchPlugin.default; + } +})); +Object.defineProperty(exports, "JestHook", ({ + enumerable: true, + get: function () { + return _JestHooks.default; + } +})); +Object.defineProperty(exports, "PatternPrompt", ({ + enumerable: true, + get: function () { + return _PatternPrompt.default; + } +})); +Object.defineProperty(exports, "Prompt", ({ + enumerable: true, + get: function () { + return _Prompt.default; + } +})); +Object.defineProperty(exports, "TestWatcher", ({ + enumerable: true, + get: function () { + return _TestWatcher.default; + } +})); +var _BaseWatchPlugin = _interopRequireDefault(__webpack_require__("./src/BaseWatchPlugin.ts")); +var _JestHooks = _interopRequireDefault(__webpack_require__("./src/JestHooks.ts")); +var _PatternPrompt = _interopRequireDefault(__webpack_require__("./src/PatternPrompt.ts")); +var _TestWatcher = _interopRequireDefault(__webpack_require__("./src/TestWatcher.ts")); +var _constants = __webpack_require__("./src/constants.ts"); +Object.keys(_constants).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _constants[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _constants[key]; + } + }); +}); +var _Prompt = _interopRequireDefault(__webpack_require__("./src/lib/Prompt.ts")); +var _patternModeHelpers = __webpack_require__("./src/lib/patternModeHelpers.ts"); +Object.keys(_patternModeHelpers).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _patternModeHelpers[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _patternModeHelpers[key]; + } + }); +}); +function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } + +/***/ }), + +/***/ "./src/lib/Prompt.ts": +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _constants = __webpack_require__("./src/constants.ts"); +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +class Prompt { + _entering; + _value; + _onChange; + _onSuccess; + _onCancel; + _offset; + _promptLength; + _selection; + constructor() { + // Copied from `enter` to satisfy TS + this._entering = true; + this._value = ''; + this._selection = null; + this._offset = -1; + this._promptLength = 0; + + /* eslint-disable @typescript-eslint/no-empty-function */ + this._onChange = () => {}; + this._onSuccess = () => {}; + this._onCancel = () => {}; + /* eslint-enable */ + } + _onResize = () => { + this._onChange(); + }; + enter(onChange, onSuccess, onCancel) { + this._entering = true; + this._value = ''; + this._onSuccess = onSuccess; + this._onCancel = onCancel; + this._selection = null; + this._offset = -1; + this._promptLength = 0; + this._onChange = () => onChange(this._value, { + max: 10, + offset: this._offset + }); + this._onChange(); + process.stdout.on('resize', this._onResize); + } + setPromptLength(length) { + this._promptLength = length; + } + setPromptSelection(selected) { + this._selection = selected; + } + put(key) { + switch (key) { + case _constants.KEYS.ENTER: + this._entering = false; + this._onSuccess(this._selection ?? this._value); + this.abort(); + break; + case _constants.KEYS.ESCAPE: + this._entering = false; + this._onCancel(this._value); + this.abort(); + break; + case _constants.KEYS.ARROW_DOWN: + this._offset = Math.min(this._offset + 1, this._promptLength - 1); + this._onChange(); + break; + case _constants.KEYS.ARROW_UP: + this._offset = Math.max(this._offset - 1, -1); + this._onChange(); + break; + case _constants.KEYS.ARROW_LEFT: + case _constants.KEYS.ARROW_RIGHT: + break; + case _constants.KEYS.CONTROL_U: + this._value = ''; + this._offset = -1; + this._selection = null; + this._onChange(); + break; + default: + this._value = key === _constants.KEYS.BACKSPACE ? this._value.slice(0, -1) : this._value + key; + this._offset = -1; + this._selection = null; + this._onChange(); + break; + } + } + abort() { + this._entering = false; + this._value = ''; + process.stdout.removeListener('resize', this._onResize); + } + isEntering() { + return this._entering; + } +} +exports["default"] = Prompt; + +/***/ }), + +/***/ "./src/lib/patternModeHelpers.ts": +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.printPatternCaret = printPatternCaret; +exports.printRestoredPatternCaret = printRestoredPatternCaret; +function _ansiEscapes() { + const data = _interopRequireDefault(require("ansi-escapes")); + _ansiEscapes = function () { + return data; + }; + return data; +} +function _chalk() { + const data = _interopRequireDefault(require("chalk")); + _chalk = function () { + return data; + }; + return data; +} +function _stringLength() { + const data = _interopRequireDefault(require("string-length")); + _stringLength = function () { + return data; + }; + return data; +} +function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +function printPatternCaret(pattern, pipe) { + const inputText = `${_chalk().default.dim(' pattern \u203A')} ${pattern}`; + pipe.write(_ansiEscapes().default.eraseDown); + pipe.write(inputText); + pipe.write(_ansiEscapes().default.cursorSavePosition); +} +function printRestoredPatternCaret(pattern, currentUsageRows, pipe) { + const inputText = `${_chalk().default.dim(' pattern \u203A')} ${pattern}`; + pipe.write(_ansiEscapes().default.cursorTo((0, _stringLength().default)(inputText), currentUsageRows - 1)); + pipe.write(_ansiEscapes().default.cursorRestorePosition); +} + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = __webpack_require__("./src/index.ts"); +/******/ module.exports = __webpack_exports__; +/******/ +/******/ })() +; \ No newline at end of file diff --git a/test/webpack.js b/test/webpack.js new file mode 100644 index 0000000..9027115 --- /dev/null +++ b/test/webpack.js @@ -0,0 +1,302 @@ +const assert = require('node:assert/strict'); +const { readFileSync } = require('node:fs'); +const { join } = require('node:path'); +const vm = require('node:vm'); + +let parse; +const options = { mode: 'extended' }; + +/** @param {string} modules */ +function bundle (modules) { + return `(() => { + const __webpack_modules__ = { ${modules} }; + const cache = {}; + function __webpack_require__(id) { + if (cache[id]) return cache[id].exports; + const module = cache[id] = { exports: {} }; + __webpack_modules__[id](module, module.exports, __webpack_require__); + return module.exports; + } + const __webpack_exports__ = __webpack_require__('entry'); + module.exports = __webpack_exports__; + })();`; +} + +/** @param {string} id */ +function star (id) { + return `var dep = __webpack_require__(${JSON.stringify(id)}); + Object.keys(dep).forEach(function (key) { + if (key === 'default' || key === '__esModule') return; + exports[key] = dep[key]; + });`; +} + +suite('Webpack extended detection', () => { + suiteSetup(async () => { + if (process.env.WASM) { + const lexer = await import('../dist/lexer.mjs'); + await lexer.init(); + parse = lexer.parse; + } else if (process.env.WASM_SYNC) { + parse = require('../dist/lexer.js').parse; + } else { + parse = require('../lexer.js').parse; + } + }); + + test('published jest-watcher@30.2.0 bundle excludes internal default exports', () => { + const source = readFileSync(join(__dirname, 'fixtures/webpack/jest-watcher.cjs'), 'utf8'); + const result = parse(source, 'jest-watcher.cjs', options); + assert.ok(!result.exports.includes('default')); + assert.deepEqual(result.exports.sort(), [ + 'BaseWatchPlugin', 'JestHook', 'KEYS', 'PatternPrompt', 'Prompt', 'TestWatcher', + '__esModule', 'printPatternCaret', 'printRestoredPatternCaret' + ].sort()); + assert.deepEqual(result.reexports, []); + assert.deepEqual(parse(source).exports, [ + 'default', 'KEYS', 'printPatternCaret', 'printRestoredPatternCaret' + ]); + }); + + test('entry exports exclude unrelated factories', () => { + const source = bundle(` + unused: (module, exports) => { exports.hidden = 1; }, + entry: (module, exports) => { exports.visible = 2; } + `); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + const result = parse(source, 'bundle.cjs', options); + assert.ok(!result.exports.includes('hidden')); + assert.deepEqual(result.exports, Object.keys(module.exports)); + assert.deepEqual(result.reexports, []); + }); + + const factories = [ + 'entry: (module, exports) => { exports.visible = 1; }', + 'entry: function(module, exports) { exports.visible = 1; }', + 'entry: (m, e) => { e.visible = 1; }', + 'entry: (m) => { m.exports = { visible: 1 }; }', + 'entry: () => {}' + ]; + for (const factory of factories) { + test(`factory ${factory}`, () => { + const source = bundle(`unused: (m, e) => { e.hidden = 1; }, ${factory}`); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports, Object.keys(module.exports)); + }); + } + + test('Webpack getter maps use the factory export binding', () => { + const source = bundle(` + unused: (m, __webpack_exports__) => { + __webpack_require__.d(__webpack_exports__, { hidden: () => 0 }); + }, + entry: (m, __webpack_exports__) => { + __webpack_require__.d(__webpack_exports__, { visible: () => 1, ['quoted']: () => 2 }); + } + `); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible', 'quoted'], reexports: [] }); + }); + + test('descriptors can target the module parameter', () => { + const source = bundle(`entry: (m, e) => { + Object.defineProperties(m.exports, { visible: { value: 1 } }); + }`); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible'], reexports: [] }); + }); + + test('inlined entries exclude unrelated factories', () => { + const source = bundle(`entry: (m, exports) => { exports.hidden = 1; }`) + .replace("const __webpack_exports__ = __webpack_require__('entry');", + 'const __webpack_exports__ = {}; __webpack_exports__.visible = 1;'); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports, Object.keys(module.exports)); + }); + + test('inlined entry star reexports follow internal dependencies', () => { + const source = bundle(` + unused: (m, exports) => { exports.hidden = 1; }, + dependency: (m, exports) => { + exports.default = 1; exports.__esModule = true; exports.visible = 2; + } + `).replace("const __webpack_exports__ = __webpack_require__('entry');", ` + const __webpack_exports__ = {}; + (() => { var exports = __webpack_exports__; ${star('dependency')} })();`); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports, Object.keys(module.exports)); + }); + + test('unknown inlined entry star reexports retain candidates', () => { + const source = bundle(` + unused: (m, exports) => { exports.hidden = 1; }, + dependency: (m, exports) => { exports.visible = 1; } + `).replace("const __webpack_exports__ = __webpack_require__('entry');", ` + const __webpack_exports__ = {}; + (() => { var exports = __webpack_exports__; ${star('unknown')} })();`); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports.sort(), ['hidden', 'visible']); + }); + + test('inlined entries ignore non-reexported internal dependencies', () => { + const source = bundle('dependency: (m, exports) => { exports.hidden = 1; }') + .replace("const __webpack_exports__ = __webpack_require__('entry');", ` + const __webpack_exports__ = {}; + __webpack_require__('dependency'); + __webpack_exports__.visible = 1;`); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports, Object.keys(module.exports)); + }); + + test('internal whole-module reexports retain default', () => { + const source = bundle(` + dependency: (m, e) => { e.default = 1; e.visible = 2; }, + entry: (m, e) => { m.exports = __webpack_require__('dependency'); } + `); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['default', 'visible'], reexports: [] }); + }); + + test('internal star reexports exclude default and __esModule', () => { + const source = bundle(` + unused: (m, exports) => { exports.hidden = 1; }, + dependency: (m, exports) => { + exports.default = 1; exports.__esModule = true; exports.visible = 2; + }, + entry: (m, exports) => { exports.own = 1; ${star('dependency')} } + `); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports, Object.keys(module.exports)); + }); + + test('star reexports terminate on cycles', () => { + const source = bundle(` + dependency: (m, exports) => { exports.second = 2; ${star('entry')} }, + entry: (m, exports) => { exports.first = 1; ${star('dependency')} } + `); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports, Object.keys(module.exports)); + }); + + test('whole-module reexports upgrade a prior star visit', () => { + const source = bundle(` + leaf: (m, exports) => { exports.default = 1; exports.visible = 2; }, + middle: (module, exports) => { module.exports = __webpack_require__('leaf'); }, + entry: (module, exports) => { ${star('leaf')} module.exports = __webpack_require__('middle'); } + `); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports.sort(), ['default', 'visible']); + }); + + test('external reexports belong to the selected entry', () => { + const source = bundle(` + unused: (module) => { module.exports = require('hidden'); }, + entry: (module) => { module.exports = require('visible'); } + `); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: [], reexports: ['visible'] }); + }); + + test('numeric module identifiers', () => { + const source = bundle(` + 0: (m, e) => { e.hidden = 1; }, + 1: (m, e) => { e.visible = 1; } + `).replace("__webpack_require__('entry')", '__webpack_require__(1)'); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible'], reexports: [] }); + }); + + test('quoted and escaped module identifiers', () => { + const source = bundle(` + unused: (m, e) => { e.hidden = 1; }, + 'entr\\u0079': (m, e) => { e.visible = 1; } + `); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible'], reexports: [] }); + }); + + for (const id of ['', '__proto__', '\u{1f4a9}', 'a"b', 'a\\b']) { + test(`module identifier ${JSON.stringify(id)}`, () => { + const source = bundle(` + unused: (m, exports) => { exports.hidden = 1; }, + ${JSON.stringify(id)}: (m, exports) => { exports.visible = 1; } + `).replace("__webpack_require__('entry')", `__webpack_require__(${JSON.stringify(id)})`); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible'], reexports: [] }); + }); + } + + test('module maps grow without losing factories', () => { + const factories = []; + for (let i = 0; i < 200; i++) factories.push(`${i}: (m, exports) => { exports.hidden = 1; }`); + factories.push('entry: (m, exports) => { exports.visible = 1; }'); + assert.deepEqual(parse(bundle(factories.join(',')), 'bundle.cjs', options), + { exports: ['visible'], reexports: [] }); + }); + + test('direct startup reexport', () => { + const source = bundle(` + unused: (m, e) => { e.hidden = 1; }, + entry: (m, e) => { e.visible = 1; } + `).replace("const __webpack_exports__ = __webpack_require__('entry');\n module.exports = __webpack_exports__;", + "module.exports = __webpack_require__('entry');"); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible'], reexports: [] }); + }); + + test('unknown entries retain candidate detection', () => { + const source = bundle('entry: (m, exports) => { exports.visible = 1; }') + .replace("__webpack_require__('entry');\n module.exports", "__webpack_require__('unknown');\n module.exports"); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible'], reexports: [] }); + }); + + for (const suffix of ['.nested', ' + other', '[key]']) { + test(`modified startup expression ${suffix} retains candidates`, () => { + const source = bundle(`unused: (m, exports) => { exports.hidden = 1; }, + entry: (m, exports) => { exports.visible = 1; }`) + .replace("__webpack_require__('entry');", `__webpack_require__('entry')${suffix};`); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports.sort(), ['hidden', 'visible']); + }); + test(`modified published value ${suffix} retains candidates`, () => { + const source = bundle(`unused: (m, exports) => { exports.hidden = 1; }, + entry: (m, exports) => { exports.visible = 1; }`) + .replace('module.exports = __webpack_exports__;', `module.exports = __webpack_exports__${suffix};`); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports.sort(), ['hidden', 'visible']); + }); + } + + test('unknown internal reexports retain candidate detection', () => { + const source = bundle(` + unused: (m, exports) => { exports.hidden = 1; }, + entry: (module, exports) => { exports.visible = 1; module.exports = __webpack_require__('unknown'); } + `); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports.sort(), ['hidden', 'visible']); + }); + + test('unpublished tables retain candidate detection', () => { + const source = bundle('entry: (m, exports) => { exports.visible = 1; }') + .replace('module.exports = __webpack_exports__;', ''); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible'], reexports: [] }); + }); + + test('duplicate module identifiers retain candidate detection', () => { + const source = bundle(`entry: (m, exports) => { exports.first = 1; }, + entry: (m, exports) => { exports.second = 2; }`); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports.sort(), ['first', 'second']); + }); + + test('comments, strings, and templates cannot create a module table', () => { + const source = ` + // __webpack_modules__ = { entry: (m, exports) => { exports.fake = 1; } }; + const text = '__webpack_modules__ = {'; + const template = \`__webpack_modules__ = {\`; + exports.visible = 1; + `; + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible'], reexports: [] }); + }); + + test('bundle detection resets after a scanner error', () => { + const source = 'var __webpack_modules__ = { entry: (m, e) => { e.hidden = 1;'; + assert.throws(() => parse(source, 'broken.cjs', options), /broken.cjs/); + assert.deepEqual(parse('exports.visible = 1;'), { exports: ['visible'], reexports: [] }); + assert.deepEqual(parse(bundle('entry: (m, e) => { e.visible = 1; }'), 'bundle.cjs', options), + { exports: ['visible'], reexports: [] }); + }); +}); From cb77579aebfff898cecd2e4b4c0817202bfb3b9a Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 19 Nov 2026 19:00:24 +0100 Subject: [PATCH 2/5] fix(lexer): retain candidates for unrecognized Webpack exports 1. Unknown uses of factory exports can hide internal reexports. Retain the full candidate set when a reachable factory has an unsupported export use. Preserve surrounding star bindings across factory scans. 2. Read shorthand factories and both getter map forms in Webpack 5.112. Keep the delimiter after a literal require call so the scanner can close a factory without a trailing semicolon. 3. Skip Webpack keyword checks for unrelated tokens. Eight passes over test/samples in extended Wasm mode take 78.74 ms before and 67.41 ms after on Node.js 22.23.4 (trimmed mean of seven trials). The Wasm binary uses memory.fill and needs bulk memory. Enable the feature explicitly for WABT versions that require the flag. Drive-by fix: * Remove the duplicate parameter annotation. Signed-off-by: Ruben Bridgewater --- Makefile | 5 +- README.md | 5 +- build/Makefile | 2 +- include-wasm/cjs-module-lexer.h | 4 +- lexer.js | 146 +- lib/lexer.wasm | Bin 40106 -> 41116 bytes lib/lexer.wat | 5268 +++++++++-------- src/lexer.c | 166 +- test/fixtures/webpack/README.md | 33 + .../webpack/webpack-5.112-harmony.cjs | 93 + .../webpack/webpack-5.112-ts-star.cjs | 127 + test/webpack.js | 92 + 12 files changed, 3471 insertions(+), 2470 deletions(-) create mode 100644 test/fixtures/webpack/README.md create mode 100644 test/fixtures/webpack/webpack-5.112-harmony.cjs create mode 100644 test/fixtures/webpack/webpack-5.112-ts-star.cjs diff --git a/Makefile b/Makefile index bf45b62..cc1b29f 100755 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ WASM2WAT ?= ../wabt/bin/wasm2wat +WASM2WAT_FLAGS ?= $(filter --enable-bulk-memory,$(shell $(WASM2WAT) --help)) WASM_OPT ?= ../binaryen/bin/wasm-opt .PHONY: optimize clean lib/lexer.wat: lib/lexer.wasm - $(WASM2WAT) lib/lexer.wasm -o lib/lexer.wat + $(WASM2WAT) $(WASM2WAT_FLAGS) lib/lexer.wasm -o lib/lexer.wat lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c | lib/ node build/wasm.js --docker @@ -13,7 +14,7 @@ lib/: @mkdir -p $@ optimize: lib/lexer.wasm - $(WASM_OPT) -Oz --enable-bulk-memory --strip-debug lib/lexer.wasm -o lib/lexer.wasm + $(WASM_OPT) -Oz --enable-bulk-memory lib/lexer.wasm -o lib/lexer.wasm clean: $(RM) lib/* diff --git a/README.md b/README.md index 0e86515..47c4247 100755 --- a/README.md +++ b/README.md @@ -112,12 +112,13 @@ The same limitation applies to `Object.defineProperties`. Direct reexport assignments contribute all detected dependencies instead of only the last assignment. Object spreads of `require('literal')` contribute reexports, but named properties with require-valued expressions do not. -Extended mode recognizes Webpack assignments through `__webpack_exports__` and getter maps in `__webpack_require__.d`. +Extended mode recognizes Webpack assignments through `__webpack_exports__` and object or array getter maps in `__webpack_require__.d`. For object-shaped `__webpack_modules__` tables, a literal startup module ID selects the entry factory. Detection follows internal whole-module reexports and supported star reexports, which exclude `default` and `__esModule`. An inlined entry can instead initialize `__webpack_exports__` with an object literal. Unrelated factories do not contribute names when the bundle publishes the recognized entry. -Unrecognized startup expressions and unresolved internal reexports retain candidate detection. +Detection retains candidates from all factories if it cannot recognize the startup expression or resolve an internal reexport. +It also retains those candidates if it encounters an unsupported use of the exports or module parameter in a reachable factory. The result contains syntactic candidates, which can include non-enumerable properties, throwing getters, and unreachable assignments. Extended mode does not apply the default getter side-effect veto. diff --git a/build/Makefile b/build/Makefile index 809b50f..0989533 100755 --- a/build/Makefile +++ b/build/Makefile @@ -21,7 +21,7 @@ lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c $(WASM_LDFLAGS) $(WASM_EXTRA_LDFLAGS) optimize: lib/lexer.wasm - ${WASM_OPT} -Oz --enable-bulk-memory --strip-debug lib/lexer.wasm -o lib/lexer.wasm + ${WASM_OPT} -Oz --enable-bulk-memory lib/lexer.wasm -o lib/lexer.wasm clean: rm lib/* diff --git a/include-wasm/cjs-module-lexer.h b/include-wasm/cjs-module-lexer.h index 262f92a..bb1fe9a 100755 --- a/include-wasm/cjs-module-lexer.h +++ b/include-wasm/cjs-module-lexer.h @@ -197,8 +197,8 @@ void tryParseLiteralExports (); void readExportDefinition (); void readExportProperty (); bool readExportsOrModuleDotExports (uint16_t ch); -void tryParseModuleExportsDotAssign (uint32_t length); -void tryParseExportsDotAssign (bool assign, uint32_t length); +bool tryParseModuleExportsDotAssign (uint32_t length); +bool tryParseExportsDotAssign (bool assign, uint32_t length); void tryParseObjectDefineOrKeys (bool keys); bool identifier (uint16_t ch); diff --git a/lexer.js b/lexer.js index 08d762a..cce7f05 100755 --- a/lexer.js +++ b/lexer.js @@ -1,10 +1,13 @@ let source, pos, end; let extended, exportObjectPos; -let webpack; +let webpack, webpackTrustedEnd, webpackArrayPos; const STACK_DEPTH = 2048; const ClassToken = 1; const ExportObjectToken = 2; const WebpackTableToken = 4; +const WebpackArrayKeyToken = 8; +const WebpackArrayBindingToken = 16; +const WebpackArrayValueToken = 32; const templateStack = new Array(1024); const openTokenPosStack = new Array(1024); const openTokenTypeStack = new Array(1024); @@ -30,6 +33,7 @@ function resetState () { nextBraceIsClass = false; allowMinifiedEnumerable = false; webpack = undefined; + webpackTrustedEnd = webpackArrayPos = -1; starExportMap = Object.create(null); lastStarExportSpecifier = null; @@ -144,7 +148,7 @@ function parseSource (cjsSource) { if (ch === 32 || ch < 14 && ch > 8) continue; - if (extendedMode && keywordStart(pos) && readWebpackToken(ch)) { + if (extendedMode && (ch === 95 || webpack?.current) && keywordStart(pos) && readWebpackToken(ch)) { skipTokenRun(); lastTokenPos = pos; continue; @@ -228,6 +232,10 @@ function parseSource (cjsSource) { case 91/*[*/: if (extendedMode) { pushOpenToken(lastTokenPos); + if (pos === webpackArrayPos) { + webpackArrayPos = -1; + readWebpackArrayElement(WebpackArrayKeyToken); + } } break; case 93/*]*/: @@ -237,10 +245,12 @@ function parseSource (cjsSource) { } break; case 44/*,*/: - if (extendedMode && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & WebpackTableToken)) - readWebpackFactory(); - if (extendedMode && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & ExportObjectToken)) - readExportProperty(); + if (extendedMode && openTokenDepth) { + const token = openTokenTypeStack[openTokenDepth - 1]; + if (token & WebpackTableToken) readWebpackFactory(); + if (token & ExportObjectToken) readExportProperty(); + if (token >= WebpackArrayKeyToken) readWebpackArrayElement(token); + } break; case 41/*)*/: if (openTokenDepth === 0) @@ -350,14 +360,17 @@ function parseSource (cjsSource) { /** @param {number} ch */ function readWebpackToken (ch) { const current = webpack?.current; + const start = pos; const target = current?.target; if (target && source.startsWith(target, pos) && !isIdentifierChar(source.codePointAt(pos + target.length), true)) { - tryParseExportsDotAssign(false, target.length); + if (!tryParseExportsDotAssign(false, target.length) && start >= webpackTrustedEnd) + current.uncertain = true; return true; } if (current?.module && source.startsWith(current.module, pos) && !isIdentifierChar(source.codePointAt(pos + current.module.length), true)) { - tryParseModuleExportsDotAssign(current.module.length); + if (!tryParseModuleExportsDotAssign(current.module.length) && start >= webpackTrustedEnd) + current.uncertain = true; return true; } if (ch !== 95/*_*/) return false; @@ -401,7 +414,6 @@ function readWebpackToken (ch) { } if (!source.startsWith('__webpack_require__', pos) || isIdentifierChar(source.codePointAt(pos + 19), true)) return false; - const start = pos; if (current ? openTokenDepth === current.depth : webpack?.inline) { const id = readWebpackCall(); if (id !== undefined) { @@ -413,13 +425,26 @@ function readWebpackToken (ch) { pos = start + 19; if (commentWhitespace() === 46/*.*/) { pos++; - if (commentWhitespace() === 100/*d*/) { + const method = commentWhitespace(); + if (method === 100/*d*/ || method === 114/*r*/) { pos++; if (commentWhitespace() === 40/*(*/) { pos++; - if (readExportsOrModuleDotExports(commentWhitespace()) && commentWhitespace() === 44/*,*/) { - pos++; - if (commentWhitespace() === 123/*{*/) exportObjectPos = pos; + if (readExportsOrModuleDotExports(commentWhitespace())) { + const argEnd = pos; + const next = commentWhitespace(); + if (method === 114 && next === 41) trustWebpackExports(argEnd); + if (method === 100 && next === 44) { + pos++; + const definition = commentWhitespace(); + if (definition === 123) { + exportObjectPos = pos; + trustWebpackExports(argEnd); + } else if (definition === 91) { + webpackArrayPos = pos; + trustWebpackExports(argEnd); + } + } } } } @@ -428,6 +453,39 @@ function readWebpackToken (ch) { return false; } +/** @param {number} finish */ +function trustWebpackExports (finish) { + if (webpack?.current && finish > webpackTrustedEnd) webpackTrustedEnd = finish; +} + +/** @param {number} token */ +function readWebpackArrayElement (token) { + const start = pos++; + const ch = commentWhitespace(); + let next = WebpackArrayKeyToken; + if (token === WebpackArrayKeyToken) { + next = 0; + if (ch === 34 || ch === 39) { + const name = pos; + stringLiteral(ch); + const nameEnd = ++pos; + if (commentWhitespace() === 44) { + _exports.add(decode(source.slice(name, nameEnd))); + next = WebpackArrayBindingToken; + } + } + if (!next && ch !== 93) { + if (webpack?.current) webpack.current.uncertain = true; + else if (webpack?.inline) webpack.invalid = true; + } + } else if (token === WebpackArrayBindingToken && ch === 48) { + pos++; + if (commentWhitespace() === 44) next = WebpackArrayValueToken; + } + openTokenTypeStack[openTokenDepth - 1] = next; + pos = start; +} + function readWebpackId () { const ch = commentWhitespace(); const start = pos; @@ -451,9 +509,12 @@ function readWebpackCall () { const ch = commentWhitespace(); const id = ch === 34 || ch === 39 || ch >= 48 && ch <= 57 ? readWebpackId() : undefined; if (id !== undefined && commentWhitespace() === 41/*)*/) { - pos++; + const callEnd = pos++; const ch = commentWhitespace(); - if (pos > end || ch === 59 || ch === 44 || ch === 41 || ch === 125) return id; + if (pos > end || ch === 59 || ch === 44 || ch === 41 || ch === 125) { + pos = callEnd; + return id; + } } } } @@ -464,10 +525,11 @@ function readWebpackFactory () { const start = pos; pos++; const id = readWebpackId(); - if (id !== undefined && commentWhitespace() === 58/*:*/) { - pos++; + const separator = commentWhitespace(); + if (id !== undefined && (separator === 58 || separator === 40)) { + if (separator === 58) pos++; let ch = commentWhitespace(); - if (ch === 40/*(*/) { + if (separator === 58 && ch === 40/*(*/) { const opening = pos; pos++; ch = commentWhitespace(); @@ -500,10 +562,11 @@ function readWebpackFactory () { if (ch === 41) { pos++; ch = commentWhitespace(); - if (!fn && ch === 61 && source.charCodeAt(pos + 1) === 62) { + const arrow = !fn && separator === 58; + if (arrow && ch === 61 && source.charCodeAt(pos + 1) === 62) { pos += 2; ch = commentWhitespace(); - } + } else if (arrow) ch = 0; if (ch === 123) { webpack.factoryPos = pos; const existing = webpack.modules.get(id); @@ -536,7 +599,7 @@ function finishWebpack () { for (let i = 0; i < queue.length; i++) { const { id, star } = queue[i]; const module = webpack.modules.get(id); - if (!module) { webpack.invalid = true; break; } + if (!module || module.uncertain) { webpack.invalid = true; break; } const flag = star ? 1 : 2; if ((visited.get(id) ?? 0) & flag) continue; visited.set(id, (visited.get(id) ?? 0) | flag); @@ -1153,6 +1216,7 @@ function tryParseObjectDefineOrKeys (keys) { const starExportSpecifier = starExportMap[id]; if (starExportSpecifier) { + if (extended) trustWebpackExports(pos); if (typeof starExportSpecifier === 'object') (webpack.current?.dependencies ?? webpack.inlineDependencies) .push({ id: starExportSpecifier.webpack, star: true }); @@ -1170,7 +1234,7 @@ function tryParseObjectDefineOrKeys (keys) { function readExportsOrModuleDotExports (ch) { const revertPos = pos; - const target = extended && (webpack?.current?.target ?? '__webpack_exports__'); + const target = extended && (webpack?.current ? webpack.current.target : '__webpack_exports__'); if (target && source.startsWith(target, pos) && !isIdentifierChar(source.codePointAt(pos + target.length), true)) { pos += target.length; return true; @@ -1206,14 +1270,13 @@ function tryParseModuleExportsDotAssign (length = 6) { pos++; ch = commentWhitespace(); if (ch === 101/*e*/ && source.startsWith('xports', pos + 1)) { - tryParseExportsDotAssign(true); - return; + return tryParseExportsDotAssign(true); } } pos = revertPos; + return false; } -/** @param {boolean} assign */ /** * @param {boolean} assign * @param {number} [length] @@ -1233,7 +1296,7 @@ function tryParseExportsDotAssign (assign, length = 7) { ch = commentWhitespace(); if (ch === 61/*=*/) { _exports.add(decode(source.slice(startPos, endPos))); - return; + return true; } } break; @@ -1252,6 +1315,8 @@ function tryParseExportsDotAssign (assign, length = 7) { ch = commentWhitespace(); if (ch !== 61/*=*/) break; _exports.add(decode(source.slice(startPos, endPos))); + pos = revertPos; + return true; } break; } @@ -1263,10 +1328,12 @@ function tryParseExportsDotAssign (assign, length = 7) { pos++; ch = commentWhitespace(); if (extended) { + let recognized = false; if (ch === 95/*_*/) { const start = pos; const id = readWebpackCall(); if (webpack && id !== undefined) { + recognized = true; if (webpack.current) webpack.current.dependencies.push({ id, star: false }); else { webpack.entry = id; webpack.published = true; } } @@ -1282,10 +1349,14 @@ function tryParseExportsDotAssign (assign, length = 7) { } } if (ch === 40/*(*/) ch = readExportExpressionStart(); - if (ch === 123/*{*/) exportObjectPos = pos; - else if (ch === 114/*r*/) tryParseRequire(ExportAssign); + if (ch === 123/*{*/) { + exportObjectPos = pos; + recognized = true; + } else if (ch === 114/*r*/) { + recognized = tryParseRequire(ExportAssign); + } pos = revertPos; - return; + return recognized; } // { ... } if (ch === 123/*{*/) { @@ -1300,6 +1371,7 @@ function tryParseExportsDotAssign (assign, length = 7) { } } pos = revertPos; + return false; } function tryParseRequire (requireType) { @@ -1376,19 +1448,25 @@ function readExportDefinition () { pos++; ch = commentWhitespace(); if (!readExportsOrModuleDotExports(ch)) return; + const argEnd = pos; if (commentWhitespace() !== 44/*,*/) return; pos++; ch = commentWhitespace(); if (properties) { if (ch === 40/*(*/) ch = readExportExpressionStart(); - if (ch === 123/*{*/) exportObjectPos = pos; + if (ch === 123/*{*/) { + exportObjectPos = pos; + trustWebpackExports(argEnd); + } } else if (ch === 39/*'*/ || ch === 34/*"*/) { const nameStart = pos; stringLiteral(ch); const nameEnd = ++pos; - if (commentWhitespace() === 44/*,*/) + if (commentWhitespace() === 44/*,*/) { _exports.add(decode(source.slice(nameStart, nameEnd))); + trustWebpackExports(argEnd); + } } pos = start; } @@ -1397,10 +1475,12 @@ function readExportProperty () { const revertPos = pos; pos++; let ch = commentWhitespace(); + const propertyStart = ch; if (ch === 46/*.*/ && source.startsWith('..', pos + 1)) { pos += 3; ch = commentWhitespace(); - if (ch === 114/*r*/) tryParseRequire(ExportAssign); + if (!(ch === 114/*r*/ && tryParseRequire(ExportAssign)) && webpack?.current) + webpack.current.uncertain = true; pos = revertPos; return; } @@ -1455,6 +1535,8 @@ function readExportProperty () { if (nameEnd !== undefined && (ch === 58/*:*/ || ch === 40/*(*/ || !computed && (ch === 44/*,*/ || ch === 125/*}*/))) _exports.add(decode(source.slice(nameStart, nameEnd))); + else if (propertyStart !== 125 && webpack?.current) + webpack.current.uncertain = true; pos = revertPos; } diff --git a/lib/lexer.wasm b/lib/lexer.wasm index 7a20eda90d9e7ac99c0ec3eb4dde87d8893eb281..81f58ecf1e28a3451665d5c1e46215ab7a71cfd5 100755 GIT binary patch delta 6746 zcmbVRe{5Y>eLp|$eeb?^?|r^;ocQ@YKl|KkCwX?9I88#DCQb8B!FC;|7_~sVbV!uW zUGf~Z*h!#UC!Vz-wh{zg4wEWW6_CbSK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..12f60bd 100644 --- a/lib/lexer.wat +++ b/lib/lexer.wat @@ -240,7 +240,7 @@ local.get 1 i32.const 4128 i32.const 4136 - call 53) + call 54) (func (;3;) (type 8) (param i64) local.get 0 i32.const 4176 @@ -271,19 +271,19 @@ local.get 1 i32.const 4140 i32.const 4148 - call 53) + call 54) (func (;5;) (type 0) (param i32 i32) local.get 0 local.get 1 i32.const 4152 i32.const 4160 - call 53) + call 54) (func (;6;) (type 6) (param i32 i32 i32 i32 i32 i32) (result i32) - (local i32 i32 i32 i32 i32 i32 i32 i64 i64) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i64 i64) global.get 0 i32.const 16 i32.sub - local.tee 10 + local.tee 9 global.set 0 i32.const 4116 i32.load @@ -306,14 +306,14 @@ end i32.const 4120 i32.load - local.tee 7 + local.tee 8 i32.const 2 i32.eq if ;; label = @4 i32.const 4120 i32.const 18708 i32.load - local.tee 7 + local.tee 8 i32.store end i32.const 4112 @@ -341,7 +341,7 @@ local.get 3 i32.store local.get 3 - local.set 7 + local.set 8 end local.get 4 if ;; label = @4 @@ -434,12 +434,15 @@ i32.const 80 call 1 local.set 12 - i32.const 18708 - local.get 7 + i32.const 18744 + local.get 0 i32.store i32.const 18704 local.get 6 i32.store + i32.const 18708 + local.get 8 + i32.store i32.const 4220 local.get 0 i32.const 2 @@ -454,6 +457,9 @@ i32.add local.tee 6 i32.store + i32.const 18748 + i32.const 0 + i32.store block ;; label = @4 local.get 0 i32.load16_u @@ -497,6 +503,8 @@ end i32.const 1024 local.set 4 + i32.const 0 + local.set 8 loop ;; label = @4 i32.const 4220 local.get 5 @@ -517,7 +525,7 @@ if ;; label = @11 local.get 5 i32.load16_u - local.tee 2 + local.tee 3 i32.const 9 i32.sub local.tee 1 @@ -531,13 +539,19 @@ i32.and select br_if 7 (;@4;) - i32.const 4112 + i32.const 4228 i32.load - local.tee 1 - local.get 5 - i32.eq - local.tee 9 + local.tee 2 i32.eqz + local.get 3 + i32.const 95 + i32.ne + i32.and + br_if 3 (;@8;) + local.get 5 + i32.const 4112 + i32.load + i32.ne if ;; label = @12 local.get 0 i32.load16_u @@ -546,36 +560,54 @@ br_if 4 (;@8;) end block ;; label = @12 - i32.const 4228 - i32.load - local.tee 3 + local.get 2 i32.eqz br_if 0 (;@12;) - local.get 3 + local.get 2 i32.load offset=8 - local.get 3 + local.get 2 i32.load offset=12 - local.tee 7 + local.tee 1 call 10 if ;; label = @13 i32.const 0 - local.get 7 + local.get 1 call 11 + br_if 7 (;@6;) + local.get 5 + i32.const 18744 + i32.load + i32.lt_u + br_if 7 (;@6;) + i32.const 4228 + i32.load + i32.const 1 + i32.store8 offset=35 br 7 (;@6;) end - local.get 3 + local.get 2 i32.load offset=16 - local.get 3 + local.get 2 i32.load offset=20 - local.tee 7 + local.tee 1 call 10 i32.eqz br_if 0 (;@12;) - local.get 7 + local.get 1 call 12 + br_if 6 (;@6;) + local.get 5 + i32.const 18744 + i32.load + i32.lt_u + br_if 6 (;@6;) + i32.const 4228 + i32.load + i32.const 1 + i32.store8 offset=35 br 6 (;@6;) end - local.get 2 + local.get 3 i32.const 95 i32.ne br_if 3 (;@8;) @@ -671,24 +703,24 @@ i32.ne br_if 0 (;@12;) i32.const 0 - local.set 7 + local.set 1 block ;; label = @13 local.get 6 local.get 0 i32.const 40 i32.add - local.tee 8 + local.tee 7 i32.lt_u br_if 0 (;@13;) - local.get 8 + local.get 7 i32.load16_u - local.tee 7 + local.tee 1 i32.const 64512 i32.and i32.const 55296 i32.ne br_if 0 (;@13;) - local.get 7 + local.get 1 i32.const 10 i32.shl i32.const 1047552 @@ -700,13 +732,13 @@ i32.or i32.const 65536 i32.add - local.set 7 + local.set 1 end - local.get 7 + local.get 1 call 13 br_if 0 (;@12;) i32.const 4220 - local.get 8 + local.get 7 i32.store call 14 i32.const 61 @@ -719,13 +751,13 @@ i32.add i32.store call 14 - local.tee 3 + local.tee 1 i32.const 40 i32.eq if (result i32) ;; label = @13 call 15 else - local.get 3 + local.get 1 end i32.const 123 i32.ne @@ -801,24 +833,24 @@ i32.ne br_if 0 (;@12;) i32.const 0 - local.set 7 + local.set 1 block ;; label = @13 local.get 6 local.get 0 i32.const 40 i32.add - local.tee 8 + local.tee 7 i32.lt_u br_if 0 (;@13;) - local.get 8 + local.get 7 i32.load16_u - local.tee 7 + local.tee 1 i32.const 64512 i32.and i32.const 55296 i32.ne br_if 0 (;@13;) - local.get 7 + local.get 1 i32.const 10 i32.shl i32.const 1047552 @@ -830,20 +862,20 @@ i32.or i32.const 65536 i32.add - local.set 7 + local.set 1 end - local.get 7 + local.get 1 call 13 br_if 0 (;@12;) block ;; label = @13 - local.get 3 + local.get 2 br_if 0 (;@13;) i32.const 4312 i32.load i32.eqz br_if 0 (;@13;) i32.const 4220 - local.get 8 + local.get 7 i32.store call 14 i32.const 61 @@ -866,21 +898,21 @@ i32.const 4316 i32.const 0 i32.store - local.get 10 + local.get 9 i32.const 12 i32.add - local.get 10 + local.get 9 i32.const 8 i32.add call 16 i32.eqz br_if 0 (;@13;) i32.const 4316 - local.get 10 + local.get 9 i32.load offset=12 i32.store i32.const 4320 - local.get 10 + local.get 9 i32.load offset=8 i32.store end @@ -890,6 +922,7 @@ i32.const 0 i32.const 19 call 11 + drop br 6 (;@6;) end local.get 0 @@ -948,24 +981,24 @@ i32.ne br_if 3 (;@8;) i32.const 0 - local.set 7 + local.set 1 block ;; label = @12 local.get 6 local.get 0 i32.const 40 i32.add - local.tee 8 + local.tee 7 i32.lt_u br_if 0 (;@12;) - local.get 8 + local.get 7 i32.load16_u - local.tee 7 + local.tee 1 i32.const 64512 i32.and i32.const 55296 i32.ne br_if 0 (;@12;) - local.get 7 + local.get 1 i32.const 10 i32.shl i32.const 1047552 @@ -977,15 +1010,15 @@ i32.or i32.const 65536 i32.add - local.set 7 + local.set 1 end - local.get 7 + local.get 1 call 13 br_if 3 (;@8;) block ;; label = @12 - local.get 3 + local.get 2 if ;; label = @13 - local.get 3 + local.get 2 i32.load offset=28 i32.const 4340 i32.load16_u @@ -1003,9 +1036,9 @@ call 16 i32.eqz br_if 1 (;@10;) - local.get 3 + local.get 2 local.get 12 - local.get 3 + local.get 2 select local.tee 2 i32.const 52 @@ -1020,26 +1053,26 @@ i32.const 4168 i32.const 4168 i64.load - local.tee 13 + local.tee 15 i64.const 12 i64.add - local.tee 14 + local.tee 16 i32.const 4176 i64.load i64.gt_u if (result i64) ;; label = @12 - local.get 14 + local.get 16 call 3 i32.const 4168 i64.load - local.tee 13 + local.tee 15 i64.const 12 i64.add else - local.get 14 + local.get 16 end i64.store - local.get 13 + local.get 15 i32.wrap_i64 local.tee 1 i32.const 0 @@ -1091,7 +1124,7 @@ i32.store i32.const 4112 i32.load - local.set 1 + local.set 2 br 9 (;@2;) end i32.const 0 @@ -1106,32 +1139,19 @@ i32.const 4324 i32.load8_u i32.eqz + br_if 0 (;@11;) + i32.const 4316 + i32.load + local.tee 0 + i32.eqz if ;; label = @12 - i32.const 4332 + i32.const 18740 i32.load8_u - local.set 5 - br 1 (;@11;) + i32.eqz + br_if 1 (;@11;) end i32.const 4332 i32.load8_u - local.tee 1 - i32.const 4316 - i32.load - local.tee 0 - i32.const 18740 - i32.load8_u - i32.or - local.tee 2 - i32.const 0 - i32.ne - i32.or - local.set 5 - local.get 2 - i32.eqz - local.get 1 - i32.const 1 - i32.and - i32.or br_if 0 (;@11;) block ;; label = @12 local.get 0 @@ -1147,8 +1167,6 @@ call 17 local.tee 4 br_if 0 (;@12;) - i32.const 1 - local.set 5 i32.const 4332 i32.const 1 i32.store8 @@ -1159,248 +1177,186 @@ local.get 4 i32.const 258 i32.store16 offset=33 align=1 - i32.const 0 - local.set 5 end local.get 4 local.set 1 loop ;; label = @11 - local.get 1 - local.tee 0 - i32.eqz - local.get 5 - i32.const 1 - i32.and - i32.or - i32.eqz - if ;; label = @12 - i32.const 0 - local.set 5 - local.get 0 - i32.const 0 - i32.store8 offset=34 - local.get 4 - i32.const 0 - local.get 0 - i32.load offset=76 - local.tee 1 - select - local.set 4 - i32.const 2 + block ;; label = @12 + local.get 1 + local.tee 0 + i32.eqz + i32.const 4332 + i32.load8_u + local.tee 5 i32.const 1 - local.get 0 - i32.load8_u offset=33 - i32.const 2 - i32.and - local.tee 6 - select - local.tee 2 - local.get 0 - i32.load8_u offset=32 - local.tee 3 i32.and - br_if 1 (;@11;) - local.get 0 - local.get 2 - local.get 3 i32.or - i32.store8 offset=32 - local.get 0 - i32.const 36 - i32.add - local.set 5 - loop (result i32) ;; label = @13 - local.get 5 - i32.load - local.tee 2 - if (result i32) ;; label = @14 - local.get 2 - i32.load offset=4 - local.set 3 - local.get 2 - i32.load - local.set 5 - block ;; label = @15 - local.get 6 - i32.eqz - if ;; label = @16 - local.get 5 - local.get 3 - i32.const 4024 - i32.const 4038 - call 18 - br_if 1 (;@15;) - local.get 5 - local.get 3 - i32.const 4048 - i32.const 4068 - call 18 - br_if 1 (;@15;) - end - local.get 5 - local.get 3 - i32.const 18704 - i32.load - call_indirect (type 0) - end - local.get 2 - i32.const 8 - i32.add - local.set 5 - br 1 (;@13;) - else - local.get 0 - i32.const 44 - i32.add - end + i32.eqz + if ;; label = @13 + local.get 0 + i32.load8_u offset=35 + i32.eqz + br_if 1 (;@12;) + i32.const 4332 + i32.const 1 + i32.store8 + i32.const 1 + local.set 5 end - local.set 5 - loop ;; label = @13 - local.get 5 + i32.const 0 + local.set 3 + i32.const 4324 + i32.load8_u + if ;; label = @13 + i32.const 4316 i32.load - local.tee 2 - if ;; label = @14 - local.get 2 - i32.load - local.get 2 - i32.load offset=4 - i32.const 18708 - i32.load - call_indirect (type 0) - local.get 2 - i32.const 8 - i32.add - local.set 5 - br 1 (;@13;) - end + i32.const 18740 + i32.load8_u + i32.or + i32.eqz + local.get 5 + i32.or + i32.const 1 + i32.and + i32.eqz + br_if 12 (;@1;) end - local.get 0 - i32.const 60 - i32.add + i32.const 18724 local.set 5 loop ;; label = @13 local.get 5 i32.load - local.tee 2 - if ;; label = @14 - block ;; label = @15 - block ;; label = @16 - local.get 2 - i32.load - local.get 2 - i32.load offset=4 - call 17 - local.tee 0 - if ;; label = @17 - local.get 0 - block (result i32) ;; label = @18 - block ;; label = @19 - local.get 6 - i32.eqz - br_if 0 (;@19;) - local.get 2 - i32.load8_u offset=8 - br_if 0 (;@19;) - i32.const 2 - br 1 (;@18;) - end - i32.const 1 - end - local.tee 3 - local.get 0 - i32.load8_u offset=33 - i32.or - i32.store8 offset=33 - local.get 0 - i32.load8_u offset=34 - br_if 2 (;@15;) - local.get 3 - local.get 0 - i32.load8_u offset=32 - i32.and - br_if 2 (;@15;) - local.get 0 - i32.const 0 - i32.store offset=76 - local.get 0 - i32.const 1 - i32.store8 offset=34 - local.get 4 - br_if 1 (;@16;) + local.tee 0 + i32.eqz + br_if 12 (;@1;) + local.get 0 + i32.const 36 + i32.add + local.set 5 + loop ;; label = @14 + local.get 5 + i32.load + local.tee 1 + if ;; label = @15 + local.get 1 + i32.load + local.get 1 + i32.load offset=4 + i32.const 18704 + i32.load + call_indirect (type 0) + local.get 1 + i32.const 8 + i32.add + local.set 5 + br 1 (;@14;) + else + local.get 0 + i32.const 44 + i32.add + local.set 5 + loop ;; label = @16 + local.get 5 + i32.load + local.tee 1 + if ;; label = @17 + local.get 1 + i32.load + local.get 1 + i32.load offset=4 + i32.const 18708 + i32.load + call_indirect (type 0) + local.get 1 + i32.const 8 + i32.add + local.set 5 + br 1 (;@16;) + else local.get 0 - local.tee 4 - local.set 1 - br 2 (;@15;) + i32.const 68 + i32.add + local.set 5 + br 4 (;@13;) end - i32.const 1 - local.set 5 - i32.const 4332 - i32.const 1 - i32.store8 - br 5 (;@11;) + unreachable end - local.get 4 - local.get 0 - i32.store offset=76 - local.get 0 - local.set 4 + unreachable end - local.get 2 - i32.const 12 - i32.add - local.set 5 - br 1 (;@13;) + unreachable end + unreachable end - i32.const 4332 - i32.load8_u - local.set 5 - br 1 (;@11;) + unreachable end - end - i32.const 0 - local.set 3 - i32.const 4324 - i32.load8_u - if ;; label = @11 - i32.const 4316 - i32.load - i32.const 18740 - i32.load8_u - i32.or - i32.eqz - local.get 5 - i32.or + local.get 0 + i32.const 0 + i32.store8 offset=34 + local.get 4 + i32.const 0 + local.get 0 + i32.load offset=76 + local.tee 1 + select + local.set 4 + i32.const 2 i32.const 1 + local.get 0 + i32.load8_u offset=33 + i32.const 2 i32.and - i32.eqz - br_if 10 (;@1;) - end - i32.const 18724 - local.set 5 - loop ;; label = @11 - local.get 5 - i32.load - local.tee 0 - i32.eqz - br_if 10 (;@1;) + local.tee 6 + select + local.tee 2 + local.get 0 + i32.load8_u offset=32 + local.tee 3 + i32.and + br_if 0 (;@11;) + local.get 0 + local.get 2 + local.get 3 + i32.or + i32.store8 offset=32 local.get 0 i32.const 36 i32.add local.set 5 - loop ;; label = @12 + loop (result i32) ;; label = @12 local.get 5 i32.load - local.tee 1 - if ;; label = @13 - local.get 1 - i32.load - local.get 1 + local.tee 2 + if (result i32) ;; label = @13 + local.get 2 i32.load offset=4 - i32.const 18704 + local.set 3 + local.get 2 i32.load - call_indirect (type 0) - local.get 1 + local.set 5 + block ;; label = @14 + local.get 6 + i32.eqz + if ;; label = @15 + local.get 5 + local.get 3 + i32.const 4024 + i32.const 4038 + call 18 + br_if 1 (;@14;) + local.get 5 + local.get 3 + i32.const 4048 + i32.const 4068 + call 18 + br_if 1 (;@14;) + end + local.get 5 + local.get 3 + i32.const 18704 + i32.load + call_indirect (type 0) + end + local.get 2 i32.const 8 i32.add local.set 5 @@ -1409,43 +1365,110 @@ local.get 0 i32.const 44 i32.add + end + end + local.set 5 + loop ;; label = @12 + local.get 5 + i32.load + local.tee 2 + if ;; label = @13 + local.get 2 + i32.load + local.get 2 + i32.load offset=4 + i32.const 18708 + i32.load + call_indirect (type 0) + local.get 2 + i32.const 8 + i32.add local.set 5 - loop ;; label = @14 - local.get 5 + br 1 (;@12;) + end + end + local.get 0 + i32.const 60 + i32.add + local.set 5 + loop ;; label = @12 + local.get 5 + i32.load + local.tee 2 + i32.eqz + br_if 1 (;@11;) + block ;; label = @13 + block ;; label = @14 + local.get 2 i32.load - local.tee 1 + local.get 2 + i32.load offset=4 + call 17 + local.tee 0 if ;; label = @15 - local.get 1 - i32.load - local.get 1 - i32.load offset=4 - i32.const 18708 - i32.load - call_indirect (type 0) - local.get 1 - i32.const 8 - i32.add - local.set 5 - br 1 (;@14;) - else local.get 0 - i32.const 68 - i32.add - local.set 5 - br 4 (;@11;) + block (result i32) ;; label = @16 + block ;; label = @17 + local.get 6 + i32.eqz + br_if 0 (;@17;) + local.get 2 + i32.load8_u offset=8 + br_if 0 (;@17;) + i32.const 2 + br 1 (;@16;) + end + i32.const 1 + end + local.tee 3 + local.get 0 + i32.load8_u offset=33 + i32.or + i32.store8 offset=33 + local.get 0 + i32.load8_u offset=34 + br_if 2 (;@13;) + local.get 3 + local.get 0 + i32.load8_u offset=32 + i32.and + br_if 2 (;@13;) + local.get 0 + i32.const 0 + i32.store offset=76 + local.get 0 + i32.const 1 + i32.store8 offset=34 + local.get 4 + br_if 1 (;@14;) + local.get 0 + local.tee 4 + local.set 1 + br 2 (;@13;) end - unreachable + i32.const 4332 + i32.const 1 + i32.store8 + br 3 (;@11;) end - unreachable + local.get 4 + local.get 0 + i32.store offset=76 + local.get 0 + local.set 4 end - unreachable + local.get 2 + i32.const 12 + i32.add + local.set 5 + br 0 (;@12;) end unreachable end unreachable end i32.const 4220 - local.get 8 + local.get 7 i32.store call 14 i32.const 46 @@ -1458,8 +1481,13 @@ i32.add i32.store call 14 + local.tee 7 + i32.const 114 + i32.ne + local.get 7 i32.const 100 i32.ne + i32.and br_if 0 (;@9;) i32.const 4220 i32.const 4220 @@ -1481,27 +1509,86 @@ call 19 i32.eqz br_if 0 (;@9;) - call 14 - i32.const 44 - i32.ne - br_if 0 (;@9;) - i32.const 4220 - i32.const 4220 - i32.load - i32.const 2 - i32.add - i32.store - call 14 - i32.const 123 - i32.ne - br_if 0 (;@9;) - i32.const 4336 i32.const 4220 i32.load - i32.store - end - i32.const 4220 - local.get 5 + local.set 1 + block ;; label = @10 + local.get 7 + i32.const 114 + i32.ne + call 14 + local.tee 11 + i32.const 41 + i32.ne + i32.or + i32.eqz + if ;; label = @11 + local.get 2 + i32.eqz + br_if 2 (;@9;) + i32.const 18744 + i32.load + local.get 1 + i32.lt_u + br_if 1 (;@10;) + br 2 (;@9;) + end + local.get 7 + i32.const 100 + i32.ne + local.get 11 + i32.const 44 + i32.ne + i32.or + br_if 1 (;@9;) + i32.const 4220 + i32.const 4220 + i32.load + i32.const 2 + i32.add + i32.store + call 14 + local.tee 7 + i32.const 91 + i32.ne + if ;; label = @11 + local.get 7 + i32.const 123 + i32.ne + br_if 2 (;@9;) + i32.const 4336 + i32.const 4220 + i32.load + i32.store + local.get 2 + i32.eqz + br_if 2 (;@9;) + i32.const 18744 + i32.load + local.get 1 + i32.lt_u + br_if 1 (;@10;) + br 2 (;@9;) + end + i32.const 18748 + i32.const 4220 + i32.load + i32.store + local.get 2 + i32.eqz + br_if 1 (;@9;) + i32.const 18744 + i32.load + local.get 1 + i32.ge_u + br_if 1 (;@9;) + end + i32.const 18744 + local.get 1 + i32.store + end + i32.const 4220 + local.get 5 i32.store end block ;; label = @8 @@ -1533,526 +1620,439 @@ block ;; label = @33 block ;; label = @34 block ;; label = @35 + i32.const 4340 + i32.load16_u + local.tee 1 + if ;; label = @36 + local.get 2 + i32.eqz + br_if 1 (;@35;) + local.get 2 + i32.load offset=28 + local.get 1 + i32.ne + br_if 1 (;@35;) + end block ;; label = @36 block ;; label = @37 - i32.const 4340 - i32.load16_u - local.tee 3 - if ;; label = @38 - i32.const 4228 - i32.load - local.tee 7 - i32.eqz - br_if 1 (;@37;) - local.get 7 - i32.load offset=28 + block ;; label = @38 local.get 3 - i32.ne - br_if 1 (;@37;) + i32.const 91 + i32.sub + br_table 9 (;@29;) 32 (;@6;) 10 (;@28;) 32 (;@6;) 2 (;@36;) 21 (;@17;) 32 (;@6;) 32 (;@6;) 6 (;@32;) 32 (;@6;) 5 (;@33;) 32 (;@6;) 32 (;@6;) 32 (;@6;) 1 (;@37;) 32 (;@6;) 32 (;@6;) 32 (;@6;) 4 (;@34;) 0 (;@38;) end block ;; label = @38 - block ;; label = @39 - block ;; label = @40 - local.get 2 - i32.const 91 - i32.sub - br_table 9 (;@31;) 34 (;@6;) 10 (;@30;) 34 (;@6;) 2 (;@38;) 23 (;@17;) 34 (;@6;) 34 (;@6;) 6 (;@34;) 34 (;@6;) 5 (;@35;) 34 (;@6;) 34 (;@6;) 34 (;@6;) 1 (;@39;) 34 (;@6;) 34 (;@6;) 34 (;@6;) 4 (;@36;) 0 (;@40;) - end - block ;; label = @40 - local.get 2 - i32.const 34 - i32.sub - br_table 20 (;@20;) 34 (;@6;) 34 (;@6;) 34 (;@6;) 34 (;@6;) 20 (;@20;) 8 (;@32;) 13 (;@27;) 34 (;@6;) 34 (;@6;) 11 (;@29;) 34 (;@6;) 34 (;@6;) 21 (;@19;) 0 (;@40;) - end - block ;; label = @40 - local.get 2 - i32.const 123 - i32.sub - br_table 15 (;@25;) 34 (;@6;) 16 (;@24;) 0 (;@40;) - end - local.get 2 - i32.const 60 - i32.eq - br_if 34 (;@5;) - local.get 2 - i32.const 79 - i32.eq - br_if 6 (;@33;) - local.get 2 - i32.const 114 - i32.ne - br_if 33 (;@6;) - i32.const 0 - call 20 - i32.eqz - br_if 33 (;@6;) - i32.const 4112 - i32.load - local.get 5 - i32.eq - br_if 32 (;@7;) - local.get 0 - i32.load16_u - call 9 - i32.eqz - br_if 33 (;@6;) - br 32 (;@7;) - end - local.get 0 - i32.load16_u offset=4 - i32.const 109 - i32.ne - br_if 32 (;@6;) - local.get 0 - i32.load16_u offset=6 - i32.const 112 - i32.ne - br_if 32 (;@6;) - local.get 0 - i32.load16_u offset=8 - i32.const 111 - i32.ne - br_if 32 (;@6;) - local.get 0 - i32.load16_u offset=10 - i32.const 114 - i32.ne - br_if 32 (;@6;) - local.get 0 - i32.load16_u offset=12 - i32.const 116 - i32.ne - br_if 32 (;@6;) - local.get 9 - i32.eqz - if ;; label = @39 - local.get 0 - i32.load16_u - call 9 - i32.eqz - br_if 33 (;@6;) - end - call 21 - br 32 (;@6;) + local.get 3 + i32.const 34 + i32.sub + br_table 18 (;@20;) 32 (;@6;) 32 (;@6;) 32 (;@6;) 32 (;@6;) 18 (;@20;) 8 (;@30;) 13 (;@25;) 32 (;@6;) 32 (;@6;) 11 (;@27;) 32 (;@6;) 32 (;@6;) 19 (;@19;) 0 (;@38;) end block ;; label = @38 - local.get 0 - i32.const 4 - i32.add - local.tee 2 - call 22 - i32.eqz - br_if 0 (;@38;) - block ;; label = @39 - local.get 9 - br_if 0 (;@39;) - local.get 0 - i32.load16_u - local.tee 7 - call 9 - br_if 0 (;@39;) - local.get 7 - i32.const 46 - i32.ne - br_if 1 (;@38;) - end - i32.const 4220 - local.get 0 - i32.const 48 - i32.add - i32.store - local.get 0 - i32.load16_u offset=48 - i32.const 40 - i32.ne - br_if 32 (;@6;) - i32.const 4220 - local.get 0 - i32.const 50 - i32.add - local.tee 2 - i32.store local.get 3 - i32.const 2048 - i32.eq - if ;; label = @39 - local.get 2 - local.set 5 - i32.const 4188 - i32.load - local.tee 3 - br_if 37 (;@2;) - i32.const 12 - local.set 3 - i32.const 4188 - i32.const 12 - i32.store - br 37 (;@2;) - end - i32.const 4224 - i32.load8_u - if ;; label = @39 - local.get 3 - i32.const 16656 - i32.add - i32.const 0 - i32.store8 - end - i32.const 4340 - local.get 3 - i32.const 1 - i32.add - i32.store16 - i32.const 4356 - i32.load - local.get 3 - i32.const 2 - i32.shl - i32.add - local.get 4 - i32.store - i32.const 0 - call 20 - i32.eqz - br_if 32 (;@6;) - i32.const 4112 - i32.load - local.get 5 - i32.eq - br_if 31 (;@7;) - local.get 0 - i32.load16_u - call 9 - i32.eqz - br_if 32 (;@6;) - br 31 (;@7;) + i32.const 123 + i32.sub + br_table 15 (;@23;) 32 (;@6;) 16 (;@22;) 0 (;@38;) end - local.get 2 - i32.load16_u - i32.const 95 - i32.ne - br_if 31 (;@6;) - local.get 0 - i32.load16_u offset=6 - i32.const 101 - i32.ne - br_if 31 (;@6;) - local.get 0 - i32.load16_u offset=8 - i32.const 120 - i32.ne - br_if 31 (;@6;) - local.get 0 - i32.load16_u offset=10 - i32.const 112 + local.get 3 + i32.const 60 + i32.eq + br_if 32 (;@5;) + local.get 3 + i32.const 79 + i32.eq + br_if 6 (;@31;) + local.get 3 + i32.const 114 i32.ne br_if 31 (;@6;) - local.get 0 - i32.load16_u offset=12 - i32.const 111 - i32.ne + i32.const 0 + call 20 + i32.eqz br_if 31 (;@6;) + i32.const 4112 + i32.load + local.get 5 + i32.eq + br_if 30 (;@7;) local.get 0 - i32.load16_u offset=14 - i32.const 114 - i32.ne + i32.load16_u + call 9 + i32.eqz br_if 31 (;@6;) + br 30 (;@7;) + end + local.get 0 + i32.load16_u offset=4 + i32.const 109 + i32.ne + br_if 30 (;@6;) + local.get 0 + i32.load16_u offset=6 + i32.const 112 + i32.ne + br_if 30 (;@6;) + local.get 0 + i32.load16_u offset=8 + i32.const 111 + i32.ne + br_if 30 (;@6;) + local.get 0 + i32.load16_u offset=10 + i32.const 114 + i32.ne + br_if 30 (;@6;) + local.get 0 + i32.load16_u offset=12 + i32.const 116 + i32.ne + br_if 30 (;@6;) + local.get 5 + i32.const 4112 + i32.load + i32.ne + if ;; label = @37 local.get 0 - i32.load16_u offset=16 - i32.const 116 - i32.ne + i32.load16_u + call 9 + i32.eqz br_if 31 (;@6;) - block ;; label = @38 - local.get 9 - br_if 0 (;@38;) - local.get 0 - i32.load16_u - local.tee 2 - call 9 - br_if 0 (;@38;) - local.get 2 - i32.const 46 - i32.ne - br_if 32 (;@6;) - end - i32.const 4220 - local.get 0 - i32.const 18 - i32.add - local.tee 5 - i32.store - local.get 0 - i32.load16_u offset=18 + end + call 21 + br 30 (;@6;) + end + block ;; label = @36 + local.get 0 + i32.const 4 + i32.add + local.tee 3 + call 22 + i32.eqz + br_if 0 (;@36;) + block ;; label = @37 + i32.const 4112 + i32.load local.tee 2 - i32.const 83 + local.get 5 i32.eq - if (result i32) ;; label = @38 - local.get 0 - i32.load16_u offset=20 - i32.const 116 - i32.ne - br_if 32 (;@6;) - local.get 0 - i32.load16_u offset=22 - i32.const 97 - i32.ne - br_if 32 (;@6;) - local.get 0 - i32.load16_u offset=24 - i32.const 114 - i32.ne - br_if 32 (;@6;) - i32.const 4220 - local.get 0 - i32.const 26 - i32.add - local.tee 5 - i32.store - local.get 0 - i32.load16_u offset=26 - else - local.get 2 - end - i32.const 65535 - i32.and - i32.const 40 + br_if 0 (;@37;) + local.get 0 + i32.load16_u + local.tee 7 + call 9 + br_if 0 (;@37;) + local.get 7 + i32.const 46 i32.ne - br_if 31 (;@6;) - local.get 3 - i32.const 2048 - i32.eq - if ;; label = @38 - i32.const 4188 - i32.load - local.tee 3 - br_if 36 (;@2;) - i32.const 12 - local.set 3 - i32.const 4188 - i32.const 12 - i32.store - br 36 (;@2;) - end - i32.const 4224 - i32.load8_u - if ;; label = @38 - local.get 3 - i32.const 16656 - i32.add - i32.const 0 - i32.store8 - end - i32.const 4340 + br_if 1 (;@36;) + end + i32.const 4220 + local.get 0 + i32.const 48 + i32.add + i32.store + local.get 0 + i32.load16_u offset=48 + i32.const 40 + i32.ne + br_if 30 (;@6;) + i32.const 4220 + local.get 0 + i32.const 50 + i32.add + local.tee 3 + i32.store + local.get 1 + i32.const 2048 + i32.eq + if ;; label = @37 local.get 3 - i32.const 1 - i32.add - i32.store16 - i32.const 4356 + local.set 5 + i32.const 4188 i32.load - local.get 3 - i32.const 2 - i32.shl - i32.add - local.get 4 - i32.store - local.get 5 - i32.load16_u offset=2 - i32.const 114 - i32.ne - br_if 31 (;@6;) - i32.const 4220 - local.get 5 - i32.const 2 - i32.add + local.tee 3 + br_if 35 (;@2;) + i32.const 12 + local.set 3 + i32.const 4188 + i32.const 12 i32.store - i32.const 2 - call 20 - drop - br 31 (;@6;) - end - block ;; label = @37 - local.get 2 - i32.const 34 - i32.sub - br_table 17 (;@20;) 31 (;@6;) 31 (;@6;) 31 (;@6;) 31 (;@6;) 17 (;@20;) 5 (;@32;) 11 (;@26;) 31 (;@6;) 31 (;@6;) 9 (;@28;) 31 (;@6;) 31 (;@6;) 18 (;@19;) 0 (;@37;) - end - block ;; label = @37 - local.get 2 - i32.const 91 - i32.sub - br_table 6 (;@31;) 31 (;@6;) 19 (;@18;) 31 (;@6;) 31 (;@6;) 20 (;@17;) 31 (;@6;) 31 (;@6;) 3 (;@34;) 31 (;@6;) 2 (;@35;) 0 (;@37;) + br 35 (;@2;) end - block ;; label = @37 - local.get 2 - i32.const 123 - i32.sub - br_table 12 (;@25;) 31 (;@6;) 14 (;@23;) 0 (;@37;) + i32.const 4224 + i32.load8_u + if ;; label = @37 + local.get 1 + i32.const 16656 + i32.add + i32.const 0 + i32.store8 end - local.get 2 - i32.const 60 - i32.eq - br_if 31 (;@5;) - local.get 2 - i32.const 79 + i32.const 4340 + local.get 1 + i32.const 1 + i32.add + i32.store16 + i32.const 4356 + i32.load + local.get 1 + i32.const 2 + i32.shl + i32.add + local.get 4 + i32.store + i32.const 0 + call 20 + i32.eqz + br_if 30 (;@6;) + i32.const 4112 + i32.load + local.get 5 i32.eq - br_if 3 (;@33;) - local.get 2 - i32.const 109 - i32.ne + br_if 29 (;@7;) + local.get 0 + i32.load16_u + call 9 + i32.eqz br_if 30 (;@6;) + br 29 (;@7;) end - local.get 0 - i32.load16_u offset=4 - i32.const 111 + local.get 3 + i32.load16_u + i32.const 95 i32.ne br_if 29 (;@6;) local.get 0 i32.load16_u offset=6 - i32.const 100 + i32.const 101 i32.ne br_if 29 (;@6;) local.get 0 i32.load16_u offset=8 - i32.const 117 + i32.const 120 i32.ne br_if 29 (;@6;) local.get 0 i32.load16_u offset=10 - i32.const 108 + i32.const 112 i32.ne br_if 29 (;@6;) local.get 0 i32.load16_u offset=12 - i32.const 101 + i32.const 111 i32.ne br_if 29 (;@6;) - local.get 9 - i32.eqz - if ;; label = @36 + local.get 0 + i32.load16_u offset=14 + i32.const 114 + i32.ne + br_if 29 (;@6;) + local.get 0 + i32.load16_u offset=16 + i32.const 116 + i32.ne + br_if 29 (;@6;) + block ;; label = @36 + i32.const 4112 + i32.load + local.tee 2 + local.get 5 + i32.eq + br_if 0 (;@36;) local.get 0 i32.load16_u + local.tee 3 call 9 - i32.eqz + br_if 0 (;@36;) + local.get 3 + i32.const 46 + i32.ne br_if 30 (;@6;) end - i32.const 6 - call 12 - br 29 (;@6;) - end - local.get 0 - i32.load16_u offset=4 - i32.const 120 - i32.ne - br_if 28 (;@6;) - local.get 0 - i32.load16_u offset=6 - i32.const 112 - i32.ne - br_if 28 (;@6;) - local.get 0 - i32.load16_u offset=8 - i32.const 111 - i32.ne - br_if 28 (;@6;) - local.get 0 - i32.load16_u offset=10 - i32.const 114 - i32.ne - br_if 28 (;@6;) - local.get 0 - i32.load16_u offset=12 - i32.const 116 - i32.ne - br_if 28 (;@6;) - local.get 9 - i32.eqz - if ;; label = @35 + i32.const 4220 local.get 0 - i32.load16_u - call 9 - i32.eqz + i32.const 18 + i32.add + local.tee 5 + i32.store + local.get 0 + i32.load16_u offset=18 + local.tee 3 + i32.const 83 + i32.eq + if (result i32) ;; label = @36 + local.get 0 + i32.load16_u offset=20 + i32.const 116 + i32.ne + br_if 30 (;@6;) + local.get 0 + i32.load16_u offset=22 + i32.const 97 + i32.ne + br_if 30 (;@6;) + local.get 0 + i32.load16_u offset=24 + i32.const 114 + i32.ne + br_if 30 (;@6;) + i32.const 4220 + local.get 0 + i32.const 26 + i32.add + local.tee 5 + i32.store + local.get 0 + i32.load16_u offset=26 + else + local.get 3 + end + i32.const 65535 + i32.and + i32.const 40 + i32.ne br_if 29 (;@6;) - end - local.get 0 - i32.load16_u offset=14 - i32.const 115 - i32.eq - if ;; label = @35 - i32.const 0 - i32.const 7 - call 11 + local.get 1 + i32.const 2048 + i32.eq + if ;; label = @36 + i32.const 4188 + i32.load + local.tee 3 + br_if 34 (;@2;) + i32.const 12 + local.set 3 + i32.const 4188 + i32.const 12 + i32.store + br 34 (;@2;) + end + i32.const 4224 + i32.load8_u + if ;; label = @36 + local.get 1 + i32.const 16656 + i32.add + i32.const 0 + i32.store8 + end + i32.const 4340 + local.get 1 + i32.const 1 + i32.add + i32.store16 + i32.const 4356 + i32.load + local.get 1 + i32.const 2 + i32.shl + i32.add + local.get 4 + i32.store + local.get 5 + i32.load16_u offset=2 + i32.const 114 + i32.ne + br_if 29 (;@6;) + i32.const 4220 + local.get 5 + i32.const 2 + i32.add + i32.store + i32.const 2 + call 20 + drop br 29 (;@6;) end + block ;; label = @35 + local.get 3 + i32.const 34 + i32.sub + br_table 15 (;@20;) 29 (;@6;) 29 (;@6;) 29 (;@6;) 29 (;@6;) 15 (;@20;) 5 (;@30;) 11 (;@24;) 29 (;@6;) 29 (;@6;) 9 (;@26;) 29 (;@6;) 29 (;@6;) 16 (;@19;) 0 (;@35;) + end + block ;; label = @35 + local.get 3 + i32.const 91 + i32.sub + br_table 6 (;@29;) 29 (;@6;) 17 (;@18;) 29 (;@6;) 29 (;@6;) 18 (;@17;) 29 (;@6;) 29 (;@6;) 3 (;@32;) 29 (;@6;) 2 (;@33;) 0 (;@35;) + end + block ;; label = @35 + local.get 3 + i32.const 123 + i32.sub + br_table 12 (;@23;) 29 (;@6;) 14 (;@21;) 0 (;@35;) + end local.get 3 - br_if 28 (;@6;) - call 23 - br 28 (;@6;) - end - local.get 9 - i32.eqz - if ;; label = @34 - local.get 0 - i32.load16_u - call 9 - i32.eqz + i32.const 60 + i32.eq + br_if 29 (;@5;) + local.get 3 + i32.const 79 + i32.eq + br_if 3 (;@31;) + local.get 3 + i32.const 109 + i32.ne br_if 28 (;@6;) end local.get 0 i32.load16_u offset=4 - i32.const 108 + i32.const 111 i32.ne br_if 27 (;@6;) local.get 0 i32.load16_u offset=6 - i32.const 97 + i32.const 100 i32.ne br_if 27 (;@6;) local.get 0 i32.load16_u offset=8 - i32.const 115 + i32.const 117 i32.ne br_if 27 (;@6;) local.get 0 i32.load16_u offset=10 - i32.const 115 + i32.const 108 i32.ne br_if 27 (;@6;) local.get 0 i32.load16_u offset=12 - local.tee 0 - i32.const 9 - i32.sub - local.tee 1 - i32.const 23 - i32.gt_u - i32.const 1 - local.get 1 - i32.shl - i32.const 8388639 - i32.and - i32.eqz - i32.or - br_if 24 (;@9;) - br 25 (;@8;) - end + i32.const 101 + i32.ne + br_if 27 (;@6;) + local.get 5 + i32.const 4112 + i32.load + i32.ne + if ;; label = @34 + local.get 0 + i32.load16_u + call 9 + i32.eqz + br_if 28 (;@6;) + end + i32.const 6 + call 12 + drop + br 27 (;@6;) + end local.get 0 i32.load16_u offset=4 - i32.const 98 + i32.const 120 i32.ne br_if 26 (;@6;) local.get 0 i32.load16_u offset=6 - i32.const 106 + i32.const 112 i32.ne br_if 26 (;@6;) local.get 0 i32.load16_u offset=8 - i32.const 101 + i32.const 111 i32.ne br_if 26 (;@6;) local.get 0 i32.load16_u offset=10 - i32.const 99 + i32.const 114 i32.ne br_if 26 (;@6;) local.get 0 @@ -2060,8 +2060,10 @@ i32.const 116 i32.ne br_if 26 (;@6;) - local.get 9 - i32.eqz + local.get 5 + i32.const 4112 + i32.load + i32.ne if ;; label = @33 local.get 0 i32.load16_u @@ -2069,367 +2071,503 @@ i32.eqz br_if 27 (;@6;) end - local.get 3 - if (result i32) ;; label = @33 - block (result i32) ;; label = @34 - i32.const 4228 - i32.load - local.tee 0 - if ;; label = @35 - local.get 0 - i32.load offset=28 - local.get 3 - i32.eq - br 1 (;@34;) - end - i32.const 18740 - i32.load8_u - end + local.get 0 + i32.load16_u offset=14 + i32.const 115 + i32.eq + if ;; label = @33 i32.const 0 - i32.ne - else - i32.const 1 + i32.const 7 + call 11 + drop + br 27 (;@6;) end - call 24 + local.get 1 + br_if 26 (;@6;) + call 23 br 26 (;@6;) end - local.get 3 - i32.const 2048 - i32.eq - if ;; label = @32 - i32.const 4188 - i32.load - local.tee 3 - br_if 30 (;@2;) - i32.const 12 - local.set 3 - i32.const 4188 - i32.const 12 - i32.store - br 30 (;@2;) - end - i32.const 4224 - i32.load8_u + local.get 5 + i32.const 4112 + i32.load + i32.ne if ;; label = @32 - local.get 3 - i32.const 16656 - i32.add - i32.const 0 - i32.store8 + local.get 0 + i32.load16_u + call 9 + i32.eqz + br_if 26 (;@6;) end - i32.const 4340 - local.get 3 + local.get 0 + i32.load16_u offset=4 + i32.const 108 + i32.ne + br_if 25 (;@6;) + local.get 0 + i32.load16_u offset=6 + i32.const 97 + i32.ne + br_if 25 (;@6;) + local.get 0 + i32.load16_u offset=8 + i32.const 115 + i32.ne + br_if 25 (;@6;) + local.get 0 + i32.load16_u offset=10 + i32.const 115 + i32.ne + br_if 25 (;@6;) + local.get 0 + i32.load16_u offset=12 + local.tee 0 + i32.const 9 + i32.sub + local.tee 1 + i32.const 23 + i32.gt_u i32.const 1 - i32.add - i32.store16 - i32.const 4356 - i32.load - local.get 3 - i32.const 2 + local.get 1 i32.shl - i32.add - local.get 4 - i32.store - br 26 (;@5;) + i32.const 8388639 + i32.and + i32.eqz + i32.or + br_if 22 (;@9;) + br 23 (;@8;) end - local.get 3 - i32.const 2048 - i32.eq + local.get 0 + i32.load16_u offset=4 + i32.const 98 + i32.ne + br_if 24 (;@6;) + local.get 0 + i32.load16_u offset=6 + i32.const 106 + i32.ne + br_if 24 (;@6;) + local.get 0 + i32.load16_u offset=8 + i32.const 101 + i32.ne + br_if 24 (;@6;) + local.get 0 + i32.load16_u offset=10 + i32.const 99 + i32.ne + br_if 24 (;@6;) + local.get 0 + i32.load16_u offset=12 + i32.const 116 + i32.ne + br_if 24 (;@6;) + local.get 5 + i32.const 4112 + i32.load + i32.ne + if ;; label = @31 + local.get 0 + i32.load16_u + call 9 + i32.eqz + br_if 25 (;@6;) + end + local.get 1 + if (result i32) ;; label = @31 + block (result i32) ;; label = @32 + local.get 2 + if ;; label = @33 + local.get 2 + i32.load offset=28 + local.get 1 + i32.eq + br 1 (;@32;) + end + i32.const 18740 + i32.load8_u + end + i32.const 0 + i32.ne + else + i32.const 1 + end + call 24 + br 24 (;@6;) + end + local.get 1 + i32.const 2048 + i32.eq + if ;; label = @30 + i32.const 4188 + i32.load + local.tee 3 + i32.eqz if ;; label = @31 - i32.const 4188 - i32.load - local.tee 3 - br_if 29 (;@2;) - i32.const 12 - local.set 3 i32.const 4188 i32.const 12 i32.store - br 29 (;@2;) - end - i32.const 4224 - i32.load8_u - if ;; label = @31 - local.get 3 - i32.const 16656 - i32.add - i32.const 0 - i32.store8 + i32.const 12 + local.set 3 end - i32.const 4340 - local.get 3 - i32.const 1 - i32.add - i32.store16 - i32.const 4356 + i32.const 4112 i32.load - local.get 3 - i32.const 2 - i32.shl + local.set 2 + br 28 (;@2;) + end + i32.const 4224 + i32.load8_u + if ;; label = @30 + local.get 1 + i32.const 16656 i32.add - local.get 4 - i32.store - br 25 (;@5;) + i32.const 0 + i32.store8 end - local.get 3 - br_if 11 (;@18;) + i32.const 4340 + local.get 1 + i32.const 1 + i32.add + i32.store16 + i32.const 4356 + i32.load + local.get 1 + i32.const 2 + i32.shl + i32.add + local.get 4 + i32.store + br 24 (;@5;) + end + local.get 1 + i32.const 2048 + i32.eq + if ;; label = @29 i32.const 4188 i32.load local.tee 3 - br_if 27 (;@2;) - i32.const 8 - local.set 3 - i32.const 4188 - i32.const 8 - i32.store + i32.eqz + if ;; label = @30 + i32.const 4188 + i32.const 12 + i32.store + i32.const 12 + local.set 3 + end + i32.const 4112 + i32.load + local.set 2 br 27 (;@2;) end - local.get 3 - i32.eqz - br_if 23 (;@5;) - end - local.get 3 - i32.const 16655 - i32.add - i32.load8_u - local.tee 0 - i32.const 4 - i32.and - if (result i32) ;; label = @28 - call 25 + i32.const 4224 + i32.load8_u + if ;; label = @29 + local.get 1 + i32.const 16656 + i32.add + i32.const 0 + i32.store8 + end + i32.const 4356 + i32.load + local.get 1 + i32.const 2 + i32.shl + i32.add + local.get 4 + i32.store i32.const 4340 - i32.load16_u - local.tee 0 - i32.eqz - br_if 23 (;@5;) - local.get 0 - i32.const 16655 + local.get 1 + i32.const 1 i32.add - i32.load8_u - else - local.get 0 + i32.store16 + local.get 5 + i32.const 18748 + i32.load + i32.ne + br_if 23 (;@5;) + i32.const 18748 + i32.const 0 + i32.store + i32.const 8 + call 25 + br 23 (;@5;) end - i32.const 2 - i32.and + local.get 1 + br_if 9 (;@18;) + i32.const 4188 + i32.load + local.tee 3 i32.eqz - br_if 22 (;@5;) - call 26 - br 22 (;@5;) + if ;; label = @28 + i32.const 4188 + i32.const 8 + i32.store + i32.const 8 + local.set 3 + end + i32.const 4112 + i32.load + local.set 2 + br 25 (;@2;) end - local.get 3 - br_if 0 (;@26;) - i32.const 4188 - i32.load - local.tee 3 - br_if 24 (;@2;) - i32.const 8 - local.set 3 - i32.const 4188 - i32.const 8 - i32.store - br 24 (;@2;) + local.get 1 + i32.eqz + br_if 21 (;@5;) end - i32.const 4340 - local.get 3 - i32.const 1 - i32.sub - i32.store16 - br 20 (;@5;) - end - local.get 3 - i32.const 2048 - i32.eq - if ;; label = @25 - i32.const 4188 - i32.load - local.tee 3 - br_if 23 (;@2;) - i32.const 12 - local.set 3 - i32.const 4188 - i32.const 12 - i32.store - br 23 (;@2;) - end - i32.const 4224 - i32.load8_u - if ;; label = @25 - local.get 3 - i32.const 16656 - i32.add - i32.const 0 - i32.store8 - end - i32.const 4356 - i32.load - local.get 3 - i32.const 2 - i32.shl - i32.add - local.get 4 - i32.store - i32.const 4340 - local.get 3 - i32.const 1 - i32.add - local.tee 0 - i32.store16 - local.get 0 - i32.const 65535 - i32.and - local.tee 0 - i32.const 16655 - i32.add - i32.const 4360 - i32.load8_u - local.tee 1 - i32.store8 - i32.const 4360 - i32.const 0 - i32.store8 - i32.const 4336 - i32.load - local.get 5 - i32.eq - if ;; label = @25 - local.get 0 - i32.const 16655 - i32.add local.get 1 - i32.const 2 - i32.or - i32.store8 - i32.const 4336 - i32.const 0 - i32.store - call 26 - i32.const 4220 - i32.load - local.set 5 - end - i32.const 4312 - i32.load - local.get 5 - i32.eq - if ;; label = @25 - i32.const 4340 - i32.load16_u i32.const 16655 i32.add - local.tee 0 - local.get 0 i32.load8_u + local.tee 0 i32.const 4 - i32.or - i32.store8 + i32.and + if ;; label = @26 + call 26 + end + local.get 0 + i32.const 2 + i32.and + if ;; label = @26 + call 27 + end + local.get 0 + i32.const 8 + i32.lt_u + br_if 20 (;@5;) + local.get 0 call 25 br 20 (;@5;) end - local.get 5 - i32.const 18712 + local.get 1 + br_if 0 (;@24;) + i32.const 4188 i32.load - i32.ne - br_if 19 (;@5;) - i32.const 4116 - i32.const 1 - i32.store - i32.const 4120 - i32.const 2 - i32.store - i32.const 4228 - i32.const 18716 + local.tee 3 + i32.eqz + if ;; label = @25 + i32.const 4188 + i32.const 8 + i32.store + i32.const 8 + local.set 3 + end + i32.const 4112 i32.load - local.tee 0 - i32.store - local.get 0 - i32.const 4340 - i32.load16_u - i32.store offset=28 - i32.const 4212 - i32.const 0 - i32.store - i32.const 4216 - i32.const 0 - i32.store - br 19 (;@5;) + local.set 2 + br 22 (;@2;) end - local.get 3 - i32.eqz - br_if 1 (;@22;) - i32.const 4228 - i32.load - local.set 7 + i32.const 4340 + local.get 1 + i32.const 1 + i32.sub + i32.store16 + br 18 (;@5;) end - block ;; label = @23 - local.get 7 - i32.eqz - br_if 0 (;@23;) - local.get 7 - i32.load offset=28 - local.get 3 - i32.ne - br_if 0 (;@23;) - i32.const 4116 - i32.const 18704 + local.get 1 + i32.const 2048 + i32.eq + if ;; label = @23 + i32.const 4188 i32.load - i32.store - i32.const 4120 - i32.const 18708 + local.tee 3 + i32.eqz + if ;; label = @24 + i32.const 4188 + i32.const 12 + i32.store + i32.const 12 + local.set 3 + end + i32.const 4112 i32.load - i32.store - i32.const 4212 - i32.const 0 - i32.store - i32.const 4228 - i32.const 0 - i32.store - i32.const 4216 + local.set 2 + br 21 (;@2;) + end + i32.const 4224 + i32.load8_u + if ;; label = @23 + local.get 1 + i32.const 16656 + i32.add i32.const 0 - i32.store + i32.store8 end + i32.const 4356 + i32.load + local.get 1 + i32.const 2 + i32.shl + i32.add + local.get 4 + i32.store i32.const 4340 - local.get 3 - i32.const 1 - i32.sub - local.tee 2 - i32.store16 - local.get 3 - i32.const 4346 - i32.load16_u - local.tee 0 - i32.ne - br_if 1 (;@21;) - i32.const 4344 - i32.const 4344 - i32.load16_u + local.get 1 i32.const 1 - i32.sub + i32.add local.tee 0 i32.store16 - i32.const 4346 - i32.const 4352 - i32.load local.get 0 i32.const 65535 i32.and - i32.const 1 - i32.shl + local.tee 0 + i32.const 16655 i32.add + i32.const 4360 + i32.load8_u + local.tee 1 + i32.store8 + i32.const 4360 + i32.const 0 + i32.store8 + i32.const 4336 + i32.load + local.get 5 + i32.eq + if ;; label = @23 + local.get 0 + i32.const 16655 + i32.add + local.get 1 + i32.const 2 + i32.or + i32.store8 + i32.const 4336 + i32.const 0 + i32.store + call 27 + i32.const 4220 + i32.load + local.set 5 + end + i32.const 4312 + i32.load + local.get 5 + i32.eq + if ;; label = @23 + i32.const 4340 + i32.load16_u + i32.const 16655 + i32.add + local.tee 0 + local.get 0 + i32.load8_u + i32.const 4 + i32.or + i32.store8 + call 26 + br 18 (;@5;) + end + local.get 5 + i32.const 18712 + i32.load + i32.ne + br_if 17 (;@5;) + i32.const 4116 + i32.const 1 + i32.store + i32.const 4120 + i32.const 2 + i32.store + i32.const 4228 + i32.const 18716 + i32.load + local.tee 0 + i32.store + local.get 0 + i32.const 4340 i32.load16_u - i32.store16 - br 12 (;@10;) + i32.store offset=28 + i32.const 4216 + i32.load + local.set 13 + i32.const 4216 + i32.const 0 + i32.store + i32.const 4212 + i32.load + local.set 8 + i32.const 4212 + i32.const 0 + i32.store + br 17 (;@5;) end + local.get 1 + br_if 0 (;@21;) i32.const 4188 i32.load local.tee 3 - br_if 19 (;@2;) - i32.const 2 - local.set 3 - i32.const 4188 - i32.const 2 - i32.store + i32.eqz + if ;; label = @22 + i32.const 4188 + i32.const 2 + i32.store + i32.const 2 + local.set 3 + end + i32.const 4112 + i32.load + local.set 2 br 19 (;@2;) end + block ;; label = @21 + local.get 2 + i32.eqz + br_if 0 (;@21;) + local.get 2 + i32.load offset=28 + local.get 1 + i32.ne + br_if 0 (;@21;) + i32.const 4216 + local.get 13 + i32.store + i32.const 4212 + local.get 8 + i32.store + i32.const 4116 + i32.const 18704 + i32.load + i32.store + i32.const 4120 + i32.const 18708 + i32.load + i32.store + i32.const 4228 + i32.const 0 + i32.store + end + i32.const 4340 + local.get 1 + i32.const 1 + i32.sub + local.tee 2 + i32.store16 + i32.const 4346 + i32.load16_u + local.tee 0 + local.get 1 + i32.eq + if ;; label = @21 + i32.const 4344 + i32.const 4344 + i32.load16_u + i32.const 1 + i32.sub + local.tee 0 + i32.store16 + i32.const 4346 + i32.const 4352 + i32.load + local.get 0 + i32.const 65535 + i32.and + i32.const 1 + i32.shl + i32.add + i32.load16_u + i32.store16 + br 11 (;@10;) + end local.get 0 i32.const 65535 i32.eq @@ -2443,12 +2581,17 @@ i32.const 4188 i32.load local.tee 3 - br_if 18 (;@2;) - i32.const 3 - local.set 3 - i32.const 4188 - i32.const 3 - i32.store + i32.eqz + if ;; label = @21 + i32.const 4188 + i32.const 3 + i32.store + i32.const 3 + local.set 3 + end + i32.const 4112 + i32.load + local.set 2 br 18 (;@2;) end block ;; label = @20 @@ -2465,15 +2608,15 @@ br_if 0 (;@22;) local.get 5 i32.load16_u - local.tee 3 - local.get 2 + local.tee 1 + local.get 3 i32.eq br_if 2 (;@20;) - local.get 3 + local.get 1 i32.const 92 i32.ne if ;; label = @23 - local.get 3 + local.get 1 i32.const 10 i32.sub br_table 1 (;@22;) 2 (;@21;) 2 (;@21;) 1 (;@22;) 2 (;@21;) @@ -2510,7 +2653,8 @@ end i32.const 4184 local.get 5 - local.get 1 + i32.const 4112 + i32.load i32.sub i32.const 1 i32.shr_s @@ -2528,7 +2672,7 @@ local.get 0 i32.const 4 i32.add - local.set 2 + local.set 3 block ;; label = @19 block ;; label = @20 block ;; label = @21 @@ -2545,7 +2689,7 @@ br_if 1 (;@22;) local.get 4 i32.load16_u - local.tee 6 + local.tee 3 i32.const 33 i32.sub local.tee 0 @@ -2559,10 +2703,10 @@ i32.and select br_if 11 (;@12;) - local.get 6 + local.get 3 i32.const 41 i32.ne - local.get 6 + local.get 3 i32.const 40 i32.sub i32.const 65535 @@ -2571,19 +2715,19 @@ i32.lt_u i32.and br_if 3 (;@20;) - local.get 6 + local.get 3 i32.const 58 i32.sub i32.const 6 i32.lt_u br_if 11 (;@12;) - local.get 6 + local.get 3 i32.const 91 i32.sub br_table 11 (;@12;) 2 (;@21;) 2 (;@21;) 11 (;@12;) 2 (;@21;) end loop ;; label = @23 - local.get 2 + local.get 3 local.tee 5 i32.const 2 i32.sub @@ -2593,7 +2737,7 @@ local.get 5 i32.const 2 i32.add - local.set 2 + local.set 3 local.get 5 i32.load16_u i32.const 10 @@ -2603,7 +2747,7 @@ unreachable end loop ;; label = @22 - local.get 2 + local.get 3 local.tee 0 local.get 6 i32.ge_u @@ -2612,7 +2756,7 @@ i32.const 2 i32.add local.tee 1 - local.set 2 + local.set 3 local.get 1 i32.load16_u i32.const 42 @@ -2629,11 +2773,11 @@ end br 6 (;@15;) end - local.get 6 + local.get 3 i32.const 125 i32.eq local.tee 0 - local.get 6 + local.get 3 i32.const 123 i32.sub i32.const 65535 @@ -2646,7 +2790,7 @@ block ;; label = @20 block ;; label = @21 block ;; label = @22 - local.get 6 + local.get 3 i32.const 43 i32.sub br_table 1 (;@21;) 10 (;@12;) 2 (;@20;) 0 (;@22;) 10 (;@12;) @@ -2685,48 +2829,50 @@ local.get 0 i32.eqz if ;; label = @19 - local.get 6 + local.get 3 i32.const 47 i32.eq br_if 5 (;@14;) - local.get 6 + local.get 3 i32.const 41 i32.ne br_if 6 (;@13;) i32.const 4356 i32.load - local.get 3 + local.get 1 i32.const 2 i32.shl i32.add i32.load - call 27 + call 28 i32.eqz br_if 6 (;@13;) br 7 (;@12;) end i32.const 4356 i32.load - local.tee 9 - local.get 3 + local.tee 11 + local.get 1 i32.const 2 i32.shl i32.add i32.load local.tee 5 - call 28 + call 29 br_if 6 (;@12;) - local.get 3 + local.get 1 i32.const 16656 i32.add i32.load8_u i32.const 1 i32.and br_if 6 (;@12;) - local.get 1 + i32.const 4112 + i32.load + local.tee 6 i32.const 6 i32.add - local.set 8 + local.set 14 loop ;; label = @19 local.get 5 i32.eqz @@ -2735,7 +2881,7 @@ i32.eq i32.or br_if 7 (;@12;) - local.get 3 + local.get 1 i32.const 65535 i32.and i32.eqz @@ -2747,11 +2893,11 @@ i32.or i32.eqz if ;; label = @20 - local.get 9 - local.get 3 + local.get 11 + local.get 1 i32.const 1 i32.sub - local.tee 3 + local.tee 1 i32.const 65535 i32.and i32.const 2 @@ -2770,19 +2916,19 @@ i32.eq br_if 8 (;@12;) local.get 5 - call 28 + call 29 i32.eqz br_if 7 (;@13;) br 8 (;@12;) end - local.get 1 local.get 5 + local.get 6 i32.eq br_if 6 (;@13;) local.get 5 i32.const 2 i32.sub - call 29 + call 30 local.tee 2 i32.eqz br_if 6 (;@13;) @@ -2801,9 +2947,9 @@ i32.const 0 local.set 7 loop ;; label = @22 - local.get 1 local.get 2 - i32.gt_u + local.get 6 + i32.lt_u br_if 2 (;@20;) local.get 2 i32.load16_u @@ -2814,7 +2960,7 @@ i32.and i32.const 56320 i32.ne - local.tee 11 + local.tee 10 if (result i32) ;; label = @23 local.get 0 else @@ -2837,10 +2983,9 @@ i32.eqz br_if 2 (;@20;) local.get 2 - local.get 1 + local.get 6 i32.sub - local.set 0 - local.get 11 + local.get 10 i32.eqz if ;; label = @23 local.get 5 @@ -2865,19 +3010,18 @@ local.get 5 i32.const 65536 i32.lt_u - local.tee 11 + local.tee 10 select i32.add local.set 2 local.get 5 - call 30 + call 31 local.set 7 - local.get 0 i32.const 1 i32.shr_s i32.const 1 i32.const 2 - local.get 11 + local.get 10 select i32.ge_u br_if 0 (;@22;) @@ -2888,9 +3032,9 @@ br 9 (;@12;) end loop ;; label = @21 - local.get 1 local.get 2 - i32.lt_u + local.get 6 + i32.gt_u if ;; label = @22 local.get 2 i32.const 2 @@ -2903,7 +3047,7 @@ local.get 2 local.set 5 loop ;; label = @23 - local.get 1 + local.get 6 local.get 5 local.tee 0 i32.lt_u @@ -2926,8 +3070,8 @@ br_if 1 (;@21;) end end - local.get 1 local.get 2 + local.get 6 i32.eq br_if 7 (;@13;) local.get 2 @@ -2941,7 +3085,7 @@ local.set 5 block ;; label = @20 local.get 2 - call 29 + call 30 local.tee 0 i32.eqz br_if 0 (;@20;) @@ -2954,20 +3098,20 @@ br_table 0 (;@22;) 1 (;@21;) 0 (;@22;) 1 (;@21;) end local.get 0 - local.get 1 + local.get 6 i32.eq br_if 1 (;@20;) local.get 0 i32.const 2 i32.sub - call 29 + call 30 local.tee 0 i32.eqz br_if 1 (;@20;) end block ;; label = @21 local.get 0 - local.get 1 + local.get 6 i32.sub i32.const 5 i32.lt_s @@ -2999,7 +3143,7 @@ i32.ne br_if 0 (;@21;) local.get 0 - local.get 8 + local.get 14 i32.eq br_if 9 (;@12;) local.get 0 @@ -3030,14 +3174,12 @@ local.get 2 end call 13 - local.set 11 local.get 2 i32.const 46 i32.eq br_if 0 (;@21;) local.get 0 local.set 5 - local.get 11 i32.eqz br_if 9 (;@12;) br 1 (;@20;) @@ -3053,7 +3195,7 @@ br 5 (;@13;) end i32.const 4340 - local.get 3 + local.get 1 i32.const 1 i32.sub i32.store16 @@ -3067,12 +3209,17 @@ i32.const 4188 i32.load local.tee 3 - br_if 14 (;@2;) - i32.const 4 - local.set 3 - i32.const 4188 - i32.const 4 - i32.store + i32.eqz + if ;; label = @17 + i32.const 4188 + i32.const 4 + i32.store + i32.const 4 + local.set 3 + end + i32.const 4112 + i32.load + local.set 2 br 14 (;@2;) end local.get 0 @@ -3090,9 +3237,9 @@ br_if 1 (;@12;) end local.get 4 - call 31 + call 32 local.set 0 - local.get 6 + local.get 3 i32.eqz br_if 0 (;@12;) i32.const 1 @@ -3101,13 +3248,13 @@ br_if 1 (;@11;) drop end - call 32 + call 33 i32.const 0 end i32.store8 br 5 (;@5;) end - call 33 + call 34 br 4 (;@5;) end local.get 0 @@ -3121,7 +3268,7 @@ br 1 (;@6;) end local.get 0 - call 34 + call 35 end block ;; label = @6 i32.const 4220 @@ -3818,6 +3965,7 @@ i32.const 0 i32.const 7 call 11 + drop br 23 (;@5;) end local.get 1 @@ -4316,7 +4464,7 @@ i32.shl i32.add i32.load - call 27 + call 28 i32.eqz br_if 2 (;@21;) br 3 (;@20;) @@ -4328,7 +4476,7 @@ i32.shl i32.add i32.load - call 28 + call 29 br_if 2 (;@20;) local.get 1 i32.const 16656 @@ -4345,7 +4493,7 @@ br_if 1 (;@20;) end local.get 4 - call 31 + call 32 local.set 1 local.get 0 i32.eqz @@ -4356,7 +4504,7 @@ br_if 1 (;@19;) drop end - call 32 + call 33 i32.const 0 end i32.store8 @@ -4467,242 +4615,77 @@ local.get 4 local.set 1 loop ;; label = @14 - local.get 1 - local.tee 0 - i32.eqz - i32.const 4332 - i32.load8_u - local.tee 1 - i32.const 1 - i32.and - i32.or - i32.eqz - if ;; label = @15 - local.get 0 - i32.const 0 - i32.store8 offset=34 - local.get 4 - i32.const 0 - local.get 0 - i32.load offset=76 - local.tee 1 - select - local.set 4 - i32.const 2 + block ;; label = @15 + local.get 1 + local.tee 0 + i32.eqz + i32.const 4332 + i32.load8_u + local.tee 5 i32.const 1 - local.get 0 - i32.load8_u offset=33 - i32.const 2 - i32.and - local.tee 6 - select - local.tee 2 - local.get 0 - i32.load8_u offset=32 - local.tee 3 i32.and - br_if 1 (;@14;) - local.get 0 - local.get 2 - local.get 3 i32.or - i32.store8 offset=32 - local.get 0 - i32.const 36 - i32.add - local.set 5 - loop (result i32) ;; label = @16 - local.get 5 - i32.load - local.tee 2 - if (result i32) ;; label = @17 - local.get 2 - i32.load offset=4 - local.set 3 - local.get 2 - i32.load - local.set 5 - block ;; label = @18 - local.get 6 - i32.eqz - if ;; label = @19 - local.get 5 - local.get 3 - i32.const 4024 - i32.const 4038 - call 18 - br_if 1 (;@18;) - local.get 5 - local.get 3 - i32.const 4048 - i32.const 4068 - call 18 - br_if 1 (;@18;) - end - local.get 5 - local.get 3 - i32.const 18704 - i32.load - call_indirect (type 0) - end - local.get 2 - i32.const 8 - i32.add - local.set 5 - br 1 (;@16;) - else - local.get 0 - i32.const 44 - i32.add - end + i32.eqz + if ;; label = @16 + local.get 0 + i32.load8_u offset=35 + i32.eqz + br_if 1 (;@15;) + i32.const 4332 + i32.const 1 + i32.store8 + i32.const 1 + local.set 5 end - local.set 5 - loop ;; label = @16 - local.get 5 + i32.const 0 + local.set 3 + i32.const 4324 + i32.load8_u + if ;; label = @16 + i32.const 4316 i32.load - local.tee 2 - if ;; label = @17 - local.get 2 - i32.load - local.get 2 - i32.load offset=4 - i32.const 18708 - i32.load - call_indirect (type 0) - local.get 2 - i32.const 8 - i32.add - local.set 5 - br 1 (;@16;) - end + i32.const 18740 + i32.load8_u + i32.or + i32.eqz + local.get 5 + i32.or + i32.const 1 + i32.and + i32.eqz + br_if 15 (;@1;) end - local.get 0 - i32.const 60 - i32.add + i32.const 18724 local.set 5 loop ;; label = @16 local.get 5 i32.load - local.tee 2 + local.tee 0 i32.eqz - br_if 2 (;@14;) - block ;; label = @17 - block ;; label = @18 - local.get 2 + br_if 15 (;@1;) + local.get 0 + i32.const 36 + i32.add + local.set 5 + loop ;; label = @17 + local.get 5 + i32.load + local.tee 1 + if ;; label = @18 + local.get 1 i32.load - local.get 2 + local.get 1 i32.load offset=4 - call 17 - local.tee 0 - if ;; label = @19 - local.get 0 - block (result i32) ;; label = @20 - block ;; label = @21 - local.get 6 - i32.eqz - br_if 0 (;@21;) - local.get 2 - i32.load8_u offset=8 - br_if 0 (;@21;) - i32.const 2 - br 1 (;@20;) - end - i32.const 1 - end - local.tee 3 - local.get 0 - i32.load8_u offset=33 - i32.or - i32.store8 offset=33 - local.get 0 - i32.load8_u offset=34 - br_if 2 (;@17;) - local.get 3 - local.get 0 - i32.load8_u offset=32 - i32.and - br_if 2 (;@17;) - local.get 0 - i32.const 0 - i32.store offset=76 - local.get 0 - i32.const 1 - i32.store8 offset=34 - local.get 4 - br_if 1 (;@18;) - local.get 0 - local.tee 4 - local.set 1 - br 2 (;@17;) - end - i32.const 4332 - i32.const 1 - i32.store8 - br 4 (;@14;) + i32.const 18704 + i32.load + call_indirect (type 0) + local.get 1 + i32.const 8 + i32.add + local.set 5 + br 1 (;@17;) end - local.get 4 - local.get 0 - i32.store offset=76 - local.get 0 - local.set 4 end - local.get 2 - i32.const 12 - i32.add - local.set 5 - br 0 (;@16;) - end - unreachable - end - end - i32.const 0 - local.set 3 - i32.const 4324 - i32.load8_u - if ;; label = @14 - i32.const 4316 - i32.load - i32.const 18740 - i32.load8_u - i32.or - i32.eqz - local.get 1 - i32.or - i32.const 1 - i32.and - i32.eqz - br_if 13 (;@1;) - end - i32.const 18724 - local.set 5 - loop ;; label = @14 - local.get 5 - i32.load - local.tee 0 - i32.eqz - br_if 13 (;@1;) - local.get 0 - i32.const 36 - i32.add - local.set 5 - loop ;; label = @15 - local.get 5 - i32.load - local.tee 1 - if ;; label = @16 - local.get 1 - i32.load - local.get 1 - i32.load offset=4 - i32.const 18704 - i32.load - call_indirect (type 0) - local.get 1 - i32.const 8 - i32.add - local.set 5 - br 1 (;@15;) - else local.get 0 i32.const 44 i32.add @@ -4729,7 +4712,7 @@ i32.const 68 i32.add local.set 5 - br 4 (;@14;) + br 2 (;@16;) end unreachable end @@ -4737,75 +4720,250 @@ end unreachable end - unreachable - end - unreachable - end - call 33 - br 8 (;@4;) - end - i32.const 12 - end - local.tee 3 - i32.store - end - i32.const 4112 - i32.load - local.set 1 - br 7 (;@2;) - end - local.get 0 - i32.const 160 - i32.ne - br_if 3 (;@5;) - end - i32.const 4360 - i32.const 1 - i32.store8 - br 2 (;@5;) - end - local.get 0 - call 34 - br 1 (;@5;) - end - local.get 0 - i32.load16_u offset=4 - i32.const 111 - i32.ne - br_if 0 (;@5;) - local.get 0 - i32.load16_u offset=6 - i32.const 100 - i32.ne - br_if 0 (;@5;) - local.get 0 - i32.load16_u offset=8 - i32.const 117 - i32.ne - br_if 0 (;@5;) - local.get 0 - i32.load16_u offset=10 - i32.const 108 - i32.ne - br_if 0 (;@5;) - local.get 0 - i32.load16_u offset=12 - i32.const 101 - i32.ne - br_if 0 (;@5;) - local.get 5 - i32.const 4112 - i32.load - i32.ne - if ;; label = @6 - local.get 0 - i32.load16_u - call 9 + local.get 0 + i32.const 0 + i32.store8 offset=34 + local.get 4 + i32.const 0 + local.get 0 + i32.load offset=76 + local.tee 1 + select + local.set 4 + i32.const 2 + i32.const 1 + local.get 0 + i32.load8_u offset=33 + i32.const 2 + i32.and + local.tee 6 + select + local.tee 2 + local.get 0 + i32.load8_u offset=32 + local.tee 3 + i32.and + br_if 0 (;@14;) + local.get 0 + local.get 2 + local.get 3 + i32.or + i32.store8 offset=32 + local.get 0 + i32.const 36 + i32.add + local.set 5 + loop (result i32) ;; label = @15 + local.get 5 + i32.load + local.tee 2 + if (result i32) ;; label = @16 + local.get 2 + i32.load offset=4 + local.set 3 + local.get 2 + i32.load + local.set 5 + block ;; label = @17 + local.get 6 + i32.eqz + if ;; label = @18 + local.get 5 + local.get 3 + i32.const 4024 + i32.const 4038 + call 18 + br_if 1 (;@17;) + local.get 5 + local.get 3 + i32.const 4048 + i32.const 4068 + call 18 + br_if 1 (;@17;) + end + local.get 5 + local.get 3 + i32.const 18704 + i32.load + call_indirect (type 0) + end + local.get 2 + i32.const 8 + i32.add + local.set 5 + br 1 (;@15;) + else + local.get 0 + i32.const 44 + i32.add + end + end + local.set 5 + loop ;; label = @15 + local.get 5 + i32.load + local.tee 2 + if ;; label = @16 + local.get 2 + i32.load + local.get 2 + i32.load offset=4 + i32.const 18708 + i32.load + call_indirect (type 0) + local.get 2 + i32.const 8 + i32.add + local.set 5 + br 1 (;@15;) + end + end + local.get 0 + i32.const 60 + i32.add + local.set 5 + loop ;; label = @15 + local.get 5 + i32.load + local.tee 2 + i32.eqz + br_if 1 (;@14;) + block ;; label = @16 + block ;; label = @17 + local.get 2 + i32.load + local.get 2 + i32.load offset=4 + call 17 + local.tee 0 + if ;; label = @18 + local.get 0 + block (result i32) ;; label = @19 + block ;; label = @20 + local.get 6 + i32.eqz + br_if 0 (;@20;) + local.get 2 + i32.load8_u offset=8 + br_if 0 (;@20;) + i32.const 2 + br 1 (;@19;) + end + i32.const 1 + end + local.tee 3 + local.get 0 + i32.load8_u offset=33 + i32.or + i32.store8 offset=33 + local.get 0 + i32.load8_u offset=34 + br_if 2 (;@16;) + local.get 3 + local.get 0 + i32.load8_u offset=32 + i32.and + br_if 2 (;@16;) + local.get 0 + i32.const 0 + i32.store offset=76 + local.get 0 + i32.const 1 + i32.store8 offset=34 + local.get 4 + br_if 1 (;@17;) + local.get 0 + local.tee 4 + local.set 1 + br 2 (;@16;) + end + i32.const 4332 + i32.const 1 + i32.store8 + br 3 (;@14;) + end + local.get 4 + local.get 0 + i32.store offset=76 + local.get 0 + local.set 4 + end + local.get 2 + i32.const 12 + i32.add + local.set 5 + br 0 (;@15;) + end + unreachable + end + unreachable + end + call 34 + br 8 (;@4;) + end + i32.const 12 + end + local.tee 3 + i32.store + end + i32.const 4112 + i32.load + local.set 2 + br 7 (;@2;) + end + local.get 0 + i32.const 160 + i32.ne + br_if 3 (;@5;) + end + i32.const 4360 + i32.const 1 + i32.store8 + br 2 (;@5;) + end + local.get 0 + call 35 + br 1 (;@5;) + end + local.get 0 + i32.load16_u offset=4 + i32.const 111 + i32.ne + br_if 0 (;@5;) + local.get 0 + i32.load16_u offset=6 + i32.const 100 + i32.ne + br_if 0 (;@5;) + local.get 0 + i32.load16_u offset=8 + i32.const 117 + i32.ne + br_if 0 (;@5;) + local.get 0 + i32.load16_u offset=10 + i32.const 108 + i32.ne + br_if 0 (;@5;) + local.get 0 + i32.load16_u offset=12 + i32.const 101 + i32.ne + br_if 0 (;@5;) + local.get 5 + i32.const 4112 + i32.load + i32.ne + if ;; label = @6 + local.get 0 + i32.load16_u + call 9 i32.eqz br_if 1 (;@5;) end i32.const 6 call 12 + drop end block ;; label = @5 i32.const 4220 @@ -4932,13 +5090,13 @@ i32.store i32.const 4184 local.get 5 - local.get 1 + local.get 2 i32.sub i32.const 1 i32.shr_s i32.store end - local.get 10 + local.get 9 i32.const 16 i32.add global.set 0 @@ -5190,12 +5348,12 @@ local.set 3 end local.get 3) - (func (;11;) (type 0) (param i32 i32) - (local i32 i32 i32 i32 i32 i32 i64 i64) + (func (;11;) (type 3) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i64 i64) global.get 0 i32.const 16 i32.sub - local.tee 5 + local.tee 6 global.set 0 i32.const 4220 i32.const 4220 @@ -5233,12 +5391,10 @@ i32.add i32.store call 14 - local.set 0 i32.const 4220 i32.load local.set 1 - local.get 0 - call 35 + call 36 i32.eqz br_if 2 (;@2;) i32.const 4220 @@ -5253,6 +5409,8 @@ i32.const 4116 i32.load call_indirect (type 0) + i32.const 1 + local.set 1 br 3 (;@1;) end i32.const 4220 @@ -5292,18 +5450,18 @@ local.get 3 local.get 1 i32.load16_u - local.tee 6 + local.tee 5 i32.eq if ;; label = @7 local.get 0 local.set 2 br 3 (;@4;) end - local.get 6 + local.get 5 i32.const 92 i32.ne if ;; label = @7 - local.get 6 + local.get 5 i32.const 10 i32.sub br_table 1 (;@6;) 2 (;@5;) 2 (;@5;) 1 (;@6;) 2 (;@5;) @@ -5372,14 +5530,19 @@ i32.const 4116 i32.load call_indirect (type 0) - br 1 (;@2;) + i32.const 4220 + local.get 4 + i32.store + i32.const 1 + local.set 1 + br 2 (;@1;) end local.get 0 i32.eqz br_if 0 (;@2;) i32.const 4224 i32.load8_u - local.tee 0 + local.tee 1 i32.eqz if ;; label = @3 i32.const 4140 @@ -5396,21 +5559,21 @@ i32.add i32.store call 14 - local.set 1 - local.get 0 + local.set 0 + local.get 1 if ;; label = @3 block ;; label = @4 block ;; label = @5 - local.get 1 + local.get 0 i32.const 40 i32.ne if ;; label = @6 - local.get 1 + local.get 0 i32.const 95 i32.ne br_if 1 (;@5;) i32.const 0 - local.set 0 + local.set 1 i32.const 4312 i32.load i32.eqz @@ -5418,94 +5581,94 @@ i32.const 4220 i32.load local.set 2 - local.get 5 + local.get 6 i32.const 12 i32.add - local.get 5 + local.get 6 i32.const 8 i32.add call 16 - local.set 3 + local.set 1 block (result i32) ;; label = @7 i32.const 4228 i32.load - local.tee 1 - local.get 3 + local.tee 0 + local.get 1 i32.eqz br_if 0 (;@7;) drop - local.get 5 + local.get 6 i32.load offset=12 - local.set 3 - local.get 1 + local.set 5 + local.get 0 if ;; label = @8 - local.get 5 + local.get 6 i32.load offset=8 - local.set 6 + local.set 7 i32.const 4168 i32.const 4168 i64.load - local.tee 8 + local.tee 9 i64.const 16 i64.add - local.tee 9 + local.tee 10 i32.const 4176 i64.load i64.gt_u if (result i64) ;; label = @9 - local.get 9 + local.get 10 call 3 i32.const 4168 i64.load - local.tee 8 + local.tee 9 i64.const 16 i64.add else - local.get 9 + local.get 10 end i64.store - local.get 8 + local.get 9 i32.wrap_i64 - local.tee 0 + local.tee 3 i32.const 0 i32.store offset=12 - local.get 0 + local.get 3 i32.const 0 i32.store8 offset=8 - local.get 0 - local.get 6 + local.get 3 + local.get 7 i32.store offset=4 - local.get 0 local.get 3 + local.get 5 i32.store - local.get 1 + local.get 0 i32.load offset=64 - local.tee 3 + local.tee 5 i32.const 12 i32.add - local.get 1 + local.get 0 i32.const 60 i32.add - local.get 3 + local.get 5 select - local.get 0 + local.get 3 i32.store - local.get 1 local.get 0 + local.get 3 i32.store offset=64 i32.const 4312 i32.load i32.eqz - local.set 0 + local.set 3 i32.const 4228 i32.load br 1 (;@7;) end i32.const 4316 - local.get 3 + local.get 5 i32.store i32.const 4320 - local.get 5 + local.get 6 i32.load offset=8 i32.store i32.const 4324 @@ -5513,9 +5676,7 @@ i32.store8 i32.const 0 end - local.set 1 - local.get 0 - local.get 1 + local.get 3 i32.or br_if 2 (;@4;) local.get 2 @@ -5609,26 +5770,26 @@ i32.ne br_if 2 (;@4;) i32.const 0 - local.set 1 + local.set 0 block ;; label = @7 i32.const 4328 i32.load - local.tee 3 + local.tee 5 local.get 2 i32.const 38 i32.add - local.tee 0 + local.tee 3 i32.lt_u br_if 0 (;@7;) - local.get 0 + local.get 3 i32.load16_u - local.tee 1 + local.tee 0 i32.const 64512 i32.and i32.const 55296 i32.ne br_if 0 (;@7;) - local.get 1 + local.get 0 i32.const 10 i32.shl i32.const 1047552 @@ -5640,56 +5801,58 @@ i32.or i32.const 65536 i32.add - local.set 1 + local.set 0 end - local.get 1 + local.get 0 call 13 br_if 2 (;@4;) i32.const 4220 - local.get 0 + local.get 3 i32.store call 14 - local.set 0 + local.set 2 i32.const 4324 - local.set 1 + local.set 0 block ;; label = @7 i32.const 4220 i32.load - local.get 3 + local.get 5 i32.gt_u br_if 0 (;@7;) block ;; label = @8 block ;; label = @9 - local.get 0 + local.get 2 i32.const 41 i32.sub br_table 2 (;@7;) 1 (;@8;) 1 (;@8;) 2 (;@7;) 0 (;@9;) end - local.get 0 + local.get 2 i32.const 59 i32.eq - local.get 0 + local.get 2 i32.const 125 i32.eq i32.or br_if 1 (;@7;) end i32.const 4332 - local.set 1 + local.set 0 end - local.get 1 + local.get 0 i32.const 1 i32.store8 br 2 (;@4;) end call 15 - local.set 1 + local.set 0 end - local.get 1 + local.get 0 i32.const 114 i32.ne if ;; label = @5 - local.get 1 + i32.const 0 + local.set 1 + local.get 0 i32.const 123 i32.ne br_if 1 (;@4;) @@ -5697,22 +5860,24 @@ i32.const 4220 i32.load i32.store + i32.const 1 + local.set 1 br 1 (;@4;) end i32.const 1 call 20 - drop + local.set 1 end i32.const 4220 local.get 4 i32.store br 2 (;@1;) end - local.get 1 + local.get 0 i32.const 114 i32.ne if ;; label = @3 - local.get 1 + local.get 0 i32.const 123 i32.ne br_if 1 (;@2;) @@ -5720,7 +5885,9 @@ i32.load i32.const 2 i32.sub - local.set 6 + local.set 7 + i32.const 1 + local.set 1 block ;; label = @4 loop ;; label = @5 i32.const 4220 @@ -5740,246 +5907,241 @@ local.set 4 i32.const 4220 i32.load - local.set 0 + local.set 3 block ;; label = @6 - local.get 4 - call 35 - if ;; label = @7 - i32.const 4220 - i32.load - local.set 2 + block ;; label = @7 block ;; label = @8 - block ;; label = @9 - call 14 - local.tee 1 - i32.const 40 - i32.sub - br_table 1 (;@8;) 5 (;@4;) 5 (;@4;) 5 (;@4;) 1 (;@8;) 0 (;@9;) - end block ;; label = @9 block ;; label = @10 - local.get 1 - i32.const 58 - i32.sub - br_table 1 (;@9;) 6 (;@4;) 6 (;@4;) 2 (;@8;) 0 (;@10;) + local.get 4 + call 36 + if ;; label = @11 + i32.const 4220 + i32.load + local.set 2 + block ;; label = @12 + call 14 + local.tee 0 + i32.const 40 + i32.sub + br_table 5 (;@7;) 8 (;@4;) 8 (;@4;) 8 (;@4;) 5 (;@7;) 0 (;@12;) + end + block ;; label = @12 + local.get 0 + i32.const 58 + i32.sub + br_table 0 (;@12;) 8 (;@4;) 8 (;@4;) 5 (;@7;) 2 (;@10;) + end + i32.const 4220 + i32.const 4220 + i32.load + i32.const 2 + i32.add + i32.store + call 14 + call 36 + i32.const 4220 + i32.load + i32.load16_u + local.set 0 + br_if 4 (;@7;) + local.get 0 + i32.const 65535 + i32.and + i32.const 92 + local.set 0 + i32.const 92 + i32.ne + br_if 7 (;@4;) + br 4 (;@7;) + end + block ;; label = @11 + local.get 4 + i32.const 34 + i32.ne + if ;; label = @12 + local.get 4 + i32.const 46 + i32.eq + br_if 1 (;@11;) + local.get 4 + i32.const 39 + i32.ne + br_if 8 (;@4;) + end + i32.const 4220 + i32.load + local.tee 8 + local.set 0 + block ;; label = @12 + loop ;; label = @13 + block ;; label = @14 + local.get 0 + local.tee 3 + i32.const 2 + i32.add + local.set 0 + local.get 2 + local.get 3 + i32.le_u + br_if 0 (;@14;) + local.get 4 + local.get 0 + i32.load16_u + local.tee 5 + i32.eq + if ;; label = @15 + local.get 3 + local.set 2 + br 3 (;@12;) + end + local.get 5 + i32.const 92 + i32.ne + if ;; label = @15 + local.get 5 + i32.const 10 + i32.sub + br_table 1 (;@14;) 2 (;@13;) 2 (;@13;) 1 (;@14;) 2 (;@13;) + end + local.get 3 + i32.const 4 + i32.add + local.set 0 + local.get 3 + i32.load16_u offset=4 + i32.const 13 + i32.ne + br_if 1 (;@13;) + local.get 3 + i32.const 6 + i32.add + local.get 0 + local.get 3 + i32.load16_u offset=6 + i32.const 10 + i32.eq + select + local.set 0 + br 1 (;@13;) + end + end + i32.const 4188 + i32.load + i32.eqz + if ;; label = @13 + i32.const 4188 + i32.const 9 + i32.store + end + i32.const 4184 + local.get 0 + i32.const 4112 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store + end + i32.const 4220 + local.get 2 + i32.const 4 + i32.add + local.tee 2 + i32.store + call 14 + local.tee 0 + i32.const 58 + i32.ne + br_if 5 (;@6;) + i32.const 4220 + i32.const 4220 + i32.load + i32.const 2 + i32.add + i32.store + call 14 + call 36 + i32.eqz + i32.const 4220 + i32.load + i32.load16_u + local.tee 0 + i32.const 92 + i32.ne + i32.and + br_if 7 (;@4;) + local.get 8 + local.get 2 + i32.const 4116 + i32.load + call_indirect (type 0) + br 5 (;@6;) + end + i32.const 4220 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 46 + i32.ne + br_if 6 (;@4;) + local.get 0 + i32.load16_u offset=4 + i32.const 46 + i32.ne + br_if 6 (;@4;) + i32.const 4220 + local.get 0 + i32.const 6 + i32.add + i32.store + local.get 0 + i32.load16_u offset=6 + local.tee 0 + i32.const 114 + i32.eq + if (result i32) ;; label = @11 + i32.const 1 + call 20 + i32.const 4220 + i32.load + local.set 0 + br_if 2 (;@9;) + local.get 0 + i32.load16_u + else + local.get 0 + end + i32.const 65535 + i32.and + call 36 + i32.eqz + br_if 6 (;@4;) + br 2 (;@8;) end - local.get 1 + local.get 0 i32.const 125 i32.eq - br_if 1 (;@8;) + br_if 2 (;@7;) br 5 (;@4;) end i32.const 4220 - i32.const 4220 - i32.load + local.get 0 i32.const 2 i32.add i32.store - call 14 - call 35 - local.set 4 - i32.const 4220 - i32.load - i32.load16_u - local.set 1 - local.get 4 - br_if 0 (;@8;) - local.get 1 - i32.const 65535 - i32.and - local.set 4 - i32.const 92 - local.set 1 - local.get 4 - i32.const 92 - i32.ne - br_if 4 (;@4;) end - local.get 0 - local.get 2 - i32.const 4116 - i32.load - call_indirect (type 0) + call 14 + local.set 0 br 1 (;@6;) end - block ;; label = @7 - local.get 4 - i32.const 34 - i32.ne - if ;; label = @8 - local.get 4 - i32.const 46 - i32.eq - br_if 1 (;@7;) - local.get 4 - i32.const 39 - i32.ne - br_if 4 (;@4;) - end - i32.const 4220 - i32.load - local.tee 7 - local.set 1 - block ;; label = @8 - loop ;; label = @9 - block ;; label = @10 - local.get 1 - local.tee 0 - i32.const 2 - i32.add - local.set 1 - local.get 0 - local.get 2 - i32.ge_u - br_if 0 (;@10;) - local.get 4 - local.get 1 - i32.load16_u - local.tee 3 - i32.eq - if ;; label = @11 - local.get 0 - local.set 2 - br 3 (;@8;) - end - local.get 3 - i32.const 92 - i32.ne - if ;; label = @11 - local.get 3 - i32.const 10 - i32.sub - br_table 1 (;@10;) 2 (;@9;) 2 (;@9;) 1 (;@10;) 2 (;@9;) - end - local.get 0 - i32.const 4 - i32.add - local.set 1 - local.get 0 - i32.load16_u offset=4 - i32.const 13 - i32.ne - br_if 1 (;@9;) - local.get 0 - i32.const 6 - i32.add - local.get 1 - local.get 0 - i32.load16_u offset=6 - i32.const 10 - i32.eq - select - local.set 1 - br 1 (;@9;) - end - end - i32.const 4188 - i32.load - i32.eqz - if ;; label = @9 - i32.const 4188 - i32.const 9 - i32.store - end - i32.const 4184 - local.get 1 - i32.const 4112 - i32.load - i32.sub - i32.const 1 - i32.shr_s - i32.store - end - i32.const 4220 - local.get 2 - i32.const 4 - i32.add - local.tee 0 - i32.store - call 14 - local.tee 1 - i32.const 58 - i32.ne - br_if 1 (;@6;) - i32.const 4220 - i32.const 4220 - i32.load - i32.const 2 - i32.add - i32.store - call 14 - call 35 - i32.eqz - i32.const 4220 - i32.load - i32.load16_u - local.tee 1 - i32.const 92 - i32.ne - i32.and - br_if 3 (;@4;) - local.get 7 - local.get 0 - i32.const 4116 - i32.load - call_indirect (type 0) - br 1 (;@6;) - end - i32.const 4220 + local.get 3 + local.get 2 + i32.const 4116 i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 46 - i32.ne - br_if 2 (;@4;) - local.get 0 - i32.load16_u offset=4 - i32.const 46 - i32.ne - br_if 2 (;@4;) - i32.const 4220 - local.get 0 - i32.const 6 - i32.add - i32.store - block ;; label = @7 - block ;; label = @8 - local.get 0 - i32.load16_u offset=6 - local.tee 1 - i32.const 114 - i32.eq - if (result i32) ;; label = @9 - i32.const 1 - call 20 - local.set 1 - i32.const 4220 - i32.load - local.set 0 - local.get 1 - br_if 1 (;@8;) - local.get 0 - i32.load16_u - else - local.get 1 - end - i32.const 65535 - i32.and - call 35 - i32.eqz - br_if 4 (;@4;) - br 1 (;@7;) - end - i32.const 4220 - local.get 0 - i32.const 2 - i32.add - i32.store - end - call 14 - local.set 1 + call_indirect (type 0) end - local.get 1 + local.get 0 i32.const 65535 i32.and local.tee 0 @@ -5993,7 +6155,7 @@ br_if 3 (;@1;) end i32.const 4220 - local.get 6 + local.get 7 i32.store br 2 (;@1;) end @@ -6001,15 +6163,18 @@ call 20 drop end + i32.const 0 + local.set 1 i32.const 4220 local.get 4 i32.store end - local.get 5 + local.get 6 i32.const 16 i32.add - global.set 0) - (func (;12;) (type 5) (param i32) + global.set 0 + local.get 1) + (func (;12;) (type 1) (param i32) (result i32) (local i32) i32.const 4220 i32.const 4220 @@ -6076,7 +6241,8 @@ local.get 1 i32.const 2 i32.sub - i32.store) + i32.store + i32.const 0) (func (;13;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32) local.get 0 @@ -6166,7 +6332,7 @@ i32.lt_u br_if 1 (;@2;) local.get 0 - call 36 + call 37 local.get 0 i32.const 8204 i32.sub @@ -7722,178 +7888,207 @@ i32.store local.get 2) (func (;16;) (type 3) (param i32 i32) (result i32) - (local i32 i32) + (local i32 i32 i32 i32) block ;; label = @1 block ;; label = @2 - i32.const 4220 - i32.load - local.tee 2 - i32.load16_u offset=2 - i32.const 95 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=4 - i32.const 119 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=6 - i32.const 101 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=8 - i32.const 98 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=10 - i32.const 112 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=12 - i32.const 97 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=14 - i32.const 99 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=16 - i32.const 107 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=18 - i32.const 95 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=20 - i32.const 114 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=22 - i32.const 101 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=24 - i32.const 113 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=26 - i32.const 117 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=28 - i32.const 105 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=30 - i32.const 114 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=32 - i32.const 101 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=34 - i32.const 95 - i32.ne - br_if 0 (;@2;) - local.get 2 - i32.load16_u offset=36 - i32.const 95 - i32.ne - br_if 0 (;@2;) - i32.const 4220 - local.get 2 - i32.const 38 - i32.add - i32.store - call 14 - i32.const 40 - i32.ne - br_if 0 (;@2;) - i32.const 4220 - i32.const 4220 - i32.load - i32.const 2 - i32.add - i32.store - call 14 - local.tee 3 - i32.const 34 - i32.eq - local.get 3 - i32.const 39 - i32.eq - i32.or - i32.eqz - local.get 3 - i32.const 48 - i32.sub - i32.const 65535 - i32.and - i32.const 9 - i32.gt_u - i32.and - br_if 0 (;@2;) - local.get 0 - local.get 1 - call 37 - i32.eqz - br_if 0 (;@2;) - call 14 - i32.const 41 - i32.ne - br_if 0 (;@2;) - i32.const 4220 - i32.const 4220 - i32.load - i32.const 2 - i32.add - i32.store - call 14 - local.set 0 - i32.const 1 - local.set 1 - i32.const 4220 - i32.load - i32.const 4328 - i32.load - i32.gt_u - br_if 1 (;@1;) block ;; label = @3 + i32.const 4220 + i32.load + local.tee 2 + i32.load16_u offset=2 + i32.const 95 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=4 + i32.const 119 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=6 + i32.const 101 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=8 + i32.const 98 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=10 + i32.const 112 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=12 + i32.const 97 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=14 + i32.const 99 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=16 + i32.const 107 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=18 + i32.const 95 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=20 + i32.const 114 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=22 + i32.const 101 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=24 + i32.const 113 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=26 + i32.const 117 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=28 + i32.const 105 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=30 + i32.const 114 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=32 + i32.const 101 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=34 + i32.const 95 + i32.ne + br_if 0 (;@3;) + local.get 2 + i32.load16_u offset=36 + i32.const 95 + i32.ne + br_if 0 (;@3;) + i32.const 4220 + local.get 2 + i32.const 38 + i32.add + i32.store + call 14 + i32.const 40 + i32.ne + br_if 1 (;@2;) + i32.const 4220 + i32.const 4220 + i32.load + i32.const 2 + i32.add + i32.store + call 14 + local.tee 3 + i32.const 34 + i32.eq + local.get 3 + i32.const 39 + i32.eq + i32.or + i32.eqz + if ;; label = @4 + local.get 3 + i32.const 48 + i32.sub + i32.const 65535 + i32.and + i32.const 9 + i32.gt_u + br_if 2 (;@2;) + end local.get 0 + local.get 1 + call 38 + i32.eqz + br_if 0 (;@3;) + call 14 i32.const 41 - i32.sub - br_table 2 (;@1;) 1 (;@2;) 1 (;@2;) 2 (;@1;) 0 (;@3;) + i32.ne + br_if 0 (;@3;) + i32.const 4220 + i32.const 4220 + i32.load + local.tee 0 + i32.const 2 + i32.add + i32.store + call 14 + local.set 3 + i32.const 4220 + i32.load + i32.const 4328 + i32.load + i32.gt_u + if ;; label = @4 + local.get 0 + local.set 2 + i32.const 1 + local.set 4 + br 2 (;@2;) + end + block ;; label = @4 + block ;; label = @5 + local.get 3 + i32.const 41 + i32.sub + local.tee 5 + br_table 1 (;@4;) 3 (;@2;) 3 (;@2;) 1 (;@4;) 0 (;@5;) + end + local.get 3 + i32.const 125 + i32.eq + br_if 0 (;@4;) + local.get 3 + i32.const 59 + i32.ne + br_if 2 (;@2;) + end + i32.const 4220 + local.get 0 + i32.store + i32.const 1 + local.set 1 + block ;; label = @4 + local.get 5 + br_table 3 (;@1;) 2 (;@2;) 2 (;@2;) 3 (;@1;) 0 (;@4;) + end + local.get 3 + i32.const 59 + i32.eq + local.get 3 + i32.const 125 + i32.eq + i32.or + br_if 2 (;@1;) + br 1 (;@2;) end - local.get 0 - i32.const 59 - i32.eq - local.get 0 - i32.const 125 - i32.eq - i32.or - br_if 1 (;@1;) end i32.const 4220 local.get 2 i32.store - i32.const 0 + local.get 4 local.set 1 end local.get 1) @@ -7955,7 +8150,7 @@ local.get 4 i32.const 4 i32.add - call 39 + call 40 local.tee 2 i32.const -1 i32.eq @@ -8099,12 +8294,12 @@ local.get 4 i32.const 20 i32.add - call 39 + call 40 local.set 0 local.get 4 i32.const 8 i32.add - call 39 + call 40 local.set 1 local.get 0 i32.const -1 @@ -9018,7 +9213,6 @@ local.set 7 local.get 0 i32.load16_u - local.set 4 local.get 0 i32.const 2 i32.add @@ -9028,7 +9222,6 @@ i32.add local.tee 2 local.set 1 - local.get 4 local.get 7 i32.load8_s i32.eq @@ -9066,7 +9259,6 @@ local.set 7 local.get 0 i32.load16_u - local.set 4 local.get 0 i32.const 2 i32.add @@ -9076,7 +9268,6 @@ i32.add local.tee 6 local.set 1 - local.get 4 local.get 7 i32.load8_s i32.eq @@ -9130,6 +9321,9 @@ call 19 i32.eqz br_if 0 (;@3;) + i32.const 4220 + i32.load + local.set 3 call 14 i32.const 44 i32.ne @@ -9142,122 +9336,145 @@ i32.store call 14 local.set 2 - local.get 0 - if ;; label = @4 - local.get 2 - i32.const 40 - i32.eq - if (result i32) ;; label = @5 - call 15 - else + block ;; label = @4 + local.get 0 + if ;; label = @5 local.get 2 - end - i32.const 123 - i32.ne - br_if 1 (;@3;) - i32.const 4336 - i32.const 4220 - i32.load - i32.store - br 1 (;@3;) - end - local.get 2 - i32.const 39 - i32.ne - local.get 2 - i32.const 34 - i32.ne - i32.and - br_if 0 (;@3;) - i32.const 4220 - i32.load - local.tee 6 - local.set 1 - block ;; label = @4 - loop ;; label = @5 - block ;; label = @6 - local.get 1 - local.tee 0 - i32.const 2 - i32.add - local.set 1 - local.get 0 - local.get 5 - i32.ge_u - br_if 0 (;@6;) + i32.const 40 + i32.eq + if (result i32) ;; label = @6 + call 15 + else local.get 2 - local.get 1 - i32.load16_u - local.tee 3 - i32.eq - if ;; label = @7 + end + i32.const 123 + i32.ne + br_if 2 (;@3;) + i32.const 4336 + i32.const 4220 + i32.load + i32.store + i32.const 4228 + i32.load + i32.eqz + br_if 2 (;@3;) + i32.const 18744 + i32.load + local.get 3 + i32.lt_u + br_if 1 (;@4;) + br 2 (;@3;) + end + local.get 2 + i32.const 39 + i32.ne + local.get 2 + i32.const 34 + i32.ne + i32.and + br_if 1 (;@3;) + i32.const 4220 + i32.load + local.tee 7 + local.set 1 + block ;; label = @5 + loop ;; label = @6 + block ;; label = @7 + local.get 1 + local.tee 0 + i32.const 2 + i32.add + local.set 1 local.get 0 - local.set 5 - br 3 (;@4;) - end - local.get 3 - i32.const 92 - i32.ne - if ;; label = @7 - local.get 3 + local.get 5 + i32.ge_u + br_if 0 (;@7;) + local.get 2 + local.get 1 + i32.load16_u + local.tee 6 + i32.eq + if ;; label = @8 + local.get 0 + local.set 5 + br 3 (;@5;) + end + local.get 6 + i32.const 92 + i32.ne + if ;; label = @8 + local.get 6 + i32.const 10 + i32.sub + br_table 1 (;@7;) 2 (;@6;) 2 (;@6;) 1 (;@7;) 2 (;@6;) + end + local.get 0 + i32.const 4 + i32.add + local.set 1 + local.get 0 + i32.load16_u offset=4 + i32.const 13 + i32.ne + br_if 1 (;@6;) + local.get 0 + i32.const 6 + i32.add + local.get 1 + local.get 0 + i32.load16_u offset=6 i32.const 10 - i32.sub - br_table 1 (;@6;) 2 (;@5;) 2 (;@5;) 1 (;@6;) 2 (;@5;) + i32.eq + select + local.set 1 + br 1 (;@6;) end - local.get 0 - i32.const 4 - i32.add - local.set 1 - local.get 0 - i32.load16_u offset=4 - i32.const 13 - i32.ne - br_if 1 (;@5;) - local.get 0 - i32.const 6 - i32.add - local.get 1 - local.get 0 - i32.load16_u offset=6 - i32.const 10 - i32.eq - select - local.set 1 - br 1 (;@5;) end - end - i32.const 4188 - i32.load - i32.eqz - if ;; label = @5 i32.const 4188 - i32.const 9 + i32.load + i32.eqz + if ;; label = @6 + i32.const 4188 + i32.const 9 + i32.store + end + i32.const 4184 + local.get 1 + i32.const 4112 + i32.load + i32.sub + i32.const 1 + i32.shr_s i32.store end - i32.const 4184 - local.get 1 - i32.const 4112 - i32.load - i32.sub - i32.const 1 - i32.shr_s + i32.const 4220 + local.get 5 + i32.const 4 + i32.add + local.tee 0 i32.store + call 14 + i32.const 44 + i32.ne + br_if 1 (;@3;) + local.get 7 + local.get 0 + i32.const 4116 + i32.load + call_indirect (type 0) + i32.const 4228 + i32.load + i32.eqz + br_if 1 (;@3;) + i32.const 18744 + i32.load + local.get 3 + i32.ge_u + br_if 1 (;@3;) end - i32.const 4220 - local.get 5 - i32.const 4 - i32.add - local.tee 0 + i32.const 18744 + local.get 3 i32.store - call 14 - i32.const 44 - i32.ne - br_if 0 (;@3;) - local.get 6 - local.get 0 - i32.const 4116 - i32.load - call_indirect (type 0) end i32.const 4220 local.get 8 @@ -9748,7 +9965,7 @@ i32.eq br_if 3 (;@2;) local.get 1 - call 35 + call 36 i32.eqz br_if 3 (;@2;) end @@ -9822,7 +10039,7 @@ i32.add i32.store call 14 - call 35 + call 36 i32.eqz br_if 1 (;@2;) block ;; label = @4 @@ -9843,7 +10060,7 @@ i32.add i32.store call 14 - call 35 + call 36 br_if 1 (;@5;) br 4 (;@2;) end @@ -10056,17 +10273,14 @@ i32.add i32.store call 14 - local.set 0 i32.const 4220 i32.load local.set 5 - local.get 0 - call 35 + call 36 i32.eqz br_if 1 (;@1;) i32.const 4220 i32.load - local.set 1 call 14 i32.const 41 i32.ne @@ -10130,14 +10344,12 @@ i32.add i32.store call 14 - local.set 0 i32.const 4220 i32.load local.tee 2 i32.const 2 i32.sub local.set 8 - local.get 0 i32.const 40 i32.ne br_if 1 (;@1;) @@ -10203,12 +10415,10 @@ i32.add i32.store call 14 - local.set 2 i32.const 4220 i32.load local.set 0 - local.get 2 - call 35 + call 36 i32.eqz br_if 1 (;@1;) i32.const 4220 @@ -10272,7 +10482,6 @@ local.tee 3 call 0 br_if 1 (;@1;) - local.get 1 local.get 5 i32.sub local.tee 6 @@ -10597,7 +10806,7 @@ i32.store local.get 0 local.get 2 - call 38 + call 39 if ;; label = @7 call 14 i32.const 41 @@ -11052,12 +11261,12 @@ br_if 0 (;@8;) local.get 0 local.get 2 - call 38 + call 39 br_if 1 (;@7;) br 7 (;@1;) end local.get 4 - call 35 + call 36 i32.eqz br_if 0 (;@7;) call 14 @@ -11713,7 +11922,7 @@ i32.eq br_if 5 (;@1;) local.get 4 - call 35 + call 36 i32.eqz br_if 5 (;@1;) end @@ -11955,9 +12164,24 @@ i32.load8_u i32.eqz br_if 0 (;@7;) - i32.const 4228 - i32.load - local.tee 1 + block ;; label = @8 + i32.const 4228 + i32.load + local.tee 1 + i32.eqz + br_if 0 (;@8;) + i32.const 4220 + i32.load + local.tee 2 + i32.const 18744 + i32.load + i32.le_u + br_if 0 (;@8;) + i32.const 18744 + local.get 2 + i32.store + end + local.get 1 i32.const 4232 local.get 1 select @@ -12070,170 +12294,387 @@ i32.const 4220 local.get 8 i32.store) - (func (;25;) (type 4) - (local i32 i32 i32 i32 i32 i32 i32 i32 i64 i64 i64) - global.get 0 - i32.const 48 - i32.sub - local.tee 2 - global.set 0 + (func (;25;) (type 5) (param i32) + (local i32 i32 i32 i32 i32 i32) i32.const 4220 i32.const 4220 i32.load - local.tee 6 + local.tee 5 i32.const 2 i32.add i32.store - local.get 2 - i32.const 0 - i32.store offset=24 - local.get 2 - i32.const 0 - i32.store offset=20 - local.get 2 - i32.const 0 - i32.store offset=16 - local.get 2 - i32.const 0 - i32.store offset=12 + call 14 + local.set 2 block ;; label = @1 - local.get 2 - i32.const 32 - i32.add - local.get 2 - i32.const 28 - i32.add - call 37 - i32.eqz - br_if 0 (;@1;) - block ;; label = @2 - call 14 - i32.const 58 - i32.ne - br_if 0 (;@2;) - i32.const 4220 - i32.const 4220 - i32.load - i32.const 2 - i32.add - i32.store + local.get 0 + i32.const 8 + i32.eq + if ;; label = @2 block ;; label = @3 - block ;; label = @4 - call 14 - local.tee 0 - i32.const 102 + local.get 2 + i32.const 34 + i32.ne + if ;; label = @4 + local.get 2 + i32.const 93 + i32.eq + br_if 3 (;@1;) + local.get 2 + i32.const 39 i32.ne - if ;; label = @5 - local.get 0 - i32.const 40 - i32.ne - br_if 3 (;@2;) - i32.const 4220 - i32.const 4220 - i32.load - local.tee 4 - i32.const 2 - i32.add - i32.store - call 14 - local.tee 0 - i32.const 40 - i32.eq - br_if 2 (;@3;) + br_if 1 (;@3;) + end + i32.const 4328 + i32.load + local.set 3 + i32.const 4220 + i32.load + local.tee 6 + local.set 1 + block ;; label = @4 + loop ;; label = @5 block ;; label = @6 - local.get 0 - i32.const 102 - i32.ne - br_if 0 (;@6;) - i32.const 4220 - i32.load + local.get 1 local.tee 0 - i32.load16_u offset=2 - i32.const 117 - i32.ne - br_if 0 (;@6;) + i32.const 2 + i32.add + local.set 1 local.get 0 - i32.load16_u offset=4 - i32.const 110 - i32.ne + local.get 3 + i32.ge_u br_if 0 (;@6;) - local.get 0 - i32.load16_u offset=6 - i32.const 99 + local.get 2 + local.get 1 + i32.load16_u + local.tee 4 + i32.eq + if ;; label = @7 + local.get 0 + local.set 3 + br 3 (;@4;) + end + local.get 4 + i32.const 92 i32.ne - br_if 0 (;@6;) + if ;; label = @7 + local.get 4 + i32.const 10 + i32.sub + br_table 1 (;@6;) 2 (;@5;) 2 (;@5;) 1 (;@6;) 2 (;@5;) + end local.get 0 - i32.load16_u offset=8 - i32.const 116 - i32.ne - br_if 0 (;@6;) + i32.const 4 + i32.add + local.set 1 local.get 0 - i32.load16_u offset=10 - i32.const 105 + i32.load16_u offset=4 + i32.const 13 i32.ne - br_if 0 (;@6;) + br_if 1 (;@5;) local.get 0 - i32.load16_u offset=12 - i32.const 111 - i32.ne - br_if 0 (;@6;) + i32.const 6 + i32.add + local.get 1 local.get 0 - i32.load16_u offset=14 - i32.const 110 + i32.load16_u offset=6 + i32.const 10 i32.eq - br_if 2 (;@4;) + select + local.set 1 + br 1 (;@5;) + end + end + i32.const 4188 + i32.load + i32.eqz + if ;; label = @5 + i32.const 4188 + i32.const 9 + i32.store + end + i32.const 4184 + local.get 1 + i32.const 4112 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store + end + i32.const 0 + local.set 1 + i32.const 4220 + local.get 3 + i32.const 4 + i32.add + local.tee 0 + i32.store + call 14 + i32.const 44 + i32.eq + if ;; label = @4 + local.get 6 + local.get 0 + i32.const 4116 + i32.load + call_indirect (type 0) + i32.const 16 + local.set 1 + br 3 (;@1;) + end + local.get 2 + i32.const 93 + i32.eq + br_if 2 (;@1;) + end + i32.const 4228 + i32.load + local.tee 0 + if ;; label = @3 + local.get 0 + i32.const 1 + i32.store8 offset=35 + br 2 (;@1;) + end + i32.const 18740 + i32.load8_u + i32.eqz + br_if 1 (;@1;) + i32.const 4332 + i32.const 1 + i32.store8 + br 1 (;@1;) + end + local.get 0 + i32.const 16 + i32.ne + if ;; label = @2 + i32.const 8 + local.set 1 + br 1 (;@1;) + end + i32.const 8 + local.set 1 + local.get 2 + i32.const 48 + i32.ne + br_if 0 (;@1;) + i32.const 4220 + i32.const 4220 + i32.load + i32.const 2 + i32.add + i32.store + i32.const 32 + i32.const 8 + call 14 + i32.const 44 + i32.eq + select + local.set 1 + end + i32.const 4340 + i32.load16_u + i32.const 16655 + i32.add + local.get 1 + i32.store8 + i32.const 4188 + i32.load + i32.eqz + if ;; label = @1 + i32.const 4220 + local.get 5 + i32.store + end) + (func (;26;) (type 4) + (local i32 i32 i32 i32 i32 i32 i32 i32 i64 i64 i64) + global.get 0 + i32.const 48 + i32.sub + local.tee 3 + global.set 0 + i32.const 4220 + i32.const 4220 + i32.load + local.tee 6 + i32.const 2 + i32.add + i32.store + local.get 3 + i32.const 0 + i32.store offset=24 + local.get 3 + i32.const 0 + i32.store offset=20 + local.get 3 + i32.const 0 + i32.store offset=16 + local.get 3 + i32.const 0 + i32.store offset=12 + local.get 3 + i32.const 32 + i32.add + local.get 3 + i32.const 28 + i32.add + call 38 + local.set 0 + call 14 + local.set 1 + block ;; label = @1 + local.get 0 + i32.eqz + br_if 0 (;@1;) + block ;; label = @2 + local.get 1 + i32.const 58 + i32.ne + local.get 1 + i32.const 40 + i32.ne + i32.and + br_if 0 (;@2;) + local.get 1 + i32.const 58 + i32.eq + if ;; label = @3 + i32.const 4220 + i32.const 4220 + i32.load + i32.const 2 + i32.add + i32.store + end + block ;; label = @3 + block (result i32) ;; label = @4 + block ;; label = @5 + local.get 1 + i32.const 58 + i32.ne + call 14 + local.tee 0 + i32.const 40 + i32.ne + i32.or + i32.eqz + if ;; label = @6 + i32.const 4220 + i32.const 4220 + i32.load + local.tee 4 + i32.const 2 + i32.add + i32.store + call 14 + local.tee 0 + i32.const 40 + i32.eq + br_if 3 (;@3;) + block ;; label = @7 + local.get 0 + i32.const 102 + i32.ne + br_if 0 (;@7;) + i32.const 4220 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 117 + i32.ne + br_if 0 (;@7;) + local.get 0 + i32.load16_u offset=4 + i32.const 110 + i32.ne + br_if 0 (;@7;) + local.get 0 + i32.load16_u offset=6 + i32.const 99 + i32.ne + br_if 0 (;@7;) + local.get 0 + i32.load16_u offset=8 + i32.const 116 + i32.ne + br_if 0 (;@7;) + local.get 0 + i32.load16_u offset=10 + i32.const 105 + i32.ne + br_if 0 (;@7;) + local.get 0 + i32.load16_u offset=12 + i32.const 111 + i32.ne + br_if 0 (;@7;) + local.get 0 + i32.load16_u offset=14 + i32.const 110 + i32.eq + br_if 2 (;@5;) + end + i32.const 4220 + local.get 4 + i32.store + br 3 (;@3;) end + i32.const 0 + local.get 0 + i32.const 102 + i32.ne + br_if 1 (;@4;) + drop i32.const 4220 - local.get 4 - i32.store - br 2 (;@3;) + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 117 + i32.ne + br_if 3 (;@2;) + local.get 0 + i32.load16_u offset=4 + i32.const 110 + i32.ne + br_if 3 (;@2;) end - i32.const 4220 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 117 + local.get 0 + i32.load16_u offset=6 + i32.const 99 i32.ne br_if 2 (;@2;) local.get 0 - i32.load16_u offset=4 + i32.load16_u offset=8 + i32.const 116 + i32.ne + br_if 2 (;@2;) + local.get 0 + i32.load16_u offset=10 + i32.const 105 + i32.ne + br_if 2 (;@2;) + local.get 0 + i32.load16_u offset=12 + i32.const 111 + i32.ne + br_if 2 (;@2;) + local.get 0 + i32.load16_u offset=14 i32.const 110 i32.ne br_if 2 (;@2;) + i32.const 4220 + local.get 0 + i32.const 16 + i32.add + i32.store + call 14 + local.set 0 + i32.const 1 end + local.set 2 local.get 0 - i32.load16_u offset=6 - i32.const 99 - i32.ne - br_if 1 (;@2;) - local.get 0 - i32.load16_u offset=8 - i32.const 116 - i32.ne - br_if 1 (;@2;) - local.get 0 - i32.load16_u offset=10 - i32.const 105 - i32.ne - br_if 1 (;@2;) - local.get 0 - i32.load16_u offset=12 - i32.const 111 - i32.ne - br_if 1 (;@2;) - local.get 0 - i32.load16_u offset=14 - i32.const 110 - i32.ne - br_if 1 (;@2;) - i32.const 4220 - local.get 0 - i32.const 16 - i32.add - i32.store - i32.const 1 - local.set 3 - call 14 i32.const 40 i32.ne br_if 1 (;@2;) @@ -12248,13 +12689,13 @@ i32.const 41 i32.ne if ;; label = @3 - local.get 2 + local.get 3 i32.const 24 i32.add - local.get 2 + local.get 3 i32.const 20 i32.add - call 37 + call 38 drop end block ;; label = @3 @@ -12269,13 +12710,13 @@ i32.const 2 i32.add i32.store - local.get 2 + local.get 3 i32.const 16 i32.add - local.get 2 + local.get 3 i32.const 12 i32.add - call 37 + call 38 drop call 14 local.tee 0 @@ -12288,13 +12729,13 @@ i32.const 2 i32.add i32.store - local.get 2 + local.get 3 i32.const 8 i32.add - local.get 2 + local.get 3 i32.const 4 i32.add - call 37 + call 38 drop call 14 local.set 0 @@ -12309,58 +12750,72 @@ i32.const 2 i32.add i32.store - local.get 3 - call 14 - local.tee 0 - i32.const 61 - i32.ne - i32.or - if (result i32) ;; label = @3 - local.get 0 - else - i32.const 4220 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 62 - i32.ne + block ;; label = @3 + block ;; label = @4 + local.get 2 + i32.const 1 + i32.xor + local.get 1 + i32.const 58 + i32.eq + i32.and + local.tee 1 + i32.eqz + call 14 + local.tee 0 + i32.const 61 + i32.ne + i32.or + br_if 0 (;@4;) + i32.const 4220 + i32.load + local.tee 2 + i32.load16_u offset=2 + i32.const 62 + i32.ne + br_if 0 (;@4;) + i32.const 4220 + local.get 2 + i32.const 4 + i32.add + i32.store + call 14 + local.set 0 + br 1 (;@3;) + end + local.get 1 br_if 1 (;@2;) - i32.const 4220 - local.get 0 - i32.const 4 - i32.add - i32.store - call 14 end + local.get 0 i32.const 123 i32.ne br_if 0 (;@2;) i32.const 18712 i32.const 4220 i32.load - local.tee 3 + local.tee 0 i32.store - local.get 2 + local.get 3 i32.load offset=28 local.set 4 - local.get 2 + local.get 3 i32.load offset=32 local.set 5 block ;; label = @3 block ;; label = @4 i32.const 18736 i32.load - local.tee 0 + local.tee 1 i32.eqz br_if 0 (;@4;) i32.const 18732 i32.load - local.get 0 + local.get 1 i32.const 1 i32.shr_u i32.ne br_if 1 (;@3;) - local.get 0 + local.get 1 i32.const 536870912 i32.lt_u br_if 0 (;@4;) @@ -12379,7 +12834,7 @@ i32.add i32.store i32.const 4184 - local.get 3 + local.get 0 i32.const 4112 i32.load i32.sub @@ -12392,18 +12847,18 @@ br 2 (;@2;) end i32.const 18736 - local.get 0 + local.get 1 i32.const 1 i32.shl i32.const 16 - local.get 0 + local.get 1 select - local.tee 1 + local.tee 2 i32.store i32.const 4168 i64.load local.tee 9 - local.get 1 + local.get 2 i32.const 2 i32.shl i64.extend_i32_u @@ -12424,7 +12879,7 @@ local.set 8 i32.const 18736 i32.load - local.set 1 + local.set 2 end i32.const 4168 local.get 8 @@ -12432,46 +12887,46 @@ i32.const 18728 local.get 9 i32.wrap_i64 - local.tee 3 + local.tee 0 i32.store - local.get 1 - local.set 0 + local.get 2 + local.set 1 loop ;; label = @4 - local.get 0 + local.get 1 if ;; label = @5 - local.get 3 + local.get 0 i32.const 0 i32.store - local.get 0 + local.get 1 i32.const 1 i32.sub - local.set 0 - local.get 3 + local.set 1 + local.get 0 i32.const 4 i32.add - local.set 3 + local.set 0 br 1 (;@4;) else - local.get 1 + local.get 2 i32.const 1 i32.sub - local.set 3 + local.set 0 i32.const 18728 i32.load - local.set 1 + local.set 2 i32.const 18724 - local.set 0 + local.set 1 loop ;; label = @6 - local.get 0 + local.get 1 i32.load - local.tee 0 + local.tee 1 i32.eqz br_if 3 (;@3;) - local.get 0 local.get 1 - local.get 0 + local.get 2 + local.get 1 i32.load offset=24 - local.get 3 + local.get 0 i32.and i32.const 2 i32.shl @@ -12480,12 +12935,12 @@ i32.load i32.store offset=72 local.get 7 - local.get 0 + local.get 1 i32.store - local.get 0 + local.get 1 i32.const 68 i32.add - local.set 0 + local.set 1 br 0 (;@6;) end unreachable @@ -12524,121 +12979,116 @@ local.get 8 end i64.store - block (result i32) ;; label = @3 + block ;; label = @3 local.get 4 - local.tee 3 - local.get 5 local.tee 0 - local.get 3 - i32.ge_u + local.get 5 + local.tee 1 + i32.le_u br_if 0 (;@3;) - drop - local.get 0 + local.get 1 i32.load16_u - local.tee 1 + local.tee 2 i32.const 39 i32.ne - if ;; label = @4 - local.get 3 - local.get 1 - i32.const 34 - i32.ne - br_if 1 (;@3;) - drop - end - local.get 5 + local.get 2 + i32.const 34 + i32.ne + i32.and + br_if 0 (;@3;) + local.get 0 i32.const 2 - i32.add + i32.sub local.set 0 - local.get 4 + local.get 1 i32.const 2 - i32.sub + i32.add + local.set 1 end - local.set 3 local.get 9 i32.wrap_i64 - local.set 1 - local.get 2 + local.set 2 + local.get 3 i32.const 0 i32.store16 offset=44 - local.get 2 local.get 3 - i32.store offset=40 - local.get 2 local.get 0 + i32.store offset=40 + local.get 3 + local.get 1 i32.store offset=36 i32.const -2128831035 - local.set 0 + local.set 1 loop ;; label = @3 - local.get 2 + local.get 3 i32.const 36 i32.add - call 39 - local.tee 3 + call 40 + local.tee 0 i32.const -1 i32.eq i32.eqz if ;; label = @4 local.get 0 - local.get 3 + local.get 1 i32.xor i32.const 16777619 i32.mul - local.set 0 + local.set 1 br 1 (;@3;) end end - local.get 1 + local.get 2 i64.const 0 i64.store offset=8 align=4 - local.get 1 + local.get 2 local.get 4 i32.store offset=4 - local.get 1 + local.get 2 local.get 5 i32.store + local.get 2 local.get 1 - local.get 0 i32.store offset=24 - local.get 1 + local.get 2 i32.const 16 i32.add local.tee 4 i64.const 0 i64.store align=4 - local.get 1 + local.get 2 i32.const 28 i32.add i32.const 52 call 1 drop - local.get 1 + local.get 2 i32.const 18728 i32.load i32.const 18736 i32.load i32.const 1 i32.sub - local.get 0 + local.get 1 i32.and i32.const 2 i32.shl i32.add - local.tee 0 + local.tee 1 i32.load i32.store offset=72 - local.get 0 local.get 1 + local.get 2 i32.store i32.const 18720 i32.load - local.tee 0 + local.tee 1 i32.const 68 i32.add i32.const 18724 - local.get 0 - select local.get 1 + select + local.get 2 i32.store i32.const 18732 i32.const 18732 @@ -12646,50 +13096,50 @@ i32.const 1 i32.add i32.store - local.get 1 local.get 2 + local.get 3 i32.load offset=12 - local.get 2 + local.get 3 i32.load offset=16 - local.tee 0 + local.tee 1 i32.sub i32.const 1 i32.shr_s i32.const 0 - local.get 0 + local.get 1 select i32.store offset=12 - local.get 1 local.get 2 + local.get 3 i32.load offset=20 - local.get 2 + local.get 3 i32.load offset=24 - local.tee 3 + local.tee 0 i32.sub i32.const 1 i32.shr_s i32.const 0 - local.get 3 + local.get 0 select i32.store offset=20 i32.const 18716 - local.get 1 + local.get 2 i32.store i32.const 18720 - local.get 1 + local.get 2 i32.store + local.get 2 local.get 1 - local.get 0 i32.store offset=8 local.get 4 - local.get 3 + local.get 0 i32.store end i32.const 18712 i32.load - local.tee 0 + local.tee 1 i32.const 0 - local.get 0 + local.get 1 local.get 6 i32.gt_u select @@ -12706,19 +13156,22 @@ local.get 6 i32.store end - local.get 2 + local.get 3 i32.const 48 i32.add global.set 0) - (func (;26;) (type 4) - (local i32 i32 i32 i32 i32 i32 i32 i32) + (func (;27;) (type 4) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32) i32.const 4220 i32.const 4220 i32.load - local.tee 7 + local.tee 8 i32.const 2 i32.add i32.store + call 14 + local.tee 7 + local.set 0 block ;; label = @1 block ;; label = @2 block ;; label = @3 @@ -12726,8 +13179,7 @@ block ;; label = @5 block ;; label = @6 block ;; label = @7 - call 14 - local.tee 0 + local.get 7 i32.const 42 i32.sub br_table 1 (;@6;) 2 (;@5;) 2 (;@5;) 2 (;@5;) 0 (;@7;) 2 (;@5;) @@ -12760,11 +13212,20 @@ i32.store call 14 i32.const 114 - i32.ne + i32.eq + if ;; label = @7 + i32.const 1 + call 20 + br_if 6 (;@1;) + end + i32.const 4228 + i32.load + local.tee 0 + i32.eqz br_if 5 (;@1;) + local.get 0 i32.const 1 - call 20 - drop + i32.store8 offset=35 br 5 (;@1;) end i32.const 4220 @@ -12896,7 +13357,7 @@ br_if 1 (;@3;) end local.get 1 - call 35 + call 36 i32.eqz if ;; label = @4 i32.const 0 @@ -13138,7 +13599,7 @@ i32.eq br_if 0 (;@3;) local.get 1 - call 35 + call 36 local.set 0 i32.const 4220 i32.load @@ -13155,54 +13616,69 @@ end call 14 local.set 0 - local.get 5 - if ;; label = @2 - local.get 0 - i32.const 93 - i32.ne - br_if 1 (;@1;) - i32.const 4220 - i32.const 4220 - i32.load - i32.const 2 - i32.add - i32.store - call 14 - local.set 0 - end - local.get 1 - i32.eqz - br_if 0 (;@1;) block ;; label = @2 - local.get 0 - i32.const 40 - i32.eq - local.get 0 - i32.const 58 - i32.eq - i32.or - br_if 0 (;@2;) local.get 5 - br_if 1 (;@1;) - local.get 0 - i32.const 125 - i32.eq + if ;; label = @3 + local.get 0 + i32.const 93 + i32.ne + br_if 1 (;@2;) + i32.const 4220 + i32.const 4220 + i32.load + i32.const 2 + i32.add + i32.store + call 14 + local.set 0 + end + local.get 1 + i32.eqz br_if 0 (;@2;) - local.get 0 - i32.const 44 - i32.ne - br_if 1 (;@1;) + block ;; label = @3 + local.get 0 + i32.const 40 + i32.eq + local.get 0 + i32.const 58 + i32.eq + i32.or + br_if 0 (;@3;) + local.get 5 + br_if 1 (;@2;) + local.get 0 + i32.const 125 + i32.eq + br_if 0 (;@3;) + local.get 0 + i32.const 44 + i32.ne + br_if 1 (;@2;) + end + local.get 2 + local.get 1 + i32.const 4116 + i32.load + call_indirect (type 0) + br 1 (;@1;) end - local.get 2 - local.get 1 - i32.const 4116 + local.get 7 + i32.const 125 + i32.eq + br_if 0 (;@1;) + i32.const 4228 i32.load - call_indirect (type 0) + local.tee 0 + i32.eqz + br_if 0 (;@1;) + local.get 0 + i32.const 1 + i32.store8 offset=35 end i32.const 4220 - local.get 7 + local.get 8 i32.store) - (func (;27;) (type 1) (param i32) (result i32) + (func (;28;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32) block ;; label = @1 block ;; label = @2 @@ -13329,7 +13805,7 @@ local.set 3 end local.get 3) - (func (;28;) (type 1) (param i32) (result i32) + (func (;29;) (type 1) (param i32) (result i32) (local i32 i32 i32) i32.const 1 local.set 2 @@ -13536,7 +14012,7 @@ return end local.get 2) - (func (;29;) (type 1) (param i32) (result i32) + (func (;30;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32) i32.const 4112 i32.load @@ -13651,7 +14127,7 @@ local.set 0 end local.get 0) - (func (;30;) (type 1) (param i32) (result i32) + (func (;31;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32) local.get 0 i32.const 64 @@ -13748,11 +14224,11 @@ i32.lt_u br_if 0 (;@1;) local.get 0 - call 36 + call 37 return end local.get 1) - (func (;31;) (type 1) (param i32) (result i32) + (func (;32;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32) block ;; label = @1 block ;; label = @2 @@ -14358,7 +14834,7 @@ return end i32.const 1) - (func (;32;) (type 4) + (func (;33;) (type 4) (local i32 i32 i32 i32 i32 i32 i32) i32.const 4328 i32.load @@ -14490,7 +14966,7 @@ i32.const 4220 local.get 4 i32.store) - (func (;33;) (type 4) + (func (;34;) (type 4) (local i32 i32 i32 i32) i32.const 4220 i32.load @@ -14638,7 +15114,7 @@ i32.const 4220 local.get 0 i32.store) - (func (;34;) (type 5) (param i32) + (func (;35;) (type 5) (param i32) (local i32 i32 i32 i32 i32 i64 i64) i32.const 4112 i32.load @@ -14658,10 +15134,8 @@ local.get 0 local.get 3 i32.gt_u - local.set 4 local.get 1 local.set 0 - local.get 4 br_if 1 (;@1;) end end @@ -14735,7 +15209,7 @@ i32.eqz br_if 0 (;@3;) local.get 1 - call 30 + call 31 local.set 4 local.get 0 i32.const -2 @@ -14947,7 +15421,7 @@ local.get 0 i32.store end) - (func (;35;) (type 1) (param i32) (result i32) + (func (;36;) (type 1) (param i32) (result i32) (local i32) block (result i32) ;; label = @1 local.get 0 @@ -14973,7 +15447,7 @@ end i32.const 0 local.get 0 - call 30 + call 31 i32.eqz br_if 0 (;@1;) drop @@ -15044,7 +15518,7 @@ end i32.const 1 end) - (func (;36;) (type 1) (param i32) (result i32) + (func (;37;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32 i32) block ;; label = @1 local.get 0 @@ -16964,7 +17438,7 @@ return end i32.const 1) - (func (;37;) (type 3) (param i32 i32) (result i32) + (func (;38;) (type 3) (param i32 i32) (result i32) (local i32 i32 i32 i32) call 14 local.set 3 @@ -17095,7 +17569,7 @@ end i32.const 0 local.get 3 - call 35 + call 36 i32.eqz br_if 1 (;@1;) drop @@ -17110,7 +17584,7 @@ i32.load i32.eqz end) - (func (;38;) (type 3) (param i32 i32) (result i32) + (func (;39;) (type 3) (param i32 i32) (result i32) (local i32 i32) block ;; label = @1 call 14 @@ -17347,7 +17821,7 @@ i32.add i32.store call 14 - call 35 + call 36 i32.eqz br_if 0 (;@1;) call 14 @@ -17391,7 +17865,7 @@ local.set 3 end local.get 3) - (func (;39;) (type 1) (param i32) (result i32) + (func (;40;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32 i32 i32) local.get 0 i32.load16_u offset=8 @@ -17683,7 +18157,7 @@ i32.const 0 i32.store16 offset=8 local.get 4) - (func (;40;) (type 1) (param i32) (result i32) + (func (;41;) (type 1) (param i32) (result i32) (local i32) i32.const 4112 i32.load @@ -17741,10 +18215,10 @@ i32.const 0 i32.store local.get 1) - (func (;41;) (type 2) (result i32) + (func (;42;) (type 2) (result i32) i32.const 4184 i32.load) - (func (;42;) (type 2) (result i32) + (func (;43;) (type 2) (result i32) i32.const 4132 i32.load i32.load @@ -17753,7 +18227,7 @@ i32.sub i32.const 1 i32.shr_s) - (func (;43;) (type 2) (result i32) + (func (;44;) (type 2) (result i32) i32.const 4132 i32.load i32.load offset=4 @@ -17762,7 +18236,7 @@ i32.sub i32.const 1 i32.shr_s) - (func (;44;) (type 2) (result i32) + (func (;45;) (type 2) (result i32) i32.const 4144 i32.load i32.load @@ -17771,7 +18245,7 @@ i32.sub i32.const 1 i32.shr_s) - (func (;45;) (type 2) (result i32) + (func (;46;) (type 2) (result i32) i32.const 4144 i32.load i32.load offset=4 @@ -17780,7 +18254,7 @@ i32.sub i32.const 1 i32.shr_s) - (func (;46;) (type 2) (result i32) + (func (;47;) (type 2) (result i32) i32.const 4156 i32.load i32.load @@ -17789,7 +18263,7 @@ i32.sub i32.const 1 i32.shr_s) - (func (;47;) (type 2) (result i32) + (func (;48;) (type 2) (result i32) i32.const 4156 i32.load i32.load offset=4 @@ -17798,19 +18272,19 @@ i32.sub i32.const 1 i32.shr_s) - (func (;48;) (type 2) (result i32) + (func (;49;) (type 2) (result i32) i32.const 4128 i32.const 4132 - call 54) - (func (;49;) (type 2) (result i32) + call 55) + (func (;50;) (type 2) (result i32) i32.const 4140 i32.const 4144 - call 54) - (func (;50;) (type 2) (result i32) + call 55) + (func (;51;) (type 2) (result i32) i32.const 4152 i32.const 4156 - call 54) - (func (;51;) (type 6) (param i32 i32 i32 i32 i32 i32) (result i32) + call 55) + (func (;52;) (type 6) (param i32 i32 i32 i32 i32 i32) (result i32) local.get 0 local.get 1 local.get 2 @@ -17818,7 +18292,7 @@ local.get 4 i32.const 0 call 6) - (func (;52;) (type 10) (param i32 i32 i32 i32 i32 i32 i32) (result i32) + (func (;53;) (type 10) (param i32 i32 i32 i32 i32 i32 i32) (result i32) local.get 0 local.get 1 local.get 2 @@ -17826,7 +18300,7 @@ local.get 4 local.get 6 call 6) - (func (;53;) (type 11) (param i32 i32 i32 i32) + (func (;54;) (type 11) (param i32 i32 i32 i32) (local i64 i64 i32 i32) i32.const 4168 i64.load @@ -17875,7 +18349,7 @@ local.get 6 local.get 1 i32.store offset=4) - (func (;54;) (type 3) (param i32 i32) (result i32) + (func (;55;) (type 3) (param i32 i32) (result i32) (local i32) local.get 1 local.get 1 @@ -17898,19 +18372,19 @@ (global (;1;) i32 (i32.const 32064)) (export "memory" (memory 0)) (export "__heap_base" (global 1)) - (export "sa" (func 40)) - (export "e" (func 41)) - (export "es" (func 42)) - (export "ee" (func 43)) - (export "res" (func 44)) - (export "ree" (func 45)) - (export "us" (func 46)) - (export "ue" (func 47)) - (export "re" (func 48)) - (export "rre" (func 49)) - (export "ru" (func 50)) - (export "parseCJS" (func 51)) - (export "parseCJSWithOptions" (func 52)) + (export "sa" (func 41)) + (export "e" (func 42)) + (export "es" (func 43)) + (export "ee" (func 44)) + (export "res" (func 45)) + (export "ree" (func 46)) + (export "us" (func 47)) + (export "ue" (func 48)) + (export "re" (func 49)) + (export "rre" (func 50)) + (export "ru" (func 51)) + (export "parseCJS" (func 52)) + (export "parseCJSWithOptions" (func 53)) (elem (;0;) (i32.const 1) func 7 8 2 4 5) (data (;0;) (i32.const 1026) "defineProperty\00defineProperties") (data (;1;) (i32.const 1076) "\0b\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00\12\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\0e\00\00\00\03\00\00\00\0d\00\00\00#\00\00\00z\00\00\00F\00\00\004\00\00\00\0c\01\00\00\1c\00\00\00\04\00\00\000\00\00\000\00\00\00\1f\00\00\00\0e\00\00\00\1d\00\00\00\06\00\00\00%\00\00\00\0b\00\00\00\1d\00\00\00\03\00\00\00#\00\00\00\05\00\00\00\07\00\00\00\02\00\00\00\04\00\00\00+\00\00\00\9d\00\00\00\13\00\00\00#\00\00\00\05\00\00\00#\00\00\00\05\00\00\00'\00\00\00\09\00\00\003\00\00\00\9d\00\00\006\01\00\00\0a\00\00\00\15\00\00\00\0b\00\00\00\07\00\00\00\99\00\00\00\05\00\00\00\03\00\00\00\00\00\00\00\02\00\00\00+\00\00\00\02\00\00\00\01\00\00\00\04\00\00\00\00\00\00\00\03\00\00\00\16\00\00\00\0b\00\00\00\16\00\00\00\0a\00\00\00\1e\00\00\00B\00\00\00\12\00\00\00\02\00\00\00\01\00\00\00\0b\00\00\00\15\00\00\00\0b\00\00\00\19\00\00\00G\00\00\007\00\00\00\07\00\00\00\01\00\00\00A\00\00\00\00\00\00\00\10\00\00\00\03\00\00\00\02\00\00\00\02\00\00\00\02\00\00\00\1c\00\00\00+\00\00\00\1c\00\00\00\04\00\00\00\1c\00\00\00$\00\00\00\07\00\00\00\02\00\00\00\1b\00\00\00\1c\00\00\005\00\00\00\0b\00\00\00\15\00\00\00\0b\00\00\00\12\00\00\00\0e\00\00\00\11\00\00\00o\00\00\00H\00\00\008\00\00\002\00\00\00\0e\00\00\002\00\00\00\0e\00\00\00#\00\00\00]\01\00\00)\00\00\00\07\00\00\00\01\00\00\00O\00\00\00\1c\00\00\00\0b\00\00\00\00\00\00\00\09\00\00\00\15\00\00\00k\00\00\00\14\00\00\00\1c\00\00\00\16\00\00\00\0d\00\00\004\00\00\00L\00\00\00,\00\00\00!\00\00\00\18\00\00\00\1b\00\00\00#\00\00\00\1e\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\09\00\00\00\22\00\00\00\04\00\00\00\00\00\00\00\0d\00\00\00/\00\00\00\0f\00\00\00\03\00\00\00\16\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00$\00\00\00\11\00\00\00\02\00\00\00\18\00\00\00U\00\00\00\06\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\0e\00\00\00\02\00\00\00\09\00\00\00\08\00\00\00.\00\00\00'\00\00\00\07\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\15\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\04\00\00\00\00\00\00\00\13\00\00\00\00\00\00\00\0d\00\00\00\04\00\00\00\9f\00\00\004\00\00\00\13\00\00\00\03\00\00\00\15\00\00\00\02\00\00\00\1f\00\00\00/\00\00\00\15\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\b9\00\00\00.\00\00\00*\00\00\00\03\00\00\00%\00\00\00/\00\00\00\15\00\00\00\00\00\00\00<\00\00\00*\00\00\00\0e\00\00\00\00\00\00\00H\00\00\00\1a\00\00\00\e6\00\00\00+\00\00\00u\00\00\00?\00\00\00 \00\00\00\07\00\00\00\03\00\00\00\00\00\00\00\03\00\00\00\07\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\17\00\00\00\10\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00_\00\00\00\07\00\00\00\03\00\00\00&\00\00\00\11\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\1d\00\00\00\00\00\00\00\0b\00\00\00'\00\00\00\08\00\00\00\00\00\00\00\16\00\00\00\00\00\00\00\0c\00\00\00-\00\00\00\14\00\00\00\00\00\00\00#\00\00\008\00\00\00\08\01\00\00\08\00\00\00\02\00\00\00$\00\00\00\12\00\00\00\00\00\00\002\00\00\00\1d\00\00\00q\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00%\00\00\00\16\00\00\00\00\00\00\00\1a\00\00\00\05\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\1f\00\00\00\0f\00\00\00\00\00\00\00H\01\00\00\12\00\00\00\be\00\00\00\00\00\00\00P\00\00\00\99\03\00\00g\00\00\00n\00\00\00\12\00\00\00\c3\00\00\00\bd\0a\00\00.\04\00\00\d2\0f\00\00F\02\00\00\ba!\00\008\02\00\00\08\00\00\00\1e\00\00\00r\00\00\00\1d\00\00\00\13\00\00\00/\00\00\00\11\00\00\00\03\00\00\00 \00\00\00\14\00\00\00\06\00\00\00\12\00\00\00\b1\02\00\00?\00\00\00\81\00\00\00J\00\00\00\06\00\00\00\00\00\00\00C\00\00\00\0c\00\00\00A\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\1d\00\00\00\f7\17\00\00\09\00\00\00\d5\04\00\00+\00\00\00\08\00\00\00\f8\22\00\00\1e\01\00\002\00\00\00\02\00\00\00\12\00\00\00\03\00\00\00\09\00\00\00\8b\01\00\00\05\09\00\00j\00\00\00\06\00\00\00\0c\00\00\00\04\00\00\00\08\00\00\00\08\00\00\00\09\00\00\00g\17\00\00T\00\00\00\02\00\00\00F\00\00\00\02\00\00\00\01\00\00\00\03\00\00\00\00\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\0b\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00@\00\00\00\02\00\00\00\03\00\00\00\03\00\00\00\07\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\1b\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\04\00\00\00\02\00\00\00\00\00\00\00\04\00\00\00\06\00\00\00\02\00\00\00S\01\00\00\03\00\00\00\18\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\07\00\00\005\09\00\00,\00\00\00\0b\00\00\00\06\00\00\00\11\00\00\00\00\00\00\00r\01\00\00+\00\00\00\15\05\00\00\c4\00\00\00<\00\00\00C\00\00\00\08\00\00\00\00\00\00\00\b5\04\00\00\03\00\00\00\02\00\00\00\1a\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\02\00\00\00\09\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\07\00\00\00\00\00\00\00\05\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\02\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\09\00\00\00\02\00\00\00\10\00\00\00\06\00\00\00\02\00\00\00\02\00\00\00\04\00\00\00\02\00\00\00\10\00\00\00E\11\00\00\dd\a6\00\00#\00\00\004\10\00\00\0c\00\00\00\dd\00\00\00\03\00\00\00\81\16\00\00\0f\00\00\000\1d\00\00 \0c\00\00\1d\02\00\00\e3\05\00\00J\13\00\00\fd\01\00\00\00\00\00\00\e3\00\00\00\00\00\00\00\96\00\00\00\04\00\00\00&\01\00\00\09\00\00\00X\05\00\00\02\00\00\00\02\00\00\00\01\00\00\00\06\00\00\00\03\00\00\00)\00\00\00\02\00\00\00\05\00\00\00\00\00\00\00\a6\00\00\00\01\00\00\00>\02\00\00\03\00\00\00\09\00\00\00\09\00\00\00r\01\00\00\01\00\00\00\9a\00\00\00\0a\00\00\00\b0\00\00\00\02\00\00\006\00\00\00\0e\00\00\00 \00\00\00\09\00\00\00\10\00\00\00\03\00\00\00.\00\00\00\0a\00\00\006\00\00\00\09\00\00\00\07\00\00\00\02\00\00\00%\00\00\00\0d\00\00\00\02\00\00\00\09\00\00\00\06\00\00\00\01\00\00\00-\00\00\00\00\00\00\00\0d\00\00\00\02\00\00\001\00\00\00\0d\00\00\00\09\00\00\00\03\00\00\00\02\00\00\00\0b\00\00\00S\00\00\00\0b\00\00\00\07\00\00\00\00\00\00\00\a1\00\00\00\0b\00\00\00\06\00\00\00\09\00\00\00\07\00\00\00\03\00\00\008\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\02\00\00\00\0a\00\00\00\00\00\00\00\0b\00\00\00\01\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\04\00\00\00\c1\00\00\00\11\00\00\00\0a\00\00\00\09\00\00\00\05\00\00\00\00\00\00\00R\00\00\00\13\00\00\00\0d\00\00\00\09\00\00\00\d6\00\00\00\06\00\00\00\03\00\00\00\08\00\00\00\1c\00\00\00\01\00\00\00S\00\00\00\10\00\00\00\10\00\00\00\09\00\00\00R\00\00\00\0c\00\00\00\09\00\00\00\09\00\00\00T\00\00\00\0e\00\00\00\05\00\00\00\09\00\00\00\f3\00\00\00\0e\00\00\00\a6\00\00\00\09\00\00\00G\00\00\00\05\00\00\00\02\00\00\00\01\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\0d\00\00\00\09\00\00\00x\00\00\00\06\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\00\00\00\00\1d\00\00\00\09\00\00\00)\00\00\00\06\00\00\00\02\00\00\00\03\00\00\00\09\00\00\00\00\00\00\00\0a\00\00\00\0a\00\00\00/\00\00\00\0f\00\00\00\96\01\00\00\07\00\00\00\02\00\00\00\07\00\00\00\11\00\00\00\09\00\00\009\00\00\00\15\00\00\00\02\00\00\00\0d\00\00\00{\00\00\00\05\00\00\00\04\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\00\00\00\00\09\00\00\00\09\00\00\001\00\00\00\04\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\09\00\00\00\09\00\00\00J\01\00\00\03\00\00\00jK\00\00\09\00\00\00\87\00\00\00\04\00\00\00<\00\00\00\06\00\00\00\1a\00\00\00\09\00\00\00\f6\03\00\00\00\00\00\00\02\00\00\006\00\00\00\08\00\00\00\03\00\00\00R\00\00\00\00\00\00\00\0c\00\00\00\01\00\00\00\acL\00\00\01\00\00\00\c7\14\00\00\04\00\00\00\04\00\00\00\05\00\00\00\09\00\00\00\07\00\00\00\03\00\00\00\06\00\00\00\1f\00\00\00\03\00\00\00\95\00\00\00\02\00\00\00\8a\05\00\001\00\00\00\01\02\00\006\00\00\00\05\00\00\001\00\00\00\09\00\00\00\00\00\00\00\0f\00\00\00\00\00\00\00\17\00\00\00\04\00\00\00\02\00\00\00\0e\00\00\00Q\05\00\00\06\00\00\00\02\00\00\00\10\00\00\00\03\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\06\01\00\00\06\00\00\00\0a\00\00\00\09\00\00\00\a3\01\00\00\0d\00\00\00\d7\05\00\00\06\00\00\00n\00\00\00\06\00\00\00\06\00\00\00\09\00\00\00\97\12\00\00\09\00\00\00\07\05\0c\00\ef\00\00\00d\00e\00f\00a\00u\00l\00t") diff --git a/src/lexer.c b/src/lexer.c index 0a14224..2a104f1 100755 --- a/src/lexer.c +++ b/src/lexer.c @@ -6,7 +6,10 @@ const uint16_t __empty_char = '\0'; const uint16_t* EMPTY_CHAR = &__empty_char; // tracked depth of template and brackets #define STACK_DEPTH 2048 -enum TokenType { ClassToken = 1, ExportObjectToken = 2, WebpackTableToken = 4 }; +enum TokenType { + ClassToken = 1, ExportObjectToken = 2, WebpackTableToken = 4, + WebpackArrayKeyToken = 8, WebpackArrayBindingToken = 16, WebpackArrayValueToken = 32 +}; const uint16_t* source; bool lastSlashWasDivision; @@ -43,6 +46,7 @@ typedef struct WebpackModule { uint8_t visited; uint8_t requested; bool queued; + bool uncertain; Slice* exports; Slice* exportsTail; Slice* reexports; @@ -58,6 +62,8 @@ typedef struct WebpackModule { static uint16_t* webpackTablePos; static uint16_t* webpackFactoryPos; +static uint16_t* webpackTrustedEnd; +static uint16_t* webpackArrayPos; static const uint16_t* webpackEntryStart; static const uint16_t* webpackEntryEnd; static WebpackModule* webpackModules; @@ -96,6 +102,7 @@ void (*clearReexports)(); static bool isStatementBrace (uint16_t* curPos, uint16_t depth); static uint16_t readExportExpressionStart (); static bool readWebpackToken (uint16_t ch); +static void readWebpackArrayElement (uint8_t token); static void readWebpackFactory (); static void finishWebpack (); static void captureWebpackExport (const uint16_t* start, const uint16_t* end); @@ -271,9 +278,12 @@ static bool readWebpackCall (const uint16_t** start, const uint16_t** finish) { uint16_t ch = commentWhitespace(); if ((ch == '\'' || ch == '"' || ch >= '0' && ch <= '9') && readWebpackId(start, finish) && commentWhitespace() == ')') { - pos++; + uint16_t* callEnd = pos++; ch = commentWhitespace(); - if (pos > end || ch == ';' || ch == ',' || ch == ')' || ch == '}') return true; + if (pos > end || ch == ';' || ch == ',' || ch == ')' || ch == '}') { + pos = callEnd; + return true; + } } } } @@ -292,19 +302,25 @@ static bool matchesWebpackBinding (const uint16_t* binding, uint32_t length) { memcmp(pos, binding, length * sizeof(uint16_t)) == 0 && !isIdentifierChar(webpackCharAt(pos + length)); } +static void trustWebpackExports (uint16_t* finish) { + if (webpackCurrent && finish > webpackTrustedEnd) webpackTrustedEnd = finish; +} + static bool readWebpackToken (uint16_t ch) { + uint16_t* start = pos; if (webpackCurrent) { if (matchesWebpackBinding(webpackCurrent->target, webpackCurrent->targetLength)) { - tryParseExportsDotAssign(false, webpackCurrent->targetLength); + if (!tryParseExportsDotAssign(false, webpackCurrent->targetLength) && start >= webpackTrustedEnd) + webpackCurrent->uncertain = true; return true; } if (matchesWebpackBinding(webpackCurrent->module, webpackCurrent->moduleLength)) { - tryParseModuleExportsDotAssign(webpackCurrent->moduleLength); + if (!tryParseModuleExportsDotAssign(webpackCurrent->moduleLength) && start >= webpackTrustedEnd) + webpackCurrent->uncertain = true; return true; } } if (ch != '_') return false; - uint16_t* start = pos; if (str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'm', 'o', 'd', 'u', 'l', 'e', 's', '_', '_') && !isIdentifierChar(webpackCharAt(pos + 19))) { pos += 19; @@ -349,13 +365,27 @@ static bool readWebpackToken (uint16_t ch) { pos = start + 19; if (commentWhitespace() == '.') { pos++; - if (commentWhitespace() == 'd') { + uint16_t method = commentWhitespace(); + if (method == 'd' || method == 'r') { pos++; if (commentWhitespace() == '(') { pos++; - if (readExportsOrModuleDotExports(commentWhitespace()) && commentWhitespace() == ',') { - pos++; - if (commentWhitespace() == '{') exportObjectPos = pos; + if (readExportsOrModuleDotExports(commentWhitespace())) { + uint16_t* argEnd = pos; + uint16_t next = commentWhitespace(); + if (method == 'r' && next == ')') trustWebpackExports(argEnd); + if (method == 'd' && next == ',') { + pos++; + uint16_t definition = commentWhitespace(); + if (definition == '{') { + exportObjectPos = pos; + trustWebpackExports(argEnd); + } + else if (definition == '[') { + webpackArrayPos = pos; + trustWebpackExports(argEnd); + } + } } } } @@ -364,15 +394,44 @@ static bool readWebpackToken (uint16_t ch) { return false; } +static void readWebpackArrayElement (uint8_t token) { + uint16_t* start = pos++; + uint16_t ch = commentWhitespace(); + uint8_t next = WebpackArrayKeyToken; + if (token == WebpackArrayKeyToken) { + next = 0; + if (ch == '"' || ch == '\'') { + uint16_t* name = pos; + stringLiteral(ch); + uint16_t* nameEnd = ++pos; + if (commentWhitespace() == ',') { + addExport(name, nameEnd); + next = WebpackArrayBindingToken; + } + } + if (!next && ch != ']') { + if (webpackCurrent) webpackCurrent->uncertain = true; + else if (webpackInline) webpackInvalid = true; + } + } + else if (token == WebpackArrayBindingToken && ch == '0') { + pos++; + if (commentWhitespace() == ',') next = WebpackArrayValueToken; + } + openTokenTypeStack[openTokenDepth - 1] = next; + if (!error) pos = start; +} + static void readWebpackFactory () { uint16_t* revert = pos; const uint16_t *id, *idEnd, *module = NULL, *moduleEnd = NULL, *target = NULL, *targetEnd = NULL, *ignored, *ignoredEnd; pos++; bool found = readWebpackId(&id, &idEnd); - if (found && commentWhitespace() == ':') { - pos++; + uint16_t separator = commentWhitespace(); + if (found && (separator == ':' || separator == '(')) { + if (separator == ':') pos++; uint16_t ch = commentWhitespace(); - if (ch == '(') { + if (separator == ':' && ch == '(') { uint16_t* opening = pos++; ch = commentWhitespace(); if (ch != '(' && !(ch == 'f' && str_eq7(pos + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n'))) { pos = opening; ch = '('; } @@ -392,7 +451,9 @@ static void readWebpackFactory () { if (ch == ')') { pos++; ch = commentWhitespace(); - if (!fn && ch == '=' && *(pos + 1) == '>') { pos += 2; ch = commentWhitespace(); } + bool arrow = !fn && separator == ':'; + if (arrow && ch == '=' && *(pos + 1) == '>') { pos += 2; ch = commentWhitespace(); } + else if (arrow) ch = 0; if (ch == '{') { webpackFactoryPos = pos; webpackPending = createWebpackModule(id, idEnd); @@ -420,6 +481,7 @@ static void finishWebpack () { } while (first && !webpackInvalid) { WebpackModule* module = first; + if (module->uncertain) { webpackInvalid = true; break; } first = first->queueNext; if (!first) last = NULL; module->queued = false; @@ -511,6 +573,8 @@ static __attribute__((always_inline)) uint32_t parseCJSMode (uint16_t* _source, openTokenPosStack = &openTokenPosStack_[0]; firstStarExport = NULL; lastStarExport = NULL; + StarExportBinding* outerFirstStarExport = NULL; + StarExportBinding* outerLastStarExport = NULL; nextBraceIsClass = false; exportObjectPos = 0; webpackTablePos = NULL; @@ -522,6 +586,8 @@ static __attribute__((always_inline)) uint32_t parseCJSMode (uint16_t* _source, webpackCapacity = webpackCount = 0; webpackPublished = webpackInvalid = webpackInline = false; webpackInlineRoot = (WebpackModule){0}; + webpackTrustedEnd = _source; + webpackArrayPos = NULL; webpackAddExport = addExport; webpackAddReexport = addReexport; } @@ -548,7 +614,7 @@ static __attribute__((always_inline)) uint32_t parseCJSMode (uint16_t* _source, if (ch == 32 || ch < 14 && ch > 8) continue; - if (extendedMode && keywordStart(pos) && readWebpackToken(ch)) + if (extendedMode && (ch == '_' || webpackCurrent) && keywordStart(pos) && readWebpackToken(ch)) goto skipTokenRun; if (openTokenDepth == 0 || extendedMode && webpackCurrent && webpackCurrent->depth == openTokenDepth) { @@ -619,8 +685,14 @@ static __attribute__((always_inline)) uint32_t parseCJSMode (uint16_t* _source, return error; break; case '[': - if (extendedMode && !pushOpenToken(lastTokenPos)) - return error; + if (extendedMode) { + if (!pushOpenToken(lastTokenPos)) + return error; + if (pos == webpackArrayPos) { + webpackArrayPos = NULL; + readWebpackArrayElement(WebpackArrayKeyToken); + } + } break; case ']': if (extendedMode) { @@ -630,10 +702,12 @@ static __attribute__((always_inline)) uint32_t parseCJSMode (uint16_t* _source, } break; case ',': - if (extendedMode && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & WebpackTableToken)) - readWebpackFactory(); - if (extendedMode && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & ExportObjectToken)) - readExportProperty(); + if (extendedMode && openTokenDepth) { + uint8_t token = openTokenTypeStack[openTokenDepth - 1]; + if (token & WebpackTableToken) readWebpackFactory(); + if (token & ExportObjectToken) readExportProperty(); + if (token >= WebpackArrayKeyToken) readWebpackArrayElement(token); + } break; case ')': if (openTokenDepth == 0) @@ -657,6 +731,8 @@ static __attribute__((always_inline)) uint32_t parseCJSMode (uint16_t* _source, else if (extendedMode && pos == webpackFactoryPos) { webpackCurrent = webpackPending; webpackCurrent->depth = openTokenDepth; + outerFirstStarExport = firstStarExport; + outerLastStarExport = lastStarExport; firstStarExport = lastStarExport = NULL; addExport = captureWebpackExport; addReexport = captureWebpackReexport; @@ -667,7 +743,8 @@ static __attribute__((always_inline)) uint32_t parseCJSMode (uint16_t* _source, return syntaxError(2), error; if (extendedMode && webpackCurrent && webpackCurrent->depth == openTokenDepth) { webpackCurrent = NULL; - firstStarExport = lastStarExport = NULL; + firstStarExport = outerFirstStarExport; + lastStarExport = outerLastStarExport; addExport = webpackAddExport; addReexport = webpackAddReexport; } @@ -1366,6 +1443,8 @@ void tryParseObjectDefineOrKeys (bool keys) { 0 == memcmp(id_start, binding->id_start, id_len * sizeof(uint16_t))) { bool internal = false; if (extended) { + trustWebpackExports(pos); + trustWebpackExports(pos); WebpackModule* owner = webpackCurrent ? webpackCurrent : &webpackInlineRoot; for (Slice* slice = owner->imports; slice; slice = slice->next) if (slice->start == binding->specifier_start) { internal = true; break; } @@ -1418,7 +1497,7 @@ bool readExportsOrModuleDotExports (uint16_t ch) { } } -void tryParseModuleExportsDotAssign (uint32_t length) { +bool tryParseModuleExportsDotAssign (uint32_t length) { pos += length; uint16_t* revertPos = pos - 1; uint16_t ch = commentWhitespace(); @@ -1426,14 +1505,14 @@ void tryParseModuleExportsDotAssign (uint32_t length) { pos++; ch = commentWhitespace(); if (ch == 'e' && str_eq6(pos + 1, 'x', 'p', 'o', 'r', 't', 's')) { - tryParseExportsDotAssign(true, 7); - return; + return tryParseExportsDotAssign(true, 7); } } pos = revertPos; + return false; } -void tryParseExportsDotAssign (bool assign, uint32_t length) { +bool tryParseExportsDotAssign (bool assign, uint32_t length) { pos += length; uint16_t* revertPos = pos - 1; uint16_t ch = commentWhitespace(); @@ -1448,7 +1527,7 @@ void tryParseExportsDotAssign (bool assign, uint32_t length) { ch = commentWhitespace(); if (ch == '=') { addExport(startPos, endPos); - return; + return true; } } break; @@ -1467,6 +1546,8 @@ void tryParseExportsDotAssign (bool assign, uint32_t length) { ch = commentWhitespace(); if (ch != '=') break; addExport(startPos, endPos); + pos = revertPos; + return true; } break; } @@ -1477,10 +1558,12 @@ void tryParseExportsDotAssign (bool assign, uint32_t length) { pos++; ch = commentWhitespace(); if (extended) { + bool recognized = false; if (ch == '_') { uint16_t* start = pos; const uint16_t *id, *idEnd; if (webpackTablePos && readWebpackCall(&id, &idEnd)) { + recognized = true; if (webpackCurrent) addWebpackDependency(id, idEnd, false); else { webpackEntryStart = id; webpackEntryEnd = idEnd; webpackPublished = true; } } @@ -1495,15 +1578,18 @@ void tryParseExportsDotAssign (bool assign, uint32_t length) { } } if (ch == '(') ch = readExportExpressionStart(); - if (ch == '{') exportObjectPos = pos; - else if (ch == 'r') tryParseRequire(ExportAssign); + if (ch == '{') { + exportObjectPos = pos; + recognized = true; + } + else if (ch == 'r') recognized = tryParseRequire(ExportAssign); pos = revertPos; - return; + return recognized; } // { ... } if (ch == '{') { tryParseLiteralExports(); - return; + return true; } // require('...') @@ -1513,6 +1599,7 @@ void tryParseExportsDotAssign (bool assign, uint32_t length) { } } pos = revertPos; + return false; } bool tryParseRequire (enum RequireType requireType) { @@ -1597,18 +1684,25 @@ void readExportDefinition () { pos++; ch = commentWhitespace(); if (!readExportsOrModuleDotExports(ch)) return; + uint16_t* argEnd = pos; if (commentWhitespace() != ',') return; pos++; ch = commentWhitespace(); if (properties) { if (ch == '(') ch = readExportExpressionStart(); - if (ch == '{') exportObjectPos = pos; + if (ch == '{') { + exportObjectPos = pos; + trustWebpackExports(argEnd); + } } else if (ch == '\'' || ch == '"') { uint16_t* nameStart = pos; stringLiteral(ch); uint16_t* nameEnd = ++pos; - if (commentWhitespace() == ',') addExport(nameStart, nameEnd); + if (commentWhitespace() == ',') { + addExport(nameStart, nameEnd); + trustWebpackExports(argEnd); + } } } @@ -1616,10 +1710,12 @@ void readExportProperty () { uint16_t* revertPos = pos; pos++; uint16_t ch = commentWhitespace(); + uint16_t propertyStart = ch; if (ch == '.' && end - pos >= 2 && str_eq2(pos + 1, '.', '.')) { pos += 3; ch = commentWhitespace(); - if (ch == 'r') tryParseRequire(ExportAssign); + if (!(ch == 'r' && tryParseRequire(ExportAssign)) && webpackCurrent) + webpackCurrent->uncertain = true; pos = revertPos; return; } @@ -1672,6 +1768,8 @@ void readExportProperty () { } if (nameEnd && (ch == ':' || ch == '(' || !computed && (ch == ',' || ch == '}'))) addExport(nameStart, nameEnd); + else if (propertyStart != '}' && webpackCurrent) + webpackCurrent->uncertain = true; pos = revertPos; } diff --git a/test/fixtures/webpack/README.md b/test/fixtures/webpack/README.md new file mode 100644 index 0000000..9301de7 --- /dev/null +++ b/test/fixtures/webpack/README.md @@ -0,0 +1,33 @@ +# Webpack 5.112.0 fixtures + +Both bundles use `target: 'node'`, `devtool: false`, `library.type: 'commonjs2'`, +and `optimization: { minimize: false, concatenateModules: false, usedExports: false }`. +Trailing horizontal whitespace is removed from the output. + +`webpack-5.112-harmony.cjs` uses production mode with these inputs: + +```js +// entry.mjs +export { depA as visible } from "./dep.mjs"; +export const own = 1; + +// dep.mjs +export const depA = globalThis.fixtureValue ?? 42; +export const internal = 43; +``` + +`webpack-5.112-ts-star.cjs` uses development mode with `ts-entry.js` as its entry. +Run `tsc --module commonjs --target es2018 ts-entry.ts ts-dep.ts unused.ts` with TypeScript 5.9.3 first. + +```ts +// ts-entry.ts +import "./unused"; +export * from "./ts-dep"; +export const own = 1; + +// ts-dep.ts +export const depA = 42; + +// unused.ts +export const hidden = 1; +``` diff --git a/test/fixtures/webpack/webpack-5.112-harmony.cjs b/test/fixtures/webpack/webpack-5.112-harmony.cjs new file mode 100644 index 0000000..1088b40 --- /dev/null +++ b/test/fixtures/webpack/webpack-5.112-harmony.cjs @@ -0,0 +1,93 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 684 +(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +const depA = globalThis.fixtureValue ?? 42; +const internal = 43; + +/* harmony export */ __webpack_require__.d(__webpack_exports__, [ +/* harmony export */ "depA", 0, /* binding */ depA, +/* harmony export */ "internal", 0, /* binding */ internal +/* harmony export */ ]); + + +/***/ } + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ const __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ const cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ const module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ // define getter/value functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ if(Array.isArray(definition)) { +/******/ var i = 0; +/******/ while(i < definition.length) { +/******/ var key = definition[i++]; +/******/ var binding = definition[i++]; +/******/ var descriptor = binding === 0 ? { enumerable: true, value: definition[i++] } : { enumerable: true, get: binding }; +/******/ if(!__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, descriptor); +/******/ } +/******/ } else { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ } +/******/ }; +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/************************************************************************/ +let __webpack_exports__ = {}; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ visible: () => (/* reexport safe */ _dep_mjs__WEBPACK_IMPORTED_MODULE_0__.depA) +/* harmony export */ }); +/* harmony import */ var _dep_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(684); + +const own = 1; + +/* harmony export */ __webpack_require__.d(__webpack_exports__, [ +/* harmony export */ "own", 0, /* binding */ own +/* harmony export */ ]); + +module.exports = __webpack_exports__; +/******/ })() +; \ No newline at end of file diff --git a/test/fixtures/webpack/webpack-5.112-ts-star.cjs b/test/fixtures/webpack/webpack-5.112-ts-star.cjs new file mode 100644 index 0000000..e652b44 --- /dev/null +++ b/test/fixtures/webpack/webpack-5.112-ts-star.cjs @@ -0,0 +1,127 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./ts-dep.ts" +/*!*******************!*\ + !*** ./ts-dep.ts ***! + \*******************/ +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ depA: () => (/* binding */ depA) +/* harmony export */ }); +const depA = 42; + + +/***/ }, + +/***/ "./ts-entry.js" +/*!*********************!*\ + !*** ./ts-entry.js ***! + \*********************/ +(__unused_webpack_module, exports, __webpack_require__) { + + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.own = void 0; +__webpack_require__(/*! ./unused */ "./unused.ts"); +__exportStar(__webpack_require__(/*! ./ts-dep */ "./ts-dep.ts"), exports); +exports.own = 1; + + +/***/ }, + +/***/ "./unused.ts" +/*!*******************!*\ + !*** ./unused.ts ***! + \*******************/ +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ hidden: () => (/* binding */ hidden) +/* harmony export */ }); +const hidden = 1; + + +/***/ } + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ const __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ const cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ const module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ if (!(moduleId in __webpack_modules__)) { +/******/ delete __webpack_module_cache__[moduleId]; +/******/ const e = new Error("Cannot find module '" + moduleId + "'"); +/******/ e.code = 'MODULE_NOT_FOUND'; +/******/ throw e; +/******/ } +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ // define getter/value functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ let __webpack_exports__ = __webpack_require__("./ts-entry.js"); +/******/ module.exports = __webpack_exports__; +/******/ +/******/ })() +; \ No newline at end of file diff --git a/test/webpack.js b/test/webpack.js index 9027115..38953e2 100644 --- a/test/webpack.js +++ b/test/webpack.js @@ -72,6 +72,7 @@ suite('Webpack extended detection', () => { }); const factories = [ + '"entry"(m, e) { e.visible = 1; }', 'entry: (module, exports) => { exports.visible = 1; }', 'entry: function(module, exports) { exports.visible = 1; }', 'entry: (m, e) => { e.visible = 1; }', @@ -99,6 +100,74 @@ suite('Webpack extended detection', () => { assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible', 'quoted'], reexports: [] }); }); + test('Webpack 5.112 harmony reexports exclude internal factory exports', () => { + const source = readFileSync(join(__dirname, 'fixtures/webpack/webpack-5.112-harmony.cjs'), 'utf8'); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports.sort(), + Object.getOwnPropertyNames(module.exports).sort()); + }); + + test('Webpack 5.112 TypeScript export star retains candidates', () => { + const source = readFileSync(join(__dirname, 'fixtures/webpack/webpack-5.112-ts-star.cjs'), 'utf8'); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports.sort(), + [...Object.getOwnPropertyNames(module.exports), 'hidden'].sort()); + }); + + test('Webpack getter arrays distinguish keys, getters, and values', () => { + const source = bundle(` + unused: (m, e) => { e.hidden = 1; }, + entry: (m, e) => { + __webpack_require__.d(e, []); + __webpack_require__.d(e, ["visible", 0, "notAKey", "getter", () => ({ nested: [1, 2] }),]); + e.tail = 2; + } + `); + assert.deepEqual(parse(source, 'bundle.cjs', options), + { exports: ['visible', 'getter', 'tail'], reexports: [] }); + }); + + test('a factory without an exports parameter does not use the startup getter binding', () => { + const source = bundle(`entry: (m) => { + __webpack_require__.d(__webpack_exports__, { hidden: () => 1 }); + m.exports.visible = 1; + }`); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible'], reexports: [] }); + }); + + for (const body of [ + `__exportStar(__webpack_require__("dependency"), exports);`, + `Object.assign(exports, __webpack_require__("dependency"));`, + `const dep = __webpack_require__("dependency"); for (const key in dep) exports[key] = dep[key];`, + `module.exports = { ...__webpack_require__("dependency") };`, + `module.exports = wrap(__webpack_require__("dependency"));`, + `Object.defineProperty(exports, computed, { value: 1 });`, + `Object.assign(module["exports"], __webpack_require__("dependency"));`, + `__webpack_require__.d(exports, [computed, () => 1]);`, + ]) { + test(`retains candidates for an unrecognized export use: ${body}`, () => { + const source = bundle(` + unused: (module, exports) => { exports.hidden = 1; }, + dependency: (module, exports) => { exports.depA = 1; }, + entry: (module, exports) => { exports.own = 1; ${body} } + `); + assert.deepEqual(parse(source, 'bundle.cjs', options).exports.sort(), ['depA', 'hidden', 'own']); + }); + } + + test('unrecognized uses only affect projection when reachable', () => { + const factories = ` + unused: (m, e) => { e.hidden = 1; Object.assign(e, __webpack_require__("leaf")); }, + leaf: (m, e) => { e.visible = 1; } + `; + const direct = bundle(`${factories}, entry: (m, e) => { m.exports = __webpack_require__("leaf"); }`); + const indirect = bundle(`${factories}, entry: (m, e) => { m.exports = __webpack_require__("unused"); }`); + assert.deepEqual(parse(direct, 'bundle.cjs', options).exports, ['visible']); + assert.deepEqual(parse(indirect, 'bundle.cjs', options).exports.sort(), ['hidden', 'visible']); + }); + test('descriptors can target the module parameter', () => { const source = bundle(`entry: (m, e) => { Object.defineProperties(m.exports, { visible: { value: 1 } }); @@ -158,6 +227,15 @@ suite('Webpack extended detection', () => { assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['default', 'visible'], reexports: [] }); }); + test('an internal reexport without a semicolon does not consume the factory brace', () => { + const source = bundle(` + entry(module) { module.exports = __webpack_require__("dependency") }, + dependency(module, exports) { exports.visible = 1 }, + unused(module, exports) { exports.hidden = 1 } + `); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['visible'], reexports: [] }); + }); + test('internal star reexports exclude default and __esModule', () => { const source = bundle(` unused: (m, exports) => { exports.hidden = 1; }, @@ -198,6 +276,20 @@ suite('Webpack extended detection', () => { assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: [], reexports: ['visible'] }); }); + test('a factory does not replace the surrounding star reexport bindings', () => { + const bundled = bundle(` + dependency: (module, exports) => { exports.internal = 1; }, + entry: (module, exports) => { ${star('dependency')} } + `); + const source = `var dep = require("external"); + ${bundled} + Object.keys(dep).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + exports[key] = dep[key]; + });`; + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: ['internal'], reexports: ['external'] }); + }); + test('numeric module identifiers', () => { const source = bundle(` 0: (m, e) => { e.hidden = 1; }, From b98279e2e3ae78c79dcc218247150c47dc7f3db9 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 19 Nov 2026 20:10:11 +0100 Subject: [PATCH 3/5] perf(lexer): narrow Webpack token matching Most tokens inside a factory cannot refer to either factory parameter. Check the first character before matching the entire identifier. On Node 22.23.4 (V8 12.4, macOS arm64), parsing three Webpack fixtures went from 625.36 ms to 495.60 ms in JS (4,500 passes) and from 518.14 ms to 407.71 ms in Wasm (9,000 passes). These are trimmed means of seven interleaved trials. A recognized star loop without a known binding could hide the write that would trigger fallback. Keep all candidates when the binding is unknown. Use the latest recorded binding in both Webpack backends. --- lexer.js | 8 +- lib/lexer.wasm | Bin 41116 -> 41270 bytes lib/lexer.wat | 7204 ++++++++++++++++++++++++----------------------- src/lexer.c | 48 +- test/webpack.js | 31 + 5 files changed, 3709 insertions(+), 3582 deletions(-) diff --git a/lexer.js b/lexer.js index cce7f05..d75d4ea 100755 --- a/lexer.js +++ b/lexer.js @@ -129,6 +129,7 @@ function parseSource (cjsSource) { pos = -1; end = source.length - 1; let ch = 0; + let targetFirst = -1, moduleFirst = -1; // Handle #! if (source.charCodeAt(0) === 35/*#*/ && source.charCodeAt(1) === 33/*!*/) { @@ -148,7 +149,7 @@ function parseSource (cjsSource) { if (ch === 32 || ch < 14 && ch > 8) continue; - if (extendedMode && (ch === 95 || webpack?.current) && keywordStart(pos) && readWebpackToken(ch)) { + if (extendedMode && (ch === 95 || ch === targetFirst || ch === moduleFirst) && keywordStart(pos) && readWebpackToken(ch)) { skipTokenRun(); lastTokenPos = pos; continue; @@ -272,6 +273,8 @@ function parseSource (cjsSource) { } else if (extendedMode && pos === webpack?.factoryPos) { webpack.current = webpack.pending; + targetFirst = webpack.current.target?.charCodeAt(0) ?? -1; + moduleFirst = webpack.current.module?.charCodeAt(0) ?? -1; webpack.current.depth = openTokenDepth; _exports = webpack.current.exports ??= new Set(); reexports = webpack.current.reexports ??= new Set(); @@ -283,6 +286,7 @@ function parseSource (cjsSource) { throw new Error('Unexpected closing brace.'); if (extendedMode && webpack?.current?.depth === openTokenDepth) { webpack.current = undefined; + targetFirst = moduleFirst = -1; _exports = webpack.exports; reexports = webpack.reexports; starExportMap = webpack.starExportMap; @@ -1225,6 +1229,8 @@ function tryParseObjectDefineOrKeys (keys) { pos = revertPos; return; } + if (webpack?.current) webpack.current.uncertain = true; + else if (webpack?.inline) webpack.invalid = true; return; } } diff --git a/lib/lexer.wasm b/lib/lexer.wasm index 81f58ecf1e28a3451665d5c1e46215ab7a71cfd5..be868bfb7ac8214bd1053eb591a6a4e42688eba7 100755 GIT binary patch delta 4535 zcmb_fYiwM_6`q-U_u;+wu5awMy=$+%bH}k`BZ3K~4TOh1X?Klr5{FRn11j3IJcO4D zISNWk5NjS%BNEz>>5qtps`O7=N~>0j5dG2e=#N&Es;H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|C|@Ik;~w`f2G#I6%L(aVJ~A^9XKBDM>wH5eULsh{V!dpC72f$kyV37_28)ZWWx)rR)pCDBc4 zbOyS-Tvb7#gpTv^!iHVT9p`k+k9=U;sp}l9qLeT1?F#>GPujE`KJ}hdWurZ6SI3KN zp}NpR|cnTi?Tv znQedO7@pX^)5P#<@eMlho1hvj`-JPa?akiw~?PNFY1aAQ6;529et; z?Vb&WFahK3B&43KzFa;GxoYcJ2mk4?+CA2(rp8wF@sW@-Fo9y7CdTmUKysOo?28Z` zSTa#YQF(LhM=3PL2_Fw7#1p4krjG7tQC-7LDX$q_VC_f~uZ-2oA5N>^@5rs?R1>r= z$<0Z1cl-u?b>qR8 zn01H>RZ)HAvuSnq;pgHwRA?Ss?cUj5{ro2)9y?Th@^e4oD)varlw1@(GtsXLDzyRL zPNG2=cm&ZW7BDiOaur^C!txB4X)I6I9x(7)_}D`cuGt;b9}wf1p~nFyO_6?QeZlep zlfy`gCUPMiXZrLeFl7vL!qhW#E=oSOfQTS}jt{O=pWfreASWUygFUsUXFD-z2609dEJ(~f8)sM~FOHVI6s&ad`Aqzdacb<^AtzsfN zsvn&=PC+vF#BOZZ^yClly|Di~)o<+ENdUdDe|;Q7>Pu||tNWh$R8p5;_+i=`rE0H^ vJhQEH(Z{`p2n~xdejTWUl^dz 8) continue; - if (extendedMode && (ch == '_' || webpackCurrent) && keywordStart(pos) && readWebpackToken(ch)) + if (extendedMode && (ch == '_' || webpackCurrent && + (webpackCurrent->target && *webpackCurrent->target == ch || + webpackCurrent->module && *webpackCurrent->module == ch)) && keywordStart(pos) && readWebpackToken(ch)) goto skipTokenRun; if (openTokenDepth == 0 || extendedMode && webpackCurrent && webpackCurrent->depth == openTokenDepth) { @@ -1437,26 +1439,32 @@ void tryParseObjectDefineOrKeys (bool keys) { // this is done last because it is a linear search through all require bindings // and by doing this search last after verifying the structure match, // we don't have to worry about the slow search algorithm - StarExportBinding* binding = firstStarExport; - while (binding) { - if (id_len == binding->id_end - binding->id_start && - 0 == memcmp(id_start, binding->id_start, id_len * sizeof(uint16_t))) { - bool internal = false; - if (extended) { - trustWebpackExports(pos); - trustWebpackExports(pos); - WebpackModule* owner = webpackCurrent ? webpackCurrent : &webpackInlineRoot; - for (Slice* slice = owner->imports; slice; slice = slice->next) - if (slice->start == binding->specifier_start) { internal = true; break; } - } - if (internal) - addWebpackDependency(binding->specifier_start, binding->specifier_end, true); - else - addReexport(binding->specifier_start, binding->specifier_end); - pos = revertPos; - return; + bool projectingWebpack = extended && (webpackCurrent || webpackInline); + StarExportBinding* binding = NULL; + for (StarExportBinding* candidate = firstStarExport; candidate; candidate = candidate->next) { + if (id_len == candidate->id_end - candidate->id_start && + 0 == memcmp(id_start, candidate->id_start, id_len * sizeof(uint16_t))) { + binding = candidate; + if (!projectingWebpack) break; + } + } + if (binding) { + bool internal = false; + if (projectingWebpack) { + trustWebpackExports(pos); + WebpackModule* owner = webpackCurrent ? webpackCurrent : &webpackInlineRoot; + for (Slice* slice = owner->imports; slice; slice = slice->next) + if (slice->start == binding->specifier_start) { internal = true; break; } } - binding = binding->next; + if (internal) + addWebpackDependency(binding->specifier_start, binding->specifier_end, true); + else + addReexport(binding->specifier_start, binding->specifier_end); + pos = revertPos; + } + else if (projectingWebpack) { + if (webpackCurrent) webpackCurrent->uncertain = true; + else webpackInvalid = true; } return; } diff --git a/test/webpack.js b/test/webpack.js index 38953e2..f6787ce 100644 --- a/test/webpack.js +++ b/test/webpack.js @@ -76,6 +76,12 @@ suite('Webpack extended detection', () => { 'entry: (module, exports) => { exports.visible = 1; }', 'entry: function(module, exports) { exports.visible = 1; }', 'entry: (m, e) => { e.visible = 1; }', + `entry: (record, output) => { + const outputOther = {}; + outputOther.hidden = 1; + record.exports.visible = 1; + output.alsoVisible = 1; + }`, 'entry: (m) => { m.exports = { visible: 1 }; }', 'entry: () => {}' ]; @@ -249,6 +255,31 @@ suite('Webpack extended detection', () => { assert.deepEqual(parse(source, 'bundle.cjs', options).exports, Object.keys(module.exports)); }); + const starBindings = [ + ['missing semicolon', 'const dep = __webpack_require__("dependency")', ['old', 'visible']], + ['wrapped require', 'const dep = identity(__webpack_require__("dependency"));', ['old', 'visible']], + ['redeclared variable', 'var dep = __webpack_require__("old"); var dep = __webpack_require__("dependency");', ['visible']] + ]; + for (const [binding, declaration, expected] of starBindings) { + for (const inline of [false, true]) { + test(`${inline ? 'inlined' : 'factory'} entry star reexport with ${binding}`, () => { + const factories = ` + old: (module, exports) => { exports.old = 1; }, + dependency: (module, exports) => { exports.visible = 2; } + `; + const body = `const identity = value => value; ${star('dependency').replace(/^.+/, declaration)}`; + const source = inline ? bundle(factories).replace("const __webpack_exports__ = __webpack_require__('entry');", ` + const __webpack_exports__ = {}; + (() => { var exports = __webpack_exports__; ${body} })();`) : + bundle(`${factories}, entry: (module, exports) => { ${body} }`); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + assert.deepEqual(Object.keys(module.exports), ['visible']); + assert.deepEqual(parse(source, 'bundle.cjs', options), { exports: expected, reexports: [] }); + }); + } + } + test('star reexports terminate on cycles', () => { const source = bundle(` dependency: (m, exports) => { exports.second = 2; ${star('entry')} }, From 538a1380a95061b6ea1edef40a59cf9129edcbd5 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 23 Nov 2026 15:09:10 +0100 Subject: [PATCH 4/5] fix(lexer): retain candidates for uncertain Webpack exports A direct factory call or a dynamic getter map can add names without a recognized write to the startup exports binding. Retain factory candidates instead of returning an incomplete export list. A direct assignment can also make a recorded star reexport uncertain. A closed call identifies the write without proving a new binding. Signed-off-by: Ruben Bridgewater --- README.md | 7 +- lexer.js | 163 +- lib/lexer.wasm | Bin 41270 -> 42981 bytes lib/lexer.wat | 8713 +++++++++-------- src/lexer.c | 223 +- test/fixtures/webpack/README.md | 32 +- .../webpack/webpack-5.112-dynamic-star.cjs | 115 + .../webpack/webpack-5.112-ts-direct.cjs | 29 + test/webpack.js | 52 +- 9 files changed, 5226 insertions(+), 4108 deletions(-) create mode 100644 test/fixtures/webpack/webpack-5.112-dynamic-star.cjs create mode 100644 test/fixtures/webpack/webpack-5.112-ts-direct.cjs diff --git a/README.md b/README.md index 47c4247..7e14fa2 100755 --- a/README.md +++ b/README.md @@ -115,14 +115,15 @@ Object spreads of `require('literal')` contribute reexports, but named propertie Extended mode recognizes Webpack assignments through `__webpack_exports__` and object or array getter maps in `__webpack_require__.d`. For object-shaped `__webpack_modules__` tables, a literal startup module ID selects the entry factory. Detection follows internal whole-module reexports and supported star reexports, which exclude `default` and `__esModule`. -An inlined entry can instead initialize `__webpack_exports__` with an object literal. +An inlined entry can instead initialize `__webpack_exports__` with an empty object literal. Unrelated factories do not contribute names when the bundle publishes the recognized entry. Detection retains candidates from all factories if it cannot recognize the startup expression or resolve an internal reexport. -It also retains those candidates if it encounters an unsupported use of the exports or module parameter in a reachable factory. +An unsupported use of the startup exports binding also causes detection to retain candidates from all factories. +The same rule applies to the exports and module parameters of reachable factories. The result contains syntactic candidates, which can include non-enumerable properties, throwing getters, and unreachable assignments. Extended mode does not apply the default getter side-effect veto. -It recognizes Webpack factory parameters but does not generally resolve bindings or aliases. +It recognizes Webpack factory parameters and the inlined `exports` alias but does not generally resolve bindings or aliases. It does not evaluate computed names or determine runtime control flow. Names created by dynamic expressions can therefore remain undetected, and shadowed identifiers can produce false positives. diff --git a/lexer.js b/lexer.js index d75d4ea..c34ed75 100755 --- a/lexer.js +++ b/lexer.js @@ -47,6 +47,10 @@ const Import = 0; const ExportAssign = 1; const ExportStar = 2; +const RequireBinding = 0; +const WebpackImport = 1; +const WebpackImportPrefix = 2; + /** @param {number} tokenPos */ function pushOpenToken (tokenPos) { if (openTokenDepth === STACK_DEPTH) @@ -203,8 +207,14 @@ function parseSource (cjsSource) { switch (ch) { case 101/*e*/: if (source.startsWith('xport', pos + 1) && keywordStart(pos)) { - if (source.charCodeAt(pos + 6) === 115/*s*/) - tryParseExportsDotAssign(false); + if (source.charCodeAt(pos + 6) === 115/*s*/) { + const start = pos; + if (!tryParseExportsDotAssign(false) && extendedMode && webpack?.inline && !webpack.current && + start >= webpackTrustedEnd && !isIdentifierChar(source.codePointAt(start + 7), true)) { + if (readWebpackExportsAlias(start)) webpack.alias = true; + else if (webpack.alias) webpack.invalid = true; + } + } else if (openTokenDepth === 0) throwIfExportStatement(); } @@ -398,32 +408,37 @@ function readWebpackToken (ch) { pos = start; return false; } - if (source.startsWith('__webpack_exports__', pos) && - !isIdentifierChar(source.codePointAt(pos + 19), true)) { - const start = pos; - if (webpack && !current) { - pos += 19; + if (matchesWebpackExports()) { + if (!tryParseExportsDotAssign(false, 19) && webpack && !current && start >= webpackTrustedEnd) { + const revert = pos++; if (commentWhitespace() === 61/*=*/) { pos++; const ch = commentWhitespace(); - webpack.inline = ch === 123; - webpack.entry = undefined; - const entry = readWebpackCall(); - if (entry !== undefined) webpack.entry = entry; - } + webpack.inline = false; + if (ch === 123) { + pos++; + if (commentWhitespace() === 125) { + pos++; + webpack.inline = readWebpackExpressionEnd(); + } + } + webpack.entry = ch === 95 ? readWebpackCall() : undefined; + if (!webpack.inline && webpack.entry === undefined) webpack.invalid = true; + } else webpack.invalid = true; + pos = revert; } - pos = start; - tryParseExportsDotAssign(false, 19); return true; } if (!source.startsWith('__webpack_require__', pos) || isIdentifierChar(source.codePointAt(pos + 19), true)) return false; if (current ? openTokenDepth === current.depth : webpack?.inline) { - const id = readWebpackCall(); + const id = readWebpackCall(false); if (id !== undefined) { - lastStarExportSpecifier = { webpack: id }; - tryBacktrackAddStarExportBinding(start - 1); - return true; + const complete = isWebpackCallExpression(); + if (complete) lastStarExportSpecifier = { webpack: id }; + tryBacktrackAddStarExportBinding(start - 1, complete ? WebpackImport : WebpackImportPrefix); + if (complete) return true; + pos = start; } } pos = start + 19; @@ -459,7 +474,36 @@ function readWebpackToken (ch) { /** @param {number} finish */ function trustWebpackExports (finish) { - if (webpack?.current && finish > webpackTrustedEnd) webpackTrustedEnd = finish; + if (webpack && finish > webpackTrustedEnd) webpackTrustedEnd = finish; +} + +function markWebpackExportsUncertain () { + if (webpack?.current) webpack.current.uncertain = true; + else if (webpack?.inline) webpack.invalid = true; +} + +function matchesWebpackExports () { + return source.startsWith('__webpack_exports__', pos) && !isIdentifierChar(source.codePointAt(pos + 19), true); +} + +/** @param {number} start */ +function readWebpackExportsAlias (start) { + if (!readPrecedingKeyword(lastTokenPos, 'var') && !readPrecedingKeyword(lastTokenPos, 'let') && + !readPrecedingKeyword(lastTokenPos, 'const')) return false; + const revert = pos; + pos = start + 7; + let alias = false; + if (commentWhitespace() === 61) { + pos++; + commentWhitespace(); + if (matchesWebpackExports()) { + pos += 19; + alias = readWebpackExpressionEnd(); + if (alias) trustWebpackExports(pos); + } + } + pos = revert; + return alias; } /** @param {number} token */ @@ -478,10 +522,7 @@ function readWebpackArrayElement (token) { next = WebpackArrayBindingToken; } } - if (!next && ch !== 93) { - if (webpack?.current) webpack.current.uncertain = true; - else if (webpack?.inline) webpack.invalid = true; - } + if (!next && ch !== 93) markWebpackExportsUncertain(); } else if (token === WebpackArrayBindingToken && ch === 48) { pos++; if (commentWhitespace() === 44) next = WebpackArrayValueToken; @@ -504,7 +545,8 @@ function readWebpackId () { if (identifier()) return source.slice(start, pos); } -function readWebpackCall () { +/** @param {boolean} [requireExpressionEnd] */ +function readWebpackCall (requireExpressionEnd = true) { const start = pos; if (source.startsWith('__webpack_require__', pos)) { pos += 19; @@ -512,19 +554,25 @@ function readWebpackCall () { pos++; const ch = commentWhitespace(); const id = ch === 34 || ch === 39 || ch >= 48 && ch <= 57 ? readWebpackId() : undefined; - if (id !== undefined && commentWhitespace() === 41/*)*/) { - const callEnd = pos++; - const ch = commentWhitespace(); - if (pos > end || ch === 59 || ch === 44 || ch === 41 || ch === 125) { - pos = callEnd; - return id; - } - } + if (id !== undefined && commentWhitespace() === 41/*)*/ && + (!requireExpressionEnd || isWebpackCallExpression())) return id; } } pos = start; } +function isWebpackCallExpression () { + const callEnd = pos++; + const complete = readWebpackExpressionEnd(); + pos = callEnd; + return complete; +} + +function readWebpackExpressionEnd () { + const ch = commentWhitespace(); + return pos > end || ch === 59 || ch === 44 || ch === 41 || ch === 125; +} + function readWebpackFactory () { const start = pos; pos++; @@ -573,6 +621,7 @@ function readWebpackFactory () { } else if (arrow) ch = 0; if (ch === 123) { webpack.factoryPos = pos; + trustWebpackExports(pos); const existing = webpack.modules.get(id); if (existing) { webpack.invalid = true; @@ -625,8 +674,11 @@ function finishWebpack () { reexports = dependencies; } -/** @param {number} bPos */ -function tryBacktrackAddStarExportBinding (bPos) { +/** + * @param {number} bPos + * @param {number} [bindingMode] + */ +function tryBacktrackAddStarExportBinding (bPos, bindingMode = RequireBinding) { while (source.charCodeAt(bPos) === 32/* */ && bPos >= 0) bPos--; if (source.charCodeAt(bPos) === 61/*=*/) { @@ -644,23 +696,20 @@ function tryBacktrackAddStarExportBinding (bPos) { identifierStart = isIdentifierStart(codePoint, true); bPos -= codePointLen(codePoint); } - if (identifierStart && source.charCodeAt(bPos) === 32/* */) { - const starExportId = source.slice(bPos + 1, id_end + 1); + const idStart = bPos + 1; + if (!identifierStart) return; + if (bindingMode !== WebpackImportPrefix && source.charCodeAt(bPos) === 32/* */) { while (source.charCodeAt(bPos) === 32/* */ && bPos >= 0) bPos--; - switch (source.charCodeAt(bPos)) { - case 114/*r*/: - if (!source.startsWith('va', bPos - 2)) - return; - break; - case 116/*t*/: - if (!source.startsWith('le', bPos - 2) && !source.startsWith('cons', bPos - 4)) - return; - break; - default: return; + const ch = source.charCodeAt(bPos); + if (ch === 114/*r*/ && source.startsWith('va', bPos - 2) || + ch === 116/*t*/ && (source.startsWith('le', bPos - 2) || source.startsWith('cons', bPos - 4))) { + starExportMap[source.slice(idStart, id_end + 1)] = lastStarExportSpecifier; + return; } - starExportMap[starExportId] = lastStarExportSpecifier; } + if (bindingMode !== RequireBinding && keywordStart(idStart) && starExportMap[source.slice(idStart, id_end + 1)] !== undefined) + markWebpackExportsUncertain(); } } @@ -1229,8 +1278,7 @@ function tryParseObjectDefineOrKeys (keys) { pos = revertPos; return; } - if (webpack?.current) webpack.current.uncertain = true; - else if (webpack?.inline) webpack.invalid = true; + markWebpackExportsUncertain(); return; } } @@ -1344,14 +1392,14 @@ function tryParseExportsDotAssign (assign, length = 7) { else { webpack.entry = id; webpack.published = true; } } pos = start; - if (webpack && !webpack.current && source.startsWith('__webpack_exports__', pos) && - !isIdentifierChar(source.codePointAt(pos + 19), true)) { + if (webpack && !webpack.current && matchesWebpackExports()) { pos += 19; - const next = commentWhitespace(); - if (pos > end || next === 59 || next === 44 || next === 41 || next === 125) + if (readWebpackExpressionEnd()) { + trustWebpackExports(pos); webpack.published = true; - else + } else { webpack.invalid = true; + } } } if (ch === 40/*(*/) ch = readExportExpressionStart(); @@ -1485,8 +1533,7 @@ function readExportProperty () { if (ch === 46/*.*/ && source.startsWith('..', pos + 1)) { pos += 3; ch = commentWhitespace(); - if (!(ch === 114/*r*/ && tryParseRequire(ExportAssign)) && webpack?.current) - webpack.current.uncertain = true; + if (!(ch === 114/*r*/ && tryParseRequire(ExportAssign))) markWebpackExportsUncertain(); pos = revertPos; return; } @@ -1541,8 +1588,8 @@ function readExportProperty () { if (nameEnd !== undefined && (ch === 58/*:*/ || ch === 40/*(*/ || !computed && (ch === 44/*,*/ || ch === 125/*}*/))) _exports.add(decode(source.slice(nameStart, nameEnd))); - else if (propertyStart !== 125 && webpack?.current) - webpack.current.uncertain = true; + else if (propertyStart !== 125) + markWebpackExportsUncertain(); pos = revertPos; } diff --git a/lib/lexer.wasm b/lib/lexer.wasm index be868bfb7ac8214bd1053eb591a6a4e42688eba7..462c84f71ca5f904cdc8104f9201fc60477e46ed 100755 GIT binary patch delta 15171 zcmb_j3y@t!nLe-kn0xM>Imygq-ZOp949VpE;w1z!Eju%0V-g4~kVPdTYsei1CWi7A zbF-F~)~=91V-;IsDOFajx>_4HkzyBD(PFoyMGImdMaHz*W>z{Nj)iyH*@9avgC^(!~5Ir`LnU;2diS6@ALq1)rNe)DFprRE(R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>)?}J^@09VNTk*A1mR~FA9c`wy+E>!J`Tl za^w~RX5$t^7mi`DW-L`gBn7p*flf5aE5H!K^VVMI=OS){3U0TArGXpZrRZ`~DEa`; z8h6CM0P{TWmpY#E7|r-N1C3Bok|PC2{~z22j0EQE^jstISaL_wz)Jc}VvU>Y+W z7IlFWW`cxlruE(Cnb*lwE?68-U@cI>ijep?a%55mFUKFs!ei#5EIi(Vz&0YEHCAOl zdR@of{BN`$#GR6FM@u~CX8-=E5PGm5cuDvr7Zn0nk|_TuY71wgC9bocrB7O(5Rc** zC}%rywTV^+wIh&{=8Rzj?>)gz5wrRFkK^^}xMt_;B@! zZs@`-CmurkCnwh6H#*sc-%Te6@cZtQo0f^vXPM`$C3{HLg|y`LcPDRUs_N=_X{uVU zOqgpvhGospkDXwY>DH@tvqBWII(pJ{e7v6#rrTUBLH{&+!a_q@r\02\00\00\03\00\00\00\09\00\00\00\09\00\00\00r\01\00\00\01\00\00\00\9a\00\00\00\0a\00\00\00\b0\00\00\00\02\00\00\006\00\00\00\0e\00\00\00 \00\00\00\09\00\00\00\10\00\00\00\03\00\00\00.\00\00\00\0a\00\00\006\00\00\00\09\00\00\00\07\00\00\00\02\00\00\00%\00\00\00\0d\00\00\00\02\00\00\00\09\00\00\00\06\00\00\00\01\00\00\00-\00\00\00\00\00\00\00\0d\00\00\00\02\00\00\001\00\00\00\0d\00\00\00\09\00\00\00\03\00\00\00\02\00\00\00\0b\00\00\00S\00\00\00\0b\00\00\00\07\00\00\00\00\00\00\00\a1\00\00\00\0b\00\00\00\06\00\00\00\09\00\00\00\07\00\00\00\03\00\00\008\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\02\00\00\00\0a\00\00\00\00\00\00\00\0b\00\00\00\01\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\04\00\00\00\c1\00\00\00\11\00\00\00\0a\00\00\00\09\00\00\00\05\00\00\00\00\00\00\00R\00\00\00\13\00\00\00\0d\00\00\00\09\00\00\00\d6\00\00\00\06\00\00\00\03\00\00\00\08\00\00\00\1c\00\00\00\01\00\00\00S\00\00\00\10\00\00\00\10\00\00\00\09\00\00\00R\00\00\00\0c\00\00\00\09\00\00\00\09\00\00\00T\00\00\00\0e\00\00\00\05\00\00\00\09\00\00\00\f3\00\00\00\0e\00\00\00\a6\00\00\00\09\00\00\00G\00\00\00\05\00\00\00\02\00\00\00\01\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\0d\00\00\00\09\00\00\00x\00\00\00\06\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\00\00\00\00\1d\00\00\00\09\00\00\00)\00\00\00\06\00\00\00\02\00\00\00\03\00\00\00\09\00\00\00\00\00\00\00\0a\00\00\00\0a\00\00\00/\00\00\00\0f\00\00\00\96\01\00\00\07\00\00\00\02\00\00\00\07\00\00\00\11\00\00\00\09\00\00\009\00\00\00\15\00\00\00\02\00\00\00\0d\00\00\00{\00\00\00\05\00\00\00\04\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\00\00\00\00\09\00\00\00\09\00\00\001\00\00\00\04\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\09\00\00\00\09\00\00\00J\01\00\00\03\00\00\00jK\00\00\09\00\00\00\87\00\00\00\04\00\00\00<\00\00\00\06\00\00\00\1a\00\00\00\09\00\00\00\f6\03\00\00\00\00\00\00\02\00\00\006\00\00\00\08\00\00\00\03\00\00\00R\00\00\00\00\00\00\00\0c\00\00\00\01\00\00\00\acL\00\00\01\00\00\00\c7\14\00\00\04\00\00\00\04\00\00\00\05\00\00\00\09\00\00\00\07\00\00\00\03\00\00\00\06\00\00\00\1f\00\00\00\03\00\00\00\95\00\00\00\02\00\00\00\8a\05\00\001\00\00\00\01\02\00\006\00\00\00\05\00\00\001\00\00\00\09\00\00\00\00\00\00\00\0f\00\00\00\00\00\00\00\17\00\00\00\04\00\00\00\02\00\00\00\0e\00\00\00Q\05\00\00\06\00\00\00\02\00\00\00\10\00\00\00\03\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\06\01\00\00\06\00\00\00\0a\00\00\00\09\00\00\00\a3\01\00\00\0d\00\00\00\d7\05\00\00\06\00\00\00n\00\00\00\06\00\00\00\06\00\00\00\09\00\00\00\97\12\00\00\09\00\00\00\07\05\0c\00\ef\00\00\00d\00e\00f\00a\00u\00l\00t") (data (;2;) (i32.const 4048) "_\00_\00e\00s\00M\00o\00d\00u\00l\00e\00\08\00\00\00\0a\00\00\00\0c\00\00\00\0a\00\00\00\0a\00\00\00\0a\00\00\00\0a\00\00\00\0a\00\00\00\0d\00\00\00\09\00\00\00\0b") - (data (;3;) (i32.const 4112) "@}\00\00\03\00\00\00\04\00\00\00\05")) + (data (;3;) (i32.const 4112) "P}\00\00\03\00\00\00\04\00\00\00\05")) diff --git a/src/lexer.c b/src/lexer.c index a900b61..24e484e 100755 --- a/src/lexer.c +++ b/src/lexer.c @@ -73,7 +73,7 @@ static WebpackModule* webpackPending; static WebpackModule webpackInlineRoot; static WebpackModule** webpackBuckets; static uint32_t webpackCapacity, webpackCount; -static bool webpackPublished, webpackInvalid, webpackInline; +static bool webpackPublished, webpackInvalid, webpackInline, webpackAlias; static void (*webpackAddExport)(const uint16_t*, const uint16_t*); static void (*webpackAddReexport)(const uint16_t*, const uint16_t*); @@ -108,7 +108,9 @@ static void finishWebpack (); static void captureWebpackExport (const uint16_t* start, const uint16_t* end); static void captureWebpackReexport (const uint16_t* start, const uint16_t* end); static void addWebpackDependency (const uint16_t* start, const uint16_t* end, bool star); -static bool readWebpackCall (const uint16_t** start, const uint16_t** end); +enum StarBindingMode { RequireBinding, WebpackImport, WebpackImportPrefix }; +static bool readWebpackCall (const uint16_t** start, const uint16_t** end, bool requireExpressionEnd); +static void backtrackStarExportBinding (uint16_t* bPos, enum StarBindingMode bindingMode); typedef struct WebpackText { const uint16_t* pos; @@ -269,7 +271,19 @@ static bool readWebpackId (const uint16_t** start, const uint16_t** finish) { return !error; } -static bool readWebpackCall (const uint16_t** start, const uint16_t** finish) { +static bool readWebpackExpressionEnd () { + uint16_t ch = commentWhitespace(); + return pos > end || ch == ';' || ch == ',' || ch == ')' || ch == '}'; +} + +static bool isWebpackCallExpression () { + uint16_t* callEnd = pos++; + bool complete = readWebpackExpressionEnd(); + pos = callEnd; + return complete; +} + +static bool readWebpackCall (const uint16_t** start, const uint16_t** finish, bool requireExpressionEnd) { uint16_t* revert = pos; if (str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'r', 'e', 'q', 'u', 'i', 'r', 'e', '_', '_')) { pos += 19; @@ -277,14 +291,8 @@ static bool readWebpackCall (const uint16_t** start, const uint16_t** finish) { pos++; uint16_t ch = commentWhitespace(); if ((ch == '\'' || ch == '"' || ch >= '0' && ch <= '9') && - readWebpackId(start, finish) && commentWhitespace() == ')') { - uint16_t* callEnd = pos++; - ch = commentWhitespace(); - if (pos > end || ch == ';' || ch == ',' || ch == ')' || ch == '}') { - pos = callEnd; - return true; - } - } + readWebpackId(start, finish) && commentWhitespace() == ')' && + (!requireExpressionEnd || isWebpackCallExpression())) return true; } } pos = revert; @@ -303,7 +311,38 @@ static bool matchesWebpackBinding (const uint16_t* binding, uint32_t length) { } static void trustWebpackExports (uint16_t* finish) { - if (webpackCurrent && finish > webpackTrustedEnd) webpackTrustedEnd = finish; + if (webpackTablePos && finish > webpackTrustedEnd) webpackTrustedEnd = finish; +} + +static void markWebpackExportsUncertain () { + if (webpackCurrent) webpackCurrent->uncertain = true; + else if (webpackInline) webpackInvalid = true; +} + +static inline __attribute__((always_inline)) bool matchesWebpackExports () { + return end - pos >= 18 && *pos == '_' && + str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'e', 'x', 'p', 'o', 'r', 't', 's', '_', '_') && + !isIdentifierChar(webpackCharAt(pos + 19)); +} + +static bool readWebpackExportsAlias (uint16_t* start) { + if (!readPrecedingKeyword3(lastTokenPos, 'v', 'a', 'r') && + !readPrecedingKeyword3(lastTokenPos, 'l', 'e', 't') && + !readPrecedingKeyword5(lastTokenPos, 'c', 'o', 'n', 's', 't')) return false; + uint16_t* revert = pos; + pos = start + 7; + bool alias = false; + if (commentWhitespace() == '=') { + pos++; + commentWhitespace(); + if (matchesWebpackExports()) { + pos += 19; + alias = readWebpackExpressionEnd(); + if (alias) trustWebpackExports(pos); + } + } + pos = revert; + return alias; } static bool readWebpackToken (uint16_t ch) { @@ -336,31 +375,45 @@ static bool readWebpackToken (uint16_t ch) { pos = start; return false; } - if (str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'e', 'x', 'p', 'o', 'r', 't', 's', '_', '_') && - !isIdentifierChar(webpackCharAt(pos + 19))) { - if (webpackTablePos && !webpackCurrent) { - pos += 19; + if (matchesWebpackExports()) { + if (!tryParseExportsDotAssign(false, 19) && webpackTablePos && !webpackCurrent && start >= webpackTrustedEnd) { + uint16_t* revert = pos++; if (commentWhitespace() == '=') { pos++; - webpackInline = commentWhitespace() == '{'; + uint16_t next = commentWhitespace(); + webpackInline = false; + if (next == '{') { + pos++; + if (commentWhitespace() == '}') { + pos++; + webpackInline = readWebpackExpressionEnd(); + } + } webpackEntryStart = webpackEntryEnd = NULL; const uint16_t *id, *idEnd; - if (readWebpackCall(&id, &idEnd)) { webpackEntryStart = id; webpackEntryEnd = idEnd; } - } + if (next == '_' && readWebpackCall(&id, &idEnd, true)) { webpackEntryStart = id; webpackEntryEnd = idEnd; } + if (!webpackInline && !webpackEntryStart) webpackInvalid = true; + } else webpackInvalid = true; + pos = revert; } - pos = start; - tryParseExportsDotAssign(false, 19); return true; } if (!str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'r', 'e', 'q', 'u', 'i', 'r', 'e', '_', '_') || isIdentifierChar(webpackCharAt(pos + 19))) return false; - if ((webpackCurrent ? openTokenDepth == webpackCurrent->depth : webpackInline) && - readWebpackCall(&starExportBinding_.specifier_start, &starExportBinding_.specifier_end)) { - WebpackModule* owner = webpackCurrent ? webpackCurrent : &webpackInlineRoot; - captureWebpackSlice(starExportBinding_.specifier_start, starExportBinding_.specifier_end, - &owner->imports, &owner->importsTail); - tryBacktrackAddStarExportBinding(start - 1); - return true; + if (webpackCurrent ? openTokenDepth == webpackCurrent->depth : webpackInline) { + const uint16_t *specifierStart, *specifierEnd; + if (readWebpackCall(&specifierStart, &specifierEnd, false)) { + bool complete = isWebpackCallExpression(); + if (complete) { + starExportBinding_.specifier_start = specifierStart; + starExportBinding_.specifier_end = specifierEnd; + WebpackModule* owner = webpackCurrent ? webpackCurrent : &webpackInlineRoot; + captureWebpackSlice(specifierStart, specifierEnd, &owner->imports, &owner->importsTail); + } + backtrackStarExportBinding(start - 1, complete ? WebpackImport : WebpackImportPrefix); + if (complete) return true; + pos = start; + } } pos = start + 19; if (commentWhitespace() == '.') { @@ -409,10 +462,7 @@ static void readWebpackArrayElement (uint8_t token) { next = WebpackArrayBindingToken; } } - if (!next && ch != ']') { - if (webpackCurrent) webpackCurrent->uncertain = true; - else if (webpackInline) webpackInvalid = true; - } + if (!next && ch != ']') markWebpackExportsUncertain(); } else if (token == WebpackArrayBindingToken && ch == '0') { pos++; @@ -455,7 +505,8 @@ static void readWebpackFactory () { if (arrow && ch == '=' && *(pos + 1) == '>') { pos += 2; ch = commentWhitespace(); } else if (arrow) ch = 0; if (ch == '{') { - webpackFactoryPos = pos; + webpackFactoryPos = pos; + trustWebpackExports(pos); webpackPending = createWebpackModule(id, idEnd); if (webpackPending) { webpackPending->target = target; @@ -584,7 +635,7 @@ static __attribute__((always_inline)) uint32_t parseCJSMode (uint16_t* _source, webpackModules = webpackModulesTail = webpackCurrent = webpackPending = NULL; webpackBuckets = NULL; webpackCapacity = webpackCount = 0; - webpackPublished = webpackInvalid = webpackInline = false; + webpackPublished = webpackInvalid = webpackInline = webpackAlias = false; webpackInlineRoot = (WebpackModule){0}; webpackTrustedEnd = _source; webpackArrayPos = NULL; @@ -663,8 +714,14 @@ static __attribute__((always_inline)) uint32_t parseCJSMode (uint16_t* _source, switch (ch) { case 'e': if (str_eq5(pos + 1, 'x', 'p', 'o', 'r', 't') && keywordStart(pos)) { - if (*(pos + 6) == 's') - tryParseExportsDotAssign(false, 7); + if (*(pos + 6) == 's') { + uint16_t* start = pos; + if (!tryParseExportsDotAssign(false, 7) && extendedMode && webpackInline && !webpackCurrent && + start >= webpackTrustedEnd && !isIdentifierChar(webpackCharAt(start + 7))) { + if (readWebpackExportsAlias(start)) webpackAlias = true; + else if (webpackAlias) webpackInvalid = true; + } + } else if (openTokenDepth == 0) throwIfExportStatement(); } @@ -836,6 +893,22 @@ uint32_t parseCJSWithOptions (uint16_t* source, uint32_t sourceLen, void (*addEx } void tryBacktrackAddStarExportBinding (uint16_t* bPos) { + backtrackStarExportBinding(bPos, RequireBinding); +} + +static StarExportBinding* findStarExportBinding (const uint16_t* start, ptrdiff_t length, bool latest) { + StarExportBinding* binding = NULL; + for (StarExportBinding* candidate = firstStarExport; candidate; candidate = candidate->next) { + if (length == candidate->id_end - candidate->id_start && + memcmp(start, candidate->id_start, length * sizeof(uint16_t)) == 0) { + binding = candidate; + if (!latest) break; + } + } + return binding; +} + +static void backtrackStarExportBinding (uint16_t* bPos, enum StarBindingMode bindingMode) { while (*bPos == ' ' && bPos > source) bPos--; if (*bPos == '=') { @@ -853,33 +926,31 @@ void tryBacktrackAddStarExportBinding (uint16_t* bPos) { identifierStart = isIdentifierStart(charCode); bPos -= charCodeByteLen(charCode); } - if (identifierStart && *bPos == ' ') { - starExportBinding_.id_start = bPos + 1; - starExportBinding_.id_end = id_end + 1; + uint16_t* idStart = bPos + 1; + if (!identifierStart) return; + if (bindingMode != WebpackImportPrefix && *bPos == ' ') { while (*bPos == ' ' && bPos > source) bPos--; - switch (*bPos) { - case 'r': - if (!readPrecedingKeyword2(bPos - 1, 'v', 'a')) - return; - break; - case 't': - if (!readPrecedingKeyword2(bPos - 1, 'l', 'e') && !readPrecedingKeyword4(bPos - 1, 'c', 'o', 'n', 's')) - return; - break; - default: return; + if (*bPos == 'r' && readPrecedingKeyword2(bPos - 1, 'v', 'a') || + *bPos == 't' && (readPrecedingKeyword2(bPos - 1, 'l', 'e') || + readPrecedingKeyword4(bPos - 1, 'c', 'o', 'n', 's'))) { + ensureAnalysisCapacity(sizeof(StarExportBinding)); + StarExportBinding* binding = (StarExportBinding*)(uintptr_t)analysis_head; + analysis_head += sizeof(StarExportBinding); + *binding = starExportBinding_; + binding->id_start = idStart; + binding->id_end = id_end + 1; + binding->next = NULL; + if (lastStarExport) + lastStarExport->next = binding; + else + firstStarExport = binding; + lastStarExport = binding; + return; } - ensureAnalysisCapacity(sizeof(StarExportBinding)); - StarExportBinding* binding = (StarExportBinding*)(uintptr_t)analysis_head; - analysis_head += sizeof(StarExportBinding); - *binding = starExportBinding_; - binding->next = NULL; - if (lastStarExport) - lastStarExport->next = binding; - else - firstStarExport = binding; - lastStarExport = binding; } + if (bindingMode != RequireBinding && keywordStart(idStart) && findStarExportBinding(idStart, id_end + 1 - idStart, false)) + markWebpackExportsUncertain(); } } @@ -1440,14 +1511,7 @@ void tryParseObjectDefineOrKeys (bool keys) { // and by doing this search last after verifying the structure match, // we don't have to worry about the slow search algorithm bool projectingWebpack = extended && (webpackCurrent || webpackInline); - StarExportBinding* binding = NULL; - for (StarExportBinding* candidate = firstStarExport; candidate; candidate = candidate->next) { - if (id_len == candidate->id_end - candidate->id_start && - 0 == memcmp(id_start, candidate->id_start, id_len * sizeof(uint16_t))) { - binding = candidate; - if (!projectingWebpack) break; - } - } + StarExportBinding* binding = findStarExportBinding(id_start, id_len, projectingWebpack); if (binding) { bool internal = false; if (projectingWebpack) { @@ -1462,10 +1526,7 @@ void tryParseObjectDefineOrKeys (bool keys) { addReexport(binding->specifier_start, binding->specifier_end); pos = revertPos; } - else if (projectingWebpack) { - if (webpackCurrent) webpackCurrent->uncertain = true; - else webpackInvalid = true; - } + else if (projectingWebpack) markWebpackExportsUncertain(); return; } } @@ -1570,19 +1631,18 @@ bool tryParseExportsDotAssign (bool assign, uint32_t length) { if (ch == '_') { uint16_t* start = pos; const uint16_t *id, *idEnd; - if (webpackTablePos && readWebpackCall(&id, &idEnd)) { + if (webpackTablePos && readWebpackCall(&id, &idEnd, true)) { recognized = true; if (webpackCurrent) addWebpackDependency(id, idEnd, false); else { webpackEntryStart = id; webpackEntryEnd = idEnd; webpackPublished = true; } } pos = start; - if (webpackTablePos && !webpackCurrent && - str_eq18(pos + 1, '_', 'w', 'e', 'b', 'p', 'a', 'c', 'k', '_', 'e', 'x', 'p', 'o', 'r', 't', 's', '_', '_') && - !isIdentifierChar(webpackCharAt(pos + 19))) { + if (webpackTablePos && !webpackCurrent && matchesWebpackExports()) { pos += 19; - uint16_t next = commentWhitespace(); - if (pos > end || next == ';' || next == ',' || next == ')' || next == '}') webpackPublished = true; - else webpackInvalid = true; + if (readWebpackExpressionEnd()) { + trustWebpackExports(pos); + webpackPublished = true; + } else webpackInvalid = true; } } if (ch == '(') ch = readExportExpressionStart(); @@ -1722,8 +1782,7 @@ void readExportProperty () { if (ch == '.' && end - pos >= 2 && str_eq2(pos + 1, '.', '.')) { pos += 3; ch = commentWhitespace(); - if (!(ch == 'r' && tryParseRequire(ExportAssign)) && webpackCurrent) - webpackCurrent->uncertain = true; + if (!(ch == 'r' && tryParseRequire(ExportAssign))) markWebpackExportsUncertain(); pos = revertPos; return; } @@ -1776,8 +1835,8 @@ void readExportProperty () { } if (nameEnd && (ch == ':' || ch == '(' || !computed && (ch == ',' || ch == '}'))) addExport(nameStart, nameEnd); - else if (propertyStart != '}' && webpackCurrent) - webpackCurrent->uncertain = true; + else if (propertyStart != '}') + markWebpackExportsUncertain(); pos = revertPos; } diff --git a/test/fixtures/webpack/README.md b/test/fixtures/webpack/README.md index 9301de7..c53105e 100644 --- a/test/fixtures/webpack/README.md +++ b/test/fixtures/webpack/README.md @@ -1,9 +1,12 @@ # Webpack 5.112.0 fixtures -Both bundles use `target: 'node'`, `devtool: false`, `library.type: 'commonjs2'`, -and `optimization: { minimize: false, concatenateModules: false, usedExports: false }`. +All bundles use `target: 'node'`, `devtool: false`, `library.type: 'commonjs2'`, +and `optimization.minimize: false`. Trailing horizontal whitespace is removed from the output. +The harmony and ts-star bundles also set `optimization.concatenateModules` and +`optimization.usedExports` to `false`. + `webpack-5.112-harmony.cjs` uses production mode with these inputs: ```js @@ -31,3 +34,28 @@ export const depA = 42; // unused.ts export const hidden = 1; ``` + +`webpack-5.112-ts-direct.cjs` uses production mode with `direct-entry.js` as its +entry. Run `tsc --module commonjs --target es2018 direct-entry.ts` first. + +```ts +// direct-entry.ts +export const helper = () => 1; +export const own = helper(); +``` + +`webpack-5.112-dynamic-star.cjs` uses production mode with `dynamic-entry.mjs` as +its entry. Run `tsc --module commonjs --target es2018 dynamic-barrel.ts dynamic-dep.ts` +first. + +```js +// dynamic-entry.mjs +export * from "./dynamic-barrel.js"; +export const mine = 1; + +// dynamic-barrel.ts +export * from "./dynamic-dep"; + +// dynamic-dep.ts +export const depA = 42; +``` diff --git a/test/fixtures/webpack/webpack-5.112-dynamic-star.cjs b/test/fixtures/webpack/webpack-5.112-dynamic-star.cjs new file mode 100644 index 0000000..8359473 --- /dev/null +++ b/test/fixtures/webpack/webpack-5.112-dynamic-star.cjs @@ -0,0 +1,115 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 893 +(__unused_webpack_module, exports, __webpack_require__) { + + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__webpack_require__(578), exports); + + +/***/ }, + +/***/ 578 +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +const depA = 42; + +/* harmony export */ __webpack_require__.d(__webpack_exports__, [ +/* harmony export */ "depA", 0, /* binding */ depA +/* harmony export */ ]); + + +/***/ } + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ const __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ const cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ const module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ // define getter/value functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ if(Array.isArray(definition)) { +/******/ var i = 0; +/******/ while(i < definition.length) { +/******/ var key = definition[i++]; +/******/ var binding = definition[i++]; +/******/ var descriptor = binding === 0 ? { enumerable: true, value: definition[i++] } : { enumerable: true, get: binding }; +/******/ if(!__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, descriptor); +/******/ } +/******/ } else { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ } +/******/ }; +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/************************************************************************/ +let __webpack_exports__ = {}; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _dynamic_barrel_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(893); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _dynamic_barrel_js__WEBPACK_IMPORTED_MODULE_0__) if(["mine","default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _dynamic_barrel_js__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); + +const mine = 1; + +/* harmony export */ __webpack_require__.d(__webpack_exports__, [ +/* harmony export */ "mine", 0, /* binding */ mine +/* harmony export */ ]); + +module.exports = __webpack_exports__; +/******/ })() +; diff --git a/test/fixtures/webpack/webpack-5.112-ts-direct.cjs b/test/fixtures/webpack/webpack-5.112-ts-direct.cjs new file mode 100644 index 0000000..92b096d --- /dev/null +++ b/test/fixtures/webpack/webpack-5.112-ts-direct.cjs @@ -0,0 +1,29 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 209 +(__unused_webpack_module, exports) { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.own = exports.helper = void 0; +const helper = () => 1; +exports.helper = helper; +exports.own = (0, exports.helper)(); + + +/***/ } + +/******/ }); +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ let __webpack_exports__ = {}; +/******/ __webpack_modules__[209](0,__webpack_exports__); +/******/ module.exports = __webpack_exports__; +/******/ +/******/ })() +; diff --git a/test/webpack.js b/test/webpack.js index f6787ce..247d6e1 100644 --- a/test/webpack.js +++ b/test/webpack.js @@ -122,6 +122,18 @@ suite('Webpack extended detection', () => { [...Object.getOwnPropertyNames(module.exports), 'hidden'].sort()); }); + for (const fixture of ['ts-direct', 'dynamic-star']) { + test(`Webpack 5.112 ${fixture} retains candidates for unsupported root uses`, () => { + const filename = `webpack-5.112-${fixture}.cjs`; + const source = readFileSync(join(__dirname, 'fixtures/webpack', filename), 'utf8'); + const module = { exports: {} }; + vm.runInNewContext(source, { module }); + const result = parse(source, filename, options); + assert.deepEqual(result.exports.sort(), Object.getOwnPropertyNames(module.exports).sort()); + assert.deepEqual(result.reexports, []); + }); + } + test('Webpack getter arrays distinguish keys, getters, and values', () => { const source = bundle(` unused: (m, e) => { e.hidden = 1; }, @@ -190,6 +202,41 @@ suite('Webpack extended detection', () => { assert.deepEqual(parse(source, 'bundle.cjs', options).exports, Object.keys(module.exports)); }); + for (const body of [ + 'Object.assign(__webpack_exports__, __webpack_require__("dependency"));', + 'var exports = __webpack_exports__; Object.assign(exports, __webpack_require__("dependency"));', + 'Object.defineProperties(__webpack_exports__, { ...__webpack_require__("dependency") });', + '__webpack_require__.d(__webpack_exports__, { [key]: () => 1 });', + '__webpack_require__.d(__webpack_exports__, [key, () => 1]);', + ]) { + test(`inlined entry retains candidates for ${body}`, () => { + const source = bundle('dependency: (module, exports) => { exports.depA = 1; }') + .replace("const __webpack_exports__ = __webpack_require__('entry');", ` + const __webpack_exports__ = {}; + __webpack_exports__.own = 1; + ${body}`); + const result = parse(source, 'bundle.cjs', options); + assert.deepEqual(result.exports.sort(), ['depA', 'own']); + assert.deepEqual(result.reexports, []); + }); + } + + test('recognized inlined descriptors and writes do not invalidate projection', () => { + const source = bundle('unused: (module, exports) => { exports.hidden = 1; }') + .replace("const __webpack_exports__ = __webpack_require__('entry');", ` + const __webpack_exports__ = {}; + __webpack_require__.r(__webpack_exports__); + __webpack_require__.d(__webpack_exports__, { getter: () => 1 }); + __webpack_require__.d(__webpack_exports__, ["arrayGetter", () => 2]); + Object.defineProperty(__webpack_exports__, "single", { value: 3 }); + Object.defineProperties(__webpack_exports__, { multiple: { value: 4 } }); + let exports = __webpack_exports__; + exports.written = 5;`); + assert.deepEqual(parse(source, 'bundle.cjs', options), { + exports: ['getter', 'arrayGetter', 'single', 'multiple', 'written'], reexports: [] + }); + }); + test('inlined entry star reexports follow internal dependencies', () => { const source = bundle(` unused: (m, exports) => { exports.hidden = 1; }, @@ -258,7 +305,10 @@ suite('Webpack extended detection', () => { const starBindings = [ ['missing semicolon', 'const dep = __webpack_require__("dependency")', ['old', 'visible']], ['wrapped require', 'const dep = identity(__webpack_require__("dependency"));', ['old', 'visible']], - ['redeclared variable', 'var dep = __webpack_require__("old"); var dep = __webpack_require__("dependency");', ['visible']] + ['redeclared variable', 'var dep = __webpack_require__("old"); var dep = __webpack_require__("dependency");', ['visible']], + ['reassigned variable', 'var dep = __webpack_require__("old"); dep = __webpack_require__("dependency");', ['old', 'visible']], + ['reassignment without semicolon', 'var dep = __webpack_require__("old"); dep = __webpack_require__("dependency")', ['old', 'visible']], + ['member assignment', 'var dep = __webpack_require__("dependency"); const holder = {}; holder.dep = __webpack_require__("old");', ['visible']] ]; for (const [binding, declaration, expected] of starBindings) { for (const inline of [false, true]) { From cf6e64bb474f68437444a11d769895a341763000 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 23 Nov 2026 17:12:31 +0100 Subject: [PATCH 5/5] perf(lexer): keep Webpack factory depth in scanner state The scanner checks the factory boundary even for tokens that are not Webpack declarations. Keeping the depth with the active parameter initials removes the factory object lookup from those checks. Five Webpack bundles took a median of 28.8 us/parse before and 25.6 us/parse after in extended mode (Node 22.23.4, V8 12.4, macOS arm64, nine warmed trials). Default-only runs in separate processes stayed within 0.2% for tiny, small, and larger CommonJS files on this runtime. Signed-off-by: Ruben Bridgewater --- lexer.js | 24 ++++++++++++++---------- test/webpack.js | 1 + 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lexer.js b/lexer.js index c34ed75..4ccf7a7 100755 --- a/lexer.js +++ b/lexer.js @@ -133,7 +133,7 @@ function parseSource (cjsSource) { pos = -1; end = source.length - 1; let ch = 0; - let targetFirst = -1, moduleFirst = -1; + let targetFirst = -1, moduleFirst = -1, factoryDepth = -1; // Handle #! if (source.charCodeAt(0) === 35/*#*/ && source.charCodeAt(1) === 33/*!*/) { @@ -153,13 +153,14 @@ function parseSource (cjsSource) { if (ch === 32 || ch < 14 && ch > 8) continue; - if (extendedMode && (ch === 95 || ch === targetFirst || ch === moduleFirst) && keywordStart(pos) && readWebpackToken(ch)) { + if (extendedMode && (ch === 95 || ch === targetFirst || ch === moduleFirst) && + keywordStart(pos) && readWebpackToken(ch, factoryDepth)) { skipTokenRun(); lastTokenPos = pos; continue; } - if (openTokenDepth === 0 || extendedMode && webpack?.current?.depth === openTokenDepth) { + if (openTokenDepth === 0 || extendedMode && factoryDepth === openTokenDepth) { switch (ch) { case 105/*i*/: if (source.startsWith('mport', pos + 1) && keywordStart(pos)) @@ -234,7 +235,7 @@ function parseSource (cjsSource) { case 79/*O*/: if (source.startsWith('bject', pos + 1) && keywordStart(pos)) tryParseObjectDefineOrKeys(openTokenDepth === 0 || extendedMode && - (webpack?.current ? webpack.current.depth === openTokenDepth : webpack?.inline)); + (webpack?.current ? factoryDepth === openTokenDepth : webpack?.inline)); skipTokenRun(); break; case 40/*(*/: @@ -285,7 +286,7 @@ function parseSource (cjsSource) { webpack.current = webpack.pending; targetFirst = webpack.current.target?.charCodeAt(0) ?? -1; moduleFirst = webpack.current.module?.charCodeAt(0) ?? -1; - webpack.current.depth = openTokenDepth; + factoryDepth = openTokenDepth; _exports = webpack.current.exports ??= new Set(); reexports = webpack.current.reexports ??= new Set(); starExportMap = Object.create(null); @@ -294,9 +295,9 @@ function parseSource (cjsSource) { case 125/*}*/: if (openTokenDepth === 0) throw new Error('Unexpected closing brace.'); - if (extendedMode && webpack?.current?.depth === openTokenDepth) { + if (extendedMode && factoryDepth === openTokenDepth) { webpack.current = undefined; - targetFirst = moduleFirst = -1; + targetFirst = moduleFirst = factoryDepth = -1; _exports = webpack.exports; reexports = webpack.reexports; starExportMap = webpack.starExportMap; @@ -371,8 +372,11 @@ function parseSource (cjsSource) { throw new Error('Unterminated braces.'); } -/** @param {number} ch */ -function readWebpackToken (ch) { +/** + * @param {number} ch + * @param {number} factoryDepth + */ +function readWebpackToken (ch, factoryDepth) { const current = webpack?.current; const start = pos; const target = current?.target; @@ -431,7 +435,7 @@ function readWebpackToken (ch) { } if (!source.startsWith('__webpack_require__', pos) || isIdentifierChar(source.codePointAt(pos + 19), true)) return false; - if (current ? openTokenDepth === current.depth : webpack?.inline) { + if (current ? openTokenDepth === factoryDepth : webpack?.inline) { const id = readWebpackCall(false); if (id !== undefined) { const complete = isWebpackCallExpression(); diff --git a/test/webpack.js b/test/webpack.js index 247d6e1..e49f3b3 100644 --- a/test/webpack.js +++ b/test/webpack.js @@ -76,6 +76,7 @@ suite('Webpack extended detection', () => { 'entry: (module, exports) => { exports.visible = 1; }', 'entry: function(module, exports) { exports.visible = 1; }', 'entry: (m, e) => { e.visible = 1; }', + 'entry: (_module, _exports) => { _module.exports.first = 1; _exports.second = 2; }', `entry: (record, output) => { const outputOther = {}; outputOther.hidden = 1;