Repository navigation
fix(compiler): secondary passes accept any file extension - #4320
Conversation
transformDirectives, lazy, refresh and source names run on already-lowered code; the filename is metadata (server-function IDs hash it). An unknown extension now parses as TSX instead of failing, so a Vite front end can pass a module's real path (e.g. App.rx). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMdD4K7882vob4J9vq
🦋 Changeset detectedLatest commit: b812bd8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
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 |
Size (brotli, eager entry chunk)
|
|
The red The cause is #4309 (55c7329, Babel 8 support). It replaced No fix exists yet. A proposed fix belongs in the babel plugin, not here: keep Generated by Claude Code |
Coverage Report for CI Build 40534821727Coverage remained the same at 78.627%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
#4309 switched evaluateAndInline to t.valueToNode for numbers, which builds -1 / 0/0 expressions; the SSR and universal transforms then treated them as dynamic, diverging from the oxc compiler (parity-probes "exotic literal holes"). Build NumericLiteral nodes directly where @babel/types 8 rejects the value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMdD4K7882vob4J9vq
Merging this PR will degrade performance by 5.49%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
|
Generated by Claude Code |
…sses-any-extension # Conflicts: # packages/babel-plugin/src/shared/utils.ts
Summary
The secondary passes (
transformDirectives, lazy, refresh, source names) run on code that is already lowered to JavaScript. Even so, they picked a parser from the filename and failed on any extension other than Solid's own with "Unknown file extension".That blocks other front ends from server functions. A function ID hashes the filename, and
moduleForFunctionIdhashes the module's real id. A front end therefore has to pass the real path (App.rx), not a borrowedApp.rx.tsx.With this change a known extension still picks its dialect, and any other extension parses as TSX (
config.rssecondary_source_type). The JSX transform is unchanged and still rejects unknown extensions.This is the companion to solidjs/solid-vite-plugin's
frontendsoption (PR linked there), which ReactiveScript (.rx) uses to build through Solid's Vite plugin.How did you test this change?
packages/compiler/__tests__/secondary-passes-frontend.test.js:transformDirectiveson/project/src/routes/App.rxworks in both modes and gives the same ID.App.rx.tsx.cargo testinpackages/compiler: 76 passed.parity-probes"exotic literal holes" cases. They fail identically without this change, because my environment's babel-plugin is linked to an older build.Generated by Claude Code