fix(deps): patch @sveltejs/acorn-typescript with upstream PR #84 - #7140
fix(deps): patch @sveltejs/acorn-typescript with upstream PR #84#7140JakeChampion wants to merge 1 commit into
Conversation
The bundled parser in @sveltejs/acorn-typescript@1.0.11 corrupts scope state when restoring speculative parse branches, causing edge-bundler's import-attribute rewriter to throw "Export X is not defined" on some compiled JS bundles (e.g. unpdf's pdfjs.mjs) - a leading cause of "tarball bundle generation failed" dry-run errors. Upstream sveltejs/acorn-typescript#84 ("make parse branches transactional") fixes it but is unmerged and unreleased, so apply it locally via patch-package. The patch is the rebuilt bundled index.js from the PR branch (esbuild 0.25.5 reproduces the shipped bundle byte-for-byte; index.d.ts is unchanged by the PR). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe package adds a Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)package.jsonTraceback (most recent call last): Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📊 Dependency Size ChangesWarning This PR adds 603.9 kB of new dependencies, which exceeds the threshold of 100 kB.
Total size change: 603.9 kB |
@netlify/build
@netlify/build-info
@netlify/cache-utils
@netlify/config
@netlify/edge-bundler
@netlify/functions-utils
@netlify/git-utils
@netlify/headers-parser
@netlify/api
@netlify/nock-udp
@netlify/opentelemetry-sdk-setup
@netlify/opentelemetry-utils
@netlify/redirect-parser
@netlify/run-utils
@netlify/zip-it-and-ship-it
commit: |
What
Patches
@sveltejs/acorn-typescript@1.0.11to include upstream sveltejs/acorn-typescript#84 ("make parse branches transactional") viapatch-package.Why
The bundled parser in 1.0.11 corrupts scope state when restoring speculative parse branches. This surfaces in edge-bundler's import-attribute rewriter (
rewriteSourceImportAssertions) asExport 'X' is not definedon some compiled JS bundles - a leading cause of "Dry run: Eszip successful, tarball bundle generation failed" errors (e.g. unpdf'spdfjs.mjs, ~596 daily failure events).Minimal repro that fails on stock 1.0.9-1.0.11 and passes with this patch:
PR #84 fixes the class of scope-corruption bug but is unmerged and unreleased upstream, so it is applied locally.
How
patch-packageas a devDependency and a rootpostinstall: patch-packagescript.patches/@sveltejs+acorn-typescript+1.0.11.patchis the rebuilt bundledindex.jsfrom the PR Simplify code related to lifecycle reducer #84 branch.esbuild src/index.ts --bundle --format=esm --platform=node --external:acorn). esbuild 0.25.5 rebuilds the released source byte-for-byte identical to the shippedindex.js, so the patch contains only PR Simplify code related to lifecycle reducer #84's real changes (466 lines / 21 hunks, no toolchain noise).index.d.tsis unchanged by the PR.Verification
npm installapplies the patch viapostinstall; re-applies idempotently.packages/edge-bundlerbuilds cleanly (tsc) against the patched dep.Follow-up
The patch is pinned to
1.0.11. It will need regenerating when the dependency is bumped or when the fix lands upstream; patch-package warns (does not silently skip) on a version mismatch.🤖 Generated with Claude Code