@solidjs/start 1.2.1 → 2.0.0-alpha.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 +14 -0
- package/README.md +2 -2
- package/dist/client/StartClient.d.ts +0 -1
- package/dist/client/StartClient.jsx +2 -4
- package/dist/client/index.d.ts +2 -3
- package/dist/client/index.jsx +2 -4
- package/dist/client/mount.d.ts +1 -7
- package/dist/client/mount.js +1 -91
- package/dist/client/spa/index.d.ts +1 -2
- package/dist/client/spa/index.jsx +1 -2
- package/dist/config/constants.d.ts +16 -0
- package/dist/config/constants.js +16 -0
- package/dist/config/dev-server.d.ts +2 -0
- package/dist/config/dev-server.js +108 -0
- package/dist/config/fs-router.d.ts +37 -0
- package/dist/config/fs-router.js +141 -0
- package/dist/config/fs-routes/fs-watcher.d.ts +3 -0
- package/dist/config/fs-routes/fs-watcher.js +49 -0
- package/dist/config/fs-routes/index.d.ts +7 -0
- package/dist/config/fs-routes/index.js +107 -0
- package/dist/config/fs-routes/router.d.ts +37 -0
- package/dist/config/fs-routes/router.js +136 -0
- package/dist/config/fs-routes/tree-shake.d.ts +2 -0
- package/dist/config/fs-routes/tree-shake.js +348 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.js +214 -0
- package/dist/config/lazy.d.ts +3 -0
- package/dist/config/lazy.js +82 -0
- package/dist/config/manifest.d.ts +3 -0
- package/dist/config/manifest.js +74 -0
- package/dist/config/utils.d.ts +4 -0
- package/dist/config/utils.js +6 -0
- package/dist/config/vite-utils.d.ts +16 -0
- package/dist/config/vite-utils.js +81 -0
- package/dist/http/index.d.ts +81 -0
- package/dist/http/index.js +129 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.jsx +5 -5
- package/dist/middleware/index.d.ts +6 -6
- package/dist/middleware/index.js +39 -0
- package/dist/{router/FileRoutes.js → router.jsx} +7 -8
- package/dist/server/StartServer.d.ts +3 -3
- package/dist/server/StartServer.jsx +9 -63
- package/dist/server/assets/index.d.ts +2 -0
- package/dist/server/assets/index.js +52 -0
- package/dist/server/assets/render.d.ts +19 -0
- package/dist/server/{renderAsset.jsx → assets/render.jsx} +1 -1
- package/dist/server/collect-styles.d.ts +3 -0
- package/dist/server/collect-styles.js +69 -0
- package/dist/server/fetchEvent.d.ts +4 -3
- package/dist/server/fetchEvent.js +12 -74
- package/dist/server/fetchEvent.spec.js +18 -197
- package/dist/server/handler.d.ts +6 -12
- package/dist/server/handler.js +193 -96
- package/dist/server/index.d.ts +9 -6
- package/dist/server/index.jsx +14 -6
- package/dist/server/manifest/client-manifest.d.ts +9 -0
- package/dist/server/manifest/client-manifest.js +6 -0
- package/dist/server/manifest/dev-client-manifest.d.ts +4 -0
- package/dist/server/manifest/dev-client-manifest.js +24 -0
- package/dist/server/manifest/dev-ssr-manifest.d.ts +5 -0
- package/dist/server/manifest/dev-ssr-manifest.js +23 -0
- package/dist/server/manifest/prod-client-manifest.d.ts +5 -0
- package/dist/server/manifest/prod-client-manifest.js +26 -0
- package/dist/server/manifest/prod-ssr-manifest.d.ts +6 -0
- package/dist/server/manifest/prod-ssr-manifest.js +85 -0
- package/dist/server/manifest/ssr-manifest.d.ts +4 -0
- package/dist/server/manifest/ssr-manifest.js +6 -0
- package/dist/{router → server}/routes.d.ts +5 -10
- package/dist/{router → server}/routes.js +32 -33
- package/dist/{runtime → server}/server-fns-runtime.d.ts +1 -1
- package/dist/{runtime → server}/server-fns-runtime.js +8 -7
- package/dist/server/server-functions-handler.d.ts +2 -0
- package/dist/{runtime/server-handler.js → server/server-functions-handler.js} +57 -97
- package/dist/server/server-runtime.d.ts +3 -0
- package/dist/{runtime → server}/server-runtime.js +17 -24
- package/dist/server/spa/StartServer.d.ts +1 -1
- package/dist/server/spa/StartServer.jsx +7 -9
- package/dist/server/spa/handler.d.ts +3 -3
- package/dist/server/spa/handler.js +9 -11
- package/dist/server/spa/index.d.ts +4 -3
- package/dist/server/spa/index.jsx +4 -3
- package/dist/server/types.d.ts +7 -9
- package/dist/server/util.d.ts +2 -0
- package/dist/server/util.js +8 -0
- package/dist/shared/ErrorBoundary.jsx +2 -2
- package/dist/shared/HttpHeader.jsx +4 -2
- package/dist/shared/{HttpStatusCode.jsx → HttpStatusCode.js} +3 -1
- package/dist/shared/dev-overlay/CodeView.d.ts +1 -1
- package/dist/shared/dev-overlay/CodeView.jsx +23 -34
- package/dist/shared/dev-overlay/DevOverlayDialog.d.ts +2 -2
- package/dist/shared/dev-overlay/DevOverlayDialog.jsx +73 -64
- package/dist/shared/dev-overlay/createStackFrame.js +3 -3
- package/dist/shared/dev-overlay/get-source-map.d.ts +1 -1
- package/dist/shared/dev-overlay/get-source-map.js +5 -5
- package/dist/shared/dev-overlay/icons.d.ts +10 -10
- package/dist/shared/dev-overlay/icons.jsx +91 -91
- package/dist/shared/dev-overlay/index.jsx +6 -9
- package/dist/shared/lazy.d.ts +3 -0
- package/dist/shared/lazy.js +42 -0
- package/dist/shared/serverFunction.d.ts +1 -1
- package/env.d.ts +2 -19
- package/package.json +44 -65
- package/scripts/build.js +15 -0
- package/scripts/validate-imports.js +316 -0
- package/src/client/StartClient.tsx +34 -0
- package/src/client/index.tsx +2 -0
- package/src/client/mount.ts +1 -0
- package/src/client/spa/index.tsx +9 -0
- package/src/config/constants.ts +19 -0
- package/src/config/dev-server.ts +145 -0
- package/{config/fs-router.js → src/config/fs-router.ts} +49 -29
- package/src/config/fs-routes/fs-watcher.ts +77 -0
- package/src/config/fs-routes/index.ts +136 -0
- package/src/config/fs-routes/router.ts +169 -0
- package/src/config/fs-routes/tree-shake.ts +371 -0
- package/src/config/index.ts +233 -0
- package/src/config/lazy.ts +100 -0
- package/src/config/manifest.ts +84 -0
- package/src/config/utils.ts +5 -0
- package/src/config/vite-utils.ts +109 -0
- package/src/env.d.ts +17 -0
- package/src/http/index.ts +216 -0
- package/src/index.tsx +7 -0
- package/src/internal.d.ts +14 -0
- package/src/middleware/index.ts +72 -0
- package/src/router.tsx +37 -0
- package/src/server/StartServer.tsx +56 -0
- package/src/server/assets/index.ts +70 -0
- package/src/server/assets/render.tsx +46 -0
- package/src/server/collect-styles.ts +87 -0
- package/src/server/fetchEvent.spec.ts +85 -0
- package/src/server/fetchEvent.ts +36 -0
- package/src/server/handler.ts +257 -0
- package/src/server/index.tsx +29 -0
- package/src/server/manifest/client-manifest.ts +8 -0
- package/src/server/manifest/dev-client-manifest.ts +21 -0
- package/src/server/manifest/dev-ssr-manifest.ts +23 -0
- package/src/server/manifest/prod-client-manifest.ts +21 -0
- package/src/server/manifest/prod-ssr-manifest.ts +109 -0
- package/src/server/manifest/ssr-manifest.ts +10 -0
- package/src/server/routes.ts +126 -0
- package/src/server/server-fns-runtime.ts +31 -0
- package/src/server/server-functions-handler.ts +339 -0
- package/src/server/server-runtime.ts +240 -0
- package/src/server/spa/StartServer.tsx +40 -0
- package/src/server/spa/handler.ts +29 -0
- package/src/server/spa/index.tsx +5 -0
- package/src/server/types.ts +82 -0
- package/src/server/util.ts +12 -0
- package/src/shared/ErrorBoundary.tsx +52 -0
- package/src/shared/GET.ts +8 -0
- package/src/shared/HttpHeader.tsx +42 -0
- package/src/shared/HttpStatusCode.ts +27 -0
- package/src/shared/clientOnly.ts +44 -0
- package/src/shared/dev-overlay/CodeView.tsx +92 -0
- package/src/shared/dev-overlay/DevOverlayDialog.tsx +316 -0
- package/src/shared/dev-overlay/createStackFrame.ts +74 -0
- package/src/shared/dev-overlay/download.ts +6 -0
- package/src/shared/dev-overlay/env.d.ts +4 -0
- package/src/shared/dev-overlay/get-source-map.ts +33 -0
- package/src/shared/dev-overlay/icons.tsx +456 -0
- package/src/shared/dev-overlay/index.tsx +63 -0
- package/src/shared/dev-overlay/styles.css +292 -0
- package/src/shared/lazy.ts +52 -0
- package/src/shared/serverFunction.ts +10 -0
- package/src/virtual.d.ts +27 -0
- package/tsconfig.json +23 -0
- package/vitest.config.ts +9 -0
- package/config/index.d.ts +0 -40
- package/config/index.js +0 -304
- package/config/server-components.js +0 -106
- package/dist/client/islands.d.ts +0 -7
- package/dist/client/islands.jsx +0 -10
- package/dist/middleware/index.jsx +0 -35
- package/dist/router/index.d.ts +0 -1
- package/dist/router/index.jsx +0 -2
- package/dist/router/lazyRoute.d.ts +0 -6
- package/dist/router/lazyRoute.js +0 -53
- package/dist/runtime/server-handler.d.ts +0 -2
- package/dist/runtime/server-runtime.d.ts +0 -3
- package/dist/server/islands/index.d.ts +0 -19
- package/dist/server/islands/index.jsx +0 -62
- package/dist/server/islands/utils.d.ts +0 -1
- package/dist/server/islands/utils.jsx +0 -85
- package/dist/server/pageEvent.d.ts +0 -2
- package/dist/server/pageEvent.js +0 -56
- package/dist/server/renderAsset.d.ts +0 -2
- /package/dist/{router/FileRoutes.d.ts → router.d.ts} +0 -0
- /package/dist/shared/{clientOnly.jsx → clientOnly.js} +0 -0
- /package/dist/shared/{serverFunction.jsx → serverFunction.js} +0 -0
|
@@ -1,56 +1,45 @@
|
|
|
1
1
|
// @refresh skip
|
|
2
|
-
import { getSingletonHighlighter } from
|
|
3
|
-
import { loadWasm } from
|
|
4
|
-
import { createEffect, createResource } from
|
|
5
|
-
import url from
|
|
6
|
-
import langJS from
|
|
7
|
-
import langJSX from
|
|
8
|
-
import langTSX from
|
|
9
|
-
import langTS from
|
|
10
|
-
import darkPlus from
|
|
2
|
+
import { getSingletonHighlighter } from "shiki";
|
|
3
|
+
import { loadWasm } from "shiki/engine/oniguruma";
|
|
4
|
+
import { createEffect, createResource } from "solid-js";
|
|
5
|
+
import url from "shiki/onig.wasm?url";
|
|
6
|
+
import langJS from "shiki/langs/javascript.mjs";
|
|
7
|
+
import langJSX from "shiki/langs/jsx.mjs";
|
|
8
|
+
import langTSX from "shiki/langs/tsx.mjs";
|
|
9
|
+
import langTS from "shiki/langs/typescript.mjs";
|
|
10
|
+
import darkPlus from "shiki/themes/dark-plus.mjs";
|
|
11
11
|
let HIGHLIGHTER;
|
|
12
12
|
async function loadHighlighter() {
|
|
13
13
|
if (!HIGHLIGHTER) {
|
|
14
14
|
await loadWasm(await fetch(url));
|
|
15
15
|
HIGHLIGHTER = await getSingletonHighlighter({
|
|
16
|
-
themes: [
|
|
17
|
-
|
|
18
|
-
],
|
|
19
|
-
langs: [
|
|
20
|
-
langJS,
|
|
21
|
-
langJSX,
|
|
22
|
-
langTS,
|
|
23
|
-
langTSX,
|
|
24
|
-
],
|
|
16
|
+
themes: [darkPlus],
|
|
17
|
+
langs: [langJS, langJSX, langTS, langTSX],
|
|
25
18
|
});
|
|
26
19
|
}
|
|
27
20
|
return HIGHLIGHTER;
|
|
28
21
|
}
|
|
29
22
|
const RANGE = 8;
|
|
30
23
|
export function CodeView(props) {
|
|
31
|
-
const lines = () => props.content.split(
|
|
24
|
+
const lines = () => props.content.split("\n").map((item, index) => ({
|
|
32
25
|
index: index + 1,
|
|
33
26
|
line: item,
|
|
34
27
|
}));
|
|
35
28
|
const minLine = () => Math.max(props.line - (1 + RANGE), 0);
|
|
36
29
|
const maxLine = () => Math.min(props.line + RANGE, lines().length - 1);
|
|
37
30
|
let ref;
|
|
38
|
-
const [data] = createResource(() =>
|
|
31
|
+
const [data] = createResource(() => lines()
|
|
39
32
|
.slice(minLine(), maxLine())
|
|
40
33
|
.map(item => item.line)
|
|
41
|
-
.join(
|
|
34
|
+
.join("\n"), async (value) => {
|
|
42
35
|
const highlighter = await loadHighlighter();
|
|
43
|
-
const fileExtension = props.fileName
|
|
44
|
-
.split(/[#?]/)[0]
|
|
45
|
-
.split('.')
|
|
46
|
-
.pop()
|
|
47
|
-
?.trim();
|
|
36
|
+
const fileExtension = props.fileName.split(/[#?]/)[0].split(".").pop()?.trim();
|
|
48
37
|
let lang = fileExtension;
|
|
49
|
-
if (fileExtension ===
|
|
50
|
-
lang =
|
|
38
|
+
if (fileExtension === "mjs" || fileExtension === "cjs") {
|
|
39
|
+
lang = "js";
|
|
51
40
|
}
|
|
52
41
|
return highlighter.codeToHtml(value, {
|
|
53
|
-
theme:
|
|
42
|
+
theme: "dark-plus",
|
|
54
43
|
lang,
|
|
55
44
|
});
|
|
56
45
|
});
|
|
@@ -61,13 +50,13 @@ export function CodeView(props) {
|
|
|
61
50
|
const lines = ref.querySelectorAll('span[class="line"]');
|
|
62
51
|
for (let i = 0, len = lines.length; i < len; i++) {
|
|
63
52
|
const el = lines[i];
|
|
64
|
-
if (
|
|
65
|
-
el.classList.add(
|
|
53
|
+
if (props.line - minLine() - 1 === i) {
|
|
54
|
+
el.classList.add("dev-overlay-error-line");
|
|
66
55
|
}
|
|
67
56
|
}
|
|
68
57
|
}
|
|
69
58
|
});
|
|
70
|
-
return <div ref={ref} class="dev-overlay-code-view" style={{
|
|
71
|
-
|
|
72
|
-
}}
|
|
59
|
+
return (<div ref={ref} class="dev-overlay-code-view" style={{
|
|
60
|
+
"--dev-overlay-code-view-start": minLine() + 1,
|
|
61
|
+
}}/>);
|
|
73
62
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { JSX } from
|
|
2
|
-
import
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import "./styles.css";
|
|
3
3
|
export declare function classNames(...classes: (string | boolean | undefined)[]): string;
|
|
4
4
|
interface DevOverlayDialogProps {
|
|
5
5
|
errors: any[];
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
// @refresh skip
|
|
2
|
-
import ErrorStackParser from
|
|
3
|
-
import * as htmlToImage from
|
|
4
|
-
import { ErrorBoundary, For, Show, Suspense, createMemo, createSignal } from
|
|
5
|
-
import { Portal } from
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
2
|
+
import ErrorStackParser from "error-stack-parser";
|
|
3
|
+
import * as htmlToImage from "html-to-image";
|
|
4
|
+
import { ErrorBoundary, For, Show, Suspense, createMemo, createSignal } from "solid-js";
|
|
5
|
+
import { Portal } from "solid-js/web";
|
|
6
|
+
// @ts-ignore - terracotta module resolution issue with NodeNext
|
|
7
|
+
import { Dialog, DialogOverlay, DialogPanel, Select, SelectOption } from "terracotta";
|
|
8
|
+
import info from "../../../package.json" with { type: "json" };
|
|
9
|
+
import { CodeView } from "./CodeView.jsx";
|
|
10
|
+
import { createStackFrame } from "./createStackFrame.js";
|
|
11
|
+
import download from "./download.js";
|
|
12
|
+
import { ArrowLeftIcon, ArrowRightIcon, CameraIcon, DiscordIcon, GithubIcon, RefreshIcon, SolidStartIcon, ViewCompiledIcon, ViewOriginalIcon, } from "./icons.jsx";
|
|
13
|
+
import "./styles.css";
|
|
13
14
|
export function classNames(...classes) {
|
|
14
|
-
return classes.filter(Boolean).join(
|
|
15
|
+
return classes.filter(Boolean).join(" ");
|
|
15
16
|
}
|
|
16
17
|
function ErrorInfo(props) {
|
|
17
18
|
const error = createMemo(() => {
|
|
@@ -31,8 +32,8 @@ function ErrorInfo(props) {
|
|
|
31
32
|
}
|
|
32
33
|
function getFileName(source) {
|
|
33
34
|
try {
|
|
34
|
-
const path = source.startsWith(
|
|
35
|
-
const paths = path.pathname.split(
|
|
35
|
+
const path = source.startsWith("/") ? new URL(source, "file://") : new URL(source);
|
|
36
|
+
const paths = path.pathname.split("/");
|
|
36
37
|
return paths[paths.length - 1];
|
|
37
38
|
}
|
|
38
39
|
catch (error) {
|
|
@@ -40,71 +41,77 @@ function getFileName(source) {
|
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
function getFilePath(source) {
|
|
43
|
-
const line = source.line ? `:${source.line}` :
|
|
44
|
-
const column = source.column ? `:${source.column}` :
|
|
44
|
+
const line = source.line ? `:${source.line}` : "";
|
|
45
|
+
const column = source.column ? `:${source.column}` : "";
|
|
45
46
|
return `${getFileName(source.source)}${line}${column}`;
|
|
46
47
|
}
|
|
47
48
|
function CodeFallback() {
|
|
48
|
-
return <div class="dev-overlay-stack-frames-code-fallback">
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
return (<div class="dev-overlay-stack-frames-code-fallback">
|
|
50
|
+
<span>Source not available.</span>
|
|
51
|
+
</div>);
|
|
51
52
|
}
|
|
52
53
|
function StackFramesContent(props) {
|
|
53
54
|
const stackframes = ErrorStackParser.parse(props.error);
|
|
54
55
|
const [selectedFrame, setSelectedFrame] = createSignal(stackframes[0]);
|
|
55
56
|
return (<div class="dev-overlay-stack-frames-content">
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
<div class="dev-overlay-stack-frames-code">
|
|
58
|
+
<ErrorBoundary fallback={null}>
|
|
59
|
+
{(() => {
|
|
59
60
|
const data = createStackFrame(selectedFrame(), () => props.isCompiled);
|
|
60
61
|
return (<Suspense fallback={<CodeFallback />}>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
<Show when={data()} keyed fallback={<CodeFallback />}>
|
|
63
|
+
{source => (<>
|
|
64
|
+
<span class="dev-overlay-stack-frames-code-source">{source.source}</span>
|
|
65
|
+
<div class="dev-overlay-stack-frames-code-container">
|
|
66
|
+
<CodeView fileName={source.source} line={source.line} content={source.content}/>
|
|
67
|
+
</div>
|
|
68
|
+
</>)}
|
|
69
|
+
</Show>
|
|
70
|
+
</Suspense>);
|
|
70
71
|
})()}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
</ErrorBoundary>
|
|
73
|
+
</div>
|
|
74
|
+
<Select class="dev-overlay-stack-frames" value={selectedFrame()} onChange={setSelectedFrame}>
|
|
75
|
+
<For each={stackframes}>
|
|
76
|
+
{current => (<ErrorBoundary fallback={<div class="dev-overlay-stack-frame">
|
|
77
|
+
<span class="dev-overlay-stack-frame-function">
|
|
78
|
+
{current.functionName ?? "<anonymous>"}
|
|
79
|
+
</span>
|
|
80
|
+
<span class="dev-overlay-stack-frame-file">
|
|
81
|
+
{getFilePath({
|
|
78
82
|
source: current.getFileName(),
|
|
79
|
-
content:
|
|
83
|
+
content: "",
|
|
80
84
|
line: current.getLineNumber(),
|
|
81
85
|
column: current.getColumnNumber(),
|
|
82
86
|
name: current.getFunctionName(),
|
|
83
|
-
})}
|
|
84
|
-
|
|
87
|
+
})}
|
|
88
|
+
</span>
|
|
89
|
+
</div>}>
|
|
85
90
|
{(() => {
|
|
86
91
|
const data = createStackFrame(current, () => props.isCompiled);
|
|
87
92
|
return (<Suspense>
|
|
88
93
|
<Show when={data()} keyed>
|
|
89
|
-
{
|
|
90
|
-
<span class="dev-overlay-stack-frame-function">
|
|
94
|
+
{source => (<SelectOption class="dev-overlay-stack-frame" value={current}>
|
|
95
|
+
<span class="dev-overlay-stack-frame-function">
|
|
96
|
+
{source.name ?? "<anonymous>"}
|
|
97
|
+
</span>
|
|
91
98
|
<span class="dev-overlay-stack-frame-file">{getFilePath(source)}</span>
|
|
92
99
|
</SelectOption>)}
|
|
93
100
|
</Show>
|
|
94
101
|
</Suspense>);
|
|
95
102
|
})()}
|
|
96
103
|
</ErrorBoundary>)}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
</For>
|
|
105
|
+
</Select>
|
|
106
|
+
</div>);
|
|
100
107
|
}
|
|
101
108
|
function StackFrames(props) {
|
|
102
109
|
return (<Show when={props.error instanceof Error && props.error} keyed>
|
|
103
|
-
{
|
|
110
|
+
{current => <StackFramesContent error={current} isCompiled={props.isCompiled}/>}
|
|
104
111
|
</Show>);
|
|
105
112
|
}
|
|
106
|
-
const ISSUE_THREAD =
|
|
107
|
-
const DISCORD_INVITE =
|
|
113
|
+
const ISSUE_THREAD = "https://github.com/solidjs/solid-start/issues/new";
|
|
114
|
+
const DISCORD_INVITE = "https://discord.com/invite/solidjs";
|
|
108
115
|
export default function DevOverlayDialog(props) {
|
|
109
116
|
const [currentPage, setCurrentPage] = createSignal(1);
|
|
110
117
|
const [isCompiled, setIsCompiled] = createSignal(false);
|
|
@@ -113,7 +120,7 @@ export default function DevOverlayDialog(props) {
|
|
|
113
120
|
return Math.min(currentPage(), length());
|
|
114
121
|
});
|
|
115
122
|
function goPrev() {
|
|
116
|
-
setCurrentPage(
|
|
123
|
+
setCurrentPage(c => {
|
|
117
124
|
if (c > 1) {
|
|
118
125
|
return c - 1;
|
|
119
126
|
}
|
|
@@ -121,7 +128,7 @@ export default function DevOverlayDialog(props) {
|
|
|
121
128
|
});
|
|
122
129
|
}
|
|
123
130
|
function goNext() {
|
|
124
|
-
setCurrentPage(
|
|
131
|
+
setCurrentPage(c => {
|
|
125
132
|
if (c < length()) {
|
|
126
133
|
return c + 1;
|
|
127
134
|
}
|
|
@@ -129,31 +136,33 @@ export default function DevOverlayDialog(props) {
|
|
|
129
136
|
});
|
|
130
137
|
}
|
|
131
138
|
function toggleIsCompiled() {
|
|
132
|
-
setIsCompiled(
|
|
139
|
+
setIsCompiled(c => !c);
|
|
133
140
|
}
|
|
134
141
|
const [panel, setPanel] = createSignal();
|
|
135
142
|
function downloadScreenshot() {
|
|
136
143
|
const current = panel();
|
|
137
144
|
if (current) {
|
|
138
|
-
htmlToImage
|
|
145
|
+
htmlToImage
|
|
146
|
+
.toPng(current, {
|
|
139
147
|
style: {
|
|
140
|
-
transform:
|
|
148
|
+
transform: "scale(0.75)",
|
|
141
149
|
},
|
|
142
|
-
})
|
|
143
|
-
|
|
150
|
+
})
|
|
151
|
+
.then(url => {
|
|
152
|
+
download(url, "start-screenshot.png");
|
|
144
153
|
});
|
|
145
154
|
}
|
|
146
155
|
}
|
|
147
156
|
function redirectToGithub() {
|
|
148
157
|
const url = new URL(ISSUE_THREAD);
|
|
149
|
-
url.searchParams.append(
|
|
150
|
-
url.searchParams.append(
|
|
151
|
-
url.searchParams.append(
|
|
152
|
-
url.searchParams.append(
|
|
153
|
-
window.open(url,
|
|
158
|
+
url.searchParams.append("labels", "bug");
|
|
159
|
+
url.searchParams.append("labels", "needs+triage");
|
|
160
|
+
url.searchParams.append("template", "bug.yml");
|
|
161
|
+
url.searchParams.append("title", `[Bug?]:` + props.errors[truncated() - 1].toString());
|
|
162
|
+
window.open(url, "_blank").focus();
|
|
154
163
|
}
|
|
155
164
|
function redirectToDiscord() {
|
|
156
|
-
window.open(DISCORD_INVITE,
|
|
165
|
+
window.open(DISCORD_INVITE, "_blank").focus();
|
|
157
166
|
}
|
|
158
167
|
return (<Portal>
|
|
159
168
|
<Dialog class="dev-overlay" isOpen>
|
|
@@ -194,7 +203,7 @@ export default function DevOverlayDialog(props) {
|
|
|
194
203
|
<CameraIcon title="Capture Error Overlay"/>
|
|
195
204
|
</button>
|
|
196
205
|
<button class="dev-overlay-button" onClick={toggleIsCompiled} type="button">
|
|
197
|
-
<Show when={isCompiled()} fallback={
|
|
206
|
+
<Show when={isCompiled()} fallback={<ViewOriginalIcon title="View Original Source"/>}>
|
|
198
207
|
<ViewCompiledIcon title="View Compiled Source"/>
|
|
199
208
|
</Show>
|
|
200
209
|
</button>
|
|
@@ -204,7 +213,7 @@ export default function DevOverlayDialog(props) {
|
|
|
204
213
|
</div>
|
|
205
214
|
</div>
|
|
206
215
|
<Show when={props.errors[truncated() - 1]} keyed>
|
|
207
|
-
{
|
|
216
|
+
{current => (<div class="dev-overlay-content">
|
|
208
217
|
<ErrorInfo error={current}/>
|
|
209
218
|
<StackFrames error={current} isCompiled={isCompiled()}/>
|
|
210
219
|
</div>)}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createMemo, createResource } from "solid-js";
|
|
2
|
-
import getSourceMap from "./get-source-map";
|
|
2
|
+
import getSourceMap from "./get-source-map.js";
|
|
3
3
|
function getActualFileSource(path) {
|
|
4
|
-
if (path.startsWith(
|
|
5
|
-
return
|
|
4
|
+
if (path.startsWith("file://")) {
|
|
5
|
+
return "/_build/@fs" + path.substring("file://".length);
|
|
6
6
|
}
|
|
7
7
|
return path;
|
|
8
8
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SourceMapConsumer } from
|
|
1
|
+
import { SourceMapConsumer } from "source-map-js";
|
|
2
2
|
export default function getSourceMap(url: string, content: string): Promise<SourceMapConsumer | null>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SourceMapConsumer } from
|
|
1
|
+
import { SourceMapConsumer } from "source-map-js";
|
|
2
2
|
const INLINE_SOURCEMAP_REGEX = /^data:application\/json[^,]+base64,/;
|
|
3
3
|
const SOURCEMAP_REGEX = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/;
|
|
4
4
|
export default async function getSourceMap(url, content) {
|
|
5
|
-
const lines = content.split(
|
|
5
|
+
const lines = content.split("\n");
|
|
6
6
|
let sourceMapUrl;
|
|
7
7
|
for (let i = lines.length - 1; i >= 0 && !sourceMapUrl; i--) {
|
|
8
8
|
const result = lines[i].match(SOURCEMAP_REGEX);
|
|
@@ -13,11 +13,11 @@ export default async function getSourceMap(url, content) {
|
|
|
13
13
|
if (!sourceMapUrl) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
|
-
if (!(INLINE_SOURCEMAP_REGEX.test(sourceMapUrl) || sourceMapUrl.startsWith(
|
|
16
|
+
if (!(INLINE_SOURCEMAP_REGEX.test(sourceMapUrl) || sourceMapUrl.startsWith("/"))) {
|
|
17
17
|
// Resolve path if it's a relative access
|
|
18
|
-
const parsedURL = url.split(
|
|
18
|
+
const parsedURL = url.split("/");
|
|
19
19
|
parsedURL[parsedURL.length - 1] = sourceMapUrl;
|
|
20
|
-
sourceMapUrl = parsedURL.join(
|
|
20
|
+
sourceMapUrl = parsedURL.join("/");
|
|
21
21
|
}
|
|
22
22
|
const response = await fetch(sourceMapUrl);
|
|
23
23
|
const rawSourceMap = await response.json();
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import type { JSX } from
|
|
2
|
-
export declare function ArrowRightIcon(props: JSX.IntrinsicElements[
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
export declare function ArrowRightIcon(props: JSX.IntrinsicElements["svg"] & {
|
|
3
3
|
title: string;
|
|
4
4
|
}): JSX.Element;
|
|
5
|
-
export declare function ArrowLeftIcon(props: JSX.IntrinsicElements[
|
|
5
|
+
export declare function ArrowLeftIcon(props: JSX.IntrinsicElements["svg"] & {
|
|
6
6
|
title: string;
|
|
7
7
|
}): JSX.Element;
|
|
8
|
-
export declare function RefreshIcon(props: JSX.IntrinsicElements[
|
|
8
|
+
export declare function RefreshIcon(props: JSX.IntrinsicElements["svg"] & {
|
|
9
9
|
title: string;
|
|
10
10
|
}): JSX.Element;
|
|
11
|
-
export declare function ViewCompiledIcon(props: JSX.IntrinsicElements[
|
|
11
|
+
export declare function ViewCompiledIcon(props: JSX.IntrinsicElements["svg"] & {
|
|
12
12
|
title: string;
|
|
13
13
|
}): JSX.Element;
|
|
14
|
-
export declare function ViewOriginalIcon(props: JSX.IntrinsicElements[
|
|
14
|
+
export declare function ViewOriginalIcon(props: JSX.IntrinsicElements["svg"] & {
|
|
15
15
|
title: string;
|
|
16
16
|
}): JSX.Element;
|
|
17
|
-
export declare function CameraIcon(props: JSX.IntrinsicElements[
|
|
17
|
+
export declare function CameraIcon(props: JSX.IntrinsicElements["svg"] & {
|
|
18
18
|
title: string;
|
|
19
19
|
}): JSX.Element;
|
|
20
|
-
export declare function DiscordIcon(props: JSX.IntrinsicElements[
|
|
20
|
+
export declare function DiscordIcon(props: JSX.IntrinsicElements["svg"] & {
|
|
21
21
|
title: string;
|
|
22
22
|
}): JSX.Element;
|
|
23
|
-
export declare function GithubIcon(props: JSX.IntrinsicElements[
|
|
23
|
+
export declare function GithubIcon(props: JSX.IntrinsicElements["svg"] & {
|
|
24
24
|
title: string;
|
|
25
25
|
}): JSX.Element;
|
|
26
|
-
export declare function SolidStartIcon(props: JSX.IntrinsicElements[
|
|
26
|
+
export declare function SolidStartIcon(props: JSX.IntrinsicElements["svg"] & {
|
|
27
27
|
title: string;
|
|
28
28
|
}): JSX.Element;
|