@timber-js/app 0.2.0-alpha.236 → 0.2.0-alpha.238

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 (105) hide show
  1. package/dist/_chunks/chains-CmzbpG-6.js +1 -0
  2. package/dist/_chunks/{chains-BsGKkMTK.js → chains-DMoHX4yH.js} +2 -2
  3. package/dist/_chunks/{chains-BsGKkMTK.js.map → chains-DMoHX4yH.js.map} +1 -1
  4. package/dist/_chunks/{classify-cmE0Gins.js → classify-BwyAd-dZ.js} +3 -3
  5. package/dist/_chunks/{classify-cmE0Gins.js.map → classify-BwyAd-dZ.js.map} +1 -1
  6. package/dist/_chunks/{cli-check-BwiahbTC.js → cli-check-DQAD9MLo.js} +3 -3
  7. package/dist/_chunks/{cli-check-BwiahbTC.js.map → cli-check-DQAD9MLo.js.map} +1 -1
  8. package/dist/_chunks/{cli-schema-sync-Brw7kTmm.js → cli-schema-sync-C_xNLqBj.js} +1 -1
  9. package/dist/_chunks/{cli-schema-sync-B2ldclRO.js → cli-schema-sync-CmGls3dc.js} +2 -2
  10. package/dist/_chunks/{cli-schema-sync-B2ldclRO.js.map → cli-schema-sync-CmGls3dc.js.map} +1 -1
  11. package/dist/_chunks/{client-dep-entries-C1nMlLKV.js → client-dep-entries-C5BTQtFS.js} +2 -2
  12. package/dist/_chunks/{client-dep-entries-C1nMlLKV.js.map → client-dep-entries-C5BTQtFS.js.map} +1 -1
  13. package/dist/_chunks/{convention-lint-CLpuzY5h.js → convention-lint-GQA6WTRo.js} +2 -2
  14. package/dist/_chunks/{convention-lint-CLpuzY5h.js.map → convention-lint-GQA6WTRo.js.map} +1 -1
  15. package/dist/_chunks/dev-server--4_Ogy_6.js +1 -0
  16. package/dist/_chunks/{dev-server-lrdpD7Ws.js → dev-server-Cr3_Fu5A.js} +244 -26
  17. package/dist/_chunks/dev-server-Cr3_Fu5A.js.map +1 -0
  18. package/dist/_chunks/{flight-source-node-BO_xD9jC.js → flight-source-node-BsrlUjMO.js} +7 -3
  19. package/dist/_chunks/flight-source-node-BsrlUjMO.js.map +1 -0
  20. package/dist/_chunks/{scanner-CrB_h6FA.js → interception-CtNt9jPt.js} +169 -1043
  21. package/dist/_chunks/interception-CtNt9jPt.js.map +1 -0
  22. package/dist/_chunks/{live-graph-ChuFfmLi.js → live-graph-HcLScfiV.js} +4 -4
  23. package/dist/_chunks/{live-graph-ChuFfmLi.js.map → live-graph-HcLScfiV.js.map} +1 -1
  24. package/dist/_chunks/{metadata-routes-BL26HCDd.js → metadata-routes-MXNjWOt5.js} +60 -2
  25. package/dist/_chunks/metadata-routes-MXNjWOt5.js.map +1 -0
  26. package/dist/_chunks/{node-response-DNNnKnoS.js → node-response-omewa8e6.js} +20 -3
  27. package/dist/_chunks/node-response-omewa8e6.js.map +1 -0
  28. package/dist/_chunks/{poison-scan-CJ9QfJWb.js → poison-scan-DONdiCGX.js} +2 -2
  29. package/dist/_chunks/{poison-scan-CJ9QfJWb.js.map → poison-scan-DONdiCGX.js.map} +1 -1
  30. package/dist/_chunks/render-timeout-MrrqD1wd.js.map +1 -1
  31. package/dist/_chunks/scanner-DSAJjH0x.js +1043 -0
  32. package/dist/_chunks/scanner-DSAJjH0x.js.map +1 -0
  33. package/dist/_chunks/{walkers-BUvpsb2Q.js → walkers-96YopJds.js} +3 -3
  34. package/dist/_chunks/{walkers-BUvpsb2Q.js.map → walkers-96YopJds.js.map} +1 -1
  35. package/dist/analyze/crawl-entry.js +3 -3
  36. package/dist/analyze/graph-command.js +2 -2
  37. package/dist/cli.js +3 -3
  38. package/dist/config-types.d.ts +11 -0
  39. package/dist/config-types.d.ts.map +1 -1
  40. package/dist/config-validation.d.ts.map +1 -1
  41. package/dist/index.js +6 -155
  42. package/dist/index.js.map +1 -1
  43. package/dist/native/rsc/server/abort-scope.js +6 -2
  44. package/dist/native/rsc/server/abort-scope.js.map +1 -1
  45. package/dist/native/rsc/server/flight-source-node.js +6 -2
  46. package/dist/native/rsc/server/flight-source-node.js.map +1 -1
  47. package/dist/native/rsc/server/pipeline-helpers.js +2 -2
  48. package/dist/native/rsc/server/pipeline-helpers.js.map +1 -1
  49. package/dist/native/rsc/server/pipeline-metadata-route.js +2 -2
  50. package/dist/native/rsc/server/pipeline-metadata-route.js.map +1 -1
  51. package/dist/native/rsc/server/render-timeout.js.map +1 -1
  52. package/dist/native/rsc/server/safe-load.js +14 -2
  53. package/dist/native/rsc/server/safe-load.js.map +1 -1
  54. package/dist/native/ssr/server/abort-scope.js +6 -2
  55. package/dist/native/ssr/server/abort-scope.js.map +1 -1
  56. package/dist/native/ssr/server/flight-source-node.js +6 -2
  57. package/dist/native/ssr/server/flight-source-node.js.map +1 -1
  58. package/dist/native/ssr/server/pipeline-helpers.js +2 -2
  59. package/dist/native/ssr/server/pipeline-helpers.js.map +1 -1
  60. package/dist/native/ssr/server/pipeline-metadata-route.js +2 -2
  61. package/dist/native/ssr/server/pipeline-metadata-route.js.map +1 -1
  62. package/dist/native/ssr/server/render-timeout.js +3 -4
  63. package/dist/native/ssr/server/render-timeout.js.map +1 -1
  64. package/dist/native/ssr/server/safe-load.js +10 -1
  65. package/dist/native/ssr/server/safe-load.js.map +1 -1
  66. package/dist/plugins/dev-precompile.d.ts +42 -14
  67. package/dist/plugins/dev-precompile.d.ts.map +1 -1
  68. package/dist/plugins/dev-server.d.ts.map +1 -1
  69. package/dist/routing/index.js +3 -2
  70. package/dist/routing/manifest-codegen.d.ts +2 -0
  71. package/dist/routing/manifest-codegen.d.ts.map +1 -1
  72. package/dist/server/abort-scope.d.ts +7 -0
  73. package/dist/server/abort-scope.d.ts.map +1 -1
  74. package/dist/server/flight-source-node.d.ts.map +1 -1
  75. package/dist/server/internal.js +46 -7
  76. package/dist/server/internal.js.map +1 -1
  77. package/dist/server/render-timeout.d.ts.map +1 -1
  78. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  79. package/dist/server/safe-load.d.ts +22 -0
  80. package/dist/server/safe-load.d.ts.map +1 -1
  81. package/docs/api/34-api-config.mdx +18 -0
  82. package/package.json +1 -1
  83. package/src/config-types.ts +11 -0
  84. package/src/config-validation.ts +15 -8
  85. package/src/plugins/dev-precompile.ts +108 -20
  86. package/src/plugins/dev-server.ts +12 -11
  87. package/src/routing/manifest-codegen.ts +2 -2
  88. package/src/server/abort-scope.ts +20 -1
  89. package/src/server/flight-source-node.ts +11 -2
  90. package/src/server/pipeline-helpers.ts +2 -2
  91. package/src/server/pipeline-metadata-route.ts +2 -2
  92. package/src/server/render-timeout.ts +8 -5
  93. package/src/server/rsc-entry/index.ts +5 -0
  94. package/src/server/safe-load.ts +53 -1
  95. package/dist/_chunks/chains-DHmoKxkO.js +0 -1
  96. package/dist/_chunks/dev-server-BGGGhHXx.js +0 -1
  97. package/dist/_chunks/dev-server-lrdpD7Ws.js.map +0 -1
  98. package/dist/_chunks/flight-source-node-BO_xD9jC.js.map +0 -1
  99. package/dist/_chunks/metadata-routes-BL26HCDd.js.map +0 -1
  100. package/dist/_chunks/node-response-DNNnKnoS.js.map +0 -1
  101. package/dist/_chunks/scanner-CrB_h6FA.js.map +0 -1
  102. package/dist/_chunks/segment-keys-Y60KNc8C.js +0 -61
  103. package/dist/_chunks/segment-keys-Y60KNc8C.js.map +0 -1
  104. package/dist/_chunks/tree-match-Bqdr9szG.js +0 -168
  105. package/dist/_chunks/tree-match-Bqdr9szG.js.map +0 -1
