mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-31 07:23:06 +08:00
A native build reuses its stale frontend cache entry when every changed source is token-equivalent to the text the entry was built from, but dev builds never did: their debug information records source lines and columns, which a token-equivalent edit can move. Builds with debug information (dev builds without --strip) now reuse the entry when every changed source is token-equivalent and every token keeps its line and column (tokenPositionEquivalentSource): edits to a comment's text within its line, comments and whitespace after the last token, and trailing whitespace. Edits that move a token still rebuild. The token scanner also reads a `/` after a non-null assertion as division (`data[i]! / 7`). It used to read it as the start of a regular expression and give up on the file, so comment edits in files with that pattern always rebuilt. A `!` after a line break, or after an operator or a keyword such as `return`, still starts a negated regular expression, and a `!` after `)`, `}`, `++` or `--` gives up.