@teyik0/furin 0.5.0-alpha.2 → 0.7.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 (230) hide show
  1. package/dist/adapter/runtime-build.d.ts +3 -1
  2. package/dist/build/client.d.ts +4 -1
  3. package/dist/build/entry-template.d.ts +5 -0
  4. package/dist/build/entry-template.ts +9 -0
  5. package/dist/build/hydrate.d.ts +1 -1
  6. package/dist/build/index.js +9589 -6685
  7. package/dist/build/preload-manifest.d.ts +17 -0
  8. package/dist/build/request-keys.d.ts +4 -0
  9. package/dist/build/types.d.ts +6 -0
  10. package/dist/cli/index.js +9539 -6644
  11. package/dist/client/browser-events-runtime.d.ts +2 -1
  12. package/dist/client/client-module.d.ts +26 -0
  13. package/dist/client/define-route.d.ts +9 -1
  14. package/dist/client/dev-error-overlay.ts +1 -0
  15. package/dist/client/document.d.ts +3 -0
  16. package/dist/client/hmr.d.ts +1 -1
  17. package/dist/client/internal/runtime-types.d.ts +2 -0
  18. package/dist/client/link.js +1011 -157
  19. package/dist/client/mutation.d.ts +38 -0
  20. package/dist/client/query-store.d.ts +85 -0
  21. package/dist/client/query.d.ts +14 -0
  22. package/dist/client/route-api.d.ts +11 -0
  23. package/dist/client/router/context.d.ts +3 -2
  24. package/dist/client/router/index.d.ts +1 -1
  25. package/dist/client/router/link-utils.d.ts +8 -1
  26. package/dist/client/router/navigation.d.ts +2 -9
  27. package/dist/client/router/optimistic.d.ts +41 -0
  28. package/dist/client/router/search/index.d.ts +3 -3
  29. package/dist/client/router/search-store.d.ts +1 -0
  30. package/dist/client/router/sync-catch-up.d.ts +3 -0
  31. package/dist/client/router/types.d.ts +49 -7
  32. package/dist/client/sync.d.ts +39 -22
  33. package/dist/client.d.ts +11 -33
  34. package/dist/client.js +1222 -57
  35. package/dist/config.d.ts +7 -0
  36. package/dist/config.js +1 -0
  37. package/dist/define-route.d.ts +231 -123
  38. package/dist/env.d.ts +2 -2
  39. package/dist/furin.d.ts +4 -2
  40. package/dist/furin.js +9717 -6796
  41. package/dist/plugin/hmr-dependencies.d.ts +2 -0
  42. package/dist/plugin/index.js +811 -145
  43. package/dist/plugin/transform-client-module.d.ts +16 -0
  44. package/dist/plugin/transform-client.d.ts +2 -0
  45. package/dist/plugin/transform-dev-page.d.ts +7 -0
  46. package/dist/plugin/transform-isomorphic.d.ts +1 -1
  47. package/dist/routes.d.ts +6 -0
  48. package/dist/rsc-client.js +87 -16
  49. package/dist/rsc.js +87 -16
  50. package/dist/server/auto-invalidate/registry.d.ts +5 -2
  51. package/dist/server/auto-invalidate/types.d.ts +2 -0
  52. package/dist/server/browser-events/plugin.d.ts +3 -0
  53. package/dist/server/cache/isr.d.ts +2 -4
  54. package/dist/server/cache/route-cache.d.ts +5 -0
  55. package/dist/server/dev/graph.d.ts +1 -0
  56. package/dist/server/dev/runtime.production.d.ts +1 -0
  57. package/dist/server/dev-page-plugin.d.ts +6 -19
  58. package/dist/server/internal.d.ts +5 -0
  59. package/dist/server/internal.js +105 -57
  60. package/dist/server/production-server.js +104 -56
  61. package/dist/server/render/assemble.d.ts +6 -6
  62. package/dist/server/render/document.d.ts +1 -1
  63. package/dist/server/render/element.d.ts +1 -1
  64. package/dist/server/render/loaders.d.ts +15 -5
  65. package/dist/server/render/mixed-cache.d.ts +6 -0
  66. package/dist/server/render/react-stream.d.ts +3 -0
  67. package/dist/server/render/ssr.d.ts +5 -4
  68. package/dist/server/render/template.d.ts +4 -0
  69. package/dist/server/router/defined-route.d.ts +2 -0
  70. package/dist/server/router/discovery.d.ts +1 -0
  71. package/dist/server/router/hmr.d.ts +1 -1
  72. package/dist/server/router/patterns.d.ts +3 -0
  73. package/dist/server/router/plugin.d.ts +3 -0
  74. package/dist/server/router/types.d.ts +4 -0
  75. package/dist/server/security/csp.d.ts +12 -0
  76. package/dist/server/sync/adapter.d.ts +25 -4
  77. package/dist/server/sync/atomic.d.ts +25 -0
  78. package/dist/server/sync/drizzle/index.d.ts +45 -0
  79. package/dist/server/sync/drizzle/index.js +540 -0
  80. package/dist/server/sync/execution-error.d.ts +2 -0
  81. package/dist/server/sync/index.d.ts +2 -1
  82. package/dist/server/sync/index.js +580 -124
  83. package/dist/server/sync/mutation-handler.d.ts +4 -0
  84. package/dist/server/sync/plugin.d.ts +34 -11
  85. package/dist/server/sync/postgres/execute.d.ts +3 -0
  86. package/dist/server/sync/postgres/index.d.ts +12 -1
  87. package/dist/server/sync/postgres/index.js +42 -13
  88. package/dist/server/sync/postgres/sql.d.ts +8 -0
  89. package/dist/server/sync/prisma/index.d.ts +24 -0
  90. package/dist/server/sync/prisma/index.js +340 -0
  91. package/dist/server/sync/queries.d.ts +21 -0
  92. package/dist/server/sync/query-context.d.ts +5 -0
  93. package/dist/server/sync/redis/index.js +3 -3
  94. package/dist/server/sync/redis/scripts.d.ts +1 -1
  95. package/dist/server/sync/response.d.ts +1 -0
  96. package/dist/server/sync/sqlite/index.d.ts +3 -0
  97. package/dist/server/sync/sqlite/index.js +10 -4
  98. package/dist/server/sync/stream.d.ts +2 -5
  99. package/dist/server/sync/validation.d.ts +4 -0
  100. package/dist/shared/defer.d.ts +31 -0
  101. package/dist/shared/error.d.ts +2 -2
  102. package/dist/shared/page-key.d.ts +7 -0
  103. package/dist/shared/query-bindings.d.ts +12 -0
  104. package/dist/shared/route-frame.d.ts +1 -0
  105. package/dist/shared/sync-query.d.ts +40 -0
  106. package/package.json +40 -16
  107. package/src/adapter/README.md +3 -0
  108. package/src/adapter/bun.ts +3 -0
  109. package/src/adapter/package.ts +16 -2
  110. package/src/adapter/runtime-build.ts +99 -14
  111. package/src/adapter/static.ts +17 -6
  112. package/src/adapter/vercel.ts +33 -23
  113. package/src/build/client.ts +23 -5
  114. package/src/build/entry-template.ts +9 -0
  115. package/src/build/hydrate.ts +18 -3
  116. package/src/build/preload-manifest.ts +100 -0
  117. package/src/build/production-instrumentation.ts +6 -3
  118. package/src/build/request-keys.ts +93 -0
  119. package/src/build/ssg-cache.ts +9 -4
  120. package/src/build/types.ts +4 -0
  121. package/src/cli/index.ts +1 -0
  122. package/src/client/boundaries.tsx +1 -1
  123. package/src/client/browser-events-runtime.ts +73 -16
  124. package/src/client/client-module.ts +57 -0
  125. package/src/client/define-route.ts +11 -2
  126. package/src/client/dev-error-overlay.ts +1 -0
  127. package/src/client/document.tsx +47 -20
  128. package/src/client/hmr.ts +4 -2
  129. package/src/client/internal/runtime-types.ts +2 -0
  130. package/src/client/link.tsx +8 -8
  131. package/src/client/mutation.ts +136 -0
  132. package/src/client/query-store.ts +418 -0
  133. package/src/client/query.tsx +67 -0
  134. package/src/client/route-api.tsx +75 -0
  135. package/src/client/router/boundary-tree.tsx +10 -6
  136. package/src/client/router/context.ts +57 -4
  137. package/src/client/router/index.ts +3 -0
  138. package/src/client/router/link-utils.ts +29 -1
  139. package/src/client/router/navigation.ts +3 -50
  140. package/src/client/router/optimistic.ts +233 -0
  141. package/src/client/router/provider.tsx +404 -96
  142. package/src/client/router/search/index.ts +37 -17
  143. package/src/client/router/search-store.ts +4 -0
  144. package/src/client/router/sync-catch-up.ts +7 -0
  145. package/src/client/router/types.ts +71 -9
  146. package/src/client/sync.ts +438 -65
  147. package/src/client.ts +20 -60
  148. package/src/config.ts +5 -0
  149. package/src/define-route.ts +442 -155
  150. package/src/env.d.ts +2 -2
  151. package/src/furin.ts +213 -38
  152. package/src/plugin/hmr-dependencies.ts +58 -0
  153. package/src/plugin/index.ts +38 -2
  154. package/src/plugin/route-config-autofix.ts +2 -2
  155. package/src/plugin/routes.ts +19 -8
  156. package/src/plugin/transform-client-module.ts +123 -0
  157. package/src/plugin/transform-client.ts +293 -13
  158. package/src/plugin/transform-dev-page.ts +231 -0
  159. package/src/plugin/transform-isomorphic.ts +11 -5
  160. package/src/routes.ts +8 -0
  161. package/src/rsc/shared.tsx +104 -18
  162. package/src/rsc/version.ts +5 -0
  163. package/src/server/auto-invalidate/registry.ts +56 -24
  164. package/src/server/auto-invalidate/runtime.ts +17 -0
  165. package/src/server/auto-invalidate/types.ts +6 -0
  166. package/src/server/browser-events/plugin.ts +112 -1
  167. package/src/server/cache/dev-loader.ts +1 -1
  168. package/src/server/cache/invalidation.ts +2 -0
  169. package/src/server/cache/isr-ssg.ts +1 -1
  170. package/src/server/cache/isr.ts +6 -34
  171. package/src/server/cache/route-cache.ts +40 -4
  172. package/src/server/cache/ssg.ts +1 -1
  173. package/src/server/dev/diagnostics.ts +4 -2
  174. package/src/server/dev/error.ts +2 -1
  175. package/src/server/dev/graph.ts +70 -7
  176. package/src/server/dev/runtime.production.ts +4 -0
  177. package/src/server/dev/symbolicate.ts +2 -0
  178. package/src/server/dev-page-plugin.ts +160 -63
  179. package/src/server/evlog.ts +1 -1
  180. package/src/server/internal.ts +5 -0
  181. package/src/server/render/assemble.ts +15 -11
  182. package/src/server/render/document.tsx +13 -2
  183. package/src/server/render/element.tsx +11 -6
  184. package/src/server/render/isr.ts +71 -33
  185. package/src/server/render/loaders.ts +328 -70
  186. package/src/server/render/mixed-cache.ts +327 -0
  187. package/src/server/render/not-found.ts +14 -11
  188. package/src/server/render/ppr-document.ts +47 -11
  189. package/src/server/render/ppr-route.ts +54 -20
  190. package/src/server/render/react-stream.ts +17 -0
  191. package/src/server/render/route-frame-transport.ts +3 -0
  192. package/src/server/render/ssg.ts +53 -19
  193. package/src/server/render/ssr.ts +105 -36
  194. package/src/server/render/static-params.ts +1 -1
  195. package/src/server/render/template.ts +23 -0
  196. package/src/server/router/defined-route.ts +3 -0
  197. package/src/server/router/discovery.ts +14 -0
  198. package/src/server/router/hmr.ts +109 -18
  199. package/src/server/router/patterns.ts +27 -0
  200. package/src/server/router/plugin.ts +94 -19
  201. package/src/server/router/source-version.ts +20 -2
  202. package/src/server/router/types.ts +4 -0
  203. package/src/server/security/csp.ts +44 -0
  204. package/src/server/sync/adapter.ts +41 -4
  205. package/src/server/sync/atomic.ts +303 -0
  206. package/src/server/sync/drizzle/index.ts +145 -0
  207. package/src/server/sync/execution-error.ts +1 -0
  208. package/src/server/sync/fingerprint.ts +2 -6
  209. package/src/server/sync/index.ts +6 -0
  210. package/src/server/sync/mutation-handler.ts +69 -0
  211. package/src/server/sync/plugin.ts +177 -60
  212. package/src/server/sync/postgres/execute.ts +20 -0
  213. package/src/server/sync/postgres/index.ts +60 -16
  214. package/src/server/sync/postgres/sql.ts +20 -0
  215. package/src/server/sync/prisma/index.ts +70 -0
  216. package/src/server/sync/queries.ts +75 -0
  217. package/src/server/sync/query-context.ts +85 -0
  218. package/src/server/sync/redis/index.ts +7 -3
  219. package/src/server/sync/redis/scripts.ts +1 -1
  220. package/src/server/sync/response.ts +21 -0
  221. package/src/server/sync/sqlite/index.ts +19 -8
  222. package/src/server/sync/stream.ts +14 -22
  223. package/src/server/sync/validation.ts +34 -0
  224. package/src/shared/defer.ts +48 -0
  225. package/src/shared/error.ts +2 -2
  226. package/src/shared/page-key.ts +36 -0
  227. package/src/shared/query-bindings.ts +138 -0
  228. package/src/shared/route-frame.ts +13 -1
  229. package/src/shared/route-map.ts +12 -2
  230. package/src/shared/sync-query.ts +138 -0
