theokit 0.5.4 → 0.6.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.
Files changed (114) hide show
  1. package/dist/{aws-lambda-SCRGTGF5.js → aws-lambda-WT4HRBNL.js} +3 -3
  2. package/dist/{build-R74EU6BP.js → build-ZZAQV2ES.js} +7 -7
  3. package/dist/{bun-FURRCQMS.js → bun-UTDVN6R4.js} +3 -3
  4. package/dist/{check-NXYPLM6M.js → check-F3UDYSZ4.js} +2 -2
  5. package/dist/{chunk-KJLECZWQ.js → chunk-3FYJ7R7N.js} +57 -14
  6. package/dist/chunk-3FYJ7R7N.js.map +1 -0
  7. package/dist/{chunk-JD7AQNJS.js → chunk-4NLIESWK.js} +18 -12
  8. package/dist/{chunk-JD7AQNJS.js.map → chunk-4NLIESWK.js.map} +1 -1
  9. package/dist/{chunk-H4J2LECY.js → chunk-6BUUZ2PK.js} +9 -9
  10. package/dist/chunk-6BUUZ2PK.js.map +1 -0
  11. package/dist/{chunk-FGOX37NB.js → chunk-BNGBG2SQ.js} +21 -2
  12. package/dist/chunk-BNGBG2SQ.js.map +1 -0
  13. package/dist/{chunk-X32KQH5C.js → chunk-CCVC6P6B.js} +3 -3
  14. package/dist/chunk-CCVC6P6B.js.map +1 -0
  15. package/dist/{chunk-S74FECKW.js → chunk-D4SV7JOG.js} +24 -20
  16. package/dist/chunk-D4SV7JOG.js.map +1 -0
  17. package/dist/{chunk-DNMSV3R3.js → chunk-D7ZH7DTG.js} +3 -3
  18. package/dist/chunk-D7ZH7DTG.js.map +1 -0
  19. package/dist/{chunk-MWYSRZI4.js → chunk-EQV67HZL.js} +2 -2
  20. package/dist/{chunk-CG563V5M.js → chunk-IEES3CHD.js} +39 -5
  21. package/dist/chunk-IEES3CHD.js.map +1 -0
  22. package/dist/{chunk-DUKXQNM7.js → chunk-IHMJV2OK.js} +2 -2
  23. package/dist/{chunk-WGHJD6I7.js → chunk-JAIKGP3Q.js} +76 -21
  24. package/dist/chunk-JAIKGP3Q.js.map +1 -0
  25. package/dist/{chunk-NZXH2LQQ.js → chunk-SJIRP73B.js} +18 -1
  26. package/dist/chunk-SJIRP73B.js.map +1 -0
  27. package/dist/{chunk-X3VNROZ7.js → chunk-SVSUUK4H.js} +73 -14
  28. package/dist/chunk-SVSUUK4H.js.map +1 -0
  29. package/dist/cli/index.js +25 -10
  30. package/dist/cli/index.js.map +1 -1
  31. package/dist/{cloudflare-IZ6VJ2OU.js → cloudflare-U5GYYI47.js} +3 -3
  32. package/dist/db-ZPDW3UCU.js +78 -0
  33. package/dist/db-ZPDW3UCU.js.map +1 -0
  34. package/dist/{deno-deploy-O73NBXIW.js → deno-deploy-3QHJ3AJQ.js} +3 -3
  35. package/dist/{dev-ZU46C5AZ.js → dev-MHCQ5RD7.js} +16 -8
  36. package/dist/dev-MHCQ5RD7.js.map +1 -0
  37. package/dist/{dev-emit-66FCOS7V.js → dev-emit-4WG3B5BM.js} +2 -2
  38. package/dist/{dev-emit-JBVINGHU.js → dev-emit-6DJUK6DT.js} +76 -21
  39. package/dist/dev-emit-6DJUK6DT.js.map +1 -0
  40. package/dist/devtools/entry.js +1 -0
  41. package/dist/devtools/entry.js.map +1 -1
  42. package/dist/generate-ODDAYXNR.js +494 -0
  43. package/dist/generate-ODDAYXNR.js.map +1 -0
  44. package/dist/index.d.ts +32 -3
  45. package/dist/index.js +3 -4
  46. package/dist/index.js.map +1 -1
  47. package/dist/{info-CORLCPEJ.js → info-CSGWIAXA.js} +5 -5
  48. package/dist/{netlify-O7G3RLK4.js → netlify-DUB7BZ4E.js} +3 -3
  49. package/dist/{node-LXPQLMVB.js → node-ELE236WK.js} +3 -3
  50. package/dist/{openapi-TEOUOIJ2.js → openapi-KSY272CW.js} +5 -5
  51. package/dist/registry-B7FA6KMI.js +25 -0
  52. package/dist/{routes-GAXVWJUK.js → routes-NWJA5L5I.js} +4 -4
  53. package/dist/{scan-NQFI5S7P.js → scan-I5PT6TUX.js} +2 -2
  54. package/dist/{schema-D3v8VB7o.d.ts → schema-BpH6ivDY.d.ts} +2 -4
  55. package/dist/{schema-Z5VJ2I76.js → schema-NPI4NJEF.js} +3 -3
  56. package/dist/server/auth/index.js +3 -5
  57. package/dist/server/define/index.d.ts +7 -0
  58. package/dist/server/define/index.js +1 -1
  59. package/dist/server/http/index.js +1 -2
  60. package/dist/server/index.d.ts +34 -1
  61. package/dist/server/index.js +57 -48
  62. package/dist/server/index.js.map +1 -1
  63. package/dist/{services-typed-client-ASZL7FQV.js → services-typed-client-24VBMDOF.js} +2 -2
  64. package/dist/{services-typed-client-KK6RHRDG.js → services-typed-client-IETY2SAK.js} +2 -2
  65. package/dist/{start-HGUNNF5X.js → start-OAAAQ7Z4.js} +84 -69
  66. package/dist/start-OAAAQ7Z4.js.map +1 -0
  67. package/dist/{static-EO73I4C7.js → static-YWF2M6YT.js} +4 -4
  68. package/dist/{theo-cloud-HBCYEODQ.js → theo-cloud-EUK56I7O.js} +2 -2
  69. package/dist/{vercel-GSFDMF7K.js → vercel-LGDQWYZD.js} +3 -3
  70. package/dist/vite-plugin/index.d.ts +1 -1
  71. package/dist/vite-plugin/index.js +3 -4
  72. package/dist/{vite-plugin-TX5H4MB6.js → vite-plugin-IF2O6BJV.js} +7 -7
  73. package/package.json +4 -1
  74. package/dist/chunk-4HBI7DHP.js +0 -20
  75. package/dist/chunk-4HBI7DHP.js.map +0 -1
  76. package/dist/chunk-CG563V5M.js.map +0 -1
  77. package/dist/chunk-DNMSV3R3.js.map +0 -1
  78. package/dist/chunk-FGOX37NB.js.map +0 -1
  79. package/dist/chunk-H4J2LECY.js.map +0 -1
  80. package/dist/chunk-KJLECZWQ.js.map +0 -1
  81. package/dist/chunk-NZXH2LQQ.js.map +0 -1
  82. package/dist/chunk-S74FECKW.js.map +0 -1
  83. package/dist/chunk-WGHJD6I7.js.map +0 -1
  84. package/dist/chunk-X32KQH5C.js.map +0 -1
  85. package/dist/chunk-X3VNROZ7.js.map +0 -1
  86. package/dist/dev-ZU46C5AZ.js.map +0 -1
  87. package/dist/dev-emit-JBVINGHU.js.map +0 -1
  88. package/dist/generate-AZ2K6Z2Z.js +0 -281
  89. package/dist/generate-AZ2K6Z2Z.js.map +0 -1
  90. package/dist/registry-KW4F4D2L.js +0 -25
  91. package/dist/start-HGUNNF5X.js.map +0 -1
  92. /package/dist/{aws-lambda-SCRGTGF5.js.map → aws-lambda-WT4HRBNL.js.map} +0 -0
  93. /package/dist/{build-R74EU6BP.js.map → build-ZZAQV2ES.js.map} +0 -0
  94. /package/dist/{bun-FURRCQMS.js.map → bun-UTDVN6R4.js.map} +0 -0
  95. /package/dist/{check-NXYPLM6M.js.map → check-F3UDYSZ4.js.map} +0 -0
  96. /package/dist/{chunk-MWYSRZI4.js.map → chunk-EQV67HZL.js.map} +0 -0
  97. /package/dist/{chunk-DUKXQNM7.js.map → chunk-IHMJV2OK.js.map} +0 -0
  98. /package/dist/{cloudflare-IZ6VJ2OU.js.map → cloudflare-U5GYYI47.js.map} +0 -0
  99. /package/dist/{deno-deploy-O73NBXIW.js.map → deno-deploy-3QHJ3AJQ.js.map} +0 -0
  100. /package/dist/{dev-emit-66FCOS7V.js.map → dev-emit-4WG3B5BM.js.map} +0 -0
  101. /package/dist/{info-CORLCPEJ.js.map → info-CSGWIAXA.js.map} +0 -0
  102. /package/dist/{netlify-O7G3RLK4.js.map → netlify-DUB7BZ4E.js.map} +0 -0
  103. /package/dist/{node-LXPQLMVB.js.map → node-ELE236WK.js.map} +0 -0
  104. /package/dist/{openapi-TEOUOIJ2.js.map → openapi-KSY272CW.js.map} +0 -0
  105. /package/dist/{registry-KW4F4D2L.js.map → registry-B7FA6KMI.js.map} +0 -0
  106. /package/dist/{routes-GAXVWJUK.js.map → routes-NWJA5L5I.js.map} +0 -0
  107. /package/dist/{scan-NQFI5S7P.js.map → scan-I5PT6TUX.js.map} +0 -0
  108. /package/dist/{schema-Z5VJ2I76.js.map → schema-NPI4NJEF.js.map} +0 -0
  109. /package/dist/{services-typed-client-ASZL7FQV.js.map → services-typed-client-24VBMDOF.js.map} +0 -0
  110. /package/dist/{services-typed-client-KK6RHRDG.js.map → services-typed-client-IETY2SAK.js.map} +0 -0
  111. /package/dist/{static-EO73I4C7.js.map → static-YWF2M6YT.js.map} +0 -0
  112. /package/dist/{theo-cloud-HBCYEODQ.js.map → theo-cloud-EUK56I7O.js.map} +0 -0
  113. /package/dist/{vercel-GSFDMF7K.js.map → vercel-LGDQWYZD.js.map} +0 -0
  114. /package/dist/{vite-plugin-TX5H4MB6.js.map → vite-plugin-IF2O6BJV.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildServicesProxyConfig,
3
3
  servicesConfigSchema
4
- } from "./chunk-DNMSV3R3.js";
4
+ } from "./chunk-D7ZH7DTG.js";
5
5
  import {
6
6
  broadcastToDevtools
7
7
  } from "./chunk-7BIM27LV.js";
