theokit 0.48.9 → 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.
- package/dist/{agent-SK4TOO6M.js → agent-K5ZRDLUK.js} +2 -2
- package/dist/{build-FMRO4W4Q.js → build-LXYQHOTL.js} +2 -2
- package/dist/{chunk-Q2S2IGSM.js → chunk-4GJAVUVK.js} +92 -9
- package/dist/{chunk-Q2S2IGSM.js.map → chunk-4GJAVUVK.js.map} +1 -1
- package/dist/{chunk-SO64VQOD.js → chunk-6DT6PNAI.js} +2 -2
- package/dist/{chunk-YML4ZDFA.js → chunk-LOC456I6.js} +92 -9
- package/dist/{chunk-YML4ZDFA.js.map → chunk-LOC456I6.js.map} +1 -1
- package/dist/cli/index.js +4 -4
- package/dist/{dev-P2MODWTG.js → dev-GEXDHW65.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{mcp-EQHTPQ2L.js → mcp-JDTRXXWN.js} +2 -2
- package/dist/vite-plugin/index.js +1 -1
- package/dist/{vite-plugin-EQMDMDXV.js → vite-plugin-N573PI37.js} +2 -2
- package/package.json +1 -1
- /package/dist/{agent-SK4TOO6M.js.map → agent-K5ZRDLUK.js.map} +0 -0
- /package/dist/{build-FMRO4W4Q.js.map → build-LXYQHOTL.js.map} +0 -0
- /package/dist/{chunk-SO64VQOD.js.map → chunk-6DT6PNAI.js.map} +0 -0
- /package/dist/{dev-P2MODWTG.js.map → dev-GEXDHW65.js.map} +0 -0
- /package/dist/{mcp-EQHTPQ2L.js.map → mcp-JDTRXXWN.js.map} +0 -0
- /package/dist/{vite-plugin-EQMDMDXV.js.map → vite-plugin-N573PI37.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import "tsx/esm";
|
|
|
3
3
|
import {
|
|
4
4
|
agentCommand,
|
|
5
5
|
createAgentSsrLoader
|
|
6
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
632
|
+
//# sourceMappingURL=build-LXYQHOTL.js.map
|
|
@@ -1380,11 +1380,28 @@ function generateSingleShotEntry(options) {
|
|
|
1380
1380
|
return [
|
|
1381
1381
|
`import React, { Suspense } from 'react'`,
|
|
1382
1382
|
`import { renderToPipeableStream } from 'react-dom/server'`,
|
|
1383
|
-
`import { createStaticHandler, createStaticRouter, StaticRouterProvider } from 'react-router'`,
|
|
1383
|
+
`import { createStaticHandler, createStaticRouter, StaticRouterProvider, matchRoutes } from 'react-router'`,
|
|
1384
1384
|
`import { PassThrough } from 'node:stream'`,
|
|
1385
|
-
`import { routes } 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
|
+
// Resolve the matched pages BEFORE rendering.
|
|
1389
|
+
//
|
|
1390
|
+
// Pages are React.lazy() in the route manifest, which is right for the browser and pure loss
|
|
1391
|
+
// here: the server already has every chunk on local disk. Rendering without this makes React
|
|
1392
|
+
// suspend on the page component, so \`onShellReady\` fires with the layout alone and the actual
|
|
1393
|
+
// page streams afterwards inside a hidden div. The reader gets an empty frame that fills in --
|
|
1394
|
+
// measured at CLS 1.12 and an article absent from the DOM for ~700ms on a real site.
|
|
1395
|
+
//
|
|
1396
|
+
// This mirrors what entry.ts already does before hydrateRoot, using the same preload map.
|
|
1397
|
+
// Streaming still applies to genuine data-fetching Suspense, which is where it earns its keep.
|
|
1398
|
+
// A failed import is swallowed on purpose: React.lazy will retry and suspend as before, which
|
|
1399
|
+
// is strictly no worse than not having preloaded at all.
|
|
1400
|
+
` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
|
|
1401
|
+
` await Promise.all(`,
|
|
1402
|
+
` __theoPreloadPathsFor(__theoMatches).map((p) => __theoPreloadMap[p]().catch(() => null)),`,
|
|
1403
|
+
` )`,
|
|
1404
|
+
``,
|
|
1388
1405
|
` const handler = createStaticHandler(routes)`,
|
|
1389
1406
|
` const request = new Request('http://localhost' + url)`,
|
|
1390
1407
|
` const context = await handler.query(request)`,
|
|
@@ -1429,6 +1446,23 @@ function streamingWebRenderer(appTree) {
|
|
|
1429
1446
|
`// Response with the stream as body. Honors request.signal for client`,
|
|
1430
1447
|
`// disconnect cleanup.`,
|
|
1431
1448
|
`export async function renderStreamingWeb(request, options = {}) {`,
|
|
1449
|
+
// Resolve the matched pages BEFORE rendering.
|
|
1450
|
+
//
|
|
1451
|
+
// Pages are React.lazy() in the route manifest, which is right for the browser and pure loss
|
|
1452
|
+
// here: the server already has every chunk on local disk. Rendering without this makes React
|
|
1453
|
+
// suspend on the page component, so \`onShellReady\` fires with the layout alone and the actual
|
|
1454
|
+
// page streams afterwards inside a hidden div. The reader gets an empty frame that fills in --
|
|
1455
|
+
// measured at CLS 1.12 and an article absent from the DOM for ~700ms on a real site.
|
|
1456
|
+
//
|
|
1457
|
+
// This mirrors what entry.ts already does before hydrateRoot, using the same preload map.
|
|
1458
|
+
// Streaming still applies to genuine data-fetching Suspense, which is where it earns its keep.
|
|
1459
|
+
// A failed import is swallowed on purpose: React.lazy will retry and suspend as before, which
|
|
1460
|
+
// is strictly no worse than not having preloaded at all.
|
|
1461
|
+
` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
|
|
1462
|
+
` await Promise.all(`,
|
|
1463
|
+
` __theoPreloadPathsFor(__theoMatches).map((p) => __theoPreloadMap[p]().catch(() => null)),`,
|
|
1464
|
+
` )`,
|
|
1465
|
+
``,
|
|
1432
1466
|
` const handler = createStaticHandler(routes)`,
|
|
1433
1467
|
` const url = new URL(request.url)`,
|
|
1434
1468
|
` const context = await handler.query(request)`,
|
|
@@ -1461,6 +1495,23 @@ function streamingNodeRenderer(appTree) {
|
|
|
1461
1495
|
`// Flushes the shell as soon as it's ready, then streams Suspense boundaries.`,
|
|
1462
1496
|
`// EC-11: respects request.signal for client-disconnect cleanup.`,
|
|
1463
1497
|
`export async function renderStreaming(url, response, options = {}) {`,
|
|
1498
|
+
// Resolve the matched pages BEFORE rendering.
|
|
1499
|
+
//
|
|
1500
|
+
// Pages are React.lazy() in the route manifest, which is right for the browser and pure loss
|
|
1501
|
+
// here: the server already has every chunk on local disk. Rendering without this makes React
|
|
1502
|
+
// suspend on the page component, so \`onShellReady\` fires with the layout alone and the actual
|
|
1503
|
+
// page streams afterwards inside a hidden div. The reader gets an empty frame that fills in --
|
|
1504
|
+
// measured at CLS 1.12 and an article absent from the DOM for ~700ms on a real site.
|
|
1505
|
+
//
|
|
1506
|
+
// This mirrors what entry.ts already does before hydrateRoot, using the same preload map.
|
|
1507
|
+
// Streaming still applies to genuine data-fetching Suspense, which is where it earns its keep.
|
|
1508
|
+
// A failed import is swallowed on purpose: React.lazy will retry and suspend as before, which
|
|
1509
|
+
// is strictly no worse than not having preloaded at all.
|
|
1510
|
+
` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
|
|
1511
|
+
` await Promise.all(`,
|
|
1512
|
+
` __theoPreloadPathsFor(__theoMatches).map((p) => __theoPreloadMap[p]().catch(() => null)),`,
|
|
1513
|
+
` )`,
|
|
1514
|
+
``,
|
|
1464
1515
|
` const handler = createStaticHandler(routes)`,
|
|
1465
1516
|
` const request = new Request('http://localhost' + url, { signal: options.signal })`,
|
|
1466
1517
|
` const context = await handler.query(request)`,
|
|
@@ -1503,6 +1554,23 @@ function backCompatRenderer(appTree) {
|
|
|
1503
1554
|
`// Backward compatibility: keep the single-shot render export available so`,
|
|
1504
1555
|
`// callers that always used 'render()' don't break when streaming is on.`,
|
|
1505
1556
|
`export async function render(url, options = {}) {`,
|
|
1557
|
+
// Resolve the matched pages BEFORE rendering.
|
|
1558
|
+
//
|
|
1559
|
+
// Pages are React.lazy() in the route manifest, which is right for the browser and pure loss
|
|
1560
|
+
// here: the server already has every chunk on local disk. Rendering without this makes React
|
|
1561
|
+
// suspend on the page component, so \`onShellReady\` fires with the layout alone and the actual
|
|
1562
|
+
// page streams afterwards inside a hidden div. The reader gets an empty frame that fills in --
|
|
1563
|
+
// measured at CLS 1.12 and an article absent from the DOM for ~700ms on a real site.
|
|
1564
|
+
//
|
|
1565
|
+
// This mirrors what entry.ts already does before hydrateRoot, using the same preload map.
|
|
1566
|
+
// Streaming still applies to genuine data-fetching Suspense, which is where it earns its keep.
|
|
1567
|
+
// A failed import is swallowed on purpose: React.lazy will retry and suspend as before, which
|
|
1568
|
+
// is strictly no worse than not having preloaded at all.
|
|
1569
|
+
` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
|
|
1570
|
+
` await Promise.all(`,
|
|
1571
|
+
` __theoPreloadPathsFor(__theoMatches).map((p) => __theoPreloadMap[p]().catch(() => null)),`,
|
|
1572
|
+
` )`,
|
|
1573
|
+
``,
|
|
1506
1574
|
` const handler = createStaticHandler(routes)`,
|
|
1507
1575
|
` const request = new Request('http://localhost' + url)`,
|
|
1508
1576
|
` const context = await handler.query(request)`,
|
|
@@ -1543,8 +1611,8 @@ function generateStreamingEntry(options) {
|
|
|
1543
1611
|
return [
|
|
1544
1612
|
`import React, { Suspense } from 'react'`,
|
|
1545
1613
|
`import { renderToPipeableStream, renderToReadableStream } from 'react-dom/server'`,
|
|
1546
|
-
`import { createStaticHandler, createStaticRouter, StaticRouterProvider } from 'react-router'`,
|
|
1547
|
-
`import { routes } from '/@theo/route-manifest'`,
|
|
1614
|
+
`import { createStaticHandler, createStaticRouter, StaticRouterProvider, matchRoutes } from 'react-router'`,
|
|
1615
|
+
`import { routes, __theoPreloadMap, __theoPreloadPathsFor } from '/@theo/route-manifest'`,
|
|
1548
1616
|
theoUiImport,
|
|
1549
1617
|
``,
|
|
1550
1618
|
...streamingWebRenderer(appTree),
|
|
@@ -1588,9 +1656,10 @@ function generateEntryClient(ssr, opts = {}) {
|
|
|
1588
1656
|
const preloadBlock = ssr ? [
|
|
1589
1657
|
`// Phase 4 \u2014 preload matched-route modules before hydrate (EC-3 safeguard)`,
|
|
1590
1658
|
`const __theoMatches = matchRoutes(routes, window.location.pathname) ?? []`,
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
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)`,
|
|
1594
1663
|
`const __theoPreloadPromise = Promise.all(`,
|
|
1595
1664
|
` __theoPreloadPaths.map((p) => __theoPreloadMap[p]().catch((err) => { console.error('[theo] preload failed', p, err); return null }))`,
|
|
1596
1665
|
`)`,
|
|
@@ -1606,7 +1675,7 @@ function generateEntryClient(ssr, opts = {}) {
|
|
|
1606
1675
|
` })()`,
|
|
1607
1676
|
`}`
|
|
1608
1677
|
] : [`if (el) {`, renderCall, `}`];
|
|
1609
|
-
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'`;
|
|
1610
1679
|
const reactRouterImports = ssr ? `import { createBrowserRouter, RouterProvider, matchRoutes } from 'react-router'` : `import { createBrowserRouter, RouterProvider } from 'react-router'`;
|
|
1611
1680
|
return [
|
|
1612
1681
|
`import React, { Suspense } from 'react'`,
|
|
@@ -1694,6 +1763,20 @@ function generateRouteManifest(tree) {
|
|
|
1694
1763
|
lines.push("export const __theoPreloadMap = {");
|
|
1695
1764
|
for (const e of preloadEntries) lines.push(e);
|
|
1696
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
|
+
);
|
|
1697
1780
|
function buildChildrenArray(node, seg) {
|
|
1698
1781
|
const childConfigs = [];
|
|
1699
1782
|
if (node.page) {
|
|
@@ -2121,4 +2204,4 @@ export {
|
|
|
2121
2204
|
theoPluginAsync,
|
|
2122
2205
|
theoPlugin
|
|
2123
2206
|
};
|
|
2124
|
-
//# sourceMappingURL=chunk-
|
|
2207
|
+
//# sourceMappingURL=chunk-4GJAVUVK.js.map
|