Repository navigation
fix(solid,vue): import generated control-flow components under private names - #1222
Merged
jonkwheeler merged 12 commits intoNov 12, 2026
Merged
Conversation
…srx on HMR handleHotUpdate compiled every changed .tsrx file to refresh its stylesheet before checking whether a stylesheet module existed. A file imported only as `?raw` (an incomplete docs example, say) failed to compile, and Vite sent an HMR error instead of the raw update. Look the stylesheet module up first and compile only when it exists, as the Hono plugin already does. Fixes tsrx-org#566 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The shared JSX import injector always added
`import { Suspense } from '<source>'` for `@try … @pending` and
`import { Fragment } from '<source>'` for keyed fragment bodies, even
when the module already imported that name from the same source. The
duplicate declaration failed the build with "Identifier `Suspense` has
already been declared".
Skip the injected import when the module already has a value import of
the same name and local from the same source. React, Preact and Hono
share this injector.
Fixes tsrx-org#862
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…privately
The import injector added `Suspense`, `Fragment` and `TsrxErrorBoundary`
under their public names, and the generated elements referenced those
names. Any other authored binding with one of them broke the build
("Identifier `Suspense` has already been declared") for a type-only,
default, namespace or other-source import, or silently replaced the
generated element for a setup local or a `@for (const Fragment of ...)`
loop variable.
Import them as `__Suspense`, `__Fragment` and `__TsrxErrorBoundary`, as
the injector already does for `mergeRefs`, and reference those aliases
from the generated elements, including Hono's `fallbackRender` boundary.
This replaces the same-name import reuse from tsrx-org#1102, which no longer has
anything to reuse.
Vue imports `TsrxErrorBoundary` itself for the core-generated boundary,
so its injector takes the alias too, and it no longer merges that value
import into an authored `import type` declaration, where it would be
erased.
Fixes tsrx-org#1141
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…uspense
Every import injector put its imports at index 0, ahead of a
`'use client'` or `'use server'` directive, which then stopped being a
directive. Any module using `@pending`, `@catch`, a keyed fragment row,
a dynamic tag or another construct with a generated import lost its
directive; Next.js treated a `'use client'` .tsrx module as a server
component ("You're importing a module that depends on `useState` into
a React Server Component module").
Insert generated imports (and the type-only style anchors) after the
directive prologue in the core, Vue and Solid injectors.
Vue's `ensure_named_import` also counted an inline `type` specifier as
the value import, so `import { type Suspense } from 'vue'` with
`@pending` left `Suspense` unbound. Require a value specifier, and
import Vue's generated `Suspense` as `__Suspense` like the core
transform does, so the value import never redeclares an authored
binding. vue-jsx-vapor compiles the aliased element the same way.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Solid imported Show, For, Switch, Match, Errored and Loading from solid-js under their public names, and Vue imported VaporFor the same way. An authored binding with one of those names either collided with the generated import (another module's import, a type-only import) or replaced the generated element (a module or setup local, or a `@for (const Match of rows)` loop variable). Import them as __Show, __For, __Switch, __Match, __Errored, __Loading and __VaporFor, the way tsrx-org#1175 imports Suspense, Fragment and TsrxErrorBoundary. Solid's compiler treats the aliased tags as plain components, and vue-jsx-vapor compiles <__VaporFor> exactly like <VaporFor> in DOM, SSR, HMR and interop output. defineVaporComponent keeps its public name: vue-jsx-vapor's macros, HMR registration, SSR registration and interop compile all find components by that callee name. Co-Authored-By: Claude Opus 5.5 <[email protected]>
vue-jsx-vapor finds components by calls to `defineVaporComponent`, so the compiler's import of it can't take a private name the way VaporFor now does. An authored binding of that name either collided with the generated import (an import from another module) or replaced it (a module function or const), and vue-jsx-vapor's macros treat every call of the name as a component definition anyway. Report each such binding with a new code, TSRX2032: an import from anywhere but `vue-jsx-vapor`, a module function, const or class, and a local or parameter in any scope. In collect and editor mode a module-level binding keeps the name, and the compiler adds no import that would declare it again. A type-only import of `defineVaporComponent` from `vue-jsx-vapor` itself becomes the value import the components need. The error has an entry in the error tables, a row in the specification and an example the content mapper checks through TypeScript 7, which now covers Vue as well as React and Solid. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jonkwheeler
added a commit
to jonkwheeler/tsrx
that referenced
this pull request
Oct 27, 2026
…st reactive reads
Review fixes for TSRX2031:
- A top-level pattern with no key vue-jsx-vapor reads was left alone,
on the reading that the macro keeps it as a plain destructuring
parameter. But such a component gets no props option, so Vue passes
setup an empty object: `function C({ ['s']: v = 3 })` rendered `3`
with `s="A"`, and `{ 's': v }` rendered `undefined`. Every computed or
non-name key is now reported at every level.
- vue-jsx-vapor applies a default inside a destructured prop
(`{ s: { a = 3 } }`) only when the whole prop is missing, so it is lost
whenever `s` is passed without `a`. TSRX2029 now reports these too,
with its own message.
- The suggested rewrite read the prop once at setup (`const v =
props[k] ?? 3`), which goes stale when the parent changes, and `??`
also replaces `null`. The messages, TSRX2029's included, now suggest
reading the prop where it is used, for example
`{props.s === undefined ? 3 : props.s}`, or a `computed`; a kebab-case
key is read by its camelized name (`props.aB`), as Vue normalizes it.
- A key that spans lines is printed on one line instead of as `[null]`.
- The content mapper's Vue error examples use the names tsrx-org#1222 uses for
the same workspace, so whichever merges second conflicts least, and
the nested default has an example.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous commit named Solid's generated control-flow components `__Show`, `__Switch`, `__Loading` and so on. The compiler counted a tag as a component only when it started with A-Z, so those looked like host tags. Solid vetoes hoisting a subtree that renders a component, and without the veto a static `@if`, `@switch` or `@pending` subtree went to one module-level node: a component rendered twice showed one copy. Decide as JSX does instead: a tag is a host element only when its first character is a lowercase ASCII letter. Compiled on every .tsrx file in the repo, React, Preact, Hono and Vue output is byte-identical before and after, and Solid output matches tsrx-org#1175's apart from the private names. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- `declare function defineVaporComponent` declares the name, so it is
reported too.
- After any TSRX2032 the compiler adds no `defineVaporComponent` import.
A `var` in a top-level block hoists to module scope, so the import
redeclared it (TS2440) even though the binding is not at module level.
- A namespace of types only binds no value, so it is not reported.
- A quoted specifier, `{ "defineVaporComponent" as defineVaporComponent }`
from `vue-jsx-vapor`, is the compiler's own import: it is not reported,
and the compiler reuses it instead of adding the name again.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
jonkwheeler
marked this pull request as ready for review
October 28, 2026 01:05
This was referenced Nov 3, 2026
jonkwheeler
added a commit
to jonkwheeler/tsrx
that referenced
this pull request
Nov 6, 2026
tsrx-org#1175 and tsrx-org#1222 import `Suspense` as `__Suspense`, so the test failed once either was merged with this branch. The name isn't what it's about. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jonkwheeler
added a commit
that referenced
this pull request
Nov 12, 2026
…pins (#1296) * fix(vue): leave Vue's slot flag out of the type-only @pending boundary `vue-jsx-vapor` 3.2.29 types a component's `v-slots` from its real slots, so the `_` flag on `Suspense` is an excess property and every `@try` with `@pending` reports TS2322 in the editor. The flag only matters at runtime, so keep it in compiled output and drop it from the type-only print. * chore(vue): bump vue to 3.6.0-rc.14 and vue-jsx-vapor to 3.2.29 Moves every dev pin, and adds `vue-jsx-vapor` as a dev dependency of `@tsrx/vue` so its peer stops resolving to 3.2.14 in the lockfile. Runs the Vue runtime tests on the real `vue-jsx-vapor` runtime instead of a hand-copied shim. The shim had the #870 bug and lacked `normalizeVaporSlots`, which the new compiler output imports, so it would have hidden the fix. * test(vue): run the worker regression in a worker-like scope The test matched text: it looked only at the first mention of `__VUE_HMR_RUNTIME__` and rejected only uses at column 0, so an indented, unguarded `createRecord` after one guarded use passed. It now runs the served module with `self` and none of Vue's globals, and checks what it posted. * test(vue): pin the Suspense slot flag in compiled output Nothing failed when `_: 1` was dropped from compiled output. Pin it there and pin its absence from type-only output, for both ways `@pending` is lowered. Correct the changeset and 4a43094's message: `vue-jsx-vapor` rejects the flag from 3.2.20, not 3.2.29, and leaving it out clears the error from 3.2.22. 4a43094's "the flag only matters at runtime" is also unsupported: removing it fails no runtime test, and I haven't shown what depends on it. * chore(vue): drop an unused paths entry from the plugin test tsconfig Nothing in the project imports Vue's Vapor browser build. Only `vue-runtime-shim.js` does, and that file isn't part of the project. `tsc` reports the same with and without the entry. * test(vue): move the Suspense slot flag test to its own file At the end of `type-only-types.test.js` it conflicted with #1177, which changes the lines before it. * test(vue): stop the slot flag test passing on missing output The type-only assertion was only a negative match, so it also passed if the `Suspense` boundary was gone. Require the boundary, and no compile errors, before checking that the flag is absent. * test(vue): let the slot flag test accept a private Suspense name #1175 and #1222 import `Suspense` as `__Suspense`, so the test failed once either was merged with this branch. The name isn't what it's about. * style(vue): format the slot flag test * fix(vue): require vue 3.6 and vue-jsx-vapor 3.2.27 as peers Raise the floors in all five packages that declare them: `@tsrx/vue`, `@tsrx/vue-runtime`, `@tsrx/vite-plugin-vue`, `@tsrx/rspack-plugin-vue` and `@tsrx/bun-plugin-vue`. `vue >=3.6.0-0` admits the 3.6 prereleases and rejects 3.5, which has no Vapor. The old `>=3.5` rejected every 3.6 prerelease under npm, so no Vapor setup installed with npm's defaults. `vue-jsx-vapor` 3.2.27 is the first release with the fixes for both #186 (3.2.26) and #870 (3.2.27). Minor, because a project on `vue-jsx-vapor` 3.2.26 that installs today under pnpm's `strict-peer-dependencies` fails after this. * docs(vue): name Vue 3.6 in the install commands `vue` alone installs Vue's `latest`, 3.5.45, which has no Vapor: with pnpm, `vite build` then fails with MISSING_EXPORT. Name `vue@^3.6.0-0`, which picks the newest 3.6 prerelease now and stable 3.6 once it ships. * docs(changeset): drop the 3.2.20 to 3.2.22 notes from the slot flag changeset With `vue-jsx-vapor` 3.2.27 as the floor, every supported version rejects the flag, and every one accepts the output without it. * docs(changeset): say which Vue prereleases the new floor admits `>=3.6.0-0` admits 3.6.0's prereleases, not later ones such as 3.6.1-alpha. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jonkwheeler
added a commit
that referenced
this pull request
Nov 12, 2026
…2031) (#1231) * refactor(vue): take the TSRX2028 and TSRX2029 messages from the core error table #1125 wrote both Vue messages inline in the transform. They are now TSRX_ERRORS.TARGET_COMPONENT_READ_BEFORE_DECLARATION and TSRX_ERRORS.TARGET_PROP_DEFAULT_UNSUPPORTED in @tsrx/core/diagnostics, taking the target's name like the other TARGET_* entries, so tools that load the tables see them. The messages are unchanged. Every table entry needs an example in the content mapper's error examples, so those now run Vue too, in a vue/ directory configured like the Vue target fixture, and both new entries have one. Each shows once through TypeScript 7. Related: #1202 * fix(vue): report a destructured prop key vue-jsx-vapor misreads (TSRX2031) vue-jsx-vapor's props macro reads a destructured prop by its key's name and ignores whether the key is computed, so `{ [k]: v }` declared and read a prop literally named `k`, dropping any default. It also skips a key that is not a name (a string or number literal, or a computed expression), which leaves that binding undefined once it reads any other prop from the pattern, and always inside a nested pattern. TSRX reported none of these, and TSRX2029 skipped computed keys. Wrapped Vue components now report TSRX2031 at each such key, mirroring the macro: a computed name anywhere in the props pattern, and any other non-name key in a pattern the macro reads (a top-level pattern with a name key or a rest element, or any nested pattern). A top-level pattern with no key the macro reads stays an ordinary destructuring parameter, which works, so it is left alone. The message suggests reading the prop from a props parameter, with an example built from the key and the binding (`const v = props[k] ?? cfg.size`). TSRX2031 follows #1223's TSRX2030. TSRX2029 now builds its example the same way, so a renamed prop (`{ s: size = cfg.size }`) suggests `const size = props.s ?? cfg.size`. * fix(vue): report every misread prop key and nested default, and suggest reactive reads Review fixes for TSRX2031: - A top-level pattern with no key vue-jsx-vapor reads was left alone, on the reading that the macro keeps it as a plain destructuring parameter. But such a component gets no props option, so Vue passes setup an empty object: `function C({ ['s']: v = 3 })` rendered `3` with `s="A"`, and `{ 's': v }` rendered `undefined`. Every computed or non-name key is now reported at every level. - vue-jsx-vapor applies a default inside a destructured prop (`{ s: { a = 3 } }`) only when the whole prop is missing, so it is lost whenever `s` is passed without `a`. TSRX2029 now reports these too, with its own message. - The suggested rewrite read the prop once at setup (`const v = props[k] ?? 3`), which goes stale when the parent changes, and `??` also replaces `null`. The messages, TSRX2029's included, now suggest reading the prop where it is used, for example `{props.s === undefined ? 3 : props.s}`, or a `computed`; a kebab-case key is read by its camelized name (`props.aB`), as Vue normalizes it. - A key that spans lines is printed on one line instead of as `[null]`. - The content mapper's Vue error examples use the names #1222 uses for the same workspace, so whichever merges second conflicts least, and the nested default has an example. * fix(vue): report a defaulted props parameter and a rest element inside a prop More shapes vue-jsx-vapor's props macro compiles wrongly, checked at runtime in the new props-params runtime test: - It skips a props parameter with a default (`{ s } = {}` or `props = {}`), so the component gets no prop options and Vue passes it no props: `v` is always undefined. TSRX2031 now reports it at the default and suggests removing it, since Vue always passes a props object. - It gives the props pattern's last rest element the component's attrs, even inside a prop, and an array's rest element the whole array, so in `{ t: { a, ...r } }` or `{ t: [a, ...r] }` `r` held `other`, not `b`. TSRX2031 reports those. A prop's object rest followed by the pattern's own rest is read right and still compiles. - The examples for a value inside a prop use optional chaining (`props.t?.a`), since the prop can be missing. * fix(vue): report every rest element inside a prop The previous commit accepted a prop's object rest followed by the pattern's own rest (`{ t: { a, ...r }, ...rest }`), where vue-jsx-vapor emits `createPropsRestProxy(__props.t, ['a'])`. That runs once at setup, so when the parent replaces `t`, `a` follows and `r` keeps the old rest; `{ t: [{ a, ...r }], ...rest }` goes stale the same way. TSRX2031 now reports every rest element inside a prop, whatever its order. A rest element of the props themselves still compiles. The runtime test replaces `t` from a parent to show the stale rest. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Solid's transform keeps main's memoized @switch, ref-prop imports and createMemo/untrack specifiers, with the control-flow components still imported under their private names. diagnostics.js and the spec list this branch's TSRX2032 after main's TSRX2027-2031 (2032 is still free on main), and the Solid and shared tests keep main's expectations (inline statics, the @catch value binding, keyed={false}) with the private `__Show`, `__Errored`, `__Loading` and `__For` names. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
…ests This branch imports Solid's Show, For, Switch, Match, Errored and Loading and Vue's VaporFor under `__` names. Tests main added since (the static @if fallbacks from tsrx-org#1129, the @{ } block bodies from tsrx-org#1128, the memoized @switch, the untracked @Try body, and the keyed-array @for from tsrx-org#1135) matched the public names; they now match the private ones. The memoized @switch also imports `createMemo` from solid-js, so the generated import no longer fits on one line and the printer wraps it. The shared generated-import check and the @switch memo test now read an import across lines. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
…s params test Main's tsrx-org#1231 added a runtime test that imports `defineVaporComponent` from `vue` and calls it directly, so vue-jsx-vapor's props macro sees the patterns as written. This branch reports every binding of that name other than an import from `vue-jsx-vapor` (TSRX2032), because the compiler imports it from there for each component it wraps and a second binding would collide. Import it from `vue-jsx-vapor`, as the compiler does; the macro still finds the calls by name. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
jonkwheeler
added a commit
to jonkwheeler/tsrx
that referenced
this pull request
Nov 12, 2026
Main's tsrx-org#1222 imports Solid's control-flow components under private names through CONTROL_FLOW_LOCALS. The import injector keeps this branch's iterable-helper import and its single CREATE_MEMO_INTERNAL_NAME specifier (for @switch and destructured @for rows) and maps the control-flow names through CONTROL_FLOW_LOCALS. The tests expect `<__For each={__for_items(…)}`, including this branch's for-of-any-iterable test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
jonkwheeler
added a commit
to jonkwheeler/tsrx
that referenced
this pull request
Nov 12, 2026
Main added TSRX2032 (tsrx-org#1222), so this branch's TSRX2035 code, its two messages, and its spec rows follow it. The content mapper's error examples keep main's TSRX2032 entry ahead of this branch's two warning entries. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
jonkwheeler
added a commit
to jonkwheeler/tsrx
that referenced
this pull request
Nov 12, 2026
Main added TSRX2032 (tsrx-org#1222), so this branch's TSRX2033 follows it in diagnostics.js and the spec's code list. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
jonkwheeler
added a commit
to jonkwheeler/tsrx
that referenced
this pull request
Nov 12, 2026
Main added TSRX2032 (tsrx-org#1222), so this branch's TSRX2034 follows it in diagnostics.js and the spec's code list. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1175; review the commits after b1809e0; merge after #1175.
Summary
Solid and Vue import their generated components under private names (#1199). #1175 did this for the shared injector (React, Preact, Hono). Solid's and Vue's own injectors still imported public names: Solid's
Show,For,Switch,Match,ErroredandLoadingfromsolid-js, and Vue'sVaporForfromvue-jsx-vapor. An authored binding with one of those names broke the build or took the generated element's place.Before → after, compiling with
@tsrx/solid/@tsrx/vueand transforming with Vite'stransformWithOxc:import { Show } from './my-show'with@ifIdentifier `Show` has already been declared<__Show>import type { For } from 'solid-js'with@forIdentifier `For` has already been declaredconst Show = …with@if … @else@ifrenders through the localShowconst Errored = 'mine'with@try … @catch'mine'<__Errored>@for (const Match of rows) { @switch … }<Match>names the row; Solid throwscreateComponent: expected a component function but got objectimport { VaporFor } from './my-for'with a keyed@forIdentifier `VaporFor` has already been declared<__VaporFor>import type { VaporFor } from 'vue-jsx-vapor'with a keyed@forIdentifier `VaporFor` has already been declared(on main: merged into the type-only import and erased)import { defineVaporComponent, VaporFor as __VaporFor } from 'vue-jsx-vapor'is a separate value importconst VaporFor = …Solid's JSX compiler only special-cases these names to auto-import them when they are unbound, so
<__Show>and the rest compile as ordinary components. vue-jsx-vapor compiles<__VaporFor>exactly like<VaporFor>(DOM, SSR, HMR and interop output compared, apart from the name).A tag counts as a component unless it starts with a lowercase letter, as in JSX. The compiler counted a tag as a component only when it started with A–Z, so
__Show,__Switchand__Loadinglooked like host tags. Solid vetoes hoisting a subtree that renders a component; without the veto, a static@if,@switchor@pendingsubtree went to one module-level node, and a component rendered twice showed one copy.is_component_jsx_name,is_component_like_elementandis_component_like_jsx_namenow treat any first character outsidea–zas a component. I compiled all 79.tsrxfiles in the repo with every target before and after this change: React, Preact, Hono and Vue output is byte-identical, and Solid output matches main and #1175 apart from the private names. An authored tag such as<_Card>is now a component too, as JSX treats it. Separately,is_composite_jsx_elementintransform/scoping.js(which elements get the scope class) still keys off A–Z; it only sees authored tags, so I left it.Vue's
defineVaporComponentkeeps its public name, and a module can't declare its own (TSRX2032). vue-jsx-vapor finds components by that callee name, so__defineVaporComponent(…)loses:{ rows, title = 'x' }loses itspropsoptions;compiler.hmr.defineComponentName);_defineVaporSSRComponentandssrRegisterHelperare not emitted);interopmode (it compiles to VDOM).The last two have no option in vue-jsx-vapor 3.2.14. Following the #1073/#1125 rule for code vue-jsx-vapor would compile wrongly, an authored binding named
defineVaporComponentis now a compile error with a new code,TSRX2032, that names the reason:import { defineVaporComponent } from './my-helpers'Identifier `defineVaporComponent` has already been declaredfunction defineVaporComponent(x) { return x; }(or aconst)const defineVaporComponent = …in a component (or any other local or parameter)declare function defineVaporComponent(…), a namespace with a value, orif (…) { var defineVaporComponent }declare namespace defineVaporComponent { type … }(types only)import { "defineVaporComponent" as defineVaporComponent } from 'vue-jsx-vapor'Identifier `defineVaporComponent` has already been declared(the compiler added the name a second time)import type { defineVaporComponent } from 'vue-jsx-vapor'Identifier `defineVaporComponent` has already been declared(on main: merged into the type-only import and erased)import { defineVaporComponent } from 'vue-jsx-vapor'; no errorAn import of
defineVaporComponentfromvue-jsx-vaporitself, plain or quoted, is still the binding the compiler uses. In collect and editor mode the compiler adds nodefineVaporComponentimport once it has reported TSRX2032, so TypeScript reports no duplicate declaration on top of it. The promoted type-only specifier is printed without a location, like a name the compiler adds, so Organize Imports maps no edit of that import back to the source.TSRX2032 has an entry in
@tsrx/core/diagnostics(TSRX_ERRORS.DEFINE_VAPOR_COMPONENT_BINDING, code keyTARGET_RESERVED_NAME), a row in the specification's error-code appendix, a sentence inllms.txt, and an example in the content mapper's error examples. That suite checks each error through the TypeScript 7 language server, and now has a Vue workspace beside React and Solid.Verification
packages/tsrx/tests/shared/compile.js), now also run for Solid (all six components) and Vue (VaporFor): for each, an authored value import from the same source, a type-only import, an inline type import, a default, namespace and other-module import, a moduleconstand a setup local. Each asserts no TypeScript redeclaration diagnostic, a private value import and private generated tags. Plus Solid's@for (const Match of rows)around@switch. 57 cases, all failing on fix(core): import generated Suspense, Fragment and TsrxErrorBoundary under private names #1175's head.import type { VaporFor } from 'vue-jsx-vapor'stays type-only and the generated names get a separate value import. Failed before.defineVaporComponent: an import from another module, a module function, a declared function, a moduleconst, a namespace with a value, avarin a top-level block and a component local each throw TSRX2032 in a strict compile, and report exactly one TSRX2032 at the binding in collect mode and in the editor compile (compile_to_volar_mappings), with no generated import. A types-only namespace and a quoted import fromvue-jsx-vaporreport nothing in all three modes.import type { defineVaporComponent },import { type defineVaporComponent }andimport type { defineVaporComponent, VaporForProps }fromvue-jsx-vaporbecome value imports with no error in all three modes, and a type-only import in a module without components stays type-only. The content-mapper example shows TSRX2032 once through the TypeScript 7 language server, with no TypeScript error on it.@if,@for,@switch,@pendingor@catchsubtree reads no binding, rendered twice, shows two copies. The@if,@switchand@pendingcases showed one copy before the component-name change, and all five pass with fix(core): import generated Suspense, Fragment and TsrxErrorBoundary under private names #1175's public names.@switcharms with a loop variable namedMatch(threw before) and an@if … @elsebeside a setup-localShow(rendered through the local before); Vue renders a keyed@forbeside a setup-localVaporFor(rendered the local before).npx vitest run: 10195 passed, 2 failed: 5–6s timeouts incontent-mappertargets.test.js and native-resolution.test.js (they spawntsc), which pass when rerun alone (7 tests). All five targets' compile and runtime projects pass (4330 tests).pnpm typecheckclean,pnpm changeset:checkpasses, Prettier clean on changed files.Related
Fixes #1199
Related: #1141, #1175, #1073, #1125
🤖 Generated with Claude Code
Note
Medium Risk
Compiler output and import shapes change for all Solid/Vue control-flow and Vue
defineVaporComponenthandling; mis-detection could still affect hoisting or macro wrapping, but behavior is heavily regression-tested.Overview
Solid and Vue no longer emit generated control-flow imports under public names that authors might shadow. Solid maps
@if/@for/@switch/@tryoutput to__Show,__For,__Switch,__Match,__Errored, and__Loadingwith matchingimport { … as __… } from 'solid-js'. Vue emits__VaporFor(VaporFor as __VaporFor) so local bindings, type-only imports, and loop variables likeMatchdo not collide or replace generated markup.Component detection in core now follows JSX: a tag is a component unless its first character is a lowercase ASCII letter, so names like
__Showand<_Card>are not treated as host elements—fixing incorrect static hoisting when the same static control-flow subtree is rendered twice.Vue reserves
defineVaporComponent: any other binding with that name raisesTSRX2032(DEFINE_VAPOR_COMPONENT_BINDING); type-only imports fromvue-jsx-vaporare promoted to the value import the compiler needs. Docs, error examples, and shared/runtime tests are updated for the new names and diagnostics.Reviewed by Cursor Bugbot for commit 034526d. Bugbot is set up for automated code reviews on this repo. Configure here.