@@ -1,10 +1,10 @@
1
1
  import { C as setMatchedSegmentPath, E as runOutsideReactCacheScope, S as runWithSegmentParams, T as setSegmentParams, b as markResponseFlushed, f as getCookie, g as getHeader, h as applyRequestHeaderOverlay, i as coerce, m as getSetCookieHeaders, o as DenySignal, s as RedirectSignal, t as executeAction, v as getSearchParams, w as setMutableCookieContext, x as runWithRequestContext, y as getSegmentParams } from "../_chunks/actions-Top9GftB.js";
2
2
  import { i as requestContextAls, n as prebuiltCaptureAls, o as timingAls, t as earlyHintsSenderAls } from "../_chunks/als-registry-DpygwCp0.js";
3
3
  import { c as collectRouteModulepreloads, i as traceTimingEntry, o as collectRouteCss, s as collectRouteFonts } from "../_chunks/dev-span-RsVeYYc_.js";
4
- import { c as drainWithDeadline, d as isAbortError, f as releaseReason, i as withResponseInit, n as discardResponseBody, o as concatBytes, p as onAbortUntil, r as nodeBodyOps, u as wrapResponseWithStreamTiming } from "../_chunks/node-response-DNNnKnoS.js";
4
+ import { c as drainWithDeadline, d as isAbortError, f as releaseReason, i as withResponseInit, m as onAbortUntil, n as discardResponseBody, o as concatBytes, p as endScope, r as nodeBodyOps, u as wrapResponseWithStreamTiming } from "../_chunks/node-response-omewa8e6.js";
5
5
  import { A as runWithTraceId, E as getOtelTraceId, F as isControlFlowSignal, I as isDenySignal, L as isRedirectSignal, M as withSpan, O as getTraceId, T as generateTraceId, _ as logWaitUntilRejected, b as swallow, c as logMiddlewareShortCircuit, d as logRequestCompleted, f as logRequestReceived, g as logSwrRefetchFailed, h as logSlowRequest, i as logCsrfRejected, j as setSpanAttribute, k as replaceTraceId, l as logProxyError, m as logRouteSetupError, n as logCacheMiss, p as logRouteError, s as logMiddlewareError, t as getLogger, u as logRenderError, v as logWaitUntilUnsupported, x as isDebug, y as setLogger } from "../_chunks/logger-DDLtp5e-.js";
