@solidjs/start 1.0.8 → 1.0.9
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.
|
@@ -130,9 +130,9 @@ async function fetchServerFunction(base, id, options, args) {
|
|
|
130
130
|
body: JSON.stringify(await Promise.resolve(toJSONAsync(args, { plugins }))),
|
|
131
131
|
headers: { ...options.headers, "Content-Type": "application/json" }
|
|
132
132
|
}));
|
|
133
|
-
if (response.headers.
|
|
134
|
-
response.headers.
|
|
135
|
-
response.headers.
|
|
133
|
+
if (response.headers.has("Location") ||
|
|
134
|
+
response.headers.has("X-Revalidate") ||
|
|
135
|
+
response.headers.has("X-Single-Flight")) {
|
|
136
136
|
if (response.body) {
|
|
137
137
|
/* @ts-ignore-next-line */
|
|
138
138
|
response.customBody = () => {
|
|
@@ -5,6 +5,8 @@ import type { Component, ComponentProps, JSX } from "solid-js";
|
|
|
5
5
|
*/
|
|
6
6
|
export default function clientOnly<T extends Component<any>>(fn: () => Promise<{
|
|
7
7
|
default: T;
|
|
8
|
-
}
|
|
8
|
+
}>, options?: {
|
|
9
|
+
lazy?: boolean;
|
|
10
|
+
}): (props: ComponentProps<T> & {
|
|
9
11
|
fallback?: JSX.Element;
|
|
10
12
|
}) => any;
|
|
@@ -5,15 +5,16 @@ import { isServer } from "solid-js/web";
|
|
|
5
5
|
* Read more: https://docs.solidjs.com/solid-start/reference/client/client-only
|
|
6
6
|
*/
|
|
7
7
|
// not using Suspense
|
|
8
|
-
export default function clientOnly(fn) {
|
|
8
|
+
export default function clientOnly(fn, options = {}) {
|
|
9
9
|
if (isServer)
|
|
10
10
|
return (props) => props.fallback;
|
|
11
11
|
const [comp, setComp] = createSignal();
|
|
12
|
-
|
|
12
|
+
!options.lazy && load(fn, setComp);
|
|
13
13
|
return (props) => {
|
|
14
14
|
let Comp;
|
|
15
15
|
let m;
|
|
16
16
|
const [, rest] = splitProps(props, ["fallback"]);
|
|
17
|
+
options.lazy && load(fn, setComp);
|
|
17
18
|
if ((Comp = comp()) && !sharedConfig.context)
|
|
18
19
|
return Comp(rest);
|
|
19
20
|
const [mounted, setMounted] = createSignal(!sharedConfig.context);
|
|
@@ -21,3 +22,6 @@ export default function clientOnly(fn) {
|
|
|
21
22
|
return createMemo(() => ((Comp = comp()), (m = mounted()), untrack(() => (Comp && m ? Comp(rest) : props.fallback))));
|
|
22
23
|
};
|
|
23
24
|
}
|
|
25
|
+
function load(fn, setComp) {
|
|
26
|
+
fn().then(m => setComp(() => m.default));
|
|
27
|
+
}
|
|
@@ -14,12 +14,20 @@ export function classNames(...classes) {
|
|
|
14
14
|
return classes.filter(Boolean).join(' ');
|
|
15
15
|
}
|
|
16
16
|
function ErrorInfo(props) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const error = createMemo(() => {
|
|
18
|
+
const e = props.error;
|
|
19
|
+
if (e instanceof Error) {
|
|
20
|
+
return { name: e.name, message: e.message };
|
|
21
|
+
}
|
|
22
|
+
if (e instanceof ErrorEvent) {
|
|
23
|
+
return { message: e.message };
|
|
24
|
+
}
|
|
25
|
+
return { message: e.toString() };
|
|
26
|
+
});
|
|
27
|
+
return (<span class="dev-overlay-error-info">
|
|
28
|
+
<span class="dev-overlay-error-info-name">{error().name}</span>
|
|
29
|
+
<span class="dev-overlay-error-info-message">{error().message}</span>
|
|
30
|
+
</span>);
|
|
23
31
|
}
|
|
24
32
|
function getFileName(source) {
|
|
25
33
|
try {
|
|
@@ -7,7 +7,7 @@ const DevOverlayDialog =
|
|
|
7
7
|
? () => {
|
|
8
8
|
return <></>;
|
|
9
9
|
}
|
|
10
|
-
: /* #__PURE__ */ clientOnly(() => import("./DevOverlayDialog"));
|
|
10
|
+
: /* #__PURE__ */ clientOnly(() => import("./DevOverlayDialog"), { lazy: true });
|
|
11
11
|
export function DevOverlay(props) {
|
|
12
12
|
const [errors, setErrors] = createSignal([]);
|
|
13
13
|
function resetError() {
|
|
@@ -20,7 +20,7 @@ export function DevOverlay(props) {
|
|
|
20
20
|
}
|
|
21
21
|
createEffect(() => {
|
|
22
22
|
const onErrorEvent = (error) => {
|
|
23
|
-
pushError(error.error);
|
|
23
|
+
pushError(error.error ?? error);
|
|
24
24
|
};
|
|
25
25
|
window.addEventListener("error", onErrorEvent);
|
|
26
26
|
onCleanup(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/start",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"solid-js": "^1.9.
|
|
58
|
+
"solid-js": "^1.9.2",
|
|
59
59
|
"vinxi": "^0.4.3",
|
|
60
60
|
"typescript": "^5.4.2"
|
|
61
61
|
},
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"@vinxi/server-functions": "^0.4.3",
|
|
66
66
|
"defu": "^6.1.2",
|
|
67
67
|
"error-stack-parser": "^2.1.4",
|
|
68
|
-
"glob": "^10.3.10",
|
|
69
68
|
"html-to-image": "^1.11.11",
|
|
70
69
|
"radix3": "^1.1.0",
|
|
71
70
|
"seroval": "^1.0.2",
|
|
@@ -73,6 +72,7 @@
|
|
|
73
72
|
"shikiji": "^0.9.12",
|
|
74
73
|
"source-map-js": "^1.0.2",
|
|
75
74
|
"terracotta": "^1.0.4",
|
|
75
|
+
"tinyglobby": "^0.2.2",
|
|
76
76
|
"vite-plugin-solid": "^2.10.2"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|