Repository navigation
Conversation
Consumers such as Node.js need broader object literal detection with the default descriptor getter and reexport policies. Conservative mode vetoes recognized object literal accessors and retains reexport replacement. Parenthesized assignments retain default detection to avoid uncertain names from comma expressions. Forwarding getters and unrecognized accessor forms can still execute when consumers read exports. The Wasm binary shrinks from 28,959 to 27,925 bytes. Interleaved Node.js 22 trials reduce warmed angular.js CPU time by 5.9% with optimized Wasm compilation (--no-liftoff, seven fresh processes).
guybedford
left a comment
There was a problem hiding this comment.
I'd prefer not to add a third mode. Since extended hasn't been released yet, could this instead redefine extended as the conservative variant?
- Keep the object literal detection (arbitrary values, methods, shorthand, string/computed string keys), with accessors vetoing their names.
- Keep the default
definePropertydescriptor/getter allowlist,definePropertiesand parenthesized assignment handling, and reexport replacement on eachmodule.exports =.
That keeps the API at default | extended, with extended safe for Node.js to consume. If there's a real consumer for the current maximal behaviour (arbitrary descriptor getters, comma-expression objects, accumulated reexports), I'd rather expose that as a separate boolean alongside allowMinifiedEnumerable than as another mode.
Also, could the isTokenRunChar table, uint16_t astral table, readExportDefinition refactor and --converge change move to a separate PR? The size and perf numbers come from those rather than this feature, and --converge produces byte-identical output to -Oz here. Separately, the mode error message should keep listing the valid values.
Consumers such as Node.js need broader object literal detection with the default descriptor getter and reexport policies. Conservative mode vetoes recognized object literal accessors and retains reexport replacement. Parenthesized assignments retain default detection to avoid uncertain names from comma expressions. Forwarding getters and unrecognized accessor forms can still execute when consumers read exports.
The Wasm binary shrinks from 28,959 to 27,925 bytes. Interleaved Node.js 22 trials reduce warmed angular.js CPU time by 5.9% with optimized Wasm compilation (--no-liftoff, seven fresh processes).