6
6
  import { _ as getWaitUntil, a as storeOverlayEntry, c as lookupArtifactSeed, d as checkVersionSkew, g as observeKeyDiscipline, i as overlayKey, l as setPrebuiltPayloadSource, n as lookupOverlay, o as hasPrebuiltPayloadSource, r as mayStoreRerender, s as isParamIndependent, u as applyReloadHeaders } from "../_chunks/cache-api-Bo8c7XVF.js";
7
- import { i as getMetadataRouteServePath, n as classifyMetadataRoute, r as getMetadataRouteAutoLink, t as METADATA_ROUTE_CONVENTIONS } from "../_chunks/metadata-routes-BL26HCDd.js";
7
+ import { c as computeSegmentTreePaths, i as getMetadataRouteServePath, n as classifyMetadataRoute, r as getMetadataRouteAutoLink, t as METADATA_ROUTE_CONVENTIONS } from "../_chunks/metadata-routes-MXNjWOt5.js";
8
8
  import { i as canonicalize, r as canonicalRequestPath } from "../_chunks/canonicalize-CqK135BN.js";
9
9
  import { n as isRscContentType, r as isRscRequest } from "../_chunks/rsc-media-type-m8jz9u6_.js";
10
10
  import { i as isRscCacheKeyShape, n as RSC_KEY_PARAM, r as appVisibleSearch, s as rscCacheKey, t as RSC_KEY_HEADERS } from "../_chunks/rsc-cache-key-D0cb0Gmc.js";
@@ -15,7 +15,6 @@ import { n as hasSchemaCodecs, t as getSchemaCodec } from "../_chunks/codec-regi
15
15
  import { t as normalizeParamValue } from "../_chunks/param-value-DqlGfF57.js";
16
16
  import { n as isHttpMethod, t as HTTP_METHODS } from "../_chunks/route-methods-Dk2kZc0n.js";
17
17
  import { i as resolveRenderTimeoutMs, r as RenderTimeoutError, t as DEFAULT_RENDER_TIMEOUT_MS } from "../_chunks/render-timeout-MrrqD1wd.js";
18
- import { t as computeSegmentTreePaths } from "../_chunks/segment-keys-Y60KNc8C.js";
19
18
  import { _ as wasInvalidatedSince, a as devEntryKey, c as getDevSeed, d as isDevPrebuiltStoreActive, f as isHardReload, h as lastInvalidationEpochFor, m as currentInvalidationEpoch, n as clearDevPrebuiltStore, p as setDevSeed, r as devComponentTag, s as discardDevEntry, u as isDevPrebuiltCacheBypassed } from "../_chunks/dev-store-BvdqtHvK.js";
20
19
  import { n as createSingleflight } from "../_chunks/singleflight-CzoOVB9Y.js";
