/** * Asset references, found through the prop schema. * * A URL prop flagged with `asset` is something the page loads. Walking the * schema alongside the validated props finds every such reference, at any * depth, with the path the author wrote. The compiler uses the same walk to * build the page's network policy and to reject blocked references at * validation, so the two can never disagree about which values are assets. * Child blocks in slots are their own IR nodes and are walked as such. */ import type { NetworkPolicy } from '../ir.js'; import { type JsonValue } from '../json.js'; import type { PropSchema } from '../registry/prop-schema.js'; import { type MediaCapability } from './network-policy.js'; export interface AssetReference { /** JSON path of the value, e.g. `$.blocks[2].items[0].src`. */ path: string; /** The prop or field name holding the reference, e.g. `poster`. */ field: string; reference: string; capability: MediaCapability; /** The schema asks for a blocked remote reference to fail validation. */ rejectBlocked: boolean; } /** Every asset reference in a block's validated props, in schema order. */ export declare function assetReferences(props: Readonly>, values: Readonly>, path: string): AssetReference[]; /** * Origins the page's policy must name so its allowed remote assets load. * Provider allowlists are applied by the renderers, which never emit a * reference the policy does not allow. */ export declare function assetOrigins(policy: NetworkPolicy, references: readonly AssetReference[]): string[]; /** True when the reference may load: a local path always may, a remote one through its gate. */ export declare function assetAllowed(policy: NetworkPolicy, asset: AssetReference): boolean; //# sourceMappingURL=asset-references.d.ts.map