theokit 0.48.10 → 0.48.11

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-NGE76BEX.js";
6
+ } from "./chunk-6DT6PNAI.js";
7
7
  import "./chunk-HBU2GIMZ.js";
8
8
  import "./chunk-6GGWS7J3.js";
9
9
  import "./chunk-LNVMHQ2Z.js";
@@ -12,4 +12,4 @@ export {
12
12
  agentCommand,
13
13
  createAgentSsrLoader
14
14
  };
15
- //# sourceMappingURL=agent-QMVAEQ7I.js.map
15
+ //# sourceMappingURL=agent-K5ZRDLUK.js.map
@@ -543,7 +543,7 @@ async function buildCommand(options) {
543
543
  `);
544
544
  }
545
545
  async function runAdapterBuild(target, config, cwd) {
546
- const { theoPluginAsync } = await import("./vite-plugin-SM5MHOJZ.js");
546
+ const { theoPluginAsync } = await import("./vite-plugin-N573PI37.js");
547
547
  const { default: react } = await import("@vitejs/plugin-react");
548
548
  const ctx = {
549
549
  // `react()` may return Plugin or Plugin[] depending on version; spread the
@@ -629,4 +629,4 @@ function relativize3(absPath, root) {
629
629
  export {
630
630
  buildCommand
631
631
  };
632
- //# sourceMappingURL=build-GYRWWCLA.js.map
632
+ //# sourceMappingURL=build-LXYQHOTL.js.map
@@ -1382,7 +1382,7 @@ function generateSingleShotEntry(options) {
1382
1382
  `import { renderToPipeableStream } from 'react-dom/server'`,
1383
1383
  `import { createStaticHandler, createStaticRouter, StaticRouterProvider, matchRoutes } from 'react-router'`,
1384
1384
  `import { PassThrough } from 'node:stream'`,
1385
- `import { routes, __theoPreloadMap } from '/@theo/route-manifest'`,
1385
+ `import { routes, __theoPreloadMap, __theoPreloadPathsFor } from '/@theo/route-manifest'`,
1386
1386
  theoUiImport,
1387
1387
  `export async function render(url, options = {}) {`,
1388
1388
  // Resolve the matched pages BEFORE rendering.
@@ -1399,10 +1399,7 @@ function generateSingleShotEntry(options) {
1399
1399
  // is strictly no worse than not having preloaded at all.
1400
1400
  ` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
1401
1401
  ` await Promise.all(`,
1402
- ` __theoMatches`,
1403
- ` .map((m) => m.route && m.route.path)`,
1404
- ` .filter((p) => typeof p === 'string' && p in __theoPreloadMap)`,
1405
- ` .map((p) => __theoPreloadMap[p]().catch(() => null)),`,
1402
+ ` __theoPreloadPathsFor(__theoMatches).map((p) => __theoPreloadMap[p]().catch(() => null)),`,
1406
1403
  ` )`,
1407
1404
  ``,
1408
1405
  ` const handler = createStaticHandler(routes)`,
@@ -1463,10 +1460,7 @@ function streamingWebRenderer(appTree) {
1463
1460
  // is strictly no worse than not having preloaded at all.
1464
1461
  ` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
1465
1462
  ` await Promise.all(`,
1466
- ` __theoMatches`,
1467
- ` .map((m) => m.route && m.route.path)`,
1468
- ` .filter((p) => typeof p === 'string' && p in __theoPreloadMap)`,
1469
- ` .map((p) => __theoPreloadMap[p]().catch(() => null)),`,
1463
+ ` __theoPreloadPathsFor(__theoMatches).map((p) => __theoPreloadMap[p]().catch(() => null)),`,
1470
1464
  ` )`,
1471
1465
  ``,
1472
1466
  ` const handler = createStaticHandler(routes)`,
@@ -1515,10 +1509,7 @@ function streamingNodeRenderer(appTree) {
1515
1509
  // is strictly no worse than not having preloaded at all.
1516
1510
  ` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
1517
1511
  ` await Promise.all(`,
1518
- ` __theoMatches`,
1519
- ` .map((m) => m.route && m.route.path)`,
1520
- ` .filter((p) => typeof p === 'string' && p in __theoPreloadMap)`,
1521
- ` .map((p) => __theoPreloadMap[p]().catch(() => null)),`,
1512
+ ` __theoPreloadPathsFor(__theoMatches).map((p) => __theoPreloadMap[p]().catch(() => null)),`,
1522
1513
  ` )`,
1523
1514
  ``,
1524
1515
  ` const handler = createStaticHandler(routes)`,
@@ -1577,10 +1568,7 @@ function backCompatRenderer(appTree) {
1577
1568
  // is strictly no worse than not having preloaded at all.
1578
1569
  ` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
1579
1570
  ` await Promise.all(`,
1580
- ` __theoMatches`,
1581
- ` .map((m) => m.route && m.route.path)`,
1582
- ` .filter((p) => typeof p === 'string' && p in __theoPreloadMap)`,
1583
- ` .map((p) => __theoPreloadMap[p]().catch(() => null)),`,
1571
+ ` __theoPreloadPathsFor(__theoMatches).map((p) => __theoPreloadMap[p]().catch(() => null)),`,
1584
1572
  ` )`,
1585
1573
  ``,
1586
1574
  ` const handler = createStaticHandler(routes)`,
@@ -1624,7 +1612,7 @@ function generateStreamingEntry(options) {
1624
1612
  `import React, { Suspense } from 'react'`,
1625
1613
  `import { renderToPipeableStream, renderToReadableStream } from 'react-dom/server'`,
1626
1614
  `import { createStaticHandler, createStaticRouter, StaticRouterProvider, matchRoutes } from 'react-router'`,
1627
- `import { routes, __theoPreloadMap } from '/@theo/route-manifest'`,
1615
+ `import { routes, __theoPreloadMap, __theoPreloadPathsFor } from '/@theo/route-manifest'`,
1628
1616
  theoUiImport,
1629
1617
  ``,
1630
1618
  ...streamingWebRenderer(appTree),
@@ -1668,9 +1656,10 @@ function generateEntryClient(ssr, opts = {}) {
1668
1656
  const preloadBlock = ssr ? [
1669
1657
  `// Phase 4 \u2014 preload matched-route modules before hydrate (EC-3 safeguard)`,
1670
1658
  `const __theoMatches = matchRoutes(routes, window.location.pathname) ?? []`,
1671
- `const __theoPreloadPaths = __theoMatches`,
1672
- ` .map((m) => m.route && (m.route).path)`,
1673
- ` .filter((p) => typeof p === 'string' && p in __theoPreloadMap)`,
1659
+ `// Absolute paths, rebuilt from the match chain \u2014 see __theoPreloadPathsFor. Looking up`,
1660
+ `// \`m.route.path\` directly finds nothing for any nested route, so this preload silently`,
1661
+ `// did nothing until usetheokit/theokit#323.`,
1662
+ `const __theoPreloadPaths = __theoPreloadPathsFor(__theoMatches)`,
1674
1663
  `const __theoPreloadPromise = Promise.all(`,
1675
1664
  ` __theoPreloadPaths.map((p) => __theoPreloadMap[p]().catch((err) => { console.error('[theo] preload failed', p, err); return null }))`,
1676
1665
  `)`,
@@ -1686,7 +1675,7 @@ function generateEntryClient(ssr, opts = {}) {
1686
1675
  ` })()`,
1687
1676
  `}`
1688
1677
  ] : [`if (el) {`, renderCall, `}`];
1689
- const manifestImports = ssr ? `import { routes, __theoPreloadMap } from '/@theo/route-manifest'` : `import { routes } from '/@theo/route-manifest'`;
1678
+ const manifestImports = ssr ? `import { routes, __theoPreloadMap, __theoPreloadPathsFor } from '/@theo/route-manifest'` : `import { routes } from '/@theo/route-manifest'`;
1690
1679
  const reactRouterImports = ssr ? `import { createBrowserRouter, RouterProvider, matchRoutes } from 'react-router'` : `import { createBrowserRouter, RouterProvider } from 'react-router'`;
1691
1680
  return [
1692
1681
  `import React, { Suspense } from 'react'`,
@@ -1774,6 +1763,20 @@ function generateRouteManifest(tree) {
1774
1763
  lines.push("export const __theoPreloadMap = {");
1775
1764
  for (const e of preloadEntries) lines.push(e);
1776
1765
  lines.push("}", "");
1766
+ lines.push(
1767
+ "export function __theoPreloadPathsFor(matches) {",
1768
+ " const out = []",
1769
+ " let base = ''",
1770
+ " for (const m of matches ?? []) {",
1771
+ " const seg = m && m.route && m.route.path",
1772
+ " if (typeof seg !== 'string') continue",
1773
+ " base = seg.startsWith('/') ? seg : base.endsWith('/') ? base + seg : base + '/' + seg",
1774
+ " out.push(base)",
1775
+ " }",
1776
+ " return out.filter((p) => p in __theoPreloadMap)",
1777
+ "}",
1778
+ ""
1779
+ );
1777
1780
  function buildChildrenArray(node, seg) {
1778
1781
  const childConfigs = [];
1779
1782
  if (node.page) {
@@ -2201,4 +2204,4 @@ export {
2201
2204
  theoPluginAsync,
2202
2205
  theoPlugin
2203
2206
  };
2204
- //# sourceMappingURL=chunk-7UMA5DY4.js.map
2207
+ //# sourceMappingURL=chunk-4GJAVUVK.js.map