@@ -0,0 +1,16 @@
1
+ import type { IsomorphicEnvironment } from "./transform-isomorphic.ts";
2
+ /**
3
+ * Stable key shared by the `clientModule()` transform and the client build's
4
+ * preload manifest. It is an opaque ASCII token so it survives minification
5
+ * unchanged and can be swapped for the module's chunk URLs after the build.
6
+ */
7
+ export declare function clientModuleKey(modulePath: string): string;
8
+ /**
9
+ * Rewrites `clientModule(() => import("./x"))` calls imported from
10
+ * `@teyik0/furin/client`:
11
+ * - client: keeps the loader and appends the module key, which the production
12
+ * client build replaces with the module's chunk URLs;
13
+ * - server: drops the `import()` so the module is never bundled server-side and
14
+ * passes the key, resolved against the preload manifest at render time.
15
+ */
16
+ export declare function transformClientModules(source: string, filename: string, environment: IsomorphicEnvironment): string;
@@ -4,5 +4,7 @@ interface TransformResult {
4
4
  map: ReturnType<MagicString["generateMap"]> | null;
5
5
  removedServerCode: boolean;
6
6
  }
7
+ /** Server stages and their imports share one signature across both HMR graphs. */
8
+ export declare function getHmrDataSignature(code: string, filename: string): string;
7
9
  export declare function transformForClient(code: string, filename: string): TransformResult;
