@solidjs/start 2.0.0-alpha.2 → 2.0.0-alpha.3
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 +19 -0
- package/dist/config/constants.d.ts +1 -1
- package/dist/config/constants.js +1 -1
- package/dist/config/dev-server.js +9 -1
- package/dist/config/env.d.ts +19 -0
- package/dist/config/env.js +81 -0
- package/dist/config/fs-routes/fs-watcher.js +14 -20
- package/dist/config/fs-routes/index.js +2 -2
- package/dist/config/fs-routes/router.js +2 -2
- package/dist/config/index.d.ts +16 -1
- package/dist/config/index.js +25 -27
- package/dist/config/lazy.js +2 -2
- package/dist/config/manifest.js +37 -4
- package/dist/config/vite-utils.d.ts +1 -1
- package/dist/directives/bubble-function-declaration.d.ts +3 -0
- package/dist/directives/bubble-function-declaration.js +23 -0
- package/dist/directives/compile.d.ts +9 -0
- package/dist/directives/compile.js +40 -0
- package/dist/directives/generate-unique-name.d.ts +3 -0
- package/dist/directives/generate-unique-name.js +16 -0
- package/dist/directives/get-descriptive-name.d.ts +2 -0
- package/dist/directives/get-descriptive-name.js +37 -0
- package/dist/directives/get-import-identifier.d.ts +4 -0
- package/dist/directives/get-import-identifier.js +19 -0
- package/dist/directives/get-root-statement-path.d.ts +2 -0
- package/dist/directives/get-root-statement-path.js +12 -0
- package/dist/directives/index.d.ts +14 -0
- package/dist/directives/index.js +169 -0
- package/dist/directives/is-statement-top-level.d.ts +3 -0
- package/dist/directives/is-statement-top-level.js +9 -0
- package/dist/directives/paths.d.ts +9 -0
- package/dist/directives/paths.js +36 -0
- package/dist/directives/plugin.d.ts +21 -0
- package/dist/directives/plugin.js +302 -0
- package/dist/directives/remove-unused-variables.d.ts +3 -0
- package/dist/directives/remove-unused-variables.js +53 -0
- package/dist/directives/types.d.ts +10 -0
- package/dist/directives/xxhash32.d.ts +6 -0
- package/dist/directives/xxhash32.js +193 -0
- package/dist/{server/server-runtime.d.ts → fns/client.d.ts} +1 -1
- package/dist/fns/client.js +106 -0
- package/dist/fns/handler.d.ts +5 -0
- package/dist/{server/server-functions-handler.js → fns/handler.js} +55 -96
- package/dist/fns/registration.d.ts +2 -0
- package/dist/fns/registration.js +12 -0
- package/dist/fns/serialization.d.ts +6 -0
- package/dist/fns/serialization.js +208 -0
- package/dist/fns/server.d.ts +7 -0
- package/dist/{server/server-fns-runtime.js → fns/server.js} +7 -1
- package/dist/fns/shared.d.ts +17 -0
- package/dist/fns/shared.js +105 -0
- package/dist/http/index.d.ts +1 -1
- package/dist/middleware/index.d.ts +17 -0
- package/dist/middleware/index.js +15 -0
- package/dist/server/handler.d.ts +61 -3
- package/dist/server/handler.js +17 -15
- package/dist/server/spa/handler.d.ts +30 -1
- package/dist/server/types.d.ts +1 -1
- package/dist/shared/dev-overlay/CodeView.jsx +4 -4
- package/dist/shared/dev-overlay/DevOverlayDialog.jsx +34 -34
- package/dist/shared/dev-overlay/index.jsx +2 -2
- package/dist/shared/dev-overlay/styles.css +40 -40
- package/package.json +27 -20
- package/src/config/constants.ts +1 -1
- package/src/config/env.ts +105 -0
- package/src/config/fs-routes/fs-watcher.ts +17 -24
- package/src/config/fs-routes/index.ts +2 -2
- package/src/config/fs-routes/router.ts +2 -2
- package/src/config/index.ts +39 -37
- package/src/config/lazy.ts +2 -2
- package/src/config/manifest.ts +37 -7
- package/src/config/vite-utils.ts +1 -1
- package/src/directives/bubble-function-declaration.ts +33 -0
- package/src/directives/compile.ts +54 -0
- package/src/directives/generate-unique-name.ts +22 -0
- package/src/directives/get-descriptive-name.ts +39 -0
- package/src/directives/get-import-identifier.ts +34 -0
- package/src/directives/get-root-statement-path.ts +14 -0
- package/src/directives/index.ts +232 -0
- package/src/directives/is-statement-top-level.ts +13 -0
- package/src/directives/paths.ts +63 -0
- package/src/directives/plugin.ts +389 -0
- package/src/directives/remove-unused-variables.ts +55 -0
- package/src/directives/types.ts +12 -0
- package/src/directives/xxhash32.ts +214 -0
- package/src/env.d.ts +1 -1
- package/src/fns/client.ts +141 -0
- package/src/fns/handler.spec.ts +85 -0
- package/src/{server/server-functions-handler.ts → fns/handler.ts} +65 -117
- package/src/fns/registration.ts +19 -0
- package/src/fns/serialization.ts +250 -0
- package/src/{server/server-fns-runtime.ts → fns/server.ts} +17 -2
- package/src/fns/shared.ts +116 -0
- package/src/middleware/index.ts +17 -0
- package/src/server/handler.ts +18 -16
- package/src/server/types.ts +1 -1
- package/src/shared/dev-overlay/CodeView.tsx +5 -7
- package/src/shared/dev-overlay/DevOverlayDialog.tsx +34 -34
- package/src/shared/dev-overlay/get-source-map.ts +1 -1
- package/src/shared/dev-overlay/index.tsx +4 -4
- package/src/shared/dev-overlay/styles.css +40 -40
- package/tsconfig.json +1 -0
- package/dist/server/fetchEvent.spec.js +0 -65
- package/dist/server/server-fns-runtime.d.ts +0 -1
- package/dist/server/server-functions-handler.d.ts +0 -2
- package/dist/server/server-runtime.js +0 -194
- package/src/server/server-runtime.ts +0 -240
- /package/dist/{server/fetchEvent.spec.d.ts → directives/types.js} +0 -0
package/src/server/handler.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { createRoutes } from "../router.tsx";
|
|
|
9
9
|
import { decorateHandler, decorateMiddleware } from "./fetchEvent.ts";
|
|
10
10
|
import { getSsrManifest } from "./manifest/ssr-manifest.ts";
|
|
11
11
|
import { matchAPIRoute } from "./routes.ts";
|
|
12
|
-
import { handleServerFunction } from "
|
|
12
|
+
import { handleServerFunction } from "../fns/handler.ts";
|
|
13
13
|
import type { APIEvent, FetchEvent, HandlerOptions, PageEvent } from "./types.ts";
|
|
14
14
|
import { getExpectedRedirectStatus } from "./util.ts";
|
|
15
15
|
|
|
@@ -43,21 +43,23 @@ export function createBaseHandler(
|
|
|
43
43
|
const mod = await match.handler.import();
|
|
44
44
|
const fn =
|
|
45
45
|
event.request.method === "HEAD" ? mod["HEAD"] || mod["GET"] : mod[event.request.method];
|
|
46
|
-
(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (res
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
if (typeof fn === "function") {
|
|
47
|
+
(event as APIEvent).params = match.params || {};
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
sharedConfig.context = { event };
|
|
50
|
+
const res = await fn(event);
|
|
51
|
+
if (res !== undefined) {
|
|
52
|
+
if (res instanceof Response) return produceResponseWithEventHeaders(res);
|
|
53
|
+
|
|
54
|
+
return res;
|
|
55
|
+
}
|
|
56
|
+
if (event.request.method !== "GET") {
|
|
57
|
+
throw new Error(
|
|
58
|
+
`API handler for ${event.request.method} "${event.request.url}" did not return a response.`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
if (!match.isPage) return;
|
|
54
62
|
}
|
|
55
|
-
if (event.request.method !== "GET") {
|
|
56
|
-
throw new Error(
|
|
57
|
-
`API handler for ${event.request.method} "${event.request.url}" did not return a response.`,
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
if (!match.isPage) return;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
const context = await createPageEvent(event);
|
|
@@ -211,7 +213,7 @@ function handleStreamCompleteRedirect(context: PageEvent) {
|
|
|
211
213
|
return ({ write }: { write: (html: string) => void }) => {
|
|
212
214
|
context.complete = true;
|
|
213
215
|
const to = context.response && context.response.headers.get("Location");
|
|
214
|
-
to && write(`<script>window.location
|
|
216
|
+
to && write(`<script>window.location=${JSON.stringify(to).replace(/</g, "\\u003c")}</script>`);
|
|
215
217
|
};
|
|
216
218
|
}
|
|
217
219
|
|
package/src/server/types.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface APIEvent extends FetchEvent {
|
|
|
69
69
|
params: { [key: string]: string };
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export type APIHandler = (event: APIEvent) =>
|
|
72
|
+
export type APIHandler = (event: APIEvent) => any;
|
|
73
73
|
|
|
74
74
|
export interface ServerFunctionMeta {
|
|
75
75
|
id: string;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
// @refresh skip
|
|
2
|
-
import {
|
|
2
|
+
import { type BuiltinLanguage, getSingletonHighlighter, type Highlighter } from "shiki";
|
|
3
3
|
import { loadWasm } from "shiki/engine/oniguruma";
|
|
4
|
-
import { createEffect, createResource, type JSX } from "solid-js";
|
|
5
|
-
|
|
6
|
-
import url from "shiki/onig.wasm?url";
|
|
7
|
-
|
|
8
4
|
import langJS from "shiki/langs/javascript.mjs";
|
|
9
5
|
import langJSX from "shiki/langs/jsx.mjs";
|
|
10
6
|
import langTSX from "shiki/langs/tsx.mjs";
|
|
11
7
|
import langTS from "shiki/langs/typescript.mjs";
|
|
8
|
+
import url from "shiki/onig.wasm?url";
|
|
12
9
|
import darkPlus from "shiki/themes/dark-plus.mjs";
|
|
10
|
+
import { createEffect, createResource, type JSX } from "solid-js";
|
|
13
11
|
|
|
14
12
|
let HIGHLIGHTER: Highlighter;
|
|
15
13
|
|
|
@@ -74,7 +72,7 @@ export function CodeView(props: CodeViewProps): JSX.Element | null {
|
|
|
74
72
|
for (let i = 0, len = lines.length; i < len; i++) {
|
|
75
73
|
const el = lines[i] as HTMLElement;
|
|
76
74
|
if (props.line - minLine() - 1 === i) {
|
|
77
|
-
el.
|
|
75
|
+
el.dataset.startDevOverlayErrorLine = '';
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
}
|
|
@@ -83,7 +81,7 @@ export function CodeView(props: CodeViewProps): JSX.Element | null {
|
|
|
83
81
|
return (
|
|
84
82
|
<div
|
|
85
83
|
ref={ref}
|
|
86
|
-
|
|
84
|
+
data-start-dev-overlay-code-view
|
|
87
85
|
style={{
|
|
88
86
|
"--dev-overlay-code-view-start": minLine() + 1,
|
|
89
87
|
}}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import ErrorStackParser from "error-stack-parser";
|
|
3
3
|
import * as htmlToImage from "html-to-image";
|
|
4
4
|
import type { JSX } from "solid-js";
|
|
5
|
-
import { ErrorBoundary, For, Show, Suspense
|
|
5
|
+
import { createMemo, createSignal, ErrorBoundary, For, Show, Suspense } from "solid-js";
|
|
6
6
|
import { Portal } from "solid-js/web";
|
|
7
7
|
// @ts-ignore - terracotta module resolution issue with NodeNext
|
|
8
8
|
import { Dialog, DialogOverlay, DialogPanel, Select, SelectOption } from "terracotta";
|
|
@@ -47,9 +47,9 @@ function ErrorInfo(props: ErrorInfoProps): JSX.Element {
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
return (
|
|
50
|
-
<span
|
|
51
|
-
<span
|
|
52
|
-
<span
|
|
50
|
+
<span data-start-dev-overlay-error-info>
|
|
51
|
+
<span data-start-dev-overlay-error-info-name>{error().name}</span>
|
|
52
|
+
<span data-start-dev-overlay-error-info-message>{error().message}</span>
|
|
53
53
|
</span>
|
|
54
54
|
);
|
|
55
55
|
}
|
|
@@ -77,7 +77,7 @@ function getFilePath(source: StackFrameSource) {
|
|
|
77
77
|
|
|
78
78
|
function CodeFallback(): JSX.Element {
|
|
79
79
|
return (
|
|
80
|
-
<div
|
|
80
|
+
<div data-start-dev-overlay-stack-frames-code-fallback>
|
|
81
81
|
<span>Source not available.</span>
|
|
82
82
|
</div>
|
|
83
83
|
);
|
|
@@ -89,8 +89,8 @@ function StackFramesContent(props: StackFramesContentProps) {
|
|
|
89
89
|
const [selectedFrame, setSelectedFrame] = createSignal(stackframes[0]!);
|
|
90
90
|
|
|
91
91
|
return (
|
|
92
|
-
<div
|
|
93
|
-
<div
|
|
92
|
+
<div data-start-dev-overlay-stack-frames-content>
|
|
93
|
+
<div data-start-dev-overlay-stack-frames-code>
|
|
94
94
|
<ErrorBoundary fallback={null}>
|
|
95
95
|
{(() => {
|
|
96
96
|
const data = createStackFrame(selectedFrame(), () => props.isCompiled);
|
|
@@ -99,8 +99,8 @@ function StackFramesContent(props: StackFramesContentProps) {
|
|
|
99
99
|
<Show when={data()} keyed fallback={<CodeFallback />}>
|
|
100
100
|
{source => (
|
|
101
101
|
<>
|
|
102
|
-
<span
|
|
103
|
-
<div
|
|
102
|
+
<span data-start-dev-overlay-stack-frames-code-source>{source.source}</span>
|
|
103
|
+
<div data-start-dev-overlay-stack-frames-code-container>
|
|
104
104
|
<CodeView
|
|
105
105
|
fileName={source.source}
|
|
106
106
|
line={source.line}
|
|
@@ -116,7 +116,7 @@ function StackFramesContent(props: StackFramesContentProps) {
|
|
|
116
116
|
</ErrorBoundary>
|
|
117
117
|
</div>
|
|
118
118
|
<Select<ErrorStackParser.StackFrame>
|
|
119
|
-
|
|
119
|
+
data-start-dev-overlay-stack-frames
|
|
120
120
|
value={selectedFrame()}
|
|
121
121
|
onChange={setSelectedFrame}
|
|
122
122
|
>
|
|
@@ -124,11 +124,11 @@ function StackFramesContent(props: StackFramesContentProps) {
|
|
|
124
124
|
{current => (
|
|
125
125
|
<ErrorBoundary
|
|
126
126
|
fallback={
|
|
127
|
-
<div
|
|
128
|
-
<span
|
|
127
|
+
<div data-start-dev-overlay-stack-frame>
|
|
128
|
+
<span data-start-dev-overlay-stack-frame-function>
|
|
129
129
|
{current.functionName ?? "<anonymous>"}
|
|
130
130
|
</span>
|
|
131
|
-
<span
|
|
131
|
+
<span data-start-dev-overlay-stack-frame-file>
|
|
132
132
|
{getFilePath({
|
|
133
133
|
source: current.getFileName()!,
|
|
134
134
|
content: "",
|
|
@@ -146,11 +146,11 @@ function StackFramesContent(props: StackFramesContentProps) {
|
|
|
146
146
|
<Suspense>
|
|
147
147
|
<Show when={data()} keyed>
|
|
148
148
|
{source => (
|
|
149
|
-
<SelectOption
|
|
150
|
-
<span
|
|
149
|
+
<SelectOption data-start-dev-overlay-stack-frame value={current}>
|
|
150
|
+
<span data-start-dev-overlay-stack-frame-function>
|
|
151
151
|
{source.name ?? "<anonymous>"}
|
|
152
152
|
</span>
|
|
153
|
-
<span
|
|
153
|
+
<span data-start-dev-overlay-stack-frame-file>{getFilePath(source)}</span>
|
|
154
154
|
</SelectOption>
|
|
155
155
|
)}
|
|
156
156
|
</Show>
|
|
@@ -249,44 +249,44 @@ export default function DevOverlayDialog(props: DevOverlayDialogProps): JSX.Elem
|
|
|
249
249
|
|
|
250
250
|
return (
|
|
251
251
|
<Portal>
|
|
252
|
-
<Dialog
|
|
252
|
+
<Dialog data-start-dev-overlay isOpen>
|
|
253
253
|
<div>
|
|
254
|
-
<DialogOverlay
|
|
255
|
-
<DialogPanel ref={setPanel}
|
|
256
|
-
<div
|
|
257
|
-
<div
|
|
258
|
-
<div
|
|
259
|
-
<div
|
|
254
|
+
<DialogOverlay data-start-dev-overlay-background />
|
|
255
|
+
<DialogPanel ref={setPanel} data-start-dev-overlay-panel-container>
|
|
256
|
+
<div data-start-dev-overlay-panel>
|
|
257
|
+
<div data-start-dev-overlay-navbar>
|
|
258
|
+
<div data-start-dev-overlay-navbar-left>
|
|
259
|
+
<div data-start-dev-overlay-version>
|
|
260
260
|
<div>
|
|
261
261
|
<SolidStartIcon title="Solid Start Version" />
|
|
262
262
|
</div>
|
|
263
263
|
<span>{info.version as string}</span>
|
|
264
264
|
</div>
|
|
265
265
|
<Show when={props.errors.length > 1}>
|
|
266
|
-
<div
|
|
267
|
-
<button
|
|
266
|
+
<div data-start-dev-overlay-pagination>
|
|
267
|
+
<button data-start-dev-overlay-button onClick={goPrev} type="button">
|
|
268
268
|
<ArrowLeftIcon title="Go Previous" />
|
|
269
269
|
</button>
|
|
270
|
-
<div
|
|
270
|
+
<div data-start-dev-overlay-page-counter>
|
|
271
271
|
{`${truncated()} of ${props.errors.length}`}
|
|
272
272
|
</div>
|
|
273
|
-
<button
|
|
273
|
+
<button data-start-dev-overlay-button onClick={goNext} type="button">
|
|
274
274
|
<ArrowRightIcon title="Go Next" />
|
|
275
275
|
</button>
|
|
276
276
|
</div>
|
|
277
277
|
</Show>
|
|
278
278
|
</div>
|
|
279
|
-
<div
|
|
280
|
-
<button
|
|
279
|
+
<div data-start-dev-overlay-controls>
|
|
280
|
+
<button data-start-dev-overlay-button onClick={redirectToGithub} type="button">
|
|
281
281
|
<GithubIcon title="Create an issue thread on Github" />
|
|
282
282
|
</button>
|
|
283
|
-
<button
|
|
283
|
+
<button data-start-dev-overlay-button onClick={redirectToDiscord} type="button">
|
|
284
284
|
<DiscordIcon title="Join our Discord Channel" />
|
|
285
285
|
</button>
|
|
286
|
-
<button
|
|
286
|
+
<button data-start-dev-overlay-button onClick={downloadScreenshot} type="button">
|
|
287
287
|
<CameraIcon title="Capture Error Overlay" />
|
|
288
288
|
</button>
|
|
289
|
-
<button
|
|
289
|
+
<button data-start-dev-overlay-button onClick={toggleIsCompiled} type="button">
|
|
290
290
|
<Show
|
|
291
291
|
when={isCompiled()}
|
|
292
292
|
fallback={<ViewOriginalIcon title="View Original Source" />}
|
|
@@ -294,14 +294,14 @@ export default function DevOverlayDialog(props: DevOverlayDialogProps): JSX.Elem
|
|
|
294
294
|
<ViewCompiledIcon title="View Compiled Source" />
|
|
295
295
|
</Show>
|
|
296
296
|
</button>
|
|
297
|
-
<button
|
|
297
|
+
<button data-start-dev-overlay-button onClick={props.resetError} type="button">
|
|
298
298
|
<RefreshIcon title="Reset Error" />
|
|
299
299
|
</button>
|
|
300
300
|
</div>
|
|
301
301
|
</div>
|
|
302
302
|
<Show when={props.errors[truncated() - 1]} keyed>
|
|
303
303
|
{current => (
|
|
304
|
-
<div
|
|
304
|
+
<div data-start-dev-overlay-content>
|
|
305
305
|
<ErrorInfo error={current} />
|
|
306
306
|
<StackFrames error={current} isCompiled={isCompiled()} />
|
|
307
307
|
</div>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @refresh skip
|
|
2
2
|
import {
|
|
3
|
-
ErrorBoundary,
|
|
4
|
-
Show,
|
|
5
3
|
createEffect,
|
|
6
4
|
createSignal,
|
|
5
|
+
ErrorBoundary,
|
|
6
|
+
type JSX,
|
|
7
7
|
onCleanup,
|
|
8
8
|
resetErrorBoundaries,
|
|
9
|
-
|
|
9
|
+
Show,
|
|
10
10
|
} from "solid-js";
|
|
11
|
-
import { HttpStatusCode } from "../HttpStatusCode.ts";
|
|
12
11
|
import clientOnly from "../clientOnly.ts";
|
|
12
|
+
import { HttpStatusCode } from "../HttpStatusCode.ts";
|
|
13
13
|
|
|
14
14
|
export interface DevOverlayProps {
|
|
15
15
|
children?: JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
[data-start-dev-overlay] {
|
|
2
2
|
position: fixed;
|
|
3
3
|
inset: 0px;
|
|
4
4
|
z-index: 50;
|
|
5
5
|
overflow-y: auto;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
[data-start-dev-overlay]>div {
|
|
9
9
|
position: relative;
|
|
10
10
|
display: flex;
|
|
11
11
|
align-items: center;
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
min-height: 100vh;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
[data-start-dev-overlay-background] {
|
|
17
17
|
position: absolute;
|
|
18
18
|
inset: 0px;
|
|
19
19
|
background-color: rgb(17 24 39 / 0.5);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
[data-start-dev-overlay-panel] {
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: column;
|
|
25
25
|
width: 75vw;
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
[data-start-dev-overlay-panel-container] {
|
|
34
34
|
margin: 2rem;
|
|
35
35
|
z-index: 10;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
[data-start-dev-overlay-navbar] {
|
|
39
39
|
display: flex;
|
|
40
40
|
flex-direction: row;
|
|
41
41
|
align-items: center;
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
gap: 0.5rem;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
[data-start-dev-overlay-pagination] {
|
|
47
47
|
display: flex;
|
|
48
48
|
flex-direction: row;
|
|
49
49
|
align-items: center;
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
padding: 0.25rem;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
[data-start-dev-overlay-button] {
|
|
58
58
|
display: flex;
|
|
59
59
|
padding: 0.125rem;
|
|
60
60
|
border-radius: 9999px;
|
|
@@ -68,44 +68,44 @@
|
|
|
68
68
|
transition-duration: 150ms;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
[data-start-dev-overlay-button]:hover {
|
|
72
72
|
background-color: rgb(229 231 235);
|
|
73
73
|
color: rgb(55 65 81);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
[data-start-dev-overlay-button]:focus {
|
|
77
77
|
outline: 2px solid transparent;
|
|
78
78
|
outline-offset: 2px
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
[data-start-dev-overlay-button]:focus-visible {
|
|
82
82
|
box-shadow: 0 0 0 calc(3px) rgb(17 24 39 / 0.75);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
[data-start-dev-overlay-button]:active {
|
|
86
86
|
background-color: rgb(243 244 246);
|
|
87
87
|
color: rgb(31 41 55);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
[data-start-dev-overlay-button]>svg {
|
|
91
91
|
height: 1.5rem;
|
|
92
92
|
width: 1.5rem;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
[data-start-dev-overlay-page-counter] {
|
|
96
96
|
font-size: 0.875rem;
|
|
97
97
|
line-height: 1.25rem;
|
|
98
98
|
font-weight: 600;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
[data-start-dev-overlay-navbar-left] {
|
|
102
102
|
display: flex;
|
|
103
103
|
flex-direction: row;
|
|
104
104
|
gap: 0.5rem;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
[data-start-dev-overlay-controls] {
|
|
109
109
|
display: flex;
|
|
110
110
|
flex-direction: row;
|
|
111
111
|
align-items: center;
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
padding: 0.25rem;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
[data-start-dev-overlay-version] {
|
|
120
120
|
display: flex;
|
|
121
121
|
flex-direction: row;
|
|
122
122
|
align-items: center;
|
|
@@ -130,17 +130,17 @@
|
|
|
130
130
|
font-weight: 600;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
[data-start-dev-overlay-version]>div {
|
|
134
134
|
height: 1.5rem;
|
|
135
135
|
width: 1.5rem;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
[data-start-dev-overlay-version]>div>svg {
|
|
139
139
|
height: 1.5rem;
|
|
140
140
|
width: 1.5rem;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
[data-start-dev-overlay-content] {
|
|
144
144
|
display: flex;
|
|
145
145
|
flex-direction: column;
|
|
146
146
|
gap: 0.75rem;
|
|
@@ -149,30 +149,30 @@
|
|
|
149
149
|
padding: 1rem;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
[data-start-dev-overlay-error-info] {
|
|
153
153
|
display: flex;
|
|
154
154
|
flex-direction: column;
|
|
155
155
|
gap: 0.25rem;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
[data-start-dev-overlay-error-info-name] {
|
|
159
159
|
font-weight: 700;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
[data-start-dev-overlay-error-info-message] {
|
|
163
163
|
font-size: 1.5rem;
|
|
164
164
|
line-height: 2rem;
|
|
165
165
|
color: rgb(239 68 68);
|
|
166
166
|
font-weight: 700;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
[data-start-dev-overlay-stack-frames-content] {
|
|
170
170
|
display: flex;
|
|
171
171
|
flex-direction: column;
|
|
172
172
|
gap: 0.75rem;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
[data-start-dev-overlay-stack-frames] {
|
|
176
176
|
flex: 1 1 0%;
|
|
177
177
|
display: flex;
|
|
178
178
|
flex-direction: column;
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
border-radius: 0.5rem;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
[data-start-dev-overlay-stack-frame] {
|
|
189
189
|
display: flex;
|
|
190
190
|
flex-direction: row;
|
|
191
191
|
align-items: center;
|
|
@@ -203,18 +203,18 @@
|
|
|
203
203
|
outline: none;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
[data-start-dev-overlay-stack-frame][tc-active],
|
|
207
|
+
[data-start-dev-overlay-stack-frame][tc-selected],
|
|
208
|
+
[data-start-dev-overlay-stack-frame]:focus {
|
|
209
209
|
background-color: rgb(219 234 254);
|
|
210
210
|
color: rgb(30 58 138);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
[data-start-dev-overlay-stack-frame-function] {
|
|
214
214
|
font-weight: 700;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
[data-start-dev-overlay-stack-frame-file] {
|
|
218
218
|
white-space: nowrap;
|
|
219
219
|
font-size: 0.75rem;
|
|
220
220
|
/* 12px */
|
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
/* 16px */
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
[data-start-dev-overlay-stack-frames-code] {
|
|
226
226
|
padding: 0.5rem 1rem;
|
|
227
227
|
gap: 0.25rem;
|
|
228
228
|
flex: 1 1 0%;
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
background-color: rgb(17 24 39);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
[data-start-dev-overlay-stack-frames-code-fallback] {
|
|
238
238
|
display: flex;
|
|
239
239
|
align-items: center;
|
|
240
240
|
justify-content: center;
|
|
@@ -244,13 +244,13 @@
|
|
|
244
244
|
line-height: 1.25rem;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
|
|
247
|
+
[data-start-dev-overlay-stack-frames-code-source] {
|
|
248
248
|
font-size: 0.875rem;
|
|
249
249
|
line-height: 1.25rem;
|
|
250
250
|
color: rgb(249 250 251);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
[data-start-dev-overlay-stack-frames-code-container] {
|
|
254
254
|
width: 100%;
|
|
255
255
|
overflow: hidden;
|
|
256
256
|
min-width: 100%;
|
|
@@ -260,13 +260,13 @@
|
|
|
260
260
|
border-top-color: rgb(249 250 251);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
|
|
263
|
+
[data-start-dev-overlay-code-view] {
|
|
264
264
|
overflow: auto;
|
|
265
265
|
min-width: 100%;
|
|
266
266
|
min-height: 16rem;
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
|
|
269
|
+
[data-start-dev-overlay-code-view]>.shiki {
|
|
270
270
|
float: left;
|
|
271
271
|
min-width: 100%;
|
|
272
272
|
overflow-x: auto;
|
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
background-color: transparent !important;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
|
|
280
|
+
[data-start-dev-overlay-code-view]>.shiki .line::before {
|
|
281
281
|
content: counter(step);
|
|
282
282
|
counter-increment: step;
|
|
283
283
|
width: 1rem;
|
|
@@ -287,6 +287,6 @@
|
|
|
287
287
|
color: rgba(115, 138, 148, .4)
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
|
|
290
|
+
[data-start-dev-overlay-error-line] {
|
|
291
291
|
background-color: rgba(239, 68, 68, .4);
|
|
292
|
-
}
|
|
292
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as h3 from "h3";
|
|
2
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
-
import { createFetchEvent, getFetchEvent, mergeResponseHeaders } from "./fetchEvent.js";
|
|
4
|
-
vi.mock(import("h3"), async (mod) => {
|
|
5
|
-
return {
|
|
6
|
-
...(await mod()),
|
|
7
|
-
getRequestIP: vi.fn(),
|
|
8
|
-
};
|
|
9
|
-
});
|
|
10
|
-
const mockedH3 = vi.mocked(h3);
|
|
11
|
-
const createMockH3Event = () => {
|
|
12
|
-
const event = new h3.H3Event(new Request("http://localhost/test"));
|
|
13
|
-
event.res.status = 200;
|
|
14
|
-
event.res.statusText = "OK";
|
|
15
|
-
return event;
|
|
16
|
-
};
|
|
17
|
-
describe("fetchEvent", () => {
|
|
18
|
-
let mockH3Event;
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
mockH3Event = createMockH3Event();
|
|
21
|
-
vi.clearAllMocks();
|
|
22
|
-
mockedH3.getRequestIP.mockReturnValue("127.0.0.1");
|
|
23
|
-
});
|
|
24
|
-
describe("createFetchEvent", () => {
|
|
25
|
-
it("should create a FetchEvent from H3Event", () => {
|
|
26
|
-
const fetchEvent = createFetchEvent(mockH3Event);
|
|
27
|
-
expect(fetchEvent).toEqual({
|
|
28
|
-
request: mockH3Event.req,
|
|
29
|
-
response: expect.any(Object),
|
|
30
|
-
clientAddress: "127.0.0.1",
|
|
31
|
-
locals: {},
|
|
32
|
-
nativeEvent: mockH3Event,
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
it("should create response stub with correct properties", () => {
|
|
36
|
-
const fetchEvent = createFetchEvent(mockH3Event);
|
|
37
|
-
expect(fetchEvent.response).toHaveProperty("status");
|
|
38
|
-
expect(fetchEvent.response).toHaveProperty("statusText");
|
|
39
|
-
expect(fetchEvent.response).toHaveProperty("headers");
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe("getFetchEvent", () => {
|
|
43
|
-
it("should create and cache FetchEvent on first call", () => {
|
|
44
|
-
const fetchEvent = getFetchEvent(mockH3Event);
|
|
45
|
-
expect(mockH3Event.context.solidFetchEvent).toBe(fetchEvent);
|
|
46
|
-
expect(fetchEvent.nativeEvent).toBe(mockH3Event);
|
|
47
|
-
});
|
|
48
|
-
it("should return cached FetchEvent on subsequent calls", () => {
|
|
49
|
-
const firstCall = getFetchEvent(mockH3Event);
|
|
50
|
-
const secondCall = getFetchEvent(mockH3Event);
|
|
51
|
-
expect(firstCall).toBe(secondCall);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe("mergeResponseHeaders", () => {
|
|
55
|
-
it("should merge headers from Headers object to H3Event", () => {
|
|
56
|
-
const headers = new Headers({
|
|
57
|
-
"content-type": "application/json",
|
|
58
|
-
"x-custom": "value",
|
|
59
|
-
});
|
|
60
|
-
mergeResponseHeaders(mockH3Event, headers);
|
|
61
|
-
expect(headers.get("content-type")).toBe("application/json");
|
|
62
|
-
expect(headers.get("x-custom")).toBe("value");
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createServerReference(fn: Function, id: string): Function;
|