Sign In

@solidjs/web

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solidjs/web - npm Package Compare versions

Comparing version
2.0.0-beta.27
to
2.0.0-beta.28
+23
-6
dist/server.cjs

@@ -202,3 +202,20 @@ 'use strict';

}
function applyAssetTracking(context, tracking, manifest) {
function warnUnresolvedModuleAssets(moduleUrl, warned) {
if (warned.has(moduleUrl)) return;
warned.add(moduleUrl);
console.error(`Asset manifest returned no client assets for module "${moduleUrl}". ` + "If this module is a server-rendered lazy() component, its entry will be missing from " + "the serialized hydration asset map, the client will be unable to preload it, and " + "hydration will fail with 'lazy() module \"…\" was not preloaded before hydration'. " + "This means the integration's asset resolver (dev manifest bridge or build client " + "manifest) failed to answer for this module — check the integration's server logs, " + "restart the dev server, or verify the module is included in the client build.");
}
function guardResolvedAssets(moduleUrl, result, warned) {
if (result && typeof result.then === "function") {
return result.then(assets => {
if (!assets || !assets.js || !assets.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
return assets;
});
}
if (!result || !result.js || !result.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
return result;
}
function applyAssetTracking(context, tracking, manifest, noScripts) {
const warned = new Set();
const guard = noScripts ? resolve => resolve : resolve => moduleUrl => guardResolvedAssets(moduleUrl, resolve(moduleUrl), warned);
Object.defineProperty(context, "_currentBoundaryId", {

@@ -217,5 +234,5 @@ get() {

if (typeof manifest === "function") {
context.resolveAssets = manifest;
context.resolveAssets = guard(manifest);
} else if (manifest && typeof manifest.resolve === "function") {
context.resolveAssets = key => manifest.resolve(key);
context.resolveAssets = guard(key => manifest.resolve(key));
if (typeof manifest.resolveSync === "function") {

@@ -226,3 +243,3 @@ context.resolveAssetsSync = key => manifest.resolveSync(key);

const resolve = moduleUrl => resolveAssets(moduleUrl, manifest);
context.resolveAssets = resolve;
context.resolveAssets = guard(resolve);
context.resolveAssetsSync = resolve;

@@ -283,3 +300,3 @@ }

};
applyAssetTracking(solidJs.sharedConfig.context, tracking, manifest);
applyAssetTracking(solidJs.sharedConfig.context, tracking, manifest, noScripts);
registerEntryAssets(manifest);

@@ -572,3 +589,3 @@ let html = solidJs.createRoot(d => {

};
applyAssetTracking(context, tracking, manifest);
applyAssetTracking(context, tracking, manifest, noScripts);
registerEntryAssets(manifest);

@@ -575,0 +592,0 @@ let html = solidJs.createRoot(d => {

@@ -201,3 +201,20 @@ import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, getOwner, runWithOwner, createComponent, omit, getNextChildId } from 'solid-js';

}
function applyAssetTracking(context, tracking, manifest) {
function warnUnresolvedModuleAssets(moduleUrl, warned) {
if (warned.has(moduleUrl)) return;
warned.add(moduleUrl);
console.error(`Asset manifest returned no client assets for module "${moduleUrl}". ` + "If this module is a server-rendered lazy() component, its entry will be missing from " + "the serialized hydration asset map, the client will be unable to preload it, and " + "hydration will fail with 'lazy() module \"…\" was not preloaded before hydration'. " + "This means the integration's asset resolver (dev manifest bridge or build client " + "manifest) failed to answer for this module — check the integration's server logs, " + "restart the dev server, or verify the module is included in the client build.");
}
function guardResolvedAssets(moduleUrl, result, warned) {
if (result && typeof result.then === "function") {
return result.then(assets => {
if (!assets || !assets.js || !assets.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
return assets;
});
}
if (!result || !result.js || !result.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
return result;
}
function applyAssetTracking(context, tracking, manifest, noScripts) {
const warned = new Set();
const guard = noScripts ? resolve => resolve : resolve => moduleUrl => guardResolvedAssets(moduleUrl, resolve(moduleUrl), warned);
Object.defineProperty(context, "_currentBoundaryId", {

@@ -216,5 +233,5 @@ get() {

if (typeof manifest === "function") {
context.resolveAssets = manifest;
context.resolveAssets = guard(manifest);
} else if (manifest && typeof manifest.resolve === "function") {
context.resolveAssets = key => manifest.resolve(key);
context.resolveAssets = guard(key => manifest.resolve(key));
if (typeof manifest.resolveSync === "function") {

@@ -225,3 +242,3 @@ context.resolveAssetsSync = key => manifest.resolveSync(key);

const resolve = moduleUrl => resolveAssets(moduleUrl, manifest);
context.resolveAssets = resolve;
context.resolveAssets = guard(resolve);
context.resolveAssetsSync = resolve;

@@ -282,3 +299,3 @@ }

};
applyAssetTracking(sharedConfig.context, tracking, manifest);
applyAssetTracking(sharedConfig.context, tracking, manifest, noScripts);
registerEntryAssets(manifest);

@@ -571,3 +588,3 @@ let html = createRoot(d => {

};
applyAssetTracking(context, tracking, manifest);
applyAssetTracking(context, tracking, manifest, noScripts);
registerEntryAssets(manifest);

@@ -574,0 +591,0 @@ let html = createRoot(d => {

@@ -223,3 +223,20 @@ 'use strict';

}
function applyAssetTracking(context, tracking, manifest) {
function warnUnresolvedModuleAssets(moduleUrl, warned) {
if (warned.has(moduleUrl)) return;
warned.add(moduleUrl);
console.error(`Asset manifest returned no client assets for module "${moduleUrl}". ` + "If this module is a server-rendered lazy() component, its entry will be missing from " + "the serialized hydration asset map, the client will be unable to preload it, and " + "hydration will fail with 'lazy() module \"…\" was not preloaded before hydration'. " + "This means the integration's asset resolver (dev manifest bridge or build client " + "manifest) failed to answer for this module — check the integration's server logs, " + "restart the dev server, or verify the module is included in the client build.");
}
function guardResolvedAssets(moduleUrl, result, warned) {
if (result && typeof result.then === "function") {
return result.then(assets => {
if (!assets || !assets.js || !assets.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
return assets;
});
}
if (!result || !result.js || !result.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
return result;
}
function applyAssetTracking(context, tracking, manifest, noScripts) {
const warned = new Set();
const guard = noScripts ? resolve => resolve : resolve => moduleUrl => guardResolvedAssets(moduleUrl, resolve(moduleUrl), warned);
Object.defineProperty(context, "_currentBoundaryId", {

@@ -238,5 +255,5 @@ get() {

if (typeof manifest === "function") {
context.resolveAssets = manifest;
context.resolveAssets = guard(manifest);
} else if (manifest && typeof manifest.resolve === "function") {
context.resolveAssets = key => manifest.resolve(key);
context.resolveAssets = guard(key => manifest.resolve(key));
if (typeof manifest.resolveSync === "function") {

@@ -247,3 +264,3 @@ context.resolveAssetsSync = key => manifest.resolveSync(key);

const resolve = moduleUrl => resolveAssets(moduleUrl, manifest);
context.resolveAssets = resolve;
context.resolveAssets = guard(resolve);
context.resolveAssetsSync = resolve;

@@ -527,3 +544,3 @@ }

};
applyAssetTracking(context, tracking, manifest);
applyAssetTracking(context, tracking, manifest, noScripts);
registerEntryAssets(manifest);

@@ -530,0 +547,0 @@ let html = solidJs.createRoot(d => {

@@ -221,3 +221,20 @@ import { toCrossJSONStream, Feature, Serializer, getCrossReferenceHeader, createPlugin } from 'seroval';

}
function applyAssetTracking(context, tracking, manifest) {
function warnUnresolvedModuleAssets(moduleUrl, warned) {
if (warned.has(moduleUrl)) return;
warned.add(moduleUrl);
console.error(`Asset manifest returned no client assets for module "${moduleUrl}". ` + "If this module is a server-rendered lazy() component, its entry will be missing from " + "the serialized hydration asset map, the client will be unable to preload it, and " + "hydration will fail with 'lazy() module \"…\" was not preloaded before hydration'. " + "This means the integration's asset resolver (dev manifest bridge or build client " + "manifest) failed to answer for this module — check the integration's server logs, " + "restart the dev server, or verify the module is included in the client build.");
}
function guardResolvedAssets(moduleUrl, result, warned) {
if (result && typeof result.then === "function") {
return result.then(assets => {
if (!assets || !assets.js || !assets.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
return assets;
});
}
if (!result || !result.js || !result.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
return result;
}
function applyAssetTracking(context, tracking, manifest, noScripts) {
const warned = new Set();
const guard = noScripts ? resolve => resolve : resolve => moduleUrl => guardResolvedAssets(moduleUrl, resolve(moduleUrl), warned);
Object.defineProperty(context, "_currentBoundaryId", {

@@ -236,5 +253,5 @@ get() {

if (typeof manifest === "function") {
context.resolveAssets = manifest;
context.resolveAssets = guard(manifest);
} else if (manifest && typeof manifest.resolve === "function") {
context.resolveAssets = key => manifest.resolve(key);
context.resolveAssets = guard(key => manifest.resolve(key));
if (typeof manifest.resolveSync === "function") {

@@ -245,3 +262,3 @@ context.resolveAssetsSync = key => manifest.resolveSync(key);

const resolve = moduleUrl => resolveAssets(moduleUrl, manifest);
context.resolveAssets = resolve;
context.resolveAssets = guard(resolve);
context.resolveAssetsSync = resolve;

@@ -525,3 +542,3 @@ }

};
applyAssetTracking(context, tracking, manifest);
applyAssetTracking(context, tracking, manifest, noScripts);
registerEntryAssets(manifest);

@@ -528,0 +545,0 @@ let html = createRoot(d => {

{
"name": "@solidjs/web",
"description": "Solid's web runtime: client rendering, hydration, SSR, and DOM-specific control flow (Portal, Dynamic).",
"version": "2.0.0-beta.27",
"version": "2.0.0-beta.28",
"author": "Ryan Carniato",

@@ -319,6 +319,6 @@ "license": "MIT",

"peerDependencies": {
"solid-js": "^2.0.0-beta.27"
"solid-js": "^2.0.0-beta.28"
},
"devDependencies": {
"solid-js": "2.0.0-beta.27"
"solid-js": "2.0.0-beta.28"
},

@@ -325,0 +325,0 @@ "scripts": {

@@ -290,2 +290,14 @@ 'use strict';

}
async function decodeResponsePayload(response, codecOptions) {
const decoded = await decodeResponse(response, codecOptions);
if (decoded !== undefined && response.headers.has(SINGLE_FLIGHT_HEADER)) {
return {
value: decoded.value,
flightData: decoded.data
};
}
return {
value: decoded
};
}

@@ -511,2 +523,3 @@ const config = {

exports.decodeResponse = decodeResponse;
exports.decodeResponsePayload = decodeResponsePayload;
exports.encodeErrorHeaderValue = encodeErrorHeaderValue;

@@ -513,0 +526,0 @@ exports.getServerFunctionMetadata = getServerFunctionMetadata;

@@ -288,2 +288,14 @@ import { fromCrossJSON, Feature } from 'seroval';

}
async function decodeResponsePayload(response, codecOptions) {
const decoded = await decodeResponse(response, codecOptions);
if (decoded !== undefined && response.headers.has(SINGLE_FLIGHT_HEADER)) {
return {
value: decoded.value,
flightData: decoded.data
};
}
return {
value: decoded
};
}

@@ -498,2 +510,2 @@ const config = {

export { ERROR_HEADER, FLASH_COOKIE, FUNCTION_HEADER, GET, INSTANCE_HEADER, SINGLE_FLIGHT_HEADER, clearFlashCookie, configureServerFunctionsClient, createServerReference, decodeErrorHeaderValue, decodeResponse, encodeErrorHeaderValue, getServerFunctionMetadata, hasFlashCookie, isServerFunction, registerServerReference, subscribeFlightData, withMeta };
export { ERROR_HEADER, FLASH_COOKIE, FUNCTION_HEADER, GET, INSTANCE_HEADER, SINGLE_FLIGHT_HEADER, clearFlashCookie, configureServerFunctionsClient, createServerReference, decodeErrorHeaderValue, decodeResponse, decodeResponsePayload, encodeErrorHeaderValue, getServerFunctionMetadata, hasFlashCookie, isServerFunction, registerServerReference, subscribeFlightData, withMeta };

@@ -11,2 +11,3 @@ 'use strict';

}
const REVALIDATE_HEADER = "X-Revalidate";

@@ -347,2 +348,14 @@ seroval.Feature.AggregateError | seroval.Feature.BigIntTypedArray;

}
async function decodeResponsePayload(response, codecOptions) {
const decoded = await decodeResponse(response, codecOptions);
if (decoded !== undefined && response.headers.has(SINGLE_FLIGHT_HEADER)) {
return {
value: decoded.value,
flightData: decoded.data
};
}
return {
value: decoded
};
}

@@ -537,2 +550,4 @@ function encodeInputValue(value) {

async function foldFlightData(hook, event, headers, outcome) {
if (outcome.value instanceof Response && outcome.value.body) return outcome.value;
digestOutcome(event, outcome);
const data = await hook(event, outcome);

@@ -546,2 +561,19 @@ if (data === undefined) return outcome.value;

}
function digestOutcome(event, outcome) {
const {
request,
response
} = outcome;
outcome.revalidateKeys = response?.headers.get(REVALIDATE_HEADER)?.split(",");
outcome.foldedHeaders = foldSetCookies(request.headers, [...(event.response?.headers?.getSetCookie() ?? []), ...(response?.headers?.getSetCookie() ?? [])]);
try {
const referrer = request.headers.get("referer");
if (referrer) {
const location = response?.headers.get("Location");
const target = location ? new URL(location, request.url) : new URL(referrer);
if (target.origin === new URL(request.url).origin) outcome.targetUrl = target.toString();
}
} catch {
}
}
function parseSetCookie(setCookie) {

@@ -828,2 +860,3 @@ const [pair, ...attributes] = setCookie.split(";");

exports.decodeResponse = decodeResponse;
exports.decodeResponsePayload = decodeResponsePayload;
exports.encodeErrorHeaderValue = encodeErrorHeaderValue;

@@ -830,0 +863,0 @@ exports.encodeFlashCookie = encodeFlashCookie;

@@ -9,2 +9,3 @@ import { sharedConfig } from 'solid-js';

}
const REVALIDATE_HEADER = "X-Revalidate";

@@ -345,2 +346,14 @@ Feature.AggregateError | Feature.BigIntTypedArray;

}
async function decodeResponsePayload(response, codecOptions) {
const decoded = await decodeResponse(response, codecOptions);
if (decoded !== undefined && response.headers.has(SINGLE_FLIGHT_HEADER)) {
return {
value: decoded.value,
flightData: decoded.data
};
}
return {
value: decoded
};
}

@@ -535,2 +548,4 @@ function encodeInputValue(value) {

async function foldFlightData(hook, event, headers, outcome) {
if (outcome.value instanceof Response && outcome.value.body) return outcome.value;
digestOutcome(event, outcome);
const data = await hook(event, outcome);

@@ -544,2 +559,19 @@ if (data === undefined) return outcome.value;

}
function digestOutcome(event, outcome) {
const {
request,
response
} = outcome;
outcome.revalidateKeys = response?.headers.get(REVALIDATE_HEADER)?.split(",");
outcome.foldedHeaders = foldSetCookies(request.headers, [...(event.response?.headers?.getSetCookie() ?? []), ...(response?.headers?.getSetCookie() ?? [])]);
try {
const referrer = request.headers.get("referer");
if (referrer) {
const location = response?.headers.get("Location");
const target = location ? new URL(location, request.url) : new URL(referrer);
if (target.origin === new URL(request.url).origin) outcome.targetUrl = target.toString();
}
} catch {
}
}
function parseSetCookie(setCookie) {

@@ -813,2 +845,2 @@ const [pair, ...attributes] = setCookie.split(";");

export { ERROR_HEADER, FLASH_COOKIE, FUNCTION_HEADER, GET, INSTANCE_HEADER, SINGLE_FLIGHT_HEADER, clearFlashCookie, configureServerFunctionsServer, createNoJSHandler, createServerReference, decodeErrorHeaderValue, decodeFlashCookie, decodeResponse, encodeErrorHeaderValue, encodeFlashCookie, foldSetCookies, getServerFunction, getServerFunctionMeta, getServerFunctionMetadata, handleServerFunctionRequest, hasFlashCookie, isServerFunction, registerServerFunction, registerServerReference, subscribeFlightData, withMeta };
export { ERROR_HEADER, FLASH_COOKIE, FUNCTION_HEADER, GET, INSTANCE_HEADER, SINGLE_FLIGHT_HEADER, clearFlashCookie, configureServerFunctionsServer, createNoJSHandler, createServerReference, decodeErrorHeaderValue, decodeFlashCookie, decodeResponse, decodeResponsePayload, encodeErrorHeaderValue, encodeFlashCookie, foldSetCookies, getServerFunction, getServerFunctionMeta, getServerFunctionMetadata, handleServerFunctionRequest, hasFlashCookie, isServerFunction, registerServerFunction, registerServerReference, subscribeFlightData, withMeta };
export { createFrame, createFrameHost, createFrameElement, FRAME_APPLIED_EVENT } from "./frame-client.cjs";
export { FRAME_STREAM_HEADER, applyFrameResponse, isFrameStreamResponse, createServerComponentHandler } from "./frame-transport.cjs";
export { createJSONDataTable } from "./serializer.cjs";
export type { Slot } from "./server.cjs";
export declare function getFrameHost(): any;

@@ -5,0 +6,0 @@ /**

@@ -0,2 +1,30 @@

import type { Element as SolidElement } from "solid-js";
/**
* A client position in a server component: a prop the server renders (as JSX
* or by calling it) where client-owned markup belongs. `P` is the client
* component's own props, so a server component can reference the client
* component's type directly instead of restating it.
*
* Arguments are classified by VALUE, not by name — any prop may carry any of
* these:
*
* - primitives ride the chunk;
* - server JSX streams as a nested region (html once, never data);
* - anything else serializes as a data record.
*
* Async server JSX in an argument needs its own boundary: the region is
* emitted as one finished string, so a bare async read has no fallback to
* show and no fragment to reveal into.
*
* `$key` names the occurrence so client state follows an entity across
* responses rather than being positional — the slot-level analogue of `For`'s
* `keyed`, for when references can't carry identity because every response
* re-creates everything. It is occurrence identity, not client data: it is
* stripped before the client component sees its props. Positional identity is
* the right default; `$key` matters when a live list reorders.
*/
export type Slot<P = {}> = (props: P & {
$key?: string | number;
}) => SolidElement;
export { renderToFrameStream, renderServerComponent, serverComponentResponse, frameTransformResult, createFrameSink, frameTransformDirectResult, ServerComponentPlugin, SERVER_COMPONENT_BOOTSTRAP } from "./frame-sink.cjs";
export { FRAME_STREAM_HEADER, isFrameStreamResponse } from "./frame-transport.cjs";

@@ -13,2 +13,3 @@ import { JSONCodecOptions } from "../serializer.cjs";

decodeResponse,
decodeResponsePayload,
encodeErrorHeaderValue,

@@ -15,0 +16,0 @@ getServerFunctionMetadata,

@@ -14,2 +14,3 @@ import { ResponseEnvelope } from "../response.cjs";

decodeResponse,
decodeResponsePayload,
encodeErrorHeaderValue,

@@ -72,2 +73,25 @@ getServerFunctionMetadata,

thrown: boolean;
/**
* The URL the client will show after the mutation — the redirect
* `Location` when the outcome carries one (resolved against the request
* URL, as a browser would), the referring page otherwise. Undefined
* without a usable referer (a non-browser caller has no page to produce
* data for) and for redirects leaving the app's origin: produce no data
* when this is undefined.
*/
targetUrl: string | undefined;
/**
* The outcome's `X-Revalidate` keys, split — the invalidation scope the
* mutation declared. Undefined when the outcome carries none (integrations
* typically collect everything for the target in that case).
*/
revalidateKeys: string[] | undefined;
/**
* The request headers with the mutation's cookie effects applied: the
* event response's `Set-Cookie`s (set during the call), then the
* outcome's own (e.g. `redirect(to, { headers })`), later winning on
* conflict, deletions honored. Build the data-collection request from
* these so re-run reads observe post-mutation cookie state.
*/
foldedHeaders: Headers;
}

@@ -87,4 +111,8 @@

* `Response`/`ResponseEnvelope` control-flow signals alike (plain thrown
* errors never collect). The handler owns the enveloping: contributed data
* ships as `{ value, data }` under the single-flight response header.
* errors never collect, and neither do raw body-carrying `Response` values
* — those are the caller's verbatim payload). The handler owns the
* enveloping: contributed data ships as `{ value, data }` under the
* single-flight response header. The generic halves of collection arrive
* pre-digested on the outcome (`targetUrl`, `revalidateKeys`,
* `foldedHeaders`); the hook supplies only the data strategy.
*/

@@ -91,0 +119,0 @@ export type CollectFlightDataHook = (

@@ -409,2 +409,15 @@ import { JSONCodecOptions } from "../serializer.cjs";

/**
* `decodeResponse` plus the single-flight envelope split: when the response
* carries the single-flight header the decoded `{ value, data }` payload is
* unwrapped into `{ value, flightData }`; otherwise the decoded body (or
* undefined for body-less responses) rides as `{ value }`. Integrations
* that apply response metadata themselves use this so the payload shape
* stays core's own.
*/
export function decodeResponsePayload<T = unknown, D = unknown>(
response: Response,
codecOptions?: JSONCodecOptions
): Promise<{ value: T | undefined; flightData?: D }>;
/**
* Frame one payload for the server-function wire: a `;0x<len32>;` length

@@ -411,0 +424,0 @@ * prefix followed by the utf-8 data. Both transports (server-function

export { createFrame, createFrameHost, createFrameElement, FRAME_APPLIED_EVENT } from "./frame-client.js";
export { FRAME_STREAM_HEADER, applyFrameResponse, isFrameStreamResponse, createServerComponentHandler } from "./frame-transport.js";
export { createJSONDataTable } from "./serializer.js";
export type { Slot } from "./server.js";
export declare function getFrameHost(): any;

@@ -5,0 +6,0 @@ /**

@@ -0,2 +1,30 @@

import type { Element as SolidElement } from "solid-js";
/**
* A client position in a server component: a prop the server renders (as JSX
* or by calling it) where client-owned markup belongs. `P` is the client
* component's own props, so a server component can reference the client
* component's type directly instead of restating it.
*
* Arguments are classified by VALUE, not by name — any prop may carry any of
* these:
*
* - primitives ride the chunk;
* - server JSX streams as a nested region (html once, never data);
* - anything else serializes as a data record.
*
* Async server JSX in an argument needs its own boundary: the region is
* emitted as one finished string, so a bare async read has no fallback to
* show and no fragment to reveal into.
*
* `$key` names the occurrence so client state follows an entity across
* responses rather than being positional — the slot-level analogue of `For`'s
* `keyed`, for when references can't carry identity because every response
* re-creates everything. It is occurrence identity, not client data: it is
* stripped before the client component sees its props. Positional identity is
* the right default; `$key` matters when a live list reorders.
*/
export type Slot<P = {}> = (props: P & {
$key?: string | number;
}) => SolidElement;
export { renderToFrameStream, renderServerComponent, serverComponentResponse, frameTransformResult, createFrameSink, frameTransformDirectResult, ServerComponentPlugin, SERVER_COMPONENT_BOOTSTRAP } from "./frame-sink.js";
export { FRAME_STREAM_HEADER, isFrameStreamResponse } from "./frame-transport.js";

@@ -13,2 +13,3 @@ import { JSONCodecOptions } from "../serializer.js";

decodeResponse,
decodeResponsePayload,
encodeErrorHeaderValue,

@@ -15,0 +16,0 @@ getServerFunctionMetadata,

@@ -14,2 +14,3 @@ import { ResponseEnvelope } from "../response.js";

decodeResponse,
decodeResponsePayload,
encodeErrorHeaderValue,

@@ -72,2 +73,25 @@ getServerFunctionMetadata,

thrown: boolean;
/**
* The URL the client will show after the mutation — the redirect
* `Location` when the outcome carries one (resolved against the request
* URL, as a browser would), the referring page otherwise. Undefined
* without a usable referer (a non-browser caller has no page to produce
* data for) and for redirects leaving the app's origin: produce no data
* when this is undefined.
*/
targetUrl: string | undefined;
/**
* The outcome's `X-Revalidate` keys, split — the invalidation scope the
* mutation declared. Undefined when the outcome carries none (integrations
* typically collect everything for the target in that case).
*/
revalidateKeys: string[] | undefined;
/**
* The request headers with the mutation's cookie effects applied: the
* event response's `Set-Cookie`s (set during the call), then the
* outcome's own (e.g. `redirect(to, { headers })`), later winning on
* conflict, deletions honored. Build the data-collection request from
* these so re-run reads observe post-mutation cookie state.
*/
foldedHeaders: Headers;
}

@@ -87,4 +111,8 @@

* `Response`/`ResponseEnvelope` control-flow signals alike (plain thrown
* errors never collect). The handler owns the enveloping: contributed data
* ships as `{ value, data }` under the single-flight response header.
* errors never collect, and neither do raw body-carrying `Response` values
* — those are the caller's verbatim payload). The handler owns the
* enveloping: contributed data ships as `{ value, data }` under the
* single-flight response header. The generic halves of collection arrive
* pre-digested on the outcome (`targetUrl`, `revalidateKeys`,
* `foldedHeaders`); the hook supplies only the data strategy.
*/

@@ -91,0 +119,0 @@ export type CollectFlightDataHook = (

@@ -409,2 +409,15 @@ import { JSONCodecOptions } from "../serializer.js";

/**
* `decodeResponse` plus the single-flight envelope split: when the response
* carries the single-flight header the decoded `{ value, data }` payload is
* unwrapped into `{ value, flightData }`; otherwise the decoded body (or
* undefined for body-less responses) rides as `{ value }`. Integrations
* that apply response metadata themselves use this so the payload shape
* stays core's own.
*/
export function decodeResponsePayload<T = unknown, D = unknown>(
response: Response,
codecOptions?: JSONCodecOptions
): Promise<{ value: T | undefined; flightData?: D }>;
/**
* Frame one payload for the server-function wire: a `;0x<len32>;` length

@@ -411,0 +424,0 @@ * prefix followed by the utf-8 data. Both transports (server-function