@solidjs/start 2.0.0-beta.9 → 2.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +149 -1
- package/dist/config/app-root-alias.d.ts +7 -0
- package/dist/config/app-root-alias.js +58 -0
- package/dist/config/constants.d.ts +2 -0
- package/dist/config/constants.js +2 -0
- package/dist/config/env.js +13 -10
- package/dist/config/fs-routes/index.js +3 -3
- package/dist/config/fs-routes/tree-shake.d.ts +27 -0
- package/dist/config/fs-routes/tree-shake.js +226 -33
- package/dist/config/index.d.ts +154 -5
- package/dist/config/index.js +23 -10
- package/dist/config/lazy.js +7 -2
- package/dist/config/manifest.d.ts +3 -0
- package/dist/config/manifest.js +26 -4
- package/dist/directives/remove-unused-variables.js +15 -3
- package/dist/directives/xxhash32.js +5 -13
- package/dist/fns/client.js +14 -5
- package/dist/fns/error-handler.d.ts +34 -0
- package/dist/fns/error-handler.js +10 -0
- package/dist/fns/handler.d.ts +1 -1
- package/dist/fns/handler.js +58 -12
- package/dist/fns/plugins.d.ts +34 -0
- package/dist/fns/plugins.js +33 -0
- package/dist/fns/serialization.d.ts +15 -0
- package/dist/fns/serialization.js +36 -6
- package/dist/middleware/index.js +4 -1
- package/dist/server/StartServer.jsx +1 -1
- package/dist/server/assets/render.jsx +1 -1
- package/dist/server/collect-styles.d.ts +3 -1
- package/dist/server/collect-styles.js +8 -5
- package/dist/server/fetchEvent.d.ts +10 -0
- package/dist/server/fetchEvent.js +10 -0
- package/dist/server/handler.d.ts +3 -4
- package/dist/server/handler.js +22 -56
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.jsx +1 -0
- package/dist/server/manifest/dev-client-manifest.js +1 -1
- package/dist/server/manifest/dev-ssr-manifest.js +1 -1
- package/dist/server/spa/StartServer.jsx +1 -1
- package/dist/server/spa/handler.d.ts +2 -3
- package/dist/server/spa/handler.js +2 -2
- package/dist/server/strip-path-base.d.ts +1 -0
- package/dist/server/strip-path-base.js +10 -0
- package/dist/server/types.d.ts +12 -1
- package/dist/server/web-stream.d.ts +9 -0
- package/dist/server/web-stream.js +29 -0
- package/dist/shared/ErrorBoundary.jsx +3 -3
- package/dist/shared/clientOnly.js +3 -1
- package/dist/shared/{dev-overlay → dev-toolbar/error-viewer}/CodeView.jsx +3 -3
- package/dist/shared/dev-toolbar/error-viewer/create-stack-frame.js +90 -0
- package/dist/shared/{dev-overlay/DevOverlayDialog.d.ts → dev-toolbar/error-viewer/index.d.ts} +3 -2
- package/dist/shared/{dev-overlay/DevOverlayDialog.jsx → dev-toolbar/error-viewer/index.jsx} +66 -77
- package/dist/shared/dev-toolbar/error-viewer/styles.css +224 -0
- package/dist/shared/dev-toolbar/functions/BlobViewer.css +4 -0
- package/dist/shared/dev-toolbar/functions/BlobViewer.d.ts +6 -0
- package/dist/shared/dev-toolbar/functions/BlobViewer.jsx +37 -0
- package/dist/shared/dev-toolbar/functions/FormDataViewer.d.ts +5 -0
- package/dist/shared/dev-toolbar/functions/FormDataViewer.jsx +23 -0
- package/dist/shared/dev-toolbar/functions/HeadersViewer.css +8 -0
- package/dist/shared/dev-toolbar/functions/HeadersViewer.d.ts +6 -0
- package/dist/shared/dev-toolbar/functions/HeadersViewer.jsx +15 -0
- package/dist/shared/dev-toolbar/functions/HexViewer.css +34 -0
- package/dist/shared/dev-toolbar/functions/HexViewer.d.ts +11 -0
- package/dist/shared/dev-toolbar/functions/HexViewer.jsx +70 -0
- package/dist/shared/dev-toolbar/functions/SerovalValue.css +5 -0
- package/dist/shared/dev-toolbar/functions/SerovalValue.d.ts +7 -0
- package/dist/shared/dev-toolbar/functions/SerovalValue.jsx +10 -0
- package/dist/shared/dev-toolbar/functions/SerovalViewer.css +70 -0
- package/dist/shared/dev-toolbar/functions/SerovalViewer.d.ts +6 -0
- package/dist/shared/dev-toolbar/functions/SerovalViewer.jsx +796 -0
- package/dist/shared/dev-toolbar/functions/URLSearchParamsViewer.d.ts +5 -0
- package/dist/shared/dev-toolbar/functions/URLSearchParamsViewer.jsx +22 -0
- package/dist/shared/dev-toolbar/functions/index.d.ts +13 -0
- package/dist/shared/dev-toolbar/functions/index.jsx +216 -0
- package/dist/shared/dev-toolbar/functions/styles.css +109 -0
- package/dist/shared/dev-toolbar/functions/tracker.d.ts +19 -0
- package/dist/shared/dev-toolbar/functions/tracker.js +29 -0
- package/dist/shared/{dev-overlay → dev-toolbar}/icons.d.ts +9 -0
- package/dist/shared/{dev-overlay → dev-toolbar}/icons.jsx +19 -1
- package/dist/shared/dev-toolbar/index.css +88 -0
- package/dist/shared/dev-toolbar/index.d.ts +6 -0
- package/dist/shared/dev-toolbar/index.jsx +179 -0
- package/dist/shared/ui/Badge.css +33 -0
- package/dist/shared/ui/Badge.d.ts +7 -0
- package/dist/shared/ui/Badge.jsx +7 -0
- package/dist/shared/ui/Button.css +32 -0
- package/dist/shared/ui/Button.d.ts +4 -0
- package/dist/shared/ui/Button.jsx +4 -0
- package/dist/shared/ui/Cascade.css +29 -0
- package/dist/shared/ui/Cascade.d.ts +4 -0
- package/dist/shared/ui/Cascade.jsx +4 -0
- package/dist/shared/ui/Dialog.css +25 -0
- package/dist/shared/ui/Dialog.d.ts +5 -0
- package/dist/shared/ui/Dialog.jsx +5 -0
- package/dist/shared/ui/IconButton.css +39 -0
- package/dist/shared/ui/IconButton.d.ts +4 -0
- package/dist/shared/ui/IconButton.jsx +4 -0
- package/dist/shared/ui/Placeholder.css +12 -0
- package/dist/shared/ui/Placeholder.d.ts +6 -0
- package/dist/shared/ui/Placeholder.jsx +4 -0
- package/dist/shared/ui/Section.css +18 -0
- package/dist/shared/ui/Section.d.ts +9 -0
- package/dist/shared/ui/Section.jsx +10 -0
- package/dist/shared/ui/Select.css +37 -0
- package/dist/shared/ui/Select.d.ts +4 -0
- package/dist/shared/ui/Select.jsx +4 -0
- package/dist/shared/ui/Table.css +22 -0
- package/dist/shared/ui/Table.d.ts +11 -0
- package/dist/shared/ui/Table.jsx +13 -0
- package/dist/shared/ui/Tabs.css +51 -0
- package/dist/shared/ui/Tabs.d.ts +6 -0
- package/dist/shared/ui/Tabs.jsx +6 -0
- package/dist/shared/ui/Text.css +73 -0
- package/dist/shared/ui/Text.d.ts +12 -0
- package/dist/shared/ui/Text.jsx +17 -0
- package/package.json +36 -29
- package/dist/shared/dev-overlay/createStackFrame.js +0 -56
- package/dist/shared/dev-overlay/index.d.ts +0 -5
- package/dist/shared/dev-overlay/index.jsx +0 -39
- package/dist/shared/dev-overlay/styles.css +0 -292
- /package/dist/shared/{dev-overlay → dev-toolbar/error-viewer}/CodeView.d.ts +0 -0
- /package/dist/shared/{dev-overlay/createStackFrame.d.ts → dev-toolbar/error-viewer/create-stack-frame.d.ts} +0 -0
- /package/dist/shared/{dev-overlay → dev-toolbar/error-viewer}/download.d.ts +0 -0
- /package/dist/shared/{dev-overlay → dev-toolbar/error-viewer}/download.js +0 -0
- /package/dist/shared/{dev-overlay → dev-toolbar/error-viewer}/get-source-map.d.ts +0 -0
- /package/dist/shared/{dev-overlay → dev-toolbar/error-viewer}/get-source-map.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,154 @@
|
|
|
1
1
|
# @solidjs/start
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.10
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3f2b7a7: The file filter logic used for CSS crawling in development can now be configured with the vite plugin option `css.filter` analog to `serverFunctions.filter`:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
solidStart({
|
|
11
|
+
css: {
|
|
12
|
+
filter: {
|
|
13
|
+
// Exclude all node_modules except "my-dependency" with a flat node_modules layout
|
|
14
|
+
exclude: "node_modules/!(my-dependency)/**/*",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 6581877: Fixed shared chunk css not being server rendered in production (Vite 8 regression).
|
|
23
|
+
- 37d4488: Migrate the built-in Vite configuration from the deprecated `rollupOptions` alias to `rolldownOptions`.
|
|
24
|
+
- 3f2b7a7: Fixed css from files with url sensitive characters such as `+` not being server-rendered.
|
|
25
|
+
|
|
26
|
+
## 2.0.0-rc.9
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- 8eef552: Remove type-only import remnants from client server-function transforms so they do not retain server-only dependency chains.
|
|
31
|
+
|
|
32
|
+
## 2.0.0-rc.8
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- 3573985: Await asynchronous `serverFunctions.onError` handlers before serializing server function errors.
|
|
37
|
+
Preserve the original error if the handler throws or rejects.
|
|
38
|
+
|
|
39
|
+
## 2.0.0-rc.7
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 87d73e1: chore: bump seroval to v1.6.0
|
|
44
|
+
|
|
45
|
+
## 2.0.0-rc.6
|
|
46
|
+
|
|
47
|
+
### Minor Changes
|
|
48
|
+
|
|
49
|
+
- bac24b2: Add a `serverFunctions.onError` option naming a module that observes and replaces what a server function threw, before it is serialized into the response
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- 27c2877: Remove leftover debug `console.log` calls from the server functions inspector, which logged on every server function request in dev.
|
|
54
|
+
- f15724b: Declare `@solidjs/router` as an optional peer dependency constrained to `>=0.16.0 <2.0.0-0`. Router v2 is expected to target Solid v2, so installing it alongside `@solidjs/start` v2 now surfaces a peer warning instead of silently producing an incompatible pairing. The peer is marked optional, so apps that do not use the router are unaffected.
|
|
55
|
+
- 5c8612f: Apply cookies set on a returned or thrown response during single flight mutations. `redirect(to, { headers: { "Set-Cookie": ... } })` previously only reached the browser: the single flight re-render of the redirect target still ran with the old request cookies, so queries reading that cookie saw stale values. Those cookies are now merged into the request the re-render sees, matching what a browser round trip would have sent.
|
|
56
|
+
- 83122ed: Reject server function calls when the response is a 5xx without an X-Error header, instead of resolving with the parsed error body
|
|
57
|
+
|
|
58
|
+
## 2.0.0-rc.5
|
|
59
|
+
|
|
60
|
+
### Minor Changes
|
|
61
|
+
|
|
62
|
+
- 4c803e5: Add `serialization.plugins` to configure custom Seroval plugins for server functions.
|
|
63
|
+
|
|
64
|
+
Values Seroval has no built-in support for (Mongo's `ObjectId`, Prisma's `Decimal`, `Temporal`, and other custom classes) previously threw when returned from or passed to a server function. Point the new option at a module whose default export is an array of plugins:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
// vite.config.ts
|
|
68
|
+
solidStart({
|
|
69
|
+
serialization: {
|
|
70
|
+
plugins: "src/seroval-plugins.ts",
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
// src/seroval-plugins.ts
|
|
77
|
+
import { createPlugin } from "@solidjs/start/serialization";
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The module is bundled into both the client and the server so both ends of a server function agree on the format, so it must not import server-only code. SolidStart's built-in plugins keep precedence. Only server-function and action payloads are affected; the SSR hydration payload is serialized by `solid-js/web`.
|
|
81
|
+
|
|
82
|
+
Also adds a `@solidjs/start/serialization` entrypoint re-exporting Seroval's `createPlugin`, `OpaqueReference`, and plugin types, so plugin authors stay on the same Seroval version SolidStart serializes with.
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- e117d91: Route module ids now end in the source extension, so ecosystem plugins apply inside `src/routes`.
|
|
87
|
+
|
|
88
|
+
Route files are imported through an id carrying the picked exports in the query (`routes/api.ts?pick=GET`), which left the id ending in the export name. Plugins whose filter is anchored on the file extension (`/\.[cm]?[jt]sx?$/`, the default for `unplugin-auto-import`, `unplugin-macros` and others) silently skipped every route file. The id now ends with a `lang.<ext>` marker, the same convention Vue SFCs use for `?vue&type=script&lang.ts`. Chunk filenames are unchanged.
|
|
89
|
+
|
|
90
|
+
- d8f1ea8: Apply the configured `nonce` to the two script tags that were still missing it, so a strict `script-src` CSP no longer needs `unsafe-inline`:
|
|
91
|
+
- The client-side redirect that streaming mode emits after the shell has already flushed (`<script>window.location=...</script>`) now carries the nonce.
|
|
92
|
+
- The SPA entry script tag now carries the nonce, matching the SSR entry script.
|
|
93
|
+
|
|
94
|
+
- 27fca88: Fix actions returning `json()` or `reload()` leaving no-JS form submissions stranded on the `/_server` endpoint. These responses carry a value rather than a destination, so the redirect issued for progressive-enhancement submissions had no `Location` header. It now falls back to the submitting page, and the response value is unwrapped into the flash cookie so `useSubmission().result` matches the JS path.
|
|
95
|
+
- 75debc3: Scope the built-in `~` alias to the app package, so files in other workspace packages can map `~` to their own root through an importer-aware plugin such as `vite-tsconfig-paths`. In stylesheets and asset URLs (CSS `@import`, `url()`, `new URL(..., import.meta.url)`) `~` still always means the app root, since Vite resolves those without running plugins.
|
|
96
|
+
|
|
97
|
+
## 2.0.0-rc.4
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- b6dfaac: Updated dependencies, including `cookie-es` to 3, `shiki` to 4, `srvx` to 0.12.4, `oxc-parser` to 0.141 and `seroval` to 1.5.6. `parseSetCookie` now returns `undefined` for cookies with a forbidden name or an empty name and value, and those cookies are no longer forwarded to nested server function requests.
|
|
102
|
+
- 02cd41e: Stop the dev toolbar from reporting benign `ResizeObserver loop` notifications as application errors. Browsers dispatch these as window `error` events carrying no error object, so the toolbar was capturing the raw `ErrorEvent` and force-opening the error panel over the app on every resize.
|
|
103
|
+
- d3c2af2: Don't send server error stack traces to the client in production builds. When a server function throws, the error is serialized and rethrown on the client, and seroval included `Error.prototype.stack` by default, leaking server file paths and internal function names. Stacks are still serialized in development.
|
|
104
|
+
|
|
105
|
+
## 2.0.0-rc.3
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- d9018d6: fix(types): add missing properties to `SolidStartOptions` and expose them via Vite plugin configuration
|
|
110
|
+
- e26cef0: Fix TS2883/TS2742 when emitting declarations for `entry-server.tsx`. `createHandler` now returns `StartHandler`, a type owned by `@solidjs/start`, instead of h3's `H3`, so the inferred type of `export default createHandler(...)` no longer has to be named through a nested `node_modules/@solidjs/start/node_modules/h3` path.
|
|
111
|
+
- 7c8dbe6: keep TypeScript namespace members in route files during production builds
|
|
112
|
+
- b3c7aaf: Update `h3` to `2.0.1-rc.26`.
|
|
113
|
+
- b3c7aaf: Fixed event response status and headers set during server-side rendering with deferred async resources, not being applied on the outgoing response.
|
|
114
|
+
|
|
115
|
+
## 2.0.0-rc.2
|
|
116
|
+
|
|
117
|
+
### Minor Changes
|
|
118
|
+
|
|
119
|
+
- eeff49a: add new dev toolbar
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- bd8cb01: Update srvx to version 0.12.0.
|
|
124
|
+
- 4e98ac0: Restore the optional `routerLoad` third argument to `createHandler`, which primes custom routers (e.g. TanStack Router) on the server before SSR rendering. It was accidentally dropped in the v2 rewrite.
|
|
125
|
+
|
|
126
|
+
## 2.0.0-rc.1
|
|
127
|
+
|
|
128
|
+
### Minor Changes
|
|
129
|
+
|
|
130
|
+
- 02e561e: Expose experimental `decorateHandler` and `decorateMiddleware` helpers from
|
|
131
|
+
`@solidjs/start/server` for providing Solid's request context to custom h3 handlers and
|
|
132
|
+
middleware.
|
|
133
|
+
|
|
134
|
+
### Patch Changes
|
|
135
|
+
|
|
136
|
+
- f66b5a9: fix: keep non-picked route exports that picked exports reference instead of deleting their bindings, so API handlers can call helpers exported from the same file (#2100); also fixes picked exports declared via `export { ... }` specifiers being dropped (#1659)
|
|
137
|
+
- 1763296: fix: run `onBeforeResponse` middleware in declared order (#2131)
|
|
138
|
+
|
|
139
|
+
Applications that reversed their `onBeforeResponse` arrays as a workaround should restore the intended declaration order.
|
|
140
|
+
|
|
141
|
+
- cd98e7d: Fix API route matching when `server.baseURL` is configured.
|
|
142
|
+
|
|
143
|
+
## 2.0.0-beta.10
|
|
144
|
+
|
|
145
|
+
### Patch Changes
|
|
146
|
+
|
|
147
|
+
- 8af6304: Support for Vite 8.1 Experimental Bundled Dev Mode
|
|
148
|
+
- 9d91484: fix: don't crash when a server function throws an error whose message contains non-latin1 characters.
|
|
149
|
+
- 068b64c: Return a cancellation-safe web `ReadableStream` for streaming SSR in development. Returning Solid's
|
|
150
|
+
raw stream only rendered on Node; Bun and Deno coerced it to `[object Object]`.
|
|
151
|
+
|
|
3
152
|
## 2.0.0-beta.9
|
|
4
153
|
|
|
5
154
|
### Minor Changes
|
|
@@ -118,7 +267,6 @@
|
|
|
118
267
|
- 8256190: Rework `@solidjs/start/env`
|
|
119
268
|
- 6cbba24: Fix multiple Set-Cookie headers being lost on redirect responses
|
|
120
269
|
- d4cc548: ## Bump Seroval
|
|
121
|
-
|
|
122
270
|
- version `1.4.1`
|
|
123
271
|
|
|
124
272
|
- dd40610: Handle base url in api routes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Provides SolidStart's `~` app-root alias without claiming module imports made
|
|
4
|
+
* by other workspace packages. Those packages may map `~` to their own root
|
|
5
|
+
* through an importer-aware resolver such as vite-tsconfig-paths.
|
|
6
|
+
*/
|
|
7
|
+
export declare function appRootAlias(projectRoot: string, appRoot: string): Plugin;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
3
|
+
import { normalizePath } from "vite";
|
|
4
|
+
/**
|
|
5
|
+
* `~/app.css`, `~/logo.svg`, ... but not `~/lib/api.ts` or `~/components/Counter`.
|
|
6
|
+
*
|
|
7
|
+
* CSS `@import`, `url()`, preprocessor imports and `new URL(..., import.meta.url)`
|
|
8
|
+
* are resolved by internal Vite resolvers that only run the alias plugin, never
|
|
9
|
+
* user plugins, so those ids can never reach `resolveId` below. Keeping non-module
|
|
10
|
+
* ids on a plain alias preserves `~` in stylesheets and asset URLs, where it always
|
|
11
|
+
* means the app root.
|
|
12
|
+
*/
|
|
13
|
+
const NON_MODULE_ID = /^~\/([^?#]*\.(?![cm]?[jt]sx?(?:[?#]|$))[^./?#]+(?:[?#].*)?)$/;
|
|
14
|
+
/**
|
|
15
|
+
* Provides SolidStart's `~` app-root alias without claiming module imports made
|
|
16
|
+
* by other workspace packages. Those packages may map `~` to their own root
|
|
17
|
+
* through an importer-aware resolver such as vite-tsconfig-paths.
|
|
18
|
+
*/
|
|
19
|
+
export function appRootAlias(projectRoot, appRoot) {
|
|
20
|
+
const appDir = normalizePath(resolve(projectRoot, appRoot));
|
|
21
|
+
const packageRoots = new Map();
|
|
22
|
+
/** Nearest directory at or above `directory` that holds a `package.json`. */
|
|
23
|
+
function packageRoot(directory) {
|
|
24
|
+
if (!packageRoots.has(directory)) {
|
|
25
|
+
const parent = dirname(directory);
|
|
26
|
+
packageRoots.set(directory, existsSync(join(directory, "package.json"))
|
|
27
|
+
? directory
|
|
28
|
+
: parent === directory
|
|
29
|
+
? undefined
|
|
30
|
+
: packageRoot(parent));
|
|
31
|
+
}
|
|
32
|
+
return packageRoots.get(directory);
|
|
33
|
+
}
|
|
34
|
+
const appPackage = packageRoot(appDir);
|
|
35
|
+
/** True only when the importer demonstrably belongs to another package. */
|
|
36
|
+
function isForeignImporter(importer) {
|
|
37
|
+
const file = normalizePath(importer.replace(/[?#].*$/s, ""));
|
|
38
|
+
if (!isAbsolute(file))
|
|
39
|
+
return false;
|
|
40
|
+
const owner = packageRoot(dirname(file));
|
|
41
|
+
return owner !== undefined && owner !== appPackage;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
name: "solid-start:app-root-alias",
|
|
45
|
+
enforce: "pre",
|
|
46
|
+
config() {
|
|
47
|
+
return { resolve: { alias: [{ find: NON_MODULE_ID, replacement: `${appDir}/$1` }] } };
|
|
48
|
+
},
|
|
49
|
+
async resolveId(id, importer, options) {
|
|
50
|
+
if (id !== "~" && !id.startsWith("~/"))
|
|
51
|
+
return null;
|
|
52
|
+
if (importer && isForeignImporter(importer))
|
|
53
|
+
return null;
|
|
54
|
+
const target = join(appDir, id.slice(1));
|
|
55
|
+
return (await this.resolve(target, importer, { ...options, skipSelf: true })) ?? target;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -5,7 +5,9 @@ export declare const VIRTUAL_MODULES: {
|
|
|
5
5
|
readonly getClientManifest: "solid-start:get-client-manifest";
|
|
6
6
|
readonly getManifest: "solid-start:get-manifest";
|
|
7
7
|
readonly middleware: "solid-start:middleware";
|
|
8
|
+
readonly serovalPlugins: "solid-start:seroval-plugins";
|
|
8
9
|
readonly serverFnManifest: "solid-start:server-fn-manifest";
|
|
10
|
+
readonly serverFnErrorHandler: "solid-start:server-fn-error-handler";
|
|
9
11
|
readonly clientEntry: "solid-start:client-entry";
|
|
10
12
|
readonly serverEntry: "solid-start:server-entry";
|
|
11
13
|
readonly app: "solid-start:app";
|
package/dist/config/constants.js
CHANGED
|
@@ -5,7 +5,9 @@ export const VIRTUAL_MODULES = {
|
|
|
5
5
|
getClientManifest: "solid-start:get-client-manifest",
|
|
6
6
|
getManifest: "solid-start:get-manifest",
|
|
7
7
|
middleware: "solid-start:middleware",
|
|
8
|
+
serovalPlugins: "solid-start:seroval-plugins",
|
|
8
9
|
serverFnManifest: "solid-start:server-fn-manifest",
|
|
10
|
+
serverFnErrorHandler: "solid-start:server-fn-error-handler",
|
|
9
11
|
clientEntry: "solid-start:client-entry",
|
|
10
12
|
serverEntry: "solid-start:server-entry",
|
|
11
13
|
app: "solid-start:app",
|
package/dist/config/env.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { loadEnv } from "vite";
|
|
2
|
+
import { parseIdQuery } from "./utils.js";
|
|
2
3
|
const LOADERS = {
|
|
3
4
|
node: `export default key => process.env[key];`,
|
|
4
5
|
"cloudflare-workers": `import { env } from 'cloudflare:workers';export default key => env[key];`,
|
|
@@ -39,38 +40,40 @@ export function envPlugin(options) {
|
|
|
39
40
|
env = config.mode !== "production" ? "development" : "production";
|
|
40
41
|
},
|
|
41
42
|
resolveId(id) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const { filename } = parseIdQuery(id);
|
|
44
|
+
if (filename === SERVER_ENV ||
|
|
45
|
+
filename === CLIENT_ENV ||
|
|
46
|
+
filename === SERVER_RUNTIME_ENV ||
|
|
47
|
+
filename === SERVER_RUNTIME_LOADER) {
|
|
46
48
|
return id;
|
|
47
49
|
}
|
|
48
50
|
return undefined;
|
|
49
51
|
},
|
|
50
52
|
load(id) {
|
|
53
|
+
const { filename } = parseIdQuery(id);
|
|
51
54
|
const isServer = this.environment.config.consumer === "server";
|
|
52
|
-
if (
|
|
55
|
+
if (filename === SERVER_ENV) {
|
|
53
56
|
if (!isServer) {
|
|
54
57
|
return SERVER_ONLY_MODULE;
|
|
55
58
|
}
|
|
56
59
|
const vars = currentOptions.server?.load
|
|
57
60
|
? currentOptions.server.load(env)
|
|
58
|
-
: loadEnv(env,
|
|
61
|
+
: loadEnv(env, ".", serverPrefix);
|
|
59
62
|
return convertObjectToModule(vars);
|
|
60
63
|
}
|
|
61
|
-
if (
|
|
64
|
+
if (filename === CLIENT_ENV) {
|
|
62
65
|
const vars = currentOptions.client?.load
|
|
63
66
|
? currentOptions.client.load(env)
|
|
64
|
-
: loadEnv(env,
|
|
67
|
+
: loadEnv(env, ".", clientPrefix);
|
|
65
68
|
return convertObjectToModule(vars);
|
|
66
69
|
}
|
|
67
|
-
if (
|
|
70
|
+
if (filename === SERVER_RUNTIME_LOADER) {
|
|
68
71
|
if (!isServer) {
|
|
69
72
|
return SERVER_ONLY_MODULE;
|
|
70
73
|
}
|
|
71
74
|
return runtimeCode;
|
|
72
75
|
}
|
|
73
|
-
if (
|
|
76
|
+
if (filename === SERVER_RUNTIME_ENV) {
|
|
74
77
|
if (!isServer) {
|
|
75
78
|
return SERVER_ONLY_MODULE;
|
|
76
79
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { relative } from "node:path";
|
|
2
2
|
import { fileSystemWatcher } from "./fs-watcher.js";
|
|
3
|
-
import { treeShake } from "./tree-shake.js";
|
|
3
|
+
import { toPickId, treeShake } from "./tree-shake.js";
|
|
4
4
|
export const moduleId = "solid-start:routes";
|
|
5
5
|
export function fsRoutes({ routers }) {
|
|
6
6
|
globalThis.ROUTERS = routers;
|
|
@@ -24,7 +24,7 @@ export function fsRoutes({ routers }) {
|
|
|
24
24
|
if (v === undefined)
|
|
25
25
|
return undefined;
|
|
26
26
|
if (k.startsWith("$$")) {
|
|
27
|
-
const buildId =
|
|
27
|
+
const buildId = toPickId(v.src, v.pick);
|
|
28
28
|
/**
|
|
29
29
|
* @type {{ [key: string]: string }}
|
|
30
30
|
*/
|
|
@@ -40,7 +40,7 @@ export function fsRoutes({ routers }) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
else if (k.startsWith("$")) {
|
|
43
|
-
const buildId =
|
|
43
|
+
const buildId = toPickId(v.src, v.pick);
|
|
44
44
|
return {
|
|
45
45
|
src: relative(root, buildId),
|
|
46
46
|
build: isBuild ? `_$() => import('${buildId}')$_` : undefined,
|
|
@@ -1,2 +1,29 @@
|
|
|
1
1
|
import type { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the module id used to import a subset of a route file's exports.
|
|
4
|
+
*
|
|
5
|
+
* The `pick` list has to live in the query so that the same file can be
|
|
6
|
+
* instantiated once per export subset (the client picks `default`/`$css`,
|
|
7
|
+
* the server picks its HTTP handlers). That query would otherwise leave the
|
|
8
|
+
* id ending in `?pick=GET`, which silently excludes route files from any
|
|
9
|
+
* plugin whose filter is anchored on the file extension -- a very common
|
|
10
|
+
* default, e.g. unplugin-macros' `/\.[cm]?[jt]sx?$/`.
|
|
11
|
+
*
|
|
12
|
+
* The trailing `lang.<ext>` marker is the same convention Vue SFCs use
|
|
13
|
+
* (`?vue&type=script&lang.ts`) and puts a real extension back at the end of
|
|
14
|
+
* the id, so those filters match again.
|
|
15
|
+
*
|
|
16
|
+
* @see https://github.com/solidjs/solid-start/issues/1918
|
|
17
|
+
*/
|
|
18
|
+
export declare function toPickId(src: string, pick: string[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* Rolldown's default chunk name sanitizer, plus a pass that drops the
|
|
21
|
+
* `?pick=...&lang` tail so route chunks keep the short, stable filenames they
|
|
22
|
+
* had before the `lang` marker was introduced (`index-<hash>.js`, not
|
|
23
|
+
* `index.tsx_pick_default_pick__css_lang-<hash>.js`). Client chunk filenames
|
|
24
|
+
* are public URLs, so this is not purely cosmetic.
|
|
25
|
+
*
|
|
26
|
+
* @see https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
|
|
27
|
+
*/
|
|
28
|
+
export declare function sanitizeChunkFileName(name: string): string;
|
|
2
29
|
export declare function treeShake(): Plugin;
|