@@ -51,7 +51,7 @@ import {
51
51
  extractTraceId,
52
52
  handleBatchRequest,
53
53
  sendError
54
- } from "./chunk-KJLECZWQ.js";
54
+ } from "./chunk-3FYJ7R7N.js";
55
55
  import {
56
56
  logRequest
57
57
  } from "./chunk-Z5IGLBWE.js";
@@ -369,6 +369,25 @@ var theoConfigSchema = z8.object({
369
369
  }).optional()
370
370
  }).optional(),
371
371
  port: z8.number().int().min(1).max(65535).default(3e3),
372
+ /** Listen on all addresses (0.0.0.0) for LAN/mobile testing. */
373
+ host: z8.union([z8.string(), z8.boolean()]).default("localhost"),
374
+ /** Automatically open browser on `theokit dev`. */
375
+ open: z8.union([z8.boolean(), z8.string()]).default(false),
376
+ /** Exit if port is already in use instead of trying next available. */
377
+ strictPort: z8.boolean().default(false),
378
+ /** Forward browser console/errors to terminal — useful for AI agent dev. */
379
+ forwardConsole: z8.union([
380
+ z8.boolean(),
381
+ z8.object({
382
+ unhandledErrors: z8.boolean().optional(),
383
+ logLevels: z8.array(z8.enum(["error", "warn", "info", "log", "debug"])).optional()
384
+ })
385
+ ]).default(false),
386
+ /** Pre-transform files on startup for faster first page load. */
387
+ warmup: z8.object({
388
+ clientFiles: z8.array(z8.string()).optional(),
389
+ ssrFiles: z8.array(z8.string()).optional()
390
+ }).optional(),
372
391
  ssr: z8.boolean().default(false),
