/** * The component bundle — what sits in a generated seat. * * These shapes are the ON-DISK and ON-THE-WIRE format of a captured host * component (`.vendo/components/**`), so they belong to the contract rather than * to the capture that writes them: the console, the jail renderer and `@vendoai/vendo/actions` * all read them, and the browser halves of those readers must not pull node code * in to speak the format. `@vendoai/vendo/actions` re-exports every name from here, so * its public surface is unchanged. */ import { type ComponentEntry } from "@vendoai/core"; import { z } from "zod"; /** * The bundle itself, and the entry it sits in. Declared in `@vendoai/core` * beside the `AppDocument.components` field it types — core's store conformance * kit parses a stored row with `appDocumentSchema` and may not reach up into * this package — and re-exported here, never re-declared, so the format door * is the one place a consumer reads. Same rule as the three bundle limits. */ export { bundleOf, componentBundleSchema, componentEntrySchema, type ComponentBundle, type ComponentEntry, } from "@vendoai/core"; /** The stored map as bare sources — what the printer, the tree assembler and * the jail all want. The only place the whole map is unwrapped, so no caller * has to know a legacy entry from a bundle. */ export declare const componentSources: (components: Record | undefined) => Record; /** * One captured module, content-addressed by the sha-256 hex of its canonical * JSON. Written to `.vendo/components/modules/.json` and pushed to the * Cloud blob namespace under the same key, so ten components importing one * `format-currency.ts` store ONE copy and reference it ten times. A captured * stylesheet is the same shape with no imports. */ export interface CapturedModule { source: string; /** Import specifier -> captured module id (root-relative posix path). */ imports?: Record; } export declare const capturedModuleSchema: z.ZodObject<{ source: z.ZodString; imports: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ source: z.ZodString; imports: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ source: z.ZodString; imports: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>; /** * Why a registered component has no captured source. Every reason is recorded, * not just the one that is easy to explain: a console tile that says WHY it * cannot preview a component is the difference between a bug report and a * one-line fix. `detail` is a finished sentence a surface can show verbatim. */ export declare const HOST_COMPONENT_SKIP_REASONS: readonly ["too-large", "unsupported-imports", "no-default-export", "default-export-conflict", "in-package", "no-named-declaration"]; export type HostComponentSkipReason = (typeof HOST_COMPONENT_SKIP_REASONS)[number]; export interface HostComponentSkip { reason: HostComponentSkipReason; /** One finished sentence, safe to render as-is. */ detail: string; /** `too-large`: bytes the closure needed, the budget, and the biggest module. */ bytes?: number; budgetBytes?: number; largest?: string; /** `unsupported-imports`: the specifiers the jail cannot resolve. */ specifiers?: string[]; } /** * One registered host component, captured by sync so the console can render it * for real instead of a labeled placeholder (`.vendo/components/.json`). * Holds no source: every byte lives in a content-addressed `CapturedModule`, so * the record stays small enough that listing the collection IS the hash * manifest a push compares against. */ export interface CapturedHostComponent { /** The name the host registered — the name generated trees reference. */ name: string; /** Content hash of the whole capture (refs + structure), `sha256:`. */ hash: string; capturedAt: string; /** Root-relative posix path of the module that declares the component. */ module: string; /** The binding inside `module` to render. "default" means render the module * as-is; anything else is a local (possibly unexported) declaration, and * `hostComponentEntrySource` turns it into the jail's default export. */ export?: string; /** Content address of the entry module. Absent when `skipped` is set. */ entry?: string; /** Captured module id -> content address, for the whole import closure. */ modules?: Record; /** App-root stylesheets, shared by every component in the project. */ styles?: Array<{ path: string; ref: string; }>; /** Total captured bytes (entry + closure), for budget accounting. */ bytes?: number; /** * Every package this capture needs at render time — the ones the jail bundles * (clsx / tailwind-merge / zod) and the ones a preview fetches from the pinned * CDN (`packages` below). A consumer that cannot supply one MUST show an * honest "preview unavailable" tile: without this field the require throws, a * `streaming` surface swallows it into a shimmer skeleton, and the component * is indistinguishable from one still loading. Consumers predating CDN * loading find the CDN packages unsatisfied here and degrade honestly — * which is exactly why the CDN pins live in a separate field. */ requires?: string[]; /** * PREVIEW VENUE ONLY. Import specifier -> `@[/subpath]`, for every package a preview may load from a pinned * CDN. Never a range and never a tag: the version is * the one the host has installed, and one that cannot be resolved exactly * makes the component an honest skip instead. * * A remix fork rendering in a customer's own page must never reach a CDN, so * nothing on the production path ever copies this into a furnishing (see * `attachPinFurnishings`, and the strip in `stripServerAuthoritativeFields`). */ packages?: Record; /** * The rehearsal seed a preview renders with, parsed from the registration's * own first usable `examples` string. * * Load-bearing, not a nicety. A registered component is written to render * nothing until its data binds (`if (!series?.length) return null` — what the * docs recommend and what every demo component does), and a preview has NO * data plane: every query stubs to `[]`. Without a seed the module loads, the * component correctly draws nothing, and the surface sits on a streaming * silhouette forever. `sampleProps` is exactly this seam, and pin baselines * already carry it. */ sampleProps?: Record; /** * Which rung of the seed ladder produced `sampleProps`: the host's own * declared `examples`, or values synthesized from its declared props schema. * * A SIBLING of `sampleProps`, deliberately not a key inside it — the jail * spreads `sampleProps` straight onto the component's props, so an `origin` * key in there would be passed to the component as a prop and could collide * with a real one. Kept out here, a surface can still say "preview uses * generated sample data" instead of implying the numbers are real. */ sampleOrigin?: "declared" | "generated"; /** Present INSTEAD of `sampleProps`, so a surface can label the gap ("no * sample data") rather than spin. Absent whenever `sampleProps` is set. */ noSampleProps?: HostComponentSampleGap; skipped?: HostComponentSkip; } /** Why a captured component has no preview seed. Distinct from `skipped`: the * capture SUCCEEDED, there is just nothing to render it with. */ export interface HostComponentSampleGap { reason: "no-examples" | "unreadable-examples" | "unrepresentable-props"; /** One finished sentence, safe to render as-is. */ detail: string; } export declare const capturedHostComponentSchema: z.ZodObject<{ name: z.ZodString; hash: z.ZodString; capturedAt: z.ZodString; module: z.ZodString; export: z.ZodOptional; entry: z.ZodOptional; modules: z.ZodOptional>; styles: z.ZodOptional, "many">>; bytes: z.ZodOptional; requires: z.ZodOptional>; packages: z.ZodOptional>; sampleProps: z.ZodOptional>; sampleOrigin: z.ZodOptional>; noSampleProps: z.ZodOptional; detail: z.ZodString; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ reason: z.ZodEnum<["no-examples", "unreadable-examples", "unrepresentable-props"]>; detail: z.ZodString; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ reason: z.ZodEnum<["no-examples", "unreadable-examples", "unrepresentable-props"]>; detail: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; skipped: z.ZodOptional; detail: z.ZodString; bytes: z.ZodOptional; budgetBytes: z.ZodOptional; largest: z.ZodOptional; specifiers: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ reason: z.ZodEnum<["too-large", "unsupported-imports", "no-default-export", "default-export-conflict", "in-package", "no-named-declaration"]>; detail: z.ZodString; bytes: z.ZodOptional; budgetBytes: z.ZodOptional; largest: z.ZodOptional; specifiers: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ reason: z.ZodEnum<["too-large", "unsupported-imports", "no-default-export", "default-export-conflict", "in-package", "no-named-declaration"]>; detail: z.ZodString; bytes: z.ZodOptional; budgetBytes: z.ZodOptional; largest: z.ZodOptional; specifiers: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; hash: z.ZodString; capturedAt: z.ZodString; module: z.ZodString; export: z.ZodOptional; entry: z.ZodOptional; modules: z.ZodOptional>; styles: z.ZodOptional, "many">>; bytes: z.ZodOptional; requires: z.ZodOptional>; packages: z.ZodOptional>; sampleProps: z.ZodOptional>; sampleOrigin: z.ZodOptional>; noSampleProps: z.ZodOptional; detail: z.ZodString; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ reason: z.ZodEnum<["no-examples", "unreadable-examples", "unrepresentable-props"]>; detail: z.ZodString; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ reason: z.ZodEnum<["no-examples", "unreadable-examples", "unrepresentable-props"]>; detail: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; skipped: z.ZodOptional; detail: z.ZodString; bytes: z.ZodOptional; budgetBytes: z.ZodOptional; largest: z.ZodOptional; specifiers: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ reason: z.ZodEnum<["too-large", "unsupported-imports", "no-default-export", "default-export-conflict", "in-package", "no-named-declaration"]>; detail: z.ZodString; bytes: z.ZodOptional; budgetBytes: z.ZodOptional; largest: z.ZodOptional; specifiers: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ reason: z.ZodEnum<["too-large", "unsupported-imports", "no-default-export", "default-export-conflict", "in-package", "no-named-declaration"]>; detail: z.ZodString; bytes: z.ZodOptional; budgetBytes: z.ZodOptional; largest: z.ZodOptional; specifiers: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; hash: z.ZodString; capturedAt: z.ZodString; module: z.ZodString; export: z.ZodOptional; entry: z.ZodOptional; modules: z.ZodOptional>; styles: z.ZodOptional, "many">>; bytes: z.ZodOptional; requires: z.ZodOptional>; packages: z.ZodOptional>; sampleProps: z.ZodOptional>; sampleOrigin: z.ZodOptional>; noSampleProps: z.ZodOptional; detail: z.ZodString; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ reason: z.ZodEnum<["no-examples", "unreadable-examples", "unrepresentable-props"]>; detail: z.ZodString; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ reason: z.ZodEnum<["no-examples", "unreadable-examples", "unrepresentable-props"]>; detail: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; skipped: z.ZodOptional; detail: z.ZodString; bytes: z.ZodOptional; budgetBytes: z.ZodOptional; largest: z.ZodOptional; specifiers: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ reason: z.ZodEnum<["too-large", "unsupported-imports", "no-default-export", "default-export-conflict", "in-package", "no-named-declaration"]>; detail: z.ZodString; bytes: z.ZodOptional; budgetBytes: z.ZodOptional; largest: z.ZodOptional; specifiers: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ reason: z.ZodEnum<["too-large", "unsupported-imports", "no-default-export", "default-export-conflict", "in-package", "no-named-declaration"]>; detail: z.ZodString; bytes: z.ZodOptional; budgetBytes: z.ZodOptional; largest: z.ZodOptional; specifiers: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; /** The jail renders a module's DEFAULT export, but a host registers whatever * binding it likes — including a component its module never exports. Capture * records the binding; this turns the stored module into a renderable entry. * Capture guarantees the append is legal (a module that already * default-exports something else is skipped with a warning instead). */ export declare function hostComponentEntrySource(source: string, exportName?: string): string; //# sourceMappingURL=component-bundle.d.ts.map