21
20
  import { createHash } from "node:crypto";
@@ -193,16 +192,56 @@ var ModuleLoadError = class extends Error {
193
192
  }
194
193
  };
195
194
  /**
195
+ * Modules already loaded in production, keyed by their manifest loader.
196
+ *
197
+ * Manifest loaders are static objects in the generated manifest module
198
+ * (routing/manifest-codegen.ts), so one loader is one file for the life of
199
+ * the process. A caller that wraps a loader in a fresh object (the sitemap
200
+ * generator does, once per generation) only misses the cache. Node hands back the same namespace on every `import()`, but
201
+ * the round-trip through the loader costs ~2.7µs, and a request loads every
202
+ * layout, page and slot on its path (16 loads on a parallel-routes page):
203
+ * caching measured −4.65% CPU on an HTML page and up to −12.5% on RSC
204
+ * navigation (TIM-1626). A WeakMap hit is ~0.09µs.
205
+ *
206
+ * Only successful loads are stored, so a failed load is retried on the next
207
+ * request and keeps reporting `ModuleLoadError`.
208
+ */
209
+ var loaded = /* @__PURE__ */ new WeakMap();
210
+ /** Set once no dev server can swap route modules; see {@link loadModule}. */
211
+ var routeModulesImmutable = false;
212
+ /**
196
213
  * Load a route manifest module with enriched error context.
197
214
  *
198
215
  * On success: returns the module object (same as `loader.load()`).
199
216
  * On failure: throws `ModuleLoadError` with file path and original cause.
200
217
  *
218
+ * Production builds cache the module per loader. A dev server never does,
219
+ * whatever NODE_ENV says: HMR depends on each request re-importing, so an
220
+ * edited file is picked up, and the manifest (with its loader objects) is
221
+ * not re-evaluated when a route file changes. Both must hold:
222
+ *
223
+ * - `process.env.NODE_ENV === 'production'`, which the server build defines
224
+ * for every adapter, Workers included (plugins/server-bundle.ts). It also
225
+ * keeps vitest (`test`) from caching.
226
+ * - {@link markRouteModulesImmutable} was called. `import.meta.hot` is what
227
+ * says HMR can swap modules, and a dev server started with
228
+ * NODE_ENV=production still has it, but runtime modules cannot read it
229
+ * (they may load outside Vite's module runner, design/51 §"Boundary"), so
230
+ * the RSC entry reads it and calls this, as rsc-entry/ssr-bridge.ts gates
231
+ * the SSR entry.
232
+ *
201
233
  * Error rendering paths that need fallthrough use `loadFallbackModule()`.
202
234
  */
203
235
  async function loadModule(loader) {
236
+ const cache = process.env.NODE_ENV === "production" && routeModulesImmutable;
237
+ if (cache) {
238
+ const hit = loaded.get(loader);
239
+ if (hit !== void 0) return hit;
240
+ }
204
241
  try {
205
- return await loader.load();
242
+ const mod = await loader.load();
243
+ if (cache) loaded.set(loader, mod);
244
+ return mod;
206
245
  } catch (error) {
207
246
  throw new ModuleLoadError(loader.filePath, error);
208
247
  }
@@ -797,7 +836,7 @@ async function runBackgroundFlight(signal, work, log) {
797
836
  if (!signal.aborted) failed(error);
798
837
  throw error;
799
838
  } finally {
800
- settled.abort();
839
+ endScope(settled);
801
840
  }
802
841
  }
803
842
  function reportedPhase(source, apiRoute) {
@@ -1626,7 +1665,7 @@ async function bufferResponse(response, timeoutMs, signal) {
1626
1665
  cancel: (reason) => void reader.cancel(reason).catch(() => {})
1627
1666
  }, timeoutMs, "Metadata route body");
1628
1667
  } finally {
1629
- readDone.abort();
1668
+ endScope(readDone);
1630
1669
  }
1631
1670
  const bytes = concatBytes(chunks);
1632
1671
  const headers = new Headers(response.headers);
@@ -4371,7 +4410,7 @@ function noteWrapperRender(innerId, options, props) {
4371
4410
  }
4372
4411
  }
4373
4412
  // src/server/flight-source.ts
4374
- var nodeFlight = typeof process !== "undefined" && process.release?.name === "node" && !(typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers") ? await import("../_chunks/flight-source-node-BO_xD9jC.js") : null;
4413
+ var nodeFlight = typeof process !== "undefined" && process.release?.name === "node" && !(typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers") ? await import("../_chunks/flight-source-node-BsrlUjMO.js") : null;
4375
4414
  /** The Node helpers, which a `kind: 'node'` source can only exist alongside. */
4376
4415
  function requireNodeFlight() {
4377
4416
  if (!nodeFlight) throw new Error("[timber] a Node Flight source reached a runtime without node:stream");