You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 353202a
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(javascript): read the minifier's comments and tokens off arrays, not terser's objects (#23039)
* refactor(javascript): type the printer's nodes as the numbers they are
Drop the ESTree-shaped `Print*` node typedefs, which every use cast a
`SyntaxTree` node number to, and the mangling recording only the deleted
`patchRecording` read.
Claude-Session: https://claude.ai/code/session_01Tgxgyb4N35ndP6cC4KcrXC
* refactor(javascript): read the minifier's comments and tokens off arrays
Comments are numbers into per-parse arrays, and a gap's or parenthesis's
comments a list number, instead of terser's `ParsedToken` and
`SourceToken` objects; the stream marks what it printed in two byte
arrays. A `comments` callback is still handed terser's comment shape.
Output is byte-identical; a parse of lodash keeping every comment retains
about 45% less heap.
Claude-Session: https://claude.ai/code/session_01Tgxgyb4N35ndP6cC4KcrXC
* refactor(javascript): drop terser's node shapes and module bag from the printer
The printer's types no longer describe terser's AST: `NodeShape`,
`NodeFields`, `Node`, `CompressorShape`, `PureCallView` and the generic
`NodeAccess<N>`/`OutputStream<N>` over ESTree nodes are gone, and the
`TerserModules` bag the phases installed into is built from explicit
pieces, its unread `quotesKept` dropped.
Claude-Session: https://claude.ai/code/session_01Tgxgyb4N35ndP6cC4KcrXC
/** @type {MinifierVariable[]} the definitions it or a scope inside it reads, in the order first read */
1231
1234
this.enclosed=[];
@@ -1333,9 +1336,9 @@ class MinifierLabel {
1333
1336
* @property {MinifierLabel[]} labels every label, in the same order
1334
1337
* @property {Map<string, MinifierVariable>} globals the names nothing declares, in the order first read
1335
1338
* @property {Set<MinifierScope>} blockDefunScopes the function scopes holding a function declared in a block
1336
-
* @property {PrintIdentifier[] | null} functionDeclarators under `keep_fnames`, the names declarators give anonymous functions, in the order the mangler asks `keep_fnames` of them
1337
-
* @property {PrintIdentifier[] | null} classDeclarators under `classDeclarators` and `keep_classnames`, the names declarators give anonymous classes
1338
-
* @property {PrintIdentifier[]} catchParameters unless `ie8` or `safari10` move them, the catch parameters, each named where the mangler's walk meets its scope
1339
+
* @property {NamedIdentifier[] | null} functionDeclarators under `keep_fnames`, the names declarators give anonymous functions, in the order the mangler asks `keep_fnames` of them
1340
+
* @property {NamedIdentifier[] | null} classDeclarators under `classDeclarators` and `keep_classnames`, the names declarators give anonymous classes
1341
+
* @property {NamedIdentifier[]} catchParameters unless `ie8` or `safari10` move them, the catch parameters, each named where the mangler's walk meets its scope
1339
1342
* @property {boolean} namesPrivate whether the program names a private member, which renaming walks it for
1340
1343
* @property {SpelledNames | null} spelledNames under `spelledNames`, the names a key or an import or export spells for a name beside it
1341
1344
* @property {(number[] | null)=} aliases under `substitutesAliases`, the declarators whose name no read reads any more
@@ -1346,7 +1349,7 @@ class MinifierLabel {
1346
1349
* Where a name stands beside one spelled for it: a property's key, which the
1347
1350
* name as its value lets print alone, or an import's or export's other name.
1348
1351
* @typedef {object} SpelledNames
1349
-
* @property {PrintIdentifier[]} identifiers each name, its `definition` read once the analysis resolves
1352
+
* @property {NamedIdentifier[]} identifiers each name, its `definition` read once the analysis resolves
1350
1353
* @property {string[]} spellings the name spelled beside each
1351
1354
* @property {number[]} savings the characters each saves, its own name one long, where it takes the name spelled
1352
1355
*/
@@ -1578,12 +1581,7 @@ class MinifierTreeScopeAnalyzer {
0 commit comments