Skip to content

chore: Address issues with /*#__PURE__*/ annotations placed inside parens cause Rolldown/Vite 8#517

Merged
nev21 merged 2 commits into
mainfrom
nev21/PrepareRelease
Jun 1, 2026
Merged

chore: Address issues with /*#__PURE__*/ annotations placed inside parens cause Rolldown/Vite 8#517
nev21 merged 2 commits into
mainfrom
nev21/PrepareRelease

Conversation

@nev21

@nev21 nev21 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor
  • address issues with /#PURE/ annotations placed inside parens cause Rolldown/Vite 8 [INVALID_ANNOTATION] warnings and disable tree-shaking
  • add a generated-artifact validation script at bundle-pure-annotations-check.js to scan packaged JavaScript under bundle and dist outputs
  • fail when PURE annotations have whitespace after opening parenthesis, and report file plus line for quick diagnosis
  • add progress logging to show discovered files and each file being processed
  • run the new validation as part of size-check in package.json
  • widen the PURE annotation normalization spacing matcher in rollup.config.js to tolerate larger whitespace ranges before rewriting to canonical form

@nev21 nev21 added this to the 0.6.1 milestone Jun 1, 2026
Copilot AI review requested due to automatic review settings June 1, 2026 00:27
@nev21 nev21 requested review from a team as code owners June 1, 2026 00:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Addresses Rolldown/Vite 8 [INVALID_ANNOTATION] warnings caused by /*#__PURE__*/ annotations emitted with whitespace between the opening paren and the comment, which disables tree-shaking. Adds a rollup plugin to normalize emitted annotations and a post-build validation script.

Changes:

  • Add fixPureAnnotations rollup plugin (using magic-string) that rewrites spaced PURE annotations to the canonical (/*#__PURE__*/ form across all rollup configs.
  • Add lib/test/bundle-pure-annotations-check.js to scan lib/bundle and lib/dist .js outputs for invalid annotations and fail the build with file:line diagnostics.
  • Wire the new check into the size-check npm script.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
package.json Chains the new annotation check after bundle-size-check in the size-check script.
lib/test/bundle-pure-annotations-check.js New script recursively scanning generated JS for invalid PURE annotations and reporting failures.
lib/rollup.config.js Adds MagicString import, defines fixPureAnnotations() plugin, and appends it to factory/main/polyfill rollup configs.

Comment thread lib/rollup.config.js
Comment thread lib/rollup.config.js
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.57%. Comparing base (fb514dd) to head (317049c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #517   +/-   ##
=======================================
  Coverage   97.57%   97.57%           
=======================================
  Files          28       28           
  Lines        1484     1484           
  Branches      350      350           
=======================================
  Hits         1448     1448           
  Misses         36       36           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nev21 nev21 force-pushed the nev21/PrepareRelease branch from f8a3cc4 to 5b4a2e4 Compare June 1, 2026 00:31
…rens cause Rolldown/Vite 8

- address issues with /*#__PURE__*/ annotations placed inside parens cause Rolldown/Vite 8 [INVALID_ANNOTATION] warnings and disable tree-shaking
- add a generated-artifact validation script at bundle-pure-annotations-check.js to scan packaged JavaScript under bundle and dist outputs
- fail when PURE annotations have whitespace after opening parenthesis, and report file plus line for quick diagnosis
- add progress logging to show discovered files and each file being processed
- run the new validation as part of size-check in package.json
- widen the PURE annotation normalization spacing matcher in rollup.config.js to tolerate larger whitespace ranges before rewriting to canonical form

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@nev21 nev21 enabled auto-merge (squash) June 1, 2026 00:45

@nevware21-bot nevware21-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by nevware21-bot

@nev21 nev21 merged commit 576bc77 into main Jun 1, 2026
10 checks passed
@nev21 nev21 deleted the nev21/PrepareRelease branch June 1, 2026 01:04
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.

3 participants