theokit 0.48.8 → 0.48.10

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 (62) hide show
  1. package/README.md +86 -0
  2. package/dist/{actions-virtual-module-IICWQK43.js → actions-virtual-module-LB4NGONI.js} +2 -2
  3. package/dist/{agent-WZLCEXD4.js → agent-QMVAEQ7I.js} +2 -2
  4. package/dist/{app-typed-client-4GDSR5T3.js → app-typed-client-G3J5G7E5.js} +2 -2
  5. package/dist/{build-5TKAROT4.js → build-GYRWWCLA.js} +4 -4
  6. package/dist/{chunk-XSCZWSE3.js → chunk-7BCC4BCR.js} +95 -6
  7. package/dist/chunk-7BCC4BCR.js.map +1 -0
  8. package/dist/{chunk-ZGNA66JK.js → chunk-7UMA5DY4.js} +91 -11
  9. package/dist/{chunk-ZGNA66JK.js.map → chunk-7UMA5DY4.js.map} +1 -1
  10. package/dist/{chunk-ABUVJU3P.js → chunk-BIVCP6X5.js} +2 -1
  11. package/dist/{chunk-UDPJP42U.js → chunk-GPX7I5ZY.js} +31 -4
  12. package/dist/chunk-GPX7I5ZY.js.map +1 -0
  13. package/dist/{chunk-RPIL7VRZ.js → chunk-GRI4XHBJ.js} +2 -2
  14. package/dist/{chunk-A4ZEP3FE.js → chunk-GVW5EKEU.js} +11 -2
  15. package/dist/chunk-GVW5EKEU.js.map +1 -0
  16. package/dist/{chunk-HENNMZUH.js → chunk-NGE76BEX.js} +4 -4
  17. package/dist/{chunk-GH32R55S.js → chunk-S433N3CT.js} +2 -2
  18. package/dist/chunk-V7MTRM6Q.js +90 -0
  19. package/dist/chunk-V7MTRM6Q.js.map +1 -0
  20. package/dist/cli/index.js +19 -9
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/cookies-QWVS7OGS.js +23 -0
  23. package/dist/{dev-XGAJQ7DH.js → dev-K27SUPJD.js} +6 -6
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +1 -1
  26. package/dist/{info-MSBQ72EM.js → info-XW7HGUPH.js} +3 -3
  27. package/dist/{internal-api-AKYIRMT2.js → internal-api-V5L65YSJ.js} +2 -2
  28. package/dist/{load-config-2LP2OEKD.js → load-config-VKD6LKWU.js} +3 -3
  29. package/dist/{mcp-D7K6NJMW.js → mcp-3JORKAFI.js} +3 -3
  30. package/dist/{openapi-FWNYHB6T.js → openapi-HZXR335W.js} +3 -3
  31. package/dist/{routes-6AMNVFMI.js → routes-OLNQX7CT.js} +3 -3
  32. package/dist/{schema-Z3Y7SFLE.js → schema-ZO3OSWVG.js} +2 -2
  33. package/dist/server/index.js +1 -1
  34. package/dist/server/rate-limit/index.d.ts +49 -1
  35. package/dist/server/rate-limit/index.js +1 -1
  36. package/dist/{start-YR4TQQP2.js → start-KR2JJR7K.js} +142 -15
  37. package/dist/start-KR2JJR7K.js.map +1 -0
  38. package/dist/vite-plugin/index.js +1 -1
  39. package/dist/{vite-plugin-PUUCR6LR.js → vite-plugin-SM5MHOJZ.js} +6 -6
  40. package/dist/vite-plugin-SM5MHOJZ.js.map +1 -0
  41. package/package.json +13 -3
  42. package/dist/chunk-A4ZEP3FE.js.map +0 -1
  43. package/dist/chunk-UDPJP42U.js.map +0 -1
  44. package/dist/chunk-XSCZWSE3.js.map +0 -1
  45. package/dist/start-YR4TQQP2.js.map +0 -1
  46. /package/dist/{actions-virtual-module-IICWQK43.js.map → actions-virtual-module-LB4NGONI.js.map} +0 -0
  47. /package/dist/{agent-WZLCEXD4.js.map → agent-QMVAEQ7I.js.map} +0 -0
  48. /package/dist/{app-typed-client-4GDSR5T3.js.map → app-typed-client-G3J5G7E5.js.map} +0 -0
  49. /package/dist/{build-5TKAROT4.js.map → build-GYRWWCLA.js.map} +0 -0
  50. /package/dist/{chunk-ABUVJU3P.js.map → chunk-BIVCP6X5.js.map} +0 -0
  51. /package/dist/{chunk-RPIL7VRZ.js.map → chunk-GRI4XHBJ.js.map} +0 -0
  52. /package/dist/{chunk-HENNMZUH.js.map → chunk-NGE76BEX.js.map} +0 -0
  53. /package/dist/{chunk-GH32R55S.js.map → chunk-S433N3CT.js.map} +0 -0
  54. /package/dist/{internal-api-AKYIRMT2.js.map → cookies-QWVS7OGS.js.map} +0 -0
  55. /package/dist/{dev-XGAJQ7DH.js.map → dev-K27SUPJD.js.map} +0 -0
  56. /package/dist/{info-MSBQ72EM.js.map → info-XW7HGUPH.js.map} +0 -0
  57. /package/dist/{load-config-2LP2OEKD.js.map → internal-api-V5L65YSJ.js.map} +0 -0
  58. /package/dist/{schema-Z3Y7SFLE.js.map → load-config-VKD6LKWU.js.map} +0 -0
  59. /package/dist/{mcp-D7K6NJMW.js.map → mcp-3JORKAFI.js.map} +0 -0
  60. /package/dist/{openapi-FWNYHB6T.js.map → openapi-HZXR335W.js.map} +0 -0
  61. /package/dist/{routes-6AMNVFMI.js.map → routes-OLNQX7CT.js.map} +0 -0
  62. /package/dist/{vite-plugin-PUUCR6LR.js.map → schema-ZO3OSWVG.js.map} +0 -0
