The shared Babel parser options set `decoratorsBeforeExport: true`, so
`export @dec class Store {}` failed to parse. The route generator logged
the error and wrote no route tree, and the code splitter left the route
unsplit. Start's compilers use the same options.
Dropping the option lets Babel accept decorators on either side of
`export`; decorators before `export` still print where they were.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(router-plugin): write `import.meta.hot.accept(` out in Vite route HMR
Vite's import analysis marks a module as a hot boundary only when its
code spells `import.meta.hot.accept(` out. The route HMR code called it
through `const hot = import.meta.hot`, so a route module no framework
plugin accepted (a `.ts` route file, or an app without
`@vitejs/plugin-react`) reloaded the page on every edit.
The React HMR code also declared a top-level `const hot`, which made a
route file with its own `hot` binding fail with `Duplicate declaration
"hot"`. Both now read `import.meta.hot` directly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(router-plugin): keep the user's `hot` binding in the module under test
Split, the component reading `hot` moves to its chunk, and with it the
user's `const hot`, so the served route module no longer holds the
binding the HMR code could collide with. Serve the route unsplit and
assert the declaration is still there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(router-plugin): omit browser warnings from production bundles
* fix(router-plugin): only the bundler's mode keeps the warning out of the page
The code splitter always passes isProduction, so the NODE_ENV fallback in the compiler was reachable only from direct test calls. The changeset now names the bug users see.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(router-plugin): real webpack and Rspack production builds ship no splitter warning
Builds an app whose route exports its component, with mode 'production' and with mode left out, and checks that no emitted JS names the app's absolute path. Fails on main. Replaces the fake-compiler matrix in router-plugin-context.test.ts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Sheraff <me@florianpellet.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(router-plugin): split routes' source maps point at the route file
Real webpack and Rspack builds, and Vite's dev server: a throw in a split
component, and in code it shares, maps to its line in the route file, and
the map names the route file rather than its ?tsr-split / ?tsr-shared id.
Fails on main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(router-plugin): point split routes' source maps at the route file
- Require unplugin ^3.5.0: its webpack/Rspack transform loader dropped a
plugin's map when no earlier loader passed one (unjs/unplugin#626).
- Name the route file, not the ?tsr-split / ?tsr-shared module id, as the
source of split and shared modules' maps.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(router-plugin): wait for the compiler to close before removing the app
runCompiler settled before compiler.close finished, so the test could remove
the app while webpack or Rspack was still shutting down, and a close error
went unreported.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore: require Node ^20.19.0 || >=22.12.0 in engines
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore: say why the Node engines range narrows in the changeset
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The option was undocumented. The webpack and Rspack entries overwrote it
with `'webpack'`, and on Vite `'webpack'` emitted `import.meta.webpackHot`,
which broke route HMR. The HMR style is now an internal parameter: the
composed plugin derives it from the bundler unplugin reports, and the
standalone webpack/Rspack code-splitter entries pass `'webpack'`.
Split out of #8817.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(router-plugin)!: remove `compilerPlugins` and splitter internals from the root entry
Remove the experimental `codeSplittingOptions.compilerPlugins` hook and
stop exporting the Babel splitter's internals from the package root:
`unpluginRouterCodeSplitterFactory`, `getObjectPropertyKeyName`,
`CodeSplitCompilerPlugin`, `ReferenceRouteCompilerPlugin`,
`ReferenceRouteCompilerPluginContext` and
`VirtualRouteSplitNodeCompilerPluginContext`.
Split out of #8817.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore: make the changeset a patch
The removed option and exports were internal, not public API.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(router-plugin): throw on autoCodeSplitting with esbuild
The esbuild plugin silently bundled every route without splitting when
`autoCodeSplitting` was enabled. It now throws a clear error, and
`TanStackRouterCodeSplitterEsbuild` always throws. Route generation is
unchanged. Extracted from #8817.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(router-plugin): drop autoCodeSplitting from the esbuild skill example
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Disabling route generation also silently disabled autoCodeSplitting,
because the code splitter relies on route metadata populated by the
generator. Remove the option instead of patching the interaction, so the
generator always runs.
Closes#5087
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@tanstack/intent 0.5.4 rejects SKILL.md links that resolve outside the
owning package, which fails the "Validate intent skills" CI job. Replace
those relative links with `<package>#<skill>` identifiers that
`intent load` resolves regardless of node_modules layout.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test: format compiler output before comparing file snapshots
The router-plugin and start-plugin-core compiler snapshots record the
layout choices of the code generator (object wrapping, blank lines,
parentheses around JSX) along with the emitted program, so swapping the
code generator rewrites most snapshot files even when the output is the
same.
Format the output with Prettier before comparing it: fixed options,
`objectWrap: 'collapse'`, and blank lines outside template literals
removed. Comments are kept. Output that does not parse is compared as is.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: regenerate compiler snapshots with formatted output
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: format inline compiler snapshots before comparing them
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(router-plugin, start-plugin-core): cover compiler output regressions
Add engine-agnostic regression tests for compiler output found while
reviewing the compiler migration (#8504). They only use the public
compiler entry points and validate emitted code with Vite's Oxc
transform/parser (TypeScript erased, parsed as a JS module with semantic
checks), so they run unchanged against any compiler implementation.
router-plugin:
- every emitted code-splitter module stays valid for re-exported imports,
partially exported destructuring and anonymous default exports
- self-/mutually-referencing side effects stay in the reference module
- namespace imports used by `import X = ns.X` and decorator placement
before `export` are preserved
- React Refresh hoisting keeps closures in scope, hoists the root route
component, and declares hoisted components before use
start-plugin-core:
- self-referencing user code survives client and server compilation
- nested and switch-case createServerFn keep provider modules valid
- aliased createClientOnlyFn re-exports are transformed in SSR
- Hydrate split modules: parent/fallback-only bindings are removed, text
children render decoded entities, `'use client'` stays first
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test: require hoisting and declared bindings in compiler regression tests
- The React Refresh ordering test now requires the inline pendingComponent
to be hoisted instead of passing when it stays inline, since main hoists it
and React Refresh needs a top-level binding.
- The self-referencing side-effect tests also assert that each binding the
callbacks use is still declared. The module validator does not report
references to undeclared names. The Start variant now validates the module.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-plugin, start-plugin-core, router-generator, react-start-rsc): cover compiler edge cases
Engine-agnostic tests through public compiler entry points, passing on
main. They cover:
- code-splitter module state shared with exported functions, `var`
declared inside top-level statements, long method chains, duplicate
split keys, split options that read `Route`, route options declared
in a variable, re-exports, type-only syntax, private class members,
and namespace JSX tags
- the code-splitter plugin pipeline: analysis cache keys and eviction,
plugin-level `splitBehavior`, config `deleteNodes`, and the
non-split HMR plugin for Solid and Vue
- the route generator transform with parenthesized call parts, and
byte-exact edits after a BOM or astral characters
- the Start compiler: dev-mode server function ids, provider
directives, handler name versioning, provider export removal,
cross-module factory resolution, invalidation, and diagnostic
locations
- Hydrate children with block-bodied callbacks, self-closing
boundaries, captures, split attributes, and the virtual module cache
- import-protection exports, member-chain boundaries, source-mapped
locations, and executed denied-import rewrites
- RSC CSS transform import shapes and argument unwrapping
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(start-plugin-core): port Next.js server actions fixtures to createServerFn
Translate the scenarios of Next.js's server-actions transform fixtures
(crates/next-custom-transforms/tests/fixture/server-actions) to the
createServerFn client, SSR caller and provider outputs: captured module
bindings, shadowing, destructuring, handler forms, directives, export
forms, non-ASCII names and client/server-only code side by side.
The destructuring default and computed-key cases pass on main and fail
with the Yuku compiler (#8504), which keeps every sibling of a live
destructuring and with it a server-only import in the client output.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-plugin): port Next.js SSG and React Router route-chunk splitting scenarios
Translate edge cases from Next.js's SSG transform fixtures and React Router's
route-chunks / remove-exports tests into code-splitter coverage: imports used
in JSX positions, shadowed names, transitive pruning of every declaration
kind, destructurings and multi-declarator statements split across groups,
mutually recursive shared helpers, nested-scope dependency analysis, helpers
shared with the loader, top-level calls on imports and split chunk source
maps. All scenarios already behave correctly; these tests pin them.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(start-plugin-core, router-plugin): port Qwik optimizer extraction edge cases
Port capture and extraction scenarios from the Qwik optimizer test suite
(QwikDev/qwik, packages/optimizer/core/src/test.rs) to the Hydrate split
transform, server function extraction and route code splitting. All of
them pass with both the Babel and the Yuku compiler.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-plugin, start-plugin-core): cover real-world compiler shapes
Adds regression coverage derived from a differential audit of in-repo
examples/e2e apps and open-source TanStack Router/Start apps:
- split chunks import exported route-file bindings instead of copying them
- declarations and imports only referenced from TypeScript types survive
(classic JSX runtime React imports, side-effecting initializers)
- TypeScript type and value exports sharing a name compile
- file-level JSX pragmas stay in split chunks and Start compiler output
- ambient declarations are not imported from the shared module
- chained comparisons in plain JavaScript route files keep their operands
- real-world route file names go through the code-splitter plugin pipeline
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-plugin, start-plugin-core): port React Compiler fixture shapes
Wrap component bodies adapted from the React Compiler fixture corpus into
route files and Start modules:
- split route components and Hydrate chunks render like the original for
labeled breaks, shadowing catch params and function names, destructuring
defaults, getters/computed keys, hoisted functions, optional call chains,
tagged templates and classes with static blocks/private fields
- server function handlers that read a server-only import through unusual
syntax positions keep it off the client
- unused locals with side-effectful initializers (hook calls) in shared route
modules and Hydrate chunks still run; these fail on the Yuku migration,
which removes them
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test: cover exported route variables in split chunks and JSX pragma forms
- Split chunks import exported route-file variables (contexts, stores and
caches built from private bindings) from the route module instead of
redeclaring them.
- The Start compiler keeps JSX pragmas in the Hydrate chunk, line-comment and
license-header forms, classic `@jsx` with `@jsxFrag`, and after a
`'use client'` directive.
Both pass on main and on #8504 after its fixes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(start-plugin-core): port SolidStart directive and Waku allowServer edge cases
Translate SolidStart's "use server" directive compiler tests and helpers
(type-only import specifiers, rejected server fn positions, captured
this/arguments/super/private members, id stability and opacity, Hydrate
closure captures) and Waku's allowServer transform tests (dependency
pruning, aliasing, default exports, untouched look-alikes, zero-argument
factories, trailing comments) into Start compiler coverage for React and
Solid.
The import-alias namespace test passes on main and fails on the Yuku
compiler (#8504), which deletes the aliased namespace.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-plugin): port React Refresh and solid-refresh scenarios to route HMR
Covers which route component shapes React Refresh registers after the HMR
transforms (checked with Vite's Oxc React Refresh transform), hook
signatures, @refresh reset, generated-name collisions, and the module shape
solid-refresh expects (registrable components, @refresh reload/skip,
top-level createContext).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-plugin, start-plugin-core, react-start-rsc): port @vitejs/plugin-rsc transform edge cases
Port scope, hoisting, export-shape, export * and directive scenarios from
@vitejs/plugin-rsc's transform tests (vitejs/vite-plugin-react, MIT) to the
Start compiler (server fn providers and callers, env-only functions, Hydrate
chunks), the route code splitter and the RSC CSS transforms.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test: port babel-dead-code-elimination and Turbopack tree-shaker scenarios
Port dead-code-elimination scenarios (pcattori/babel-dead-code-elimination)
and Turbopack tree-shaker analyzer fixtures (vercel/next.js) to the code
splitter and the Start compiler: import specifier pruning, initially unused
declarations and cycles, SCC removal, write-only bindings, nested patterns
with rests and defaults, empty parameter patterns, var declarations nested
in top-level statements, import attributes, typeof references, enum IIFEs,
shared mutable state and statement order in the provider.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-plugin): share compiler regression test helpers
The regression suites each re-implemented the same plumbing. Move it into
`tests/regression-helpers.ts`:
- `compileRouteModules` (reference, virtual chunks and shared module, with
optional route HMR, Solid target or file name) and `expectValidModules`,
previously copied into 12 files
- `buildAndRun`, the Vite build-and-run harness copied into 5 files
- `createCodeSplitterTransforms` and `transformWithRouteHmrPlugin`, which
drive the bundler plugins the way a bundler does
- `evaluateModule`, the JSX-to-text module evaluator copied into 3 files
No test is added, removed or renamed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(start-plugin-core): share compiler regression test helpers
The regression suites each built their own `StartCompiler`, output compiler,
Start runtime stubs and `<Hydrate>` chunk loader. Move them into
`tests/regression-helpers.ts`:
- `createStartCompiler`, `compileFor`, `compileCode` and `compileAll` (client,
SSR caller and provider outputs, validated), previously built in 10 files
- `importModule`, `callProvider`, `importSources` and `settle`, with one
minimal Start runtime instead of four variants
- `compileHydrate`, `getChunkParams`, `getChunkIds`, `loadChunk`,
`evaluateModule` and `renderChunk`, previously copied into 6 files
No test is added, removed or renamed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(react-start-rsc): share the RSC CSS transform compile helper
Both RSC CSS transform regression suites defined the same compile helper
and a copy of the module validator; move the helper into
`tests/regression-helpers.ts` and reuse start-plugin-core's validator.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-plugin): merge duplicated compiler regression tests
Remove tests whose input shape and assertions another suite already covers,
folding any unique assertion into the surviving test:
- code-splitter-real-world: the two "split chunks share exported route-file
bindings" compile checks duplicate code-splitter-exported-bindings (the
built-app check stays); "file-level JSX pragmas" duplicates the
@jsxImportSource cases of code-splitter-jsx-pragmas, which now also check
that Oxc selects the pragma's JSX runtime for every split chunk.
- ported-react-compiler-fixtures: "a catch parameter shadowing a module
binding" duplicates the plugin-rsc "next to a catch parameter of the same
name" case, which now names both sources.
- ported-nextjs-ssg: "moves one declarator of a multi-declarator statement
into the split chunk" duplicates the React Router "plain declarators" case,
which now also asserts where each declarator is declared.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(start-plugin-core): merge duplicated compiler regression tests
- The SolidStart "local types used by split children are not passed as
props" Hydrate test duplicates the Qwik "local types used by the children
are not captured as values" test; the Qwik test now also covers JSX type
arguments and asserts that no type is passed as a prop.
- start-compiler-edge-cases "does not duplicate a directive the module
already has" becomes a case of the plugin-rsc "provider module directives"
table, which also checks the prologue and module validity.
- The single test of aliased-env-only-fns.test.ts moves to the
"cross-module factory resolution" tests of start-compiler-edge-cases, where
its output is also validated.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-generator): merge the parenthesized route call transform tests
transform-parenthesized.test.ts duplicated the `transform` harness of
transform-preservation.test.ts; move its tests there.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-plugin): keep covering configs without the router plugin
Before the code-splitter transforms were shared, the real-world file-name
test resolved a Vite config that did not list the router plugin, which
covers the early return of the plugin-order check. Let the shared helper
take the config's plugins and keep that case.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-plugin): regroup compiler regression tests by behaviour
Dissolve the ported-* and code-splitter edge-case files into behaviour
files (dead code, imports/exports, module state, pragmas, route options,
scope), drop duplicate cases and vacuous assertions, and replace the five
real Vite builds with one.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(start-plugin-core): regroup compiler regression tests by behaviour
Dissolve the ported-* and start-compiler edge-case files into behaviour
files (server fn caller dead code, declaration sites, exports and
directives, handler scope, Hydrate captures, factories, user code kept),
drop duplicate cases and vacuous assertions, and compile through a single
harness. The RSC external-transform scope cases move into compiler.test.ts,
replacing react-start-rsc's ported-vite-plugin-rsc.test.tsx.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(router-generator): move transform edge cases into transform.test.ts
Merge the five parenthesized-call cases into one test next to the existing
outer-parens test and fold the remaining preservation cases into
transform.test.ts, reusing its makeNode helper.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(react-start-rsc): move RSC CSS transform edge cases into rscCssTransform.test.tsx
Keep the cases with unique coverage (the @tanstack/react-start-rsc import
source, transparent JSX wrappers, non-JSX arguments) next to the existing
tests and drop the separate helper, which imported start-plugin-core tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test: keep regression tests valid once known compiler bugs are fixed
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test: share the build and React Refresh helpers
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(start-plugin-core): link Hydrate chunks to their parent however a fix imports it
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>