8
10
  export {};
@@ -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 {};
@@ -5,5 +5,5 @@ export interface IsomorphicTransformResult {
5
5
  map: ReturnType<MagicString["generateMap"]> | null;
6
6
  transformed: boolean;
7
7
  }
8
- export declare function transformIsomorphicFunctions(source: string, filename: string, environment: IsomorphicEnvironment): IsomorphicTransformResult;
8
+ export declare function transformIsomorphicFunctions(input: string, filename: string, environment: IsomorphicEnvironment): IsomorphicTransformResult;
9
9
  export declare function isomorphicTransformPlugin(environment: IsomorphicEnvironment): Bun.BunPlugin;
package/dist/routes.d.ts CHANGED
@@ -4,3 +4,9 @@
4
4
  */
5
5
  export interface RouteMap {
6
6
  }
7
+ /** Literal route patterns for editor completion in APIs that accept path params. */
8
+ export interface RoutePatternMap {
9
+ }
10
+ /** Application contract for sync IDs and their resource scopes. */
11
+ export interface SyncQueryMap {
12
+ }
@@ -128,25 +128,96 @@ function restoreRscSource(kind, bytes) {
128
128
  const state = { bytes, kind, tree: decodeFlightBytes(bytes) };
129
129
  return kind === "renderable" ? createRenderableSource(state) : { [RSC_SOURCE]: state };
130
130
  }
