@teyik0/furin 0.5.0-alpha.2 → 0.6.0-alpha.1

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 (97) hide show
  1. package/dist/adapter/runtime-build.d.ts +2 -0
  2. package/dist/build/entry-template.d.ts +2 -0
  3. package/dist/build/entry-template.ts +2 -0
  4. package/dist/build/index.js +8082 -6573
  5. package/dist/build/request-keys.d.ts +4 -0
  6. package/dist/cli/index.js +8071 -6562
  7. package/dist/client/browser-events-runtime.d.ts +2 -1
  8. package/dist/client/define-route.d.ts +0 -1
  9. package/dist/client/dev-error-overlay.ts +1 -0
  10. package/dist/client/document.d.ts +1 -0
  11. package/dist/client/hmr.d.ts +1 -1
  12. package/dist/client/link.js +101 -61
  13. package/dist/client.js +13 -8
  14. package/dist/define-route.d.ts +163 -101
  15. package/dist/furin.d.ts +3 -0
  16. package/dist/furin.js +7663 -6480
  17. package/dist/plugin/index.js +462 -127
  18. package/dist/plugin/transform-dev-page.d.ts +7 -0
  19. package/dist/server/auto-invalidate/registry.d.ts +4 -2
  20. package/dist/server/browser-events/plugin.d.ts +3 -0
  21. package/dist/server/dev/runtime.production.d.ts +1 -0
  22. package/dist/server/dev-page-plugin.d.ts +1 -0
  23. package/dist/server/internal.d.ts +2 -0
  24. package/dist/server/internal.js +67 -39
  25. package/dist/server/production-server.js +66 -38
  26. package/dist/server/render/assemble.d.ts +6 -6
  27. package/dist/server/render/document.d.ts +1 -1
  28. package/dist/server/render/element.d.ts +1 -1
  29. package/dist/server/render/loaders.d.ts +11 -3
  30. package/dist/server/render/mixed-cache.d.ts +6 -0
  31. package/dist/server/render/ssr.d.ts +3 -3
  32. package/dist/server/router/discovery.d.ts +1 -0
  33. package/dist/server/router/patterns.d.ts +3 -0
  34. package/dist/server/router/plugin.d.ts +3 -0
  35. package/dist/server/router/types.d.ts +4 -0
  36. package/dist/server/security/csp.d.ts +12 -0
  37. package/dist/server/sync/index.js +65 -37
  38. package/dist/server/sync/postgres/index.js +8 -0
  39. package/package.json +12 -11
  40. package/src/adapter/README.md +3 -0
  41. package/src/adapter/bun.ts +3 -0
  42. package/src/adapter/package.ts +4 -0
  43. package/src/adapter/runtime-build.ts +36 -2
  44. package/src/adapter/static.ts +10 -4
  45. package/src/adapter/vercel.ts +18 -10
  46. package/src/build/entry-template.ts +2 -0
  47. package/src/build/hydrate.ts +1 -0
  48. package/src/build/request-keys.ts +93 -0
  49. package/src/build/ssg-cache.ts +9 -4
  50. package/src/client/boundaries.tsx +1 -1
  51. package/src/client/browser-events-runtime.ts +69 -16
  52. package/src/client/define-route.ts +0 -1
  53. package/src/client/dev-error-overlay.ts +1 -0
  54. package/src/client/document.tsx +19 -2
  55. package/src/client/hmr.ts +3 -2
  56. package/src/client/router/boundary-tree.tsx +3 -4
  57. package/src/client/router/provider.tsx +109 -61
  58. package/src/define-route.ts +356 -127
  59. package/src/furin.ts +138 -25
  60. package/src/plugin/route-config-autofix.ts +2 -2
  61. package/src/plugin/routes.ts +16 -5
  62. package/src/plugin/transform-dev-page.ts +231 -0
  63. package/src/rsc/version.ts +5 -0
  64. package/src/server/auto-invalidate/registry.ts +53 -25
  65. package/src/server/browser-events/plugin.ts +112 -1
  66. package/src/server/cache/dev-loader.ts +1 -1
  67. package/src/server/cache/invalidation.ts +2 -0
  68. package/src/server/cache/isr-ssg.ts +1 -1
  69. package/src/server/cache/ssg.ts +1 -1
  70. package/src/server/dev/diagnostics.ts +4 -2
  71. package/src/server/dev/error.ts +2 -1
  72. package/src/server/dev/graph.ts +55 -6
  73. package/src/server/dev/runtime.production.ts +4 -0
  74. package/src/server/dev/symbolicate.ts +2 -0
  75. package/src/server/dev-page-plugin.ts +67 -4
  76. package/src/server/evlog.ts +1 -1
  77. package/src/server/internal.ts +2 -0
  78. package/src/server/render/assemble.ts +15 -11
  79. package/src/server/render/document.tsx +3 -1
  80. package/src/server/render/element.tsx +5 -5
  81. package/src/server/render/isr.ts +11 -5
  82. package/src/server/render/loaders.ts +243 -56
  83. package/src/server/render/mixed-cache.ts +298 -0
  84. package/src/server/render/not-found.ts +10 -4
  85. package/src/server/render/ppr-document.ts +45 -10
  86. package/src/server/render/ppr-route.ts +26 -12
  87. package/src/server/render/ssg.ts +2 -1
  88. package/src/server/render/ssr.ts +55 -31
  89. package/src/server/render/static-params.ts +1 -1
  90. package/src/server/router/discovery.ts +14 -0
  91. package/src/server/router/hmr.ts +106 -16
  92. package/src/server/router/patterns.ts +27 -0
  93. package/src/server/router/plugin.ts +69 -9
  94. package/src/server/router/source-version.ts +20 -2
  95. package/src/server/router/types.ts +4 -0
  96. package/src/server/security/csp.ts +44 -0
  97. package/src/server/sync/postgres/index.ts +8 -0
