@solidjs/start 0.5.3 → 0.5.5
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/config/index.js
CHANGED
|
@@ -114,8 +114,7 @@ export function defineConfig(baseConfig = {}) {
|
|
|
114
114
|
"~": join(process.cwd(), start.appRoot),
|
|
115
115
|
...(!start.ssr
|
|
116
116
|
? {
|
|
117
|
-
"@solidjs/start/server": "@solidjs/start/server/spa"
|
|
118
|
-
"@solidjs/start/entry": "@solidjs/start/entry/spa"
|
|
117
|
+
"@solidjs/start/server": "@solidjs/start/server/spa"
|
|
119
118
|
}
|
|
120
119
|
: {}),
|
|
121
120
|
...userConfig.resolve?.alias
|
package/config/server-handler.ts
CHANGED
|
@@ -168,7 +168,6 @@ async function handleServerFunction(h3Event) {
|
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
-
if (!result || typeof result === "string") return result || null;
|
|
172
171
|
setHeader(h3Event, "content-type", "text/javascript");
|
|
173
172
|
return serializeToStream(instance, result);
|
|
174
173
|
} catch (x) {
|
|
@@ -201,29 +200,36 @@ async function handleSingleFlight(sourceEvent: FetchEvent, result: any) {
|
|
|
201
200
|
return await provideRequestEvent(event, async () => {
|
|
202
201
|
await createPageEvent(event);
|
|
203
202
|
/* @ts-ignore */
|
|
204
|
-
sharedConfig.context = { event };
|
|
205
|
-
/* @ts-ignore */
|
|
206
203
|
event.router.dataOnly = revalidate || true;
|
|
207
204
|
/* @ts-ignore */
|
|
208
205
|
event.router.previousUrl = sourceEvent.request.headers.get("referer");
|
|
209
|
-
|
|
206
|
+
(async () => {
|
|
207
|
+
try {
|
|
208
|
+
await renderToStringAsync(() => {
|
|
209
|
+
/* @ts-ignore */
|
|
210
|
+
sharedConfig.context = { event };
|
|
211
|
+
App();
|
|
212
|
+
});
|
|
213
|
+
} catch (e) {
|
|
214
|
+
console.log(e);
|
|
215
|
+
}
|
|
216
|
+
})();
|
|
210
217
|
/* @ts-ignore */
|
|
211
218
|
const body = event.router.data;
|
|
212
|
-
if (body)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
result.customBody = () => body;
|
|
224
|
-
result.headers.set("X-Single-Flight", "true");
|
|
225
|
-
return result;
|
|
219
|
+
if (!body) return result;
|
|
220
|
+
let containsKey = false;
|
|
221
|
+
for (const key in body) {
|
|
222
|
+
if (body[key] === undefined) delete body[key];
|
|
223
|
+
else containsKey = true;
|
|
224
|
+
}
|
|
225
|
+
if (!containsKey) return result;
|
|
226
|
+
if (!(result instanceof Response)) {
|
|
227
|
+
body["_$value"] = result;
|
|
228
|
+
result = new Response(null, { status: 200 });
|
|
226
229
|
}
|
|
230
|
+
result.customBody = () => body;
|
|
231
|
+
result.headers.set("X-Single-Flight", "true");
|
|
232
|
+
return result;
|
|
227
233
|
});
|
|
228
234
|
}
|
|
229
235
|
|
package/package.json
CHANGED
package/server/islands/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, ComponentProps, lazy, sharedConfig } from "solid-js";
|
|
1
|
+
import { type Component, type ComponentProps, lazy, sharedConfig } from "solid-js";
|
|
2
2
|
import { getRequestEvent, Hydration, NoHydration } from "solid-js/web";
|
|
3
3
|
// import { IslandManifest } from "./types";
|
|
4
4
|
import { splitProps } from "./utils";
|
package/server/pageEvent.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
getCookie,
|
|
3
|
+
setCookie
|
|
4
4
|
} from "vinxi/http";
|
|
5
5
|
import { createRoutes } from "../shared/FileRoutes";
|
|
6
6
|
import { FetchEvent, PageEvent } from "./types";
|
|
@@ -22,7 +22,7 @@ function initFromFlash(ctx: FetchEvent) {
|
|
|
22
22
|
export async function createPageEvent(ctx: FetchEvent) {
|
|
23
23
|
const clientManifest = import.meta.env.MANIFEST["client"];
|
|
24
24
|
const serverManifest = import.meta.env.MANIFEST["ssr"];
|
|
25
|
-
ctx.response.headers.set("
|
|
25
|
+
ctx.response.headers.set("Content-Type", "text/html");
|
|
26
26
|
// const prevPath = ctx.request.headers.get("x-solid-referrer");
|
|
27
27
|
// const mutation = ctx.request.headers.get("x-solid-mutation") === "true";
|
|
28
28
|
const pageEvent: PageEvent = Object.assign(ctx, {
|
|
@@ -6,7 +6,7 @@ import { Portal } from 'solid-js/web';
|
|
|
6
6
|
import { Dialog, DialogOverlay, DialogPanel, Select, SelectOption } from 'terracotta';
|
|
7
7
|
import info from '../../package.json';
|
|
8
8
|
import { CodeView } from './CodeView';
|
|
9
|
-
import { StackFrameSource, createStackFrame } from './createStackFrame';
|
|
9
|
+
import { type StackFrameSource, createStackFrame } from './createStackFrame';
|
|
10
10
|
import download from './download';
|
|
11
11
|
import { ArrowLeftIcon, ArrowRightIcon, CameraIcon, DiscordIcon, GithubIcon, RefreshIcon, SolidStartIcon, ViewCompiledIcon, ViewOriginalIcon } from './icons';
|
|
12
12
|
import './styles.css';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accessor, createMemo, createResource } from "solid-js";
|
|
1
|
+
import { type Accessor, createMemo, createResource } from "solid-js";
|
|
2
2
|
import getSourceMap from "./get-source-map";
|
|
3
3
|
|
|
4
4
|
export interface StackFrameSource {
|
|
@@ -53,12 +53,11 @@ export function createStackFrame(
|
|
|
53
53
|
const { source, content, sourceMap } = current;
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
if (!isCompiled() && source.line && source.column) {
|
|
56
|
+
if (!isCompiled() && source.line && source.column && sourceMap) {
|
|
57
57
|
const result = sourceMap.originalPositionFor({
|
|
58
58
|
line: source.line,
|
|
59
59
|
column: source.column,
|
|
60
60
|
});
|
|
61
|
-
console.log('sourcemap', result);
|
|
62
61
|
|
|
63
62
|
return {
|
|
64
63
|
...result,
|