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

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 (47) hide show
  1. package/dist/_chunks/{flight-source-node-BO_xD9jC.js → flight-source-node-BsrlUjMO.js} +7 -3
  2. package/dist/_chunks/flight-source-node-BsrlUjMO.js.map +1 -0
  3. package/dist/_chunks/{node-response-DNNnKnoS.js → node-response-omewa8e6.js} +20 -3
  4. package/dist/_chunks/node-response-omewa8e6.js.map +1 -0
  5. package/dist/_chunks/render-timeout-MrrqD1wd.js.map +1 -1
  6. package/dist/native/rsc/server/abort-scope.js +6 -2
  7. package/dist/native/rsc/server/abort-scope.js.map +1 -1
  8. package/dist/native/rsc/server/flight-source-node.js +6 -2
  9. package/dist/native/rsc/server/flight-source-node.js.map +1 -1
  10. package/dist/native/rsc/server/pipeline-helpers.js +2 -2
  11. package/dist/native/rsc/server/pipeline-helpers.js.map +1 -1
  12. package/dist/native/rsc/server/pipeline-metadata-route.js +2 -2
  13. package/dist/native/rsc/server/pipeline-metadata-route.js.map +1 -1
  14. package/dist/native/rsc/server/render-timeout.js.map +1 -1
  15. package/dist/native/rsc/server/safe-load.js +14 -2
  16. package/dist/native/rsc/server/safe-load.js.map +1 -1
  17. package/dist/native/ssr/server/abort-scope.js +6 -2
  18. package/dist/native/ssr/server/abort-scope.js.map +1 -1
  19. package/dist/native/ssr/server/flight-source-node.js +6 -2
  20. package/dist/native/ssr/server/flight-source-node.js.map +1 -1
  21. package/dist/native/ssr/server/pipeline-helpers.js +2 -2
  22. package/dist/native/ssr/server/pipeline-helpers.js.map +1 -1
  23. package/dist/native/ssr/server/pipeline-metadata-route.js +2 -2
  24. package/dist/native/ssr/server/pipeline-metadata-route.js.map +1 -1
  25. package/dist/native/ssr/server/render-timeout.js +3 -4
  26. package/dist/native/ssr/server/render-timeout.js.map +1 -1
  27. package/dist/native/ssr/server/safe-load.js +10 -1
  28. package/dist/native/ssr/server/safe-load.js.map +1 -1
  29. package/dist/server/abort-scope.d.ts +7 -0
  30. package/dist/server/abort-scope.d.ts.map +1 -1
  31. package/dist/server/flight-source-node.d.ts.map +1 -1
  32. package/dist/server/internal.js +45 -5
  33. package/dist/server/internal.js.map +1 -1
  34. package/dist/server/render-timeout.d.ts.map +1 -1
  35. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  36. package/dist/server/safe-load.d.ts +22 -0
  37. package/dist/server/safe-load.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/src/server/abort-scope.ts +20 -1
  40. package/src/server/flight-source-node.ts +11 -2
  41. package/src/server/pipeline-helpers.ts +2 -2
  42. package/src/server/pipeline-metadata-route.ts +2 -2
  43. package/src/server/render-timeout.ts +8 -5
  44. package/src/server/rsc-entry/index.ts +5 -0
  45. package/src/server/safe-load.ts +53 -1
  46. package/dist/_chunks/flight-source-node-BO_xD9jC.js.map +0 -1
  47. package/dist/_chunks/node-response-DNNnKnoS.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { onAbortUntil } from "./abort-scope.js";
1
+ import { endScope, onAbortUntil } from "./abort-scope.js";
2
2
  // src/server/render-timeout.ts
3
3
  var DEFAULT_RENDER_TIMEOUT_MS = 3e4;
4
4
  var RENDER_TIMEOUT_CEILING_MS = 12e4;
@@ -16,8 +16,7 @@ var RenderTimeoutError = class extends Error {
16
16
  };
