@elurjs/kit 2.4.4
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 +874 -0
- package/LICENSE +21 -0
- package/README.md +1330 -0
- package/bin/elur-kit.js +54 -0
- package/dist/lib/action/define.d.cts +72 -0
- package/dist/lib/action/define.d.ts +72 -0
- package/dist/lib/action/error-store.d.cts +29 -0
- package/dist/lib/action/error-store.d.ts +29 -0
- package/dist/lib/action/index.cjs +1 -0
- package/dist/lib/action/index.d.cts +64 -0
- package/dist/lib/action/index.d.ts +64 -0
- package/dist/lib/action/index.js +2 -0
- package/dist/lib/action/origin.d.cts +20 -0
- package/dist/lib/action/origin.d.ts +20 -0
- package/dist/lib/action/scan.d.cts +28 -0
- package/dist/lib/action/scan.d.ts +28 -0
- package/dist/lib/action/server.d.cts +30 -0
- package/dist/lib/action/server.d.ts +30 -0
- package/dist/lib/action-BB6N5yD-.js +111 -0
- package/dist/lib/action-BB6N5yD-.js.map +1 -0
- package/dist/lib/action-DZHihU3Z.cjs +2 -0
- package/dist/lib/action-DZHihU3Z.cjs.map +1 -0
- package/dist/lib/adapters/bun.cjs +30 -0
- package/dist/lib/adapters/bun.cjs.map +1 -0
- package/dist/lib/adapters/bun.d.cts +13 -0
- package/dist/lib/adapters/bun.d.ts +13 -0
- package/dist/lib/adapters/bun.js +65 -0
- package/dist/lib/adapters/bun.js.map +1 -0
- package/dist/lib/adapters/index.cjs +0 -0
- package/dist/lib/adapters/index.d.cts +30 -0
- package/dist/lib/adapters/index.d.ts +30 -0
- package/dist/lib/adapters/index.js +0 -0
- package/dist/lib/adapters/netlify.cjs +10 -0
- package/dist/lib/adapters/netlify.cjs.map +1 -0
- package/dist/lib/adapters/netlify.d.cts +13 -0
- package/dist/lib/adapters/netlify.d.ts +13 -0
- package/dist/lib/adapters/netlify.js +51 -0
- package/dist/lib/adapters/netlify.js.map +1 -0
- package/dist/lib/adapters/node.cjs +46 -0
- package/dist/lib/adapters/node.cjs.map +1 -0
- package/dist/lib/adapters/node.d.cts +13 -0
- package/dist/lib/adapters/node.d.ts +13 -0
- package/dist/lib/adapters/node.js +105 -0
- package/dist/lib/adapters/node.js.map +1 -0
- package/dist/lib/adapters/shared.d.cts +17 -0
- package/dist/lib/adapters/shared.d.ts +17 -0
- package/dist/lib/adapters/vercel.cjs +2 -0
- package/dist/lib/adapters/vercel.cjs.map +1 -0
- package/dist/lib/adapters/vercel.d.cts +9 -0
- package/dist/lib/adapters/vercel.d.ts +9 -0
- package/dist/lib/adapters/vercel.js +62 -0
- package/dist/lib/adapters/vercel.js.map +1 -0
- package/dist/lib/build/build.d.cts +83 -0
- package/dist/lib/build/build.d.ts +83 -0
- package/dist/lib/build/document-shell.d.cts +48 -0
- package/dist/lib/build/document-shell.d.ts +48 -0
- package/dist/lib/build/transform-source.d.cts +26 -0
- package/dist/lib/build/transform-source.d.ts +26 -0
- package/dist/lib/build/vite-build.d.cts +78 -0
- package/dist/lib/build/vite-build.d.ts +78 -0
- package/dist/lib/cache/policy.d.cts +25 -0
- package/dist/lib/cache/policy.d.ts +25 -0
- package/dist/lib/cache.d.cts +13 -0
- package/dist/lib/cache.d.ts +13 -0
- package/dist/lib/capabilities-C0TDQoMY.cjs +2 -0
- package/dist/lib/capabilities-C0TDQoMY.cjs.map +1 -0
- package/dist/lib/capabilities-C7txofmY.js +45 -0
- package/dist/lib/capabilities-C7txofmY.js.map +1 -0
- package/dist/lib/cli/commands.d.cts +15 -0
- package/dist/lib/cli/commands.d.ts +15 -0
- package/dist/lib/cli.cjs +5132 -0
- package/dist/lib/cli.cjs.map +1 -0
- package/dist/lib/cli.d.cts +30 -0
- package/dist/lib/cli.d.ts +30 -0
- package/dist/lib/cli.js +5131 -0
- package/dist/lib/cli.js.map +1 -0
- package/dist/lib/collections-Dbc8aRLf.js +233 -0
- package/dist/lib/collections-Dbc8aRLf.js.map +1 -0
- package/dist/lib/collections-VDy5g9p8.cjs +13 -0
- package/dist/lib/collections-VDy5g9p8.cjs.map +1 -0
- package/dist/lib/config/index.cjs +2 -0
- package/dist/lib/config/index.cjs.map +1 -0
- package/dist/lib/config/index.d.cts +100 -0
- package/dist/lib/config/index.d.ts +100 -0
- package/dist/lib/config/index.js +122 -0
- package/dist/lib/config/index.js.map +1 -0
- package/dist/lib/content/collections.d.cts +69 -0
- package/dist/lib/content/collections.d.ts +69 -0
- package/dist/lib/content/frontmatter.d.cts +20 -0
- package/dist/lib/content/frontmatter.d.ts +20 -0
- package/dist/lib/content/index.cjs +2 -0
- package/dist/lib/content/index.cjs.map +1 -0
- package/dist/lib/content/index.d.cts +5 -0
- package/dist/lib/content/index.d.ts +5 -0
- package/dist/lib/content/index.js +28 -0
- package/dist/lib/content/index.js.map +1 -0
- package/dist/lib/content/markdown.d.cts +6 -0
- package/dist/lib/content/markdown.d.ts +6 -0
- package/dist/lib/content/raw.d.cts +9 -0
- package/dist/lib/content/raw.d.ts +9 -0
- package/dist/lib/content/schema.d.cts +14 -0
- package/dist/lib/content/schema.d.ts +14 -0
- package/dist/lib/errors-0X7pCFNU.cjs +2 -0
- package/dist/lib/errors-0X7pCFNU.cjs.map +1 -0
- package/dist/lib/errors-ePYxDlhU.js +70 -0
- package/dist/lib/errors-ePYxDlhU.js.map +1 -0
- package/dist/lib/errors.d.cts +84 -0
- package/dist/lib/errors.d.ts +84 -0
- package/dist/lib/hydrate-8a3TbQbs.cjs +2 -0
- package/dist/lib/hydrate-8a3TbQbs.cjs.map +1 -0
- package/dist/lib/hydrate-CgZGrTxF.js +126 -0
- package/dist/lib/hydrate-CgZGrTxF.js.map +1 -0
- package/dist/lib/image/index.cjs +2 -0
- package/dist/lib/image/index.cjs.map +1 -0
- package/dist/lib/image/index.d.cts +37 -0
- package/dist/lib/image/index.d.ts +37 -0
- package/dist/lib/image/index.js +49 -0
- package/dist/lib/image/index.js.map +1 -0
- package/dist/lib/image/pipeline.d.cts +37 -0
- package/dist/lib/image/pipeline.d.ts +37 -0
- package/dist/lib/image/registry.cjs +2 -0
- package/dist/lib/image/registry.cjs.map +1 -0
- package/dist/lib/image/registry.d.cts +26 -0
- package/dist/lib/image/registry.d.ts +26 -0
- package/dist/lib/image/registry.js +23 -0
- package/dist/lib/image/registry.js.map +1 -0
- package/dist/lib/image/service.cjs +2 -0
- package/dist/lib/image/service.cjs.map +1 -0
- package/dist/lib/image/service.d.cts +164 -0
- package/dist/lib/image/service.d.ts +164 -0
- package/dist/lib/image/service.js +308 -0
- package/dist/lib/image/service.js.map +1 -0
- package/dist/lib/index.cjs +1 -0
- package/dist/lib/index.cjs.map +1 -0
- package/dist/lib/index.d.cts +38 -0
- package/dist/lib/index.d.ts +38 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/integrations/hooks.d.cts +58 -0
- package/dist/lib/integrations/hooks.d.ts +58 -0
- package/dist/lib/integrations/index.cjs +1 -0
- package/dist/lib/integrations/index.d.cts +18 -0
- package/dist/lib/integrations/index.d.ts +18 -0
- package/dist/lib/integrations/index.js +2 -0
- package/dist/lib/integrations-7dpN1RYB.js +35 -0
- package/dist/lib/integrations-7dpN1RYB.js.map +1 -0
- package/dist/lib/integrations-DDqfWjvH.cjs +2 -0
- package/dist/lib/integrations-DDqfWjvH.cjs.map +1 -0
- package/dist/lib/interpolation-plugin-Bt-KRKVY.js +365 -0
- package/dist/lib/interpolation-plugin-Bt-KRKVY.js.map +1 -0
- package/dist/lib/interpolation-plugin-CMPCDlVJ.cjs +31 -0
- package/dist/lib/interpolation-plugin-CMPCDlVJ.cjs.map +1 -0
- package/dist/lib/island/generate-entry.d.cts +27 -0
- package/dist/lib/island/generate-entry.d.ts +27 -0
- package/dist/lib/island/hydrate.d.cts +33 -0
- package/dist/lib/island/hydrate.d.ts +33 -0
- package/dist/lib/island/index.cjs +1 -0
- package/dist/lib/island/index.d.cts +2 -0
- package/dist/lib/island/index.d.ts +2 -0
- package/dist/lib/island/index.js +1 -0
- package/dist/lib/island/island.d.cts +32 -0
- package/dist/lib/island/island.d.ts +32 -0
- package/dist/lib/island/scan.d.cts +14 -0
- package/dist/lib/island/scan.d.ts +14 -0
- package/dist/lib/manifest/index.cjs +3 -0
- package/dist/lib/manifest/index.cjs.map +1 -0
- package/dist/lib/manifest/index.d.cts +18 -0
- package/dist/lib/manifest/index.d.ts +18 -0
- package/dist/lib/manifest/index.js +110 -0
- package/dist/lib/manifest/index.js.map +1 -0
- package/dist/lib/middleware/index.d.cts +56 -0
- package/dist/lib/middleware/index.d.ts +56 -0
- package/dist/lib/middleware/stream-boundary.d.cts +53 -0
- package/dist/lib/middleware/stream-boundary.d.ts +53 -0
- package/dist/lib/node-http-DRAUhO0c.js +617 -0
- package/dist/lib/node-http-DRAUhO0c.js.map +1 -0
- package/dist/lib/node-http-DhxguYyz.cjs +13 -0
- package/dist/lib/node-http-DhxguYyz.cjs.map +1 -0
- package/dist/lib/render/render-to-string.d.cts +12 -0
- package/dist/lib/render/render-to-string.d.ts +12 -0
- package/dist/lib/render/ssr-flag.d.cts +4 -0
- package/dist/lib/render/ssr-flag.d.ts +4 -0
- package/dist/lib/route-scanner-JY6YrNH5.cjs +2 -0
- package/dist/lib/route-scanner-JY6YrNH5.cjs.map +1 -0
- package/dist/lib/route-scanner-XcLId7lK.js +100 -0
- package/dist/lib/route-scanner-XcLId7lK.js.map +1 -0
- package/dist/lib/router/client.cjs +2 -0
- package/dist/lib/router/client.cjs.map +1 -0
- package/dist/lib/router/client.d.cts +47 -0
- package/dist/lib/router/client.d.ts +47 -0
- package/dist/lib/router/client.js +298 -0
- package/dist/lib/router/client.js.map +1 -0
- package/dist/lib/router/route-scanner.d.cts +50 -0
- package/dist/lib/router/route-scanner.d.ts +50 -0
- package/dist/lib/runtime/capabilities.d.cts +47 -0
- package/dist/lib/runtime/capabilities.d.ts +47 -0
- package/dist/lib/runtime/context.d.cts +140 -0
- package/dist/lib/runtime/context.d.ts +140 -0
- package/dist/lib/runtime/handler.d.cts +39 -0
- package/dist/lib/runtime/handler.d.ts +39 -0
- package/dist/lib/runtime/index.cjs +1 -0
- package/dist/lib/runtime/index.d.cts +6 -0
- package/dist/lib/runtime/index.d.ts +6 -0
- package/dist/lib/runtime/index.js +4 -0
- package/dist/lib/runtime/node-http.d.cts +2 -0
- package/dist/lib/runtime/node-http.d.ts +2 -0
- package/dist/lib/runtime/security-headers.d.cts +13 -0
- package/dist/lib/runtime/security-headers.d.ts +13 -0
- package/dist/lib/runtime/static.d.cts +1 -0
- package/dist/lib/runtime/static.d.ts +1 -0
- package/dist/lib/runtime-CrH5X-Es.cjs +2 -0
- package/dist/lib/runtime-CrH5X-Es.cjs.map +1 -0
- package/dist/lib/runtime-Ds2-wH6P.js +520 -0
- package/dist/lib/runtime-Ds2-wH6P.js.map +1 -0
- package/dist/lib/scan-CY2O9ty6.cjs +2 -0
- package/dist/lib/scan-CY2O9ty6.cjs.map +1 -0
- package/dist/lib/scan-CjMUgnsd.js +22 -0
- package/dist/lib/scan-CjMUgnsd.js.map +1 -0
- package/dist/lib/scan-DXzYtmRQ.cjs +2 -0
- package/dist/lib/scan-DXzYtmRQ.cjs.map +1 -0
- package/dist/lib/scan-Dn93ycXG.js +33 -0
- package/dist/lib/scan-Dn93ycXG.js.map +1 -0
- package/dist/lib/seo/index.cjs +10 -0
- package/dist/lib/seo/index.cjs.map +1 -0
- package/dist/lib/seo/index.d.cts +99 -0
- package/dist/lib/seo/index.d.ts +99 -0
- package/dist/lib/seo/index.js +41 -0
- package/dist/lib/seo/index.js.map +1 -0
- package/dist/lib/shared-CfqOLsKj.cjs +183 -0
- package/dist/lib/shared-CfqOLsKj.cjs.map +1 -0
- package/dist/lib/shared-DU3iQgr7.js +236 -0
- package/dist/lib/shared-DU3iQgr7.js.map +1 -0
- package/dist/lib/ssr/match.d.cts +25 -0
- package/dist/lib/ssr/match.d.ts +25 -0
- package/dist/lib/ssr/render.d.cts +62 -0
- package/dist/lib/ssr/render.d.ts +62 -0
- package/dist/lib/ssr/server.d.cts +41 -0
- package/dist/lib/ssr/server.d.ts +41 -0
- package/dist/lib/ssr/stream.d.cts +48 -0
- package/dist/lib/ssr/stream.d.ts +48 -0
- package/dist/lib/stream-CpOG052V.js +104 -0
- package/dist/lib/stream-CpOG052V.js.map +1 -0
- package/dist/lib/stream-DmZjYqHm.cjs +17 -0
- package/dist/lib/stream-DmZjYqHm.cjs.map +1 -0
- package/dist/lib/types.d.cts +97 -0
- package/dist/lib/types.d.ts +97 -0
- package/dist/lib/vite/index.cjs +2 -0
- package/dist/lib/vite/index.cjs.map +1 -0
- package/dist/lib/vite/index.d.cts +41 -0
- package/dist/lib/vite/index.d.ts +41 -0
- package/dist/lib/vite/index.js +229 -0
- package/dist/lib/vite/index.js.map +1 -0
- package/dist/lib/vite/interpolation-plugin.d.cts +64 -0
- package/dist/lib/vite/interpolation-plugin.d.ts +64 -0
- package/package.json +292 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Cache mode for a route. */
|
|
2
|
+
export type CacheMode = "public" | "private" | "dynamic";
|
|
3
|
+
/** Cache policy declared by the route's data module. */
|
|
4
|
+
export interface CachePolicy {
|
|
5
|
+
mode: CacheMode;
|
|
6
|
+
revalidate: number;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
}
|
|
9
|
+
/** Default cache policy when none is declared. */
|
|
10
|
+
export declare const DEFAULT_CACHE_POLICY: CachePolicy;
|
|
11
|
+
/**
|
|
12
|
+
* Normalizes a raw cache export from a data module into a CachePolicy.
|
|
13
|
+
* Returns the default policy if the input is invalid or missing.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeCachePolicy(raw: unknown): CachePolicy;
|
|
16
|
+
/**
|
|
17
|
+
* Determines whether a route's cache policy allows public caching for the
|
|
18
|
+
* given request.
|
|
19
|
+
*
|
|
20
|
+
* Per §9.1:
|
|
21
|
+
* - "dynamic" → never cache
|
|
22
|
+
* - "private" → never cache publicly (requires private adapter)
|
|
23
|
+
* - "public" → cache only if request has no Cookie/Authorization
|
|
24
|
+
*/
|
|
25
|
+
export declare function shouldCachePublic(policy: CachePolicy, request: Request): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Cache mode for a route. */
|
|
2
|
+
export type CacheMode = "public" | "private" | "dynamic";
|
|
3
|
+
/** Cache policy declared by the route's data module. */
|
|
4
|
+
export interface CachePolicy {
|
|
5
|
+
mode: CacheMode;
|
|
6
|
+
revalidate: number;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
}
|
|
9
|
+
/** Default cache policy when none is declared. */
|
|
10
|
+
export declare const DEFAULT_CACHE_POLICY: CachePolicy;
|
|
11
|
+
/**
|
|
12
|
+
* Normalizes a raw cache export from a data module into a CachePolicy.
|
|
13
|
+
* Returns the default policy if the input is invalid or missing.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeCachePolicy(raw: unknown): CachePolicy;
|
|
16
|
+
/**
|
|
17
|
+
* Determines whether a route's cache policy allows public caching for the
|
|
18
|
+
* given request.
|
|
19
|
+
*
|
|
20
|
+
* Per §9.1:
|
|
21
|
+
* - "dynamic" → never cache
|
|
22
|
+
* - "private" → never cache publicly (requires private adapter)
|
|
23
|
+
* - "public" → cache only if request has no Cookie/Authorization
|
|
24
|
+
*/
|
|
25
|
+
export declare function shouldCachePublic(policy: CachePolicy, request: Request): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface CacheEntry {
|
|
2
|
+
html: string;
|
|
3
|
+
generatedAt: number;
|
|
4
|
+
revalidate: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CacheOptions {
|
|
7
|
+
cacheDir: string;
|
|
8
|
+
defaultRevalidate?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function getCachedHtml(cacheDir: string, pathname: string): Promise<CacheEntry | undefined>;
|
|
11
|
+
export declare function setCachedHtml(cacheDir: string, pathname: string, html: string, revalidate: number): Promise<void>;
|
|
12
|
+
export declare function isStale(cacheDir: string, pathname: string): Promise<boolean>;
|
|
13
|
+
export declare function clearCache(cacheDir: string): Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface CacheEntry {
|
|
2
|
+
html: string;
|
|
3
|
+
generatedAt: number;
|
|
4
|
+
revalidate: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CacheOptions {
|
|
7
|
+
cacheDir: string;
|
|
8
|
+
defaultRevalidate?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function getCachedHtml(cacheDir: string, pathname: string): Promise<CacheEntry | undefined>;
|
|
11
|
+
export declare function setCachedHtml(cacheDir: string, pathname: string, html: string, revalidate: number): Promise<void>;
|
|
12
|
+
export declare function isStale(cacheDir: string, pathname: string): Promise<boolean>;
|
|
13
|
+
export declare function clearCache(cacheDir: string): Promise<void>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={streaming:!0,filesystem:`persistent`,imageRuntime:!0,backgroundWork:!0},t={streaming:!0,filesystem:`ephemeral`,imageRuntime:!1,backgroundWork:!1,maxBodySize:1048576},n={streaming:!0,filesystem:`readonly`,imageRuntime:!1,backgroundWork:!1,maxBodySize:1048576};function r(t={}){return{...e,...t}}function i(e={streaming:!0}){return e.streaming!==!1}function a(e){return e.filesystem===`persistent`}function o(e){return e.filesystem===`persistent`||e.filesystem===`ephemeral`}function s(e,t={}){let n=[];return t.isr&&!a(e)&&n.push(`ISR requires a persistent filesystem; the host declares filesystem="${e.filesystem}".`),t.images&&e.imageRuntime===!1&&e.filesystem===`none`&&n.push(`On-demand image transforms require either imageRuntime=true or a readable filesystem; the host has neither.`),t.streaming&&e.streaming===!1&&n.push(`Streaming was requested but the host declares streaming=false.`),{ok:n.length===0,problems:n}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
|
|
2
|
+
//# sourceMappingURL=capabilities-C0TDQoMY.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities-C0TDQoMY.cjs","names":[],"sources":["../../src/runtime/capabilities.ts"],"sourcesContent":["// --- Adapter capabilities contract (§8.5) ---\n//\n// Every runtime host (Node CLI, Vite dev, Node/Bun adapters, Vercel, Netlify)\n// declares an explicit `AdapterCapabilities` object. The framework uses it to\n// decide which features are safe to enable: streaming, filesystem access,\n// runtime image transforms, background work, body size limits, ISR persistence.\n//\n// Invalid or incompatible capability combinations fail fast during build.\n\nexport type FilesystemCapability = \"none\" | \"readonly\" | \"persistent\" | \"ephemeral\";\n\nexport interface AdapterCapabilities {\n /** Whether the host supports streaming responses (ReadableStream bodies). */\n streaming: boolean;\n /** Filesystem access model of the host. */\n filesystem: FilesystemCapability;\n /** Whether the host can run image transforms at request time. */\n imageRuntime: boolean;\n /** Whether the host allows background work after the response completes. */\n backgroundWork: boolean;\n /** Maximum request body size in bytes accepted by the host (if any). */\n maxBodySize?: number;\n}\n\nexport interface CapabilityOptions {\n streaming?: boolean;\n filesystem?: FilesystemCapability;\n imageRuntime?: boolean;\n backgroundWork?: boolean;\n maxBodySize?: number;\n}\n\n/** Default capabilities for a full-featured long-lived Node/Bun process. */\nexport const DEFAULT_CAPABILITIES: AdapterCapabilities = {\n streaming: true,\n filesystem: \"persistent\",\n imageRuntime: true,\n backgroundWork: true,\n};\n\n/** Default capabilities for a stateless serverless function (Vercel/Netlify). */\nexport const SERVERLESS_CAPABILITIES: AdapterCapabilities = {\n streaming: true,\n filesystem: \"ephemeral\",\n imageRuntime: false,\n backgroundWork: false,\n maxBodySize: 1_048_576,\n};\n\n/** Default capabilities for an edge runtime (read-only filesystem). */\nexport const EDGE_CAPABILITIES: AdapterCapabilities = {\n streaming: true,\n filesystem: \"readonly\",\n imageRuntime: false,\n backgroundWork: false,\n maxBodySize: 1_048_576,\n};\n\nexport function createCapabilities(options: CapabilityOptions = {}): AdapterCapabilities {\n return {\n ...DEFAULT_CAPABILITIES,\n ...options,\n };\n}\n\n/** True when the host supports streaming responses (streaming !== false). */\nexport function supportsStreaming(capabilities: Pick<AdapterCapabilities, \"streaming\"> = { streaming: true }): boolean {\n return capabilities.streaming !== false;\n}\n\n/** True when the host can write to persistent storage (for ISR/cache/image writes). */\nexport function supportsPersistentStorage(capabilities: Pick<AdapterCapabilities, \"filesystem\">): boolean {\n return capabilities.filesystem === \"persistent\";\n}\n\n/** True when the host exposes a writable filesystem at build/runtime. */\nexport function supportsWritableFilesystem(capabilities: Pick<AdapterCapabilities, \"filesystem\">): boolean {\n return capabilities.filesystem === \"persistent\" || capabilities.filesystem === \"ephemeral\";\n}\n\nexport interface CapabilityDiagnostics {\n ok: boolean;\n problems: string[];\n}\n\n/**\n * Validates a capability declaration and reports incompatible combinations.\n * Used by the build pipeline so invalid hosts fail at build time instead of\n * producing a broken runtime.\n */\nexport function validateCapabilities(\n capabilities: AdapterCapabilities,\n features: { isr?: boolean; images?: boolean; streaming?: boolean } = {},\n): CapabilityDiagnostics {\n const problems: string[] = [];\n\n if (features.isr && !supportsPersistentStorage(capabilities)) {\n problems.push(\n `ISR requires a persistent filesystem; the host declares filesystem=\"${capabilities.filesystem}\".`,\n );\n }\n if (features.images && capabilities.imageRuntime === false && capabilities.filesystem === \"none\") {\n problems.push(\n \"On-demand image transforms require either imageRuntime=true or a readable filesystem; the host has neither.\",\n );\n }\n if (features.streaming && capabilities.streaming === false) {\n problems.push(\"Streaming was requested but the host declares streaming=false.\");\n }\n\n return { ok: problems.length === 0, problems };\n}\n"],"mappings":"AAiCA,IAAa,EAA4C,CACvD,UAAW,GACX,WAAY,aACZ,aAAc,GACd,eAAgB,EAClB,EAGa,EAA+C,CAC1D,UAAW,GACX,WAAY,YACZ,aAAc,GACd,eAAgB,GAChB,YAAa,OACf,EAGa,EAAyC,CACpD,UAAW,GACX,WAAY,WACZ,aAAc,GACd,eAAgB,GAChB,YAAa,OACf,EAEA,SAAgB,EAAmB,EAA6B,CAAC,EAAwB,CACvF,MAAO,CACL,GAAG,EACH,GAAG,CACL,CACF,CAGA,SAAgB,EAAkB,EAAuD,CAAE,UAAW,EAAK,EAAY,CACrH,OAAO,EAAa,YAAc,EACpC,CAGA,SAAgB,EAA0B,EAAgE,CACxG,OAAO,EAAa,aAAe,YACrC,CAGA,SAAgB,EAA2B,EAAgE,CACzG,OAAO,EAAa,aAAe,cAAgB,EAAa,aAAe,WACjF,CAYA,SAAgB,EACd,EACA,EAAqE,CAAC,EAC/C,CACvB,IAAM,EAAqB,CAAC,EAgB5B,OAdI,EAAS,KAAO,CAAC,EAA0B,CAAY,GACzD,EAAS,KACP,uEAAuE,EAAa,WAAW,GACjG,EAEE,EAAS,QAAU,EAAa,eAAiB,IAAS,EAAa,aAAe,QACxF,EAAS,KACP,6GACF,EAEE,EAAS,WAAa,EAAa,YAAc,IACnD,EAAS,KAAK,gEAAgE,EAGzE,CAAE,GAAI,EAAS,SAAW,EAAG,UAAS,CAC/C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/runtime/capabilities.ts
|
|
2
|
+
var e = {
|
|
3
|
+
streaming: !0,
|
|
4
|
+
filesystem: "persistent",
|
|
5
|
+
imageRuntime: !0,
|
|
6
|
+
backgroundWork: !0
|
|
7
|
+
}, t = {
|
|
8
|
+
streaming: !0,
|
|
9
|
+
filesystem: "ephemeral",
|
|
10
|
+
imageRuntime: !1,
|
|
11
|
+
backgroundWork: !1,
|
|
12
|
+
maxBodySize: 1048576
|
|
13
|
+
}, n = {
|
|
14
|
+
streaming: !0,
|
|
15
|
+
filesystem: "readonly",
|
|
16
|
+
imageRuntime: !1,
|
|
17
|
+
backgroundWork: !1,
|
|
18
|
+
maxBodySize: 1048576
|
|
19
|
+
};
|
|
20
|
+
function r(t = {}) {
|
|
21
|
+
return {
|
|
22
|
+
...e,
|
|
23
|
+
...t
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function i(e = { streaming: !0 }) {
|
|
27
|
+
return e.streaming !== !1;
|
|
28
|
+
}
|
|
29
|
+
function a(e) {
|
|
30
|
+
return e.filesystem === "persistent";
|
|
31
|
+
}
|
|
32
|
+
function o(e) {
|
|
33
|
+
return e.filesystem === "persistent" || e.filesystem === "ephemeral";
|
|
34
|
+
}
|
|
35
|
+
function s(e, t = {}) {
|
|
36
|
+
let n = [];
|
|
37
|
+
return t.isr && !a(e) && n.push(`ISR requires a persistent filesystem; the host declares filesystem="${e.filesystem}".`), t.images && e.imageRuntime === !1 && e.filesystem === "none" && n.push("On-demand image transforms require either imageRuntime=true or a readable filesystem; the host has neither."), t.streaming && e.streaming === !1 && n.push("Streaming was requested but the host declares streaming=false."), {
|
|
38
|
+
ok: n.length === 0,
|
|
39
|
+
problems: n
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { a, s as c, r as i, n, i as o, t as r, o as s, e as t };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=capabilities-C7txofmY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities-C7txofmY.js","names":[],"sources":["../../src/runtime/capabilities.ts"],"sourcesContent":["// --- Adapter capabilities contract (§8.5) ---\n//\n// Every runtime host (Node CLI, Vite dev, Node/Bun adapters, Vercel, Netlify)\n// declares an explicit `AdapterCapabilities` object. The framework uses it to\n// decide which features are safe to enable: streaming, filesystem access,\n// runtime image transforms, background work, body size limits, ISR persistence.\n//\n// Invalid or incompatible capability combinations fail fast during build.\n\nexport type FilesystemCapability = \"none\" | \"readonly\" | \"persistent\" | \"ephemeral\";\n\nexport interface AdapterCapabilities {\n /** Whether the host supports streaming responses (ReadableStream bodies). */\n streaming: boolean;\n /** Filesystem access model of the host. */\n filesystem: FilesystemCapability;\n /** Whether the host can run image transforms at request time. */\n imageRuntime: boolean;\n /** Whether the host allows background work after the response completes. */\n backgroundWork: boolean;\n /** Maximum request body size in bytes accepted by the host (if any). */\n maxBodySize?: number;\n}\n\nexport interface CapabilityOptions {\n streaming?: boolean;\n filesystem?: FilesystemCapability;\n imageRuntime?: boolean;\n backgroundWork?: boolean;\n maxBodySize?: number;\n}\n\n/** Default capabilities for a full-featured long-lived Node/Bun process. */\nexport const DEFAULT_CAPABILITIES: AdapterCapabilities = {\n streaming: true,\n filesystem: \"persistent\",\n imageRuntime: true,\n backgroundWork: true,\n};\n\n/** Default capabilities for a stateless serverless function (Vercel/Netlify). */\nexport const SERVERLESS_CAPABILITIES: AdapterCapabilities = {\n streaming: true,\n filesystem: \"ephemeral\",\n imageRuntime: false,\n backgroundWork: false,\n maxBodySize: 1_048_576,\n};\n\n/** Default capabilities for an edge runtime (read-only filesystem). */\nexport const EDGE_CAPABILITIES: AdapterCapabilities = {\n streaming: true,\n filesystem: \"readonly\",\n imageRuntime: false,\n backgroundWork: false,\n maxBodySize: 1_048_576,\n};\n\nexport function createCapabilities(options: CapabilityOptions = {}): AdapterCapabilities {\n return {\n ...DEFAULT_CAPABILITIES,\n ...options,\n };\n}\n\n/** True when the host supports streaming responses (streaming !== false). */\nexport function supportsStreaming(capabilities: Pick<AdapterCapabilities, \"streaming\"> = { streaming: true }): boolean {\n return capabilities.streaming !== false;\n}\n\n/** True when the host can write to persistent storage (for ISR/cache/image writes). */\nexport function supportsPersistentStorage(capabilities: Pick<AdapterCapabilities, \"filesystem\">): boolean {\n return capabilities.filesystem === \"persistent\";\n}\n\n/** True when the host exposes a writable filesystem at build/runtime. */\nexport function supportsWritableFilesystem(capabilities: Pick<AdapterCapabilities, \"filesystem\">): boolean {\n return capabilities.filesystem === \"persistent\" || capabilities.filesystem === \"ephemeral\";\n}\n\nexport interface CapabilityDiagnostics {\n ok: boolean;\n problems: string[];\n}\n\n/**\n * Validates a capability declaration and reports incompatible combinations.\n * Used by the build pipeline so invalid hosts fail at build time instead of\n * producing a broken runtime.\n */\nexport function validateCapabilities(\n capabilities: AdapterCapabilities,\n features: { isr?: boolean; images?: boolean; streaming?: boolean } = {},\n): CapabilityDiagnostics {\n const problems: string[] = [];\n\n if (features.isr && !supportsPersistentStorage(capabilities)) {\n problems.push(\n `ISR requires a persistent filesystem; the host declares filesystem=\"${capabilities.filesystem}\".`,\n );\n }\n if (features.images && capabilities.imageRuntime === false && capabilities.filesystem === \"none\") {\n problems.push(\n \"On-demand image transforms require either imageRuntime=true or a readable filesystem; the host has neither.\",\n );\n }\n if (features.streaming && capabilities.streaming === false) {\n problems.push(\"Streaming was requested but the host declares streaming=false.\");\n }\n\n return { ok: problems.length === 0, problems };\n}\n"],"mappings":";AAiCA,IAAa,IAA4C;CACvD,WAAW;CACX,YAAY;CACZ,cAAc;CACd,gBAAgB;AAClB,GAGa,IAA+C;CAC1D,WAAW;CACX,YAAY;CACZ,cAAc;CACd,gBAAgB;CAChB,aAAa;AACf,GAGa,IAAyC;CACpD,WAAW;CACX,YAAY;CACZ,cAAc;CACd,gBAAgB;CAChB,aAAa;AACf;AAEA,SAAgB,EAAmB,IAA6B,CAAC,GAAwB;CACvF,OAAO;EACL,GAAG;EACH,GAAG;CACL;AACF;AAGA,SAAgB,EAAkB,IAAuD,EAAE,WAAW,GAAK,GAAY;CACrH,OAAO,EAAa,cAAc;AACpC;AAGA,SAAgB,EAA0B,GAAgE;CACxG,OAAO,EAAa,eAAe;AACrC;AAGA,SAAgB,EAA2B,GAAgE;CACzG,OAAO,EAAa,eAAe,gBAAgB,EAAa,eAAe;AACjF;AAYA,SAAgB,EACd,GACA,IAAqE,CAAC,GAC/C;CACvB,IAAM,IAAqB,CAAC;CAgB5B,OAdI,EAAS,OAAO,CAAC,EAA0B,CAAY,KACzD,EAAS,KACP,uEAAuE,EAAa,WAAW,GACjG,GAEE,EAAS,UAAU,EAAa,iBAAiB,MAAS,EAAa,eAAe,UACxF,EAAS,KACP,6GACF,GAEE,EAAS,aAAa,EAAa,cAAc,MACnD,EAAS,KAAK,gEAAgE,GAGzE;EAAE,IAAI,EAAS,WAAW;EAAG;CAAS;AAC/C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CliOptions } from "../cli.js";
|
|
2
|
+
/** Exit codes used by all CLI commands. */
|
|
3
|
+
export declare const ExitCode: {
|
|
4
|
+
readonly Success: 0;
|
|
5
|
+
readonly GenericError: 1;
|
|
6
|
+
readonly ConfigError: 2;
|
|
7
|
+
readonly TypeError: 3;
|
|
8
|
+
readonly RouteConflict: 4;
|
|
9
|
+
readonly MissingDependency: 5;
|
|
10
|
+
};
|
|
11
|
+
/** Formats an error with cause, path, and suggestion. */
|
|
12
|
+
export declare function formatError(cause: string, path?: string, suggestion?: string): string;
|
|
13
|
+
export declare function doCheck(options: CliOptions): Promise<number>;
|
|
14
|
+
export declare function doRoutes(options: CliOptions): Promise<number>;
|
|
15
|
+
export declare function doDoctor(options: CliOptions): Promise<number>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CliOptions } from "../cli.js";
|
|
2
|
+
/** Exit codes used by all CLI commands. */
|
|
3
|
+
export declare const ExitCode: {
|
|
4
|
+
readonly Success: 0;
|
|
5
|
+
readonly GenericError: 1;
|
|
6
|
+
readonly ConfigError: 2;
|
|
7
|
+
readonly TypeError: 3;
|
|
8
|
+
readonly RouteConflict: 4;
|
|
9
|
+
readonly MissingDependency: 5;
|
|
10
|
+
};
|
|
11
|
+
/** Formats an error with cause, path, and suggestion. */
|
|
12
|
+
export declare function formatError(cause: string, path?: string, suggestion?: string): string;
|
|
13
|
+
export declare function doCheck(options: CliOptions): Promise<number>;
|
|
14
|
+
export declare function doRoutes(options: CliOptions): Promise<number>;
|
|
15
|
+
export declare function doDoctor(options: CliOptions): Promise<number>;
|