@rsc-kit/core 0.1.0
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 +95 -0
- package/SECURITY.md +60 -0
- package/dist/action.d.ts +90 -0
- package/dist/action.d.ts.map +1 -0
- package/dist/action.js +137 -0
- package/dist/action.js.map +1 -0
- package/dist/build-rsc-vite.d.ts +39 -0
- package/dist/build-rsc-vite.d.ts.map +1 -0
- package/dist/build-rsc-vite.js +172 -0
- package/dist/build-rsc-vite.js.map +1 -0
- package/dist/cache.d.ts +25 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +108 -0
- package/dist/cache.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +85 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile.d.ts +55 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +141 -0
- package/dist/compile.js.map +1 -0
- package/dist/devServer.d.ts +18 -0
- package/dist/devServer.d.ts.map +1 -0
- package/dist/devServer.js +70 -0
- package/dist/devServer.js.map +1 -0
- package/dist/devUrls.d.ts +11 -0
- package/dist/devUrls.d.ts.map +1 -0
- package/dist/devUrls.js +68 -0
- package/dist/devUrls.js.map +1 -0
- package/dist/embed.d.ts +21 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.js +119 -0
- package/dist/embed.js.map +1 -0
- package/dist/errors.d.ts +24 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +38 -0
- package/dist/errors.js.map +1 -0
- package/dist/export.d.ts +41 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +100 -0
- package/dist/export.js.map +1 -0
- package/dist/files.d.ts +39 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +146 -0
- package/dist/files.js.map +1 -0
- package/dist/headers.d.ts +81 -0
- package/dist/headers.d.ts.map +1 -0
- package/dist/headers.js +96 -0
- package/dist/headers.js.map +1 -0
- package/dist/host.d.ts +86 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +590 -0
- package/dist/host.js.map +1 -0
- package/dist/js/ActivityRouter.d.ts +47 -0
- package/dist/js/ActivityRouter.d.ts.map +1 -0
- package/dist/js/ActivityRouter.js +87 -0
- package/dist/js/ActivityRouter.js.map +1 -0
- package/dist/js/DocumentTitle.d.ts +22 -0
- package/dist/js/DocumentTitle.d.ts.map +1 -0
- package/dist/js/DocumentTitle.js +28 -0
- package/dist/js/DocumentTitle.js.map +1 -0
- package/dist/js/Form.d.ts +54 -0
- package/dist/js/Form.d.ts.map +1 -0
- package/dist/js/Form.js +225 -0
- package/dist/js/Form.js.map +1 -0
- package/dist/js/Link.d.ts +29 -0
- package/dist/js/Link.d.ts.map +1 -0
- package/dist/js/Link.js +112 -0
- package/dist/js/Link.js.map +1 -0
- package/dist/js/PathnameProvider.d.ts +8 -0
- package/dist/js/PathnameProvider.d.ts.map +1 -0
- package/dist/js/PathnameProvider.js +24 -0
- package/dist/js/PathnameProvider.js.map +1 -0
- package/dist/js/RedirectBoundary.d.ts +18 -0
- package/dist/js/RedirectBoundary.d.ts.map +1 -0
- package/dist/js/RedirectBoundary.js +34 -0
- package/dist/js/RedirectBoundary.js.map +1 -0
- package/dist/js/SegmentBoundary.d.ts +8 -0
- package/dist/js/SegmentBoundary.d.ts.map +1 -0
- package/dist/js/SegmentBoundary.js +38 -0
- package/dist/js/SegmentBoundary.js.map +1 -0
- package/dist/js/SlotBoundary.d.ts +15 -0
- package/dist/js/SlotBoundary.d.ts.map +1 -0
- package/dist/js/SlotBoundary.js +17 -0
- package/dist/js/SlotBoundary.js.map +1 -0
- package/dist/js/createViteRscApp.d.ts +8 -0
- package/dist/js/createViteRscApp.d.ts.map +1 -0
- package/dist/js/createViteRscApp.js +185 -0
- package/dist/js/createViteRscApp.js.map +1 -0
- package/dist/js/errors.d.ts +51 -0
- package/dist/js/errors.d.ts.map +1 -0
- package/dist/js/errors.js +93 -0
- package/dist/js/errors.js.map +1 -0
- package/dist/js/navigate.d.ts +118 -0
- package/dist/js/navigate.d.ts.map +1 -0
- package/dist/js/navigate.js +780 -0
- package/dist/js/navigate.js.map +1 -0
- package/dist/js/onlineStore.d.ts +23 -0
- package/dist/js/onlineStore.d.ts.map +1 -0
- package/dist/js/onlineStore.js +42 -0
- package/dist/js/onlineStore.js.map +1 -0
- package/dist/js/pagePayload.d.ts +15 -0
- package/dist/js/pagePayload.d.ts.map +1 -0
- package/dist/js/pagePayload.js +39 -0
- package/dist/js/pagePayload.js.map +1 -0
- package/dist/js/router.d.ts +29 -0
- package/dist/js/router.d.ts.map +1 -0
- package/dist/js/router.js +40 -0
- package/dist/js/router.js.map +1 -0
- package/dist/js/section.d.ts +16 -0
- package/dist/js/section.d.ts.map +1 -0
- package/dist/js/section.js +55 -0
- package/dist/js/section.js.map +1 -0
- package/dist/js/segmentStore.d.ts +69 -0
- package/dist/js/segmentStore.d.ts.map +1 -0
- package/dist/js/segmentStore.js +127 -0
- package/dist/js/segmentStore.js.map +1 -0
- package/dist/js/slotStore.d.ts +35 -0
- package/dist/js/slotStore.d.ts.map +1 -0
- package/dist/js/slotStore.js +46 -0
- package/dist/js/slotStore.js.map +1 -0
- package/dist/js/standardSchema.d.ts +47 -0
- package/dist/js/standardSchema.d.ts.map +1 -0
- package/dist/js/standardSchema.js +41 -0
- package/dist/js/standardSchema.js.map +1 -0
- package/dist/js/useForm.d.ts +43 -0
- package/dist/js/useForm.d.ts.map +1 -0
- package/dist/js/useForm.js +164 -0
- package/dist/js/useForm.js.map +1 -0
- package/dist/js/useLinkStatus.d.ts +2 -0
- package/dist/js/useLinkStatus.d.ts.map +1 -0
- package/dist/js/useLinkStatus.js +3 -0
- package/dist/js/useLinkStatus.js.map +1 -0
- package/dist/js/useOnline.d.ts +8 -0
- package/dist/js/useOnline.d.ts.map +1 -0
- package/dist/js/useOnline.js +20 -0
- package/dist/js/useOnline.js.map +1 -0
- package/dist/js/usePathname.d.ts +9 -0
- package/dist/js/usePathname.d.ts.map +1 -0
- package/dist/js/usePathname.js +32 -0
- package/dist/js/usePathname.js.map +1 -0
- package/dist/js/useSearchParams.d.ts +2 -0
- package/dist/js/useSearchParams.d.ts.map +1 -0
- package/dist/js/useSearchParams.js +60 -0
- package/dist/js/useSearchParams.js.map +1 -0
- package/dist/manifest.d.ts +66 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +13 -0
- package/dist/manifest.js.map +1 -0
- package/dist/prerender.d.ts +138 -0
- package/dist/prerender.d.ts.map +1 -0
- package/dist/prerender.js +387 -0
- package/dist/prerender.js.map +1 -0
- package/dist/redirect.d.ts +34 -0
- package/dist/redirect.d.ts.map +1 -0
- package/dist/redirect.js +108 -0
- package/dist/redirect.js.map +1 -0
- package/dist/redirectDigest.d.ts +20 -0
- package/dist/redirectDigest.d.ts.map +1 -0
- package/dist/redirectDigest.js +66 -0
- package/dist/redirectDigest.js.map +1 -0
- package/dist/request.d.ts +93 -0
- package/dist/request.d.ts.map +1 -0
- package/dist/request.js +308 -0
- package/dist/request.js.map +1 -0
- package/dist/revalidate.d.ts +43 -0
- package/dist/revalidate.d.ts.map +1 -0
- package/dist/revalidate.js +99 -0
- package/dist/revalidate.js.map +1 -0
- package/dist/routes.d.ts +37 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +28 -0
- package/dist/routes.js.map +1 -0
- package/dist/routing.d.ts +52 -0
- package/dist/routing.d.ts.map +1 -0
- package/dist/routing.js +146 -0
- package/dist/routing.js.map +1 -0
- package/dist/runtime.d.ts +36 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +86 -0
- package/dist/runtime.js.map +1 -0
- package/dist/safeUrl.d.ts +10 -0
- package/dist/safeUrl.d.ts.map +1 -0
- package/dist/safeUrl.js +40 -0
- package/dist/safeUrl.js.map +1 -0
- package/dist/streaming.d.ts +62 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/streaming.js +108 -0
- package/dist/streaming.js.map +1 -0
- package/dist/types.d.ts +82 -0
- package/dist/vite.d.ts +109 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +1909 -0
- package/dist/vite.js.map +1 -0
- package/dist/worker.d.ts +2 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +863 -0
- package/dist/worker.js.map +1 -0
- package/package.json +223 -0
package/dist/embed.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Putting the build output inside the binary.
|
|
2
|
+
//
|
|
3
|
+
// `bun build --compile` bundles the JavaScript it can see and nothing else, so
|
|
4
|
+
// a compiled server renders pages and then 404s every stylesheet and every
|
|
5
|
+
// client chunk — the page arrives, unstyled, and never hydrates. Nothing warns:
|
|
6
|
+
// the server starts, the routes answer, and only the browser knows.
|
|
7
|
+
//
|
|
8
|
+
// Bun embeds a file when something imports it with `{ type: 'file' }`, so this
|
|
9
|
+
// writes a module that imports each one and hands back the readers the host
|
|
10
|
+
// already takes:
|
|
11
|
+
//
|
|
12
|
+
// bun run embed # after vite build && prerender
|
|
13
|
+
// bun build --compile server.ts --outfile app
|
|
14
|
+
//
|
|
15
|
+
// The generated module is the only thing that has to exist at compile time.
|
|
16
|
+
// After that the binary carries the assets, the prerendered pages and the
|
|
17
|
+
// engine, and runs anywhere with nothing beside it.
|
|
18
|
+
import { existsSync, mkdirSync, readdirSync, statSync, writeFileSync } from 'node:fs';
|
|
19
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
20
|
+
/** Every file under a directory, as paths relative to it. */
|
|
21
|
+
function walk(dir, base = dir) {
|
|
22
|
+
if (!existsSync(dir))
|
|
23
|
+
return [];
|
|
24
|
+
const found = [];
|
|
25
|
+
for (const entry of readdirSync(dir)) {
|
|
26
|
+
const abs = join(dir, entry);
|
|
27
|
+
if (statSync(abs).isDirectory()) {
|
|
28
|
+
found.push(...walk(abs, base));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
found.push(relative(base, abs).replace(/\\/g, '/'));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return found;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Write the module that embeds the build.
|
|
38
|
+
*
|
|
39
|
+
* Returns what it found, so a build script can say so rather than producing a
|
|
40
|
+
* binary that is quietly missing half of itself.
|
|
41
|
+
*/
|
|
42
|
+
export function writeEmbedModule(options) {
|
|
43
|
+
const prefix = options.prefix ?? '/assets/';
|
|
44
|
+
const assetsDir = options.assets ? resolve(options.assets) : null;
|
|
45
|
+
const prerenderedDir = options.prerendered ? resolve(options.prerendered) : null;
|
|
46
|
+
const assetFiles = assetsDir ? walk(assetsDir) : [];
|
|
47
|
+
const pageFiles = prerenderedDir ? walk(prerenderedDir) : [];
|
|
48
|
+
const imports = [];
|
|
49
|
+
const assetEntries = [];
|
|
50
|
+
const pageEntries = [];
|
|
51
|
+
const outDir = dirname(resolve(options.out));
|
|
52
|
+
// Relative to the generated module. An absolute path is only true on the
|
|
53
|
+
// machine that wrote it, and a build that moves — a container, CI — would
|
|
54
|
+
// compile a binary whose every asset points at somewhere that does not exist.
|
|
55
|
+
const from = (abs) => {
|
|
56
|
+
const rel = relative(outDir, abs).replace(/\\/g, '/');
|
|
57
|
+
return rel.startsWith('.') ? rel : './' + rel;
|
|
58
|
+
};
|
|
59
|
+
// Sorted, so the same input produces the same module and the same binary.
|
|
60
|
+
assetFiles.sort().forEach((name, i) => {
|
|
61
|
+
imports.push(`import a${i} from ${JSON.stringify(from(join(assetsDir, name)))} with { type: 'file' }`);
|
|
62
|
+
assetEntries.push(` ${JSON.stringify(prefix + name)}: a${i},`);
|
|
63
|
+
});
|
|
64
|
+
pageFiles.sort().forEach((name, i) => {
|
|
65
|
+
imports.push(`import p${i} from ${JSON.stringify(from(join(prerenderedDir, name)))} with { type: 'file' }`);
|
|
66
|
+
pageEntries.push(` ${JSON.stringify(name)}: p${i},`);
|
|
67
|
+
});
|
|
68
|
+
const source = `// GENERATED — do not edit. Written by writeEmbedModule().
|
|
69
|
+
//
|
|
70
|
+
// Each import is what makes the file part of the binary. A path read at
|
|
71
|
+
// runtime would not be: bun build --compile follows imports, not strings.
|
|
72
|
+
${imports.join('\n')}
|
|
73
|
+
|
|
74
|
+
export const assetPaths: Record<string, string> = {
|
|
75
|
+
${assetEntries.join('\n')}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const pagePaths: Record<string, string> = {
|
|
79
|
+
${pageEntries.join('\n')}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const TYPES: Record<string, string> = {
|
|
83
|
+
js: 'text/javascript; charset=utf-8',
|
|
84
|
+
css: 'text/css; charset=utf-8',
|
|
85
|
+
map: 'application/json; charset=utf-8',
|
|
86
|
+
svg: 'image/svg+xml',
|
|
87
|
+
woff2: 'font/woff2',
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The \`assets\` reader, served from inside the binary. */
|
|
91
|
+
export async function assets(pathname: string): Promise<Response | null> {
|
|
92
|
+
const path = assetPaths[pathname]
|
|
93
|
+
|
|
94
|
+
if (!path) return null
|
|
95
|
+
|
|
96
|
+
// .stream() rather than the file itself: a Response implementation that does
|
|
97
|
+
// not know what a BunFile is turns the body into the string "[object Blob]",
|
|
98
|
+
// which serves a stylesheet that parses as nothing and reports 200.
|
|
99
|
+
return new Response(Bun.file(path).stream(), {
|
|
100
|
+
headers: {
|
|
101
|
+
'Content-Type': TYPES[pathname.split('.').pop() ?? ''] ?? 'application/octet-stream',
|
|
102
|
+
// Content-hashed by the build, so this is safe.
|
|
103
|
+
'Cache-Control': 'public, max-age=31536000, immutable',
|
|
104
|
+
},
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The \`prerendered\` reader, served from inside the binary. */
|
|
109
|
+
export async function prerendered(name: string): Promise<string | null> {
|
|
110
|
+
const path = pagePaths[name]
|
|
111
|
+
|
|
112
|
+
return path ? await Bun.file(path).text() : null
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
mkdirSync(dirname(resolve(options.out)), { recursive: true });
|
|
116
|
+
writeFileSync(resolve(options.out), source);
|
|
117
|
+
return { assets: assetFiles.length, prerendered: pageFiles.length };
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=embed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.js","sourceRoot":"","sources":["../src/embed.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,gFAAgF;AAChF,oEAAoE;AACpE,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,iBAAiB;AACjB,EAAE;AACF,2DAA2D;AAC3D,kDAAkD;AAClD,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,oDAAoD;AAEpD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAa5D,6DAA6D;AAC7D,SAAS,IAAI,CAAC,GAAW,EAAE,IAAI,GAAG,GAAG;IACnC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAA;IAE/B,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QAE5B,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YAChC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;QAChC,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,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,SAAS,CAAC,MAAM,EAAE,CAAA;AACrE,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The worker's own error types.
|
|
3
|
+
*
|
|
4
|
+
* A separate set from `src/js/errors.ts` on purpose: these are thrown inside
|
|
5
|
+
* the worker and turned into HTTP statuses, so they never reach the browser as
|
|
6
|
+
* objects — the client reconstructs its own from the response. The public
|
|
7
|
+
* `@rsc-kit/core/errors` specifier is the client's module, because that is
|
|
8
|
+
* the one an `instanceof` in a component has to match.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ServerValidationError extends Error {
|
|
11
|
+
readonly errors: Record<string, string[]>;
|
|
12
|
+
constructor(message: string, errors: Record<string, string[]>);
|
|
13
|
+
}
|
|
14
|
+
export declare class ServerAuthenticationError extends Error {
|
|
15
|
+
constructor(message?: string);
|
|
16
|
+
}
|
|
17
|
+
export declare class ServerAuthorizationError extends Error {
|
|
18
|
+
constructor(message?: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class ServerRedirectError extends Error {
|
|
21
|
+
readonly location: string;
|
|
22
|
+
constructor(location: string);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,SAAgB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAEjD,YAAY,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAI5D;CACF;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAO,GAAE,MAA2B,EAG/C;CACF;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAO,GAAE,MAAuC,EAG3D;CACF;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC,YAAY,QAAQ,EAAE,MAAM,EAI3B;CACF"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The worker's own error types.
|
|
3
|
+
*
|
|
4
|
+
* A separate set from `src/js/errors.ts` on purpose: these are thrown inside
|
|
5
|
+
* the worker and turned into HTTP statuses, so they never reach the browser as
|
|
6
|
+
* objects — the client reconstructs its own from the response. The public
|
|
7
|
+
* `@rsc-kit/core/errors` specifier is the client's module, because that is
|
|
8
|
+
* the one an `instanceof` in a component has to match.
|
|
9
|
+
*/
|
|
10
|
+
export class ServerValidationError extends Error {
|
|
11
|
+
errors;
|
|
12
|
+
constructor(message, errors) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "ServerValidationError";
|
|
15
|
+
this.errors = errors;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class ServerAuthenticationError extends Error {
|
|
19
|
+
constructor(message = "Unauthenticated.") {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = "ServerAuthenticationError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class ServerAuthorizationError extends Error {
|
|
25
|
+
constructor(message = "This action is unauthorized.") {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = "ServerAuthorizationError";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class ServerRedirectError extends Error {
|
|
31
|
+
location;
|
|
32
|
+
constructor(location) {
|
|
33
|
+
super(`Redirect to ${location}`);
|
|
34
|
+
this.name = "ServerRedirectError";
|
|
35
|
+
this.location = location;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9B,MAAM,CAA2B;IAEjD,YAAY,OAAe,EAAE,MAAgC;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAO,GAAW,kBAAkB;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAO,GAAW,8BAA8B;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5B,QAAQ,CAAS;IAEjC,YAAY,QAAgB;QAC1B,KAAK,CAAC,eAAe,QAAQ,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/export.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PrerenderResult } from './prerender.js';
|
|
2
|
+
import type { RouteManifest } from './manifest.js';
|
|
3
|
+
export interface ExportOptions {
|
|
4
|
+
/** What prerender() decided, so this can refuse what it cannot serve. */
|
|
5
|
+
results: PrerenderResult[];
|
|
6
|
+
/** Reads what prerender() wrote. `prerenderedFrom` in `@rsc-kit/core/files`. */
|
|
7
|
+
read: (name: string) => Promise<string | null> | string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Writes the site, keyed by its url path — `docs/index.html`, not an
|
|
10
|
+
* absolute one. `writeTo` in `@rsc-kit/core/files` puts those under a
|
|
11
|
+
* directory; a deploy that uploads straight to a bucket writes keys.
|
|
12
|
+
*/
|
|
13
|
+
write: (path: string, contents: string) => Promise<void> | void;
|
|
14
|
+
/** The route table, for what the build decided about payload urls. */
|
|
15
|
+
manifest: RouteManifest;
|
|
16
|
+
/**
|
|
17
|
+
* Brings the browser bundle along, if this export has to carry it.
|
|
18
|
+
*
|
|
19
|
+
* A callback rather than a directory pair: copying a tree of built files is
|
|
20
|
+
* a filesystem operation by nature, and a deploy that uploads them has its
|
|
21
|
+
* own tooling for it. `copyAssets` in `@rsc-kit/core/files` does the local one.
|
|
22
|
+
*/
|
|
23
|
+
assets?: () => Promise<void> | void;
|
|
24
|
+
/**
|
|
25
|
+
* Export anyway, leaving out whatever is not static.
|
|
26
|
+
*
|
|
27
|
+
* The result is a site with holes in it, which is sometimes what you want
|
|
28
|
+
* while moving an app towards being exportable. It is never the default,
|
|
29
|
+
* because the holes are 404s at urls that worked before.
|
|
30
|
+
*/
|
|
31
|
+
force?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare class NotExportable extends Error {
|
|
34
|
+
readonly refused: PrerenderResult[];
|
|
35
|
+
constructor(refused: PrerenderResult[]);
|
|
36
|
+
}
|
|
37
|
+
export declare function exportSite(options: ExportOptions): Promise<{
|
|
38
|
+
pages: number;
|
|
39
|
+
refused: PrerenderResult[];
|
|
40
|
+
}>;
|
|
41
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,gFAAgF;IAChF,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAA;IAC9D;;;;OAIG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC/D,sEAAsE;IACtE,QAAQ,EAAE,aAAa,CAAA;IACvB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACnC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,qBAAa,aAAc,SAAQ,KAAK;aACV,OAAO,EAAE,eAAe,EAAE;IAAtD,YAA4B,OAAO,EAAE,eAAe,EAAE,EAQrD;CACF;AAYD,wBAAsB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC,CAiF/G"}
|
package/dist/export.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Writing the whole site out as files, for a host that only serves files.
|
|
2
|
+
//
|
|
3
|
+
// Everything a server was doing has to have happened already, which makes the
|
|
4
|
+
// refusals the important part. A site exported with a route missing, or with a
|
|
5
|
+
// shell nothing will ever fill, does not fail at build time and does not fail
|
|
6
|
+
// on load — it serves a page that sits there, or a 404 for a url that worked
|
|
7
|
+
// yesterday. So anything that is not fully static stops the export and says
|
|
8
|
+
// which routes and why.
|
|
9
|
+
//
|
|
10
|
+
// Layout is a directory per route with an index inside it, so urls stay
|
|
11
|
+
// extensionless, and the Flight payload sits beside it under a filename the
|
|
12
|
+
// client was built to ask for.
|
|
13
|
+
//
|
|
14
|
+
// out/index.html /
|
|
15
|
+
// out/index.rsc
|
|
16
|
+
// out/docs/index.html /docs
|
|
17
|
+
// out/docs/index.rsc
|
|
18
|
+
// out/assets/… the browser bundle
|
|
19
|
+
import { pathKey } from './prerender.js';
|
|
20
|
+
export class NotExportable extends Error {
|
|
21
|
+
refused;
|
|
22
|
+
constructor(refused) {
|
|
23
|
+
super('This site cannot be exported as it is. A static host runs nothing, so these routes have ' +
|
|
24
|
+
'no way to finish rendering:\n\n' +
|
|
25
|
+
refused.map((r) => ` ${r.url} — ${r.reason ?? describe(r.type)}`).join('\n') +
|
|
26
|
+
'\n\nMake them static, or pass force to export the rest and leave these out.');
|
|
27
|
+
this.refused = refused;
|
|
28
|
+
this.name = 'NotExportable';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function describe(type) {
|
|
32
|
+
if (type === 'shell') {
|
|
33
|
+
// Worth spelling out: a shell looks like a working page in the build
|
|
34
|
+
// output, and on a static host it is a page that loads and stays empty.
|
|
35
|
+
return 'only a shell was stored, and nothing on a static host will fill it';
|
|
36
|
+
}
|
|
37
|
+
return 'failed to render';
|
|
38
|
+
}
|
|
39
|
+
export async function exportSite(options) {
|
|
40
|
+
const { results, read, write, manifest, assets, force = false } = options;
|
|
41
|
+
// A guarded route is frozen on purpose — the content is the same for
|
|
42
|
+
// everyone allowed to see it — but the guard runs when the page is served,
|
|
43
|
+
// and a static host serves without running anything. Exporting one publishes
|
|
44
|
+
// the page to whoever asks, which is the opposite of what the guard said.
|
|
45
|
+
const guarded = new Set(manifest.routes
|
|
46
|
+
.filter((route) => route.middleware?.length)
|
|
47
|
+
.map((route) => route.component));
|
|
48
|
+
const refused = results
|
|
49
|
+
.filter((r) => r.type !== 'frozen' || guarded.has(r.component))
|
|
50
|
+
.map((r) => r.type === 'frozen' && guarded.has(r.component)
|
|
51
|
+
? { ...r, reason: 'guarded, and a static host has nothing to run the guard' }
|
|
52
|
+
: r);
|
|
53
|
+
if (refused.length > 0 && !force)
|
|
54
|
+
throw new NotExportable(refused);
|
|
55
|
+
// The client has to ask for payloads by url, because a static host cannot
|
|
56
|
+
// read the header that would otherwise select one. That is decided by the
|
|
57
|
+
// build, so a site exported from a server build ships a client asking the
|
|
58
|
+
// wrong way — every navigation silently falls back to a full page load.
|
|
59
|
+
const payloadName = manifest.build?.payloadName;
|
|
60
|
+
if (!payloadName) {
|
|
61
|
+
throw new Error('This build was made for a server, so its client asks for payloads with a header rather ' +
|
|
62
|
+
"than by url. Build with output: 'export' before exporting.");
|
|
63
|
+
}
|
|
64
|
+
const copy = async (name, into) => {
|
|
65
|
+
const contents = await read(name);
|
|
66
|
+
// Missing where the results said it would be: the prerender output and the
|
|
67
|
+
// results it returned disagree, which is not something to paper over with
|
|
68
|
+
// a half-written site.
|
|
69
|
+
if (contents === null) {
|
|
70
|
+
throw new Error(`Nothing to export at ${name}. Prerender and export must read the same output.`);
|
|
71
|
+
}
|
|
72
|
+
await write(into, contents);
|
|
73
|
+
};
|
|
74
|
+
let pages = 0;
|
|
75
|
+
for (const result of results) {
|
|
76
|
+
if (result.type !== 'frozen')
|
|
77
|
+
continue;
|
|
78
|
+
const key = pathKey(result.url);
|
|
79
|
+
// The root is the out dir itself; everything else is a directory with an
|
|
80
|
+
// index, so /docs stays /docs rather than becoming /docs.html.
|
|
81
|
+
const dir = key === 'index' ? '' : `${key}/`;
|
|
82
|
+
await copy(`${key}.html`, `${dir}index.html`);
|
|
83
|
+
await copy(`${key}.flight`, `${dir}${payloadName}`);
|
|
84
|
+
// One file per depth a client might already hold, addressed by name
|
|
85
|
+
// because a file server cannot vary on a header. Without these every
|
|
86
|
+
// navigation is a whole document, which replaces the root and unmounts
|
|
87
|
+
// the pages retained behind it — so going back does not restore the form
|
|
88
|
+
// you were filling in.
|
|
89
|
+
for (let depth = 1;; depth++) {
|
|
90
|
+
const variant = await read(`${key}.seg${depth}.flight`);
|
|
91
|
+
if (variant === null)
|
|
92
|
+
break;
|
|
93
|
+
await write(`${dir}${payloadName.replace(/^index\./, `index.seg${depth}.`)}`, variant);
|
|
94
|
+
}
|
|
95
|
+
pages++;
|
|
96
|
+
}
|
|
97
|
+
await assets?.();
|
|
98
|
+
return { pages, refused };
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,wBAAwB;AACxB,EAAE;AACF,wEAAwE;AACxE,4EAA4E;AAC5E,+BAA+B;AAC/B,EAAE;AACF,gCAAgC;AAChC,kBAAkB;AAClB,oCAAoC;AACpC,uBAAuB;AACvB,iDAAiD;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAmCxC,MAAM,OAAO,aAAc,SAAQ,KAAK;IACV,OAAO;IAAnC,YAA4B,OAA0B;QACpD,KAAK,CACH,0FAA0F;YACxF,iCAAiC;YACjC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAC7E,6EAA6E,CAChF,CAAA;uBANyB,OAAO;QAOjC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC7B,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,IAA6B;IAC7C,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,qEAAqE;QACrE,wEAAwE;QACxE,OAAO,oEAAoE,CAAA;IAC7E,CAAC;IAED,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAsB;IACrD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,OAA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AE,CAAA;AAC3B,CAAC"}
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serve built browser assets out of the build's public directory.
|
|
3
|
+
*
|
|
4
|
+
* `dir` is the browser's root, not the asset folder: a request for
|
|
5
|
+
* /assets/x.js reads <dir>/assets/x.js. Stripping the prefix instead reads
|
|
6
|
+
* <dir>/x.js, which is a 404 for every asset and a page that renders and then
|
|
7
|
+
* never hydrates — nothing logs, because the failed request is the browser's.
|
|
8
|
+
*
|
|
9
|
+
* In production these belong in front of the application, on whatever already
|
|
10
|
+
* serves static files. This exists so a development server and a single-file
|
|
11
|
+
* binary do not each write it.
|
|
12
|
+
*/
|
|
13
|
+
export declare function assetsFrom(dir: string, prefix?: string): (pathname: string) => Promise<Response | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Read what the prerenderer wrote, from a directory.
|
|
16
|
+
*
|
|
17
|
+
* Missing is an answer, not an error: a partial prerender is a valid state,
|
|
18
|
+
* and anything not found here is rendered on demand instead.
|
|
19
|
+
*/
|
|
20
|
+
export declare function prerenderedFrom(dir: string): (name: string) => Promise<string | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Write build output into a directory.
|
|
23
|
+
*
|
|
24
|
+
* The sink `prerender` and `exportSite` take. Names are relative and may
|
|
25
|
+
* contain directories — `docs/index.html` — so each one's parent is created
|
|
26
|
+
* as it goes.
|
|
27
|
+
*/
|
|
28
|
+
export declare function writeTo(dir: string): ((name: string, contents: string) => Promise<void>) & {
|
|
29
|
+
dir: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Copy the built browser bundle into an exported site.
|
|
33
|
+
*
|
|
34
|
+
* Separate from the export itself because copying a tree of files is a
|
|
35
|
+
* filesystem operation by nature — a deploy that uploads them to a bucket
|
|
36
|
+
* has its own way to do that, and passes its own callback instead.
|
|
37
|
+
*/
|
|
38
|
+
export declare function copyAssets(from: string, to: string, url?: string): () => Promise<void>;
|
|
39
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,SAAa,cACjC,MAAM,KAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAqB1D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UA2BrB,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWpD;AAYD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAY1G;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,SAAa,SAClD,OAAO,CAAC,IAAI,CAAC,CAU/B"}
|
package/dist/files.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// Reading built output off a disk.
|
|
2
|
+
//
|
|
3
|
+
// Kept apart from the host on purpose: it is the only part of serving an RSC
|
|
4
|
+
// app that assumes a filesystem, and plenty of places to run one do not have
|
|
5
|
+
// a filesystem. A Worker reads its assets from a binding, a Deno Deploy app
|
|
6
|
+
// from KV, a CDN from itself. Those hosts pass their own readers and never
|
|
7
|
+
// load this module — and because nothing in `@rsc-kit/core/host` imports it, a
|
|
8
|
+
// bundle for one of them contains no reference to `node:fs` at all.
|
|
9
|
+
//
|
|
10
|
+
// import { createRscHandler } from '@rsc-kit/core/host'
|
|
11
|
+
// import { assetsFrom, prerenderedFrom } from '@rsc-kit/core/files'
|
|
12
|
+
//
|
|
13
|
+
// createRscHandler({
|
|
14
|
+
// engine,
|
|
15
|
+
// assets: assetsFrom('./build/public'),
|
|
16
|
+
// prerendered: prerenderedFrom('./build/static'),
|
|
17
|
+
// })
|
|
18
|
+
import { cp, mkdir, readdir, readFile, writeFile } from 'node:fs/promises';
|
|
19
|
+
import { dirname, join } from 'node:path';
|
|
20
|
+
/**
|
|
21
|
+
* Serve built browser assets out of the build's public directory.
|
|
22
|
+
*
|
|
23
|
+
* `dir` is the browser's root, not the asset folder: a request for
|
|
24
|
+
* /assets/x.js reads <dir>/assets/x.js. Stripping the prefix instead reads
|
|
25
|
+
* <dir>/x.js, which is a 404 for every asset and a page that renders and then
|
|
26
|
+
* never hydrates — nothing logs, because the failed request is the browser's.
|
|
27
|
+
*
|
|
28
|
+
* In production these belong in front of the application, on whatever already
|
|
29
|
+
* serves static files. This exists so a development server and a single-file
|
|
30
|
+
* binary do not each write it.
|
|
31
|
+
*/
|
|
32
|
+
export function assetsFrom(dir, prefix = '/assets/') {
|
|
33
|
+
return async (pathname) => {
|
|
34
|
+
if (!pathname.startsWith(prefix))
|
|
35
|
+
return null;
|
|
36
|
+
// No traversal out of the asset directory, whatever the url claims.
|
|
37
|
+
if (pathname.includes('..'))
|
|
38
|
+
return null;
|
|
39
|
+
try {
|
|
40
|
+
const bytes = await readFile(join(dir, pathname));
|
|
41
|
+
return new Response(bytes, {
|
|
42
|
+
headers: {
|
|
43
|
+
'Content-Type': contentTypeOf(pathname),
|
|
44
|
+
// Content-hashed by the build, so this is safe and is the difference
|
|
45
|
+
// between a warm navigation and a cold one.
|
|
46
|
+
'Cache-Control': 'public, max-age=31536000, immutable',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Read what the prerenderer wrote, from a directory.
|
|
57
|
+
*
|
|
58
|
+
* Missing is an answer, not an error: a partial prerender is a valid state,
|
|
59
|
+
* and anything not found here is rendered on demand instead.
|
|
60
|
+
*/
|
|
61
|
+
export function prerenderedFrom(dir) {
|
|
62
|
+
/**
|
|
63
|
+
* What is on disk, listed once.
|
|
64
|
+
*
|
|
65
|
+
* A miss used to be a thrown ENOENT, and misses are the common case: the
|
|
66
|
+
* host asks for `{url}.html`, then `{url}.ppr.html`, then the route's
|
|
67
|
+
* pattern — so every request to a page served by a pattern shell threw and
|
|
68
|
+
* caught two exceptions before finding anything. Measured at 3,000 req/s
|
|
69
|
+
* against 28,000 for the same page read from memory.
|
|
70
|
+
*
|
|
71
|
+
* Only existence is cached, never contents: a file that is there is still
|
|
72
|
+
* read on every request, so a redeploy that rewrites one is picked up. What
|
|
73
|
+
* a running server will not notice is a page appearing that was not there at
|
|
74
|
+
* boot — which is a build artefact, and the build has finished.
|
|
75
|
+
*/
|
|
76
|
+
let present = null;
|
|
77
|
+
const listing = async () => {
|
|
78
|
+
present ??= readdir(dir, { recursive: true })
|
|
79
|
+
.then((names) => new Set(names.map((n) => String(n).replace(/\\/g, '/'))))
|
|
80
|
+
// An absent directory is an empty one: a partial prerender is a valid
|
|
81
|
+
// state, and everything falls through to being rendered.
|
|
82
|
+
.catch(() => new Set());
|
|
83
|
+
return await present;
|
|
84
|
+
};
|
|
85
|
+
return async (name) => {
|
|
86
|
+
if (name.includes('..'))
|
|
87
|
+
return null;
|
|
88
|
+
if (!(await listing()).has(name))
|
|
89
|
+
return null;
|
|
90
|
+
try {
|
|
91
|
+
return await readFile(join(dir, name), 'utf-8');
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function contentTypeOf(pathname) {
|
|
99
|
+
if (pathname.endsWith('.js'))
|
|
100
|
+
return 'text/javascript; charset=utf-8';
|
|
101
|
+
if (pathname.endsWith('.css'))
|
|
102
|
+
return 'text/css; charset=utf-8';
|
|
103
|
+
if (pathname.endsWith('.map'))
|
|
104
|
+
return 'application/json; charset=utf-8';
|
|
105
|
+
if (pathname.endsWith('.svg'))
|
|
106
|
+
return 'image/svg+xml';
|
|
107
|
+
if (pathname.endsWith('.woff2'))
|
|
108
|
+
return 'font/woff2';
|
|
109
|
+
return 'application/octet-stream';
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Write build output into a directory.
|
|
113
|
+
*
|
|
114
|
+
* The sink `prerender` and `exportSite` take. Names are relative and may
|
|
115
|
+
* contain directories — `docs/index.html` — so each one's parent is created
|
|
116
|
+
* as it goes.
|
|
117
|
+
*/
|
|
118
|
+
export function writeTo(dir) {
|
|
119
|
+
const write = async (name, contents) => {
|
|
120
|
+
const path = join(dir, name);
|
|
121
|
+
await mkdir(dirname(path), { recursive: true });
|
|
122
|
+
await writeFile(path, contents);
|
|
123
|
+
};
|
|
124
|
+
// Where it wrote, for a caller that has to read it back. The embeddable
|
|
125
|
+
// module has to list these files, and being told the directory a second time
|
|
126
|
+
// is a second place for it to be wrong.
|
|
127
|
+
return Object.assign(write, { dir });
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Copy the built browser bundle into an exported site.
|
|
131
|
+
*
|
|
132
|
+
* Separate from the export itself because copying a tree of files is a
|
|
133
|
+
* filesystem operation by nature — a deploy that uploads them to a bucket
|
|
134
|
+
* has its own way to do that, and passes its own callback instead.
|
|
135
|
+
*/
|
|
136
|
+
export function copyAssets(from, to, url = '/assets/') {
|
|
137
|
+
return async () => {
|
|
138
|
+
const at = url.replace(/^\/+|\/+$/g, '');
|
|
139
|
+
if (at === '')
|
|
140
|
+
return;
|
|
141
|
+
const target = join(to, at);
|
|
142
|
+
await mkdir(dirname(target), { recursive: true });
|
|
143
|
+
await cp(from, target, { recursive: true });
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot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load rather than the document. One
|
|
4
|
+
* url serves both, which is why every answer must Vary on it.
|
|
5
|
+
*/
|
|
6
|
+
readonly rsc: 'X-RSC';
|
|
7
|
+
/** The layout chain the client has mounted, outermost first, comma-separated. */
|
|
8
|
+
readonly segments: 'X-RSC-Segments';
|
|
9
|
+
/** The boundary the answer replaces. 0 means a whole document. */
|
|
10
|
+
readonly segmentDepth: 'X-RSC-Segment-Depth';
|
|
11
|
+
/** The chain to send back next time. */
|
|
12
|
+
readonly layouts: 'X-RSC-Layouts';
|
|
13
|
+
/** Identifies the build, so a client can notice it is talking to an old one. */
|
|
14
|
+
readonly version: 'X-RSC-Version';
|
|
15
|
+
/** The slot an intercepted navigation is targeting. */
|
|
16
|
+
readonly intercept: 'X-RSC-Intercept';
|
|
17
|
+
/** Where the navigation or action came from. */
|
|
18
|
+
readonly referer: 'X-RSC-Referer';
|
|
19
|
+
/** One named region of the current page to render and return alone. */
|
|
20
|
+
readonly revalidate: 'X-RSC-Revalidate';
|
|
21
|
+
/** The server reference being invoked. */
|
|
22
|
+
readonly action: 'X-RSC-Action';
|
|
23
|
+
/**
|
|
24
|
+
* Go here instead.
|
|
25
|
+
*
|
|
26
|
+
* Used for a redirect the client has to perform itself: a failed action, and
|
|
27
|
+
* a navigation whose render redirected. Never a 3xx for those — `fetch`
|
|
28
|
+
* follows one transparently, so the client would get the destination's HTML
|
|
29
|
+
* where it expected a Flight payload and decode it as one.
|
|
30
|
+
*/
|
|
31
|
+
readonly redirect: 'X-RSC-Redirect';
|
|
32
|
+
/**
|
|
33
|
+
* The body's real type.
|
|
34
|
+
*
|
|
35
|
+
* The body itself goes out as application/octet-stream so a host that parses
|
|
36
|
+
* multipart cannot consume it before the action does — reading Content-Type
|
|
37
|
+
* instead leaves an upload undecodable.
|
|
38
|
+
*/
|
|
39
|
+
readonly contentType: 'X-RSC-Content-Type';
|
|
40
|
+
/**
|
|
41
|
+
* Where the browser posts server actions.
|
|
42
|
+
*
|
|
43
|
+
* Not a convention this can choose: the client runtime posts here
|
|
44
|
+
* unconditionally.
|
|
45
|
+
*/
|
|
46
|
+
readonly actionPath: '/_rsc/action';
|
|
47
|
+
};
|
|
48
|
+
/** Flight payload. */
|
|
49
|
+
export declare const FLIGHT_TYPE = "text/x-component; charset=utf-8";
|
|
50
|
+
/** A rendered document. */
|
|
51
|
+
export declare const HTML_TYPE = "text/html; charset=utf-8";
|
|
52
|
+
/**
|
|
53
|
+
* Every request header that changes what a response body contains.
|
|
54
|
+
*
|
|
55
|
+
* One url answers with a whole document, a partial payload, a named region or
|
|
56
|
+
* an interceptor depending on these — so a cache keyed on the url alone, or on
|
|
57
|
+
* `X-RSC` alone, will hand one client another's answer. They are materially
|
|
58
|
+
* different bodies, not variations in presentation.
|
|
59
|
+
*/
|
|
60
|
+
export declare const VARY_ON_RSC: string;
|
|
61
|
+
/**
|
|
62
|
+
* What a response says about being stored, when it must not be.
|
|
63
|
+
*
|
|
64
|
+
* `Vary` alone is not enough on the platform this targets. Cloudflare ignores
|
|
65
|
+
* `Vary` for everything except `Accept-Encoding`, and this package ships a
|
|
66
|
+
* Workers story as a headline feature — so one url answering with a document,
|
|
67
|
+
* a Flight payload, a segment and an interceptor, keyed only on the url, hands
|
|
68
|
+
* one visitor another's body. Anything narrowed by a request header, and
|
|
69
|
+
* anything behind a guard, says outright that it is not to be stored.
|
|
70
|
+
*/
|
|
71
|
+
export declare const PER_CLIENT = "private, no-store";
|
|
72
|
+
/**
|
|
73
|
+
* And what a frozen, unguarded page says.
|
|
74
|
+
*
|
|
75
|
+
* Explicit rather than absent: with no directive at all, whether an
|
|
76
|
+
* intermediary stores it comes down to that intermediary's heuristics, which
|
|
77
|
+
* is not a decision this package should be leaving to chance in either
|
|
78
|
+
* direction.
|
|
79
|
+
*/
|
|
80
|
+
export declare const REVALIDATE = "public, max-age=0, must-revalidate";
|
|
81
|
+
//# sourceMappingURL=headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../src/headers.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM;IACjB;;;OAGG;aACH,GAAG,EAAE,OAAO;IAEZ,iFAAiF;aACjF,QAAQ,EAAE,gBAAgB;IAE1B,kEAAkE;aAClE,YAAY,EAAE,qBAAqB;IAEnC,wCAAwC;aACxC,OAAO,EAAE,eAAe;IAExB,gFAAgF;aAChF,OAAO,EAAE,eAAe;IAExB,uDAAuD;aACvD,SAAS,EAAE,iBAAiB;IAE5B,gDAAgD;aAChD,OAAO,EAAE,eAAe;IAExB,uEAAuE;aACvE,UAAU,EAAE,kBAAkB;IAE9B,0CAA0C;aAC1C,MAAM,EAAE,cAAc;IAEtB;;;;;;;OAOG;aACH,QAAQ,EAAE,gBAAgB;IAE1B;;;;;;OAMG;aACH,WAAW,EAAE,oBAAoB;IAEjC;;;;;OAKG;aACH,UAAU,EAAE,cAAc;CAClB,CAAA;AAEV,sBAAsB;AACtB,eAAO,MAAM,WAAW,oCAAoC,CAAA;AAE5D,2BAA2B;AAC3B,eAAO,MAAM,SAAS,6BAA6B,CAAA;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,QAMZ,CAAA;AAEZ;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,sBAAsB,CAAA;AAE7C;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,uCAAuC,CAAA"}
|