17
17
  function createRenderTimeout(timeoutMs, parentSignal) {
18
18
  const controller = new AbortController();
19
- const reason = new RenderTimeoutError(timeoutMs, "RSC stream read timed out");
20
- const timer = setTimeout(() => controller.abort(reason), timeoutMs);
19
+ const timer = setTimeout(() => controller.abort(new RenderTimeoutError(timeoutMs, "RSC stream read timed out")), timeoutMs);
21
20
  const scope = new AbortController();
22
21
  onAbortUntil(parentSignal, () => {
23
22
  clearTimeout(timer);
@@ -27,7 +26,7 @@ function createRenderTimeout(timeoutMs, parentSignal) {
27
26
  signal: controller.signal,
28
27
  cancel: () => {
29
28
  clearTimeout(timer);
30
- scope.abort();
29
+ endScope(scope);
31
30
  }
32
31
  };
33
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"render-timeout.js","names":[],"sources":["../../../../src/server/render-timeout.ts"],"mappings":";;AAaA,IAAa,4BAA4B;AAOzC,IAAa,4BAA4B;AAQzC,SAAgB,uBAAuB,YAAwC;CAC7E,QAAQ,cAAA,QAAA;AACV;AAQA,IAAa,qBAAb,cAAwC,MAAM;CAC5C;CAEA,YAAY,WAAmB,SAAkB;EAC/C,MAAM,UAAU,UACZ,wBAAwB,UAAU,MAAM,YACxC,wBAAwB,UAAU;EACtC,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,YAAY;CACnB;AACF;AA0BA,SAAgB,oBAAoB,WAAmB,cAA2C;CAChG,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,SAAS,IAAI,mBAAmB,WAAW,2BAA2B;CAE5E,MAAM,QAAQ,iBAAiB,WAAW,MAAM,MAAM,GAAG,SAAS;CAClE,MAAM,QAAQ,IAAI,gBAAgB;CAGlC,aACE,oBACM;EACJ,aAAa,KAAK;EAClB,WAAW,MAAM,cAAc,MAAM;CACvC,GACA,MAAM,MACR;CAEA,OAAO;EACL,QAAQ,WAAW;EACnB,cAAc;GACZ,aAAa,KAAK;GAClB,MAAM,MAAM;EACd;CACF;AACF;AAQA,SAAgB,YACd,SACA,WACA,SACY;CACZ,IAAI;CACJ,MAAM,iBAAiB,IAAI,SAAgB,UAAU,WAAW;EAC9D,QAAQ,iBAAiB;GACvB,OAAO,IAAI,mBAAmB,WAAW,OAAO,CAAC;EACnD,GAAG,SAAS;CACd,CAAC;CAED,OAAO,QAAQ,KAAK,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,cAAc;EAC3D,aAAa,KAAM;CACrB,CAAC;AACH"}
1
+ {"version":3,"file":"render-timeout.js","names":[],"sources":["../../../../src/server/render-timeout.ts"],"mappings":";;AAaA,IAAa,4BAA4B;AAOzC,IAAa,4BAA4B;AAQzC,SAAgB,uBAAuB,YAAwC;CAC7E,QAAQ,cAAA,QAAA;AACV;AAQA,IAAa,qBAAb,cAAwC,MAAM;CAC5C;CAEA,YAAY,WAAmB,SAAkB;EAC/C,MAAM,UAAU,UACZ,wBAAwB,UAAU,MAAM,YACxC,wBAAwB,UAAU;EACtC,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,YAAY;CACnB;AACF;AA0BA,SAAgB,oBAAoB,WAAmB,cAA2C;CAChG,MAAM,aAAa,IAAI,gBAAgB;CAGvC,MAAM,QAAQ,iBACN,WAAW,MAAM,IAAI,mBAAmB,WAAW,2BAA2B,CAAC,GACrF,SACF;CACA,MAAM,QAAQ,IAAI,gBAAgB;CAGlC,aACE,oBACM;EACJ,aAAa,KAAK;EAClB,WAAW,MAAM,cAAc,MAAM;CACvC,GACA,MAAM,MACR;CAEA,OAAO;EACL,QAAQ,WAAW;EACnB,cAAc;GACZ,aAAa,KAAK;GAClB,SAAS,KAAK;EAChB;CACF;AACF;AAQA,SAAgB,YACd,SACA,WACA,SACY;CACZ,IAAI;CACJ,MAAM,iBAAiB,IAAI,SAAgB,UAAU,WAAW;EAC9D,QAAQ,iBAAiB;GACvB,OAAO,IAAI,mBAAmB,WAAW,OAAO,CAAC;EACnD,GAAG,SAAS;CACd,CAAC;CAED,OAAO,QAAQ,KAAK,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,cAAc;EAC3D,aAAa,KAAM;CACrB,CAAC;AACH"}
@@ -8,9 +8,18 @@ var ModuleLoadError = class extends Error {
8
8
  this.filePath = filePath;
9
9
  }
10
10
  };
11
+ var loaded = new WeakMap();
12
+ var routeModulesImmutable = false;
11
13
  async function loadModule(loader) {
14
+ const cache = process.env.NODE_ENV === "production" && routeModulesImmutable;
15
+ if (cache) {
16
+ const hit = loaded.get(loader);
17
+ if (hit !== void 0) return hit;
18
+ }
12
19
  try {
13
- return await loader.load();
20
+ const mod = await loader.load();
21
+ if (cache) loaded.set(loader, mod);
22
+ return mod;
14
23
  } catch (error) {
15
24
  throw new ModuleLoadError(loader.filePath, error);
16
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"safe-load.js","names":[],"sources":["../../../../src/server/safe-load.ts"],"mappings":";AA0BA,IAAa,kBAAb,cAAqC,MAAM;CAEzC;CAEA,YAAY,UAAkB,OAAgB;EAC5C,MAAM,kBAAkB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC7E,MAAM,kCAAkC,SAAS,MAAM,mBAAmB,EAAE,MAAM,CAAC;EACnF,KAAK,OAAO;EACZ,KAAK,WAAW;CAClB;AACF;AAUA,eAAsB,WAAwC,QAAoC;CAChG,IAAI;EACF,OAAQ,MAAM,OAAO,KAAK;CAC5B,SAAS,OAAO;EACd,MAAM,IAAI,gBAAgB,OAAO,UAAU,KAAK;CAClD;AACF"}
1
+ {"version":3,"file":"safe-load.js","names":[],"sources":["../../../../src/server/safe-load.ts"],"mappings":";AA0BA,IAAa,kBAAb,cAAqC,MAAM;CAEzC;CAEA,YAAY,UAAkB,OAAgB;EAC5C,MAAM,kBAAkB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC7E,MAAM,kCAAkC,SAAS,MAAM,mBAAmB,EAAE,MAAM,CAAC;EACnF,KAAK,OAAO;EACZ,KAAK,WAAW;CAClB;AACF;AAiBA,IAAM,SAAS,IAAI,QAAiC;AAGpD,IAAI,wBAAwB;AAmC5B,eAAsB,WAAwC,QAAoC;CAChG,MAAM,QAAA,QAAA,IAAA,aAAiC,gBAAgB;CACvD,IAAI,OAAO;EACT,MAAM,MAAM,OAAO,IAAI,MAAM;EAC7B,IAAI,QAAQ,QAAW,OAAO;CAChC;CACA,IAAI;EACF,MAAM,MAAM,MAAM,OAAO,KAAK;EAC9B,IAAI,OAAO,OAAO,IAAI,QAAQ,GAAG;EACjC,OAAO;CACT,SAAS,OAAO;EACd,MAAM,IAAI,gBAAgB,OAAO,UAAU,KAAK;CAClD;AACF"}
@@ -24,4 +24,11 @@
24
24
  * fire, as after a timeout's `cancel()`).
25
25
  */
26
26
  export declare function onAbortUntil(signal: AbortSignal | undefined, onAbort: () => void, until: PromiseLike<unknown> | AbortSignal): void;
27
+ /**
28
+ * End a scope: abort a server-private controller whose signal only bounds
29
+ * listeners (an `onAbortUntil` `until`). Never use it on a signal anything
30
+ * reads a reason from — a render, fetch or stream would see this symbol
31
+ * instead of an AbortError.
32
+ */
33
+ export declare function endScope(scope: AbortController): void;
27
34
  //# sourceMappingURL=abort-scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"abort-scope.d.ts","sourceRoot":"","sources":["../../src/server/abort-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,OAAO,EAAE,MAAM,IAAI,EACnB,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,WAAW,GACxC,IAAI,CAkBN"}
1
+ {"version":3,"file":"abort-scope.d.ts","sourceRoot":"","sources":["../../src/server/abort-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,OAAO,EAAE,MAAM,IAAI,EACnB,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,WAAW,GACxC,IAAI,CAkBN;AAWD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAErD"}
@@ -1 +1 @@
1
- {"version":3,"file":"flight-source-node.d.ts","sourceRoot":"","sources":["../../src/server/flight-source-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;AAUlD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,YAAY,IAAI,MAAM,CAAC;KACxB;CACF;AAED,uCAAuC;AACvC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,UAAU,CAAC;AAElD,qEAAqE;AACrE,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,cAAc,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;IACzD,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B;AAWD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CASzE;AAED,6EAA6E;AAC7E,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,EACtB,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,eAAe,GACrC,QAAQ,CA6BV;AAOD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,QAAQ,EAChB,cAAc,GAAE,MAAiC,GAChD,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAiItB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CAEjF;AA2GD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBtE"}
1
+ {"version":3,"file":"flight-source-node.d.ts","sourceRoot":"","sources":["../../src/server/flight-source-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;AAUlD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,YAAY,IAAI,MAAM,CAAC;KACxB;CACF;AAED,uCAAuC;AACvC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,UAAU,CAAC;AAElD,qEAAqE;AACrE,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,cAAc,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;IACzD,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B;AAWD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CASzE;AAED,6EAA6E;AAC7E,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,EACtB,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,eAAe,GACrC,QAAQ,CAsCV;AAOD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,QAAQ,EAChB,cAAc,GAAE,MAAiC,GAChD,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAiItB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CAEjF;AA2GD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBtE"}
@@ -1,7 +1,7 @@
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
7
  import { i as getMetadataRouteServePath, n as classifyMetadataRoute, r as getMetadataRouteAutoLink, t as METADATA_ROUTE_CONVENTIONS } from "../_chunks/metadata-routes-BL26HCDd.js";
@@ -193,16 +193,56 @@ var ModuleLoadError = class extends Error {
193
193
  }
194
194
  };
195
195
  /**
196
+ * Modules already loaded in production, keyed by their manifest loader.
197
+ *
198
+ * Manifest loaders are static objects in the generated manifest module
199
+ * (routing/manifest-codegen.ts), so one loader is one file for the life of
200
+ * the process. A caller that wraps a loader in a fresh object (the sitemap
201
+ * generator does, once per generation) only misses the cache. Node hands back the same namespace on every `import()`, but
202
+ * the round-trip through the loader costs ~2.7µs, and a request loads every
203
+ * layout, page and slot on its path (16 loads on a parallel-routes page):
204
+ * caching measured −4.65% CPU on an HTML page and up to −12.5% on RSC
205
+ * navigation (TIM-1626). A WeakMap hit is ~0.09µs.
206
+ *
207
+ * Only successful loads are stored, so a failed load is retried on the next
208
+ * request and keeps reporting `ModuleLoadError`.
209
+ */
210
+ var loaded = /* @__PURE__ */ new WeakMap();
211
+ /** Set once no dev server can swap route modules; see {@link loadModule}. */
212
+ var routeModulesImmutable = false;
213
+ /**
196
214
  * Load a route manifest module with enriched error context.
197
215
  *
198
216
  * On success: returns the module object (same as `loader.load()`).
199
217
  * On failure: throws `ModuleLoadError` with file path and original cause.
200
218
  *
219
+ * Production builds cache the module per loader. A dev server never does,
220
+ * whatever NODE_ENV says: HMR depends on each request re-importing, so an
221
+ * edited file is picked up, and the manifest (with its loader objects) is
222
+ * not re-evaluated when a route file changes. Both must hold:
223
+ *
224
+ * - `process.env.NODE_ENV === 'production'`, which the server build defines
225
+ * for every adapter, Workers included (plugins/server-bundle.ts). It also
226
+ * keeps vitest (`test`) from caching.
227
+ * - {@link markRouteModulesImmutable} was called. `import.meta.hot` is what
228
+ * says HMR can swap modules, and a dev server started with
229
+ * NODE_ENV=production still has it, but runtime modules cannot read it
230
+ * (they may load outside Vite's module runner, design/51 §"Boundary"), so
231
+ * the RSC entry reads it and calls this, as rsc-entry/ssr-bridge.ts gates
232
+ * the SSR entry.
233
+ *
201
234
  * Error rendering paths that need fallthrough use `loadFallbackModule()`.
202
235
  */
203
236
  async function loadModule(loader) {
237
+ const cache = process.env.NODE_ENV === "production" && routeModulesImmutable;
238
+ if (cache) {
239
+ const hit = loaded.get(loader);
240
+ if (hit !== void 0) return hit;
241
+ }
204
242
  try {
205
- return await loader.load();
243
+ const mod = await loader.load();
244
+ if (cache) loaded.set(loader, mod);
245
+ return mod;
206
246
  } catch (error) {
207
247
  throw new ModuleLoadError(loader.filePath, error);
208
248
  }
@@ -797,7 +837,7 @@ async function runBackgroundFlight(signal, work, log) {
797
837
  if (!signal.aborted) failed(error);
798
838
  throw error;
799
839
  } finally {
800
- settled.abort();
840
+ endScope(settled);
801
841
  }
802
842
  }
803
843
  function reportedPhase(source, apiRoute) {
@@ -1626,7 +1666,7 @@ async function bufferResponse(response, timeoutMs, signal) {
1626
1666
  cancel: (reason) => void reader.cancel(reason).catch(() => {})
1627
1667
  }, timeoutMs, "Metadata route body");
1628
1668
  } finally {
1629
- readDone.abort();
1669
+ endScope(readDone);
1630
1670
  }
1631
1671
  const bytes = concatBytes(chunks);
1632
1672
  const headers = new Headers(response.headers);
@@ -4371,7 +4411,7 @@ function noteWrapperRender(innerId, options, props) {
4371
4411
  }
4372
4412
  }
4373
4413
  // 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;
4414
+ 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
4415
  /** The Node helpers, which a `kind: 'node'` source can only exist alongside. */
4376
4416
  function requireNodeFlight() {
4377
4417
  if (!nodeFlight) throw new Error("[timber] a Node Flight source reached a runtime without node:stream");