import type { SeedSubSource } from "../formats.js"; export interface CapturedClosure { sourceImports: Record; subSources: Record; /** Entry source plus every captured module, in UTF-8 bytes. */ bytes: number; /** * Specifiers the render venue will ask for and cannot answer: every import * the walk did NOT capture that is not `isIslandResolvableSpecifier` — * unbundled package imports, component-local stylesheets, unresolvable host * paths. * * This is the difference between a closure that renders and one that * error-boxes. The mount compiles with sucrase's `imports` transform, so * every surviving import becomes `require(specifier)`; a specifier that is * neither in the mount table nor in the module's captured import table * THROWS, which the host catches into a loud notice. Dropping these silently * is how a grey placeholder becomes a mislabeled crash. */ unsupported: string[]; /** * Every PACKAGE this closure needs at render time — the ones the mount table * bundles (`IN_CLIENT_BUNDLED_PACKAGES`) and the ones a preview venue can * fetch from a pinned CDN alike. * * Recorded so a CONSUMER can detect skew instead of failing silently: a * venue that cannot supply one throws `module "recharts" is not available`, * and a surface that renders previews as `streaming` turns that throw into a * shimmer skeleton forever — no frame, no error, indistinguishable from * "still loading". A consumer that predates CDN loading sees `recharts` here, * finds it unsatisfied, and says so honestly instead of spinning. */ requires: string[]; /** * PREVIEW VENUE ONLY. Import specifier -> `@` * plus any subpath, for every package import a preview venue can resolve * from a pinned CDN. * * Deliberately reported ALONGSIDE `unsupported` rather than removed from it: * the walk states facts, and the two venues that read a closure answer them * differently. A `` pin baseline renders in a customer's own page, * where no CDN may be reached, so `unsupported` stays exactly as it always * was for that caller; a console preview subtracts these (see * {@link previewBlockingSpecifiers}). */ packages: Record; /** * Package imports that are NOT offered to the CDN, with the clause that says * why — a workspace link or a `private: true` package is not on any public * registry, and a version we cannot resolve exactly must never be guessed. * The preview says this instead of shipping a URL that 404s. */ unloadablePackages: Record; } /** The specifiers that block a PREVIEW render: everything the venue cannot * resolve, minus the packages a preview venue fetches from the pinned CDN. */ export declare const previewBlockingSpecifiers: (closure: CapturedClosure) => string[]; export interface ClosureOverBudget { bytes: number; budgetBytes: number; /** Root-relative id of the largest module reached — what to shrink. */ largest: string; } export type ClosureResult = { ok: true; closure: CapturedClosure; } | { ok: false; overBudget: ClosureOverBudget; }; export declare function portablePath(root: string, file: string): string; export declare function importSpecifiers(source: string, fileName?: string): string[]; /** The module's default export, when it has one: `name` is the identifier it * declares, or null for an anonymous one. Null RESULT means no default export * at all — a distinction the entry rule needs and `defaultExportName` (the * pin path's caller) collapses. */ export declare function defaultExportOf(source: string, file: string): { name: string | null; } | null; /** * Walk one component's import graph to closure. `label` names the thing being * captured in every warning ("remixable slot Foo", "host component Foo"). * Warnings are only surfaced when the capture succeeds: an over-budget capture * reports the one fact that matters instead of a list of missed imports. */ export declare function captureClosure(options: { root: string; realRoot: string; /** Realpathed directories outside `realRoot` that also hold host source * (`remix.sources`). Captured ids stay relative to `realRoot`, so a module * under one of these reads as `../demos/…`. */ extraRoots?: readonly string[]; label: string; primaryFile: string; primarySource: string; budgetBytes?: number; warnings: string[]; }): Promise; /** The one over-budget sentence: what blew it, and what to do about it. */ export declare function overBudgetWarning(label: string, over: ClosureOverBudget): string;