Follow-up to #2083, which stopped an unawaited `import("x")` being taken for the module itself. Bundled code often writes the awaited form as `await (0, import("x"))`, and that shape was no longer recognised, so calls on the module it loads weren't recorded. An awaited comma sequence that ends in a dynamic import is the module again; the same sequence without `await` still isn't.
Windows drops a dot at the end of a file or folder name, so `pkg./a.js` and `pkg/a.js`, or a host written `ex.test.` and `ex.test`, were planned as two files and written as one, and the second was refused. Dots at the end of each part of a path are now removed before names are compared, as dots at the start already were. A module id ending in an upper-case extension (`src/App.TSX`) also keeps it, where `.js` used to be added after it.
When a script can't be parsed, a simpler reader lists what it can from the script's words. It listed the address of a `fetch("https://…")` call twice and repeated an address for every time it was written; it stopped noticing addresses at all after 4,000 other strings; and when its lists of strings, IPC uses or exposed names were full it dropped the rest without saying so. Each address is now listed once, addresses are found however many strings came first, and a list that was cut is named as cut.
A backtick string with no `${}` in it is a plain string, but several readers took its text as written in the source, escapes and all, or ignored it: ``require(`node\x3afs`)`` was recorded as that spelling, not `node:fs`, and a route, a preload setting or a bundle's module id written with backticks was missed. One helper now reads a quoted string or such a template by its value everywhere a string is expected. A template with an invalid escape, which is a syntax error unless tagged, is no longer reported as text.
When two modules recovered from a bundle had the same path, the second was renamed with a `.js` ending whatever it was, so a duplicate `.ts`, `.css` or `.json` module came out as `.js`; the copy now keeps its own extension. A module id is also stripped of at most one `webpack://`, `webpack:` or `file://` prefix instead of every repeated one.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.