@solidjs/start 2.0.0-beta.0 → 2.0.0-beta.1
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 +7 -0
- package/package.json +5 -4
- package/src/config/dev-server.ts +5 -1
- package/dist/client/StartClient.d.ts +0 -7
- package/dist/client/StartClient.jsx +0 -26
- package/dist/client/index.d.ts +0 -2
- package/dist/client/index.jsx +0 -2
- package/dist/client/mount.d.ts +0 -1
- package/dist/client/mount.js +0 -1
- package/dist/client/spa/index.d.ts +0 -4
- package/dist/client/spa/index.jsx +0 -5
- package/dist/config/constants.d.ts +0 -16
- package/dist/config/constants.js +0 -16
- package/dist/config/dev-server.d.ts +0 -2
- package/dist/config/dev-server.js +0 -126
- package/dist/config/env.d.ts +0 -19
- package/dist/config/env.js +0 -81
- package/dist/config/fs-router.d.ts +0 -37
- package/dist/config/fs-router.js +0 -141
- package/dist/config/fs-routes/fs-watcher.d.ts +0 -3
- package/dist/config/fs-routes/fs-watcher.js +0 -53
- package/dist/config/fs-routes/index.d.ts +0 -7
- package/dist/config/fs-routes/index.js +0 -107
- package/dist/config/fs-routes/router.d.ts +0 -42
- package/dist/config/fs-routes/router.js +0 -148
- package/dist/config/fs-routes/tree-shake.d.ts +0 -2
- package/dist/config/fs-routes/tree-shake.js +0 -305
- package/dist/config/index.d.ts +0 -25
- package/dist/config/index.js +0 -217
- package/dist/config/lazy.d.ts +0 -3
- package/dist/config/lazy.js +0 -114
- package/dist/config/manifest.d.ts +0 -3
- package/dist/config/manifest.js +0 -109
- package/dist/config/utils.d.ts +0 -4
- package/dist/config/utils.js +0 -6
- package/dist/config/vite-utils.d.ts +0 -21
- package/dist/config/vite-utils.js +0 -85
- package/dist/directives/bubble-function-declaration.d.ts +0 -3
- package/dist/directives/bubble-function-declaration.js +0 -23
- package/dist/directives/compile.d.ts +0 -9
- package/dist/directives/compile.js +0 -40
- package/dist/directives/generate-unique-name.d.ts +0 -3
- package/dist/directives/generate-unique-name.js +0 -16
- package/dist/directives/get-descriptive-name.d.ts +0 -2
- package/dist/directives/get-descriptive-name.js +0 -37
- package/dist/directives/get-import-identifier.d.ts +0 -4
- package/dist/directives/get-import-identifier.js +0 -19
- package/dist/directives/get-root-statement-path.d.ts +0 -2
- package/dist/directives/get-root-statement-path.js +0 -12
- package/dist/directives/index.d.ts +0 -14
- package/dist/directives/index.js +0 -170
- package/dist/directives/is-statement-top-level.d.ts +0 -3
- package/dist/directives/is-statement-top-level.js +0 -9
- package/dist/directives/paths.d.ts +0 -9
- package/dist/directives/paths.js +0 -36
- package/dist/directives/plugin.d.ts +0 -21
- package/dist/directives/plugin.js +0 -302
- package/dist/directives/remove-unused-variables.d.ts +0 -3
- package/dist/directives/remove-unused-variables.js +0 -66
- package/dist/directives/types.d.ts +0 -10
- package/dist/directives/types.js +0 -1
- package/dist/directives/xxhash32.d.ts +0 -6
- package/dist/directives/xxhash32.js +0 -193
- package/dist/fns/client.d.ts +0 -3
- package/dist/fns/client.js +0 -106
- package/dist/fns/handler.d.ts +0 -5
- package/dist/fns/handler.js +0 -269
- package/dist/fns/registration.d.ts +0 -2
- package/dist/fns/registration.js +0 -12
- package/dist/fns/serialization.d.ts +0 -6
- package/dist/fns/serialization.js +0 -208
- package/dist/fns/server.d.ts +0 -7
- package/dist/fns/server.js +0 -38
- package/dist/fns/shared.d.ts +0 -17
- package/dist/fns/shared.js +0 -105
- package/dist/http/index.d.ts +0 -81
- package/dist/http/index.js +0 -129
- package/dist/index.d.ts +0 -5
- package/dist/index.jsx +0 -6
- package/dist/middleware/index.d.ts +0 -38
- package/dist/middleware/index.js +0 -59
- package/dist/router.d.ts +0 -6
- package/dist/router.jsx +0 -29
- package/dist/server/StartServer.d.ts +0 -9
- package/dist/server/StartServer.jsx +0 -34
- package/dist/server/assets/PatchVirtualDevStyles.d.ts +0 -4
- package/dist/server/assets/PatchVirtualDevStyles.jsx +0 -28
- package/dist/server/assets/index.d.ts +0 -2
- package/dist/server/assets/index.js +0 -52
- package/dist/server/assets/render.d.ts +0 -19
- package/dist/server/assets/render.jsx +0 -14
- package/dist/server/collect-styles.d.ts +0 -3
- package/dist/server/collect-styles.js +0 -57
- package/dist/server/fetchEvent.d.ts +0 -7
- package/dist/server/fetchEvent.js +0 -26
- package/dist/server/handler.d.ts +0 -64
- package/dist/server/handler.js +0 -222
- package/dist/server/index.d.ts +0 -9
- package/dist/server/index.jsx +0 -14
- package/dist/server/manifest/client-manifest.d.ts +0 -9
- package/dist/server/manifest/client-manifest.js +0 -6
- package/dist/server/manifest/dev-client-manifest.d.ts +0 -4
- package/dist/server/manifest/dev-client-manifest.js +0 -24
- package/dist/server/manifest/dev-ssr-manifest.d.ts +0 -5
- package/dist/server/manifest/dev-ssr-manifest.js +0 -23
- package/dist/server/manifest/prod-client-manifest.d.ts +0 -5
- package/dist/server/manifest/prod-client-manifest.js +0 -26
- package/dist/server/manifest/prod-ssr-manifest.d.ts +0 -6
- package/dist/server/manifest/prod-ssr-manifest.js +0 -85
- package/dist/server/manifest/ssr-manifest.d.ts +0 -4
- package/dist/server/manifest/ssr-manifest.js +0 -6
- package/dist/server/routes.d.ts +0 -23
- package/dist/server/routes.js +0 -74
- package/dist/server/spa/StartServer.d.ts +0 -9
- package/dist/server/spa/StartServer.jsx +0 -25
- package/dist/server/spa/handler.d.ts +0 -36
- package/dist/server/spa/handler.js +0 -20
- package/dist/server/spa/index.d.ts +0 -4
- package/dist/server/spa/index.jsx +0 -5
- package/dist/server/types.d.ts +0 -75
- package/dist/server/types.js +0 -1
- package/dist/server/util.d.ts +0 -2
- package/dist/server/util.js +0 -8
- package/dist/shared/ErrorBoundary.d.ts +0 -3
- package/dist/shared/ErrorBoundary.jsx +0 -36
- package/dist/shared/GET.d.ts +0 -5
- package/dist/shared/GET.js +0 -8
- package/dist/shared/HttpHeader.d.ts +0 -10
- package/dist/shared/HttpHeader.jsx +0 -38
- package/dist/shared/HttpStatusCode.d.ts +0 -9
- package/dist/shared/HttpStatusCode.js +0 -18
- package/dist/shared/clientOnly.d.ts +0 -12
- package/dist/shared/clientOnly.js +0 -27
- package/dist/shared/dev-overlay/CodeView.d.ts +0 -7
- package/dist/shared/dev-overlay/CodeView.jsx +0 -62
- package/dist/shared/dev-overlay/DevOverlayDialog.d.ts +0 -9
- package/dist/shared/dev-overlay/DevOverlayDialog.jsx +0 -226
- package/dist/shared/dev-overlay/createStackFrame.d.ts +0 -9
- package/dist/shared/dev-overlay/createStackFrame.js +0 -56
- package/dist/shared/dev-overlay/download.d.ts +0 -1
- package/dist/shared/dev-overlay/download.js +0 -6
- package/dist/shared/dev-overlay/get-source-map.d.ts +0 -2
- package/dist/shared/dev-overlay/get-source-map.js +0 -25
- package/dist/shared/dev-overlay/icons.d.ts +0 -28
- package/dist/shared/dev-overlay/icons.jsx +0 -150
- 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/lazy.d.ts +0 -3
- package/dist/shared/lazy.js +0 -42
- package/dist/shared/serverFunction.d.ts +0 -6
- package/dist/shared/serverFunction.js +0 -8
- package/dist/utils/debounce.d.ts +0 -4
- package/dist/utils/debounce.js +0 -10
package/dist/server/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { default as lazy } from "../shared/lazy.ts";
|
|
2
|
-
export { getServerFunctionMeta } from "../shared/serverFunction.ts";
|
|
3
|
-
export { StartServer } from "./StartServer.tsx";
|
|
4
|
-
export { createHandler } from "./handler.ts";
|
|
5
|
-
export type { APIEvent, APIHandler, Asset, ContextMatches, DocumentComponentProps, FetchEvent, HandlerOptions, PageEvent, ResponseStub, ServerFunctionMeta, } from "./types.ts";
|
|
6
|
-
/**
|
|
7
|
-
* Checks if user has set a redirect status in the response.
|
|
8
|
-
* If not, falls back to the 302 (temporary redirect)
|
|
9
|
-
*/
|
package/dist/server/index.jsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { default as lazy } from "../shared/lazy.js";
|
|
2
|
-
export { getServerFunctionMeta } from "../shared/serverFunction.js";
|
|
3
|
-
export { StartServer } from "./StartServer.jsx";
|
|
4
|
-
export { createHandler } from "./handler.js";
|
|
5
|
-
/**
|
|
6
|
-
* Checks if user has set a redirect status in the response.
|
|
7
|
-
* If not, falls back to the 302 (temporary redirect)
|
|
8
|
-
*/
|
|
9
|
-
// export function getExpectedRedirectStatus(response: ResponseStub): number {
|
|
10
|
-
// if (response.status && validRedirectStatuses.has(response.status)) {
|
|
11
|
-
// return response.status;
|
|
12
|
-
// }
|
|
13
|
-
// return 302;
|
|
14
|
-
// }
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare function getClientManifest(): {
|
|
2
|
-
import(id: string): Promise<any>;
|
|
3
|
-
getAssets(id: string): Promise<any[]>;
|
|
4
|
-
} | {
|
|
5
|
-
import(id: string): Promise<any>;
|
|
6
|
-
getAssets(id: string): Promise<any>;
|
|
7
|
-
json(): Promise<any>;
|
|
8
|
-
};
|
|
9
|
-
export { getClientManifest as getManifest };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { getClientDevManifest } from "./dev-client-manifest.js";
|
|
2
|
-
import { getClientProdManifest } from "./prod-client-manifest.js";
|
|
3
|
-
export function getClientManifest() {
|
|
4
|
-
return import.meta.env.DEV ? getClientDevManifest() : getClientProdManifest();
|
|
5
|
-
}
|
|
6
|
-
export { getClientManifest as getManifest };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
-
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
-
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
return path;
|
|
8
|
-
};
|
|
9
|
-
import { join } from "pathe";
|
|
10
|
-
export function getClientDevManifest() {
|
|
11
|
-
return {
|
|
12
|
-
import(id) {
|
|
13
|
-
return import(__rewriteRelativeImportExtension(/* @vite-ignore */ join("/", id), true));
|
|
14
|
-
},
|
|
15
|
-
async getAssets(id) {
|
|
16
|
-
const assetsPath = `/@manifest/client/${Date.now()}/assets?id=${id}`;
|
|
17
|
-
const assets = (await import(__rewriteRelativeImportExtension(/* @vite-ignore */ assetsPath, true))).default;
|
|
18
|
-
return await Promise.all(assets.map(async (v) => ({
|
|
19
|
-
...v,
|
|
20
|
-
children: await v.children(),
|
|
21
|
-
})));
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
-
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
-
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
return path;
|
|
8
|
-
};
|
|
9
|
-
import { join, normalize } from "pathe";
|
|
10
|
-
export function getSsrDevManifest(environment) {
|
|
11
|
-
return {
|
|
12
|
-
path: (id) => normalize(join(import.meta.env.BASE_URL, id)),
|
|
13
|
-
async getAssets(id) {
|
|
14
|
-
const assetsPath = `/@manifest/${environment}/${Date.now()}/assets?id=${id}`;
|
|
15
|
-
const assets = (await import(__rewriteRelativeImportExtension(/* @vite-ignore */ assetsPath, true))).default;
|
|
16
|
-
return await Promise.all(assets.map(async (v) => ({
|
|
17
|
-
...v,
|
|
18
|
-
children: await v.children(),
|
|
19
|
-
})));
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export { getSsrDevManifest as getSsrManifest };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
-
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
-
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
return path;
|
|
8
|
-
};
|
|
9
|
-
export function getClientProdManifest() {
|
|
10
|
-
return {
|
|
11
|
-
import(id) {
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
return import(__rewriteRelativeImportExtension(/* @vite-ignore */ window.manifest[id].output, true));
|
|
14
|
-
},
|
|
15
|
-
async getAssets(id) {
|
|
16
|
-
if (id.startsWith("./"))
|
|
17
|
-
id = id.slice(2);
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
return window.manifest[id]?.assets ?? [];
|
|
20
|
-
},
|
|
21
|
-
async json() {
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
return window.manifest;
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { clientViteManifest } from "solid-start:client-vite-manifest";
|
|
2
|
-
import { join } from "pathe";
|
|
3
|
-
// Only reads from client manifest atm, might need server support for islands
|
|
4
|
-
export function getSsrProdManifest() {
|
|
5
|
-
const viteManifest = clientViteManifest;
|
|
6
|
-
return {
|
|
7
|
-
path(id) {
|
|
8
|
-
if (id.startsWith("./"))
|
|
9
|
-
id = id.slice(2);
|
|
10
|
-
const viteManifestEntry = clientViteManifest[id /*import.meta.env.START_CLIENT_ENTRY*/];
|
|
11
|
-
if (!viteManifestEntry)
|
|
12
|
-
throw new Error(`No entry found in vite manifest for '${id}'`);
|
|
13
|
-
return join("/", viteManifestEntry.file);
|
|
14
|
-
},
|
|
15
|
-
async getAssets(id) {
|
|
16
|
-
if (id.startsWith("./"))
|
|
17
|
-
id = id.slice(2);
|
|
18
|
-
return createHtmlTagsForAssets(findAssetsInViteManifest(clientViteManifest, id));
|
|
19
|
-
},
|
|
20
|
-
async json() {
|
|
21
|
-
const json = {};
|
|
22
|
-
const entryKeys = Object.keys(viteManifest)
|
|
23
|
-
.filter(id => viteManifest[id]?.isEntry || viteManifest[id]?.isDynamicEntry)
|
|
24
|
-
.map(id => id);
|
|
25
|
-
for (const entryKey of entryKeys) {
|
|
26
|
-
json[entryKey] = {
|
|
27
|
-
output: join("/", viteManifest[entryKey].file),
|
|
28
|
-
assets: await this.getAssets(entryKey),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return json;
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function createHtmlTagsForAssets(assets) {
|
|
36
|
-
return assets
|
|
37
|
-
.filter(asset => asset.endsWith(".css") ||
|
|
38
|
-
asset.endsWith(".js") ||
|
|
39
|
-
asset.endsWith(".ts") ||
|
|
40
|
-
asset.endsWith(".mjs"))
|
|
41
|
-
.map(asset => ({
|
|
42
|
-
tag: "link",
|
|
43
|
-
attrs: {
|
|
44
|
-
href: "/" + asset,
|
|
45
|
-
key: asset,
|
|
46
|
-
...(asset.endsWith(".css") ? { rel: "stylesheet" } : { rel: "modulepreload" }),
|
|
47
|
-
},
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
const entryId = import.meta.env.START_CLIENT_ENTRY.slice(2);
|
|
51
|
-
let entryImports = undefined;
|
|
52
|
-
function findAssetsInViteManifest(manifest, id, assetMap = new Map(), stack = []) {
|
|
53
|
-
if (stack.includes(id)) {
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
56
|
-
const cached = assetMap.get(id);
|
|
57
|
-
if (cached) {
|
|
58
|
-
return cached;
|
|
59
|
-
}
|
|
60
|
-
const chunk = manifest[id];
|
|
61
|
-
if (!chunk) {
|
|
62
|
-
return [];
|
|
63
|
-
}
|
|
64
|
-
if (!entryImports) {
|
|
65
|
-
entryImports = [entryId, ...(manifest[entryId]?.imports ?? [])];
|
|
66
|
-
}
|
|
67
|
-
// Only include entry imports, if we are specifically crawling the entry
|
|
68
|
-
// Chunks (e.g. routes) that import something from entry, should not render entry css redundantly
|
|
69
|
-
const excludeEntryImports = id !== entryId;
|
|
70
|
-
const assets = chunk.css?.filter(Boolean) || [];
|
|
71
|
-
if (chunk.imports) {
|
|
72
|
-
stack.push(id);
|
|
73
|
-
for (let i = 0, l = chunk.imports.length; i < l; i++) {
|
|
74
|
-
const importId = chunk.imports[i];
|
|
75
|
-
if (!importId || (excludeEntryImports && entryImports.includes(importId)))
|
|
76
|
-
continue;
|
|
77
|
-
assets.push(...findAssetsInViteManifest(manifest, importId, assetMap, stack));
|
|
78
|
-
}
|
|
79
|
-
stack.pop();
|
|
80
|
-
}
|
|
81
|
-
assets.push(chunk.file);
|
|
82
|
-
const all = Array.from(new Set(assets));
|
|
83
|
-
assetMap.set(id, all);
|
|
84
|
-
return all;
|
|
85
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { getSsrDevManifest } from "./dev-ssr-manifest.ts";
|
|
2
|
-
import { getSsrProdManifest } from "./prod-ssr-manifest.ts";
|
|
3
|
-
export declare function getSsrManifest(target: "client" | "ssr"): ReturnType<typeof getSsrDevManifest> | ReturnType<typeof getSsrProdManifest>;
|
|
4
|
-
export { getSsrManifest as getManifest };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { getSsrDevManifest } from "./dev-ssr-manifest.js";
|
|
2
|
-
import { getSsrProdManifest } from "./prod-ssr-manifest.js";
|
|
3
|
-
export function getSsrManifest(target) {
|
|
4
|
-
return import.meta.env.DEV ? getSsrDevManifest(target) : getSsrProdManifest();
|
|
5
|
-
}
|
|
6
|
-
export { getSsrManifest as getManifest };
|
package/dist/server/routes.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { FetchEvent } from "./types.ts";
|
|
2
|
-
interface Route {
|
|
3
|
-
path: string;
|
|
4
|
-
id: string;
|
|
5
|
-
children?: Route[];
|
|
6
|
-
page?: boolean;
|
|
7
|
-
$component?: any;
|
|
8
|
-
$HEAD?: any;
|
|
9
|
-
$GET?: any;
|
|
10
|
-
$POST?: any;
|
|
11
|
-
$PUT?: any;
|
|
12
|
-
$PATCH?: any;
|
|
13
|
-
$DELETE?: any;
|
|
14
|
-
}
|
|
15
|
-
export declare const pageRoutes: Route[];
|
|
16
|
-
export declare function matchAPIRoute(path: string, method: string): {
|
|
17
|
-
params?: Record<string, any>;
|
|
18
|
-
handler: {
|
|
19
|
-
import: () => Promise<Record<string, (e: FetchEvent) => Promise<any>>>;
|
|
20
|
-
};
|
|
21
|
-
isPage: boolean;
|
|
22
|
-
} | undefined;
|
|
23
|
-
export {};
|
package/dist/server/routes.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// @ts-expect-error
|
|
2
|
-
import fileRoutes from "solid-start:routes";
|
|
3
|
-
import { createRouter } from "radix3";
|
|
4
|
-
export const pageRoutes = defineRoutes(fileRoutes.filter(o => o.page));
|
|
5
|
-
function defineRoutes(fileRoutes) {
|
|
6
|
-
function processRoute(routes, route, id, full) {
|
|
7
|
-
const parentRoute = Object.values(routes).find(o => {
|
|
8
|
-
return id.startsWith(o.id + "/");
|
|
9
|
-
});
|
|
10
|
-
if (!parentRoute) {
|
|
11
|
-
routes.push({
|
|
12
|
-
...route,
|
|
13
|
-
id,
|
|
14
|
-
path: id.replace(/\([^)/]+\)/g, "").replace(/\/+/g, "/"),
|
|
15
|
-
});
|
|
16
|
-
return routes;
|
|
17
|
-
}
|
|
18
|
-
processRoute(parentRoute.children || (parentRoute.children = []), route, id.slice(parentRoute.id.length), full);
|
|
19
|
-
return routes;
|
|
20
|
-
}
|
|
21
|
-
return fileRoutes
|
|
22
|
-
.sort((a, b) => a.path.length - b.path.length)
|
|
23
|
-
.reduce((prevRoutes, route) => {
|
|
24
|
-
return processRoute(prevRoutes, route, route.path, route.path);
|
|
25
|
-
}, []);
|
|
26
|
-
}
|
|
27
|
-
const router = createRouter({
|
|
28
|
-
routes: fileRoutes.reduce((memo, route) => {
|
|
29
|
-
if (!containsHTTP(route))
|
|
30
|
-
return memo;
|
|
31
|
-
const path = route.path
|
|
32
|
-
.replace(/\([^)/]+\)/g, "")
|
|
33
|
-
.replace(/\/+/g, "/")
|
|
34
|
-
.replace(/\*([^/]*)/g, (_, m) => `**:${m}`)
|
|
35
|
-
.split("/")
|
|
36
|
-
.map(s => (s.startsWith(":") || s.startsWith("*") ? s : encodeURIComponent(s)))
|
|
37
|
-
.join("/");
|
|
38
|
-
if (/:[^/]*\?/g.test(path)) {
|
|
39
|
-
throw new Error(`Optional parameters are not supported in API routes: ${path}`);
|
|
40
|
-
}
|
|
41
|
-
if (memo[path]) {
|
|
42
|
-
throw new Error(`Duplicate API routes for "${path}" found at "${memo[path].route.path}" and "${route.path}"`);
|
|
43
|
-
}
|
|
44
|
-
memo[path] = { route };
|
|
45
|
-
return memo;
|
|
46
|
-
}, {}),
|
|
47
|
-
});
|
|
48
|
-
function containsHTTP(route) {
|
|
49
|
-
return (route["$HEAD"] ||
|
|
50
|
-
route["$GET"] ||
|
|
51
|
-
route["$POST"] ||
|
|
52
|
-
route["$PUT"] ||
|
|
53
|
-
route["$PATCH"] ||
|
|
54
|
-
route["$DELETE"]);
|
|
55
|
-
}
|
|
56
|
-
export function matchAPIRoute(path, method) {
|
|
57
|
-
const match = router.lookup(path);
|
|
58
|
-
if (match && match.route) {
|
|
59
|
-
const route = match.route;
|
|
60
|
-
// Find the appropriate handler for the HTTP method
|
|
61
|
-
const handler = method === "HEAD" ? route.$HEAD || route.$GET : route[`$${method}`];
|
|
62
|
-
if (handler === undefined)
|
|
63
|
-
return;
|
|
64
|
-
// Check if this is a page route
|
|
65
|
-
const isPage = route.page === true && route.$component !== undefined;
|
|
66
|
-
// Return comprehensive route information
|
|
67
|
-
return {
|
|
68
|
-
handler,
|
|
69
|
-
params: match.params,
|
|
70
|
-
isPage,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Component } from "solid-js";
|
|
2
|
-
import type { DocumentComponentProps } from "../types.ts";
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Read more: https://docs.solidjs.com/solid-start/reference/server/start-server
|
|
6
|
-
*/
|
|
7
|
-
export declare function StartServer(props: {
|
|
8
|
-
document: Component<DocumentComponentProps>;
|
|
9
|
-
}): import("solid-js").JSX.Element;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { NoHydration, getRequestEvent, ssr } from "solid-js/web";
|
|
2
|
-
import { getSsrManifest } from "../manifest/ssr-manifest.js";
|
|
3
|
-
import { TopErrorBoundary } from "../../shared/ErrorBoundary.jsx";
|
|
4
|
-
import { useAssets } from "../assets/index.js";
|
|
5
|
-
import PatchVirtualDevStyles from "../assets/PatchVirtualDevStyles.jsx";
|
|
6
|
-
const docType = ssr("<!DOCTYPE html>");
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* Read more: https://docs.solidjs.com/solid-start/reference/server/start-server
|
|
10
|
-
*/
|
|
11
|
-
export function StartServer(props) {
|
|
12
|
-
const context = getRequestEvent();
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
const nonce = context.nonce;
|
|
15
|
-
useAssets(context.assets, nonce);
|
|
16
|
-
return (<NoHydration>
|
|
17
|
-
{docType}
|
|
18
|
-
<TopErrorBoundary>
|
|
19
|
-
<props.document scripts={<>
|
|
20
|
-
<PatchVirtualDevStyles nonce={nonce}/>
|
|
21
|
-
<script type="module" src={getSsrManifest("client").path(import.meta.env.START_CLIENT_ENTRY)}/>
|
|
22
|
-
</>}/>
|
|
23
|
-
</TopErrorBoundary>
|
|
24
|
-
</NoHydration>);
|
|
25
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { JSX } from "solid-js";
|
|
2
|
-
import type { HandlerOptions, PageEvent } from "../types.ts";
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Read more: https://docs.solidjs.com/solid-start/reference/server/create-handler
|
|
6
|
-
*/
|
|
7
|
-
export declare function createHandler(fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions)): {
|
|
8
|
-
"~rou3": import("h3").RouterContext;
|
|
9
|
-
request(request: import("srvx").ServerRequest | URL | string, options?: RequestInit, context?: import("h3").H3EventContext): Response | Promise<Response>;
|
|
10
|
-
use(route: string, handler: import("h3").Middleware, opts?: import("h3").MiddlewareOptions): /*elided*/ any;
|
|
11
|
-
use(handler: import("h3").Middleware, opts?: import("h3").MiddlewareOptions): /*elided*/ any;
|
|
12
|
-
on(method: import("h3").HTTPMethod | Lowercase<import("h3").HTTPMethod> | "", route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
13
|
-
register(plugin: import("h3").H3Plugin): /*elided*/ any;
|
|
14
|
-
mount(base: string, input: import("srvx").FetchHandler | {
|
|
15
|
-
fetch: import("srvx").FetchHandler;
|
|
16
|
-
} | /*elided*/ any): /*elided*/ any;
|
|
17
|
-
all(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
18
|
-
get(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
19
|
-
post(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
20
|
-
put(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
21
|
-
delete(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
22
|
-
patch(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
23
|
-
head(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
24
|
-
options(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
25
|
-
connect(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
26
|
-
trace(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
27
|
-
readonly config: import("h3").H3Config;
|
|
28
|
-
"~middleware": import("h3").Middleware[];
|
|
29
|
-
"~routes": import("h3").H3Route[];
|
|
30
|
-
fetch(_request: import("srvx").ServerRequest): Response | Promise<Response>;
|
|
31
|
-
handler(event: import("h3").H3Event): unknown | Promise<unknown>;
|
|
32
|
-
"~request"(request: import("srvx").ServerRequest, context?: import("h3").H3EventContext): Response | Promise<Response>;
|
|
33
|
-
"~findRoute"(_event: import("h3").H3Event): import("h3").MatchedRoute<import("h3").H3Route> | void;
|
|
34
|
-
"~getMiddleware"(event: import("h3").H3Event, route: import("h3").MatchedRoute<import("h3").H3Route> | undefined): import("h3").Middleware[];
|
|
35
|
-
"~addRoute"(_route: import("h3").H3Route): void;
|
|
36
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createBaseHandler } from "../handler.js";
|
|
2
|
-
import { getSsrManifest } from "../manifest/ssr-manifest.js";
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Read more: https://docs.solidjs.com/solid-start/reference/server/create-handler
|
|
6
|
-
*/
|
|
7
|
-
export function createHandler(fn, options) {
|
|
8
|
-
return createBaseHandler(createPageEvent, fn, options);
|
|
9
|
-
}
|
|
10
|
-
async function createPageEvent(ctx) {
|
|
11
|
-
const manifest = getSsrManifest("ssr");
|
|
12
|
-
const pageEvent = Object.assign(ctx, {
|
|
13
|
-
manifest: "json" in manifest ? await manifest.json() : {},
|
|
14
|
-
assets: await manifest.getAssets(import.meta.env.START_CLIENT_ENTRY),
|
|
15
|
-
routes: [],
|
|
16
|
-
complete: false,
|
|
17
|
-
$islands: new Set(),
|
|
18
|
-
});
|
|
19
|
-
return pageEvent;
|
|
20
|
-
}
|
package/dist/server/types.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { H3Event } from "h3";
|
|
2
|
-
import type { JSX } from "solid-js";
|
|
3
|
-
import type { RequestEvent } from "solid-js/web";
|
|
4
|
-
export type DocumentComponentProps = {
|
|
5
|
-
assets?: JSX.Element;
|
|
6
|
-
scripts: JSX.Element;
|
|
7
|
-
children?: JSX.Element;
|
|
8
|
-
};
|
|
9
|
-
export type Asset = {
|
|
10
|
-
tag: "style";
|
|
11
|
-
attrs: JSX.StyleHTMLAttributes<HTMLStyleElement> & {
|
|
12
|
-
key?: string;
|
|
13
|
-
};
|
|
14
|
-
children?: JSX.Element;
|
|
15
|
-
} | {
|
|
16
|
-
tag: "script";
|
|
17
|
-
attrs: JSX.ScriptHTMLAttributes<HTMLScriptElement> & {
|
|
18
|
-
key?: string;
|
|
19
|
-
};
|
|
20
|
-
} | {
|
|
21
|
-
tag: "link";
|
|
22
|
-
attrs: JSX.LinkHTMLAttributes<HTMLLinkElement> & {
|
|
23
|
-
key?: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export type HandlerOptions = {
|
|
27
|
-
mode?: "sync" | "async" | "stream";
|
|
28
|
-
nonce?: string;
|
|
29
|
-
renderId?: string;
|
|
30
|
-
onCompleteAll?: (options: {
|
|
31
|
-
write: (v: any) => void;
|
|
32
|
-
}) => void;
|
|
33
|
-
onCompleteShell?: (options: {
|
|
34
|
-
write: (v: any) => void;
|
|
35
|
-
}) => void;
|
|
36
|
-
};
|
|
37
|
-
export type ContextMatches = {
|
|
38
|
-
originalPath: string;
|
|
39
|
-
pattern: string;
|
|
40
|
-
path: string;
|
|
41
|
-
params: unknown;
|
|
42
|
-
};
|
|
43
|
-
export interface ResponseStub {
|
|
44
|
-
status?: number;
|
|
45
|
-
statusText?: string;
|
|
46
|
-
headers: Headers;
|
|
47
|
-
}
|
|
48
|
-
export interface FetchEvent {
|
|
49
|
-
request: Request;
|
|
50
|
-
response: ResponseStub;
|
|
51
|
-
clientAddress?: string;
|
|
52
|
-
locals: App.RequestEventLocals;
|
|
53
|
-
nativeEvent: H3Event;
|
|
54
|
-
}
|
|
55
|
-
export interface PageEvent extends RequestEvent {
|
|
56
|
-
assets: any[];
|
|
57
|
-
routes: any[];
|
|
58
|
-
$islands: Set<string>;
|
|
59
|
-
complete: boolean;
|
|
60
|
-
nonce?: string;
|
|
61
|
-
}
|
|
62
|
-
export interface APIEvent extends FetchEvent {
|
|
63
|
-
params: {
|
|
64
|
-
[key: string]: string;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
export type APIHandler = (event: APIEvent) => any;
|
|
68
|
-
export interface ServerFunctionMeta {
|
|
69
|
-
id: string;
|
|
70
|
-
}
|
|
71
|
-
declare module "solid-js/web" {
|
|
72
|
-
interface RequestEvent extends FetchEvent {
|
|
73
|
-
serverOnly?: boolean;
|
|
74
|
-
}
|
|
75
|
-
}
|
package/dist/server/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/server/util.d.ts
DELETED
package/dist/server/util.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// according to https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages
|
|
2
|
-
const validRedirectStatuses = new Set([301, 302, 303, 307, 308]);
|
|
3
|
-
export function getExpectedRedirectStatus(response) {
|
|
4
|
-
if (response.status && validRedirectStatuses.has(response.status)) {
|
|
5
|
-
return response.status;
|
|
6
|
-
}
|
|
7
|
-
return 302;
|
|
8
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// @refresh skip
|
|
2
|
-
import { ErrorBoundary as DefaultErrorBoundary, catchError } from "solid-js";
|
|
3
|
-
import { isServer } from "solid-js/web";
|
|
4
|
-
import { HttpStatusCode } from "./HttpStatusCode.js";
|
|
5
|
-
import { DevOverlay } from "./dev-overlay/index.jsx";
|
|
6
|
-
export const ErrorBoundary = import.meta.env.DEV && import.meta.env.START_DEV_OVERLAY
|
|
7
|
-
? (props) => <DevOverlay>{props.children}</DevOverlay>
|
|
8
|
-
: (props) => {
|
|
9
|
-
const message = isServer
|
|
10
|
-
? "500 | Internal Server Error"
|
|
11
|
-
: "Error | Uncaught Client Exception";
|
|
12
|
-
return (<DefaultErrorBoundary fallback={error => {
|
|
13
|
-
console.error(error);
|
|
14
|
-
return (<>
|
|
15
|
-
<span style="font-size:1.5em;text-align:center;position:fixed;left:0px;bottom:55%;width:100%;">
|
|
16
|
-
{message}
|
|
17
|
-
</span>
|
|
18
|
-
<HttpStatusCode code={500}/>
|
|
19
|
-
</>);
|
|
20
|
-
}}>
|
|
21
|
-
{props.children}
|
|
22
|
-
</DefaultErrorBoundary>);
|
|
23
|
-
};
|
|
24
|
-
export const TopErrorBoundary = (props) => {
|
|
25
|
-
let isError = false;
|
|
26
|
-
const res = catchError(() => props.children, err => {
|
|
27
|
-
console.error(err);
|
|
28
|
-
isError = !!err;
|
|
29
|
-
});
|
|
30
|
-
return isError ? (<>
|
|
31
|
-
<span style="font-size:1.5em;text-align:center;position:fixed;left:0px;bottom:55%;width:100%;">
|
|
32
|
-
500 | Internal Server Error
|
|
33
|
-
</span>
|
|
34
|
-
<HttpStatusCode code={500}/>
|
|
35
|
-
</>) : (res);
|
|
36
|
-
};
|
package/dist/shared/GET.d.ts
DELETED
package/dist/shared/GET.js
DELETED