@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.
- package/dist/adapter/runtime-build.d.ts +3 -1
- package/dist/build/client.d.ts +4 -1
- package/dist/build/entry-template.d.ts +5 -0
- package/dist/build/entry-template.ts +9 -0
- package/dist/build/hydrate.d.ts +1 -1
- package/dist/build/index.js +9589 -6685
- package/dist/build/preload-manifest.d.ts +17 -0
- package/dist/build/request-keys.d.ts +4 -0
- package/dist/build/types.d.ts +6 -0
- package/dist/cli/index.js +9539 -6644
- package/dist/client/browser-events-runtime.d.ts +2 -1
- package/dist/client/client-module.d.ts +26 -0
- package/dist/client/define-route.d.ts +9 -1
- package/dist/client/dev-error-overlay.ts +1 -0
- package/dist/client/document.d.ts +3 -0
- package/dist/client/hmr.d.ts +1 -1
- package/dist/client/internal/runtime-types.d.ts +2 -0
- package/dist/client/link.js +1011 -157
- package/dist/client/mutation.d.ts +38 -0
- package/dist/client/query-store.d.ts +85 -0
- package/dist/client/query.d.ts +14 -0
- package/dist/client/route-api.d.ts +11 -0
- package/dist/client/router/context.d.ts +3 -2
- package/dist/client/router/index.d.ts +1 -1
- package/dist/client/router/link-utils.d.ts +8 -1
- package/dist/client/router/navigation.d.ts +2 -9
- package/dist/client/router/optimistic.d.ts +41 -0
- package/dist/client/router/search/index.d.ts +3 -3
- package/dist/client/router/search-store.d.ts +1 -0
- package/dist/client/router/sync-catch-up.d.ts +3 -0
- package/dist/client/router/types.d.ts +49 -7
- package/dist/client/sync.d.ts +39 -22
- package/dist/client.d.ts +11 -33
- package/dist/client.js +1222 -57
- package/dist/config.d.ts +7 -0
- package/dist/config.js +1 -0
- package/dist/define-route.d.ts +231 -123
- package/dist/env.d.ts +2 -2
- package/dist/furin.d.ts +4 -2
- package/dist/furin.js +9717 -6796
- package/dist/plugin/hmr-dependencies.d.ts +2 -0
- package/dist/plugin/index.js +811 -145
- package/dist/plugin/transform-client-module.d.ts +16 -0
- package/dist/plugin/transform-client.d.ts +2 -0
- package/dist/plugin/transform-dev-page.d.ts +7 -0
- package/dist/plugin/transform-isomorphic.d.ts +1 -1
- package/dist/routes.d.ts +6 -0
- package/dist/rsc-client.js +87 -16
- package/dist/rsc.js +87 -16
- package/dist/server/auto-invalidate/registry.d.ts +5 -2
- package/dist/server/auto-invalidate/types.d.ts +2 -0
- package/dist/server/browser-events/plugin.d.ts +3 -0
- package/dist/server/cache/isr.d.ts +2 -4
- package/dist/server/cache/route-cache.d.ts +5 -0
- package/dist/server/dev/graph.d.ts +1 -0
- package/dist/server/dev/runtime.production.d.ts +1 -0
- package/dist/server/dev-page-plugin.d.ts +6 -19
- package/dist/server/internal.d.ts +5 -0
- package/dist/server/internal.js +105 -57
- package/dist/server/production-server.js +104 -56
- package/dist/server/render/assemble.d.ts +6 -6
- package/dist/server/render/document.d.ts +1 -1
- package/dist/server/render/element.d.ts +1 -1
- package/dist/server/render/loaders.d.ts +15 -5
- package/dist/server/render/mixed-cache.d.ts +6 -0
- package/dist/server/render/react-stream.d.ts +3 -0
- package/dist/server/render/ssr.d.ts +5 -4
- package/dist/server/render/template.d.ts +4 -0
- package/dist/server/router/defined-route.d.ts +2 -0
- package/dist/server/router/discovery.d.ts +1 -0
- package/dist/server/router/hmr.d.ts +1 -1
- package/dist/server/router/patterns.d.ts +3 -0
- package/dist/server/router/plugin.d.ts +3 -0
- package/dist/server/router/types.d.ts +4 -0
- package/dist/server/security/csp.d.ts +12 -0
- package/dist/server/sync/adapter.d.ts +25 -4
- package/dist/server/sync/atomic.d.ts +25 -0
- package/dist/server/sync/drizzle/index.d.ts +45 -0
- package/dist/server/sync/drizzle/index.js +540 -0
- package/dist/server/sync/execution-error.d.ts +2 -0
- package/dist/server/sync/index.d.ts +2 -1
- package/dist/server/sync/index.js +580 -124
- package/dist/server/sync/mutation-handler.d.ts +4 -0
- package/dist/server/sync/plugin.d.ts +34 -11
- package/dist/server/sync/postgres/execute.d.ts +3 -0
- package/dist/server/sync/postgres/index.d.ts +12 -1
- package/dist/server/sync/postgres/index.js +42 -13
- package/dist/server/sync/postgres/sql.d.ts +8 -0
- package/dist/server/sync/prisma/index.d.ts +24 -0
- package/dist/server/sync/prisma/index.js +340 -0
- package/dist/server/sync/queries.d.ts +21 -0
- package/dist/server/sync/query-context.d.ts +5 -0
- package/dist/server/sync/redis/index.js +3 -3
- package/dist/server/sync/redis/scripts.d.ts +1 -1
- package/dist/server/sync/response.d.ts +1 -0
- package/dist/server/sync/sqlite/index.d.ts +3 -0
- package/dist/server/sync/sqlite/index.js +10 -4
- package/dist/server/sync/stream.d.ts +2 -5
- package/dist/server/sync/validation.d.ts +4 -0
- package/dist/shared/defer.d.ts +31 -0
- package/dist/shared/error.d.ts +2 -2
- package/dist/shared/page-key.d.ts +7 -0
- package/dist/shared/query-bindings.d.ts +12 -0
- package/dist/shared/route-frame.d.ts +1 -0
- package/dist/shared/sync-query.d.ts +40 -0
- package/package.json +40 -16
- package/src/adapter/README.md +3 -0
- package/src/adapter/bun.ts +3 -0
- package/src/adapter/package.ts +16 -2
- package/src/adapter/runtime-build.ts +99 -14
- package/src/adapter/static.ts +17 -6
- package/src/adapter/vercel.ts +33 -23
- package/src/build/client.ts +23 -5
- package/src/build/entry-template.ts +9 -0
- package/src/build/hydrate.ts +18 -3
- package/src/build/preload-manifest.ts +100 -0
- package/src/build/production-instrumentation.ts +6 -3
- package/src/build/request-keys.ts +93 -0
- package/src/build/ssg-cache.ts +9 -4
- package/src/build/types.ts +4 -0
- package/src/cli/index.ts +1 -0
- package/src/client/boundaries.tsx +1 -1
- package/src/client/browser-events-runtime.ts +73 -16
- package/src/client/client-module.ts +57 -0
- package/src/client/define-route.ts +11 -2
- package/src/client/dev-error-overlay.ts +1 -0
- package/src/client/document.tsx +47 -20
- package/src/client/hmr.ts +4 -2
- package/src/client/internal/runtime-types.ts +2 -0
- package/src/client/link.tsx +8 -8
- package/src/client/mutation.ts +136 -0
- package/src/client/query-store.ts +418 -0
- package/src/client/query.tsx +67 -0
- package/src/client/route-api.tsx +75 -0
- package/src/client/router/boundary-tree.tsx +10 -6
- package/src/client/router/context.ts +57 -4
- package/src/client/router/index.ts +3 -0
- package/src/client/router/link-utils.ts +29 -1
- package/src/client/router/navigation.ts +3 -50
- package/src/client/router/optimistic.ts +233 -0
- package/src/client/router/provider.tsx +404 -96
- package/src/client/router/search/index.ts +37 -17
- package/src/client/router/search-store.ts +4 -0
- package/src/client/router/sync-catch-up.ts +7 -0
- package/src/client/router/types.ts +71 -9
- package/src/client/sync.ts +438 -65
- package/src/client.ts +20 -60
- package/src/config.ts +5 -0
- package/src/define-route.ts +442 -155
- package/src/env.d.ts +2 -2
- package/src/furin.ts +213 -38
- package/src/plugin/hmr-dependencies.ts +58 -0
- package/src/plugin/index.ts +38 -2
- package/src/plugin/route-config-autofix.ts +2 -2
- package/src/plugin/routes.ts +19 -8
- package/src/plugin/transform-client-module.ts +123 -0
- package/src/plugin/transform-client.ts +293 -13
- package/src/plugin/transform-dev-page.ts +231 -0
- package/src/plugin/transform-isomorphic.ts +11 -5
- package/src/routes.ts +8 -0
- package/src/rsc/shared.tsx +104 -18
- package/src/rsc/version.ts +5 -0
- package/src/server/auto-invalidate/registry.ts +56 -24
- package/src/server/auto-invalidate/runtime.ts +17 -0
- package/src/server/auto-invalidate/types.ts +6 -0
- package/src/server/browser-events/plugin.ts +112 -1
- package/src/server/cache/dev-loader.ts +1 -1
- package/src/server/cache/invalidation.ts +2 -0
- package/src/server/cache/isr-ssg.ts +1 -1
- package/src/server/cache/isr.ts +6 -34
- package/src/server/cache/route-cache.ts +40 -4
- package/src/server/cache/ssg.ts +1 -1
- package/src/server/dev/diagnostics.ts +4 -2
- package/src/server/dev/error.ts +2 -1
- package/src/server/dev/graph.ts +70 -7
- package/src/server/dev/runtime.production.ts +4 -0
- package/src/server/dev/symbolicate.ts +2 -0
- package/src/server/dev-page-plugin.ts +160 -63
- package/src/server/evlog.ts +1 -1
- package/src/server/internal.ts +5 -0
- package/src/server/render/assemble.ts +15 -11
- package/src/server/render/document.tsx +13 -2
- package/src/server/render/element.tsx +11 -6
- package/src/server/render/isr.ts +71 -33
- package/src/server/render/loaders.ts +328 -70
- package/src/server/render/mixed-cache.ts +327 -0
- package/src/server/render/not-found.ts +14 -11
- package/src/server/render/ppr-document.ts +47 -11
- package/src/server/render/ppr-route.ts +54 -20
- package/src/server/render/react-stream.ts +17 -0
- package/src/server/render/route-frame-transport.ts +3 -0
- package/src/server/render/ssg.ts +53 -19
- package/src/server/render/ssr.ts +105 -36
- package/src/server/render/static-params.ts +1 -1
- package/src/server/render/template.ts +23 -0
- package/src/server/router/defined-route.ts +3 -0
- package/src/server/router/discovery.ts +14 -0
- package/src/server/router/hmr.ts +109 -18
- package/src/server/router/patterns.ts +27 -0
- package/src/server/router/plugin.ts +94 -19
- package/src/server/router/source-version.ts +20 -2
- package/src/server/router/types.ts +4 -0
- package/src/server/security/csp.ts +44 -0
- package/src/server/sync/adapter.ts +41 -4
- package/src/server/sync/atomic.ts +303 -0
- package/src/server/sync/drizzle/index.ts +145 -0
- package/src/server/sync/execution-error.ts +1 -0
- package/src/server/sync/fingerprint.ts +2 -6
- package/src/server/sync/index.ts +6 -0
- package/src/server/sync/mutation-handler.ts +69 -0
- package/src/server/sync/plugin.ts +177 -60
- package/src/server/sync/postgres/execute.ts +20 -0
- package/src/server/sync/postgres/index.ts +60 -16
- package/src/server/sync/postgres/sql.ts +20 -0
- package/src/server/sync/prisma/index.ts +70 -0
- package/src/server/sync/queries.ts +75 -0
- package/src/server/sync/query-context.ts +85 -0
- package/src/server/sync/redis/index.ts +7 -3
- package/src/server/sync/redis/scripts.ts +1 -1
- package/src/server/sync/response.ts +21 -0
- package/src/server/sync/sqlite/index.ts +19 -8
- package/src/server/sync/stream.ts +14 -22
- package/src/server/sync/validation.ts +34 -0
- package/src/shared/defer.ts +48 -0
- package/src/shared/error.ts +2 -2
- package/src/shared/page-key.ts +36 -0
- package/src/shared/query-bindings.ts +138 -0
- package/src/shared/route-frame.ts +13 -1
- package/src/shared/route-map.ts +12 -2
- 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(
|
|
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
|
+
}
|
package/dist/rsc-client.js
CHANGED
|
@@ -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
|
|
132
|
-
return
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
|
|
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
|
-
|
|
148
|
-
|
|
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
|
|
288
|
-
return
|
|
289
|
-
|
|
290
|
-
|
|
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
|
-
|
|
293
|
-
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
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
|
-
|
|
304
|
-
|
|
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
|
-
|
|
6
|
+
private reindexPath;
|
|
7
|
+
registerLoaderTags(urlPath: string, tags: readonly string[] | undefined, owner?: string): void;
|
|
6
8
|
pathsForTags(tags: readonly string[]): string[];
|
|
7
|
-
|
|
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
|
|
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
|
-
*
|
|
51
|
-
*
|
|
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
|
-
*
|
|
101
|
-
*
|
|
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(
|
|
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;
|