373
392
  /** When true (and ssr === true), use renderToPipeableStream with progressive
374
393
  * shell flush instead of single-shot renderToString. Opt-in for streaming
@@ -811,19 +830,53 @@ function attachRouteFiles(node, dir) {
811
830
  }
812
831
  }
813
832
  }
833
+ function parseSegment(name) {
834
+ if (name.startsWith("[[")) {
835
+ throw new Error(
836
+ `Optional catch-all route segment is not supported yet: '${name}'. Use '[...param]' for catch-all, or split into explicit segments.`
837
+ );
838
+ }
839
+ const catchAll = /^\[\.\.\.(.+)\]$/.exec(name);
840
+ if (catchAll) return checkedSegment("catchall", catchAll[1], name);
841
+ const dynamic = /^\[(.+)\]$/.exec(name);
842
+ if (dynamic) return checkedSegment("dynamic", dynamic[1], name);
843
+ return { kind: "static" };
844
+ }
845
+ function checkedSegment(kind, paramName, name) {
846
+ if (!/^\w+$/.test(paramName)) {
847
+ throw new Error(
848
+ `Invalid route param '${paramName}' in segment '${name}' \u2014 param names must match [A-Za-z0-9_] (react-router constraint).`
849
+ );
850
+ }
851
+ return { kind, paramName };
852
+ }
814
853
  function nodeHasContent(node) {
815
854
  return node.page !== void 0 || node.layout !== void 0 || node.error !== void 0 || node.loading !== void 0 || node.notFound !== void 0 || node.children.length > 0;
816
855
  }
856
+ function buildChildPath(routePath, urlSegment) {
857
+ if (!urlSegment) return routePath;
858
+ return routePath === "/" ? `/${urlSegment}` : `${routePath}/${urlSegment}`;
859
+ }
860
+ function scanChild(parentDir, dirName, routePath) {
861
+ const isRouteGroup = dirName.startsWith("(") && dirName.endsWith(")");
862
+ const urlSegment = isRouteGroup ? "" : dirName;
863
+ const childPath = buildChildPath(routePath, urlSegment);
864
+ const child = scanDir(join2(parentDir, dirName), isRouteGroup ? "" : dirName, childPath);
865
+ if (!isRouteGroup) {
866
+ const parsed = parseSegment(dirName);
867
+ if (parsed.kind !== "static" && parsed.paramName !== void 0) {
868
+ child.dynamic = { paramName: parsed.paramName, catchAll: parsed.kind === "catchall" };
869
+ }
870
+ }
871
+ return child;
872
+ }
817
873
  function scanDir(dir, segment, routePath) {
818
874
  const node = { segment, path: routePath, children: [] };
819
875
  attachRouteFiles(node, dir);
820
876
  for (const entry of readdirSync(dir, { withFileTypes: true })) {
821
877
  if (!entry.isDirectory()) continue;
822
878
  if (entry.name.startsWith("_") || entry.name.startsWith(".")) continue;
823
- const isRouteGroup = entry.name.startsWith("(") && entry.name.endsWith(")");
824
- const urlSegment = isRouteGroup ? "" : entry.name;
825
- const childPath = urlSegment ? routePath === "/" ? `/${urlSegment}` : `${routePath}/${urlSegment}` : routePath;
826
- const child = scanDir(join2(dir, entry.name), isRouteGroup ? "" : entry.name, childPath);
879
+ const child = scanChild(dir, entry.name, routePath);
827
880
  if (nodeHasContent(child)) {
828
881
  node.children.push(child);
829
882
  }
@@ -1297,7 +1350,7 @@ async function runConfigureServer(server, ctx) {
1297
1350
  server.watcher.on("unlink", handleRouteChange);
1298
1351
  if (ctx.resolvedOpenApi !== void 0) {
1299
1352
  const openApiCfg = ctx.resolvedOpenApi;
1300
- const { reEmitOpenApi } = await import("./dev-emit-JBVINGHU.js");
1353
+ const { reEmitOpenApi } = await import("./dev-emit-6DJUK6DT.js");
1301
1354
  const openApiServerDir = resolve6(ctx.projectRoot, "server");
1302
1355
  const openApiDistDir = resolve6(ctx.projectRoot, ctx.resolvedDistDir);
1303
1356
  const isRouteFileForOpenApi = (file) => file.startsWith(openApiServerDir) && /\.(ts|tsx|js|mjs)$/.test(file);
@@ -1990,6 +2043,11 @@ function safeVarName(segment, prefix) {
1990
2043
  const safe = segment.replace(/[^a-zA-Z0-9]/g, "_") || "root";
1991
2044
  return `${prefix}_${safe}`;
1992
2045
  }
2046
+ function segmentPath(node) {
2047
+ if (node.dynamic?.catchAll) return "*";
2048
+ if (node.dynamic) return `:${node.dynamic.paramName}`;
2049
+ return node.segment;
2050
+ }
1993
2051
  function buildRoutePath(parents, segment) {
1994
2052
  const joined = [...parents, segment].filter(Boolean).join("/");
1995
2053
  return "/" + joined;
@@ -2001,7 +2059,7 @@ function pushIf(staticImports, filePath, varName) {
2001
2059
  }
2002
2060
  function walkRouteTree(node, parents, acc) {
2003
2061
  const seg = node.segment || "root";
2004
- const routePath = buildRoutePath(parents, node.segment);
2062
+ const routePath = buildRoutePath(parents, segmentPath(node));
2005
2063
  if (node.page !== void 0) {
2006
2064
  acc.lazyPages.push({
2007
2065
  varName: safeVarName(seg, "Page"),
@@ -2015,7 +2073,8 @@ function walkRouteTree(node, parents, acc) {
2015
2073
  pushIf(acc.staticImports, node.loading, safeVarName(seg, "Loading"));
2016
2074
  pushIf(acc.staticImports, node.notFound, safeVarName(seg, "NotFound"));
2017
2075
  for (const child of node.children) {
2018
- const nextParents = node.segment ? [...parents, node.segment] : parents;
2076
+ const childSegPath = segmentPath(node);
2077
+ const nextParents = childSegPath ? [...parents, childSegPath] : parents;
2019
2078
  walkRouteTree(child, nextParents, acc);
2020
2079
  }
2021
2080
  }
@@ -2074,7 +2133,7 @@ function generateRouteManifest(tree) {
2074
2133
  const childrenArray = buildChildrenArray(node, seg);
2075
2134
  if (node.layout) {
2076
2135
  const layoutVar = safeVarName(seg, "Layout");
2077
- const pathPart = isRoot ? `path: '/'` : `path: '${node.segment}'`;
2136
+ const pathPart = isRoot ? `path: '/'` : `path: '${segmentPath(node)}'`;
2078
2137
  return `{ ${pathPart}, element: React.createElement(${layoutVar}, { children: React.createElement(Outlet) }), children: ${childrenArray} }`;
2079
2138
  }
2080
2139
  if (isRoot) {
@@ -2087,9 +2146,9 @@ function generateRouteManifest(tree) {
2087
2146
  const pageVar = safeVarName(seg, "Page");
2088
2147
  const fallbackEl = node.loading ? `React.createElement(${safeVarName(seg, "Loading")})` : "null";
2089
2148
  const pageElement = `React.createElement(Suspense, { fallback: ${fallbackEl} }, React.createElement(${pageVar}))`;
2090
- return `{ path: '${node.segment}', element: ${pageElement} }`;
2149
+ return `{ path: '${segmentPath(node)}', element: ${pageElement} }`;
2091
2150
  }
2092
- return `{ path: '${node.segment}', children: ${childrenArray} }`;
2151
+ return `{ path: '${segmentPath(node)}', children: ${childrenArray} }`;
2093
2152
  }
2094
2153
  const routeConfig = genRouteConfig(tree, true);
2095
2154
  lines.push(`export const routes = [${routeConfig}]`);
@@ -2269,7 +2328,7 @@ async function theoPluginAsync(rootOrOptions) {
2269
2328
  });
2270
2329
  const servicesPlugins = [];
2271
2330
  if (options.services && Object.keys(options.services).length > 0) {
2272
- const { servicesTypedClientPlugin } = await import("./services-typed-client-KK6RHRDG.js");
2331
+ const { servicesTypedClientPlugin } = await import("./services-typed-client-IETY2SAK.js");
2273
2332
  servicesPlugins.push(
2274
2333
  servicesTypedClientPlugin({
2275
2334
  cwd: projectRoot,
@@ -2457,4 +2516,4 @@ export {
2457
2516
  theoPluginAsync,
2458
2517
  theoPlugin
2459
2518
  };
2460
- //# sourceMappingURL=chunk-X3VNROZ7.js.map
2519
+ //# sourceMappingURL=chunk-SVSUUK4H.js.map