@ilha/router 0.10.0 → 0.10.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/dist/{plugin-CmI3Brr2.js → plugin-Bh0y5kkI.js} +1 -1
- package/dist/rsbuild.js +1 -1
- package/dist/server.d.ts +8 -0
- package/dist/server.js +14 -0
- package/dist/{ssr-BxrcUYy5.js → ssr-CGcMUP1G.js} +4 -27
- package/dist/ssr.d.ts +4 -8
- package/dist/ssr.js +1 -1
- package/dist/vite.js +1 -1
- package/package.json +7 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as setLoaderGuard, T as runWithIslandRequest, b as setFrameAuth, c as frameEnvelope, m as isSafeFramePath, n as FrameError, o as authorizeFrameRequest, u as getFrameGuard, x as setFrameGuard, y as renderServerIsland } from "./ssr-
|
|
1
|
+
import { C as setLoaderGuard, T as runWithIslandRequest, b as setFrameAuth, c as frameEnvelope, m as isSafeFramePath, n as FrameError, o as authorizeFrameRequest, u as getFrameGuard, x as setFrameGuard, y as renderServerIsland } from "./ssr-CGcMUP1G.js";
|
|
2
2
|
import { existsSync, readFileSync, statSync, watch } from "node:fs";
|
|
3
3
|
import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
4
4
|
import { createUnplugin } from "unplugin";
|
package/dist/rsbuild.js
CHANGED
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "ilha";
|
|
2
|
+
import { type ServerAction } from "ilha/internal";
|
|
3
|
+
/**
|
|
4
|
+
* Declare an Oxide RPC action that can also be passed directly to server-island
|
|
5
|
+
* event props or bound to a serializable payload with `.with()`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function action<A extends unknown[], R>(fn: (...args: A) => R): ServerAction<A, R>;
|
|
8
|
+
export type { ServerAction } from "ilha/internal";
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "ilha";
|
|
2
|
+
import { bindServerAction } from "ilha/internal";
|
|
3
|
+
|
|
4
|
+
//#region src/server.ts
|
|
5
|
+
/**
|
|
6
|
+
* Declare an Oxide RPC action that can also be passed directly to server-island
|
|
7
|
+
* event props or bound to a serializable payload with `.with()`.
|
|
8
|
+
*/
|
|
9
|
+
function action(fn) {
|
|
10
|
+
return bindServerAction(fn);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { action };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { M as parsePattern, N as safeDecode, b as resolveRedirectTarget, j as matchSegments } from "./src-B5dHU24f.js";
|
|
2
|
-
import
|
|
2
|
+
import "ilha";
|
|
3
|
+
import { bindServerAction, setServerManifestSerializer } from "ilha/internal";
|
|
3
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
5
|
|
|
5
6
|
//#region src/request-scope.ts
|
|
@@ -34,24 +35,6 @@ function runWithIslandRequest(request, fn) {
|
|
|
34
35
|
|
|
35
36
|
//#endregion
|
|
36
37
|
//#region src/ssr.ts
|
|
37
|
-
/**
|
|
38
|
-
* Production SSR endpoints for server-owned islands and regular-page loads.
|
|
39
|
-
*
|
|
40
|
-
* Default export is an oxidejs-style fetch middleware:
|
|
41
|
-
* `(request) => Response | undefined`. Returns `undefined` for any request it
|
|
42
|
-
* does not own, so hosts can chain it ahead of their own handler:
|
|
43
|
-
*
|
|
44
|
-
* ```ts
|
|
45
|
-
* oxide({ middleware: ["@ilha/router/ssr"] });
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* Serves:
|
|
49
|
-
* - `POST /__ilha/frame` — re-renders a server island (JSON `{ id, path }` in,
|
|
50
|
-
* `{ html }` out). Renderers come from the process-global registry
|
|
51
|
-
* populated by self-registration code appended to `.server` modules.
|
|
52
|
-
* - `GET /__ilha/loader?path=…` — regular-page server loads via the loader
|
|
53
|
-
* runner (`setFrameLoaderRunner`, wired by the generated server module).
|
|
54
|
-
*/
|
|
55
38
|
const REGISTRY_KEY = Symbol.for("ilha.serverIslandRenderers");
|
|
56
39
|
function registry() {
|
|
57
40
|
const g = globalThis;
|
|
@@ -191,15 +174,9 @@ function getFrameLoaderRunner() {
|
|
|
191
174
|
setServerManifestSerializer({ template(manifest) {
|
|
192
175
|
return `<template data-ilha-actions='${JSON.stringify(Object.fromEntries(manifest)).replace(/&/g, "&").replace(/'/g, "'").replace(/</g, "<")}'></template>`;
|
|
193
176
|
} });
|
|
194
|
-
/**
|
|
195
|
-
/**
|
|
196
|
-
* Wrap an exported server action with a named transport key. Ilha never
|
|
197
|
-
* executes event-handler closures during server rendering (fail closed), so
|
|
198
|
-
* this is a transparent passthrough kept for API compatibility; the `key`
|
|
199
|
-
* documents the RPC transport name used by tooling.
|
|
200
|
-
*/
|
|
177
|
+
/** @internal Brand an exported server action with its generated RPC transport key. */
|
|
201
178
|
function __ilhaServerAction(key, fn) {
|
|
202
|
-
return
|
|
179
|
+
return bindServerAction(fn, key);
|
|
203
180
|
}
|
|
204
181
|
function registerServerIsland(id, render, options) {
|
|
205
182
|
registry().set(id, {
|
package/dist/ssr.d.ts
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* - `GET /__ilha/loader?path=…` — regular-page server loads via the loader
|
|
17
17
|
* runner (`setFrameLoaderRunner`, wired by the generated server module).
|
|
18
18
|
*/
|
|
19
|
+
import "ilha";
|
|
20
|
+
import { type ServerAction } from "ilha/internal";
|
|
19
21
|
import type { HeadInput } from "./head";
|
|
20
22
|
/**
|
|
21
23
|
* Server-frame state shared by the dev middleware and the production
|
|
@@ -143,14 +145,8 @@ export type FrameLoaderRunner = (path: string, request?: Request) => Promise<{
|
|
|
143
145
|
*/
|
|
144
146
|
export declare function setFrameLoaderRunner(runner: FrameLoaderRunner): void;
|
|
145
147
|
export declare function getFrameLoaderRunner(): FrameLoaderRunner | undefined;
|
|
146
|
-
/**
|
|
147
|
-
|
|
148
|
-
* Wrap an exported server action with a named transport key. Ilha never
|
|
149
|
-
* executes event-handler closures during server rendering (fail closed), so
|
|
150
|
-
* this is a transparent passthrough kept for API compatibility; the `key`
|
|
151
|
-
* documents the RPC transport name used by tooling.
|
|
152
|
-
*/
|
|
153
|
-
export declare function __ilhaServerAction<A extends unknown[], R>(key: string, fn: (...args: A) => R): (...args: A) => R | undefined;
|
|
148
|
+
/** @internal Brand an exported server action with its generated RPC transport key. */
|
|
149
|
+
export declare function __ilhaServerAction<A extends unknown[], R>(key: string, fn: (...args: A) => R): ServerAction<A, R>;
|
|
154
150
|
export declare function registerServerIsland(id: string, render: () => unknown, options?: {
|
|
155
151
|
load?: ServerPageLoader;
|
|
156
152
|
pattern?: string;
|
package/dist/ssr.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as setLoaderGuard, S as setFrameLoaderRunner, _ as readBodyBounded, a as __ilhaServerAction, b as setFrameAuth, c as frameEnvelope, d as getFrameLoaderRunner, f as getLoaderGuard, g as json, h as isTrustedOrigin, i as MAX_BODY, l as getFrameAuth, m as isSafeFramePath, n as FrameError, o as authorizeFrameRequest, p as getServerIslandEntry, r as LOADER_ENDPOINT, s as forwardIdentityHeaders, t as FRAME_ENDPOINT, u as getFrameGuard, v as registerServerIsland, w as ssr, x as setFrameGuard, y as renderServerIsland } from "./ssr-
|
|
1
|
+
import { C as setLoaderGuard, S as setFrameLoaderRunner, _ as readBodyBounded, a as __ilhaServerAction, b as setFrameAuth, c as frameEnvelope, d as getFrameLoaderRunner, f as getLoaderGuard, g as json, h as isTrustedOrigin, i as MAX_BODY, l as getFrameAuth, m as isSafeFramePath, n as FrameError, o as authorizeFrameRequest, p as getServerIslandEntry, r as LOADER_ENDPOINT, s as forwardIdentityHeaders, t as FRAME_ENDPOINT, u as getFrameGuard, v as registerServerIsland, w as ssr, x as setFrameGuard, y as renderServerIsland } from "./ssr-CGcMUP1G.js";
|
|
2
2
|
|
|
3
3
|
export { FRAME_ENDPOINT, FrameError, LOADER_ENDPOINT, MAX_BODY, __ilhaServerAction, authorizeFrameRequest, ssr as default, forwardIdentityHeaders, frameEnvelope, getFrameAuth, getFrameGuard, getFrameLoaderRunner, getLoaderGuard, getServerIslandEntry, isSafeFramePath, isTrustedOrigin, json, readBodyBounded, registerServerIsland, renderServerIsland, setFrameAuth, setFrameGuard, setFrameLoaderRunner, setLoaderGuard };
|
package/dist/vite.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilha/router",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "A tiny SPA router for Ilha",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"frontend",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"types": "./dist/index.d.ts",
|
|
41
41
|
"import": "./dist/index.js"
|
|
42
42
|
},
|
|
43
|
+
"./server": {
|
|
44
|
+
"types": "./dist/server.d.ts",
|
|
45
|
+
"import": "./dist/server.js"
|
|
46
|
+
},
|
|
43
47
|
"./server-island": {
|
|
44
48
|
"types": "./dist/server-island.d.ts",
|
|
45
49
|
"import": "./dist/server-island.js"
|
|
@@ -69,10 +73,10 @@
|
|
|
69
73
|
"unplugin": "3.3.0"
|
|
70
74
|
},
|
|
71
75
|
"devDependencies": {
|
|
72
|
-
"ilha": "0.12.
|
|
76
|
+
"ilha": "0.12.1",
|
|
73
77
|
"vite": "^8.2.2"
|
|
74
78
|
},
|
|
75
79
|
"peerDependencies": {
|
|
76
|
-
"ilha": ">=0.12.
|
|
80
|
+
"ilha": ">=0.12.1"
|
|
77
81
|
}
|
|
78
82
|
}
|