@solidjs/start 0.6.0 → 0.6.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/client/StartClient.tsx +1 -0
- package/client/index.tsx +3 -0
- package/client/islands.tsx +1 -0
- package/client/spa/index.tsx +1 -0
- package/package.json +3 -2
- package/server/StartServer.tsx +1 -0
- package/server/index.tsx +2 -0
- package/server/islands/index.tsx +3 -2
- package/server/islands/utils.tsx +2 -0
- package/server/pageEvent.ts +4 -3
- package/server/renderAsset.tsx +2 -0
- package/server/spa/StartServer.tsx +1 -0
- package/server/spa/index.tsx +2 -0
- package/shared/ErrorBoundary.tsx +18 -18
- package/shared/FileRoutes.tsx +3 -3
- package/shared/HttpHeader.tsx +11 -5
- package/shared/HttpStatusCode.tsx +10 -4
- package/shared/clientOnly.tsx +1 -0
- package/shared/dev-overlay/CodeView.tsx +1 -0
- package/shared/dev-overlay/DevOverlayDialog.tsx +1 -0
- package/shared/dev-overlay/icons.tsx +1 -0
- package/shared/dev-overlay/index.tsx +1 -0
- package/shared/index.tsx +2 -0
- package/shared/lazyRoute.tsx +2 -0
package/client/StartClient.tsx
CHANGED
package/client/index.tsx
CHANGED
package/client/islands.tsx
CHANGED
package/client/spa/index.tsx
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/start",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
|
+
"license": "MIT",
|
|
6
7
|
"publishConfig": {
|
|
7
8
|
"access": "public"
|
|
8
9
|
},
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"solid-js": "^1.8.15",
|
|
46
|
-
"vinxi": "^0.3.
|
|
47
|
+
"vinxi": "^0.3.9"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
50
|
"@vinxi/plugin-directives": "^0.3.0",
|
package/server/StartServer.tsx
CHANGED
package/server/index.tsx
CHANGED
package/server/islands/index.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
// @refresh skip
|
|
2
|
+
import { lazy, sharedConfig, type Component, type ComponentProps } from "solid-js";
|
|
3
|
+
import { Hydration, NoHydration, getRequestEvent } from "solid-js/web";
|
|
3
4
|
// import { IslandManifest } from "./types";
|
|
4
5
|
import { splitProps } from "./utils";
|
|
5
6
|
|
package/server/islands/utils.tsx
CHANGED
package/server/pageEvent.ts
CHANGED
|
@@ -9,13 +9,14 @@ function initFromFlash(ctx: FetchEvent) {
|
|
|
9
9
|
const flash = getCookie(ctx, "flash");
|
|
10
10
|
if (!flash) return;
|
|
11
11
|
let param = JSON.parse(flash);
|
|
12
|
-
if (!param || !param.result) return
|
|
12
|
+
if (!param || !param.result) return;
|
|
13
13
|
const input = [...param.input.slice(0, -1), new Map(param.input[param.input.length - 1])];
|
|
14
14
|
setCookie(ctx, "flash", "", { maxAge: 0 });
|
|
15
15
|
return {
|
|
16
|
+
input,
|
|
16
17
|
url: param.url,
|
|
18
|
+
pending: false,
|
|
17
19
|
result: param.error ? new Error(param.result) : param.result,
|
|
18
|
-
input
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -36,7 +37,7 @@ export async function createPageEvent(ctx: FetchEvent) {
|
|
|
36
37
|
: [])
|
|
37
38
|
],
|
|
38
39
|
router: {
|
|
39
|
-
submission: initFromFlash(ctx)
|
|
40
|
+
submission: initFromFlash(ctx) as any
|
|
40
41
|
},
|
|
41
42
|
routes: createRoutes(),
|
|
42
43
|
// prevUrl: prevPath || "",
|
package/server/renderAsset.tsx
CHANGED
package/server/spa/index.tsx
CHANGED
package/shared/ErrorBoundary.tsx
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
+
// @refresh skip
|
|
1
2
|
import { ErrorBoundary as DefaultErrorBoundary, type ParentProps } from "solid-js";
|
|
2
3
|
import { isServer } from "solid-js/web";
|
|
3
4
|
import { HttpStatusCode } from "./HttpStatusCode";
|
|
4
5
|
import { DevOverlay } from "./dev-overlay";
|
|
5
6
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
7
|
+
export const ErrorBoundary = import.meta.env.DEV && import.meta.env.START_DEV_OVERLAY
|
|
8
|
+
? (props: ParentProps) => <DevOverlay>{props.children}</DevOverlay>
|
|
9
|
+
: (props: ParentProps) => {
|
|
10
|
+
const message = isServer ? "500 | Internal Server Error" : "Error | Uncaught Client Exception";
|
|
11
|
+
return (
|
|
12
|
+
<DefaultErrorBoundary
|
|
13
|
+
fallback={
|
|
14
|
+
<>
|
|
15
|
+
<span style="font-size:1.5em;text-align:center;position:fixed;left:0px;bottom:55%;width:100%;">{message}</span>
|
|
16
|
+
<HttpStatusCode code={500} />
|
|
17
|
+
</>
|
|
18
|
+
}
|
|
19
|
+
>
|
|
20
|
+
{props.children}
|
|
21
|
+
</DefaultErrorBoundary>
|
|
22
|
+
)
|
|
23
|
+
};
|
package/shared/FileRoutes.tsx
CHANGED
|
@@ -30,6 +30,6 @@ export function createRoutes() {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
let routes: any[];
|
|
33
|
-
export const FileRoutes =
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
export const FileRoutes = isServer
|
|
34
|
+
? () => (getRequestEvent() as PageEvent).routes
|
|
35
|
+
: () => routes || (routes = createRoutes());
|
package/shared/HttpHeader.tsx
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
// @refresh skip
|
|
1
2
|
import { onCleanup } from "solid-js";
|
|
2
3
|
import { getRequestEvent, isServer } from "solid-js/web";
|
|
3
4
|
import type { PageEvent } from "../server/types";
|
|
4
5
|
|
|
5
|
-
export
|
|
6
|
-
|
|
6
|
+
export interface HttpHeaderProps {
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
append?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const HttpHeader = isServer
|
|
13
|
+
? (props: HttpHeaderProps) => {
|
|
7
14
|
const event = getRequestEvent() as PageEvent;
|
|
8
15
|
|
|
9
16
|
if (props.append) event.response.headers.append(props.name, props.value);
|
|
@@ -23,7 +30,6 @@ export function HttpHeader(props: { name: string; value: string; append?: boolea
|
|
|
23
30
|
if (values.length) event.response.headers.set(props.name, values.join(","));
|
|
24
31
|
else event.response.headers.delete(props.name);
|
|
25
32
|
});
|
|
33
|
+
return null;
|
|
26
34
|
}
|
|
27
|
-
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
35
|
+
: (_props: HttpHeaderProps) => null;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
// @refresh skip
|
|
1
2
|
import { onCleanup } from "solid-js";
|
|
2
3
|
import { getRequestEvent, isServer } from "solid-js/web";
|
|
3
4
|
import type { PageEvent } from "../server/types";
|
|
4
5
|
|
|
5
|
-
export
|
|
6
|
-
|
|
6
|
+
export interface HttpStatusCodeProps {
|
|
7
|
+
code: number;
|
|
8
|
+
text?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const HttpStatusCode = isServer
|
|
12
|
+
? (props: HttpStatusCodeProps) => {
|
|
7
13
|
const event = getRequestEvent() as PageEvent;
|
|
8
14
|
event.response.status = props.code;
|
|
9
15
|
event.response.statusText = props.text;
|
|
10
16
|
onCleanup(() => !event.nativeEvent.handled && (event.response.status = 200));
|
|
17
|
+
return null;
|
|
11
18
|
}
|
|
12
|
-
|
|
13
|
-
}
|
|
19
|
+
: (_props: HttpStatusCodeProps) => null;
|
package/shared/clientOnly.tsx
CHANGED
package/shared/index.tsx
CHANGED
package/shared/lazyRoute.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @refresh skip
|
|
2
|
+
// TODO rename to lazyRoute.ts?
|
|
1
3
|
/// <reference types="vinxi/types/client" />
|
|
2
4
|
import { createComponent, lazy, onCleanup, type Component, type JSX } from "solid-js";
|
|
3
5
|
import { appendStyles, cleanupStyles, preloadStyles, updateStyles } from "vinxi/css";
|