@k8ordo/framework 1.4.1 → 1.4.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/README.md +1 -1
- package/dist/cli.mjs +1 -2
- package/dist/runtime/app-router.d.mts +1 -3
- package/dist/runtime/app-router.mjs +1 -2
- package/dist/runtime/browser-payloads.d.mts +1 -3
- package/dist/runtime/browser-payloads.mjs +1 -2
- package/dist/runtime/cancel.d.mts +1 -3
- package/dist/runtime/cancel.mjs +1 -2
- package/dist/runtime/client-ready.d.mts +1 -3
- package/dist/runtime/client-ready.mjs +1 -2
- package/dist/runtime/cookies.d.mts +1 -3
- package/dist/runtime/cookies.mjs +1 -2
- package/dist/runtime/entry.browser.mjs +1 -2
- package/dist/runtime/entry.rsc.d.mts +1 -3
- package/dist/runtime/entry.rsc.mjs +1 -2
- package/dist/runtime/entry.ssr.d.mts +1 -3
- package/dist/runtime/entry.ssr.mjs +1 -2
- package/dist/runtime/fallback-boundary.d.mts +0 -2
- package/dist/runtime/fallback-boundary.mjs +1 -2
- package/dist/runtime/guard.d.mts +0 -2
- package/dist/runtime/guard.mjs +1 -2
- package/dist/runtime/is-payload.d.mts +1 -3
- package/dist/runtime/is-payload.mjs +1 -2
- package/dist/runtime/mount.d.mts +1 -3
- package/dist/runtime/mount.mjs +1 -2
- package/dist/runtime/page-boundary.d.mts +0 -2
- package/dist/runtime/page-boundary.mjs +1 -2
- package/dist/runtime/page-shown.d.mts +1 -3
- package/dist/runtime/page-shown.mjs +1 -2
- package/dist/runtime/page-watch.d.mts +1 -3
- package/dist/runtime/page-watch.mjs +1 -2
- package/dist/runtime/params.d.mts +0 -2
- package/dist/runtime/params.mjs +1 -2
- package/dist/runtime/pathname.d.mts +1 -3
- package/dist/runtime/pathname.mjs +1 -2
- package/dist/runtime/payload-path.d.mts +1 -3
- package/dist/runtime/payload-path.mjs +1 -2
- package/dist/runtime/payload.d.mts +1 -3
- package/dist/runtime/payload.mjs +1 -2
- package/dist/runtime/prefetch.d.mts +1 -3
- package/dist/runtime/prefetch.mjs +1 -2
- package/dist/runtime/recover.d.mts +1 -3
- package/dist/runtime/recover.mjs +1 -2
- package/dist/runtime/redirect-file.d.mts +0 -2
- package/dist/runtime/redirect-file.mjs +1 -2
- package/dist/runtime/redirect.d.mts +0 -2
- package/dist/runtime/redirect.mjs +1 -2
- package/dist/runtime/reload.d.mts +1 -3
- package/dist/runtime/reload.mjs +1 -2
- package/dist/runtime/render.d.mts +1 -3
- package/dist/runtime/render.mjs +1 -2
- package/dist/runtime/request-scope.d.mts +1 -3
- package/dist/runtime/request-scope.mjs +1 -2
- package/dist/runtime/request.d.mts +1 -3
- package/dist/runtime/request.mjs +1 -2
- package/dist/runtime/revealed.d.mts +1 -3
- package/dist/runtime/revealed.mjs +1 -2
- package/dist/runtime/route.d.mts +0 -2
- package/dist/runtime/route.mjs +1 -2
- package/dist/runtime/says-not-found.d.mts +1 -3
- package/dist/runtime/says-not-found.mjs +1 -2
- package/dist/runtime/shell.d.mts +1 -3
- package/dist/runtime/shell.mjs +1 -2
- package/dist/runtime/tree-pathname.d.mts +1 -3
- package/dist/runtime/tree-pathname.mjs +1 -2
- package/dist/serve.d.mts +1 -3
- package/dist/serve.mjs +2 -3
- package/dist/server.d.mts +0 -16
- package/dist/server.mjs +2 -4
- package/dist/{shared-dir-CkF4QCWc.mjs → shared-dir-CNXFRZgP.mjs} +1 -2
- package/dist/{static-BaGdAVF1.d.mts → static-6z8_6B1U.d.mts} +0 -6
- package/dist/{static-host-dgtttTuZ.mjs → static-host-C6D_11Gp.mjs} +6 -12
- package/dist/vercel.d.mts +1 -5
- package/dist/vercel.mjs +3 -5
- package/dist/vite.d.mts +1 -3
- package/dist/vite.mjs +16 -30
- package/docs/GUIDE.md +10 -0
- package/package.json +5 -5
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
//#region src/runtime/reload.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Ending the page and asking the server for it again — the framework's one
|
|
4
3
|
* way of giving up on the client. Its own module because `location.reload`
|
|
5
4
|
* cannot be replaced (the Location interface is unforgeable), so this name is
|
|
6
5
|
* the only seam from which a test can watch the framework give up.
|
|
7
6
|
*/
|
|
8
|
-
export declare const reloadDocument: () => void;
|
|
9
|
-
//#endregion
|
|
7
|
+
export declare const reloadDocument: () => void;
|
package/dist/runtime/reload.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/reload.ts
|
|
2
2
|
/**
|
|
3
3
|
* Ending the page and asking the server for it again — the framework's one
|
|
4
4
|
* way of giving up on the client. Its own module because `location.reload`
|
|
@@ -8,5 +8,4 @@
|
|
|
8
8
|
const reloadDocument = () => {
|
|
9
9
|
location.reload();
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { reloadDocument };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RouteRequest } from "./request.mjs";
|
|
2
2
|
import { Match, Routes } from "@k8ordo/router";
|
|
3
3
|
import { ComponentType, ReactNode } from "react";
|
|
4
|
-
//#region src/runtime/render.d.ts
|
|
5
4
|
export type PageProps = {
|
|
6
5
|
/**
|
|
7
6
|
* The pattern's params: for the page, after the schemas the route files
|
|
@@ -70,5 +69,4 @@ export declare const renderMatch: (match: Match, { pathname, params, request, pa
|
|
|
70
69
|
* visitor keeps the site's frame, its `<html lang>`, its stylesheets, and a
|
|
71
70
|
* way back. With no root layout either, a document of its own.
|
|
72
71
|
*/
|
|
73
|
-
export declare const renderNotFound: (routes: Routes, pathname: string, request?: RouteRequest) => ReactNode;
|
|
74
|
-
//#endregion
|
|
72
|
+
export declare const renderNotFound: (routes: Routes, pathname: string, request?: RouteRequest) => ReactNode;
|
package/dist/runtime/render.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FallbackBoundary } from "./fallback-boundary.mjs";
|
|
2
2
|
import { PageBoundary } from "./page-boundary.mjs";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/runtime/render.tsx
|
|
5
5
|
/**
|
|
6
6
|
* Nests the matched stack the way Server Components require: a layout
|
|
7
7
|
* receives what it wraps as `children`, because context cannot cross the
|
|
@@ -73,5 +73,4 @@ const renderNotFound = (routes, pathname, request) => {
|
|
|
73
73
|
children: /* @__PURE__ */ jsx(NotFoundBody, {})
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
|
-
//#endregion
|
|
77
76
|
export { renderMatch, renderNotFound };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Cookies } from "./cookies.mjs";
|
|
2
|
-
//#region src/runtime/request-scope.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* What is running for the request: a `guard.ts`, a `route.ts`, a Server
|
|
5
4
|
* Action, or the render. Only what answers the request may read and write
|
|
@@ -60,5 +59,4 @@ export declare const nonce: () => string;
|
|
|
60
59
|
* The nonce the handler signs its own inline scripts with, in either mode: a
|
|
61
60
|
* build into files turns what it signed into hashes.
|
|
62
61
|
*/
|
|
63
|
-
export declare const signingNonce: () => string;
|
|
64
|
-
//#endregion
|
|
62
|
+
export declare const signingNonce: () => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createCookies } from "./cookies.mjs";
|
|
2
2
|
import { parseCookies } from "./request.mjs";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
-
|
|
4
|
+
// src/runtime/request-scope.ts
|
|
5
5
|
/**
|
|
6
6
|
* The framework bundles this module twice — into the runtime the handler
|
|
7
7
|
* is built from, and into the entry an application imports the response API
|
|
@@ -130,5 +130,4 @@ const signingNonce = () => {
|
|
|
130
130
|
if (scope === void 0) throw new Error("the handler signs its scripts while a request is answered");
|
|
131
131
|
return scope.nonce;
|
|
132
132
|
};
|
|
133
|
-
//#endregion
|
|
134
133
|
export { answer, cookies, inPhase, nonce, requestHeaders, responseHeaders, signingNonce, withRequest, writingFile };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/runtime/request.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* What a page may read of the request under mode: 'server': the headers
|
|
4
3
|
* and the cookies, read-only. Nothing that would let a page write to the
|
|
@@ -18,5 +17,4 @@ export declare const routeRequestOf: (request: Request) => RouteRequest;
|
|
|
18
17
|
* fallback of a `request?.` the build then writes for everyone. Its getters
|
|
19
18
|
* are not enumerable: React, handing the props on, sees an empty object.
|
|
20
19
|
*/
|
|
21
|
-
export declare const fileRequest: RouteRequest;
|
|
22
|
-
//#endregion
|
|
20
|
+
export declare const fileRequest: RouteRequest;
|
package/dist/runtime/request.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/request.ts
|
|
2
2
|
const parseCookies = (header) => {
|
|
3
3
|
const cookies = /* @__PURE__ */ new Map();
|
|
4
4
|
if (header === null) return cookies;
|
|
@@ -34,5 +34,4 @@ const fileRequest = Object.defineProperties({}, {
|
|
|
34
34
|
headers: unreadable("headers"),
|
|
35
35
|
cookies: unreadable("cookies")
|
|
36
36
|
});
|
|
37
|
-
//#endregion
|
|
38
37
|
export { fileRequest, parseCookies, routeRequestOf };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//#region src/runtime/revealed.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Settles once every Suspense boundary the server streamed into the document
|
|
4
3
|
* is on screen — at once when none is waiting.
|
|
5
4
|
*/
|
|
6
|
-
export declare const whenRevealed: () => Promise<void>;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare const whenRevealed: () => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/revealed.ts
|
|
2
2
|
/**
|
|
3
3
|
* How the server's HTML marks a Suspense boundary whose content is not in
|
|
4
4
|
* place yet: `$?` while it is still on its way (or waiting on its
|
|
@@ -31,5 +31,4 @@ const whenRevealed = () => new Promise((resolve) => {
|
|
|
31
31
|
characterData: true
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
//#endregion
|
|
35
34
|
export { whenRevealed };
|
package/dist/runtime/route.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/runtime/route.d.ts
|
|
2
1
|
/** The request methods a `route.ts` answers by exporting a function named so. */
|
|
3
2
|
export declare const ROUTE_METHODS: readonly ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'];
|
|
4
3
|
export type RouteMethod = (typeof ROUTE_METHODS)[number];
|
|
@@ -32,5 +31,4 @@ export declare const methodNotAllowed: (module: AnyRouteModule) => Response;
|
|
|
32
31
|
* answers the request as much as a guard does.
|
|
33
32
|
*/
|
|
34
33
|
export declare const runRoute: ({ handler, headOnly }: RouteAnswer, context: RouteContext) => Promise<Response>;
|
|
35
|
-
//#endregion
|
|
36
34
|
export {};
|
package/dist/runtime/route.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inPhase } from "./request-scope.mjs";
|
|
2
|
-
|
|
2
|
+
// src/runtime/route.ts
|
|
3
3
|
/** The request methods a `route.ts` answers by exporting a function named so. */
|
|
4
4
|
const ROUTE_METHODS = [
|
|
5
5
|
"GET",
|
|
@@ -55,5 +55,4 @@ const runRoute = async ({ handler, headOnly }, context) => {
|
|
|
55
55
|
headers: response.headers
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
|
-
//#endregion
|
|
59
58
|
export { ROUTE_METHODS, methodNotAllowed, methodsOf, routeAnswerFor, runRoute };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//#region src/runtime/says-not-found.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Whether what a boundary caught is `notFound()`: thrown where the browser
|
|
4
3
|
* rendered it, or arrived as the digest the RSC render sent in its place.
|
|
5
4
|
*/
|
|
6
|
-
export declare const saysNotFound: (error: unknown) => boolean;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare const saysNotFound: (error: unknown) => boolean;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "./payload.mjs";
|
|
2
2
|
import { isNotFound } from "@k8ordo/router";
|
|
3
|
-
|
|
3
|
+
// src/runtime/says-not-found.ts
|
|
4
4
|
/**
|
|
5
5
|
* Whether what a boundary caught is `notFound()`: thrown where the browser
|
|
6
6
|
* rendered it, or arrived as the digest the RSC render sent in its place.
|
|
7
7
|
*/
|
|
8
8
|
const saysNotFound = (error) => isNotFound(error) || typeof error === "object" && error !== null && error.digest === "K8ORDO_NOT_FOUND";
|
|
9
|
-
//#endregion
|
|
10
9
|
export { saysNotFound };
|
package/dist/runtime/shell.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//#region src/runtime/shell.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The params a shell request fills — `null` when this is not one: no param
|
|
4
3
|
* holds the reserved segment, or one that does is not open.
|
|
5
4
|
*/
|
|
6
|
-
export declare const shellParams: (params: Readonly<Record<string, string>>, open: readonly string[]) => Readonly<Record<string, string>> | null;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare const shellParams: (params: Readonly<Record<string, string>>, open: readonly string[]) => Readonly<Record<string, string>> | null;
|
package/dist/runtime/shell.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FALLBACK_SEGMENT } from "./pathname.mjs";
|
|
2
|
-
|
|
2
|
+
// src/runtime/shell.ts
|
|
3
3
|
/**
|
|
4
4
|
* The params a shell request fills — `null` when this is not one: no param
|
|
5
5
|
* holds the reserved segment, or one that does is not open.
|
|
@@ -9,5 +9,4 @@ const shellParams = (params, open) => {
|
|
|
9
9
|
if (left.length === 0 || left.some((name) => !open.includes(name))) return null;
|
|
10
10
|
return Object.fromEntries(Object.entries(params).filter(([, value]) => value !== FALLBACK_SEGMENT));
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { shellParams };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createContext } from "react";
|
|
3
|
-
|
|
3
|
+
// src/runtime/tree-pathname.ts
|
|
4
4
|
/**
|
|
5
5
|
* `@k8ordo/router`'s context for the pathname each tree was applied for,
|
|
6
6
|
* which `<Router>` provides and `@k8ordo/state` reads to keep a page state's
|
|
@@ -8,5 +8,4 @@ import { createContext } from "react";
|
|
|
8
8
|
*/
|
|
9
9
|
const KEY = Symbol.for("@k8ordo/router/tree-pathname");
|
|
10
10
|
const TreePathname = globalThis[KEY] ??= createContext(null);
|
|
11
|
-
//#endregion
|
|
12
11
|
export { TreePathname };
|
package/dist/serve.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/serve.d.ts
|
|
2
1
|
export type ServeOptions = {
|
|
3
2
|
/** Build output directory, the one holding `rsc/` and `client/`. */
|
|
4
3
|
readonly dist?: string;
|
|
@@ -19,5 +18,4 @@ export type Server = {
|
|
|
19
18
|
* `200` rules, then `404.html` — never calling the handler, which wrote
|
|
20
19
|
* every file there is.
|
|
21
20
|
*/
|
|
22
|
-
export declare const serve: (options?: ServeOptions) => Promise<Server>;
|
|
23
|
-
//#endregion
|
|
21
|
+
export declare const serve: (options?: ServeOptions) => Promise<Server>;
|
package/dist/serve.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as ENCODINGS, f as SUFFIX, h as streamingCompressor, m as negotiateEncoding, n as resolveStatic, p as isCompressible, r as safeJoin, t as readRules } from "./static-host-
|
|
1
|
+
import { d as ENCODINGS, f as SUFFIX, h as streamingCompressor, m as negotiateEncoding, n as resolveStatic, p as isCompressible, r as safeJoin, t as readRules } from "./static-host-C6D_11Gp.mjs";
|
|
2
2
|
import { withoutBase } from "@k8ordo/router";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { stat } from "node:fs/promises";
|
|
@@ -11,7 +11,7 @@ import { Readable } from "node:stream";
|
|
|
11
11
|
import { pipeline } from "node:stream/promises";
|
|
12
12
|
import fresh from "fresh";
|
|
13
13
|
import parseRange from "range-parser";
|
|
14
|
-
|
|
14
|
+
// src/serve.ts
|
|
15
15
|
/**
|
|
16
16
|
* Vite writes the hash of the contents into the name of everything under
|
|
17
17
|
* `assets/`, so those files can never change under a URL — anything else
|
|
@@ -274,5 +274,4 @@ const serve = async (options = {}) => {
|
|
|
274
274
|
})
|
|
275
275
|
};
|
|
276
276
|
};
|
|
277
|
-
//#endregion
|
|
278
277
|
export { serve };
|
package/dist/server.d.mts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { ParamsOf } from "@k8ordo/router";
|
|
2
|
-
//#region ../framework-engine/dist/runtime/cookies.d.mts
|
|
3
|
-
//#region src/runtime/cookies.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* How a cookie is kept. The defaults are the ones a session wants: sent on
|
|
6
4
|
* every path, never readable from a page's script, only over HTTPS, and not
|
|
@@ -38,9 +36,6 @@ type Cookies = {
|
|
|
38
36
|
readonly set: (name: string, value: string, options?: CookieOptions) => void;
|
|
39
37
|
readonly delete: (name: string, scope?: CookieScope) => void;
|
|
40
38
|
};
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region ../framework-engine/dist/runtime/guard.d.mts
|
|
43
|
-
//#region src/runtime/guard.d.ts
|
|
44
39
|
/**
|
|
45
40
|
* What a `guard.ts` receives: the request, and the params of the pattern its
|
|
46
41
|
* directory puts it under, as the strings the pathname carried — a guard runs
|
|
@@ -57,16 +52,11 @@ type GuardContext<P extends string = string> = {
|
|
|
57
52
|
* streams, and its headers leave before its body is written.
|
|
58
53
|
*/
|
|
59
54
|
type Guard<P extends string = string> = (context: GuardContext<P>) => Response | void | Promise<Response | void>;
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region ../framework-engine/dist/runtime/redirect-file.d.mts
|
|
62
|
-
//#region src/runtime/redirect-file.d.ts
|
|
63
55
|
/** What a `redirect.ts` route file default-exports. */
|
|
64
56
|
type RedirectTarget = string | {
|
|
65
57
|
readonly to: string;
|
|
66
58
|
readonly permanent?: boolean;
|
|
67
59
|
};
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region ../framework-engine/dist/runtime/redirect.d.mts
|
|
70
60
|
/**
|
|
71
61
|
* Ends a Server Action by sending the visitor somewhere else. Thrown, so an
|
|
72
62
|
* action reads the way it did before the redirect was added — the lines
|
|
@@ -75,9 +65,6 @@ type RedirectTarget = string | {
|
|
|
75
65
|
* payload that tells the browser to navigate there.
|
|
76
66
|
*/
|
|
77
67
|
export declare const redirect: (to: string) => never;
|
|
78
|
-
//#endregion
|
|
79
|
-
//#region ../framework-engine/dist/runtime/request.d.mts
|
|
80
|
-
//#region src/runtime/request.d.ts
|
|
81
68
|
/**
|
|
82
69
|
* What a page may read of the request under mode: 'server': the headers
|
|
83
70
|
* and the cookies, read-only. Nothing that would let a page write to the
|
|
@@ -88,8 +75,6 @@ type RouteRequest = {
|
|
|
88
75
|
readonly headers: Headers;
|
|
89
76
|
readonly cookies: ReadonlyMap<string, string>;
|
|
90
77
|
};
|
|
91
|
-
//#endregion
|
|
92
|
-
//#region ../framework-engine/dist/runtime/request-scope.d.mts
|
|
93
78
|
/**
|
|
94
79
|
* The headers the final response will carry, whatever answers the request.
|
|
95
80
|
* Set from a `guard.ts` that lets the request through — a
|
|
@@ -122,5 +107,4 @@ export declare const requestHeaders: () => Headers;
|
|
|
122
107
|
* carries it into hashes.
|
|
123
108
|
*/
|
|
124
109
|
export declare const nonce: () => string;
|
|
125
|
-
//#endregion
|
|
126
110
|
export type { CookieOptions, CookieScope, Cookies, Guard, GuardContext, RedirectTarget, RouteRequest };
|
package/dist/server.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
|
|
2
|
+
// ../framework-engine/dist/runtime/request-scope.mjs
|
|
3
3
|
/**
|
|
4
4
|
* The framework bundles this module twice — into the runtime the handler
|
|
5
5
|
* is built from, and into the entry an application imports the response API
|
|
@@ -62,8 +62,7 @@ const nonce = () => {
|
|
|
62
62
|
if (scope.file === true) throw fileRefusal("nonce()");
|
|
63
63
|
return scope.nonce;
|
|
64
64
|
};
|
|
65
|
-
|
|
66
|
-
//#region ../framework-engine/dist/runtime/redirect.mjs
|
|
65
|
+
// ../framework-engine/dist/runtime/redirect.mjs
|
|
67
66
|
/**
|
|
68
67
|
* A redirect thrown from a Server Action. Branded with a registry symbol
|
|
69
68
|
* rather than a class: the framework bundles this module once into the
|
|
@@ -95,5 +94,4 @@ var Redirect = class extends Error {
|
|
|
95
94
|
const redirect = (to) => {
|
|
96
95
|
throw new Redirect(to);
|
|
97
96
|
};
|
|
98
|
-
//#endregion
|
|
99
97
|
export { cookies, nonce, redirect, requestHeaders, responseHeaders };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
|
|
2
|
+
// ../framework-engine/dist/plugin/shared-dir.mjs
|
|
3
3
|
/** The deepest directory holding both `a` and `b`. */
|
|
4
4
|
const sharedDir = (a, b) => {
|
|
5
5
|
let dir = a;
|
|
6
6
|
while (path.relative(dir, b).startsWith("..")) dir = path.dirname(dir);
|
|
7
7
|
return dir;
|
|
8
8
|
};
|
|
9
|
-
//#endregion
|
|
10
9
|
export { sharedDir as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Plugin, PluginOption } from "vite";
|
|
2
2
|
import "react";
|
|
3
|
-
//#region ../framework-engine/dist/host.d.mts
|
|
4
3
|
/** What `framework()` takes whatever the mode. */
|
|
5
4
|
type EngineOptions = {
|
|
6
5
|
/** Where the route files live, relative to the project root. */
|
|
@@ -12,16 +11,12 @@ type EngineOptions = {
|
|
|
12
11
|
*/
|
|
13
12
|
readonly reactCompiler?: boolean;
|
|
14
13
|
};
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/documents.d.ts
|
|
17
14
|
/**
|
|
18
15
|
* The `Content-Security-Policy` an application wants on every page, as
|
|
19
16
|
* directives and their sources. The build writes it into each page's
|
|
20
17
|
* `<meta>`, with the hashes of that page's signed inline scripts added.
|
|
21
18
|
*/
|
|
22
19
|
type ContentSecurityPolicy = Readonly<Record<string, readonly string[]>>;
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/static.d.ts
|
|
25
20
|
type StaticOptions = EngineOptions & {
|
|
26
21
|
/**
|
|
27
22
|
* Every route rendered at build time and written to files; no server at
|
|
@@ -62,5 +57,4 @@ type StaticOptions = EngineOptions & {
|
|
|
62
57
|
*/
|
|
63
58
|
readonly csp?: ContentSecurityPolicy;
|
|
64
59
|
};
|
|
65
|
-
//#endregion
|
|
66
60
|
export { ContentSecurityPolicy as n, EngineOptions as r, StaticOptions as t };
|
|
@@ -4,7 +4,7 @@ import path from "node:path";
|
|
|
4
4
|
import { constants, createBrotliCompress, createGzip } from "node:zlib";
|
|
5
5
|
import compressible from "compressible";
|
|
6
6
|
import Negotiator from "negotiator";
|
|
7
|
-
|
|
7
|
+
// ../framework-engine/dist/runtime/pathname.mjs
|
|
8
8
|
/**
|
|
9
9
|
* A pathname as the URL carries it, decoded for the filesystem — the one
|
|
10
10
|
* thing the static writer and the server's file lookup both have to do
|
|
@@ -34,8 +34,7 @@ const NOT_FOUND_SEGMENT = "__k8ordo-not-found__";
|
|
|
34
34
|
* re-encodes a rewrite target finds the directory under the same spelling.
|
|
35
35
|
*/
|
|
36
36
|
const FALLBACK_SEGMENT = "!fallback";
|
|
37
|
-
|
|
38
|
-
//#region ../framework-engine/dist/runtime/payload-path.mjs
|
|
37
|
+
// ../framework-engine/dist/runtime/payload-path.mjs
|
|
39
38
|
/**
|
|
40
39
|
* Where a page's RSC payload lives. It has to be a plain path, not a header
|
|
41
40
|
* or a query, because static hosting varies on neither — the same convention
|
|
@@ -53,8 +52,7 @@ const pagePathFor = (payloadPath) => {
|
|
|
53
52
|
const page = payloadPath.slice(0, -10);
|
|
54
53
|
return page === "" ? "/" : page;
|
|
55
54
|
};
|
|
56
|
-
|
|
57
|
-
//#region src/encoding.ts
|
|
55
|
+
// src/encoding.ts
|
|
58
56
|
/** The content codings `serve` sends, the more compact first. */
|
|
59
57
|
const ENCODINGS = ["br", "gzip"];
|
|
60
58
|
/** Where the build leaves each coding's copy of a file: beside it. */
|
|
@@ -85,8 +83,7 @@ const streamingCompressor = (encoding) => encoding === "br" ? createBrotliCompre
|
|
|
85
83
|
flush: constants.BROTLI_OPERATION_FLUSH,
|
|
86
84
|
params: { [constants.BROTLI_PARAM_QUALITY]: 4 }
|
|
87
85
|
}) : createGzip({ flush: constants.Z_SYNC_FLUSH });
|
|
88
|
-
|
|
89
|
-
//#region src/rewrites.ts
|
|
86
|
+
// src/rewrites.ts
|
|
90
87
|
const BUILT_COMMENT = "# @k8ordo/framework: built URLs the rules below would also catch";
|
|
91
88
|
const SHELL_COMMENT = "# @k8ordo/framework: values the build did not write, answered by their fallback.tsx's shell";
|
|
92
89
|
/** What Cloudflare reads as a placeholder: `:` and a letter, anywhere. */
|
|
@@ -332,8 +329,7 @@ const rewriteFor = (rules, pathname) => {
|
|
|
332
329
|
}
|
|
333
330
|
return null;
|
|
334
331
|
};
|
|
335
|
-
|
|
336
|
-
//#region src/static-file.ts
|
|
332
|
+
// src/static-file.ts
|
|
337
333
|
/**
|
|
338
334
|
* Where a request pathname is allowed to land inside the build output.
|
|
339
335
|
* Traversal is not a case to weigh at request time: a URL may only ever name
|
|
@@ -346,8 +342,7 @@ const safeJoin = (root, pathname) => {
|
|
|
346
342
|
if (resolved !== root && !resolved.startsWith(root + path.sep)) return null;
|
|
347
343
|
return resolved;
|
|
348
344
|
};
|
|
349
|
-
|
|
350
|
-
//#region src/static-host.ts
|
|
345
|
+
// src/static-host.ts
|
|
351
346
|
const isFile = async (candidate) => {
|
|
352
347
|
try {
|
|
353
348
|
return (await stat(candidate)).isFile();
|
|
@@ -403,5 +398,4 @@ const readRules = async (client) => {
|
|
|
403
398
|
}
|
|
404
399
|
return parseRedirects(text);
|
|
405
400
|
};
|
|
406
|
-
//#endregion
|
|
407
401
|
export { pagePathFor as _, cloudflareCounts as a, NOT_FOUND_SEGMENT as b, rewriteFor as c, ENCODINGS as d, SUFFIX as f, isPayloadPath as g, streamingCompressor as h, builtRules as i, rulesOf as l, negotiateEncoding as m, resolveStatic as n, cloudflareMatches as o, isCompressible as p, safeJoin as r, formatRedirects as s, readRules as t, shellRules as u, payloadPathFor as v, decodePathname as x, FALLBACK_SEGMENT as y };
|
package/dist/vercel.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import "./static-
|
|
1
|
+
import "./static-6z8_6B1U.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
|
-
//#region src/vercel-output.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* A route as Vercel's Build Output API (v3) reads it, written to
|
|
6
5
|
* `.vercel/output/config.json` as given — the fields an application needs.
|
|
@@ -40,8 +39,6 @@ type VercelOptions = {
|
|
|
40
39
|
*/
|
|
41
40
|
readonly beforeNotFound?: readonly VercelRoute[];
|
|
42
41
|
};
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/vercel.d.ts
|
|
45
42
|
/**
|
|
46
43
|
* Deploys the application to Vercel: after `vite build`, the build is also
|
|
47
44
|
* written as `.vercel/output/` in the Build Output API's shape, which
|
|
@@ -57,5 +54,4 @@ type VercelOptions = {
|
|
|
57
54
|
* served with the `Content-Type` its `GET` answered.
|
|
58
55
|
*/
|
|
59
56
|
export declare const vercel: (options?: VercelOptions) => Plugin;
|
|
60
|
-
//#endregion
|
|
61
57
|
export type { VercelOptions, VercelRoute };
|
package/dist/vercel.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as sharedDir } from "./shared-dir-
|
|
1
|
+
import { t as sharedDir } from "./shared-dir-CNXFRZgP.mjs";
|
|
2
2
|
import { withBase } from "@k8ordo/router";
|
|
3
3
|
import { cp, rm, stat, writeFile } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
|
|
5
|
+
// src/vercel-output.ts
|
|
6
6
|
/** The function every request that names no file is rewritten to. */
|
|
7
7
|
const FUNCTION = "handler";
|
|
8
8
|
/**
|
|
@@ -158,8 +158,7 @@ const writeStaticVercelOutput = async (output, routes = {}) => {
|
|
|
158
158
|
});
|
|
159
159
|
await writeFile(path.join(dir, "config.json"), json(staticConfigFor(output, routes)));
|
|
160
160
|
};
|
|
161
|
-
|
|
162
|
-
//#region src/vercel.ts
|
|
161
|
+
// src/vercel.ts
|
|
163
162
|
/**
|
|
164
163
|
* Deploys the application to Vercel: after `vite build`, the build is also
|
|
165
164
|
* written as `.vercel/output/` in the Build Output API's shape, which
|
|
@@ -210,5 +209,4 @@ const vercel = (options = {}) => {
|
|
|
210
209
|
}
|
|
211
210
|
};
|
|
212
211
|
};
|
|
213
|
-
//#endregion
|
|
214
212
|
export { vercel };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as ContentSecurityPolicy, r as EngineOptions, t as StaticOptions } from "./static-
|
|
1
|
+
import { n as ContentSecurityPolicy, r as EngineOptions, t as StaticOptions } from "./static-6z8_6B1U.mjs";
|
|
2
2
|
import { PluginOption } from "vite";
|
|
3
|
-
//#region src/vite.d.ts
|
|
4
3
|
export type ServerOptions = EngineOptions & {
|
|
5
4
|
/**
|
|
6
5
|
* Every route rendered per request: a page may read the request, and
|
|
@@ -16,5 +15,4 @@ export type FrameworkOptions = StaticOptions | ServerOptions;
|
|
|
16
15
|
* every route, written to files (`'static'`), or per request (`'server'`).
|
|
17
16
|
*/
|
|
18
17
|
export declare const framework: (options: FrameworkOptions) => PluginOption[];
|
|
19
|
-
//#endregion
|
|
20
18
|
export type { ContentSecurityPolicy, StaticOptions };
|