Skip to content

Uglify ascii option - #744

Merged
fuzzie360 merged 5 commits into
gpujs:developfrom
jbghoul:uglify-ascii-option
Jul 22, 2026
Merged

Uglify ascii option#744
fuzzie360 merged 5 commits into
gpujs:developfrom
jbghoul:uglify-ascii-option

Conversation

@jbghoul

@jbghoul jbghoul commented Mar 7, 2022

Copy link
Copy Markdown

Closes #743

@fuzzie360
fuzzie360 merged commit a42c9e4 into gpujs:develop Jul 22, 2026
fuzzie360 added a commit that referenced this pull request Jul 27, 2026
Step two of the build modernization, and the last of browserify. The
pilot in @gpujs/benchmark covered the plain case; this covers the three
things unique to gpu.js.

  bundle                    browserify    rolldown      gzip
  gpu-browser.js                118770      116126      -2.2%
  gpu-browser-core.js            77352       75740      -2.1%
  gpu-browser.min.js             95906       93080      -2.9%
  gpu-browser-core.min.js        63277       60213      -4.8%

`gl`, and acorn for the core build, are aliased to an empty module
rather than marked external: external would leave a require() in the
bundle that throws in a browser, where .ignore() substituted a stub.

The bundle now gets an ascii pass. acorn ships its unicode identifier
tables already escaped and browserify emitted them verbatim, but
rolldown decodes string literals and prints the characters — 68732 raw
UTF-8 bytes in dist/gpu-browser.js. Serving that without a matching
charset corrupts acorn's identifier regex, which is what #743 and #744
were. terser does the escaping rather than a regex sweep, because it
parses the code and so only escapes where an escape is equivalent. All
four artifacts are ASCII-clean, as they were before.

Verified against the browserify bundle: identical export surface (20
named exports, 6 static flags), the #639 write-swallowing global setter
intact, kernels producing the same values, 9/9 BrowserStack targets on
both the smoke and visual suites, and the real QUnit suite in Chrome
giving 90 passed / 3 failed / 18 skipped from both bundles — the three
being the pre-existing node-only test files that cannot load in a
browser.

Installed packages 451 -> 304, and 717 before this work started.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Safari : Invalid regular expression, because of uglify compressing utf-8 characters

3 participants