theokit 0.83.0 → 0.83.1

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.
@@ -3,7 +3,7 @@ import "tsx/esm";
3
3
  import {
4
4
  agentCommand,
5
5
  createAgentSsrLoader
6
- } from "./chunk-MDTPLIOU.js";
6
+ } from "./chunk-3PKFH32F.js";
7
7
  import "./chunk-4JRXZTVQ.js";
8
8
  import "./chunk-FU3LEX2I.js";
9
9
  import "./chunk-Z7CJHDLS.js";
@@ -13,4 +13,4 @@ export {
13
13
  agentCommand,
14
14
  createAgentSsrLoader
15
15
  };
16
- //# sourceMappingURL=agent-QXJZG6R7.js.map
16
+ //# sourceMappingURL=agent-CSTQXBKU.js.map
@@ -411,7 +411,7 @@ async function buildCommand(options) {
411
411
  `);
412
412
  }
413
413
  async function runAdapterBuild(target, config, cwd, adapter) {
414
- const { theoPluginAsync } = await import("./vite-plugin-WW3DFQPT.js");
414
+ const { theoPluginAsync } = await import("./vite-plugin-U62NK6NT.js");
415
415
  const { default: react } = await import("@vitejs/plugin-react");
416
416
  const ctx = {
417
417
  // `react()` may return Plugin or Plugin[] depending on version; spread the
@@ -506,4 +506,4 @@ function relativize3(absPath, root) {
506
506
  export {
507
507
  buildCommand
508
508
  };
509
- //# sourceMappingURL=build-55ZYADOG.js.map
509
+ //# sourceMappingURL=build-QKZ265O5.js.map
@@ -178,7 +178,7 @@ async function agentCommand(name, message, deps = {}) {
178
178
  async function createAgentSsrLoader(projectRoot) {
179
179
  const { createServer } = await import("vite");
180
180
  const react = (await import("@vitejs/plugin-react")).default;
181
- const { theoPluginAsync } = await import("./vite-plugin-WW3DFQPT.js");
181
+ const { theoPluginAsync } = await import("./vite-plugin-U62NK6NT.js");
182
182
  const { loadConfig } = await import("./load-config-2ND2LIRV.js");
183
183
  const config = await loadConfig(projectRoot);
184
184
  const theoPlugins = await theoPluginAsync({
@@ -212,4 +212,4 @@ export {
212
212
  agentCommand,
213
213
  createAgentSsrLoader
214
214
  };
215
- //# sourceMappingURL=chunk-MDTPLIOU.js.map
215
+ //# sourceMappingURL=chunk-3PKFH32F.js.map
@@ -1973,9 +1973,26 @@ function buildRoutePath(parents, segment) {
1973
1973
  const joined = [...parents, segment].filter(Boolean).join("/");
1974
1974
  return "/" + joined;
1975
1975
  }
1976
- function pushIf(staticImports, filePath, varName) {
1976
+ function allocName(node, seg, prefix, acc) {
1977
+ const base = safeVarName(seg, prefix);
1978
+ let name = base;
1979
+ let n = 2;
1980
+ while (acc.used.has(name)) {
1981
+ name = `${base}_${n}`;
1982
+ n += 1;
1983
+ }
1984
+ acc.used.add(name);
1985
+ const perNode = acc.names.get(node) ?? /* @__PURE__ */ new Map();
1986
+ perNode.set(prefix, name);
1987
+ acc.names.set(node, perNode);
1988
+ return name;
1989
+ }
1990
+ function pushIf(acc, node, seg, filePath, prefix) {
1977
1991
  if (filePath !== void 0) {
1978
- staticImports.push({ varName, importPath: normalizePath(filePath) });
1992
+ acc.staticImports.push({
1993
+ varName: allocName(node, seg, prefix, acc),
1994
+ importPath: normalizePath(filePath)
1995
+ });
1979
1996
  }
1980
1997
  }
1981
1998
  function walkRouteTree(node, parents, acc) {
@@ -1983,15 +2000,15 @@ function walkRouteTree(node, parents, acc) {
1983
2000
  const routePath = buildRoutePath(parents, segmentPath(node));
1984
2001
  if (node.page !== void 0) {
1985
2002
  acc.lazyPages.push({
1986
- varName: safeVarName(seg, "Page"),
2003
+ varName: allocName(node, seg, "Page", acc),
1987
2004
  importPath: normalizePath(node.page),
1988
2005
  routePath
1989
2006
  });
1990
2007
  }
1991
- pushIf(acc.staticImports, node.layout, safeVarName(seg, "Layout"));
1992
- pushIf(acc.staticImports, node.error, safeVarName(seg, "Error"));
1993
- pushIf(acc.staticImports, node.loading, safeVarName(seg, "Loading"));
1994
- pushIf(acc.staticImports, node.notFound, safeVarName(seg, "NotFound"));
2008
+ pushIf(acc, node, seg, node.layout, "Layout");
2009
+ pushIf(acc, node, seg, node.error, "Error");
2010
+ pushIf(acc, node, seg, node.loading, "Loading");
2011
+ pushIf(acc, node, seg, node.notFound, "NotFound");
1995
2012
  for (const child of node.children) {
1996
2013
  const childSegPath = segmentPath(node);
1997
2014
  const nextParents = childSegPath ? [...parents, childSegPath] : parents;
@@ -2001,6 +2018,8 @@ function walkRouteTree(node, parents, acc) {
2001
2018
  function generateRouteManifest(tree, options = {}) {
2002
2019
  const lazyPages_ = options.lazyPages !== false;
2003
2020
  const acc = {
2021
+ used: /* @__PURE__ */ new Set(),
2022
+ names: /* @__PURE__ */ new Map(),
2004
2023
  staticImports: [],
2005
2024
  lazyPages: []
2006
2025
  };
@@ -2044,11 +2063,12 @@ function generateRouteManifest(tree, options = {}) {
2044
2063
  "}",
2045
2064
  ""
2046
2065
  );
2047
- function buildChildrenArray(node, seg) {
2066
+ const nameOf = (node, prefix) => acc.names.get(node)?.get(prefix) ?? safeVarName(node.segment || "root", prefix);
2067
+ function buildChildrenArray(node) {
2048
2068
  const childConfigs = [];
2049
2069
  if (node.page) {
2050
- const pageVar = safeVarName(seg, "Page");
2051
- const fallbackEl = node.loading ? `React.createElement(${safeVarName(seg, "Loading")})` : "null";
2070
+ const pageVar = nameOf(node, "Page");
2071
+ const fallbackEl = node.loading ? `React.createElement(${nameOf(node, "Loading")})` : "null";
2052
2072
  const pageElement = `React.createElement(Suspense, { fallback: ${fallbackEl} }, React.createElement(${pageVar}))`;
2053
2073
  childConfigs.push(`{ index: true, element: ${pageElement} }`);
2054
2074
  }
@@ -2056,22 +2076,21 @@ function generateRouteManifest(tree, options = {}) {
2056
2076
  childConfigs.push(genRouteConfig(child, false));
2057
2077
  }
2058
2078
  if (node.notFound) {
2059
- const nfVar = safeVarName(seg, "NotFound");
2079
+ const nfVar = nameOf(node, "NotFound");
2060
2080
  childConfigs.push(`{ path: '*', element: React.createElement(${nfVar}) }`);
2061
2081
  }
2062
2082
  let arr = `[${childConfigs.join(", ")}]`;
2063
2083
  if (node.error) {
2064
- const errVar = safeVarName(seg, "Error");
2084
+ const errVar = nameOf(node, "Error");
2065
2085
  arr = `[{ errorElement: React.createElement(${errVar}), children: ${arr} }]`;
2066
2086
  }
2067
2087
  return arr;
2068
2088
  }
2069
2089
  function genRouteConfig(node, isRoot) {
2070
- const seg = node.segment || "root";
2071
- const childrenArray = buildChildrenArray(node, seg);
2090
+ const childrenArray = buildChildrenArray(node);
2072
2091
  const withScrollRestoration = (element) => `React.createElement(React.Fragment, null, React.createElement(ScrollRestoration), React.createElement(ElementScrollRestoration), ${element})`;
2073
2092
  if (node.layout) {
2074
- const layoutVar = safeVarName(seg, "Layout");
2093
+ const layoutVar = nameOf(node, "Layout");
2075
2094
  const pathPart = isRoot ? `path: '/'` : `path: '${segmentPath(node)}'`;
2076
2095
  const layoutElement = `React.createElement(${layoutVar}, { children: React.createElement(Outlet) })`;
2077
2096
  const element = isRoot ? withScrollRestoration(layoutElement) : layoutElement;
@@ -2085,8 +2104,8 @@ function generateRouteManifest(tree, options = {}) {
2085
2104
  return `{ path: '/', element: ${rootElement}, children: ${childrenArray} }`;
2086
2105
  }
2087
2106
  if (node.page && node.children.length === 0 && !node.error && !node.notFound) {
2088
- const pageVar = safeVarName(seg, "Page");
2089
- const fallbackEl = node.loading ? `React.createElement(${safeVarName(seg, "Loading")})` : "null";
2107
+ const pageVar = nameOf(node, "Page");
2108
+ const fallbackEl = node.loading ? `React.createElement(${nameOf(node, "Loading")})` : "null";
2090
2109
  const pageElement = `React.createElement(Suspense, { fallback: ${fallbackEl} }, React.createElement(${pageVar}))`;
2091
2110
  return `{ path: '${segmentPath(node)}', element: ${pageElement} }`;
2092
2111
  }
@@ -2497,4 +2516,4 @@ export {
2497
2516
  buildOptimizeDepsInclude,
2498
2517
  theoPlugin
2499
2518
  };
2500
- //# sourceMappingURL=chunk-CIMKVK5O.js.map
2519
+ //# sourceMappingURL=chunk-7LERIE32.js.map