Skip to content

Commit 836eb49

Browse files
leonidazclaude
andauthored
Native TypeScript 7 support for .tsrx through a content mapper (#41) (#135)
* chore(content-mapper): Phase 0 baseline for native TypeScript 7 support (#41) - pin the TypeScript 7 nightly platform packages (7.1.0-dev.20260918.1) at the repository root so the native tsc binary is available without a bin conflict - add the packages/content-mapper skeleton with the consumer parity fixture, the classic tsrx-tsc reference (expected-diagnostics.json) and a test that verifies it - inventory every mapping site by mapping_data variant (MAPPING.md) - delete the dead suppressedDiagnostics plumbing: no transform in this repo or in Ripple ever produced it Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(content-mapper): TypeScript 7 content mapper for .tsrx (#41, Phase 1) - @tsrx/typescript-plugin: factor the type-only transform into a pure transform_tsrx() (src/transform.js) with no Volar types; language.js and the mapper both consume it. Export require_tsrx_compiler/get_tsrx_compiler. - @tsrx/content-mapper: stdio JSON-RPC server (initialize/openProject/ transform/closeProject), Volar mapping → span map conversion (Verbatim/Atom/ Alias, feature bits, disjoint generated spans), embedded <script> bodies as supplemental outputs, compile errors as mapper diagnostics with an export stub fallback, dynamicConfig identity/watchedFiles, option validation and a documented compiler precedence rule (entry options > tsrx.compiler > auto-detect). - Tests: unit tests for span mappings, the export stub and the mapper; native tsc --runExternalCode integration tests against the React consumer fixture, per-target fixtures for Preact, Solid, Vue and Ripple with classic/native diagnostic parity, and a third-party stub compiler that proves Alias spans show authored identifiers. Co-Authored-By: Claude Fable 5.1 <[email protected]> * test(content-mapper): CLI, build and declaration coverage for native tsc (#41, Phase 2) - declaration emit: Component.d.tsrx.ts + maps, supplemental <script> declarations as .mts modules, generics preserved, consumption of the emitted declarations from a separate project with TypeScript 5 and 7 without the mapper (allowArbitraryExtensions) - incremental: no-op second run, re-check on .tsrx edits, config-identity invalidation when the tsconfig chain changes, file add/delete/rename - --build with project references: the referencing project declares the mapper too so .tsrx inputs redirect to the library's declaration output; the composite + supplemental <script> TS6307 limitation is pinned - --watch: initial compilation asserted; the nightly never recompiles on edit on macOS (plain projects too), documented as an upstream limitation - <script> supplemental outputs switch from .ts to .mts (module scope) Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore(content-mapper): drop the vue-jsx-vapor dev dependency It resolved against a second vite instance, which broke the hono test and website typechecks with conflicting Vite types. The Vue target fixture now borrows vue-jsx-vapor from the Vite Vue plugin's install, and the lockfile is rebuilt from main plus the new entries only. Co-Authored-By: Claude Fable 5.1 <[email protected]> * refactor(content-mapper): split the stdio transport out of the executable entry (#41, Phase 3) Move the JSON-RPC framing into src/rpc.js and export the mapper, transport and protocol modules, so a host that bundles the mapper (the VS Code extension for inferred projects) can start it from its own entry without the main guard. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(language-server): native TypeScript backend mode without volar-service-typescript (#41, Phase 3) Add --typescript-backend=<classic|native> (or the typescriptBackend initialization option). On the native backend TypeScript 7 owns every TypeScript feature for .tsrx through @tsrx/content-mapper, so the server only registers the TSRX-owned plugins (snippets, CSS, symbols, auto-insert, CSS-class hover and definition, keyword highlights); the hover, definition and highlight plugins now work without typescript-semantic, and the volar-service-typescript patch is applied lazily on first classic use. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(vscode-plugin): native TypeScript 7 backend through registerContentMappers (#41, Phase 3) Add the tsrx.typescript.backend setting (auto/classic/native). On the native backend the extension activates the TypeScript 7 extension, registers the bundled @tsrx/content-mapper for inferred projects (disposed on deactivate and re-registered when that extension reloads), skips the built-in TypeScript extension patch and its useTsgo warning, and starts the TSRX language server with typescriptBackend=native. auto picks native when the TypeScript 7 extension is installed and enabled. The extension also activates on onLanguage:tsrx, declares untrustedWorkspaces.supported=false, and prompts for an extension restart when the resolved backend changes. Co-Authored-By: Claude Fable 5.1 <[email protected]> * test(content-mapper): drive the native TypeScript 7 language server for editor features (#41, Phase 3) Add tests/lsp-client.js and native-lsp.test.js: dynamic .tsrx registration, pull diagnostics, hover, definition, references, document highlights, rename (Verbatim works, Atom returns nothing), auto-import (extending an import works; a new import statement is dropped, microsoft/TypeScript#64119), compile-failure stub, two configured projects, server restart, the runExternalCode trust gate (mapper never spawned without it), and inferred projects through custom/setContentMapperContributions. Coalesce neighbouring Verbatim spans across identical gaps so a whole import statement is one edit-safe span (this is what makes the auto-import edit applicable), and drop partial-identifier Atom spans such as the file-start anchor. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(typescript-plugin): blank <script> bodies in the generated TSX (#41, Phase 3) Checking the Ripple playground with native tsc surfaced a TS1003 in virtual code: the Ripple compiler copies <script> bodies into the JSX of the element, so a '<' inside one (1 < 2) parses as a tag. The classic path only hid it because Volar drops unmapped diagnostics. Blank the body in the shared transform (same length, line breaks kept); it is checked as the embedded script / supplemental output. The consumer fixture now carries such a body so the parity, native tsc and LSP tests cover it. Record the Ripple playground parity result in the README for the Phase 4 compatibility matrix. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(editors): per-editor guides for the TypeScript 7 backend (#41, Phase 3) Document the classic and native TypeScript backends for Zed, Neovim, JetBrains IDEs and Sublime Text (which gains a README), stating per editor what is verified in this repository and what the editor can run today. The Neovim plugin gains a typescript_backend setup option that starts the TSRX server with --typescript-backend=native and registers the tsrx filetype and runExternalCode with nvim-lspconfig's tsc (TypeScript 7) config. Co-Authored-By: Claude Fable 5.1 <[email protected]> * bench(content-mapper): classic versus native benchmark harness and results (#41, Phase 4) - bench/bench.js measures cold and warm (--incremental) checks, single-edit latency through the language servers, peak process-tree RSS and process counts for tsrx-tsc/TSRX server (classic) against tsc --runExternalCode and tsc --lsp (native) on the same tsconfig, with repeated runs - tests/lsp-client.js can drive any stdio server (the classic TSRX server for push diagnostics), exposes the pid, notification listeners and extra text-document capabilities - BENCHMARKS.md records the method and five-run results for the consumer fixture (x1, x25, x100) and the Ripple playground; raw reports under bench/results/2026-09-18-macos-x64/ - the scaled fixture includes every copied importer; bench/ is typechecked Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(content-mapper): compatibility matrix for the native TypeScript path (#41, Phase 4) Every observed classic-versus-native difference classified as compiler-version, previously hidden, adapter bug (fixed), adapter design, upstream limitation or client requirement, with the pinning test or probe per row, plus the surfaces not exercised yet and the upstream items to file. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(content-mapper): release notes, migration, rollback and default-backend decision (#41, Phase 4) ROLLOUT.md is the release note for the first native TypeScript 7 release: what ships per package, the default-backend decision (classic for the CLI and language server, auto for VS Code) with the criteria for flipping it, migration steps for the CLI, VS Code and other editors, and rollback per surface. The content-mapper README's Phase 3 compatibility notes are replaced by pointers to COMPATIBILITY.md, BENCHMARKS.md and ROLLOUT.md; the language-server and VS Code READMEs and the three changesets link to them. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(content-mapper): keep type modifiers on re-exports in the compile-failure stub (#41) `export type { A } from`, `export type * from` and `export { type A } from` were re-emitted as value re-exports, so the stub for a file that already failed to compile could raise its own diagnostics under isolatedModules or verbatimModuleSyntax and importers could lose type-only names. The stub now reads the ESTree-TS exportKind on the statement and on each specifier. Review finding on #135 by Cursor Bugbot. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(content-mapper): keep the last-good AST across a project reopen (#41) openProject created a fresh lastGood map per project state, so after TypeScript reopened a project (watched tsconfig or compiler manifest change) a .tsrx file that still failed to compile got an empty export stub and its importers lost the preserved export surface. The last-good ASTs are keyed by file name and independent of the project, so they now live at the mapper level and survive reopens with the same or a new handle, and close/reopen. Review finding on #135 by Cursor Bugbot. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(content-mapper): link the filed upstream issues for TS6307 and --watch (#41) Both items in the "upstream issues still to file" list are now filed on microsoft/TypeScript after checking for existing reports and workarounds: - #64350: composite projects report TS6307 for the supplemental <script> output. Reproduced with a dependency-free mapper; no `include` glob or `files` entry can name the virtual file and referenced projects must be composite, so there is no configuration workaround. - #64351: `tsc --watch` never recompiles on macOS. Reproduced without a mapper and bisected across the nightlies to the 7.1.0-dev.20260811.1 build; `--watchFile` strategies, directory casing, symlinks and stdin state make no difference, so it is distinct from #64089. The README, COMPATIBILITY.md, ROLLOUT.md and the two pinning tests now reference the issues instead of "not filed yet". Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(typescript-plugin): support TypeScript 6 and explain the TypeScript 7 package (#41) The classic path (tsrx-tsc, the tsserver plugin, the TSRX language server) passes its whole test suite on TypeScript 6.0.3, so the `typescript` peer range becomes `^5.9.3 || ^6.0.0`. The `typescript@7` package is a launcher for the native binary without a JavaScript API: tsrx-tsc, the language server and @tsrx/content-mapper now stop with an explanation (and a pointer to the tracking issue tsrx-org/tsrx#136) instead of failing on its export map, and the mapper declares the JavaScript TypeScript it needs for tsconfig parsing as its own dependency so a TypeScript 7 project needs nothing extra. The mapper's minimum TypeScript build is `7.1.0-dev.20260822.1`, found by running the native test suite across the nightlies (`7.1.0-dev.20260821.1` rejects `--runExternalCode`, `[email protected]` has no content-mapper protocol at all); `TSRX_NATIVE_TSC` runs the suite against another build. VS Code: the TypeScript 7 extension is looked up under the ids VS Code's own TypeScript extension uses (adding `TypeScriptTeam.native-preview`) and every installed one is tried for `registerContentMappers`, because the nightly channel is a compiler-only companion. The TypeScript 7 warnings now state what the native backend needs, say that support is not complete, link the tracking issue and offer to open it. Co-Authored-By: Claude Fable 5.1 <[email protected]> * test(content-mapper): close the validation gaps of the compatibility matrix (#41) Resolution: `paths` aliases, a `.tsx` importer and a workspace package behind a `node_modules` symlink, checked against classic `tsrx-tsc` on the same workspace. Build: a chain of mapper-backed composite projects. Editors: inlay hints with every hint enabled (through `workspace/configuration`), the formatting registration TypeScript 7 makes for `.tsrx` (no edits, so Prettier must stay the `[tsrx]` default formatter), the third-party compiler under the language server, and the built TSRX server driven over stdio on both backends for CSS completion, hover, class definition, document symbols and diagnostics ownership. Lifecycle: deleting and renaming `.tsrx` files during a native session. The LSP test client answers `workspace/configuration`, advertises file watching and can report watched-file changes. `COMPATIBILITY.md` gains rows 37 to 50 and a shorter "not yet exercised" list. Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore: ignore the IntelliJ Platform sandbox in Prettier `pnpm format:check` failed on the untracked `packages/intellij-plugin/.intellijPlatform/**` files the plugin build generates; nothing in there is source. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: TypeScript 7 requirements, status and setup on tsrx.dev and in the rollout notes (#41) llms.txt and the getting-started page gain a "Type checking" section: the classic `tsrx-tsc` path on TypeScript 5.9 or 6, the native path through `@tsrx/content-mapper` on a TypeScript 7.1 nightly (`7.1.0-dev.20260822.1` or newer) with `contentMappers` and `tsc --runExternalCode`, the VS Code `tsrx.typescript.backend` setting, and the tracking issue tsrx-org/tsrx#136. ROLLOUT.md records what is true on 2026-09-19: the stable 7.0 line has no content-mapper protocol, no marketplace release of the TypeScript 7 extension exposes `registerContentMappers` yet, packaging is verified on macOS (tarball with npm and `typescript@7` outside the checkout; the VSIX's bundled mapper), the migration installs `typescript@next`, and Prettier must be the `[tsrx]` default formatter. BENCHMARKS.md adds the mapper's start-up breakdown (a third of the ~600 ms floor is TypeScript's JavaScript API). Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(typescript-plugin): the native TypeScript 7 path needs no other TypeScript (#41) A project whose only `typescript` is the native compiler's launcher package (no JavaScript API) now works with @tsrx/content-mapper and with the TSRX language server on the native backend in every editor. @tsrx/typescript-plugin reads tsconfig.json itself (`jsonc.js` on jsonc-parser: comments, trailing commas) and resolves `extends` entries and compiler packages with its own package walk (`package-resolution.js`, the rules of get-tsconfig's resolver, resolve-pkg-maps for `exports`, `.json` appended to a `tsconfig` field target as TypeScript does). The layered config reader keeps its shape (`load_tsconfig_layers(host, path)`, layers, dependencies, failures) with its own diagnostics carrying TypeScript's codes (5024, 6053, 18000). `import.meta.env.platform` flags are detected without TypeScript's scanner, and the plugin's remaining TypeScript uses are lazy: only the classic path (tsrx-tsc, the tsserver plugin, the language server's classic backend) loads TypeScript. @tsrx/content-mapper drops its `typescript` dependency and starts in about a third of the time (108 ms instead of 326 ms to import; see BENCHMARKS.md). @tsrx/language-server on --typescript-backend=native runs on Volar's plain project host and loads no TypeScript. Both are tested with the `typescript` package forbidden through a preload (`tests/forbid-typescript.cjs`): the mapper from source and from the built dist/server.js under native tsc, and the built language server over stdio. jsonc-parser is a runtime dependency of the three bundling packages (its UMD entry requires its ./impl files). Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(typescript-plugin): append .json to a relative extends path beside a same-named directory (#41) TypeScript's extends resolver appends `.json` whenever the resolved path is not a file, so `extends: "./base"` finds `base.json` even when a `base/` directory exists next to it. The directory guard here skipped the fallback in that layout and the base config was never loaded. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(typescript-plugin): keep jsonc-parser external so tsrx-tsc loads (#41) The bundle inlined the UMD `main` of `jsonc-parser`, whose internal `require('./impl/...')` calls survive bundling and then fail at runtime with "Cannot find module './impl/format'". That broke `tsrx-tsc` in the Hono test typecheck and the vite-plugin-react fixture typechecks in CI. Keep it external, as the content-mapper, language-server and VS Code bundles already do; it is a runtime dependency of this package. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(typescript-plugin): tsrx-tsc runs native tsc --runExternalCode on TypeScript 7 (#41) The typescript@7 package is a launcher without a JavaScript API, so Volar cannot host it. Instead of stopping, tsrx-tsc now resolves the launcher's @typescript/typescript-<os>-<arch> platform package the way lib/getExePath.js does and runs the native binary with --runExternalCode (after the arguments in --build mode, first otherwise), so .tsrx files are checked through @tsrx/content-mapper and one package.json script serves TypeScript 5.9, 6 and 7. Before spawning it reads the tsconfig files the invocation would use (-p/--project, the working directory, or the --build projects) through the plugin's own extends-aware reader and refuses to run one that declares no content mapper for .tsrx, since TypeScript would otherwise skip those files silently. A TypeScript 7 build without the content-mapper protocol (stable 7.0, nightlies before 7.1.0-dev.20260822.1) is still explained; the version order ranks -dev nightlies below the betas and releases they precede. @tsrx/content-mapper becomes an optional peer dependency of the plugin. tsc.test.js drives the dispatcher against a stub launcher and a recording platform binary; tsrx-tsc-native.test.js runs the wrapper end to end on the pinned TypeScript 7 binary and requires the classic diagnostics. The READMEs, ROLLOUT.md, COMPATIBILITY.md, llms.txt and the getting-started page describe the one-command story. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(typescript-plugin): tsrx-tsc checks the --build references graph and leaves unreadable tsconfigs to tsc (#41) Review follow-ups on the TypeScript 7 dispatcher. In --build mode the content-mapper guard now walks the references graph of every root (a config's own references, the one top-level key TypeScript does not inherit through extends) and checks each project that compiles sources; a solution-style config whose resolved files is empty is skipped. A config with parse diagnostics or extends failures counts as declared so tsc reports the real error instead of the guard. The --project=path form reported by the review is rejected by TypeScript itself (TS5023 on 5.9.3 and on the native binary), so only the doc comment notes it. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(typescript-plugin): a --build config with files: [] and an include is a project, not a solution (#41) TypeScript unions files and include, so the content-mapper guard's solution check now also requires that no include is set (own or inherited); verified against the native binary, which compiles and reports the included sources of such a config. Regression test in tests/tsc.test.js. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(vscode-plugin): native backend without the TypeScript 7 extension API (#41) The extension no longer looks up, activates or registers with the TypeScript 7 extension. On the native backend TypeScript 7 runs @tsrx/content-mapper for the .tsrx files each tsconfig.json declares under contentMappers, exactly as on the command line and in every other editor; the bundled mapper copy, the extension-id lookup and the registerContentMappers registration for inferred projects are gone, so a .tsrx file that no such tsconfig covers gets no TypeScript features. The auto backend now follows VS Code's own TypeScript 7 switch (js/ts.experimental.useTsgo, which the "Select TypeScript Version" picker sets). Docs point at packages/vscode-typescript in microsoft/TypeScript instead of the closed typescript-go staging repository, and say that no marketplace release of the TypeScript 7 extension supports content mappers yet. Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore: drop @typescript/native-preview, typecheck with the pinned TypeScript 7.1 binary, upgrade tsdown to 0.23 (#41) @typescript/native-preview is the retired preview package of TypeScript 7 (its last build is from July; the compiler now ships as typescript@7). pnpm typecheck runs the native tsc of the @typescript/typescript-<platform> packages already pinned as root optional dependencies, through scripts/native-tsc.js, since the root typescript must stay on the 5.x line for the tooling's JavaScript API. tsdown moves to 0.23: the six configs use deps.neverBundle, deps.alwaysBundle and deps.onlyBundle in place of the removed external, noExternal and inlineOnly options, and rolldown's comments.legal in place of legalComments. Every bundle's external imports and JavaScript output are unchanged. The re-resolution also drops the stale native-preview peer entries from the lockfile. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(vscode-plugin): the backend follows VS Code's TypeScript 7 switch, no setting of its own (#41) Remove tsrx.typescript.backend. The backend is exactly VS Code's own js/ts.experimental.useTsgo, which the "Select TypeScript Version" picker writes: off means classic, on means native. Nothing else is consulted, in particular no other extension; the warnings about mismatched settings go with the setting. Verified in isolated VS Code 1.138 instances (own user-data and extensions directories) on TypeScript 5.9.3 and 6.0.3 workspace versions (classic) and on the 7.1 nightly through a TypeScript 7 extension built from microsoft/TypeScript (native): diagnostics inside .tsrx files, hover, a .ts importer's cross-file prop-type error, go-to-definition into .tsrx and hover on the import. Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore: native-tsc runs the root typescript launcher when it is TypeScript 7, the pinned binary otherwise (#41) The regular path first: a TypeScript 7 `typescript` package at the repository root runs through its own launcher, as `npx tsc` would. The pinned platform package is only the fallback for as long as the root typescript has to stay on the 5.x line for the tooling's JavaScript API. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(vscode-plugin): host the TypeScript VS Code runs instead of a bundled copy (#41) The extension no longer bundles TypeScript. On the classic backend it resolves the TypeScript VS Code runs for the workspace, in VS Code's own order (js/ts.tsdk.path, written by "TypeScript: Select TypeScript Version" when the workspace version is picked, or its deprecated typescript.tsdk spelling, then VS Code's own copy; a directory counts only if it holds typescript.js, so a TypeScript 7 package is skipped like VS Code skips it) and passes its lib directory to the language server as the Volar-style typescript.tsdk initialization option. A change of the picked version restarts the language server in place. The server loads that installation and aliases every later require('typescript') to it, so one TypeScript runs per process; without the option it keeps loading the typescript package next to it, as other editors do. The VSIX drops from 865 files and 7.13 MB to 733 files and 6.62 MB. Verified in isolated VS Code 1.138 instances: the classic backend hosts the workspace TypeScript 5.9.3 and 6.0.3 respectively, the native backend hosts none, and no TypeScript ships in the extension. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(vscode-plugin): VS Code's own TypeScript serves .tsrx files through the contributed tsserver plugin (#41) With TypeScript 7 off, VS Code's built-in TypeScript extension now runs its tsserver with @tsrx/typescript-plugin, contributed through VS Code's typescriptServerPlugins point (enableForWorkspaceTypeScriptVersions, languages: ["tsrx"]) and shipped inside the VSIX. VS Code hands the plugin to whichever TypeScript it runs, its own copy or the workspace version, and manages .tsrx documents like .ts ones, so .ts importers resolve .tsrx modules with no tsconfig plugins entry, VS Code's own TypeScript commands and menus work on .tsrx files, and the patch of the built-in extension is gone. The extension neither bundles nor hosts any TypeScript: the tsdk resolution added earlier today is removed again (the language server keeps the typescript.tsdk option for other editors), and the redundant context-key code goes with the patch. The TSRX language server runs slim on both backends. A new plugin mode (--typescript-backend=plugin) is the native set plus TSRX compile-error diagnostics, which a tsserver plugin cannot report. The tsserver plugin itself now drops TypeScript's diagnostics for a .tsrx file while that file has a fatal compile error, as the classic server's filter did, so the compile error is reported exactly once. Verified in isolated VS Code 1.138 instances against VS Code's bundled TypeScript 6.0.3 with no settings (the case that failed before), the workspace 5.9.3 and 6.0.3 versions, and the 7.1 nightly: diagnostics inside .tsrx files, TypeScript and CSS-selector hover from exactly one provider each, no false problems, the importer's cross-file error, definition into .tsrx, and one TSRX compile error with no TypeScript noise. The stdio language-server test covers the plugin mode beside native and classic. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(editors): one rule for the tsconfig plugins entry across editors (#41) TypeScript 5.9 or 6: editors other than VS Code add @tsrx/typescript-plugin to compilerOptions.plugins so their own TypeScript server, running the workspace TypeScript, resolves .tsrx imports from .ts files; VS Code needs no entry because its extension hands the plugin to VS Code's tsserver, and tsrx-tsc hosts the plugin itself. TypeScript 7: contentMappers replaces it everywhere and plugins is ignored, so both entries can share one tsconfig. Stated in the Neovim, Zed, Sublime Text, IntelliJ and typescript-plugin READMEs, llms.txt and the getting-started page. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(vscode-plugin): never ask which TypeScript VS Code runs (#41) The extension no longer reads js/ts.experimental.useTsgo or any other signal of the TypeScript VS Code runs. VS Code's own TypeScript serves .tsrx files either way (its tsserver through the contributed plugin, or TypeScript 7 through the content mapper), and the two context keys the menus use, tsSupportsFileReferences and typescript.isManagedFile, are VS Code's own, so the extension stops setting them; its Go to Source Definition entry keys on the language alone. The TSRX language server always runs in plugin mode and reports TSRX compile errors. For a file the content mapper already reports on (TypeScript 7), the extension drops the server's copy in the language client's diagnostics middleware, and, because the mapper's diagnostics can arrive later, asks VS Code to pull the server's diagnostics again when they do. backend.js and the restart prompt are gone. Verified in isolated VS Code 1.138: with VS Code's bundled TypeScript 6.0.3 and with the 7.1 nightly, a TSRX compile error is reported exactly once, hover comes from one provider, and every other check of the suite passes. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(vscode-plugin): remember the content mapper for the session, so compile errors never double or flash (#41) Once TypeScript 7's content mapper has been seen reporting for any .tsrx file, the language server's compile-error copy is dropped for every file for the rest of the session (VS Code restarts the extension host when TypeScript 7 is switched on or off, which resets this), and every open .tsrx file is refreshed on that first sighting. Before, the filter was per file and only after the mapper had reported for that very file, so a fresh file showed the server's copy until the mapper caught up, and a file the mapper stopped reporting on kept the filtered set. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(language-server): list the component snippet once in completions (#41) The general completion path pushed the component-function snippet and then the whole directive list, which carries its own copy of that snippet for the `@` trigger, so every completion popup listed it twice. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(vscode-plugin): explain the TypeScript 7 extension's warning about the TSRX tsserver plugin (#41) Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(typescript-plugin): type-check <script> bodies as blocks in the generated TSX on every path (#41) The shared transform now appends each <script> body to the generated TSX as a block statement with an ordinary mapping back to the source, instead of blanking it and relying on Volar's extra service scripts, which only the language-server path supports; the tsserver-plugin path (VS Code by default, other editors' tsserver) silently skipped them. A block keeps one body's declarations from colliding with another's or with the component's and adds nothing to declaration output. The import declarations of a <script type="module"> body are hoisted verbatim to module level in front of its block, mapped, where TypeScript resolves them like any other import. The language plugin no longer registers script embedded codes or extra service scripts, and the content mapper no longer emits supplemental .mts outputs, so composite (--build) projects accept .tsrx files with <script> bodies (the TS6307 limitation is gone) and --declaration emits no *.tsrx.<n>.d.mts files. Script-body declarations are no longer document symbols on any path (a bare block is skipped by TypeScript's navigation tree). Verified: the existing script-body checks in the native tsc, native LSP and language-server stdio tests pass unchanged; in isolated VS Code, a type error inside a <script> body is reported at its source position exactly once, with hover, on VS Code's bundled TypeScript 6.0.3 through the plugin and on the 7.1 nightly through the mapper. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: drop the last descriptions of the patched extension and bundled TypeScript; document the plugin server mode (#41) Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: link the script-body document-symbols issue (#137) Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(typescript-plugin): blank export syntax of embedded <script> bodies; top-level await stays (#41) A <script type="module"> body may export, but a block cannot hold export syntax and nothing can import an inline script anyway, so the export keywords in front of declarations and whole re-export statements are blanked in place, keeping the body's one-to-one mapping. Top-level await inside a block of a module is legal on TypeScript 5.9 and 7.1 and is left as written. Unit tests cover hoisted imports, blanked exports and await. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: note the blanked export syntax of embedded script bodies in the changeset (#41) Co-Authored-By: Claude Fable 5.1 <[email protected]> * test(language-server): wait for the diagnostics batch that carries the compile error (#41) Volar publishes each plugin's diagnostics as they arrive, so on the classic backend the first non-empty notification can be TypeScript's alone; CI hit that once. The test now waits for the batch with the TSRX compile error. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(typescript-plugin): every blanked export form of an embedded <script> body is valid TypeScript (#41) Statements that only export (re-exports, local export lists, `export type { T }`, `export = x`) are blanked whole, so `{ value as alias }` never survives as a type assertion; `export default` becomes a same-length `const _default=` so an anonymous function or class stays a valid expression; only the keyword in front of a declaration is blanked. The blanked output of every form compiles as a block on TypeScript 5.9.3 and 7.1. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(typescript-plugin): named default exports in embedded <script> bodies keep their name in scope (#41) Only anonymous default-exported functions and classes take the const-initializer form; a named function or class declaration keeps its declaration, with just the export default keywords blanked, so later references in the body resolve. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: link the TypeScript 7 tracking issue from the plugin and editor READMEs (#41) Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(content-mapper): cover the whitespace after a span so TypeScript 7 applies import edits (#41) TypeScript's edits routinely end at the start of the line after a statement, and TypeScript 7 discards a whole workspace edit when any of its ranges does not map. Our import block span stopped at the last import's semicolon, so Organize Imports, Sort Imports and Remove Unused Imports resolved to empty edits on .tsrx files (reproduced with a minimal standalone mapper: a span one newline short turns the edit into `changes: {}`). Verbatim spans now extend over the identical whitespace that follows them, up to the next span. Verified over the protocol and in VS Code on the 7.1 nightly: both actions now change the file. Co-Authored-By: Claude Fable 5.1 <[email protected]> * test(content-mapper): expectations for spans that extend over trailing whitespace; organize-imports test uses the session client (#41) Co-Authored-By: Claude Fable 5.1 <[email protected]> * refactor(typescript-plugin): drop the unused <script> region fallback extractor (#41) Script bodies are embedded as blocks from the compiler's script mappings; the regex fallback that fed the removed script embedded codes had no caller left. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(typescript-plugin): anonymous default-exported classes with extends or implements stay expressions (#41) The named-declaration check treated the keyword after `class` as a binding name, so `export default class extends Base {}` was blanked into an unnamed class statement. Keywords are excluded; those forms take the const-initializer form again. Compiled as a block on TypeScript 5.9.3 and 7.1 in the check. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(vscode-plugin): wake VS Code's TypeScript for .tsrx-only sessions (#41) VS Code's TypeScript extensions activate only on JavaScript and TypeScript documents, and TypeScript 7 learns about .tsrx files only once a project that declares the mapper has loaded, which takes a file of that project being opened; a session where only .tsrx files are opened got no TypeScript features at all (microsoft/TypeScript#64355). An untitled TypeScript document activates the extension but belongs to no project, so it does not help. On the first .tsrx document of a directory the extension now opens the nearest .ts or .js file of the project without showing it: no editor, nothing written, nothing to close. Verified in an isolated VS Code on the 7.1 nightly with only .tsrx files opened: diagnostics, references and Organize Imports work. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(vscode-plugin): write a self-explaining wake-up file when a project has no .ts or .js file (#41) When no TypeScript or JavaScript file exists near a .tsrx file, the extension writes tsrx-wake-up.ts next to it, shows it in a preview tab, and closes and deletes it as soon as TypeScript reports on it (the file is a module with an unused local, so TypeScript's hint proves it is running and has loaded the project), when the user closes the tab, or after 30 seconds at the latest. The file's comment says not to close it and why. Verified in an isolated VS Code on the 7.1 nightly with a .tsrx-only project: written at 0.6 s, the .tsrx file served at 2.1 s, the wake-up file closed and deleted at 2.1 s. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(vscode-plugin): open the wake-up file as an inactive tab beside the .tsrx file (#41) `showTextDocument` always makes the tab active in its group, so the wake-up file briefly replaced the .tsrx file in view. The `vscode.open` command honours the `background` option, which adds the tab without activating it. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(vscode-plugin): pin the wake-up tab and wait for a TypeScript diagnostic before removing it (#41) A preview wake-up tab replaced a .tsrx tab that was itself a preview, and that tab was gone once the wake-up tab closed; the wake-up tab is now pinned. Only a diagnostic from VS Code's TypeScript (source `ts`) proves that the project has loaded, so a linter reporting the planted unused local first no longer removes the file early. Document the workaround and its removal (#138). Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore(content-mapper): version 0.1.0 for the first manual publish (#41) The release notes move from the changeset into the package CHANGELOG so the manual 0.1.0 release is not bumped again by the next Version Packages run. Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore(content-mapper): restore the changeset entry (#41) Changesets writes the CHANGELOG and tags the release; the hand-written entry is gone. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(content-mapper): the classic path stays while TypeScript 5.9 and 6 are supported (#41) Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore: minor bumps for the TypeScript 7 changesets; core and content-mapper stay patch (#41) Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(content-mapper): bundle the package exports and quote string export names (#41) Address the Bugbot review on #135: - `@tsrx/content-mapper/mapper`, `/rpc` and `/protocol` resolved to `src/`, which imports `@tsrx/typescript-plugin/src/*`; that package publishes only `dist` and is a devDependency here, so the exports failed to import from the installed tarball. Bundle them into `dist/` beside `server.js` and pin the contract with `tests/package.test.js`. - The compile-failure export stub wrote arbitrary module namespace names (`export { "foo-bar" as baz } from`, `export * as "ns-name" from`) unquoted, so the stub failed to parse. Quote non-identifier names. - The bench harness read a `--project` tsconfig with `JSON.parse`; read it with the plugin's JSONC reader and splice `contentMappers` in as an edit. Rewrite the README dependencies section, which still described a classic `typescript` peer dependency the package does not have. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(vscode-plugin): activate TypeScript through extension APIs (#41) * test(content-mapper): write multi-line sources with real line breaks Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(content-mapper): format the test fixtures with main's formatter Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content-mapper): keep code 1000 for fatal errors now that every error has a code (#41) Since #843 every TSRX error has a code, fatal ones included, so the mapper turned a fatal `Unexpected token` (TS1012) into the hashed `tsrx27582` instead of `tsrx1000`, this protocol's code for a file that could not be transformed. A fatal error is `1000` again, whatever its own code, which stays in the message. The native LSP test broke the Button with `<button type="button"><`, which is text now that a `>` in markup reads as text (#711); it uses `<button type="button" +` instead. The `to_diagnostic` unit tests and the README use current codes (`TSRX1001`, `TS1186`) in place of the removed `tsrx-*` ones. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(content-mapper): take error codes and messages from @tsrx/core's tables Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(vscode-plugin): drop the server's copy of a mistake tsserver also reports (#946, #41) On TypeScript 5.9 or 6 the extension runs the language server in `plugin` mode, where VS Code's tsserver reports TypeScript's diagnostics, so the language server's own check from #958 has no TypeScript to compare with, and a mistake the parser collects (a rest element's default, a redeclared `let`) showed twice again. `CompileErrorDedupe` now also drops a server compile error with a TypeScript code while VS Code holds a `ts` diagnostic with that code starting at the same place. It remembers the server's diagnostics per file before filtering, and a change of a `.tsrx` file's diagnostics refreshes them only when the compile errors shown differ from what the filter gives now: tsserver's copy arriving hides the server's, tsserver's copy going brings it back, and the mapper rule falls out of the same check. The tests take their codes from core's error tables, imported by path so they don't load the compiler. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): export the error tables as @tsrx/core/diagnostics `DIAGNOSTIC_CODES`, `TS_ERRORS` and `TSRX_ERRORS` without loading the compiler: `src/diagnostics.js` imports nothing. The same export goes to main in its own PR, which carries the changeset. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(content-mapper, vscode-plugin): take the error tables from @tsrx/core/diagnostics The tables only, not the whole compiler. `@tsrx/core` is a test-only dev dependency of the extension; nothing it ships imports core. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content-mapper): send TSRX codes as their numbers and leave TypeScript-coded errors to TypeScript (#41) TypeScript 7 shows each error the mapper reports as `tsrx<number>`, and the protocol takes one prefix for all of them and a number, not a code. The mapper hashed every code into 10000..99999; now: - a TSRX error goes as its code's number (`TSRX2002` → `2002`); - an error with a TypeScript code isn't sent while the file compiles: TypeScript reports the mistake from the generated code, once, with its own message and quick fixes (and the mapper's syntax-error diagnostics no longer hold back its grammar checks or type checking); - when the file doesn't compile, its error goes whatever its code, a TypeScript one as `11` then its number (`TS1005` → `111005`), keeping the code in the message; - the mapper's own errors are `771000` to `771003`. The codes and prefixes live in `@tsrx/core/diagnostics` (`MAPPER_CODES`, `TYPESCRIPT_CODE_PREFIX`, `MAPPER_CODE_PREFIX`), which the mapper's bundle inlines while the rest of `@tsrx/core` stays out of it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content-mapper): report errors under the source `TSRX`, in capitals like TypeScript's (#41) TypeScript prints a mapper's diagnostic source as-is, so the mapper's errors now show as `TSRX2002`, `TSRX111005` and `TSRX771002`, next to TypeScript's own `TS2322`, and match the TSRX language server's `TSRX` source. The VS Code extension told the mapper's errors from the language server's by the case of their source. Both are `TSRX` now, so it tells them apart by their code: TypeScript 7 takes a number as a mapper diagnostic's code, and the server's codes are strings. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(core, content-mapper, language-server, vscode-plugin): take the `TSRX` diagnostic source from @tsrx/core/diagnostics `DIAGNOSTIC_SOURCE` moves from the content mapper's protocol.js to @tsrx/core's diagnostics.js, beside the codes and prefixes, and the content mapper, the language server's compile errors and the VS Code extension all import it from `@tsrx/core/diagnostics`. The extension's build now names the rule it followed by accident: every `@tsrx/core` path stays external except `@tsrx/core/diagnostics`, which is inlined, as the content mapper's build does. Its output is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content-mapper): send every compile error, with a directive that hides TypeScript's copy (#41) The generated code can lose a mistake the parser records with a TypeScript code: modifiers are printed in their canonical order and without repeats, and a rest parameter loses its `?`, so TypeScript never reported 21 of them on TypeScript 7. The mapper now sends every error (a TypeScript code as `11` and its number) and, for each, an `ignore` diagnostic directive over the generated code of the statement, class or type member, or element that holds it. Where TypeScript reports the mistake too, or a follow-on error of a TSRX one, its copy stays hidden until the mapper's error is fixed. The ranges come from the compiler's `sourceAst` and mappings, so any target compiler gets the same; the README says what a compiler has to return. tests/error-examples.js has an example of each error in @tsrx/core/diagnostics (133), or the reason there is none (16, such as errors only compilers outside this repository raise). error-examples.test.js checks that every entry has one, that each example reports its error, and that each shows exactly once on the native language server with no TypeScript error on it. The seven that don't yet are recorded with their issues (#978, #979, #980, #981, #707) and must keep their problem until it is fixed, so a fix fails the test until its record goes. A compiler the mapper doesn't know, reporting a code TSRX doesn't have, gets the same (third-party-compiler.test.js). Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(core): let bundlers keep only the error tables a consumer reads from @tsrx/core/diagnostics Every bundle that read one export of diagnostics.js kept all of it (about 45 KB in the content mapper and the VS Code extension): the upstream message lookup was built when the module loaded, from rows that read entries of all three tables, and bundlers keep calls and property reads they can't prove free of side effects. Now nothing runs on load. The lookup and its rows are built the first time a message is looked up, the tables' calls are marked `/* @__PURE__ */`, and a TSRX entry names its code's key in DIAGNOSTIC_CODES (`tsrx('UNCLOSED_TAG', …)`, typed so a wrong key fails the typecheck) and the helper reads the code: a `DIAGNOSTIC_CODES.X` read in the arguments keeps the table in Rolldown and esbuild even when the call is pure. A consumer of the source and codes now takes 0.2–1.8 KB with Rollup, Rolldown, esbuild or webpack, with no bundler settings: 996 B in the content mapper, 553 B in the extension, 387 B in the language server. Every entry, code and message is unchanged, and a test checks that nothing in the file runs on load. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(core): throw when a TSRX error names a code DIAGNOSTIC_CODES doesn't have `tsrx()` and `tsrx_with_values()` read the code of a key through `tsrx_code()`, which throws for a key that isn't in DIAGNOSTIC_CODES, so a wrong key fails when the module loads, not only in the typecheck. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(core): check a TSRX code key with `in` Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(core): mark the four table helpers `@__NO_SIDE_EFFECTS__` instead of each call `@__PURE__` Rolldown, esbuild and Rollup drop an unused call to a function marked `/* @__NO_SIDE_EFFECTS__ */`, so the annotation goes on `with_values`, `tsrx`, `tsrx_with_values` and `mapper_code` (now a function declaration) instead of on each of their 78 calls. Bundles are the same size. The load-time check accepts calls to such functions, and no longer takes an annotation that comes after a node for one before it: the slice between them was empty, so any annotation later in the file marked every function. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content-mapper): route every console method to stderr, not only log, info, warn and debug `console.dir`, `table`, `trace`, `group` and the rest still wrote to stdout, which carries the JSON-RPC stream, so a target compiler logging with them corrupted the protocol. Each console method now takes the method of a Console whose stdout is stderr. rpc.test.js calls every method in a child process and checks that stdout stays empty. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content-mapper): export a name no declaration can have from a local binding in the compile-failure stub A local export named `null`, `if`, `string` or another reserved word or type name became `export declare const null: any`, which doesn't parse (TS1389, TS1214, TS2457), and an arbitrary module namespace name (`"foo-bar"`) was left out. Such a name is now exported from a local `_$_export_<n>` binding that is both a value and a type (`export { _$_export_0 as null }`). Re-exports already wrote any identifier name as is, which parses. The test runs TypeScript 7 on a stub with such names and an importer of each. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(core): give a `<script>` body an embedded TypeScript region only when its type makes it code (#846) Every `<script>` body became a TypeScript region, so a valid JSON or import map body got `';' expected` in the language service, and on this branch in `tsrx-tsc` too, which type-checks script bodies as blocks in the generated TSX (CI's Hono test typecheck failed on the shared fixture's JSON and import map scripts). A body is code when its `type` is absent, `module`, a JavaScript MIME type (as HTML decides, trimmed and case-insensitive), a TypeScript or JSX type that in-browser compilers run, or only known at run time; any other type is a data block and gets no region. Closes #846. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(core): let the braces script fixture name a declared global `<script>{typeof code}</script>` is valid at run time, but type checking reads the body as a block, where `code` is undeclared (TS2304), and the Hono tests' typecheck now checks script bodies. `{typeof globalThis}` is text just the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(content-mapper): load the error examples' compilers up front The first example imported `@tsrx/react` itself and timed out at 5 s when the whole suite ran at once. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(core): pin that a `<script>` type with MIME parameters is a data block, as HTML runs it HTML compares the trimmed `type` with the JavaScript MIME type essence strings as a whole, so `text/javascript; charset=utf-8` is not evaluated ("will not be evaluated, even though that is a valid JavaScript MIME type when parsed"). Co-Authored-By: Claude Opus 5.5 <[email protected]> * build: run TypeScript 7.1.0-dev.20260930.4 from the root and type-check with its tsc The root `typescript` is now the TypeScript 7.1 nightly (the new `native` catalog, `ts_native` in pnpm-workspace.yaml) instead of pinning its platform packages as root optional dependencies, so `pnpm typecheck` runs `tsc` directly and scripts/native-tsc.js is gone. The website type-checks with it too. - @tsrx/typescript-plugin and @tsrx/language-server list `typescript` from the default catalog as a devDependency: they only had the peer, which pnpm resolved from the root, and their tests need the 5.x JavaScript API. - packageExtensions give @typescript-eslint/types, @volar/typescript, @volar/language-server, @volar/language-service and volar-service-typescript an optional `typescript` peer: their declaration files import it without declaring it and resolved the root launcher, which has no types. - @ripple-ts/vite-plugin gets an optional `vite` peer the same way: it imports `vite` undeclared and took whichever Vite pnpm hoists, which changed with this lockfile and put a second copy into the website program (TS2320). - The content-mapper tests find the binary through the root launcher's platform package, as the launcher does. - tsc.test.js drops NODE_PATH for the stub project: pnpm's vitest shim points it at the hoisted packages, which now include the real platform package. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(typescript-plugin): require TypeScript 7.1.0-dev.20260923.1, whose tsc --watch recompiles MINIMUM_NATIVE_TYPESCRIPT_VERSION moves from 7.1.0-dev.20260822.1 (the first nightly with the content-mapper protocol) to 7.1.0-dev.20260923.1, the first nightly whose `tsc --watch` recompiles after an edit on macOS (microsoft/TypeScript#64351, fixed by microsoft/TypeScript#64210). The whole content-mapper suite passes on it and on 7.1.0-dev.20260930.4; tsrx-tsc now explains the nightlies in between instead of running them. native-watch.test.js no longer stops at the initial compilation: it fixes the broken .tsrx file and waits for main.ts's cross-file error, then fixes main.ts and waits for a clean pass (it times out on 7.1.0-dev.20260918.1). `tsc --build --watch` still recompiles only after `.ts` edits, not `.tsrx` edits (COMPATIBILITY.md row 51; plain `.ts` projects recompile under --build --watch, so it is specific to content-mapped files). Docs, llms.txt, the getting-started page and the changesets name the new minimum. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat: admit TypeScript 7.1 nightlies in the typescript peer range `ts_supported`, the `typescript` peer range of @tsrx/typescript-plugin and @tsrx/language-server, is now `^5.9.3 || ^6.0.0 || ^7.1.0-dev.20260923.1`: `tsrx-tsc` and the language server's native backend run on TypeScript 7 from MINIMUM_NATIVE_TYPESCRIPT_VERSION, so a project whose only `typescript` is such a nightly no longer gets a peer warning. SUPPORTED_TYPESCRIPT_RANGE stays the JavaScript API range (5.9 and 6) that the tsserver plugin and the classic backend check. typescript-version.test.js reads pnpm-workspace.yaml: `ts_supported` must be that range plus the minimum, and `ts_native` must be a supported nightly with its minimumReleaseAgeExclude entries. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(content-mapper): tsc --build --watch misses only unlisted files, as on TypeScript 6 The previous commit called `--build --watch` missing `.tsrx` edits a TypeScript 7 gap specific to content-mapped files. A standalone probe (the identity `.foo` mapper from the #64548 gist, plain `.ts` controls, TypeScript 7.1.0-dev.20260930.4 and 6.0.3) shows build mode watches the tsconfig's input files: an `include` glob matches `.foo`/`.tsrx` files once the mapper is declared and their edits recompile, while a file that is only imported is not watched, with or without a mapper, on TypeScript 6 too. The consumer fixture lists only `main.ts`, which is why Panel.tsrx edits were missed. Row 51 now records that as no difference; the README and ROLLOUT limitation bullets and the flip-criterion note are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: point the TypeScript 7 status links at #135, the document of record The TypeScript 7 gaps and their upstream issues are now recorded in the pull request that added the support (tsrx-org/tsrx#135); the former tracking issue #136 is closed. The `tsrx-tsc` and language-server messages (TYPESCRIPT_7_TRACKING_URL, renamed from TYPESCRIPT_7_TRACKING_ISSUE_URL since it is no longer an issue), the package and editor READMEs, llms.txt and the getting-started page link it. The changeset no longer mentions the VS Code extension's "Open Tracking Issue" action, which 940fb7d6 removed with the extension's TypeScript 7 messages. Co-Authored-By: Claude Opus 5.5 <[email protected]> * build(vscode-plugin): build the workspace packages the extension ships before bundling Since #877 the extension bundles @tsrx/language-server from its dist/ and copies @tsrx/typescript-plugin's dist/, but its `build` script only ran its own tsdown, so `build-and-package` packaged whatever those dist/ folders last held: current after `pnpm install` (their `prepare`) or scripts/build-if-changed.js, stale after a source edit. `build` now runs `pnpm --filter "@tsrx/vscode-plugin^..." build` first (typescript-plugin, content-mapper and language-server, each cleaning its dist/), then tsdown. The `^...` form leaves the extension itself out, so the script does not call itself; the double quotes keep cmd.exe from reading `^` as an escape. build-if-changed.js still skips when no package source changed; when it does rebuild, those packages now build once more inside the extension's build. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(vscode-plugin): manual editor tests in isolated VS Code instances `pnpm --filter @tsrx/vscode-plugin test:editor` checks the built VSIX in real VS Code: each scenario in editor-tests/scenarios.js starts a fresh instance with its own user data and extensions directories (your VS Code and settings are untouched), installs the extensions it lists, opens a copy of editor-tests/fixtures/react with its dependencies linked from the workspace, and records which TypeScript serves the `.tsrx` file (hover, definition, and a type error typed into the unsaved buffer): TypeScript 7 through the content mapper (diagnostic source `ts`), VS Code's own TypeScript through the tsserver plugin (`ts-plugin`), or nothing. The seven scenarios pass on VS Code 1.140 with TypeScript 7 extension 1.0.1: - the TypeScript 7 extension pointed at the project's 7.1 nightly with `js/ts.tsdk.path`, or given the TypeScript 7 Nightly extension, serves `.tsrx` through the mapper; - with its bundled compiler (7.0.2, no content-mapper protocol), including on its first start, which turns `js/ts.experimental.useTsgo` on by itself, nothing serves `.tsrx` (recorded as a gap); - switched off, or not installed (with or without the project's 7.1 nightly), VS Code's bundled TypeScript serves it through the plugin. The runner strips the ELECTRON_*/VSCODE_* variables of the VS Code it may run in (ELECTRON_RUN_AS_NODE makes the executable reject --user-data-dir), keeps the user data path short for VS Code's IPC socket, bounds every editor request and scenario with a timeout, and always shuts the instance down. Not part of `pnpm test` or CI; editor-tests/ is excluded from the VSIX. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(vscode-plugin): editor tests check closing tags Each scenario now also types `<b` and then `>` inside the fixture's button and records what follows, and states the expected result. On VS Code 1.140 with TypeScript 7 extension 1.0.1 the closing tag comes from the TSRX extension in every setup, exactly once, including the ones where no TypeScript serves the file. A new scenario turns `tsrx.autoClosingTags.enabled` off with the TypeScript 7 Nightly compiler: TypeScript 7 does not close tags in `.tsrx` files by itself (`<b>` stays open), so there is no second provider to clash with. The check focuses the `.tsrx` editor again before typing, since another extension may have opened an editor of its own; the report shows the typed result per scenario. All eight scenarios pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> * build: type-check the Hono tests and the playgrounds with tsc --runExternalCode `typecheck:tests` of @tsrx/vite-plugin-hono and the `typecheck` scripts of the playgrounds run the repository's TypeScript 7.1 nightly with the content mapper (`contentMappers` in their tsconfig, @tsrx/content-mapper and `typescript` from the `native` catalog as devDependencies) instead of `tsrx-tsc`, which is how our own docs tell TypeScript 7 users to type-check. TypeScript 7 checks a `.tsrx` file reached through a workspace symlink at its real path, like any TypeScript source, so the shared @tsrx/core test-harness fixtures resolve their generated imports (@tsrx/hono, the Hono JSX runtime) from packages/tsrx, which depends on neither; the repository root now lists @tsrx/hono and hono beside the other targets it already lists (COMPATIBILITY.md row 52). The untyped hook cache that TypeScript 7 reported in those tests (row 53, tsrx-org/tsrx#983) is gone since the merged #985. The React and Solid playgrounds have no `src` in the repository, so their `typecheck` reports TS18003 (no inputs) as `tsrx-tsc` did. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(core): keep a recovered unclosed tag unclosed in the type-only output In loose mode the parser recovers `<b>` without a `</b>` as an unclosed element, and the JSX transform gave it a synthesized closing tag in every output. The type-only output (editors, the content mapper, the tsserver plugin) now leaves it unclosed, as authored, like Ripple's own `to_ts` does: source: <button>{count}<b></button> type-only: <button>{count}<b></button> (was <b></b></button>) TypeScript then reports the unclosed tag (TS17008) as it does in a `.tsx` file, which loose compiles did not report at all (tsrx-org/tsrx#978), and its closing-tag completion sees an open tag: asked directly, `tsc --lsp` from TypeScript 7.1.0-dev.20260930.4 answers `$0</b>` for such a `.tsrx` file, where it answered nothing before. Hover and the other features keep working while the tag is open (checked in VS Code on TypeScript 6.0.3 and 7.1). Compiled (runtime) output is unchanged. Octane builds its editor output with this transform and gets the same behaviour; Ripple has its own `to_ts`. The shared source-mappings test that pinned the synthesized close now pins the unclosed output and keeps its mapping checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(typescript-plugin): answer TypeScript's closing-tag request in .tsrx files Volar's language-service proxy maps most position-based methods into the generated code but not getJsxClosingTagAtPosition, so tsserver read the .tsrx position against the generated TSX and found nothing. The plugin now maps that request the way Volar maps linked editing ranges. Together with the unclosed type-only output, VS Code's built-in TypeScript closes tags in .tsrx files on its own. The tsserver plugin now builds Volar's quickstart by hand so it can keep the language it creates. Editor scenarios cover VS Code's TypeScript closing a tag with TSRX's own closing off, and the control with both off. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(vscode-plugin): close tags in .tsrx files ourselves only on TypeScript 7 VS Code's built-in TypeScript now closes tags in .tsrx files through the tsserver plugin, so running the TSRX language server's closing tags beside it made two providers race for the same closing tag. They now run only while TypeScript 7 serves .tsrx files, by the check VS Code's TypeScript uses to stand down (useTsgo on and a TypeScript 7 extension installed), and follow that setting and the installed extensions. The TypeScript 7 extension does not send its closing-tag request for .tsrx files yet (microsoft/TypeScript#64564), although tsc --lsp answers it through the content mapper. TYPESCRIPT_7_CLOSES_TAGS turns the workaround off once a fixed extension ships; #989 tracks removing it. Editor scenarios: VS Code's TypeScript closing off now leaves `<b>`, and ts7-first-run shows the closing tags start once TypeScript 7 turns itself on. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(vscode-plugin): say which TypeScript compilers serve .tsrx files The native setup still said no ma…
1 parent f518cb9 commit 836eb49

200 files changed

Lines changed: 22096 additions & 2447 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tsrx/content-mapper': patch
3+
---
4+
5+
Bundle the `@tsrx/content-mapper/mapper`, `/rpc` and `/protocol` exports into `dist/` so they import from the installed package: they resolved to `src/`, which imports `@tsrx/typescript-plugin/src/*`, a path that package does not publish and that is not a dependency of the mapper. The compile-failure export stub now quotes arbitrary module namespace names (`export { "foo-bar" as baz } from`, `export * as "ns-name" from`) instead of emitting them unquoted, and the bench harness reads a `--project` tsconfig as JSONC (comments and trailing commas) and splices its `contentMappers` entry in as an edit.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tsrx/content-mapper': patch
3+
---
4+
5+
Every `console` method of the mapper process writes to stderr, not only `log`, `info`, `warn` and `debug`: `console.dir`, `table`, `trace`, `group` and the rest no longer write to stdout, where they would corrupt the protocol stream TypeScript reads.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@tsrx/core': patch
3+
'@tsrx/content-mapper': patch
4+
---
5+
6+
`@tsrx/content-mapper` reports every compile error under the source `TSRX`, in capitals like TypeScript's own `TS2322`: a TSRX error with its code's number, so it shows with its own code (`TSRX2002`) instead of a hash of the code, and an error with a TypeScript code with `11` before its number (`TS1005` shows as `TSRX111005`). The generated code can lose a mistake, such as a repeated modifier or a rest parameter's `?`, so TypeScript can't always report it itself. Where it does, an `ignore` diagnostic directive over the generated code of the statement, member or element that holds the error hides TypeScript's copy until the error is fixed, so each mistake shows once. The mapper's own errors are `771000` to `771003`. `@tsrx/core/diagnostics` exports the source, codes and prefixes as `DIAGNOSTIC_SOURCE`, `MAPPER_CODES`, `TYPESCRIPT_CODE_PREFIX` and `MAPPER_CODE_PREFIX`.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tsrx/content-mapper': patch
3+
---
4+
5+
A TSRX error inside an element that holds a `<script>` body no longer hides TypeScript errors in other components. The directive that hides TypeScript's copy of the error spanned from the element's first to its last generated code, and the body is checked at the end of the generated file, so the range covered every component in between. It now covers each piece of the element's generated code separately.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tsrx/content-mapper': patch
3+
---
4+
5+
The stub that stands in for a file that doesn't compile exports a name no declaration can have, such as `null`, `if`, `string`, or `"foo-bar"`, from a local binding, instead of declaring it (`export declare const null: any` doesn't parse) or leaving it out, so importers keep resolving it.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tsrx/core': patch
3+
---
4+
5+
`@tsrx/core/diagnostics` runs nothing when it loads, so a bundler keeps only the tables a consumer reads: a bundle that imports the diagnostic source and codes now takes under 2 KB of it instead of about 45 KB, with Rolldown, esbuild or Rollup and no bundler settings. The upstream message lookup is built the first time it is used.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tsrx/core': patch
3+
---
4+
5+
A `<script>` whose `type` makes its body data rather than code, such as `application/json`, `importmap` or `text/template`, no longer gets an embedded TypeScript region, so the language service and TypeScript 7 stop reporting TypeScript errors in valid JSON (#846). A body with no `type`, `module`, a JavaScript MIME type, a TypeScript or JSX type (`text/typescript`, `text/babel`), or a `type` only known at run time is still checked.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@tsrx/language-server': patch
3+
'@tsrx/vscode-plugin': minor
4+
---
5+
6+
The TSRX language server now formats `.tsrx` files (`textDocument/formatting`, and `textDocument/rangeFormatting` for Format Selection and format on paste) with the project's own `prettier` and `@tsrx/prettier-plugin`, on every backend and in every editor that formats through it. It adds the plugin and the `tsrx` parser itself, so a `.tsrx` file formats even when the Prettier config does not list the plugin, and it applies the project's Prettier config, `.editorconfig` and `.prettierignore`, so the editor gives the same result as the `prettier` command. When a package is missing, or Prettier is older than 3.6, the server returns no edits and shows a message once per project with the install command for the project's package manager (from the nearest lockfile: pnpm, Yarn, Bun or npm). `tsrx.format.enable: false` turns formatting off.
7+
8+
The VS Code extension makes TSRX the default formatter for `.tsrx` files through `configurationDefaults`, so the Prettier extension is no longer needed. It no longer writes `prettier.documentSelectors` and `"[tsrx]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }` into the user settings on every start. That write replaced the whole `[tsrx]` block and the whole selector list each time. Settings that older versions wrote stay until you remove them, and while they stay, the Prettier extension formats `.tsrx` files. The unused `tsrx.preferences.preferTypeOnlyAutoImports` setting is removed.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tsrx/language-server': minor
3+
---
4+
5+
Add a `native` TypeScript backend mode (`--typescript-backend=native` or the `typescriptBackend` initialization option) that leaves every TypeScript feature for `.tsrx` files to TypeScript 7 and `@tsrx/content-mapper`, serving only TSRX snippets, CSS, document symbols, auto-insert, CSS-class hover and definition, and keyword highlights; `volar-service-typescript` is loaded lazily and only on the classic backend. Migration and rollback steps, the compatibility matrix against the classic path, and benchmarks are in `packages/content-mapper/ROLLOUT.md`, `COMPATIBILITY.md` and `BENCHMARKS.md`. On the classic backend the new Volar-style `typescript.tsdk` initialization option names the TypeScript installation to host (the `lib` directory containing `typescript.js`); without it the server keeps loading the `typescript` package next to it. A third mode, `plugin` (`--typescript-backend=plugin`), is the slim native set plus TSRX compile-error diagnostics, for editors whose own tsserver serves `.tsrx` files through `@tsrx/typescript-plugin`. The component-function snippet is no longer listed twice in completions.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@tsrx/typescript-plugin': minor
3+
'@tsrx/content-mapper': patch
4+
'@tsrx/language-server': minor
5+
---
6+
7+
The native TypeScript 7 path needs no other TypeScript. `@tsrx/typescript-plugin` now reads `tsconfig.json` (with `jsonc-parser`) and resolves `extends` entries and compiler packages itself (the rules of get-tsconfig's resolver, with `resolve-pkg-maps` for `exports`) instead of through TypeScript's JavaScript API, and detects `import.meta.env.platform` flags without TypeScript's scanner; TypeScript is only loaded by the classic path (`tsrx-tsc`, the tsserver plugin, the language server's `classic` backend). `@tsrx/content-mapper` drops its `typescript` dependency and starts about three times faster; `@tsrx/language-server --typescript-backend=native` runs on Volar's plain project host and loads no TypeScript, so a project whose only `typescript` is the native compiler's launcher package works in every editor. Both are tested with the `typescript` package forbidden.

0 commit comments

Comments
 (0)