@@ -9,7 +9,7 @@ import {
9
9
  serveAgentAuxRoute,
10
10
  setupSsrDevMiddleware,
11
11
  writeWebResponseToServerResponse
12
- } from "./chunk-RPIL7VRZ.js";
12
+ } from "./chunk-GRI4XHBJ.js";
13
13
  import {
14
14
  isMcpPath
15
15
  } from "./chunk-2CVV6CNN.js";
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-IEES3CHD.js";
20
20
  import {
21
21
  loadConfig
22
- } from "./chunk-GH32R55S.js";
22
+ } from "./chunk-S433N3CT.js";
23
23
  import {
24
24
  buildServicesProxyConfig
25
25
  } from "./chunk-7VPQHEAJ.js";
@@ -44,7 +44,7 @@ import {
44
44
  handleCspReport,
45
45
  handleCsrfReadiness,
46
46
  mountAgent
47
- } from "./chunk-ABUVJU3P.js";
47
+ } from "./chunk-BIVCP6X5.js";
48
48
  import {
49
49
  getApprovalRegistry,
50
50
  resolveProvider
@@ -1380,11 +1380,31 @@ 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 } 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
+ ` __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)),`,
1406
+ ` )`,
1407
+ ``,
1388
1408
  ` const handler = createStaticHandler(routes)`,
1389
1409
  ` const request = new Request('http://localhost' + url)`,
1390
1410
  ` const context = await handler.query(request)`,
@@ -1429,6 +1449,26 @@ function streamingWebRenderer(appTree) {
1429
1449
  `// Response with the stream as body. Honors request.signal for client`,
1430
1450
  `// disconnect cleanup.`,
1431
1451
  `export async function renderStreamingWeb(request, options = {}) {`,
1452
+ // Resolve the matched pages BEFORE rendering.
1453
+ //
1454
+ // Pages are React.lazy() in the route manifest, which is right for the browser and pure loss
1455
+ // here: the server already has every chunk on local disk. Rendering without this makes React
1456
+ // suspend on the page component, so \`onShellReady\` fires with the layout alone and the actual
1457
+ // page streams afterwards inside a hidden div. The reader gets an empty frame that fills in --
1458
+ // measured at CLS 1.12 and an article absent from the DOM for ~700ms on a real site.
1459
+ //
1460
+ // This mirrors what entry.ts already does before hydrateRoot, using the same preload map.
1461
+ // Streaming still applies to genuine data-fetching Suspense, which is where it earns its keep.
1462
+ // A failed import is swallowed on purpose: React.lazy will retry and suspend as before, which
1463
+ // is strictly no worse than not having preloaded at all.
1464
+ ` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
1465
+ ` 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)),`,
1470
+ ` )`,
1471
+ ``,
1432
1472
  ` const handler = createStaticHandler(routes)`,
1433
1473
  ` const url = new URL(request.url)`,
1434
1474
  ` const context = await handler.query(request)`,
@@ -1461,6 +1501,26 @@ function streamingNodeRenderer(appTree) {
1461
1501
  `// Flushes the shell as soon as it's ready, then streams Suspense boundaries.`,
1462
1502
  `// EC-11: respects request.signal for client-disconnect cleanup.`,
1463
1503
  `export async function renderStreaming(url, response, options = {}) {`,