131
- function resolveSlots(node, slots) {
132
- return Children.map(node, (child) => {
133
- if (!isValidElement(child)) {
134
- return child;
131
+ function isLazyNode(value) {
132
+ return "$$typeof" in value && value.$$typeof === Symbol.for("react.lazy");
133
+ }
134
+ function containsSlot(value, visited) {
135
+ if (value === null || typeof value !== "object" || visited.has(value)) {
136
+ return false;
137
+ }
138
+ visited.add(value);
139
+ if (isLazyNode(value)) {
140
+ return true;
141
+ }
142
+ if (isValidElement(value)) {
143
+ return value.type === SLOT_MARKER || containsSlot(value.props, visited);
144
+ }
145
+ if (Array.isArray(value)) {
146
+ return value.some((item) => containsSlot(item, visited));
147
+ }
148
+ return Object.getPrototypeOf(value) === Object.prototype && Object.values(value).some((item) => containsSlot(item, visited));
149
+ }
150
+ function resolveSlotArgument(value, slots, visited) {
151
+ if (!containsSlot(value, new WeakSet)) {
152
+ return value;
153
+ }
154
+ if (visited.has(value)) {
155
+ return visited.get(value);
156
+ }
157
+ if (isLazyNode(value)) {
158
+ const result = createElement(LazySlots, { node: value, slots });
159
+ visited.set(value, result);
160
+ return result;
161
+ }
162
+ if (isValidElement(value)) {
163
+ const resolved = resolveSlotElement(value, slots);
164
+ const result = isValidElement(resolved) ? Children.map(value, () => resolved)?.[0] : resolved;
165
+ visited.set(value, result);
166
+ return result;
167
+ }
168
+ if (Array.isArray(value)) {
169
+ const result = [];
170
+ visited.set(value, result);
171
+ for (const item of value) {
172
+ result.push(resolveSlotArgument(item, slots, visited));
135
173
  }
136
- if (child.type === SLOT_MARKER) {
137
- const marker = child.props;
138
- if (typeof marker.name !== "string") {
139
- return null;
174
+ const keys = new Set(result.filter(isValidElement).map((element) => element.key));
175
+ for (const [index, resolved] of result.entries()) {
176
+ if (isValidElement(resolved) && resolved.key === null) {
177
+ let key = String(index);
178
+ while (keys.has(key)) {
179
+ key = `.${key}`;
180
+ }
181
+ keys.add(key);
182
+ result[index] = cloneElement(resolved, { key });
140
183
  }
141
- const implementation = Reflect.get(slots, marker.name);
142
- if (typeof implementation === "function") {
143
- return implementation(...marker.args ?? []);
144
- }
145
- return implementation;
146
184
  }
147
- const props = child.props;
148
- return props.children === undefined ? child : cloneElement(child, undefined, resolveSlots(props.children, slots));
149
- });
185
+ return result;
186
+ }
187
+ const result = {};
188
+ visited.set(value, result);
189
+ for (const [key, item] of Object.entries(value)) {
190
+ Object.defineProperty(result, key, {
191
+ configurable: true,
192
+ enumerable: true,
193
+ value: resolveSlotArgument(item, slots, visited),
194
+ writable: true
195
+ });
196
+ }
197
+ return result;
198
+ }
199
+ function resolveSlotElement(child, slots) {
200
+ if (child.type === SLOT_MARKER) {
201
+ const marker = child.props;
202
+ if (typeof marker.name !== "string") {
203
+ return null;
204
+ }
205
+ const implementation = Reflect.get(slots, marker.name);
206
+ if (typeof implementation === "function") {
207
+ const visited = new WeakMap;
208
+ const args = (marker.args ?? []).map((argument) => resolveSlotArgument(argument, slots, visited));
209
+ return implementation(...args);
210
+ }
211
+ return implementation;
212
+ }
213
+ const props = resolveSlotArgument(child.props, slots, new WeakMap);
214
+ return props === child.props ? child : cloneElement(child, props);
215
+ }
216
+ function resolveSlots(node, slots) {
217
+ return Children.map(node, (child) => isValidElement(child) ? resolveSlotElement(child, slots) : child);
218
+ }
219
+ function LazySlots({ node, slots }) {
220
+ return resolveSlots(node, slots);
150
221
  }
151
222
  function CompositeComponent(props) {
152
223
  const { src, ...slots } = props;
package/dist/rsc.js CHANGED
@@ -284,25 +284,96 @@ function restoreRscSource(kind, bytes) {
284
284
  const state = { bytes, kind, tree: decodeFlightBytes(bytes) };
285
285
  return kind === "renderable" ? createRenderableSource(state) : { [RSC_SOURCE]: state };
286
286
  }
287
- function resolveSlots(node, slots) {
288
- return Children.map(node, (child) => {
289
- if (!isValidElement(child)) {
290
- return child;
287
+ function isLazyNode(value) {
288
+ return "$$typeof" in value && value.$$typeof === Symbol.for("react.lazy");
289
+ }
290
+ function containsSlot(value, visited) {
291
+ if (value === null || typeof value !== "object" || visited.has(value)) {
292
+ return false;
293
+ }
294
+ visited.add(value);
295
+ if (isLazyNode(value)) {
296
+ return true;
297
+ }
298
+ if (isValidElement(value)) {
299
+ return value.type === SLOT_MARKER || containsSlot(value.props, visited);
300
+ }
301
+ if (Array.isArray(value)) {
302
+ return value.some((item) => containsSlot(item, visited));
303
+ }
304
+ return Object.getPrototypeOf(value) === Object.prototype && Object.values(value).some((item) => containsSlot(item, visited));
305
+ }
306
+ function resolveSlotArgument(value, slots, visited) {
307
+ if (!containsSlot(value, new WeakSet)) {
308
+ return value;
309
+ }
310
+ if (visited.has(value)) {
311
+ return visited.get(value);
312
+ }
313
+ if (isLazyNode(value)) {
314
+ const result = createElement(LazySlots, { node: value, slots });
315
+ visited.set(value, result);
316
+ return result;
317
+ }
318
+ if (isValidElement(value)) {
319
+ const resolved = resolveSlotElement(value, slots);
320
+ const result = isValidElement(resolved) ? Children.map(value, () => resolved)?.[0] : resolved;
321
+ visited.set(value, result);
322
+ return result;
323
+ }
324
+ if (Array.isArray(value)) {
325
+ const result = [];
326
+ visited.set(value, result);
327
+ for (const item of value) {
328
+ result.push(resolveSlotArgument(item, slots, visited));
291
329
  }
292
- if (child.type === SLOT_MARKER) {
293
- const marker = child.props;
294
- if (typeof marker.name !== "string") {
295
- return null;
296
- }
297
- const implementation = Reflect.get(slots, marker.name);
298
- if (typeof implementation === "function") {
299
- return implementation(...marker.args ?? []);
330
+ const keys = new Set(result.filter(isValidElement).map((element) => element.key));
331
+ for (const [index, resolved] of result.entries()) {
332
+ if (isValidElement(resolved) && resolved.key === null) {
333
+ let key = String(index);
334
+ while (keys.has(key)) {
335
+ key = `.${key}`;
336
+ }
337
+ keys.add(key);
338
+ result[index] = cloneElement(resolved, { key });
300
339
  }
301
- return implementation;
302
340
  }
303
- const props = child.props;
304
- return props.children === undefined ? child : cloneElement(child, undefined, resolveSlots(props.children, slots));
305
- });
341
+ return result;
342
+ }
343
+ const result = {};
344
+ visited.set(value, result);
345
+ for (const [key, item] of Object.entries(value)) {
346
+ Object.defineProperty(result, key, {
347
+ configurable: true,
348
+ enumerable: true,
349
+ value: resolveSlotArgument(item, slots, visited),
350
+ writable: true
351
+ });
352
+ }
353
+ return result;
354
+ }
355
+ function resolveSlotElement(child, slots) {
356
+ if (child.type === SLOT_MARKER) {
357
+ const marker = child.props;
358
+ if (typeof marker.name !== "string") {
359
+ return null;
360
+ }
361
+ const implementation = Reflect.get(slots, marker.name);
362
+ if (typeof implementation === "function") {
363
+ const visited = new WeakMap;
364
+ const args = (marker.args ?? []).map((argument) => resolveSlotArgument(argument, slots, visited));
365
+ return implementation(...args);
366
+ }
367
+ return implementation;
368
+ }
369
+ const props = resolveSlotArgument(child.props, slots, new WeakMap);
370
+ return props === child.props ? child : cloneElement(child, props);
371
+ }
372
+ function resolveSlots(node, slots) {
373
+ return Children.map(node, (child) => isValidElement(child) ? resolveSlotElement(child, slots) : child);
374
+ }
375
+ function LazySlots({ node, slots }) {
376
+ return resolveSlots(node, slots);
306
377
  }
307
378
  function CompositeComponent(props) {
308
379
  const { src, ...slots } = props;
@@ -1,10 +1,13 @@
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
+ tagsForPath(path: string): string[];
10
+ unregisterPath(urlPath: string, owner?: string): void;
8
11
  reset(): void;
9
12
  }
10
13
  /** The current furin instance's registry (see server/instance.ts). */
@@ -1,4 +1,5 @@
1
1
  import type { CacheTag } from "../../furin.ts";
2
+ import type { SyncQueryIdentity } from "../../shared/sync-query.ts";
2
3
  import type { RevalidateType } from "../cache/route-cache.ts";
3
4
  export type InvalidationRule = {
4
5
  path: string;
@@ -10,3 +11,4 @@ export type InvalidationRule = {
10
11
  type?: never;
11
12
  };
12
13
  export type InvalidationInput = InvalidationRule | readonly InvalidationRule[];
14
+ export type SyncInvalidationInput = InvalidationRule | SyncQueryIdentity | readonly (InvalidationRule | SyncQueryIdentity)[];
@@ -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 {};
@@ -1,10 +1,8 @@
1
1
  import { type FurinInstance } from "../instance.ts";
2
2
  import { type ISRCacheEntry } from "./isr-ssg";
3
- import type { Cache } from "./route-cache";
3
+ import type { Cache, CacheGeneration } from "./route-cache";
4
4
  import { type StoreView } from "./store-view";
5
- export interface ISRCacheGeneration {
6
- valid: boolean;
7
- }
5
+ export type ISRCacheGeneration = CacheGeneration;
8
6
  export declare function isrRouteCache(instance?: FurinInstance): Cache<ISRCacheEntry>;
9
7
  /** Raw store view over the current instance's ISR cache. */
10
8
  export declare const isrCache: StoreView<ISRCacheEntry>;
@@ -3,7 +3,11 @@ export interface CacheInvalidationResult {
3
3
  deleted: boolean;
4
4
  purgedPaths: string[];
5
5
  }
6
+ export interface CacheGeneration {
7
+ valid: boolean;
8
+ }
6
9
  export interface Cache<Entry> {
10
+ captureGeneration: (key: string) => CacheGeneration;
7
11
  clear: () => void;
8
12
  delete: (key: string) => boolean;
9
13
  entries: () => IterableIterator<[string, Entry]>;
@@ -12,6 +16,7 @@ export interface Cache<Entry> {
12
16
  invalidatePath: (path: string, type: RevalidateType) => CacheInvalidationResult;
13
17
  keys: () => IterableIterator<string>;
14
18
  readonly name: string;
19
+ releaseGeneration: (key: string, generation: CacheGeneration) => void;
15
20
  set: (key: string, entry: Entry) => void;
16
21
  get size(): number;
17
22
  readonly store: Map<string, Entry>;
@@ -66,6 +66,7 @@ export declare class DevGraph<Snapshot> {
66
66
  importModule<Module>(path: string, sourceVersion: string, importModule: DevModuleImporter<Module>): Promise<Module>;
67
67
  importChain(from: string, to: string): string[];
68
68
  dependsOn(from: string, to: string): boolean;
69
+ sourceDependencies(from: string): string[];
69
70
  clearSourceErrors(path: string): void;
70
71
  publishError(error: DevErrorPayload): Extract<DevGraphEvent, {
71
72
  type: "error";
@@ -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;
@@ -47,10 +47,8 @@
47
47
  * guaranteeing a single shared React instance regardless of CWD or
48
48
  * hot-reload state.
49
49
  *
50
- * All import/re-export occurrences of each quoted specifier are replaced using
51
- * a context-aware regex (requires a preceding `from` or `import` keyword) so
52
- * that modules which both import and re-export from the same package are fully
53
- * rewritten while string literals in non-import positions are left untouched.
50
+ * Static imports, re-exports, and literal dynamic imports are rewritten from
51
+ * the parsed module, leaving ordinary strings and comments untouched.
54
52
  */
55
53
  export declare const WORKSPACE_SOURCE_FILTER: RegExp;
56
54
  interface CachedDevPageContents {
@@ -97,25 +95,14 @@ export declare function injectJsxHelperImports(transpiled: string): string;
97
95
  /** @internal exported for testing */
98
96
  export declare function rewriteRelativeImports(source: string, dir: string): string;
99
97
  /**
100
- * Rewrites all remaining bare specifiers in the transpiled JS to absolute
101
- * on-disk paths resolved from `dir` (the page file's directory).
102
- *
103
- * Uses `Bun.Transpiler.scan()` on the original source to get the authoritative
104
- * list of *actual* import specifiers (parsing correctly handles template
105
- * literals, comments, etc.). For each bare specifier that is not already
106
- * handled by `rewriteSingletonImports`, it calls `Bun.resolveSync` and
107
- * replaces **every** import/re-export occurrence of the quoted specifier using
108
- * a context-aware regex with the `g` flag — mirroring the approach used by
109
- * `rewriteSingletonImports`. This correctly handles modules that both import
110
- * and re-export from the same package without leaving any bare specifier
111
- * behind. String literals that happen to contain the same text (inside
112
- * template literals, JSX props, etc.) are not touched because the regex
113
- * requires a preceding `from` or `import` keyword.
98
+ * Resolves static imports, re-exports, and literal dynamic imports from the
99
+ * page file's directory, including tsconfig aliases in virtual modules.
114
100
  *
115
101
  * @internal exported for testing
116
102
  */
117
- export declare function rewriteBareImports(source: string, transpiled: string, dir: string): string;
103
+ export declare function rewriteBareImports(transpiled: string, dir: string): string;
118
104
  export declare function transformDevSource(raw: string, filePath: string, options: {
105
+ renderFragment?: boolean;
119
106
  rewriteBareImports: boolean;
120
107
  rewriteRelativeImports: boolean;
121
108
  }): string;
@@ -1,4 +1,5 @@
1
1
  import type { AnyElysia } from "elysia";
2
+ import type { ClientPreloadManifest } from "../build/preload-manifest.ts";
2
3
  import type { SsgCacheEntry } from "./cache/index.ts";
3
4
  import { type RuntimeCacheProvider } from "./cache/runtime-cache.ts";
4
5
  import { setRuntimeEvlogWaitUntil as installRuntimeEvlogWaitUntil } from "./evlog.ts";
@@ -26,6 +27,8 @@ export interface CompileContext {
26
27
  nativeRoutes?: AnyElysia;
27
28
  /** Mount prefix this app was built for (`""` = root). */
28
29
  prefix?: string;
30
+ /** Chunk URLs to modulepreload, produced by the client build. */
31
+ preloadManifest?: ClientPreloadManifest;
29
32
  /** Root-level conventions discovered at compile time. */
30
33
  rootConventions?: {
31
34
  errorPath?: string;
@@ -34,6 +37,8 @@ export interface CompileContext {
34
37
  rootPath: string;
35
38
  /** Per-route metadata including pre-computed segment boundaries. */
36
39
  routeMetadata?: Record<string, {
40
+ requestKeys?: string[];
41
+ requestKeysByLoader?: string[][];
37
42
  segmentBoundaries: Array<{
38
43
  depth: number;
39
44
  path: string;