Commit Graph
39 Commits
Author SHA1 Message Date
RRFZ b259436c53 Honor legacy HTML script language when type is absent (R3.12) 2026-11-16 23:35:26 -05:00
BFlat 6f07bad8c4 Merge pull request #2003 from Plastic-time/bugfix/r3.12-html-exact-module-keyword
A script whose type was the module keyword with spaces around it was listed as a classic script, and a whitespace-only type was listed too, although browsers run neither. The keyword and the empty attribute are now matched exactly, before the whitespace trimming that classic script types get. Checked in a Chromium 156 page: padded and tab-prefixed module types and a whitespace-only type did not run.
2026-11-17 11:16:02 +07:00
RRFZ ecb83e9350 Honor the exact HTML module script keyword (R3.12) 2026-11-16 22:49:33 -05:00
RRFZ 8b6a701b16 Keep all declared HTML meta security policies (R3.13) 2026-11-16 22:49:32 -05:00
BFlat a3fc0056d3 Merge pull request #1992 from Plastic-time/bugfix/r3.12-dynamic-import-options
On the lexer fallback, `import("./data.json", { with: { type: "json" } })` lost its dependency, because only a closing parenthesis was accepted after the path. A comma after a dynamic import's literal path is now accepted, and a method called `import` on an object is no longer taken for one.
2026-11-17 10:32:27 +07:00
RRFZ 358b15abc6 Keep dynamic import specifiers with options in lexer fallback (R3.12) 2026-11-16 22:07:01 -05:00
RRFZ 4d132b7b0a Ignore incomplete start tags in HTML page inventories (R3.13) 2026-11-16 22:07:00 -05:00
BFlat cd4ecad585 Merge pull request #1982 from Plastic-time/bugfix/r3.12-graphql-string-line-breaks
The operation reader accepted a raw CR inside a regular quoted GraphQL string, and a raw line break after a backslash, both invalid GraphQL. Both line terminators are now checked before an escape is processed; block strings keep their multi-line grammar.
2026-11-17 08:23:59 +07:00
RRFZ 5d83a84b26 Refuse raw line breaks in quoted GraphQL strings (R3.12) 2026-11-16 19:59:04 -05:00
RRFZ 6f0a6f4677 Keep bogus HTML comments out of script inventories (R3.13) 2026-11-16 19:59:02 -05:00
BFlat 9437e05641 Merge pull request #1977 from Plastic-time/bugfix/r3.13-html-comment-endings
Browsers also close a comment at `--!>`, `<!-->` and `<!--->`. The scanner looked only for `-->`, so it missed scripts and preloads after such a comment. It now resumes at the first ending a browser recognises, and still hides what is inside ordinary and unfinished comments.
2026-11-17 07:38:10 +07:00
RRFZ 30172fd238 Keep scripts after an HTML comment closed by the browser (R3.13) 2026-11-16 19:00:03 -05:00
RRFZ 4d39d020f7 Keep escaped triple quotes inside GraphQL block strings (R3.12) 2026-11-16 19:00:01 -05:00
BFlat e70b577550 Merge pull request #1956 from Plastic-time/bugfix/r3.12-with-void-1116
Recovering `with ({undefined: 42}) { result = void 0; }` rewrote `void 0` to `undefined`, which the `with` object can supply, changing the result. Files containing a `with` statement keep their `void` expressions; other rewrites stay on.
2026-11-16 21:28:55 +07:00
BFlat 62f120294c Merge pull request #1955 from Plastic-time/bugfix/r3.12-trpc-calls-1116
The lexer fallback reported `const hook = trpc.users.list.useQuery` as a client call although it only reads a property. An opening call parenthesis (or an optional call) is now required.
2026-11-16 21:28:49 +07:00
BFlat 36c3325e4b Merge pull request #1954 from Plastic-time/bugfix/r3.12-string-escapes-1116
The lexer fallback read `require("./\141pp.js")` as a different module path and mis-decoded zero-padded braced Unicode escapes. Legacy octal escapes, every escaped line terminator and braced escapes of any length are now decoded, with checked arithmetic.
2026-11-16 21:28:42 +07:00
BFlat 99fd4a56c3 Merge pull request #1953 from Plastic-time/bugfix/r3.12-graphql-comments-1116
A comment between an operation keyword and its name hid the name, and a parenthesis inside a header comment could hide the whole operation. Comments and ignored separators are now skipped before header tokens are read.
2026-11-16 21:28:36 +07:00
RRFZ d9ebf8adb8 Preserve void expressions around dynamic with scopes (R3.12) 2026-11-16 09:03:52 -05:00
RRFZ b849f1fbc7 Require a call before reporting a fallback tRPC operation (R3.12) 2026-11-16 09:03:07 -05:00
RRFZ d0c2b514d6 Decode JavaScript legacy escapes and line continuations (R3.12) 2026-11-16 09:02:23 -05:00
RRFZ 03f022e398 Skip comments in GraphQL operation headers (R3.12) 2026-11-16 09:01:38 -05:00
RRFZ a2cb128815 Reject unsupported HTML script type suffixes (R3.12) 2026-11-16 09:00:47 -05:00
RRFZ 72af4d7676 Correct JavaScript lines facts (R3.12) 2026-11-15 14:28:05 -05:00
RRFZ ad9b1c74d1 Keep side-effect imports in JavaScript lexer fallback (R3.12) (#1915)
The lexer fallback, used for sources too large or too deep to parse, dropped side-effect imports such as import "./polyfill.js", which the syntax-tree path records. A string straight after the import keyword is now recorded as a static dependency with its location. Every fallback import goes through one helper that marks the list truncated past its cap and records a .node specifier as a native module, as the syntax-tree pass does.
2026-11-16 00:34:26 +07:00
RRFZ fd9832c7a6 Preserve scoped package names in JavaScript banners (R3.12) (#1916)
A banner such as /*! @scope/pkg@1.2.3 */ was recorded as package pkg, losing its scope. A word that starts with @ now keeps its slash, so @scope/pkg@1.2.3 and @scope/pkg v1.2.3 keep the full name; every other word is still split on slashes, so a banner that names a package by its URL reads as before.
2026-11-16 00:27:48 +07:00
RRFZ bf50b9eb3a Preserve webpack factory parameters used by direct eval (R3.12) (#1913)
Recovering a webpack factory renames its parameters (e, t, n) to module, exports and __webpack_require__, but code inside a direct eval still used the old names, so the recovered factory threw a ReferenceError. A factory with a possible direct eval call now keeps its parameter names; indirect and optional eval calls, and mere mentions of eval, still allow the rename.
2026-11-15 23:48:43 +07:00
RRFZ 501e6b2da0 Read GraphQL and tRPC endpoints only from a URL's path (R3.12) (#1890)
A URL with no path has its first slash in the query or fragment, so https://auth.example.test?next=/graphql was read as a GraphQL endpoint; and a :// in a query made /api/graphql?next=https://x.test lose its path. A scheme now counts only before any /, ? or #, the host ends at the first of those, and run-time text in a partly literal URL ends neither.
2026-11-15 12:17:05 +07:00
RRFZ d821d01c35 Add numbers and read number literals by value in JavaScript constant text (R3.12) (#1889)
Text read through constants joined both sides of every + as written, so '/v' + (1 + 2) read as /v12 and '/w' + 0x10 as /w0x10, both marked literal. Two numbers now add, a number literal reads as JavaScript turns it into text (0x10 is 16), and a + whose sides are neither known text nor two numbers is no longer reported as literal.
2026-11-15 11:59:54 +07:00
RRFZ 18aa351c73 Read a one-module webpack chunk only with a factory and webpack evidence (R3.12) (#1888)
A push of [[ids], {one property}] was read as a webpack chunk whatever the object held, so ordinary code such as queue.push([[1], { callback }]) became a webpack module and marked the file as bundled. A one-property object now counts only when the property is a module factory and the file names webpack or uses its chunk-global push.
2026-11-15 11:15:09 +07:00
RRFZ 5353f81948 Match export lists to function bindings, wherever the list is (R3.12) (#1887)
An export list marked functions exported by name among those seen so far: a list before the declaration marked nothing, and one after it marked every function of that name, nested ones included. Listed names are now resolved to bindings and matched to functions after the walk, whether the function was declared, initialised a variable or was assigned to one.
2026-11-15 11:15:03 +07:00
RRFZ fc22ad1fee Read .cts files as CommonJS and .mts files as ES modules (R3.12) (#1886)
.cts and .mts got the same source type as .ts, where the parser decides between module and script from the syntax, so their reported source kind could be wrong. As in Node and TypeScript, .cts is now always CommonJS and .mts always an ES module.
2026-11-15 11:14:56 +07:00
RRFZ 50fafd176c Bound the text JavaScript facts read through constants (R3.12) (#1864)
Concatenating a constant with itself doubled its text with each declaration, so a file under 1 KB could ask for gigabytes. Text built from several parts is now at most 4 KiB, and all constants in a file share a budget of the source's size plus 1 MiB; longer text reads as not literal. A redeclared name drops its earlier value once the new initializer has been read.
2026-11-14 22:46:49 +07:00
RRFZ 5d8ef28f5b Count call chains and label runs in the JavaScript nesting estimate (R3.12) (#1863)
Calls, index reads and tagged templates that follow one another, and labels in a row, each nest the syntax tree one level, but the estimate stayed flat, so a source with millions of links was sent to the parser and overflowed its stack. The estimate now counts each link, keeps the count across a closed bracket the expression goes on after, and skips comments. The tokenizer also treats JavaScript's non-ASCII spaces and the vertical tab as whitespace.
2026-11-14 22:46:41 +07:00
Alex Joaquim Pereira 2c80fdb799 Use one sourceMappingURL reader in the JS analyzer (R3.12) (#1772) (#1772)
The JavaScript analyzer had its own copy of the sourceMappingURL reader, which missed #1731's fix: it now uses the formats one, so the no-space annotation is found, tabs and repeated spaces are accepted, a URL with whitespace is refused, and an annotation up to 64 lines from the end is seen, on the parsed and lexer paths alike.
2026-11-12 18:58:53 +07:00
Afloat 0757863ece End JavaScript comments at every line terminator (R3.12) (#1616)
The token scanner ended `//` comments only at LF. A bare CR, U+2028 or U+2029 therefore hid following executable code inside the comment. That dropped imports, IPC and fetch facts in lexer fallback and prevented the parser admission check from seeing excessive nesting after the comment. Recognize every JavaScript line terminator when scanning line comments, skip Unicode terminators before charging the token budget, and stop identifiers at those boundaries. Strings, templates and block comments keep their existing handling.
2026-11-11 13:39:24 +07:00
Afloat 99ee49dd99 Match numeric bundle identifiers by their JavaScript value (R3.12) (#1615)
A module keyed by `0x10` and a loader call written as `16` produced different identities. Numeric separators and exponent notation caused the same problem, including dangling `requires` targets in the application graph. Different spellings of one numeric dependency could also occupy separate list entries. Use the existing syntax library's JavaScript number conversion for numeric module keys, loader arguments, browserify mappings and chunk IDs. Explicitly enable its already-present `to_js_string` feature. String identifiers retain their literal spelling, including strings such as `"0x10"` that identify a different property from numeric `0x10`.
2026-11-11 13:38:17 +07:00
Afloat d552493da2 Resolve webpack loaders by their parameter bindings (R3.12) (#1614)
A webpack wrapper can have a loader parameter named `r` while a nested function uses its own unrelated parameter with the same spelling. The dependency visitor treated both calls as module loads, adding false `requires` edges to the application graph. Resolve loader calls against the wrapper parameter's semantic binding. This retains closures that capture the real loader, distinguishes function/arrow parameters, block and catch bindings, and avoids treating the placeholder for a destructured parameter as an actual loader name. First-seen ordering and dependency deduplication stay intact.
2026-11-11 12:42:40 +07:00
BFlatandAfloat ebed13d0fc Keep ARM32 conditional call values, esbuild dependencies and window labels right (#656)
Replays #640–#642. Conditional A32 calls keep the skipped path's value, esbuild dependencies survive unrelated calls, and window comparison labels stay distinct without renumbering occurrences.

Co-authored-by: Afloat <132809511+Afloat16@users.noreply.github.com>
2026-11-03 20:49:11 +07:00
BFlatandAfloat 0eea78d7aa Read HTML pages' scripts and preloads correctly in more cases (#645)
Replays #591–#596. The HTML scanner reads rel token lists, decodes asset URLs once, keeps script and title text through lookalike closing tags, and skips raw-text elements, markup inside attribute values and custom tag names.

Co-authored-by: Afloat <132809511+Afloat16@users.noreply.github.com>
2026-11-03 19:58:08 +07:00