@@ -0,0 +1,7 @@
1
+ interface SplitDevPage {
2
+ contract: string;
3
+ render: string;
4
+ }
5
+ /** Split only a top-level route with an inline page that captures imports, not module state. */
6
+ export declare function splitDevPage(source: string, filePath: string, renderSpecifier: string): SplitDevPage | undefined;
7
+ export {};
@@ -1,10 +1,12 @@
1
1
  import { type FurinInstance } from "../instance.ts";
2
2
  export declare class AutoInvalidateRegistry {
3
3
  private readonly pathToTags;
4
+ private readonly pathOwners;
4
5
  private readonly tagToPaths;
5
- registerLoaderTags(urlPath: string, tags: readonly string[] | undefined): void;
6
+ private reindexPath;
7
+ registerLoaderTags(urlPath: string, tags: readonly string[] | undefined, owner?: string): void;
6
8
  pathsForTags(tags: readonly string[]): string[];
7
- unregisterPath(urlPath: string): void;
9
+ unregisterPath(urlPath: string, owner?: string): void;
8
10
  reset(): void;
9
11
  }
10
12
  /** The current furin instance's registry (see server/instance.ts). */
@@ -6,6 +6,9 @@ interface BrowserEventsPluginOptions {
6
6
  sync?: FurinSyncOptions;
7
7
  }
8
8
  export declare function createBrowserEventsPlugin(options: BrowserEventsPluginOptions): AnyElysia;
9
+ export declare function createSseBrowserEventsPlugin({ sync }: {
10
+ sync: FurinSyncOptions;
11
+ }): AnyElysia;
9
12
  export declare function browserEventsClientScript(basePath: string): string;
10
13
  export declare function injectBrowserEventsClient(html: string, basePath: string): string;
11
14
  export {};
