Skip to content

fix(compiler): restore babel modules the prune wrongly removed - #3690

Merged
DylanPiercey merged 1 commit into
mainfrom
dpiercey-ws-marko-website-3w77hx-jsx-defs
Jul 29, 2026
Merged

fix(compiler): restore babel modules the prune wrongly removed#3690
DylanPiercey merged 1 commit into
mainfrom
dpiercey-ws-marko-website-3w77hx-jsx-defs

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

Three of the modules stubbed in 5.41.13 are reachable after all, and building markojs.com against it fails.

@babel/generator's flow printer. generators/classes.js requires it for its variance helper, and it owns the TypeParameterDeclaration and TypeParameterInstantiation printers. Stubbing it did not throw — it silently mangled unrelated output, dropping the parentheses around an arrow IIFE so (() => { ... })() printed as }(), which then fails to parse downstream.

The flow and jsx node definitions. helper-create-class-features-plugin builds getScopeInformationVisitor with a JSXIdentifier key, and @babel/traverse throws for a visitor on a type it does not know: You gave us a visitor for the node type JSXIdentifier but it's not a valid type.

The other prunes stand. Sizes land at 2084 KB → 1662 KB for node and 1966 KB → 1545 KB for the browser, against 1626/1509 in the bad release.

Verified by building markojs.com against the fixed compiler, and by diffing compiled output for templates covering reactive state, TypeScript with parameter properties, imports, control flow and <await> in both html and dom — byte-identical to pre-prune. Suite is 10302 passing.

The suite did not catch either fault, which is the real gap: it never exercised a .marko file whose compiled output contains an arrow IIFE, and the JSXIdentifier visitor is only constructed on the stripTypes path. Worth adding a fixture for both.

Three of the stubs in the last release are reachable after all.

`@babel/generator`'s flow printer is required by the class printer for its
variance helper, and owns the `TypeParameterDeclaration` printer. Stubbing it
did not throw; it silently mangled unrelated output, dropping the parentheses
around an arrow IIFE so `(() => {})()` printed as `}()`, which then fails to
parse downstream.

The flow and jsx node definitions have to stay because
`helper-create-class-features-plugin` builds a visitor keyed on `JSXIdentifier`,
and `@babel/traverse` rejects a visitor for a type it does not know.

The remaining prunes are unaffected: 2084 KB to 1662 KB for node, 1966 KB to
1545 KB for the browser.
@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ff704d2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@marko/compiler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d33a489a-9a81-4b8a-9762-7be2f2c101f3

📥 Commits

Reviewing files that changed from the base of the PR and between df871c3 and ff704d2.

📒 Files selected for processing (2)
  • .changeset/fix-overpruned-babel.md
  • packages/compiler/scripts/bundle.mts

Walkthrough

The compiler bundling script updates documentation for empty Babel module stubs and removes the Flow generator from the shown dead-module mapping while retaining the JSX generator stub. A new changeset schedules a patch release for @marko/compiler and documents the restoration of three Babel modules related to Flow/class printing and JSXIdentifier traversal.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: restoring Babel modules removed during pruning.
Description check ✅ Passed The description directly explains the restored Babel modules and related compiler impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dpiercey-ws-marko-website-3w77hx-jsx-defs

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.35%. Comparing base (df871c3) to head (ff704d2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3690   +/-   ##
=======================================
  Coverage   90.35%   90.35%           
=======================================
  Files         414      414           
  Lines       19737    19737           
  Branches     3609     3609           
=======================================
  Hits        17834    17834           
  Misses       1366     1366           
  Partials      537      537           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@DylanPiercey
DylanPiercey merged commit 596d441 into main Jul 29, 2026
11 checks passed
@DylanPiercey
DylanPiercey deleted the dpiercey-ws-marko-website-3w77hx-jsx-defs branch July 29, 2026 12:33
@github-actions github-actions Bot mentioned this pull request Jul 29, 2026
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.

1 participant