@solidjs/start 2.0.0-rc.1 → 2.0.0-rc.2
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 +12 -0
- package/dist/fns/client.js +13 -3
- package/dist/fns/handler.js +7 -5
- package/dist/fns/serialization.d.ts +15 -0
- package/dist/fns/serialization.js +1 -1
- package/dist/server/handler.d.ts +2 -2
- package/dist/server/handler.js +5 -3
- package/dist/server/spa/handler.d.ts +2 -2
- package/dist/server/spa/handler.js +2 -2
- package/dist/shared/ErrorBoundary.jsx +3 -3
- package/dist/shared/{dev-overlay → dev-toolbar/error-viewer}/CodeView.jsx +3 -3
- 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 +41 -0
- package/dist/shared/dev-toolbar/functions/FormDataViewer.d.ts +5 -0
- package/dist/shared/dev-toolbar/functions/FormDataViewer.jsx +27 -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 +78 -0
- package/dist/shared/dev-toolbar/functions/SerovalValue.css +7 -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 +71 -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 +24 -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 +110 -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 +175 -0
- package/dist/shared/ui/Badge.css +34 -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 +26 -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 +6 -0
- package/dist/shared/ui/Section.css +19 -0
- package/dist/shared/ui/Section.d.ts +9 -0
- package/dist/shared/ui/Section.jsx +12 -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 +69 -0
- package/dist/shared/ui/Text.d.ts +12 -0
- package/dist/shared/ui/Text.jsx +17 -0
- package/package.json +3 -3
- 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/createStackFrame.js → dev-toolbar/error-viewer/create-stack-frame.js} +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,16 @@
|
|
|
1
1
|
# @solidjs/start
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- eeff49a: add new dev toolbar
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- bd8cb01: Update srvx to version 0.12.0.
|
|
12
|
+
- 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.
|
|
13
|
+
|
|
3
14
|
## 2.0.0-rc.1
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -144,6 +155,7 @@
|
|
|
144
155
|
- 8256190: Rework `@solidjs/start/env`
|
|
145
156
|
- 6cbba24: Fix multiple Set-Cookie headers being lost on redirect responses
|
|
146
157
|
- d4cc548: ## Bump Seroval
|
|
158
|
+
|
|
147
159
|
- version `1.4.1`
|
|
148
160
|
|
|
149
161
|
- dd40610: Handle base url in api routes
|
package/dist/fns/client.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { pushRequest, pushResponse } from "../shared/dev-toolbar/functions/tracker.js";
|
|
1
2
|
import {
|
|
2
3
|
// serializeToJSONStream,
|
|
3
4
|
serializeToJSONString, } from "./serialization.js";
|
|
4
|
-
import { BODY_FORMAT_KEY, BodyFormat, extractBody, getHeadersAndBody
|
|
5
|
+
import { BODY_FORMAT_KEY, BodyFormat, extractBody, getHeadersAndBody } from "./shared.js";
|
|
5
6
|
let INSTANCE = 0;
|
|
6
|
-
function createRequest(base, id, instance, options) {
|
|
7
|
-
|
|
7
|
+
async function createRequest(base, id, instance, options) {
|
|
8
|
+
const request = new Request(base, {
|
|
8
9
|
method: "POST",
|
|
9
10
|
...options,
|
|
10
11
|
headers: {
|
|
@@ -13,6 +14,15 @@ function createRequest(base, id, instance, options) {
|
|
|
13
14
|
"X-Server-Instance": instance,
|
|
14
15
|
},
|
|
15
16
|
});
|
|
17
|
+
if (import.meta.env.DEV) {
|
|
18
|
+
console.log(pushRequest);
|
|
19
|
+
pushRequest(id, instance, request.clone());
|
|
20
|
+
}
|
|
21
|
+
const response = await fetch(request);
|
|
22
|
+
if (import.meta.env.DEV) {
|
|
23
|
+
pushResponse(id, instance, response.clone());
|
|
24
|
+
}
|
|
25
|
+
return response;
|
|
16
26
|
}
|
|
17
27
|
async function initializeResponse(base, id, instance, options, args) {
|
|
18
28
|
// No args, skip serialization
|
package/dist/fns/handler.js
CHANGED
|
@@ -121,7 +121,6 @@ export async function handleServerFunction(h3Event) {
|
|
|
121
121
|
h3Event.res.headers.set("content-type", "text/javascript");
|
|
122
122
|
return serializeToJSStream(instance, result);
|
|
123
123
|
}
|
|
124
|
-
h3Event.res.headers.set("content-type", "text/plain");
|
|
125
124
|
return serializeToJSONStream(result);
|
|
126
125
|
}
|
|
127
126
|
catch (x) {
|
|
@@ -133,7 +132,8 @@ export async function handleServerFunction(h3Event) {
|
|
|
133
132
|
if (x.headers)
|
|
134
133
|
mergeResponseHeaders(h3Event, x.headers);
|
|
135
134
|
// forward non-redirect statuses
|
|
136
|
-
if (x.status &&
|
|
135
|
+
if (x.status &&
|
|
136
|
+
(!instance || x.status < 300 || x.status >= 400))
|
|
137
137
|
h3Event.res.status = x.status;
|
|
138
138
|
if (x.customBody) {
|
|
139
139
|
x = await x.customBody();
|
|
@@ -166,7 +166,6 @@ export async function handleServerFunction(h3Event) {
|
|
|
166
166
|
h3Event.res.headers.set("content-type", "text/javascript");
|
|
167
167
|
return serializeToJSStream(instance, x);
|
|
168
168
|
}
|
|
169
|
-
h3Event.res.headers.set("content-type", "text/plain");
|
|
170
169
|
return serializeToJSONStream(x);
|
|
171
170
|
}
|
|
172
171
|
return x;
|
|
@@ -205,7 +204,10 @@ function handleNoJS(result, request, parsed, thrown) {
|
|
|
205
204
|
result: isError ? result.message : result,
|
|
206
205
|
thrown: thrown,
|
|
207
206
|
error: isError,
|
|
208
|
-
input: [
|
|
207
|
+
input: [
|
|
208
|
+
...parsed.slice(0, -1),
|
|
209
|
+
[...parsed[parsed.length - 1].entries()],
|
|
210
|
+
],
|
|
209
211
|
}))}; Secure; HttpOnly;`);
|
|
210
212
|
}
|
|
211
213
|
return new Response(null, {
|
|
@@ -227,7 +229,7 @@ export function createSingleFlightHeaders(sourceEvent) {
|
|
|
227
229
|
// useH3Internals = true;
|
|
228
230
|
// sourceEvent.nativeEvent.node.req.headers.cookie = "";
|
|
229
231
|
// }
|
|
230
|
-
SetCookies.forEach(cookie => {
|
|
232
|
+
SetCookies.forEach((cookie) => {
|
|
231
233
|
if (!cookie)
|
|
232
234
|
return;
|
|
233
235
|
const { maxAge, expires, name, value } = parseSetCookie(cookie);
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
export declare function serializeToJSStream(id: string, value: any): ReadableStream<any>;
|
|
2
2
|
export declare function serializeToJSONStream(value: any): ReadableStream<any>;
|
|
3
|
+
export declare class SerovalChunkReader {
|
|
4
|
+
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
5
|
+
buffer: Uint8Array;
|
|
6
|
+
done: boolean;
|
|
7
|
+
constructor(stream: ReadableStream<Uint8Array>);
|
|
8
|
+
readChunk(): Promise<void>;
|
|
9
|
+
next(): Promise<{
|
|
10
|
+
done: true;
|
|
11
|
+
value: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
done: false;
|
|
14
|
+
value: string;
|
|
15
|
+
}>;
|
|
16
|
+
drain(interpret: (chunk: string) => void): Promise<void>;
|
|
17
|
+
}
|
|
3
18
|
export declare function serializeToJSONString(value: any): Promise<string>;
|
|
4
19
|
export declare function deserializeFromJSONString(json: string): Promise<unknown>;
|
|
5
20
|
export declare function deserializeJSONStream(response: Response | Request): Promise<unknown>;
|
package/dist/server/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { H3 } from "h3/generic";
|
|
2
2
|
import type { JSX } from "solid-js";
|
|
3
3
|
import type { FetchEvent, HandlerOptions, PageEvent } from "./types.ts";
|
|
4
|
-
export declare function createBaseHandler(createPageEvent: (e: FetchEvent) => Promise<PageEvent>, fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>)): H3;
|
|
5
|
-
export declare function createHandler(fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>)): H3;
|
|
4
|
+
export declare function createBaseHandler(createPageEvent: (e: FetchEvent) => Promise<PageEvent>, fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>), routerLoad?: (event: FetchEvent) => Promise<void>): H3;
|
|
5
|
+
export declare function createHandler(fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>), routerLoad?: (event: FetchEvent) => Promise<void>): H3;
|
|
6
6
|
export declare function createPageEvent(ctx: FetchEvent): Promise<PageEvent>;
|
package/dist/server/handler.js
CHANGED
|
@@ -11,7 +11,7 @@ import { getExpectedRedirectStatus } from "./util.js";
|
|
|
11
11
|
import { toWebReadableStream } from "./web-stream.js";
|
|
12
12
|
import { stripPathBase } from "./strip-path-base.js";
|
|
13
13
|
const SERVER_FN_BASE = "/_server";
|
|
14
|
-
export function createBaseHandler(createPageEvent, fn, options = {}) {
|
|
14
|
+
export function createBaseHandler(createPageEvent, fn, options = {}, routerLoad) {
|
|
15
15
|
const handler = defineHandler({
|
|
16
16
|
middleware: middleware.length ? middleware.map(decorateMiddleware) : undefined,
|
|
17
17
|
handler: decorateHandler(async (e) => {
|
|
@@ -47,6 +47,8 @@ export function createBaseHandler(createPageEvent, fn, options = {}) {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
if (routerLoad)
|
|
51
|
+
await routerLoad(event);
|
|
50
52
|
const context = await createPageEvent(event);
|
|
51
53
|
const resolvedOptions = typeof options === "function" ? await options(context) : { ...options };
|
|
52
54
|
const mode = resolvedOptions.mode || "stream";
|
|
@@ -104,8 +106,8 @@ export function createBaseHandler(createPageEvent, fn, options = {}) {
|
|
|
104
106
|
app.use(handler);
|
|
105
107
|
return app;
|
|
106
108
|
}
|
|
107
|
-
export function createHandler(fn, options = {}) {
|
|
108
|
-
return createBaseHandler(createPageEvent, fn, options);
|
|
109
|
+
export function createHandler(fn, options = {}, routerLoad) {
|
|
110
|
+
return createBaseHandler(createPageEvent, fn, options, routerLoad);
|
|
109
111
|
}
|
|
110
112
|
export async function createPageEvent(ctx) {
|
|
111
113
|
ctx.response.headers.set("Content-Type", "text/html");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { H3 } from "h3/generic";
|
|
2
2
|
import type { JSX } from "solid-js";
|
|
3
|
-
import type { HandlerOptions, PageEvent } from "../types.ts";
|
|
3
|
+
import type { FetchEvent, HandlerOptions, PageEvent } from "../types.ts";
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* Read more: https://docs.solidjs.com/solid-start/reference/server/create-handler
|
|
7
7
|
*/
|
|
8
|
-
export declare function createHandler(fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions)): H3;
|
|
8
|
+
export declare function createHandler(fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions), routerLoad?: (event: FetchEvent) => Promise<void>): H3;
|
|
@@ -4,8 +4,8 @@ import { getSsrManifest } from "../manifest/ssr-manifest.js";
|
|
|
4
4
|
*
|
|
5
5
|
* Read more: https://docs.solidjs.com/solid-start/reference/server/create-handler
|
|
6
6
|
*/
|
|
7
|
-
export function createHandler(fn, options) {
|
|
8
|
-
return createBaseHandler(createPageEvent, fn, options);
|
|
7
|
+
export function createHandler(fn, options, routerLoad) {
|
|
8
|
+
return createBaseHandler(createPageEvent, fn, options, routerLoad);
|
|
9
9
|
}
|
|
10
10
|
async function createPageEvent(ctx) {
|
|
11
11
|
const manifest = getSsrManifest("ssr");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @refresh skip
|
|
2
|
-
import { ErrorBoundary as DefaultErrorBoundary
|
|
2
|
+
import { catchError, ErrorBoundary as DefaultErrorBoundary } from "solid-js";
|
|
3
3
|
import { isServer } from "solid-js/web";
|
|
4
|
+
import { DevToolbar } from "./dev-toolbar/index.jsx";
|
|
4
5
|
import { HttpStatusCode } from "./HttpStatusCode.js";
|
|
5
|
-
import { DevOverlay } from "./dev-overlay/index.jsx";
|
|
6
6
|
export const ErrorBoundary = import.meta.env.DEV && import.meta.env.START_DEV_OVERLAY
|
|
7
|
-
? (props) => <
|
|
7
|
+
? (props) => <DevToolbar>{props.children}</DevToolbar>
|
|
8
8
|
: (props) => {
|
|
9
9
|
const message = isServer
|
|
10
10
|
? "500 | Internal Server Error"
|
|
@@ -51,12 +51,12 @@ export function CodeView(props) {
|
|
|
51
51
|
for (let i = 0, len = lines.length; i < len; i++) {
|
|
52
52
|
const el = lines[i];
|
|
53
53
|
if (props.line - minLine() - 1 === i) {
|
|
54
|
-
el.dataset.
|
|
54
|
+
el.dataset.startErrorViewerErrorLine = '';
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
|
-
return (<div ref={ref} data-start-
|
|
60
|
-
"--
|
|
59
|
+
return (<div ref={ref} data-start-error-viewer-code-view style={{
|
|
60
|
+
"--error-viewer-code-view-start": minLine() + 1,
|
|
61
61
|
}}/>);
|
|
62
62
|
}
|
package/dist/shared/{dev-overlay/DevOverlayDialog.d.ts → dev-toolbar/error-viewer/index.d.ts}
RENAMED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { JSX } from "solid-js";
|
|
2
2
|
import "./styles.css";
|
|
3
3
|
export declare function classNames(...classes: (string | boolean | undefined)[]): string;
|
|
4
|
-
interface
|
|
4
|
+
interface ErrorViewerProps {
|
|
5
|
+
show?: boolean;
|
|
5
6
|
errors: any[];
|
|
6
7
|
resetError: () => void;
|
|
7
8
|
}
|
|
8
|
-
export default function
|
|
9
|
+
export default function ErrorViewer(props: ErrorViewerProps): JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
import ErrorStackParser from "error-stack-parser";
|
|
3
3
|
import * as htmlToImage from "html-to-image";
|
|
4
4
|
import { createMemo, createSignal, ErrorBoundary, For, Show, Suspense } from "solid-js";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import info from "../../../package.json" with { type: "json" };
|
|
5
|
+
import IconButton from "../../ui/IconButton.jsx";
|
|
6
|
+
import { Select, SelectOption } from "../../ui/Select.jsx";
|
|
7
|
+
import { ArrowLeftIcon, ArrowRightIcon, CameraIcon, DiscordIcon, GithubIcon, RefreshIcon, ViewCompiledIcon, ViewOriginalIcon, } from "../icons.jsx";
|
|
9
8
|
import { CodeView } from "./CodeView.jsx";
|
|
10
|
-
import { createStackFrame } from "./
|
|
9
|
+
import { createStackFrame } from "./create-stack-frame.js";
|
|
11
10
|
import download from "./download.js";
|
|
12
|
-
import { ArrowLeftIcon, ArrowRightIcon, CameraIcon, DiscordIcon, GithubIcon, RefreshIcon, SolidStartIcon, ViewCompiledIcon, ViewOriginalIcon, } from "./icons.jsx";
|
|
13
11
|
import "./styles.css";
|
|
14
12
|
export function classNames(...classes) {
|
|
15
13
|
return classes.filter(Boolean).join(" ");
|
|
@@ -25,9 +23,9 @@ function ErrorInfo(props) {
|
|
|
25
23
|
}
|
|
26
24
|
return { message: e.toString() };
|
|
27
25
|
});
|
|
28
|
-
return (<span data-start-
|
|
29
|
-
<span data-start-
|
|
30
|
-
<span data-start-
|
|
26
|
+
return (<span data-start-error-viewer-error-info>
|
|
27
|
+
<span data-start-error-viewer-error-info-name>{error().name}</span>
|
|
28
|
+
<span data-start-error-viewer-error-info-message>{error().message}</span>
|
|
31
29
|
</span>);
|
|
32
30
|
}
|
|
33
31
|
function getFileName(source) {
|
|
@@ -46,23 +44,23 @@ function getFilePath(source) {
|
|
|
46
44
|
return `${getFileName(source.source)}${line}${column}`;
|
|
47
45
|
}
|
|
48
46
|
function CodeFallback() {
|
|
49
|
-
return (<div data-start-
|
|
47
|
+
return (<div data-start-error-viewer-stack-frames-code-fallback>
|
|
50
48
|
<span>Source not available.</span>
|
|
51
49
|
</div>);
|
|
52
50
|
}
|
|
53
51
|
function StackFramesContent(props) {
|
|
54
52
|
const stackframes = ErrorStackParser.parse(props.error);
|
|
55
53
|
const [selectedFrame, setSelectedFrame] = createSignal(stackframes[0]);
|
|
56
|
-
return (<div data-start-
|
|
57
|
-
<div data-start-
|
|
54
|
+
return (<div data-start-error-viewer-stack-frames-content>
|
|
55
|
+
<div data-start-error-viewer-stack-frames-code>
|
|
58
56
|
<ErrorBoundary fallback={null}>
|
|
59
57
|
{(() => {
|
|
60
58
|
const data = createStackFrame(selectedFrame(), () => props.isCompiled);
|
|
61
59
|
return (<Suspense fallback={<CodeFallback />}>
|
|
62
60
|
<Show when={data()} keyed fallback={<CodeFallback />}>
|
|
63
61
|
{source => (<>
|
|
64
|
-
<span data-start-
|
|
65
|
-
<div data-start-
|
|
62
|
+
<span data-start-error-viewer-stack-frames-code-source>{source.source}</span>
|
|
63
|
+
<div data-start-error-viewer-stack-frames-code-container>
|
|
66
64
|
<CodeView fileName={source.source} line={source.line} content={source.content}/>
|
|
67
65
|
</div>
|
|
68
66
|
</>)}
|
|
@@ -71,13 +69,13 @@ function StackFramesContent(props) {
|
|
|
71
69
|
})()}
|
|
72
70
|
</ErrorBoundary>
|
|
73
71
|
</div>
|
|
74
|
-
<Select data-start-
|
|
72
|
+
<Select data-start-error-viewer-stack-frames value={selectedFrame()} onChange={setSelectedFrame}>
|
|
75
73
|
<For each={stackframes}>
|
|
76
|
-
{current => (<ErrorBoundary fallback={<
|
|
77
|
-
<span data-start-
|
|
74
|
+
{current => (<ErrorBoundary fallback={<SelectOption value={current} disabled data-start-error-viewer-stack-frame>
|
|
75
|
+
<span data-start-error-viewer-stack-frame-function>
|
|
78
76
|
{current.functionName ?? "<anonymous>"}
|
|
79
77
|
</span>
|
|
80
|
-
<span data-start-
|
|
78
|
+
<span data-start-error-viewer-stack-frame-file>
|
|
81
79
|
{getFilePath({
|
|
82
80
|
source: current.getFileName(),
|
|
83
81
|
content: "",
|
|
@@ -86,16 +84,18 @@ function StackFramesContent(props) {
|
|
|
86
84
|
name: current.getFunctionName(),
|
|
87
85
|
})}
|
|
88
86
|
</span>
|
|
89
|
-
</
|
|
87
|
+
</SelectOption>}>
|
|
90
88
|
{(() => {
|
|
91
89
|
const data = createStackFrame(current, () => props.isCompiled);
|
|
92
90
|
return (<Suspense>
|
|
93
91
|
<Show when={data()} keyed>
|
|
94
|
-
{source => (<SelectOption data-start-
|
|
95
|
-
<span data-start-
|
|
92
|
+
{source => (<SelectOption data-start-error-viewer-stack-frame value={current}>
|
|
93
|
+
<span data-start-error-viewer-stack-frame-function>
|
|
96
94
|
{source.name ?? "<anonymous>"}
|
|
97
95
|
</span>
|
|
98
|
-
<span data-start-
|
|
96
|
+
<span data-start-error-viewer-stack-frame-file>
|
|
97
|
+
{getFilePath(source)}
|
|
98
|
+
</span>
|
|
99
99
|
</SelectOption>)}
|
|
100
100
|
</Show>
|
|
101
101
|
</Suspense>);
|
|
@@ -112,7 +112,7 @@ function StackFrames(props) {
|
|
|
112
112
|
}
|
|
113
113
|
const ISSUE_THREAD = "https://github.com/solidjs/solid-start/issues/new";
|
|
114
114
|
const DISCORD_INVITE = "https://discord.com/invite/solidjs";
|
|
115
|
-
export default function
|
|
115
|
+
export default function ErrorViewer(props) {
|
|
116
116
|
const [currentPage, setCurrentPage] = createSignal(1);
|
|
117
117
|
const [isCompiled, setIsCompiled] = createSignal(false);
|
|
118
118
|
const length = createMemo(() => props.errors.length);
|
|
@@ -164,63 +164,52 @@ export default function DevOverlayDialog(props) {
|
|
|
164
164
|
function redirectToDiscord() {
|
|
165
165
|
window.open(DISCORD_INVITE, "_blank").focus();
|
|
166
166
|
}
|
|
167
|
-
return (<
|
|
168
|
-
<
|
|
169
|
-
<div>
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
<span>{info.version}</span>
|
|
167
|
+
return (<Show when={props.show}>
|
|
168
|
+
<div data-start-dev-toolbar-panel>
|
|
169
|
+
<div ref={setPanel} data-start-error-viewer>
|
|
170
|
+
<div data-start-error-viewer-navbar>
|
|
171
|
+
<div data-start-error-viewer-navbar-left>
|
|
172
|
+
<Show when={props.errors.length > 1}>
|
|
173
|
+
<div data-start-error-viewer-pagination>
|
|
174
|
+
<IconButton data-start-error-viewer-button onClick={goPrev} type="button">
|
|
175
|
+
<ArrowLeftIcon title="Go Previous"/>
|
|
176
|
+
</IconButton>
|
|
177
|
+
<div data-start-error-viewer-page-counter>
|
|
178
|
+
{`${truncated()} of ${props.errors.length}`}
|
|
180
179
|
</div>
|
|
181
|
-
<
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
<ArrowLeftIcon title="Go Previous"/>
|
|
185
|
-
</button>
|
|
186
|
-
<div data-start-dev-overlay-page-counter>
|
|
187
|
-
{`${truncated()} of ${props.errors.length}`}
|
|
188
|
-
</div>
|
|
189
|
-
<button data-start-dev-overlay-button onClick={goNext} type="button">
|
|
190
|
-
<ArrowRightIcon title="Go Next"/>
|
|
191
|
-
</button>
|
|
192
|
-
</div>
|
|
193
|
-
</Show>
|
|
194
|
-
</div>
|
|
195
|
-
<div data-start-dev-overlay-controls>
|
|
196
|
-
<button data-start-dev-overlay-button onClick={redirectToGithub} type="button">
|
|
197
|
-
<GithubIcon title="Create an issue thread on Github"/>
|
|
198
|
-
</button>
|
|
199
|
-
<button data-start-dev-overlay-button onClick={redirectToDiscord} type="button">
|
|
200
|
-
<DiscordIcon title="Join our Discord Channel"/>
|
|
201
|
-
</button>
|
|
202
|
-
<button data-start-dev-overlay-button onClick={downloadScreenshot} type="button">
|
|
203
|
-
<CameraIcon title="Capture Error Overlay"/>
|
|
204
|
-
</button>
|
|
205
|
-
<button data-start-dev-overlay-button onClick={toggleIsCompiled} type="button">
|
|
206
|
-
<Show when={isCompiled()} fallback={<ViewOriginalIcon title="View Original Source"/>}>
|
|
207
|
-
<ViewCompiledIcon title="View Compiled Source"/>
|
|
208
|
-
</Show>
|
|
209
|
-
</button>
|
|
210
|
-
<button data-start-dev-overlay-button onClick={props.resetError} type="button">
|
|
211
|
-
<RefreshIcon title="Reset Error"/>
|
|
212
|
-
</button>
|
|
180
|
+
<IconButton data-start-error-viewer-button onClick={goNext} type="button">
|
|
181
|
+
<ArrowRightIcon title="Go Next"/>
|
|
182
|
+
</IconButton>
|
|
213
183
|
</div>
|
|
214
|
-
</div>
|
|
215
|
-
<Show when={props.errors[truncated() - 1]} keyed>
|
|
216
|
-
{current => (<div data-start-dev-overlay-content>
|
|
217
|
-
<ErrorInfo error={current}/>
|
|
218
|
-
<StackFrames error={current} isCompiled={isCompiled()}/>
|
|
219
|
-
</div>)}
|
|
220
184
|
</Show>
|
|
221
185
|
</div>
|
|
222
|
-
|
|
186
|
+
<div data-start-error-viewer-controls>
|
|
187
|
+
<IconButton data-start-error-viewer-button onClick={redirectToGithub} type="button">
|
|
188
|
+
<GithubIcon title="Create an issue thread on Github"/>
|
|
189
|
+
</IconButton>
|
|
190
|
+
<IconButton data-start-error-viewer-button onClick={redirectToDiscord} type="button">
|
|
191
|
+
<DiscordIcon title="Join our Discord Channel"/>
|
|
192
|
+
</IconButton>
|
|
193
|
+
<IconButton data-start-error-viewer-button onClick={downloadScreenshot} type="button">
|
|
194
|
+
<CameraIcon title="Capture Error Overlay"/>
|
|
195
|
+
</IconButton>
|
|
196
|
+
<IconButton data-start-error-viewer-button onClick={toggleIsCompiled} type="button">
|
|
197
|
+
<Show when={isCompiled()} fallback={<ViewOriginalIcon title="View Original Source"/>}>
|
|
198
|
+
<ViewCompiledIcon title="View Compiled Source"/>
|
|
199
|
+
</Show>
|
|
200
|
+
</IconButton>
|
|
201
|
+
<IconButton data-start-error-viewer-button onClick={props.resetError} type="button">
|
|
202
|
+
<RefreshIcon title="Reset Error"/>
|
|
203
|
+
</IconButton>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
<Show when={props.errors[truncated() - 1]} keyed>
|
|
207
|
+
{current => (<div data-start-error-viewer-content>
|
|
208
|
+
<ErrorInfo error={current}/>
|
|
209
|
+
<StackFrames error={current} isCompiled={isCompiled()}/>
|
|
210
|
+
</div>)}
|
|
211
|
+
</Show>
|
|
223
212
|
</div>
|
|
224
|
-
</
|
|
225
|
-
</
|
|
213
|
+
</div>
|
|
214
|
+
</Show>);
|
|
226
215
|
}
|