@@ -3,4 +3,5 @@ export declare function createDevDiagnosticPlugin(_store: undefined, _instance:
3
3
  export declare function createDevelopmentBrowserEventSources(_instance: unknown, _diagnostics: undefined): readonly never[];
4
4
  export declare function devDiagnosticStore(): undefined;
5
5
  export declare function devGraph(): never;
6
+ export declare function developmentGraphs(): readonly never[];
6
7
  export declare function injectDevDiagnosticClient(html: string, _basePath: string): string;
@@ -116,6 +116,7 @@ export declare function rewriteRelativeImports(source: string, dir: string): str
116
116
  */
117
117
  export declare function rewriteBareImports(source: string, transpiled: string, dir: string): string;
118
118
  export declare function transformDevSource(raw: string, filePath: string, options: {
119
+ renderFragment?: boolean;
119
120
  rewriteBareImports: boolean;
120
121
  rewriteRelativeImports: boolean;
121
122
  }): string;
@@ -34,6 +34,8 @@ export interface CompileContext {
34
34
  rootPath: string;
35
35
  /** Per-route metadata including pre-computed segment boundaries. */
36
36
  routeMetadata?: Record<string, {
37
+ requestKeys?: string[];
38
+ requestKeysByLoader?: string[][];
37
39
  segmentBoundaries: Array<{
38
40
  depth: number;
39
41
  path: string;
@@ -11,7 +11,7 @@ var __esm = (fn, res, err) => () => {
11
11
  return res;
12
12
  };
13
13
 
14
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/streamResponse-OlirMA5P.mjs
14
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/streamResponse-OlirMA5P.mjs
15
15
  function shouldDeferEmitForResponse(response) {
16
16
  if (!response.body)
17
17
  return false;
@@ -91,7 +91,7 @@ function bindStreamingResponseLifecycle(response, onComplete) {
91
91
  }
92
92
  var init_streamResponse_OlirMA5P = () => {};
93
93
 
94
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/utils.mjs
94
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/utils.mjs
95
95
  function elapsedMs(startTime) {
96
96
  return Math.max(0, Date.now() - startTime);
97
97
  }
@@ -232,7 +232,7 @@ var init_utils = __esm(() => {
232
232
  _isoDate = /* @__PURE__ */ new Date;
233
233
  });
234
234
 
235
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/redact-C7FmdhwI.mjs
235
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/redact-C7FmdhwI.mjs
236
236
  function normalizeRedactPathPattern(pattern) {
237
237
  if (!pattern.includes("*") && !pattern.includes("."))
238
238
  return `**.${pattern}`;
@@ -541,7 +541,7 @@ var init_redact_C7FmdhwI = __esm(() => {
541
541
  globallyRedacted = Symbol.for("evlog.globallyRedacted");
542
542
  });
543
543
 
544
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/globalRegistry-Bh3bIGwA.mjs
544
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/globalRegistry-Bh3bIGwA.mjs
545
545
  function logPluginError(name, hook, err) {
546
546
  console.error(`[evlog/${name}] ${hook} failed:`, err);
547
547
  }
@@ -711,7 +711,7 @@ var init_globalRegistry_Bh3bIGwA = __esm(() => {
711
711
  globalConfig = getRegistry().config;
712
712
  });
713
713
 
714
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/pretty-error-D8rlWNL1.mjs
714
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/pretty-error-D8rlWNL1.mjs
715
715
  function pushTreeSpacer(children) {
716
716
  children.push(PRETTY_ERROR_TREE_SPACER);
717
717
  }
@@ -1012,7 +1012,7 @@ var init_pretty_error_D8rlWNL1 = __esm(() => {
1012
1012
  SKIP_FRAME_FN_RE = /^(?:createError|EvlogError|new EvlogError)$/;
1013
1013
  });
1014
1014
 
1015
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/dev-terminal-Brarc6vc.mjs
1015
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/dev-terminal-Brarc6vc.mjs
1016
1016
  function finalizePrettyError(partial, frameworkOverlay, pretty, inDev) {
1017
1017
  const compact = partial.compact ?? (inDev && pretty);
1018
1018
  const detail = partial.detail ?? (frameworkOverlay ? "guidance" : "full");
@@ -1065,7 +1065,7 @@ var init_dev_terminal_Brarc6vc = __esm(() => {
1065
1065
  };
1066
1066
  });
1067
1067
 
1068
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/wideEventChannel-BUDW48oP.mjs
1068
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/wideEventChannel-BUDW48oP.mjs
1069
1069
  function hasWideEventPublisher() {
1070
1070
  return publisher !== null;
1071
1071
  }
@@ -1081,7 +1081,7 @@ function publishWideEvent(event) {
1081
1081
  var publisher = null;
1082
1082
  var init_wideEventChannel_BUDW48oP = () => {};
1083
1083
 
1084
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/error-brand-D0-DCPvr.mjs
1084
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/error-brand-D0-DCPvr.mjs
1085
1085
  function isEvlogError(error) {
1086
1086
  return typeof error === "object" && error !== null && error[evlogErrorBrand] === true;
1087
1087
  }
@@ -1090,7 +1090,7 @@ var init_error_brand_D0_DCPvr = __esm(() => {
1090
1090
  evlogErrorBrand = Symbol.for("evlog.error.brand");
1091
1091
  });
1092
1092
 
1093
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/error.mjs
1093
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/error.mjs
1094
1094
  var evlogErrorInternalKey, evlogErrorDataKey, EvlogError;
1095
1095
  var init_error = __esm(() => {
1096
1096
  init_utils();
@@ -1199,7 +1199,7 @@ var init_error = __esm(() => {
1199
1199
  });
1200
1200
  });
1201
1201
 
1202
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/headers-Bx1ieR-m.mjs
1202
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/headers-Bx1ieR-m.mjs
1203
1203
  function extractSafeHeaders(headers) {
1204
1204
  const raw = {};
1205
1205
  headers.forEach((value, key) => {
@@ -1220,7 +1220,7 @@ var init_headers_Bx1ieR_m = __esm(() => {
1220
1220
  init_utils();
1221
1221
  });
1222
1222
 
1223
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/audit-C8euLMvu.mjs
1223
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/audit-C8euLMvu.mjs
1224
1224
  function writePrettyStdout(text) {
1225
1225
  (globalThis.__evlogNativeStdoutWrite ?? nativeStdoutWrite)?.(text);
1226
1226
  }
@@ -2142,7 +2142,7 @@ var init_audit_C8euLMvu = __esm(() => {
2142
2142
  initLogger(__EVLOG_CONFIG__);
2143
2143
  });
2144
2144
 
2145
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/errors-CL8dDgIi.mjs
2145
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/errors-CL8dDgIi.mjs
2146
2146
  function extractErrorStatus(error) {
2147
2147
  if (error === null || typeof error !== "object")
2148
2148
  return 500;
@@ -2152,7 +2152,7 @@ function extractErrorStatus(error) {
2152
2152
  }
2153
2153
  var init_errors_CL8dDgIi = () => {};
2154
2154
 
2155
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/deferred-drain-CfRYimo5.mjs
2155
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/deferred-drain-CfRYimo5.mjs
2156
2156
  function shouldLog(path, include, exclude) {
2157
2157
  if (exclude && exclude.length > 0) {
2158
2158
  if (exclude.some((pattern) => matchesPattern(path, pattern)))
@@ -2180,7 +2180,7 @@ var init_deferred_drain_CfRYimo5 = __esm(() => {
2180
2180
  init_utils();
2181
2181
  });
2182
2182
 
2183
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/middleware-fam3VyaL.mjs
2183
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/middleware-fam3VyaL.mjs
2184
2184
  function resolveMiddlewarePluginRunner(options) {
2185
2185
  const global = getGlobalPluginRunner();
2186
2186
  const local = options.plugins;
@@ -2375,7 +2375,7 @@ var init_middleware_fam3VyaL = __esm(() => {
2375
2375
  runnerCache = /* @__PURE__ */ new WeakMap;
2376
2376
  });
2377
2377
 
2378
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/integration-CGD18W8r.mjs
2378
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/integration-CGD18W8r.mjs
2379
2379
  function attachForkToLogger(storage, parent, middlewareOptions, lifecycle) {
2380
2380
  const log = parent;
2381
2381
  log.fork = (label, fn) => {
@@ -2478,7 +2478,7 @@ var init_integration_CGD18W8r = __esm(() => {
2478
2478
  init_middleware_fam3VyaL();
2479
2479
  });
2480
2480
 
2481
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/toolkit/storage.mjs
2481
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/toolkit/storage.mjs
2482
2482
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
2483
2483
  function createLoggerStorage(contextHint, id = contextHint) {
2484
2484
  const storage = getSharedStorage(id, () => new AsyncLocalStorage2);
@@ -2497,7 +2497,7 @@ var init_storage = __esm(() => {
2497
2497
  init_globalRegistry_Bh3bIGwA();
2498
2498
  });
2499
2499
 
2500
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/toolkit.mjs
2500
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/toolkit.mjs
2501
2501
  var init_toolkit = __esm(() => {
2502
2502
  init_integration_CGD18W8r();
2503
2503
  init_storage();
@@ -2594,14 +2594,29 @@ function instanceSlot(init) {
2594
2594
  // src/server/auto-invalidate/registry.ts
2595
2595
  class AutoInvalidateRegistry {
2596
2596
  pathToTags = new Map;
2597
+ pathOwners = new Map;
2597
2598
  tagToPaths = new Map;
2598
- registerLoaderTags(urlPath, tags) {
2599
- if (!tags || tags.length === 0) {
2600
- this.unregisterPath(urlPath);
2599
+ reindexPath(urlPath) {
2600
+ const previous = this.pathToTags.get(urlPath);
2601
+ if (previous) {
2602
+ for (const tag of previous) {
2603
+ const paths = this.tagToPaths.get(tag);
2604
+ paths?.delete(urlPath);
2605
+ if (paths?.size === 0) {
2606
+ this.tagToPaths.delete(tag);
2607
+ }
2608
+ }
2609
+ }
2610
+ const uniqueTags = new Set;
2611
+ for (const tags of this.pathOwners.get(urlPath)?.values() ?? []) {
2612
+ for (const tag of tags) {
2613
+ uniqueTags.add(tag);
2614
+ }
2615
+ }
2616
+ if (uniqueTags.size === 0) {
2617
+ this.pathToTags.delete(urlPath);
2601
2618
  return;
2602
2619
  }
2603
- this.unregisterPath(urlPath);
2604
- const uniqueTags = new Set(tags);
2605
2620
  this.pathToTags.set(urlPath, uniqueTags);
2606
2621
  for (const tag of uniqueTags) {
2607
2622
  let paths = this.tagToPaths.get(tag);
@@ -2612,6 +2627,23 @@ class AutoInvalidateRegistry {
2612
2627
  paths.add(urlPath);
2613
2628
  }
2614
2629
  }
2630
+ registerLoaderTags(urlPath, tags, owner) {
2631
+ const ownerKey = owner ?? "default";
2632
+ let owners = this.pathOwners.get(urlPath);
2633
+ if (tags === undefined || tags.length === 0) {
2634
+ owners?.delete(ownerKey);
2635
+ if (owners?.size === 0) {
2636
+ this.pathOwners.delete(urlPath);
2637
+ }
2638
+ } else {
2639
+ if (!owners) {
2640
+ owners = new Map;
2641
+ this.pathOwners.set(urlPath, owners);
2642
+ }
2643
+ owners.set(ownerKey, new Set(tags));
2644
+ }
2645
+ this.reindexPath(urlPath);
2646
+ }
2615
2647
  pathsForTags(tags) {
2616
2648
  const paths = new Set;
2617
2649
  for (const tag of tags) {
@@ -2621,34 +2653,30 @@ class AutoInvalidateRegistry {
2621
2653
  }
2622
2654
  return [...paths];
2623
2655
  }
2624
- unregisterPath(urlPath) {
2625
- const tags = this.pathToTags.get(urlPath);
2626
- if (!tags) {
2627
- return;
2628
- }
2629
- for (const tag of tags) {
2630
- const paths = this.tagToPaths.get(tag);
2631
- if (!paths) {
2632
- continue;
2633
- }
2634
- paths.delete(urlPath);
2635
- if (paths.size === 0) {
2636
- this.tagToPaths.delete(tag);
2656
+ unregisterPath(urlPath, owner) {
2657
+ if (owner === undefined) {
2658
+ this.pathOwners.delete(urlPath);
2659
+ } else {
2660
+ const owners = this.pathOwners.get(urlPath);
2661
+ owners?.delete(owner);
2662
+ if (owners?.size === 0) {
2663
+ this.pathOwners.delete(urlPath);
2637
2664
  }
2638
2665
  }
2639
- this.pathToTags.delete(urlPath);
2666
+ this.reindexPath(urlPath);
2640
2667
  }
2641
2668
  reset() {
2642
2669
  this.pathToTags.clear();
2670
+ this.pathOwners.clear();
2643
2671
  this.tagToPaths.clear();
2644
2672
  }
2645
2673
  }
2646
2674
  var instanceAutoInvalidateRegistry = instanceSlot(() => new AutoInvalidateRegistry);
2647
2675
  var autoInvalidateRegistry = {
2648
2676
  pathsForTags: (tags) => instanceAutoInvalidateRegistry().pathsForTags(tags),
2649
- registerLoaderTags: (urlPath, tags) => instanceAutoInvalidateRegistry().registerLoaderTags(urlPath, tags),
2677
+ registerLoaderTags: (urlPath, tags, owner) => instanceAutoInvalidateRegistry().registerLoaderTags(urlPath, tags, owner),
2650
2678
  reset: () => instanceAutoInvalidateRegistry().reset(),
2651
- unregisterPath: (urlPath) => instanceAutoInvalidateRegistry().unregisterPath(urlPath)
2679
+ unregisterPath: (urlPath, owner) => instanceAutoInvalidateRegistry().unregisterPath(urlPath, owner)
2652
2680
  };
2653
2681
 
2654
2682
  // src/server/cache/route-cache.ts
@@ -2755,7 +2783,7 @@ function createHtmlRouteCache(mode, options) {
2755
2783
  maxSize: MAX_HTML_CACHE_SIZE,
2756
2784
  name: `render:${mode}-html`,
2757
2785
  onDelete: (key, entry) => {
2758
- autoInvalidateRegistry.unregisterPath(key);
2786
+ autoInvalidateRegistry.unregisterPath(key, `render:${mode}-html`);
2759
2787
  options?.onDelete?.(key, entry);
2760
2788
  },
2761
2789
  pathFromKey: pathWithoutSearch
@@ -71,14 +71,29 @@ function instanceSlot(init) {
71
71
  // src/server/auto-invalidate/registry.ts
72
72
  class AutoInvalidateRegistry {
73
73
  pathToTags = new Map;
74
+ pathOwners = new Map;
74
75
  tagToPaths = new Map;
75
- registerLoaderTags(urlPath, tags) {
76
- if (!tags || tags.length === 0) {
77
- this.unregisterPath(urlPath);
76
+ reindexPath(urlPath) {
77
+ const previous = this.pathToTags.get(urlPath);
78
+ if (previous) {
79
+ for (const tag of previous) {
80
+ const paths = this.tagToPaths.get(tag);
81
+ paths?.delete(urlPath);
82
+ if (paths?.size === 0) {
83
+ this.tagToPaths.delete(tag);
84
+ }
85
+ }
86
+ }
87
+ const uniqueTags = new Set;
88
+ for (const tags of this.pathOwners.get(urlPath)?.values() ?? []) {
89
+ for (const tag of tags) {
90
+ uniqueTags.add(tag);
91
+ }
92
+ }
93
+ if (uniqueTags.size === 0) {
94
+ this.pathToTags.delete(urlPath);
78
95
  return;
79
96
  }
80
- this.unregisterPath(urlPath);
81
- const uniqueTags = new Set(tags);
82
97
  this.pathToTags.set(urlPath, uniqueTags);
83
98
  for (const tag of uniqueTags) {
84
99
  let paths = this.tagToPaths.get(tag);
@@ -89,6 +104,23 @@ class AutoInvalidateRegistry {
89
104
  paths.add(urlPath);
90
105
  }
91
106
  }
107
+ registerLoaderTags(urlPath, tags, owner) {
108
+ const ownerKey = owner ?? "default";
109
+ let owners = this.pathOwners.get(urlPath);
110
+ if (tags === undefined || tags.length === 0) {
111
+ owners?.delete(ownerKey);
112
+ if (owners?.size === 0) {
113
+ this.pathOwners.delete(urlPath);
114
+ }
115
+ } else {
116
+ if (!owners) {
117
+ owners = new Map;
118
+ this.pathOwners.set(urlPath, owners);
119
+ }
120
+ owners.set(ownerKey, new Set(tags));
121
+ }
122
+ this.reindexPath(urlPath);
123
+ }
92
124
  pathsForTags(tags) {
93
125
  const paths = new Set;
94
126
  for (const tag of tags) {
@@ -98,34 +130,30 @@ class AutoInvalidateRegistry {
98
130
  }
99
131
  return [...paths];
100
132
  }
101
- unregisterPath(urlPath) {
102
- const tags = this.pathToTags.get(urlPath);
103
- if (!tags) {
104
- return;
105
- }
106
- for (const tag of tags) {
107
- const paths = this.tagToPaths.get(tag);
108
- if (!paths) {
109
- continue;
110
- }
111
- paths.delete(urlPath);
112
- if (paths.size === 0) {
113
- this.tagToPaths.delete(tag);
133
+ unregisterPath(urlPath, owner) {
134
+ if (owner === undefined) {
135
+ this.pathOwners.delete(urlPath);
136
+ } else {
137
+ const owners = this.pathOwners.get(urlPath);
138
+ owners?.delete(owner);
139
+ if (owners?.size === 0) {
140
+ this.pathOwners.delete(urlPath);
114
141
  }
115
142
  }
116
- this.pathToTags.delete(urlPath);
143
+ this.reindexPath(urlPath);
117
144
  }
118
145
  reset() {
119
146
  this.pathToTags.clear();
147
+ this.pathOwners.clear();
120
148
  this.tagToPaths.clear();
121
149
  }
122
150
  }
123
151
  var instanceAutoInvalidateRegistry = instanceSlot(() => new AutoInvalidateRegistry);
124
152
  var autoInvalidateRegistry = {
125
153
  pathsForTags: (tags) => instanceAutoInvalidateRegistry().pathsForTags(tags),
126
- registerLoaderTags: (urlPath, tags) => instanceAutoInvalidateRegistry().registerLoaderTags(urlPath, tags),
154
+ registerLoaderTags: (urlPath, tags, owner) => instanceAutoInvalidateRegistry().registerLoaderTags(urlPath, tags, owner),
127
155
  reset: () => instanceAutoInvalidateRegistry().reset(),
128
- unregisterPath: (urlPath) => instanceAutoInvalidateRegistry().unregisterPath(urlPath)
156
+ unregisterPath: (urlPath, owner) => instanceAutoInvalidateRegistry().unregisterPath(urlPath, owner)
129
157
  };
130
158
 
131
159
  // src/server/cache/route-cache.ts
@@ -232,7 +260,7 @@ function createHtmlRouteCache(mode, options) {
232
260
  maxSize: MAX_HTML_CACHE_SIZE,
233
261
  name: `render:${mode}-html`,
234
262
  onDelete: (key, entry) => {
235
- autoInvalidateRegistry.unregisterPath(key);
263
+ autoInvalidateRegistry.unregisterPath(key, `render:${mode}-html`);
236
264
  options?.onDelete?.(key, entry);
237
265
  },
238
266
  pathFromKey: pathWithoutSearch
@@ -306,7 +334,7 @@ async function waitForPendingISRRevalidations() {
306
334
 
307
335
  // src/server/evlog.ts
308
336
  import { Elysia } from "elysia";
309
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/streamResponse-OlirMA5P.mjs
337
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/streamResponse-OlirMA5P.mjs
310
338
  function shouldDeferEmitForResponse(response) {
311
339
  if (!response.body)
312
340
  return false;
@@ -384,7 +412,7 @@ function bindStreamingResponseLifecycle(response, onComplete) {
384
412
  headers: response.headers
385
413
  });
386
414
  }
387
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/utils.mjs
415
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/utils.mjs
388
416
  function elapsedMs(startTime) {
389
417
  return Math.max(0, Date.now() - startTime);
390
418
  }
@@ -524,7 +552,7 @@ function isoNow() {
524
552
  return `${_isoCachedPrefix}.${String(now % 1000).padStart(3, "0")}Z`;
525
553
  }
526
554
 
527
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/redact-C7FmdhwI.mjs
555
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/redact-C7FmdhwI.mjs
528
556
  var DEFAULT_REPLACEMENT = "[REDACTED]";
529
557
  function normalizeRedactPathPattern(pattern) {
530
558
  if (!pattern.includes("*") && !pattern.includes("."))
@@ -830,7 +858,7 @@ function applyMaskers(value, maskers) {
830
858
  return result;
831
859
  }
832
860
 
833
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/globalRegistry-Bh3bIGwA.mjs
861
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/globalRegistry-Bh3bIGwA.mjs
834
862
  function logPluginError(name, hook, err) {
835
863
  console.error(`[evlog/${name}] ${hook} failed:`, err);
836
864
  }
@@ -997,7 +1025,7 @@ function getSharedStorage(id, create) {
997
1025
  return storage;
998
1026
  }
999
1027
 
1000
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/pretty-error-D8rlWNL1.mjs
1028
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/pretty-error-D8rlWNL1.mjs
1001
1029
  var snippetReader = null;
1002
1030
  var PRETTY_ERROR_TREE_SPACER = "__EVLOG_TREE_SPACER__";
1003
1031
  function pushTreeSpacer(children) {
@@ -1298,7 +1326,7 @@ function buildErrorEntries(error, options = {}) {
1298
1326
  }];
1299
1327
  }
1300
1328
 
1301
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/dev-terminal-Brarc6vc.mjs
1329
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/dev-terminal-Brarc6vc.mjs
1302
1330
  var DEV_PRESETS = {
1303
1331
  evlog: {
1304
1332
  frameworkOverlay: false,
@@ -1347,7 +1375,7 @@ function resolveDevTerminal(input = {}) {
1347
1375
  };
1348
1376
  }
1349
1377
 
1350
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/wideEventChannel-BUDW48oP.mjs
1378
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/wideEventChannel-BUDW48oP.mjs
1351
1379
  var publisher = null;
1352
1380
  function hasWideEventPublisher() {
1353
1381
  return publisher !== null;
@@ -1362,13 +1390,13 @@ function publishWideEvent(event) {
1362
1390
  }
1363
1391
  }
1364
1392
 
1365
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/error-brand-D0-DCPvr.mjs
1393
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/error-brand-D0-DCPvr.mjs
1366
1394
  var evlogErrorBrand = Symbol.for("evlog.error.brand");
1367
1395
  function isEvlogError(error) {
1368
1396
  return typeof error === "object" && error !== null && error[evlogErrorBrand] === true;
1369
1397
  }
1370
1398
 
1371
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/error.mjs
1399
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/error.mjs
1372
1400
  var evlogErrorInternalKey = Symbol.for("evlog.error.internal");
1373
1401
  var evlogErrorDataKey = Symbol.for("evlog.error.data");
1374
1402
  var EvlogError = class EvlogError extends Error {
@@ -1472,7 +1500,7 @@ Object.defineProperty(EvlogError.prototype, evlogErrorBrand, {
1472
1500
  enumerable: false
1473
1501
  });
1474
1502
 
1475
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/headers-Bx1ieR-m.mjs
1503
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/headers-Bx1ieR-m.mjs
1476
1504
  function extractSafeHeaders(headers) {
1477
1505
  const raw = {};
1478
1506
  headers.forEach((value, key) => {
@@ -1490,7 +1518,7 @@ function extractSafeNodeHeaders(headers) {
1490
1518
  return filterSafeHeaders(raw);
1491
1519
  }
1492
1520
 
1493
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/audit-C8euLMvu.mjs
1521
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/audit-C8euLMvu.mjs
1494
1522
  var nativeStdoutWrite = typeof process !== "undefined" && typeof process.stdout?.write === "function" ? process.stdout.write.bind(process.stdout) : undefined;
1495
1523
  function writePrettyStdout(text) {
1496
1524
  (globalThis.__evlogNativeStdoutWrite ?? nativeStdoutWrite)?.(text);
@@ -2406,7 +2434,7 @@ function finalizeAudit(event) {
2406
2434
  _testCollector?.(decorated, event);
2407
2435
  }
2408
2436
 
2409
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/errors-CL8dDgIi.mjs
2437
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/errors-CL8dDgIi.mjs
2410
2438
  function extractErrorStatus(error) {
2411
2439
  if (error === null || typeof error !== "object")
2412
2440
  return 500;
@@ -2415,7 +2443,7 @@ function extractErrorStatus(error) {
2415
2443
  return Number.isFinite(status) ? status : 500;
2416
2444
  }
2417
2445
 
2418
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/deferred-drain-CfRYimo5.mjs
2446
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/deferred-drain-CfRYimo5.mjs
2419
2447
  function shouldLog(path, include, exclude) {
2420
2448
  if (exclude && exclude.length > 0) {
2421
2449
  if (exclude.some((pattern) => matchesPattern(path, pattern)))
@@ -2440,7 +2468,7 @@ function extendDeferredDrain(drainPromise, waitUntil) {
2440
2468
  waitUntil(drainPromise);
2441
2469
  }
2442
2470
 
2443
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/middleware-fam3VyaL.mjs
2471
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/middleware-fam3VyaL.mjs
2444
2472
  var noopResult = {
2445
2473
  logger: noopLogger,
2446
2474
  finish: () => Promise.resolve(null),
@@ -2624,7 +2652,7 @@ function createMiddlewareLogger(options) {
2624
2652
  };
2625
2653
  }
2626
2654
 
2627
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/integration-CGD18W8r.mjs
2655
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/integration-CGD18W8r.mjs
2628
2656
  function attachForkToLogger(storage, parent, middlewareOptions, lifecycle) {
2629
2657
  const log = parent;
2630
2658
  log.fork = (label, fn) => {
@@ -2720,7 +2748,7 @@ function defineFrameworkIntegration(spec) {
2720
2748
  };
2721
2749
  } };
2722
2750
  }
2723
- // ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/toolkit/storage.mjs
2751
+ // ../../node_modules/.bun/evlog@2.29.0+dbd53f8719b7cf53/node_modules/evlog/dist/toolkit/storage.mjs
2724
2752
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
2725
2753
  function createLoggerStorage(contextHint, id = contextHint) {
2726
2754
  const storage = getSharedStorage(id, () => new AsyncLocalStorage2);
@@ -18,9 +18,9 @@ export declare const FURIN_DEFERRED_GLOBAL = "__FURIN_DEFERRED__";
18
18
  * Synchronous loader data is NOT carried here — it lives exclusively in the
19
19
  * `__FURIN_DATA__` JSON script that the hydrate entry reads.
20
20
  *
21
- * CSP note: this is an inline `<script>` — nonce support is a v2 concern.
22
21
  */
23
- export declare function buildDeferredScript(deferredKeys: string[]): string;
22
+ export declare function nonceAttribute(nonce?: string): string;
23
+ export declare function buildDeferredScript(deferredKeys: string[], nonce?: string): string;
24
24
  /**
25
25
  * Generates a late `<script>` that settles one deferred Promise on the client.
26
26
  * The `chunk` must be a seroval CrossJSON value produced by `toCrossJSON(value)`.
@@ -29,7 +29,7 @@ export declare function buildDeferredScript(deferredKeys: string[]): string;
29
29
  * @param chunk - The already-serialised CrossJSON value
30
30
  * @param action - "resolve" or "reject"
31
31
  */
32
- export declare function buildDeferredResolution(key: string, chunk: ReturnType<typeof toCrossJSON>, action: "resolve" | "reject"): string;
32
+ export declare function buildDeferredResolution(key: string, chunk: ReturnType<typeof toCrossJSON>, action: "resolve" | "reject", nonce?: string): string;
33
33
  /** Minimal context passed to background / synthetic render helpers — only `request` is needed. */
34
34
  export interface LoaderContext {
35
35
  request: Request;
@@ -37,8 +37,8 @@ export interface LoaderContext {
37
37
  export declare function resolvePath(pattern: string, params: Record<string, string>): string;
38
38
  export declare function streamToString(stream: ReadableStream): Promise<string>;
39
39
  export declare function buildRouteFrameTemplate(payload: string): string;
40
- export declare function buildRouteFrameStreamScript(): string;
41
- export declare function buildRouteFramePushScript(payload: string): string;
42
- export declare function buildRouteFrameCloseScript(): string;
40
+ export declare function buildRouteFrameStreamScript(nonce?: string): string;
41
+ export declare function buildRouteFramePushScript(payload: string, nonce?: string): string;
42
+ export declare function buildRouteFrameCloseScript(nonce?: string): string;
43
43
  export declare function buildSyncRuntimeScript(): string;
44
44
  export declare function injectSyncRuntimeScript(html: string): string;
@@ -1,4 +1,4 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type DocumentAssets } from "../../client/document.tsx";
3
3
  import type { HeadOptions } from "../../client.ts";
4
- export declare function withDocumentState(element: ReactNode, assets: DocumentAssets, head: HeadOptions | undefined, data: object | undefined): ReactNode;
4
+ export declare function withDocumentState(element: ReactNode, assets: DocumentAssets, head: HeadOptions | undefined, data: object | undefined, nonce?: string): ReactNode;
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  import type { RuntimeRoute } from "../../client/internal/runtime-types.ts";
3
3
  import type { ErrorComponent } from "../../shared/error.ts";
4
4
  import type { FurinNotFoundError, NotFoundComponent } from "../../shared/not-found.ts";
@@ -43,12 +43,15 @@ export type LoaderResult = {
43
43
  message: string;
44
44
  headers: Record<string, string>;
45
45
  };
46
- export declare function runRequestLoaderData(route: ResolvedRoute, ctx: Context): Promise<object> | undefined;
46
+ export declare function runRequestLoaderFields(route: ResolvedRoute, ctx: Context): {
47
+ fields: Record<string, Promise<unknown>>;
48
+ noFieldCompletion: Promise<void>;
49
+ } | undefined;
47
50
  export declare function withRequestLoaderData(route: ResolvedRoute, ctx: Context, publicResult: Extract<LoaderResult, {
48
51
  type: "data";
49
- }>): Extract<LoaderResult, {
52
+ }>): Promise<Extract<LoaderResult, {
50
53
  type: "data";
51
- }>;
54
+ }>>;
52
55
  /**
53
56
  * Normalises an error thrown inside a deferred Promise into a value that is
54
57
  * safe to send through `toCrossJSON` and that preserves the original semantics
@@ -69,4 +72,9 @@ export declare function withRequestLoaderData(route: ResolvedRoute, ctx: Context
69
72
  export declare function serializeDeferredRejection(err: unknown): Promise<unknown>;
70
73
  export declare function runLoaders(route: ResolvedRoute, ctx: Context): Promise<LoaderResult>;
71
74
  export declare function runPublicLoaders(route: ResolvedRoute, ctx: Context): Promise<LoaderResult>;
75
+ export declare function hasSsrLoaderAncestor(route: ResolvedRoute): boolean;
76
+ export declare function hasMixedLoaderModes(route: ResolvedRoute): boolean;
77
+ export declare function runMixedLoaders(route: ResolvedRoute, ctx: Context): Promise<LoaderResult>;
78
+ export declare function runRouteLoaders(route: ResolvedRoute, ctx: Context): Promise<LoaderResult>;
79
+ export declare function runSegmentPublicLoaders(route: ResolvedRoute, ctx: Context): Promise<LoaderResult>;
72
80
  export declare function hasRequestLoader(route: ResolvedRoute): boolean;