@sigil-dev/grimoire 0.7.6 → 0.7.7
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/index.ts +35 -34
- package/package.json +8 -6
- package/preload.js +3 -2
- package/server.ts +13 -13
- package/src/client/head.ts +29 -29
- package/src/client/router.ts +290 -224
- package/src/dev/compile-module.ts +173 -0
- package/src/dev/effect-registry.ts +23 -0
- package/src/dev/graph.ts +114 -0
- package/src/dev/hmr-client.ts +158 -0
- package/src/dev/hmr-server.ts +187 -0
- package/src/dev/loader.ts +47 -0
- package/src/dev/paths.ts +14 -0
- package/src/dev/runtime-bundle.ts +49 -0
- package/src/dev/watcher.ts +44 -0
- package/src/integrations/vite.ts +73 -72
- package/src/rendering/hydrate.ts +120 -81
- package/src/rendering/index.ts +296 -199
- package/src/rendering/ssrPlugin.ts +67 -53
- package/src/routing/manifest-gen.ts +42 -39
- package/src/routing/router.ts +109 -106
- package/src/routing/scanner.ts +141 -135
- package/src/routing/transform-routes.ts +101 -101
- package/src/server/build.ts +239 -147
- package/src/server/coordinator.ts +306 -306
- package/src/server/index.ts +260 -50
- package/src/server/worker.ts +59 -59
- package/src/typegen/index.ts +356 -353
- package/src/types.ts +270 -269
- package/test/context.test.ts +52 -52
- package/test/hydration.test.ts +119 -119
- package/test/middleware.test.ts +223 -223
- package/test/rendering.test.ts +579 -425
- package/test/routing.test.ts +81 -83
- package/test/scanning.test.ts +200 -181
- package/test/scope.test.ts +24 -8
- package/test/server.test.ts +249 -229
- package/test/streaming.test.ts +125 -106
- package/test/transform-routes.test.ts +84 -84
- package/test/typegen.test.ts +35 -25
- package/tsconfig.json +1 -0
package/index.ts
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
export { Head } from "./src/rendering/head";
|
|
2
|
-
export
|
|
3
|
-
export type {
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
export { Head } from "./src/rendering/head";
|
|
2
|
+
export { registerSSRPlugin } from "./src/rendering/ssrPlugin.ts";
|
|
3
|
+
export type { RouteFile, RouteTree } from "./src/routing/scanner";
|
|
4
|
+
export type { ErrorResult } from "./src/sentinels/error.ts";
|
|
5
|
+
export { error, isErrorResult } from "./src/sentinels/error.ts";
|
|
6
|
+
export type { FailResult } from "./src/sentinels/fail.ts";
|
|
7
|
+
export { fail, isFailResult } from "./src/sentinels/fail.ts";
|
|
8
|
+
export type { RedirectResult } from "./src/sentinels/redirect.ts";
|
|
9
|
+
export { isRedirectResult, redirect } from "./src/sentinels/redirect.ts";
|
|
10
|
+
export type {
|
|
11
|
+
CookieOptions,
|
|
12
|
+
Cookies,
|
|
13
|
+
Handle,
|
|
14
|
+
RequestEvent,
|
|
15
|
+
ResolveFunction,
|
|
16
|
+
} from "./src/server/hooks";
|
|
17
|
+
export { createHooks, sequence } from "./src/server/hooks";
|
|
18
|
+
export type {
|
|
19
|
+
BuiltinWorkerMode,
|
|
20
|
+
CoordinatorContext,
|
|
21
|
+
GrimoireConfig,
|
|
22
|
+
GrimoirePlugin,
|
|
23
|
+
LayoutServerLoad,
|
|
24
|
+
LoadContext,
|
|
25
|
+
PageServerLoad,
|
|
26
|
+
RenderContext,
|
|
27
|
+
RequestHandler,
|
|
28
|
+
RouteInfo,
|
|
29
|
+
TypedLoadContext,
|
|
30
|
+
WorkerDescriptor,
|
|
31
|
+
WorkerEnv,
|
|
32
|
+
WorkerMode,
|
|
33
|
+
WsRouteHandler,
|
|
34
|
+
} from "./src/types";
|
|
35
|
+
export { defineConfig } from "./src/types";
|
package/package.json
CHANGED
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
"module": "index.ts",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "0.7.
|
|
7
|
-
"devDependencies": {
|
|
8
|
-
"@types/bun": "latest"
|
|
9
|
-
},
|
|
6
|
+
"version": "0.7.7",
|
|
10
7
|
"exports": {
|
|
11
8
|
".": "./index.ts",
|
|
12
9
|
"./server": "./server.ts",
|
|
@@ -32,11 +29,16 @@
|
|
|
32
29
|
"@babel/plugin-syntax-typescript": "^8.0.0-rc.6",
|
|
33
30
|
"@babel/preset-typescript": "^8.0.0-rc.6",
|
|
34
31
|
"@babel/types": "^8.0.0-rc.6",
|
|
35
|
-
"@sigil-dev/compiler": "0.7.6",
|
|
36
|
-
"@sigil-dev/runtime": "0.7.6",
|
|
37
32
|
"vite": "^8.0.16"
|
|
38
33
|
},
|
|
39
34
|
"peerDependencies": {
|
|
35
|
+
"@sigil-dev/compiler": "0.7.7",
|
|
36
|
+
"@sigil-dev/runtime": "0.7.7",
|
|
40
37
|
"typescript": "^5"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/bun": "latest",
|
|
41
|
+
"@sigil-dev/compiler": "0.7.7",
|
|
42
|
+
"@sigil-dev/runtime": "0.7.7"
|
|
41
43
|
}
|
|
42
44
|
}
|
package/preload.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { registerSSRPlugin } from "./src/
|
|
2
|
-
|
|
1
|
+
import { registerSSRPlugin } from "./src/rendering/ssrPlugin.ts";
|
|
2
|
+
|
|
3
|
+
registerSSRPlugin();
|
package/server.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export type { TypegenConfig } from "./src/typegen";
|
|
13
|
-
export { generateTypes } from "./src/typegen";
|
|
1
|
+
export { scanRoutes } from "./src/routing/scanner";
|
|
2
|
+
export { createServer } from "./src/server";
|
|
3
|
+
export { buildProject } from "./src/server/build";
|
|
4
|
+
export { parseCookies } from "./src/server/cookie-utils";
|
|
5
|
+
export { startCoordinator } from "./src/server/coordinator.ts";
|
|
6
|
+
export {
|
|
7
|
+
runDeserializeLocals,
|
|
8
|
+
runRouteRequest,
|
|
9
|
+
runSerializeLocals,
|
|
10
|
+
runWorkerSpawn,
|
|
11
|
+
} from "./src/server/plugins";
|
|
12
|
+
export type { TypegenConfig } from "./src/typegen";
|
|
13
|
+
export { generateTypes } from "./src/typegen";
|
package/src/client/head.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
let headElements: (string | Node)[] = [];
|
|
2
|
-
|
|
3
|
-
export function resetHead(): void {
|
|
4
|
-
headElements = [];
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function collectHead(): (string | Node)[] {
|
|
8
|
-
return headElements;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function applyHead(): void {
|
|
12
|
-
document.querySelectorAll("[data-sigil-head]").forEach((el) => el.remove());
|
|
13
|
-
for (const el of headElements) {
|
|
14
|
-
if (el instanceof Node) {
|
|
15
|
-
const clone = el.cloneNode(true) as HTMLElement;
|
|
16
|
-
clone.dataset.sigilHead = "1";
|
|
17
|
-
document.head.appendChild(clone);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function Head({ children }: { children: string | Node }): Comment {
|
|
23
|
-
if (typeof document === "undefined") {
|
|
24
|
-
headElements.push(children);
|
|
25
|
-
} else if (children instanceof Node) {
|
|
26
|
-
(headElements as Node[]).push(children);
|
|
27
|
-
}
|
|
28
|
-
return document.createComment("head");
|
|
29
|
-
}
|
|
1
|
+
let headElements: (string | Node)[] = [];
|
|
2
|
+
|
|
3
|
+
export function resetHead(): void {
|
|
4
|
+
headElements = [];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function collectHead(): (string | Node)[] {
|
|
8
|
+
return headElements;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function applyHead(): void {
|
|
12
|
+
document.querySelectorAll("[data-sigil-head]").forEach((el) => el.remove());
|
|
13
|
+
for (const el of headElements) {
|
|
14
|
+
if (el instanceof Node) {
|
|
15
|
+
const clone = el.cloneNode(true) as HTMLElement;
|
|
16
|
+
clone.dataset.sigilHead = "1";
|
|
17
|
+
document.head.appendChild(clone);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function Head({ children }: { children: string | Node }): Comment {
|
|
23
|
+
if (typeof document === "undefined") {
|
|
24
|
+
headElements.push(children);
|
|
25
|
+
} else if (children instanceof Node) {
|
|
26
|
+
(headElements as Node[]).push(children);
|
|
27
|
+
}
|
|
28
|
+
return document.createComment("head");
|
|
29
|
+
}
|