1504
+ // Resolve the matched pages BEFORE rendering.
1505
+ //
1506
+ // Pages are React.lazy() in the route manifest, which is right for the browser and pure loss
1507
+ // here: the server already has every chunk on local disk. Rendering without this makes React
1508
+ // suspend on the page component, so \`onShellReady\` fires with the layout alone and the actual
1509
+ // page streams afterwards inside a hidden div. The reader gets an empty frame that fills in --
1510
+ // measured at CLS 1.12 and an article absent from the DOM for ~700ms on a real site.
1511
+ //
1512
+ // This mirrors what entry.ts already does before hydrateRoot, using the same preload map.
1513
+ // Streaming still applies to genuine data-fetching Suspense, which is where it earns its keep.
1514
+ // A failed import is swallowed on purpose: React.lazy will retry and suspend as before, which
1515
+ // is strictly no worse than not having preloaded at all.
1516
+ ` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
1517
+ ` 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)),`,
1522
+ ` )`,
1523
+ ``,
1464
1524
  ` const handler = createStaticHandler(routes)`,
1465
1525
  ` const request = new Request('http://localhost' + url, { signal: options.signal })`,
1466
1526
  ` const context = await handler.query(request)`,
@@ -1503,6 +1563,26 @@ function backCompatRenderer(appTree) {
1503
1563
  `// Backward compatibility: keep the single-shot render export available so`,
1504
1564
  `// callers that always used 'render()' don't break when streaming is on.`,
1505
1565
  `export async function render(url, options = {}) {`,
1566
+ // Resolve the matched pages BEFORE rendering.
1567
+ //
1568
+ // Pages are React.lazy() in the route manifest, which is right for the browser and pure loss
1569
+ // here: the server already has every chunk on local disk. Rendering without this makes React
1570
+ // suspend on the page component, so \`onShellReady\` fires with the layout alone and the actual
1571
+ // page streams afterwards inside a hidden div. The reader gets an empty frame that fills in --
1572
+ // measured at CLS 1.12 and an article absent from the DOM for ~700ms on a real site.
1573
+ //
1574
+ // This mirrors what entry.ts already does before hydrateRoot, using the same preload map.
1575
+ // Streaming still applies to genuine data-fetching Suspense, which is where it earns its keep.
1576
+ // A failed import is swallowed on purpose: React.lazy will retry and suspend as before, which
1577
+ // is strictly no worse than not having preloaded at all.
1578
+ ` const __theoMatches = matchRoutes(routes, url.split('?')[0]) ?? []`,
1579
+ ` 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)),`,
1584
+ ` )`,
1585
+ ``,
1506
1586
  ` const handler = createStaticHandler(routes)`,
1507
1587
  ` const request = new Request('http://localhost' + url)`,
1508
1588
  ` const context = await handler.query(request)`,
@@ -1543,8 +1623,8 @@ function generateStreamingEntry(options) {
1543
1623
  return [
1544
1624
  `import React, { Suspense } from 'react'`,
1545
1625
  `import { renderToPipeableStream, renderToReadableStream } from 'react-dom/server'`,
1546
- `import { createStaticHandler, createStaticRouter, StaticRouterProvider } from 'react-router'`,
1547
- `import { routes } from '/@theo/route-manifest'`,
1626
+ `import { createStaticHandler, createStaticRouter, StaticRouterProvider, matchRoutes } from 'react-router'`,
1627
+ `import { routes, __theoPreloadMap } from '/@theo/route-manifest'`,
1548
1628
  theoUiImport,
1549
1629
  ``,
1550
1630
  ...streamingWebRenderer(appTree),
@@ -1927,19 +2007,19 @@ async function theoPluginAsync(rootOrOptions) {
1927
2007
  })
1928
2008
  );
1929
2009
  }
1930
- const { appTypedClientPlugin } = await import("./app-typed-client-4GDSR5T3.js");
2010
+ const { appTypedClientPlugin } = await import("./app-typed-client-G3J5G7E5.js");
1931
2011
  const appClientPlugin = appTypedClientPlugin({
1932
2012
  cwd: projectRoot,
1933
2013
  serverDir: serverDirAbs,
1934
2014
  distDir: resolve6(projectRoot, ".theokit")
1935
2015
  });
1936
- const { actionsVirtualModule } = await import("./actions-virtual-module-IICWQK43.js");
2016
+ const { actionsVirtualModule } = await import("./actions-virtual-module-LB4NGONI.js");
1937
2017
  const actionsPlugin = actionsVirtualModule({
1938
2018
  serverDir: serverDirAbs,
1939
2019
  distDir: resolve6(projectRoot, ".theokit")
1940
2020
  });
1941
2021
  const { agentsTypedClientPlugin } = await import("./agents-typed-client-D4OA2TXB.js");
1942
- const { generateManifest } = await import("./internal-api-AKYIRMT2.js");
2022
+ const { generateManifest } = await import("./internal-api-V5L65YSJ.js");
1943
2023
  const agentsClientPlugin = agentsTypedClientPlugin({
1944
2024
  projectRoot,
1945
2025
  agentsDir: agentsDirName,
@@ -2121,4 +2201,4 @@ export {
2121
2201
  theoPluginAsync,
2122
2202
  theoPlugin
2123
2203
  };
2124
- //# sourceMappingURL=chunk-ZGNA66JK.js.map
2204
+ //# sourceMappingURL=chunk-7UMA5DY4.js.map