theokit 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{actions-virtual-module-IY46EEEX.js → actions-virtual-module-DL74V6SR.js} +2 -2
- package/dist/actions-virtual-module-DL74V6SR.js.map +1 -0
- package/dist/{actions-virtual-module-XNHDNCZ6.js → actions-virtual-module-ZDD54ZZE.js} +2 -2
- package/dist/actions-virtual-module-ZDD54ZZE.js.map +1 -0
- package/dist/{app-typed-client-OUJO3V5J.js → app-typed-client-4GIKUKRT.js} +4 -4
- package/dist/app-typed-client-4GIKUKRT.js.map +1 -0
- package/dist/{app-typed-client-YOMWSA3F.js → app-typed-client-4M4NVSK3.js} +3 -3
- package/dist/app-typed-client-4M4NVSK3.js.map +1 -0
- package/dist/{aws-lambda-GKSTX6HD.js → aws-lambda-SCRGTGF5.js} +5 -5
- package/dist/aws-lambda-SCRGTGF5.js.map +1 -0
- package/dist/{build-2WZ6XXVY.js → build-R74EU6BP.js} +11 -11
- package/dist/build-R74EU6BP.js.map +1 -0
- package/dist/{bun-ISHSNFIO.js → bun-FURRCQMS.js} +7 -7
- package/dist/bun-FURRCQMS.js.map +1 -0
- package/dist/{chunk-FI7MPTJW.js → chunk-3IOFTG3L.js} +1 -1
- package/dist/chunk-3IOFTG3L.js.map +1 -0
- package/dist/{chunk-U6TPSW4L.js → chunk-DUKXQNM7.js} +2 -2
- package/dist/{chunk-4S2UCILN.js → chunk-FGOX37NB.js} +8 -8
- package/dist/chunk-FGOX37NB.js.map +1 -0
- package/dist/{chunk-MR7OLIC6.js → chunk-GPF64ENM.js} +2 -2
- package/dist/{chunk-4S6YHNG2.js → chunk-GUUWDMR2.js} +2 -2
- package/dist/chunk-GUUWDMR2.js.map +1 -0
- package/dist/{chunk-WEGALZEU.js → chunk-HDA6M7P4.js} +3 -3
- package/dist/{chunk-K4M64WD6.js → chunk-IZQN5CDS.js} +4 -4
- package/dist/chunk-IZQN5CDS.js.map +1 -0
- package/dist/{chunk-M2EY7KDR.js → chunk-JD7AQNJS.js} +15 -15
- package/dist/chunk-JD7AQNJS.js.map +1 -0
- package/dist/{chunk-5Z2727GV.js → chunk-KJLECZWQ.js} +1 -1
- package/dist/chunk-KJLECZWQ.js.map +1 -0
- package/dist/{chunk-LC5PYNJP.js → chunk-MWYSRZI4.js} +7 -7
- package/dist/chunk-MWYSRZI4.js.map +1 -0
- package/dist/{chunk-VBZCVFSA.js → chunk-P2RS3WWY.js} +2 -2
- package/dist/{chunk-R7OC6UDK.js → chunk-P3SGM4NR.js} +1 -1
- package/dist/chunk-P3SGM4NR.js.map +1 -0
- package/dist/{chunk-ABVITXFH.js → chunk-S74FECKW.js} +1 -1
- package/dist/{chunk-ABVITXFH.js.map → chunk-S74FECKW.js.map} +1 -1
- package/dist/{chunk-COXLEZCN.js → chunk-UVHRD33F.js} +1 -1
- package/dist/chunk-UVHRD33F.js.map +1 -0
- package/dist/{chunk-27LWMYNK.js → chunk-X32KQH5C.js} +2 -2
- package/dist/chunk-X32KQH5C.js.map +1 -0
- package/dist/{chunk-2F4FROEQ.js → chunk-X3VNROZ7.js} +17 -17
- package/dist/chunk-X3VNROZ7.js.map +1 -0
- package/dist/{chunk-Y4H3JNVK.js → chunk-YB5DJJ4U.js} +1 -1
- package/dist/chunk-YB5DJJ4U.js.map +1 -0
- package/dist/cli/index.js +8 -8
- package/dist/{cloudflare-OJGJ7R2D.js → cloudflare-IZ6VJ2OU.js} +7 -7
- package/dist/cloudflare-IZ6VJ2OU.js.map +1 -0
- package/dist/{deno-deploy-BHWKFTOW.js → deno-deploy-O73NBXIW.js} +6 -6
- package/dist/deno-deploy-O73NBXIW.js.map +1 -0
- package/dist/{dev-U4UDZFDB.js → dev-ZU46C5AZ.js} +8 -8
- package/dist/{dev-emit-HHP2XJXE.js → dev-emit-66FCOS7V.js} +4 -4
- package/dist/{dev-emit-5VPRCHOD.js → dev-emit-JBVINGHU.js} +3 -3
- package/dist/devtools/entry.js +5 -4
- package/dist/devtools/entry.js.map +1 -1
- package/dist/{docker-EZDA5FT7.js → docker-AZSJFLP2.js} +3 -3
- package/dist/docker-AZSJFLP2.js.map +1 -0
- package/dist/{index-DWWEdFh5.d.ts → index-CuHICqb9.d.ts} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/{info-47VB62MV.js → info-CORLCPEJ.js} +4 -4
- package/dist/{netlify-GSNSJGMN.js → netlify-O7G3RLK4.js} +3 -3
- package/dist/netlify-O7G3RLK4.js.map +1 -0
- package/dist/{node-6I5B6RL3.js → node-LXPQLMVB.js} +3 -3
- package/dist/{openapi-NFLSNNVQ.js → openapi-TEOUOIJ2.js} +7 -7
- package/dist/registry-KW4F4D2L.js +25 -0
- package/dist/{routes-3A4XGIEJ.js → routes-GAXVWJUK.js} +6 -6
- package/dist/{schema-KZVOV333.js → schema-Z5VJ2I76.js} +3 -3
- package/dist/server/cron/index.js +2 -2
- package/dist/server/http/index.d.ts +1 -1
- package/dist/server/http/index.js +2 -2
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +18 -11
- package/dist/server/index.js.map +1 -1
- package/dist/server/jobs/index.d.ts +1 -1
- package/dist/server/jobs/index.js +2 -2
- package/dist/server/scan/index.d.ts +1 -1
- package/dist/server/scan/index.js +2 -2
- package/dist/{services-json-Z2QNGVPW.js → services-json-6SHWMYJH.js} +1 -1
- package/dist/services-json-6SHWMYJH.js.map +1 -0
- package/dist/{services-typed-client-T7M5VPBP.js → services-typed-client-ASZL7FQV.js} +2 -2
- package/dist/{start-QDRSRNXK.js → start-HGUNNF5X.js} +10 -10
- package/dist/start-HGUNNF5X.js.map +1 -0
- package/dist/{static-QI5NQT2X.js → static-EO73I4C7.js} +6 -6
- package/dist/static-EO73I4C7.js.map +1 -0
- package/dist/{theo-cloud-RSQCBNXL.js → theo-cloud-HBCYEODQ.js} +2 -2
- package/dist/theo-cloud-HBCYEODQ.js.map +1 -0
- package/dist/{vercel-TKPZK62A.js → vercel-GSFDMF7K.js} +4 -4
- package/dist/vercel-GSFDMF7K.js.map +1 -0
- package/dist/vite-plugin/index.js +3 -3
- package/dist/{vite-plugin-CR4JDFUQ.js → vite-plugin-TX5H4MB6.js} +8 -8
- package/package.json +1 -1
- package/dist/actions-virtual-module-IY46EEEX.js.map +0 -1
- package/dist/actions-virtual-module-XNHDNCZ6.js.map +0 -1
- package/dist/app-typed-client-OUJO3V5J.js.map +0 -1
- package/dist/app-typed-client-YOMWSA3F.js.map +0 -1
- package/dist/aws-lambda-GKSTX6HD.js.map +0 -1
- package/dist/build-2WZ6XXVY.js.map +0 -1
- package/dist/bun-ISHSNFIO.js.map +0 -1
- package/dist/chunk-27LWMYNK.js.map +0 -1
- package/dist/chunk-2F4FROEQ.js.map +0 -1
- package/dist/chunk-4S2UCILN.js.map +0 -1
- package/dist/chunk-4S6YHNG2.js.map +0 -1
- package/dist/chunk-5Z2727GV.js.map +0 -1
- package/dist/chunk-COXLEZCN.js.map +0 -1
- package/dist/chunk-FI7MPTJW.js.map +0 -1
- package/dist/chunk-K4M64WD6.js.map +0 -1
- package/dist/chunk-LC5PYNJP.js.map +0 -1
- package/dist/chunk-M2EY7KDR.js.map +0 -1
- package/dist/chunk-R7OC6UDK.js.map +0 -1
- package/dist/chunk-Y4H3JNVK.js.map +0 -1
- package/dist/cloudflare-OJGJ7R2D.js.map +0 -1
- package/dist/deno-deploy-BHWKFTOW.js.map +0 -1
- package/dist/docker-EZDA5FT7.js.map +0 -1
- package/dist/netlify-GSNSJGMN.js.map +0 -1
- package/dist/registry-QHEZ3BWB.js +0 -25
- package/dist/services-json-Z2QNGVPW.js.map +0 -1
- package/dist/start-QDRSRNXK.js.map +0 -1
- package/dist/static-QI5NQT2X.js.map +0 -1
- package/dist/theo-cloud-RSQCBNXL.js.map +0 -1
- package/dist/vercel-TKPZK62A.js.map +0 -1
- /package/dist/{chunk-U6TPSW4L.js.map → chunk-DUKXQNM7.js.map} +0 -0
- /package/dist/{chunk-MR7OLIC6.js.map → chunk-GPF64ENM.js.map} +0 -0
- /package/dist/{chunk-WEGALZEU.js.map → chunk-HDA6M7P4.js.map} +0 -0
- /package/dist/{chunk-VBZCVFSA.js.map → chunk-P2RS3WWY.js.map} +0 -0
- /package/dist/{dev-U4UDZFDB.js.map → dev-ZU46C5AZ.js.map} +0 -0
- /package/dist/{dev-emit-HHP2XJXE.js.map → dev-emit-66FCOS7V.js.map} +0 -0
- /package/dist/{dev-emit-5VPRCHOD.js.map → dev-emit-JBVINGHU.js.map} +0 -0
- /package/dist/{info-47VB62MV.js.map → info-CORLCPEJ.js.map} +0 -0
- /package/dist/{node-6I5B6RL3.js.map → node-LXPQLMVB.js.map} +0 -0
- /package/dist/{openapi-NFLSNNVQ.js.map → openapi-TEOUOIJ2.js.map} +0 -0
- /package/dist/{registry-QHEZ3BWB.js.map → registry-KW4F4D2L.js.map} +0 -0
- /package/dist/{routes-3A4XGIEJ.js.map → routes-GAXVWJUK.js.map} +0 -0
- /package/dist/{schema-KZVOV333.js.map → schema-Z5VJ2I76.js.map} +0 -0
- /package/dist/{services-typed-client-T7M5VPBP.js.map → services-typed-client-ASZL7FQV.js.map} +0 -0
- /package/dist/{vite-plugin-CR4JDFUQ.js.map → vite-plugin-TX5H4MB6.js.map} +0 -0
|
@@ -47,7 +47,7 @@ function generateDockerfile(pkgManager) {
|
|
|
47
47
|
"FROM node:22-alpine AS runner",
|
|
48
48
|
"WORKDIR /app",
|
|
49
49
|
"ENV NODE_ENV=production",
|
|
50
|
-
"COPY --from=builder /app/.
|
|
50
|
+
"COPY --from=builder /app/.theokit ./.theokit",
|
|
51
51
|
"COPY --from=builder /app/server ./server",
|
|
52
52
|
"COPY --from=builder /app/theo.config.ts ./theo.config.ts",
|
|
53
53
|
"COPY --from=builder /app/package.json ./package.json",
|
|
@@ -63,7 +63,7 @@ function generateDockerignore() {
|
|
|
63
63
|
return [
|
|
64
64
|
"node_modules",
|
|
65
65
|
".git",
|
|
66
|
-
".
|
|
66
|
+
".theokit",
|
|
67
67
|
"dist",
|
|
68
68
|
".env",
|
|
69
69
|
".env.*",
|
|
@@ -100,4 +100,4 @@ async function dockerCommand(options) {
|
|
|
100
100
|
export {
|
|
101
101
|
dockerCommand
|
|
102
102
|
};
|
|
103
|
-
//# sourceMappingURL=docker-
|
|
103
|
+
//# sourceMappingURL=docker-AZSJFLP2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/docker.ts"],"sourcesContent":["import { existsSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nfunction detectPkgManager(cwd: string): 'pnpm' | 'npm' | 'yarn' {\n if (existsSync(resolve(cwd, 'pnpm-lock.yaml'))) return 'pnpm'\n if (existsSync(resolve(cwd, 'yarn.lock'))) return 'yarn'\n return 'npm'\n}\n\nfunction generateDockerfile(pkgManager: 'pnpm' | 'npm' | 'yarn'): string {\n const installCmd = {\n pnpm: 'RUN corepack enable && pnpm install --frozen-lockfile',\n npm: 'RUN npm ci',\n yarn: 'RUN yarn install --frozen-lockfile',\n }[pkgManager]\n\n const lockfile = {\n pnpm: 'pnpm-lock.yaml',\n npm: 'package-lock.json',\n yarn: 'yarn.lock',\n }[pkgManager]\n\n const runBuild = {\n pnpm: 'RUN pnpm theo build',\n npm: 'RUN npx theo build',\n yarn: 'RUN yarn theo build',\n }[pkgManager]\n\n const startCmd = {\n pnpm: 'CMD [\"pnpm\", \"theo\", \"start\"]',\n npm: 'CMD [\"npx\", \"theo\", \"start\"]',\n yarn: 'CMD [\"yarn\", \"theo\", \"start\"]',\n }[pkgManager]\n\n return [\n '# Generated by Theo',\n '# Multi-stage build for production',\n '',\n '# Stage 1: Build',\n 'FROM node:22-alpine AS builder',\n 'WORKDIR /app',\n `COPY package.json ${lockfile} ./`,\n installCmd,\n 'COPY . .',\n runBuild,\n '',\n '# Stage 2: Production',\n 'FROM node:22-alpine AS runner',\n 'WORKDIR /app',\n 'ENV NODE_ENV=production',\n 'COPY --from=builder /app/.theokit ./.theokit',\n 'COPY --from=builder /app/server ./server',\n 'COPY --from=builder /app/theo.config.ts ./theo.config.ts',\n 'COPY --from=builder /app/package.json ./package.json',\n `COPY --from=builder /app/${lockfile} ./${lockfile}`,\n 'COPY --from=builder /app/node_modules ./node_modules',\n '',\n 'EXPOSE 3000',\n startCmd,\n '',\n ].join('\\n')\n}\n\nfunction generateDockerignore(): string {\n return [\n 'node_modules',\n '.git',\n '.theokit',\n 'dist',\n '.env',\n '.env.*',\n '!.env.example',\n '*.log',\n '.DS_Store',\n '.vscode',\n '.idea',\n 'Dockerfile',\n '.dockerignore',\n '',\n ].join('\\n')\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await -- CLI surface contract is async; sync today is implementation detail\nexport async function dockerCommand(options?: { force?: boolean }): Promise<void> {\n const cwd = process.cwd()\n const dockerfilePath = resolve(cwd, 'Dockerfile')\n const dockerignorePath = resolve(cwd, '.dockerignore')\n\n if (existsSync(dockerfilePath) && !options?.force) {\n console.log('\\n ⚠ Dockerfile already exists. Use --force to overwrite.\\n')\n return\n }\n\n const pkgManager = detectPkgManager(cwd)\n writeFileSync(dockerfilePath, generateDockerfile(pkgManager))\n writeFileSync(dockerignorePath, generateDockerignore())\n\n console.log(`\\n ✓ Generated Dockerfile (${pkgManager})`)\n console.log(` ✓ Generated .dockerignore`)\n console.log(`\\n Next steps:`)\n console.log(` docker build -t my-app .`)\n console.log(` docker run -p 3000:3000 my-app\\n`)\n}\n"],"mappings":";;;;;AAAA,SAAS,YAAY,qBAAqB;AAC1C,SAAS,eAAe;AAExB,SAAS,iBAAiB,KAAsC;AAC9D,MAAI,WAAW,QAAQ,KAAK,gBAAgB,CAAC,EAAG,QAAO;AACvD,MAAI,WAAW,QAAQ,KAAK,WAAW,CAAC,EAAG,QAAO;AAClD,SAAO;AACT;AAEA,SAAS,mBAAmB,YAA6C;AACvE,QAAM,aAAa;AAAA,IACjB,MAAM;AAAA,IACN,KAAK;AAAA,IACL,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;AAEtD,UAAQ,IAAI;AAAA,iCAA+B,UAAU,GAAG;AACxD,UAAQ,IAAI,kCAA6B;AACzC,UAAQ,IAAI;AAAA,cAAiB;AAC7B,UAAQ,IAAI,8BAA8B;AAC1C,UAAQ,IAAI;AAAA,CAAsC;AACpD;","names":[]}
|
|
@@ -331,7 +331,7 @@ declare function handleBatchRequest(payload: unknown, options: HandleBatchOption
|
|
|
331
331
|
/**
|
|
332
332
|
* T2.4 — Custom error pages loader.
|
|
333
333
|
*
|
|
334
|
-
* Loads optional `.
|
|
334
|
+
* Loads optional `.theokit/client/404.html` and `500.html` from disk so adapters
|
|
335
335
|
* (Node, CF, Vercel, Bun, Netlify, AWS Lambda, Deno) can pass them to the
|
|
336
336
|
* shared `sendError` pipeline.
|
|
337
337
|
*
|
|
@@ -344,7 +344,7 @@ interface CustomErrorPages {
|
|
|
344
344
|
custom500Html?: string;
|
|
345
345
|
}
|
|
346
346
|
/**
|
|
347
|
-
* Load `.
|
|
347
|
+
* Load `.theokit/client/{404,500}.html` from the given client directory.
|
|
348
348
|
* Returns object with both fields when present; missing pages remain undefined.
|
|
349
349
|
*/
|
|
350
350
|
declare function loadCustomErrorPages(clientDir: string): CustomErrorPages;
|
package/dist/index.d.ts
CHANGED
|
@@ -248,7 +248,7 @@ declare const theoConfigSchema: z.ZodObject<{
|
|
|
248
248
|
}, z.core.$strip>>>;
|
|
249
249
|
openapi: z.ZodOptional<z.ZodObject<{
|
|
250
250
|
servers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
251
|
-
url: z.
|
|
251
|
+
url: z.ZodURL;
|
|
252
252
|
description: z.ZodOptional<z.ZodString>;
|
|
253
253
|
}, z.core.$strip>>>;
|
|
254
254
|
specVersion: z.ZodDefault<z.ZodEnum<{
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
scanRoutes,
|
|
9
9
|
theoConfigSchema,
|
|
10
10
|
theoPlugin
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-X3VNROZ7.js";
|
|
12
12
|
import "./chunk-DNMSV3R3.js";
|
|
13
13
|
import "./chunk-7BIM27LV.js";
|
|
14
14
|
import "./chunk-PIVX3DYW.js";
|
|
@@ -17,13 +17,13 @@ import "./chunk-IAJ2JVEH.js";
|
|
|
17
17
|
import "./chunk-VMEWD57H.js";
|
|
18
18
|
import "./chunk-JQSKBMXP.js";
|
|
19
19
|
import "./chunk-OLPB36O2.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-P3SGM4NR.js";
|
|
21
21
|
import "./chunk-WSJKACWB.js";
|
|
22
22
|
import "./chunk-B3L3TJVF.js";
|
|
23
23
|
import "./chunk-C3ZZ56YZ.js";
|
|
24
24
|
import "./chunk-7MQOHNHE.js";
|
|
25
25
|
import "./chunk-X2VVCJ4V.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-KJLECZWQ.js";
|
|
27
27
|
import "./chunk-GY5Q27BJ.js";
|
|
28
28
|
import "./chunk-Z5IGLBWE.js";
|
|
29
29
|
import "./chunk-ZEGYW52B.js";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
loadConfig
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-DUKXQNM7.js";
|
|
6
|
+
import "./chunk-FGOX37NB.js";
|
|
7
|
+
import "./chunk-X32KQH5C.js";
|
|
8
8
|
import {
|
|
9
9
|
scanRoutes
|
|
10
10
|
} from "./chunk-CG563V5M.js";
|
|
@@ -101,4 +101,4 @@ export {
|
|
|
101
101
|
buildInfo,
|
|
102
102
|
infoCommand
|
|
103
103
|
};
|
|
104
|
-
//# sourceMappingURL=info-
|
|
104
|
+
//# sourceMappingURL=info-CORLCPEJ.js.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
nodeAdapter
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MWYSRZI4.js";
|
|
6
6
|
import {
|
|
7
7
|
assertServicesUnsupported,
|
|
8
8
|
readManifest
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-X32KQH5C.js";
|
|
10
10
|
import "./chunk-KT3MWNZG.js";
|
|
11
11
|
|
|
12
12
|
// src/adapters/netlify.ts
|
|
@@ -148,4 +148,4 @@ export {
|
|
|
148
148
|
netlifyAdapter,
|
|
149
149
|
renderNetlifyFunction
|
|
150
150
|
};
|
|
151
|
-
//# sourceMappingURL=netlify-
|
|
151
|
+
//# sourceMappingURL=netlify-O7G3RLK4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/netlify.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename --\n * Netlify deploy adapter. All paths derived from `cwd` and a fixed\n * `.theokit/netlify/` output layout. Build-time tool — no HTTP input.\n */\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nimport type { TheoConfig } from '../config/schema.js'\nimport { assertServicesUnsupported, readManifest } from '../services/index.js'\n\nimport { nodeAdapter } from './node.js'\nimport type { AdapterBuildContext, DeployAdapter } from './types.js'\n\nexport class NetlifyConflictError extends Error {\n constructor(path: string, currentTo: string) {\n super(\n `netlify.toml has a conflicting redirect: \"${path}\" → \"${currentTo}\". ` +\n `Remove it manually or edit it to point to \"/.netlify/functions/theo\" ` +\n `before running the Netlify adapter again.`,\n )\n this.name = 'NetlifyConflictError'\n }\n}\n\nexport interface NetlifyBuildDeps {\n runNodeBuild?: (config: TheoConfig, cwd: string, ctx?: AdapterBuildContext) => Promise<void>\n writeFile?: (path: string, content: string) => void\n ensureDir?: (path: string) => void\n readTomlIfExists?: () => string | null\n}\n\nexport function renderNetlifyFunction(): string {\n return [\n `// Generated by Theo — Netlify Functions adapter`,\n `import { resolve } from 'node:path'`,\n `import { randomUUID } from 'node:crypto'`,\n `import { scanServerRoutes, matchRoute, executeRoute, createProductionLoader } from 'theokit/server'`,\n `import { createWebShim } from 'theokit/adapters/web-shim'`,\n ``,\n `const cwd = process.cwd()`,\n `const serverDir = resolve(cwd, 'server')`,\n `let routesCache = null`,\n `let loaderCache = null`,\n ``,\n `export default async (request, context) => {`,\n ` const url = new URL(request.url)`,\n ` if (!url.pathname.startsWith('/api/')) {`,\n ` return new Response('Not Found', { status: 404 })`,\n ` }`,\n ``,\n ` if (!routesCache) routesCache = scanServerRoutes(serverDir)`,\n ` if (!loaderCache) loaderCache = createProductionLoader()`,\n ``,\n ` const match = matchRoute(url.pathname, routesCache)`,\n ` if (!match) {`,\n ` return new Response(JSON.stringify({ error: { code: 'NOT_FOUND' } }), {`,\n ` status: 404,`,\n ` headers: { 'content-type': 'application/json' },`,\n ` })`,\n ` }`,\n ``,\n ` const { req, res, toResponse } = createWebShim(request)`,\n ` const requestId = randomUUID()`,\n ` const method = request.method.toUpperCase()`,\n ` await executeRoute({ route: match.route, method, params: match.params, req, res, loadModule: loaderCache, serverDir, requestId })`,\n ` return toResponse()`,\n `}`,\n ].join('\\n')\n}\n\nconst THEO_REDIRECT_FROM = '/api/*'\nconst THEO_REDIRECT_TO = '/.netlify/functions/theo'\n\n/**\n * TOML merge (EC-2) — non-destructive.\n *\n * We avoid adding a TOML parser dependency by working at the line level. The\n * supported subset is sufficient for the Netlify use case:\n * - detect existing `[[redirects]]` blocks\n * - find a block whose `from = \"...\"` matches our target\n * - error if such a block points elsewhere\n * - otherwise append our block\n *\n * Unknown sections (e.g. `[build]`, `[[headers]]`, `[context.production.environment]`)\n * are preserved as-is.\n */\ninterface NetlifyRedirectBlock {\n startLine: number\n endLine: number\n from?: string\n to?: string\n}\n\nfunction parseRedirectBlocks(lines: readonly string[]): NetlifyRedirectBlock[] {\n const blocks: NetlifyRedirectBlock[] = []\n let current: NetlifyRedirectBlock | null = null\n\n for (let i = 0; i < lines.length; i++) {\n const trimmed = lines[i].trim()\n if (trimmed === '[[redirects]]') {\n if (current) {\n current.endLine = i - 1\n blocks.push(current)\n }\n current = { startLine: i, endLine: i }\n continue\n }\n if (current && /^\\[(\\[|[^[])/.test(trimmed)) {\n // Entering another section — close current.\n current.endLine = i - 1\n blocks.push(current)\n current = null\n }\n if (current) {\n const fromMatch = /^from\\s*=\\s*\"([^\"]+)\"/.exec(trimmed)\n if (fromMatch) current.from = fromMatch[1]\n const toMatch = /^to\\s*=\\s*\"([^\"]+)\"/.exec(trimmed)\n if (toMatch) current.to = toMatch[1]\n current.endLine = i\n }\n }\n if (current) blocks.push(current)\n return blocks\n}\n\nconst THEO_REDIRECT_TARGET = [\n '[[redirects]]',\n ' from = \"/api/*\"',\n ' to = \"/.netlify/functions/theo\"',\n ' status = 200',\n ' force = true',\n].join('\\n')\n\nexport function mergeNetlifyToml(existing: string | null): string {\n if (existing === null || existing.trim().length === 0) {\n return `${THEO_REDIRECT_TARGET}\\n`\n }\n\n const blocks = parseRedirectBlocks(existing.split(/\\r?\\n/))\n\n // Detect conflict: every `/api/*` block must point at our function.\n for (const b of blocks) {\n if (b.from !== THEO_REDIRECT_FROM) continue\n if (b.to === THEO_REDIRECT_TO) {\n // Already merged — return existing as-is (idempotent).\n return existing.endsWith('\\n') ? existing : `${existing}\\n`\n }\n throw new NetlifyConflictError(b.from, b.to ?? '(unknown)')\n }\n\n // No conflict — append target block.\n const sep = existing.endsWith('\\n') ? '' : '\\n'\n return `${existing}${sep}\\n${THEO_REDIRECT_TARGET}\\n`\n}\n\nexport async function buildNetlify(\n config: TheoConfig,\n cwd: string,\n deps: NetlifyBuildDeps = {},\n ctx?: AdapterBuildContext,\n): Promise<void> {\n // Wave 2 (T2.2) — reject polyglot services on this adapter.\n assertServicesUnsupported('netlify', readManifest(cwd))\n\n const runNodeBuild = deps.runNodeBuild ?? nodeAdapter.build.bind(nodeAdapter)\n await runNodeBuild(config, cwd, ctx)\n\n const ensureDir = deps.ensureDir ?? ((p: string) => mkdirSync(p, { recursive: true }))\n const writeFile =\n deps.writeFile ??\n ((p, c) => {\n writeFileSync(p, c)\n })\n const readTomlIfExists =\n deps.readTomlIfExists ??\n (() => {\n const p = resolve(cwd, 'netlify.toml')\n return existsSync(p) ? readFileSync(p, 'utf-8') : null\n })\n\n const fnDir = resolve(cwd, '.netlify/functions')\n ensureDir(fnDir)\n writeFile(resolve(fnDir, 'theo.mjs'), renderNetlifyFunction())\n\n const existingToml = readTomlIfExists()\n const merged = mergeNetlifyToml(existingToml)\n writeFile(resolve(cwd, 'netlify.toml'), merged)\n\n // eslint-disable-next-line no-console -- CLI build progress\n console.log('\\n ✓ Netlify output → .netlify/functions/theo.mjs + netlify.toml\\n')\n}\n\nexport const netlifyAdapter: DeployAdapter = {\n name: 'netlify',\n build(config, cwd, ctx) {\n return buildNetlify(config, cwd, {}, ctx)\n },\n}\n"],"mappings":";;;;;;;;;;;;AAIA,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,eAAe;AAQjB,IAAM,uBAAN,cAAmC,MAAM;AAAA,EAC9C,YAAY,MAAc,WAAmB;AAC3C;AAAA,MACE,6CAA6C,IAAI,aAAQ,SAAS;AAAA,IAGpE;AACA,SAAK,OAAO;AAAA,EACd;AACF;AASO,SAAS,wBAAgC;AAC9C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;A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js";
|
|
6
|
+
import "./chunk-X32KQH5C.js";
|
|
7
7
|
import "./chunk-KT3MWNZG.js";
|
|
8
8
|
export {
|
|
9
9
|
nodeAdapter
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=node-
|
|
11
|
+
//# sourceMappingURL=node-LXPQLMVB.js.map
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
loadConfig
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-DUKXQNM7.js";
|
|
6
|
+
import "./chunk-FGOX37NB.js";
|
|
7
|
+
import "./chunk-X32KQH5C.js";
|
|
8
8
|
import {
|
|
9
9
|
emitOpenApi,
|
|
10
10
|
loadRoutesForOpenApi
|
|
11
11
|
} from "./chunk-WGHJD6I7.js";
|
|
12
12
|
import {
|
|
13
13
|
generateManifest
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-HDA6M7P4.js";
|
|
15
|
+
import "./chunk-P2RS3WWY.js";
|
|
16
|
+
import "./chunk-UVHRD33F.js";
|
|
17
17
|
import "./chunk-KT3MWNZG.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/commands/openapi.ts
|
|
@@ -81,4 +81,4 @@ function emitOpenApiInMemory(manifest, config) {
|
|
|
81
81
|
export {
|
|
82
82
|
openapiCommand
|
|
83
83
|
};
|
|
84
|
-
//# sourceMappingURL=openapi-
|
|
84
|
+
//# sourceMappingURL=openapi-TEOUOIJ2.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "tsx/esm";
|
|
3
|
+
import "./chunk-KT3MWNZG.js";
|
|
4
|
+
|
|
5
|
+
// src/adapters/registry.ts
|
|
6
|
+
var adapterRegistry = {
|
|
7
|
+
node: async () => (await import("./node-LXPQLMVB.js")).nodeAdapter,
|
|
8
|
+
vercel: async () => (await import("./vercel-GSFDMF7K.js")).vercelAdapter,
|
|
9
|
+
cloudflare: async () => (await import("./cloudflare-IZ6VJ2OU.js")).cloudflareAdapter,
|
|
10
|
+
static: async () => (await import("./static-EO73I4C7.js")).staticAdapter,
|
|
11
|
+
bun: async () => (await import("./bun-FURRCQMS.js")).bunAdapter,
|
|
12
|
+
"deno-deploy": async () => (await import("./deno-deploy-O73NBXIW.js")).denoDeployAdapter,
|
|
13
|
+
netlify: async () => (await import("./netlify-O7G3RLK4.js")).netlifyAdapter,
|
|
14
|
+
"aws-lambda": async () => (await import("./aws-lambda-SCRGTGF5.js")).awsLambdaAdapter,
|
|
15
|
+
"theo-cloud": async () => (await import("./theo-cloud-HBCYEODQ.js")).theoCloudAdapter
|
|
16
|
+
};
|
|
17
|
+
async function resolveAdapter(target) {
|
|
18
|
+
const factory = adapterRegistry[target];
|
|
19
|
+
return factory();
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
adapterRegistry,
|
|
23
|
+
resolveAdapter
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=registry-KW4F4D2L.js.map
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
} from "./chunk-XMS5VRIK.js";
|
|
6
6
|
import {
|
|
7
7
|
loadConfig
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-DUKXQNM7.js";
|
|
9
|
+
import "./chunk-FGOX37NB.js";
|
|
10
|
+
import "./chunk-X32KQH5C.js";
|
|
11
11
|
import {
|
|
12
12
|
scanServerRoutes,
|
|
13
13
|
scanWebSocketRoutes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-P2RS3WWY.js";
|
|
15
15
|
import {
|
|
16
16
|
scanServerActions
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-UVHRD33F.js";
|
|
18
18
|
import "./chunk-KT3MWNZG.js";
|
|
19
19
|
|
|
20
20
|
// src/cli/commands/routes.ts
|
|
@@ -63,4 +63,4 @@ async function routesCommand() {
|
|
|
63
63
|
export {
|
|
64
64
|
routesCommand
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=routes-
|
|
66
|
+
//# sourceMappingURL=routes-GAXVWJUK.js.map
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
storageSchema,
|
|
13
13
|
theoConfigSchema,
|
|
14
14
|
uploadSchema
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-FGOX37NB.js";
|
|
16
|
+
import "./chunk-X32KQH5C.js";
|
|
17
17
|
import "./chunk-KT3MWNZG.js";
|
|
18
18
|
export {
|
|
19
19
|
cacheSchema,
|
|
@@ -28,4 +28,4 @@ export {
|
|
|
28
28
|
theoConfigSchema,
|
|
29
29
|
uploadSchema
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=schema-
|
|
31
|
+
//# sourceMappingURL=schema-Z5VJ2I76.js.map
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
translateCronToVercel,
|
|
14
14
|
validateCronSchedule,
|
|
15
15
|
writeCronManifest
|
|
16
|
-
} from "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
16
|
+
} from "../../chunk-IZQN5CDS.js";
|
|
17
|
+
import "../../chunk-YB5DJJ4U.js";
|
|
18
18
|
import "../../chunk-6NEXVBPY.js";
|
|
19
19
|
import "../../chunk-7MQOHNHE.js";
|
|
20
20
|
import "../../chunk-X2VVCJ4V.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BATCH_PATH, a as BatchExecuteFn, b as BatchPathConflictError, c as BatchPayload, d as BatchRequestItem, e as BatchResponse, f as BatchResultItem, C as CookieOptions, g as CorsConfig, h as CorsHandler, i as CorsOrigin, j as CorsWebHandler, k as CustomErrorPages, E as ExecuteActionOptions, l as ExecuteRouteContext, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, m as MiddlewareResult, S as STRIPPED_HEADERS, n as SendErrorInput, o as SendErrorOptions, T as TRACE_HEADER, p as TRACE_PARENT_HEADER, _ as _resetMiddlewareCacheForTests, r as appendCookieToHeaders, s as appendDeleteCookieToHeaders, t as createCorsHandler, u as createCorsWebHandler, v as deleteCookie, w as executeAction, x as executeRoute, y as extractTraceId, z as extractTraceIdFromRequest, A as getCookie, D as getCookieFromRequest, F as handleBatchRequest, I as loadCustomErrorPages, J as matchesOrigin, K as parseCookieHeader, L as parseTraceparent, O as runMiddlewareAndContext, P as sendError, Q as sendJson, R as serializeCookie, U as serveStaticFile, V as setCookie } from '../../index-
|
|
1
|
+
export { B as BATCH_PATH, a as BatchExecuteFn, b as BatchPathConflictError, c as BatchPayload, d as BatchRequestItem, e as BatchResponse, f as BatchResultItem, C as CookieOptions, g as CorsConfig, h as CorsHandler, i as CorsOrigin, j as CorsWebHandler, k as CustomErrorPages, E as ExecuteActionOptions, l as ExecuteRouteContext, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, m as MiddlewareResult, S as STRIPPED_HEADERS, n as SendErrorInput, o as SendErrorOptions, T as TRACE_HEADER, p as TRACE_PARENT_HEADER, _ as _resetMiddlewareCacheForTests, r as appendCookieToHeaders, s as appendDeleteCookieToHeaders, t as createCorsHandler, u as createCorsWebHandler, v as deleteCookie, w as executeAction, x as executeRoute, y as extractTraceId, z as extractTraceIdFromRequest, A as getCookie, D as getCookieFromRequest, F as handleBatchRequest, I as loadCustomErrorPages, J as matchesOrigin, K as parseCookieHeader, L as parseTraceparent, O as runMiddlewareAndContext, P as sendError, Q as sendJson, R as serializeCookie, U as serveStaticFile, V as setCookie } from '../../index-CuHICqb9.js';
|
|
2
2
|
import 'node:http';
|
|
3
3
|
import '../../job-backend-CgC8Xf33.js';
|
|
4
4
|
import '../../plugin-runner-BGBkzgi0.js';
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
MAX_ERROR_HTML_BYTES,
|
|
3
3
|
loadCustomErrorPages,
|
|
4
4
|
serveStaticFile
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-3IOFTG3L.js";
|
|
6
6
|
import {
|
|
7
7
|
BATCH_PATH,
|
|
8
8
|
BatchPathConflictError,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
runMiddlewareAndContext,
|
|
23
23
|
sendError,
|
|
24
24
|
sendJson
|
|
25
|
-
} from "../../chunk-
|
|
25
|
+
} from "../../chunk-KJLECZWQ.js";
|
|
26
26
|
import "../../chunk-GY5Q27BJ.js";
|
|
27
27
|
import "../../chunk-Z5IGLBWE.js";
|
|
28
28
|
import "../../chunk-ZEGYW52B.js";
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RouteConfig } from './define/index.js';
|
|
2
2
|
export { ActionAccept, ActionConfig, AgentEndpointConfig, AgentEndpointHandlerArgs, ChannelHandler, CustomTool, DefineAgentToolSpec, MiddlewareHandler, WebChannelHandler, defineAction, defineAgentEndpoint, defineAgentTool, defineChannel, defineMiddleware, defineRoute, defineTheoPlugin, defineWebChannel } from './define/index.js';
|
|
3
3
|
export { W as WebSocketHandler, a as WebSocketHandlerWeb, b as WebSocketLike, d as defineWebSocket, c as defineWebSocketWeb } from '../define-websocket-CdK94O-D.js';
|
|
4
|
-
export { B as BATCH_PATH, a as BatchExecuteFn, b as BatchPathConflictError, c as BatchPayload, d as BatchRequestItem, e as BatchResponse, f as BatchResultItem, C as CookieOptions, g as CorsConfig, h as CorsHandler, i as CorsOrigin, j as CorsWebHandler, k as CustomErrorPages, E as ExecuteActionOptions, l as ExecuteRouteContext, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, m as MiddlewareResult, S as STRIPPED_HEADERS, n as SendErrorInput, o as SendErrorOptions, T as TRACE_HEADER, p as TRACE_PARENT_HEADER, q as TheoTransformer, _ as _resetMiddlewareCacheForTests, r as appendCookieToHeaders, s as appendDeleteCookieToHeaders, t as createCorsHandler, u as createCorsWebHandler, v as deleteCookie, w as executeAction, x as executeRoute, y as extractTraceId, z as extractTraceIdFromRequest, A as getCookie, D as getCookieFromRequest, F as handleBatchRequest, G as jsonTransformer, I as loadCustomErrorPages, J as matchesOrigin, K as parseCookieHeader, L as parseTraceparent, N as resolveTransformer, O as runMiddlewareAndContext, P as sendError, Q as sendJson, R as serializeCookie, U as serveStaticFile, V as setCookie, W as superjsonTransformer } from '../index-
|
|
4
|
+
export { B as BATCH_PATH, a as BatchExecuteFn, b as BatchPathConflictError, c as BatchPayload, d as BatchRequestItem, e as BatchResponse, f as BatchResultItem, C as CookieOptions, g as CorsConfig, h as CorsHandler, i as CorsOrigin, j as CorsWebHandler, k as CustomErrorPages, E as ExecuteActionOptions, l as ExecuteRouteContext, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, m as MiddlewareResult, S as STRIPPED_HEADERS, n as SendErrorInput, o as SendErrorOptions, T as TRACE_HEADER, p as TRACE_PARENT_HEADER, q as TheoTransformer, _ as _resetMiddlewareCacheForTests, r as appendCookieToHeaders, s as appendDeleteCookieToHeaders, t as createCorsHandler, u as createCorsWebHandler, v as deleteCookie, w as executeAction, x as executeRoute, y as extractTraceId, z as extractTraceIdFromRequest, A as getCookie, D as getCookieFromRequest, F as handleBatchRequest, G as jsonTransformer, I as loadCustomErrorPages, J as matchesOrigin, K as parseCookieHeader, L as parseTraceparent, N as resolveTransformer, O as runMiddlewareAndContext, P as sendError, Q as sendJson, R as serializeCookie, U as serveStaticFile, V as setCookie, W as superjsonTransformer } from '../index-CuHICqb9.js';
|
|
5
5
|
export { ActionNode, ActionScanError, LoadedManifest, ManifestAction, ManifestRoute, ManifestWebSocket, TheoManifest, WebSocketRouteNode, generateManifest, loadManifest, scanMiddlewares, scanServerActions, scanServerActionsEnriched, scanServerRoutes, scanWebSocketRoutes, writeManifest } from './scan/index.js';
|
|
6
6
|
export { L as LoadModule, S as ServerRouteNode, c as compilePattern, a as createProductionLoader, b as createViteLoader, m as matchRoute } from '../module-loader-Cfz7dgCP.js';
|
|
7
7
|
import { T as TheoErrorEnvelope, a as TheoErrorCode, V as ValidationFieldsExt } from '../error-envelope-BsNzzAV5.js';
|
|
@@ -186,7 +186,7 @@ type SerializedActionResult = {
|
|
|
186
186
|
};
|
|
187
187
|
/**
|
|
188
188
|
* `ActionManifestEntry` — per-action metadata emitted by `action-scan.ts`
|
|
189
|
-
* (T1.4) into `.
|
|
189
|
+
* (T1.4) into `.theokit/actions-manifest.json`. Consumed by virtual module
|
|
190
190
|
* `@theo/actions` (T3.1) and G4 devtools "Actions" tab (T5.1).
|
|
191
191
|
*/
|
|
192
192
|
interface ActionManifestEntry {
|
|
@@ -202,7 +202,7 @@ interface OpenApiDocsOptions {
|
|
|
202
202
|
docsPath?: string;
|
|
203
203
|
/** Path to serve the JSON spec (default: '/api/docs/openapi.json'). */
|
|
204
204
|
openapiJsonPath?: string;
|
|
205
|
-
/** Path to the spec file on disk (default: '.
|
|
205
|
+
/** Path to the spec file on disk (default: '.theokit/openapi.json'). */
|
|
206
206
|
specFilePath?: string;
|
|
207
207
|
/** Page title (default: 'API Reference'). */
|
|
208
208
|
pageTitle?: string;
|
package/dist/server/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
defineJob,
|
|
21
21
|
scanJobs,
|
|
22
22
|
writeJobManifest
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-GUUWDMR2.js";
|
|
24
24
|
import {
|
|
25
25
|
ConsoleObservabilityAdapter,
|
|
26
26
|
NoopObservabilityAdapter,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
generateManifest,
|
|
49
49
|
loadManifest,
|
|
50
50
|
writeManifest
|
|
51
|
-
} from "../chunk-
|
|
51
|
+
} from "../chunk-GPF64ENM.js";
|
|
52
52
|
import "../chunk-JHEAWR3L.js";
|
|
53
53
|
import {
|
|
54
54
|
StorageManager,
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
ActionScanError,
|
|
94
94
|
scanServerActions,
|
|
95
95
|
scanServerActionsEnriched
|
|
96
|
-
} from "../chunk-
|
|
96
|
+
} from "../chunk-P3SGM4NR.js";
|
|
97
97
|
import "../chunk-WSJKACWB.js";
|
|
98
98
|
import {
|
|
99
99
|
CSP_REPORT_PATH,
|
|
@@ -165,8 +165,8 @@ import {
|
|
|
165
165
|
translateCronToVercel,
|
|
166
166
|
validateCronSchedule,
|
|
167
167
|
writeCronManifest
|
|
168
|
-
} from "../chunk-
|
|
169
|
-
import "../chunk-
|
|
168
|
+
} from "../chunk-IZQN5CDS.js";
|
|
169
|
+
import "../chunk-YB5DJJ4U.js";
|
|
170
170
|
import "../chunk-6NEXVBPY.js";
|
|
171
171
|
import "../chunk-7MQOHNHE.js";
|
|
172
172
|
import "../chunk-X2VVCJ4V.js";
|
|
@@ -186,7 +186,7 @@ import {
|
|
|
186
186
|
MAX_ERROR_HTML_BYTES,
|
|
187
187
|
loadCustomErrorPages,
|
|
188
188
|
serveStaticFile
|
|
189
|
-
} from "../chunk-
|
|
189
|
+
} from "../chunk-3IOFTG3L.js";
|
|
190
190
|
import {
|
|
191
191
|
ActionError,
|
|
192
192
|
ActionInputError,
|
|
@@ -211,7 +211,7 @@ import {
|
|
|
211
211
|
runMiddlewareAndContext,
|
|
212
212
|
sendError,
|
|
213
213
|
sendJson
|
|
214
|
-
} from "../chunk-
|
|
214
|
+
} from "../chunk-KJLECZWQ.js";
|
|
215
215
|
import {
|
|
216
216
|
DuplicateContextKeyError,
|
|
217
217
|
createOutbox,
|
|
@@ -266,7 +266,7 @@ var DEFAULT_CDN = "https://cdn.jsdelivr.net/npm/@scalar/api-reference";
|
|
|
266
266
|
function createOpenApiHandler(opts = {}) {
|
|
267
267
|
const docsPath = opts.docsPath ?? "/api/docs";
|
|
268
268
|
const jsonPath = opts.openapiJsonPath ?? "/api/docs/openapi.json";
|
|
269
|
-
const specFile = resolve(opts.specFilePath ?? ".
|
|
269
|
+
const specFile = resolve(opts.specFilePath ?? ".theokit/openapi.json");
|
|
270
270
|
const title = opts.pageTitle ?? "API Reference";
|
|
271
271
|
const cdn = opts.cdnUrl ?? DEFAULT_CDN;
|
|
272
272
|
if (specFile.includes("..")) {
|
|
@@ -311,14 +311,20 @@ function renderScalarHtml(title, specUrl, cdnUrl) {
|
|
|
311
311
|
function serveSpecFile(filePath) {
|
|
312
312
|
if (!existsSync(filePath)) {
|
|
313
313
|
return jsonResponse(503, {
|
|
314
|
-
error: {
|
|
314
|
+
error: {
|
|
315
|
+
code: "OPENAPI_NOT_EMITTED",
|
|
316
|
+
message: "OpenAPI spec not generated yet. Start the dev server and visit a route first."
|
|
317
|
+
}
|
|
315
318
|
});
|
|
316
319
|
}
|
|
317
320
|
try {
|
|
318
321
|
const stat = statSync(filePath);
|
|
319
322
|
if (stat.size > MAX_SPEC_BYTES) {
|
|
320
323
|
return jsonResponse(413, {
|
|
321
|
-
error: {
|
|
324
|
+
error: {
|
|
325
|
+
code: "OPENAPI_TOO_LARGE",
|
|
326
|
+
message: `Spec file exceeds ${MAX_SPEC_BYTES / 1024 / 1024}MB limit`
|
|
327
|
+
}
|
|
322
328
|
});
|
|
323
329
|
}
|
|
324
330
|
const content = readFileSync(filePath, "utf-8");
|
|
@@ -327,8 +333,9 @@ function serveSpecFile(filePath) {
|
|
|
327
333
|
headers: { "content-type": "application/json", "cache-control": "no-cache" }
|
|
328
334
|
});
|
|
329
335
|
} catch (err) {
|
|
336
|
+
const message = err instanceof Error ? err.message : "Failed to read OpenAPI spec file";
|
|
330
337
|
return jsonResponse(500, {
|
|
331
|
-
error: { code: "OPENAPI_READ_FAILED", message
|
|
338
|
+
error: { code: "OPENAPI_READ_FAILED", message }
|
|
332
339
|
});
|
|
333
340
|
}
|
|
334
341
|
}
|