From ab61dcc3ee161a23b95eb0b931231188a3ffd113 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 17:33:34 +0000 Subject: [PATCH] chore: ride solid rc.16 Bump solid-js / @solidjs/web / @solidjs/compiler / @solidjs/babel-plugin to 2.0.0-rc.16 and fix the two things the bump surfaced: - JSX source locations pointed into the code the native prelude (primitive names, lazy, refresh) had reprinted. Map them back through the prelude's sourcemap on both compiler backends; the primitives pass's own locations are already authored positions and are kept. - Start mode's production containFailure now reports through @solidjs/web's reportRequestFailure (kind 'request'), so an error the runtime already reported is not heard a second time under rc.16's per-kind ledger. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_019zVakGXNk835Dj1yu5kGgE --- .changeset/solid-rc16.md | 5 + README.md | 7 +- examples/start-ssr/test/run.mjs | 15 ++- package.json | 14 +-- pnpm-lock.yaml | 174 ++++++++++++++++---------------- pnpm-workspace.yaml | 28 ++--- src/index.ts | 19 +++- src/source-names.test.ts | 8 ++ src/source-names.ts | 33 ++++++ src/ssr/index.ts | 24 ++--- 10 files changed, 191 insertions(+), 136 deletions(-) create mode 100644 .changeset/solid-rc16.md diff --git a/.changeset/solid-rc16.md b/.changeset/solid-rc16.md new file mode 100644 index 0000000..5d27fe9 --- /dev/null +++ b/.changeset/solid-rc16.md @@ -0,0 +1,5 @@ +--- +'@solidjs/vite-plugin': patch +--- + +Require solid-js / @solidjs/web 2.0.0-rc.16 (peer floor) and compile with @solidjs/compiler / @solidjs/babel-plugin rc.16. rc.16 adds `reportRequestFailure` to @solidjs/web, and start mode's production handler now reports a contained failure (a middleware throw, a `setup` failure) through it, so the `configureServerErrors` hook hears it as `{ kind: 'request', handling: 'failed', event }` — and not at all when the runtime already reported that error (an uncaught in-process server-function call stays `server-function`/`thrown`), where rc.16's per-kind ledger would otherwise have heard it twice. JSX source locations (`sourceNames.locations`, which rc.16's compilers emit) now point at the authored source on both compiler backends: the JSX transform runs after the primitive-names, `lazy()` and refresh passes have reprinted the module, so its positions are mapped back through those passes' sourcemap. diff --git a/README.md b/README.md index 4b4f788..ecbe858 100644 --- a/README.md +++ b/README.md @@ -486,9 +486,10 @@ Whatever escapes the chain is settled at the handler edge. A thrown counts as a failure. In a production build any other failure (a middleware throw, a `setup` failure, or an invalid `event.renderMode` / `event.nonce`) is contained by the handler instead of rejecting to the host. It is reported once to the hook -registered with `configureServerErrors` from `@solidjs/web`, with the site -a failed render reports (`{ kind: 'render', handling: 'failed' }` and the -request `event`), or logged with `console.error` when no hook is +registered with `configureServerErrors` from `@solidjs/web` (through its +`reportRequestFailure`: `{ kind: 'request', handling: 'failed' }` and the +request `event`; an error the runtime already reported is not heard +again), or logged with `console.error` when no hook is registered, and the client gets a bodyless 500. That 500 carries the headers and cookies written to the request event only while the response head is still open: once `next()` has returned a rendered page, the head diff --git a/examples/start-ssr/test/run.mjs b/examples/start-ssr/test/run.mjs index e6a3051..0d25fcf 100644 --- a/examples/start-ssr/test/run.mjs +++ b/examples/start-ssr/test/run.mjs @@ -3798,7 +3798,7 @@ async function runContainmentChecks( const failures = heardFor(secret); return ( failures.length === 1 && - failures[0].kind === 'render' && + failures[0].kind === 'request' && failures[0].handling === 'failed' && failures[0].event === true ); @@ -3806,7 +3806,7 @@ async function runContainmentChecks( record( mode, 'contain', - 'configureServerErrors hook hears the failure once (render/failed, with the event)', + 'configureServerErrors hook hears the failure once (request/failed, with the event)', failedOnce('mw-throw-secret') && failedOnce('late-throw-secret'), JSON.stringify(heard), ); @@ -3814,7 +3814,7 @@ async function runContainmentChecks( record( mode, 'contain', - 'a start.setup failure reaches the hook once (render/failed, with the event)', + 'a start.setup failure reaches the hook once (request/failed, with the event)', failedOnce('setup-throw-secret'), JSON.stringify(heard), ); @@ -3954,16 +3954,15 @@ async function runMiddlewareMode() { ); // Dev containment is the thrown-Response half only: the catch answers // a thrown Response or envelope and rethrows everything else to - // Vite's error middleware. Reporting (reportServerError from - // solid-js/internal) and the bodyless 500 are build-only. + // Vite's error middleware. Reporting (reportRequestFailure) and the + // bodyless 500 are build-only. record( 'mw-codegen', 'gen', - 'dev handler catch rethrows failures (no reportServerError, no synthesized 500)', + 'dev handler catch rethrows failures (no reportRequestFailure, no synthesized 500)', code.includes('function containFailure') && code.includes('throw error') && - !code.includes('reportServerError') && - !code.includes('solid-js/internal'), + !code.includes('reportRequestFailure'), ); // The generated entry-server threads start.setup: awaited with the // request event before renderToStream, its result (or App) rendered. diff --git a/package.json b/package.json index fad8758..e95199e 100644 --- a/package.json +++ b/package.json @@ -63,8 +63,8 @@ "dependencies": { "@ampproject/remapping": "^2.3.0", "@babel/core": "^7.23.3", - "@solidjs/babel-plugin": "^2.0.0-rc.14", - "@solidjs/compiler": "^2.0.0-rc.14", + "@solidjs/babel-plugin": "^2.0.0-rc.16", + "@solidjs/compiler": "^2.0.0-rc.16", "@types/babel__core": "^7.20.4", "merge-anything": "^5.1.7", "vitefu": "^1.0.4" @@ -77,9 +77,9 @@ "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-node-resolve": "^15.2.3", "@skypack/package-check": "^0.2.2", - "@solidjs/diagnostics": "2.0.0-rc.14", + "@solidjs/diagnostics": "2.0.0-rc.16", "@solidjs/start-devtools": "^1.0.0-next.3", - "@solidjs/web": "^2.0.0-rc.14", + "@solidjs/web": "^2.0.0-rc.16", "@types/node": "^24.0.0", "cypress": "^14.0.0", "cypress-visual-regression": "^5.2.2", @@ -88,16 +88,16 @@ "prettier": "^3.1.0", "rollup": "^4.5.0", "rollup-plugin-cleaner": "^1.0.0", - "solid-js": "^2.0.0-rc.14", + "solid-js": "^2.0.0-rc.16", "typescript": "^5.2.2", "vite": "^8.2.1", "vitest": "^4.1.11" }, "peerDependencies": { "@solidjs/start-devtools": "^1.0.0-next.2", - "@solidjs/web": "^2.0.0-rc.14", + "@solidjs/web": "^2.0.0-rc.16", "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.0.0 || ^7.0.0", - "solid-js": "^2.0.0-rc.14", + "solid-js": "^2.0.0-rc.16", "vite": "^8.0.0 || ^9.0.0" }, "peerDependenciesMeta": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 28e2249..da9efc9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,11 +7,11 @@ settings: catalogs: default: '@solidjs/web': - specifier: ^2.0.0-rc.14 - version: 2.0.0-rc.14 + specifier: ^2.0.0-rc.16 + version: 2.0.0-rc.16 solid-js: - specifier: ^2.0.0-rc.14 - version: 2.0.0-rc.14 + specifier: ^2.0.0-rc.16 + version: 2.0.0-rc.16 importers: @@ -24,11 +24,11 @@ importers: specifier: ^7.23.3 version: 7.29.7 '@solidjs/babel-plugin': - specifier: ^2.0.0-rc.14 - version: 2.0.0-rc.14(@babel/core@7.29.7)(@tsrx/core@0.1.63) + specifier: ^2.0.0-rc.16 + version: 2.0.0-rc.16(@babel/core@7.29.7)(@tsrx/core@0.1.63) '@solidjs/compiler': - specifier: ^2.0.0-rc.14 - version: 2.0.0-rc.14 + specifier: ^2.0.0-rc.16 + version: 2.0.0-rc.16 '@testing-library/jest-dom': specifier: ^5.16.6 || ^5.17.0 || ^6.0.0 || ^7.0.0 version: 6.10.0(@testing-library/dom@10.4.1) @@ -64,14 +64,14 @@ importers: specifier: ^0.2.2 version: 0.2.2 '@solidjs/diagnostics': - specifier: 2.0.0-rc.14 - version: 2.0.0-rc.14(@solidjs/web@2.0.0-rc.14(solid-js@2.0.0-rc.14))(solid-js@2.0.0-rc.14)(vitest@4.1.11) + specifier: 2.0.0-rc.16 + version: 2.0.0-rc.16(@solidjs/web@2.0.0-rc.16(solid-js@2.0.0-rc.16))(solid-js@2.0.0-rc.16)(vitest@4.1.11) '@solidjs/start-devtools': specifier: ^1.0.0-next.3 - version: 1.0.0-next.4(@solidjs/web@2.0.0-rc.14(solid-js@2.0.0-rc.14))(solid-js@2.0.0-rc.14) + version: 1.0.0-next.4(@solidjs/web@2.0.0-rc.16(solid-js@2.0.0-rc.16))(solid-js@2.0.0-rc.16) '@solidjs/web': - specifier: ^2.0.0-rc.14 - version: 2.0.0-rc.14(solid-js@2.0.0-rc.14) + specifier: ^2.0.0-rc.16 + version: 2.0.0-rc.16(solid-js@2.0.0-rc.16) '@types/node': specifier: ^24.0.0 version: 24.13.3 @@ -97,8 +97,8 @@ importers: specifier: ^1.0.0 version: 1.0.0(rollup@4.62.2) solid-js: - specifier: ^2.0.0-rc.14 - version: 2.0.0-rc.14 + specifier: ^2.0.0-rc.16 + version: 2.0.0-rc.16 typescript: specifier: ^5.2.2 version: 5.9.3 @@ -113,10 +113,10 @@ importers: dependencies: '@solidjs/web': specifier: 'catalog:' - version: 2.0.0-rc.14(solid-js@2.0.0-rc.14) + version: 2.0.0-rc.16(solid-js@2.0.0-rc.16) solid-js: specifier: 'catalog:' - version: 2.0.0-rc.14 + version: 2.0.0-rc.16 devDependencies: '@solidjs/vite-plugin': specifier: workspace:* @@ -129,10 +129,10 @@ importers: dependencies: '@solidjs/web': specifier: 'catalog:' - version: 2.0.0-rc.14(solid-js@2.0.0-rc.14) + version: 2.0.0-rc.16(solid-js@2.0.0-rc.16) solid-js: specifier: 'catalog:' - version: 2.0.0-rc.14 + version: 2.0.0-rc.16 devDependencies: '@solidjs/vite-plugin': specifier: workspace:* @@ -145,10 +145,10 @@ importers: dependencies: '@solidjs/web': specifier: 'catalog:' - version: 2.0.0-rc.14(solid-js@2.0.0-rc.14) + version: 2.0.0-rc.16(solid-js@2.0.0-rc.16) solid-js: specifier: 'catalog:' - version: 2.0.0-rc.14 + version: 2.0.0-rc.16 devDependencies: '@solidjs/vite-plugin': specifier: workspace:* @@ -161,10 +161,10 @@ importers: dependencies: '@solidjs/web': specifier: 'catalog:' - version: 2.0.0-rc.14(solid-js@2.0.0-rc.14) + version: 2.0.0-rc.16(solid-js@2.0.0-rc.16) solid-js: specifier: 'catalog:' - version: 2.0.0-rc.14 + version: 2.0.0-rc.16 valibot: specifier: ^1.1.0 version: 1.4.2(typescript@5.9.3) @@ -186,14 +186,14 @@ importers: dependencies: '@solidjs/web': specifier: 'catalog:' - version: 2.0.0-rc.14(solid-js@2.0.0-rc.14) + version: 2.0.0-rc.16(solid-js@2.0.0-rc.16) solid-js: specifier: 'catalog:' - version: 2.0.0-rc.14 + version: 2.0.0-rc.16 devDependencies: '@solidjs/testing-library': specifier: ^1.0.0-beta.2 - version: 1.0.0-beta.2(@solidjs/web@2.0.0-rc.14(solid-js@2.0.0-rc.14))(solid-js@2.0.0-rc.14) + version: 1.0.0-beta.2(@solidjs/web@2.0.0-rc.16(solid-js@2.0.0-rc.16))(solid-js@2.0.0-rc.16) '@solidjs/vite-plugin': specifier: workspace:* version: link:../.. @@ -211,14 +211,14 @@ importers: dependencies: '@solidjs/web': specifier: 'catalog:' - version: 2.0.0-rc.14(solid-js@2.0.0-rc.14) + version: 2.0.0-rc.16(solid-js@2.0.0-rc.16) solid-js: specifier: 'catalog:' - version: 2.0.0-rc.14 + version: 2.0.0-rc.16 devDependencies: '@solidjs/testing-library': specifier: ^1.0.0-beta.2 - version: 1.0.0-beta.2(@solidjs/web@2.0.0-rc.14(solid-js@2.0.0-rc.14))(solid-js@2.0.0-rc.14) + version: 1.0.0-beta.2(@solidjs/web@2.0.0-rc.16(solid-js@2.0.0-rc.16))(solid-js@2.0.0-rc.16) '@solidjs/vite-plugin': specifier: workspace:* version: link:../.. @@ -1368,8 +1368,8 @@ packages: resolution: {integrity: sha512-T4Wyi9lUuz0a1C2OHuzqZ0aFOCI0AmaGTb2LP9sHgWdoHXlB3JU02gfBpa0Y081G/gFsJYpQ/R0iCJRzF/nknw==} hasBin: true - '@solidjs/babel-plugin@2.0.0-rc.14': - resolution: {integrity: sha512-zMbK1GMHnChgfnalS5Q6rwPeQ9UoC7snavzes90R7+6J+8Fa7Yq4AfgqrfaAKYAjlpMgT0E8AmVwYCdIvSsG/A==} + '@solidjs/babel-plugin@2.0.0-rc.16': + resolution: {integrity: sha512-BGktwp90c5+acKPg3AhuoJlVxmY2FMqLx4TaHPtz50hU7jzAwhmuRURdK4eteTeA+gBtNN/tqunK67At7I1HEA==} peerDependencies: '@babel/core': ^7.20.12 '@tsrx/core': 0.1.63 @@ -1377,50 +1377,50 @@ packages: '@tsrx/core': optional: true - '@solidjs/compiler-darwin-arm64@2.0.0-rc.14': - resolution: {integrity: sha512-WiOnnVov6XfT7QG9OrgqWfoJMrUYYbjO88qMzJ09tijV6Phu+BoeK2J3I0B3IpPPrOTMQ2mXpcwdvnSLuAtWdw==} + '@solidjs/compiler-darwin-arm64@2.0.0-rc.16': + resolution: {integrity: sha512-XS2YYSiNLfxK3cTXaTs4GWz9HU4jjezL+G3rWcGP7A7H3jnTHukbQSV2CoslH4ZD5GrcSyllfj/LrW9FC0Xv9g==} cpu: [arm64] os: [darwin] - '@solidjs/compiler-darwin-x64@2.0.0-rc.14': - resolution: {integrity: sha512-pW1kmlbkRLjLBnsDL+lF8LKrdjK141uCYt2RFNcodud/JOqIWTMK3v+zULeJelqbQX78CjhQ5xz0V2ApKb6UsA==} + '@solidjs/compiler-darwin-x64@2.0.0-rc.16': + resolution: {integrity: sha512-m/mr1+w2MpF9g+xF+Df5RABV637OFZF0KteCRM/iWfr15JRhn3qaMTl8SOrJ0vYng+b4XiRb6clUdcOCg9Imew==} cpu: [x64] os: [darwin] - '@solidjs/compiler-linux-arm64-gnu@2.0.0-rc.14': - resolution: {integrity: sha512-2d8F8x4sBae7DQHi9wholdzHir8UsHVHpPRPj4NRr4seD5rWkpIbQ3Pwk/9FMZoM4KZmCZ+6+SInQm7iGALgTw==} + '@solidjs/compiler-linux-arm64-gnu@2.0.0-rc.16': + resolution: {integrity: sha512-9ky/nAbWT587MQ094B+5CtMuA3NuLN2Il44yjVxikyAMPrSVoAvW53AFNq28reKSaLyzUcu3ajlllNXN4zBJig==} cpu: [arm64] os: [linux] - '@solidjs/compiler-linux-x64-gnu@2.0.0-rc.14': - resolution: {integrity: sha512-dXt4PJeEKSD07X/k5PcsFczxJLof72hEw3aVu8S0WBWh+KTYjYx9tg3Hnnl0KntR61PyphUjwIOICsWWsgKQTA==} + '@solidjs/compiler-linux-x64-gnu@2.0.0-rc.16': + resolution: {integrity: sha512-w4R5FBh8wj1hDBTRGghev4Izb3mY5WQJKkh3t12LbUYv9Q/RgQLRJ0HCdgusA0M3pbmZa9+tNo/jC+kOcGkCcA==} cpu: [x64] os: [linux] - '@solidjs/compiler-wasm32-wasi@2.0.0-rc.14': - resolution: {integrity: sha512-cTaAmM7Ca6JisgvnqsLT9Fce4sDmonCaTvBb5eF2iEfdt8htFZ2Z9RlUEK2yG6LxCN89/K/vZLbI7giLA4HUjw==} + '@solidjs/compiler-wasm32-wasi@2.0.0-rc.16': + resolution: {integrity: sha512-waYVk1KOGfAAS0e2Y2F/g2pPxK5SKZGY8o9MzpYvw63vdohf2aM4dOztQ5PXhdj9EwBsNkCfs108LXQxmKHyZA==} engines: {node: '>=14.0.0'} - '@solidjs/compiler-win32-x64-msvc@2.0.0-rc.14': - resolution: {integrity: sha512-JosTalJd6Pgb8mjNgPCEauQSOi647Vlm2mS0qvO3hYLvzcrODmrYsHIY1/DqbI1FxQdc9vUOKJ5zCHvhjlScuA==} + '@solidjs/compiler-win32-x64-msvc@2.0.0-rc.16': + resolution: {integrity: sha512-EruXUf1LlFl/Wz1API7+EgKrrjwGWnvc5LsRBOIDZeL4lijVxFUWuhu2If+Mwi6zFDojIImJau9o155n+3tfKw==} cpu: [x64] os: [win32] - '@solidjs/compiler@2.0.0-rc.14': - resolution: {integrity: sha512-eCTVcxXl1UHOisRMYg+hABwiiTkfTmSkaOFtAb8bjzeqpLlju3lo6pT2qWPfUbrvnslbNGnLZd+HZSIVgZu9VQ==} + '@solidjs/compiler@2.0.0-rc.16': + resolution: {integrity: sha512-WRnqxb3LHvR8XiQuETxI++BVdLZOPougnN50kZhwiHLODIc4orUFFlx6hC0Jt2aurO5LZCjSxStGEHVHeo7maQ==} - '@solidjs/diagnostics@2.0.0-rc.14': - resolution: {integrity: sha512-PrBdpVTN7krHz5Lv+Cwa1q+vuhpQjwUG/WWFa3fed5JNlx4EmIBTdReeegQm4o3h+JWFo5eQZ8tf6dPjXnL8UQ==} + '@solidjs/diagnostics@2.0.0-rc.16': + resolution: {integrity: sha512-XZQuXhXov+BeNs1xQyG1ffsDWN9qB0AV45nmH+M448HGiQ8T0T/e2ep2uSyditgF0oy7BTl4AQYEK1VdiSG31w==} peerDependencies: - '@solidjs/web': ^2.0.0-rc.14 - solid-js: ^2.0.0-rc.14 + '@solidjs/web': ^2.0.0-rc.16 + solid-js: ^2.0.0-rc.16 vitest: '>=2.0.0' peerDependenciesMeta: vitest: optional: true - '@solidjs/signals@2.0.0-rc.14': - resolution: {integrity: sha512-s3v1wpPcX3wfNO0WUERrPrXS+qqJ4ylzH9QTIRKqrgcMVeLEOXgFa3hZrhEoVTp+lVAgido2NH6GCI79twe2fg==} + '@solidjs/signals@2.0.0-rc.16': + resolution: {integrity: sha512-WPMb8FuAVKyzF6sIgZn/c89V69VS3R4DtCnOoaS1ZXy5Uos9K/8yrclyQkG6kqkN3ubtPiPnaPfdjt/jfsi4qQ==} engines: {node: '>=22.12.0'} '@solidjs/start-devtools@1.0.0-next.4': @@ -1436,11 +1436,11 @@ packages: '@solidjs/web': '>=2.0.0' solid-js: '>=2.0.0' - '@solidjs/web@2.0.0-rc.14': - resolution: {integrity: sha512-MhHqUoVBdgAG7EZOANx7Y5SuCFH7sBxzt9uBSYLpJxE503tqoi7pX1UhV7PWxw4LvmPe1PZkdkSOZ8BLchZkhQ==} + '@solidjs/web@2.0.0-rc.16': + resolution: {integrity: sha512-dWbRvG8PlcXelWYdoOmyJwItFPrPSsppUbOJ/RLrQhesQD3sEL9BTRUi8vdXyi+rdA8klYvxJtB43/BTqxJcbw==} engines: {node: '>=22.12.0'} peerDependencies: - solid-js: ^2.0.0-rc.14 + solid-js: ^2.0.0-rc.16 '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} @@ -2849,8 +2849,8 @@ packages: resolution: {integrity: sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==} engines: {node: '>=10'} - solid-js@2.0.0-rc.14: - resolution: {integrity: sha512-fmaqUHgbITf18Hedur6gPnaPE4GrdPgkTbLujHqM5Vl5jxWf9rxwFh6hZMXQs+Kg1pu8KYuOMfqnuSizFQ9I6Q==} + solid-js@2.0.0-rc.16: + resolution: {integrity: sha512-GtrX+ieB9ctN2eQ0raDOHAHZBpFPoMn98gCsUn6YD5hz0xSou3zzV4J3Hti6xclvvrnPIFO8NJ+kk+pXbuXPHg==} engines: {node: '>=22.12.0'} source-map-js@1.2.1: @@ -4453,7 +4453,7 @@ snapshots: kleur: 4.1.5 yargs-parser: 20.2.9 - '@solidjs/babel-plugin@2.0.0-rc.14(@babel/core@7.29.7)(@tsrx/core@0.1.63)': + '@solidjs/babel-plugin@2.0.0-rc.16(@babel/core@7.29.7)(@tsrx/core@0.1.63)': dependencies: '@babel/core': 7.29.7 '@babel/helper-module-imports': 7.18.6 @@ -4464,63 +4464,63 @@ snapshots: optionalDependencies: '@tsrx/core': 0.1.63 - '@solidjs/compiler-darwin-arm64@2.0.0-rc.14': + '@solidjs/compiler-darwin-arm64@2.0.0-rc.16': optional: true - '@solidjs/compiler-darwin-x64@2.0.0-rc.14': + '@solidjs/compiler-darwin-x64@2.0.0-rc.16': optional: true - '@solidjs/compiler-linux-arm64-gnu@2.0.0-rc.14': + '@solidjs/compiler-linux-arm64-gnu@2.0.0-rc.16': optional: true - '@solidjs/compiler-linux-x64-gnu@2.0.0-rc.14': + '@solidjs/compiler-linux-x64-gnu@2.0.0-rc.16': optional: true - '@solidjs/compiler-wasm32-wasi@2.0.0-rc.14': + '@solidjs/compiler-wasm32-wasi@2.0.0-rc.16': dependencies: '@emnapi/core': 1.11.3 '@emnapi/runtime': 1.11.3 '@napi-rs/wasm-runtime': 1.2.3(@emnapi/core@1.11.3)(@emnapi/runtime@1.11.3) optional: true - '@solidjs/compiler-win32-x64-msvc@2.0.0-rc.14': + '@solidjs/compiler-win32-x64-msvc@2.0.0-rc.16': optional: true - '@solidjs/compiler@2.0.0-rc.14': + '@solidjs/compiler@2.0.0-rc.16': optionalDependencies: - '@solidjs/compiler-darwin-arm64': 2.0.0-rc.14 - '@solidjs/compiler-darwin-x64': 2.0.0-rc.14 - '@solidjs/compiler-linux-arm64-gnu': 2.0.0-rc.14 - '@solidjs/compiler-linux-x64-gnu': 2.0.0-rc.14 - '@solidjs/compiler-wasm32-wasi': 2.0.0-rc.14 - '@solidjs/compiler-win32-x64-msvc': 2.0.0-rc.14 - - '@solidjs/diagnostics@2.0.0-rc.14(@solidjs/web@2.0.0-rc.14(solid-js@2.0.0-rc.14))(solid-js@2.0.0-rc.14)(vitest@4.1.11)': - dependencies: - '@solidjs/signals': 2.0.0-rc.14 - '@solidjs/web': 2.0.0-rc.14(solid-js@2.0.0-rc.14) - solid-js: 2.0.0-rc.14 + '@solidjs/compiler-darwin-arm64': 2.0.0-rc.16 + '@solidjs/compiler-darwin-x64': 2.0.0-rc.16 + '@solidjs/compiler-linux-arm64-gnu': 2.0.0-rc.16 + '@solidjs/compiler-linux-x64-gnu': 2.0.0-rc.16 + '@solidjs/compiler-wasm32-wasi': 2.0.0-rc.16 + '@solidjs/compiler-win32-x64-msvc': 2.0.0-rc.16 + + '@solidjs/diagnostics@2.0.0-rc.16(@solidjs/web@2.0.0-rc.16(solid-js@2.0.0-rc.16))(solid-js@2.0.0-rc.16)(vitest@4.1.11)': + dependencies: + '@solidjs/signals': 2.0.0-rc.16 + '@solidjs/web': 2.0.0-rc.16(solid-js@2.0.0-rc.16) + solid-js: 2.0.0-rc.16 optionalDependencies: vitest: 4.1.11(@types/node@24.13.3)(@vitest/browser-playwright@4.1.11)(jsdom@26.1.0)(vite@8.2.1(@types/node@24.13.3)(esbuild@0.28.2)) - '@solidjs/signals@2.0.0-rc.14': {} + '@solidjs/signals@2.0.0-rc.16': {} - '@solidjs/start-devtools@1.0.0-next.4(@solidjs/web@2.0.0-rc.14(solid-js@2.0.0-rc.14))(solid-js@2.0.0-rc.14)': + '@solidjs/start-devtools@1.0.0-next.4(@solidjs/web@2.0.0-rc.16(solid-js@2.0.0-rc.16))(solid-js@2.0.0-rc.16)': dependencies: - '@solidjs/web': 2.0.0-rc.14(solid-js@2.0.0-rc.14) - solid-js: 2.0.0-rc.14 + '@solidjs/web': 2.0.0-rc.16(solid-js@2.0.0-rc.16) + solid-js: 2.0.0-rc.16 - '@solidjs/testing-library@1.0.0-beta.2(@solidjs/web@2.0.0-rc.14(solid-js@2.0.0-rc.14))(solid-js@2.0.0-rc.14)': + '@solidjs/testing-library@1.0.0-beta.2(@solidjs/web@2.0.0-rc.16(solid-js@2.0.0-rc.16))(solid-js@2.0.0-rc.16)': dependencies: - '@solidjs/web': 2.0.0-rc.14(solid-js@2.0.0-rc.14) + '@solidjs/web': 2.0.0-rc.16(solid-js@2.0.0-rc.16) '@testing-library/dom': 10.4.1 - solid-js: 2.0.0-rc.14 + solid-js: 2.0.0-rc.16 - '@solidjs/web@2.0.0-rc.14(solid-js@2.0.0-rc.14)': + '@solidjs/web@2.0.0-rc.16(solid-js@2.0.0-rc.16)': dependencies: seroval: 1.6.7 seroval-plugins: 1.6.7(seroval@1.6.7) - solid-js: 2.0.0-rc.14 + solid-js: 2.0.0-rc.16 '@standard-schema/spec@1.1.0': {} @@ -5973,9 +5973,9 @@ snapshots: astral-regex: 2.0.0 is-fullwidth-code-point: 3.0.0 - solid-js@2.0.0-rc.14: + solid-js@2.0.0-rc.16: dependencies: - '@solidjs/signals': 2.0.0-rc.14 + '@solidjs/signals': 2.0.0-rc.16 csstype: 3.2.3 seroval: 1.6.7 seroval-plugins: 1.6.7(seroval@1.6.7) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 731cc4e..b63f7a9 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -8,27 +8,27 @@ allowBuilds: msw: true catalog: - solid-js: "^2.0.0-rc.14" - "@solidjs/web": "^2.0.0-rc.14" + solid-js: "^2.0.0-rc.16" + "@solidjs/web": "^2.0.0-rc.16" ignoredBuiltDependencies: - cypress minimumReleaseAgeExclude: - - '@solidjs/signals@2.0.0-beta.30 || 2.0.0-beta.31 || 2.0.0-beta.32 || 2.0.0-rc.0 || 2.0.0-rc.1 || 2.0.0-rc.2 || 2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' + - '@solidjs/signals@2.0.0-beta.30 || 2.0.0-beta.31 || 2.0.0-beta.32 || 2.0.0-rc.0 || 2.0.0-rc.1 || 2.0.0-rc.2 || 2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' - '@solidjs/start-devtools@1.0.0-next.1 || 1.0.0-next.2 || 1.0.0-next.3' - - '@solidjs/web@2.0.0-beta.30 || 2.0.0-beta.31 || 2.0.0-beta.32 || 2.0.0-rc.0 || 2.0.0-rc.1 || 2.0.0-rc.2 || 2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' - - '@solidjs/babel-plugin@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' - - '@solidjs/compiler@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' - - '@solidjs/compiler-darwin-arm64@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' - - '@solidjs/compiler-darwin-x64@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' - - '@solidjs/compiler-linux-arm64-gnu@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' - - '@solidjs/compiler-linux-x64-gnu@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' - - '@solidjs/compiler-win32-x64-msvc@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' - - '@solidjs/compiler-wasm32-wasi@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' - - '@solidjs/diagnostics@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14' + - '@solidjs/web@2.0.0-beta.30 || 2.0.0-beta.31 || 2.0.0-beta.32 || 2.0.0-rc.0 || 2.0.0-rc.1 || 2.0.0-rc.2 || 2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' + - '@solidjs/babel-plugin@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' + - '@solidjs/compiler@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' + - '@solidjs/compiler-darwin-arm64@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' + - '@solidjs/compiler-darwin-x64@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' + - '@solidjs/compiler-linux-arm64-gnu@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' + - '@solidjs/compiler-linux-x64-gnu@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' + - '@solidjs/compiler-win32-x64-msvc@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' + - '@solidjs/compiler-wasm32-wasi@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' + - '@solidjs/diagnostics@2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16' - '@tsrx/core@0.1.63' - - solid-js@2.0.0-beta.30 || 2.0.0-beta.31 || 2.0.0-beta.32 || 2.0.0-rc.0 || 2.0.0-rc.1 || 2.0.0-rc.2 || 2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 + - solid-js@2.0.0-beta.30 || 2.0.0-beta.31 || 2.0.0-beta.32 || 2.0.0-rc.0 || 2.0.0-rc.1 || 2.0.0-rc.2 || 2.0.0-rc.3 || 2.0.0-rc.4 || 2.0.0-rc.5 || 2.0.0-rc.6 || 2.0.0-rc.7 || 2.0.0-rc.8 || 2.0.0-rc.9 || 2.0.0-rc.10 || 2.0.0-rc.13 || 2.0.0-rc.14 || 2.0.0-rc.15 || 2.0.0-rc.16 - '@dom-expressions/babel-plugin-jsx@0.50.0-next.35 || 0.50.0-next.37 || 0.50.0-next.40 || 0.50.0-next.43' - '@dom-expressions/compiler-darwin-arm64@0.50.0-next.35 || 0.50.0-next.37 || 0.50.0-next.40 || 0.50.0-next.43' - '@dom-expressions/compiler-darwin-x64@0.50.0-next.35 || 0.50.0-next.37 || 0.50.0-next.40 || 0.50.0-next.43' diff --git a/src/index.ts b/src/index.ts index 2ed157f..d0993f5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,6 +33,7 @@ import { getJsxSourceNamesOptions, getPrimitiveNamesOptions, getSourceNames, + remapJsxLocations, requestedLocations, type LocationTarget, type ResolvedSourceNames, @@ -2621,6 +2622,18 @@ export default manifest;`; }, }; + // The prelude above reprinted the module, so the JSX transform's + // locations are positions in `code`: map them back to `source`. + const remapLocations = (output: string, filename: string) => + sourceNames.locations && code !== source + ? remapJsxLocations( + output, + code, + combineSourcemaps(maps), + toPosixPath(path.relative(projectRoot, filename)), + ) + : output; + if (options.compiler !== 'babel') { if (options.babel) { // Custom babel options reintroduce a Babel support pass hosting @@ -2642,10 +2655,11 @@ export default manifest;`; filename: nativeFilename, sourceMap: true, }); + const jsxCode = remapLocations(result.code || '', nativeFilename); maps.push(result.map); const finalCode = injectSsrModuleId( - await resolveLazyModuleUrls(this, result.code || '', id), + await resolveLazyModuleUrls(this, jsxCode, id), moduleId, !!isSsr, ); @@ -2670,10 +2684,11 @@ export default manifest;`; if (!result) { return undefined; } + const jsxCode = remapLocations(result.code || '', id); maps.push(result.map); const finalCode = injectSsrModuleId( - await resolveLazyModuleUrls(this, result.code || '', id), + await resolveLazyModuleUrls(this, jsxCode, id), moduleId, !!isSsr, ); diff --git a/src/source-names.test.ts b/src/source-names.test.ts index 26a5310..3fb3723 100644 --- a/src/source-names.test.ts +++ b/src/source-names.test.ts @@ -317,7 +317,10 @@ describe('the plugin under vite dev', () => { expect(result?.code).toContain('"Home"'); expect(result?.code).toContain('name: "count"'); if (supportsLocations) { + // Authored positions, though the prelude passes reprinted the module + // before the JSX transform saw it. expect(result?.code).toContain('"Home", "src/App.tsx:6:26"'); + expect(result?.code).toContain('loc: "src/App.tsx:4:56"'); expect(result?.code).toContain('loc: "src/App.tsx:3:29"'); } else { // (The refresh pass's own cwd-relative `location` metadata is not a @@ -334,6 +337,11 @@ describe('the plugin under vite dev', () => { const result = await server.environments.client.transformRequest('/src/App.tsx'); expect(result?.code).toContain('"Home"'); expect(result?.code).toContain('name: "count"'); + // @solidjs/babel-plugin takes `locations` whatever the native compiler + // does; the primitives pass is native, so its `loc` follows the probe. + expect(result?.code).toContain('"Home", "src/App.tsx:6:26"'); + expect(result?.code).toContain('loc: "src/App.tsx:4:56"'); + if (supportsLocations) expect(result?.code).toContain('loc: "src/App.tsx:3:29"'); expect(warnings.filter((message) => message.includes('locations'))).toEqual([]); await server.close(); }); diff --git a/src/source-names.ts b/src/source-names.ts index 6cd48f5..bd09620 100644 --- a/src/source-names.ts +++ b/src/source-names.ts @@ -6,6 +6,8 @@ * plugin's transform hooks (src/index.ts) decide when to call it. */ +import { SourceMap } from 'module'; + /** * Which source names are carried into output for the dev and observe * runtimes to label the reactive graph with (see @@ -192,3 +194,34 @@ export function getPrimitiveNamesOptions( ...(names.locations ? { root: target.root } : {}), }; } + +/** + * Point the JSX transform's locations back at the authored source. The JSX + * transform runs after the native prelude (primitive names, `lazy()`, + * refresh), which reprints the module, so the `file:line:col` it writes is a + * position in that intermediate code. `map` is the prelude's combined + * sourcemap and `input` the code the JSX transform received: a location + * already in `input` is the primitives pass's, written against the authored + * source, and is kept. `file` is the root-relative path the compilers write. + */ +export function remapJsxLocations( + code: string, + input: string, + map: object | null, + file: string, +): string { + if (!map || !code.includes(`"${file}:`)) return code; + const escaped = file.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const pattern = new RegExp(`"${escaped}:(\\d+):(\\d+)"`, 'g'); + const prelude = new Set(input.match(pattern)); + const consumer = new SourceMap(map as ConstructorParameters[0]); + return code.replace(pattern, (loc, line: string, column: string) => { + if (prelude.has(loc)) return loc; + // Nearest mapping at or before the position, on the same line: the + // offset past it carries over (one token's mapping covers its text). + const entry = consumer.findEntry(+line - 1, +column - 1); + if (!('originalLine' in entry) || entry.generatedLine !== +line - 1) return loc; + const original = entry.originalColumn + +column - entry.generatedColumn; + return `"${file}:${entry.originalLine + 1}:${original}"`; + }); +} diff --git a/src/ssr/index.ts b/src/ssr/index.ts index 0d4ae18..0630bec 100644 --- a/src/ssr/index.ts +++ b/src/ssr/index.ts @@ -1170,8 +1170,7 @@ export function startServe( const composeServerFunctions = internal.serverFunctions; const lines = [ - `import { createRequestEvent, createSSRResponse, commitEventResponse, isResponseEnvelope } from '@solidjs/web';`, - ...(isBuild ? [`import { reportServerError } from 'solid-js/internal';`] : []), + `import { createRequestEvent, createSSRResponse, commitEventResponse, isResponseEnvelope${isBuild ? ', reportRequestFailure' : ''} } from '@solidjs/web';`, `import { provideRequestEvent } from ${JSON.stringify(STORAGE_SOURCE)};`, `import * as entry from ${JSON.stringify(entryServerSpec())};`, ...(middlewarePath @@ -1586,14 +1585,13 @@ export function startServe( // failure, an invalid event.renderMode or event.nonce, a render that // throws before renderToStream returns) must not leave handleRequest: each host would // answer it its own way and the configured error policy would never see - // it. It is reported the way `failRender` reports a failed render, - // through the runtime's `reportServerError` (from solid-js/internal, as - // @solidjs/web does; there is no public entry point for request - // failures) with the site `{ kind: 'render', handling: 'failed' }` and - // the event, and to console.error when no `configureServerErrors` hook - // is registered. The runtime's ledger calls the hook once per error - // object, so a failure it already reported (an uncaught in-process - // server-function call, heard as `server-function`/`thrown`) is not + // it. It is reported through @solidjs/web's `reportRequestFailure` + // (`{ kind: 'request', handling: 'failed' }` with the event, and to + // console.error when no `configureServerErrors` hook is registered). + // The runtime hears a request failure only for an error object it has + // not reported yet, so one it already reported (a render failure, or an + // uncaught in-process server-function call, heard as + // `server-function`/`thrown`) is not // heard twice. The answer is a bodyless 500 like the endpoint's. The // edge fold below adds the stub's headers and cookies while the // response head is still open; once next() returned a rendered page, @@ -1602,16 +1600,12 @@ export function startServe( lines.push( ...(isBuild ? [ - `const SERVER_ERRORS = Symbol.for('solid-js/server/errors');`, - ``, `function containFailure(error, event) {`, ` try {`, ` const thrown = isResponseEnvelope(error) ? error.response : error;`, ` if (thrown instanceof Response && thrown.status !== 0) return thrown;`, ` } catch {}`, - ` reportServerError(error, { kind: 'render', handling: 'failed', event });`, - ` const slot = globalThis[SERVER_ERRORS];`, - ` if (!(slot && slot.hook)) console.error(error);`, + ` reportRequestFailure(error, event);`, ` return new Response(null, { status: 500 });`, `}`, ]