Server/Packages/Resume/API reference
@sigx/resume · Stable

API reference#

Exports of @sigx/resume v0.13.0, by entry point.

Entry points#

SubpathPurpose
@sigx/resumeresumePlugin + the resume types.
@sigx/resume/serverWinterCG-clean server surface — createBoundaryRefresh, signal-state capture.
@sigx/resume/clientThe scope-resume / upgrade-on-write runtime (lazy-loaded on first interaction).
@sigx/resume/loaderThe delegation loader — the page's only script.

Apps usually import only @sigx/resume (and @sigx/resume/server for boundary refresh); the client and loader entries are wired up by the generated virtual:sigx-resume/entry.

resumePlugin#

TypeScript
function resumePlugin(options?: ResumePluginOptions): SSRPack;

interface ResumePluginOptions {
  manifest?: ResumeManifest;
}

Install on the app: app.use(resumePlugin({ manifest })). On the server it records resume-stamped components as boundaries with hydrate: 'never' (the pack's delegation owns all waking) and declines any usage site carrying a client:* directive (that belongs to islands). Pass resumeManifest from virtual:sigx-manifests as the manifest (undefined under dev).

TypeScript
interface ResumeManifest {
  components: Record<string, ResumeChunkRef>;  // __resumeId → upgrade chunk
  handlers: Record<string, ResumeChunkRef>;    // QRL symbol → handler chunk
}
interface ResumeChunkRef { chunkUrl: string; exportName: string; }

createBoundaryRefresh#

From @sigx/resume/server. Builds the function that re-renders admitted boundaries for a mutation — hand its result to your server-function request handler as renderBoundaries.

TypeScript
function createBoundaryRefresh(options: BoundaryRefreshOptions): (
  requests: ReadonlyArray<BoundaryRefreshRequest>,
  base: number,
  rq?: unknown,
) => Promise<BoundaryRefreshEntry[]>;

interface BoundaryRefreshOptions {
  plugins?: SSRPlugin[];                     // SSR plugins the re-render runs with (resumePlugin at least)
  components: Record<string, unknown>;       // REQUIRED — __resumeId → server component (factory or lazy loader)
  app?: (rq?: unknown) => App | Promise<App>; // per-call app for DI (type handlers, provides)
}
  • components is required and explicit — own-property lookup only (the key is attacker-controlled).
  • plugins may be omitted when app carries them.
  • The returned function floors the component-id counter at the client-chosen base to avoid marker collisions.
TypeScript
interface BoundaryRefreshRequest { id: number; component: string; deps?: string[]; props?: Record<string, unknown>; }
interface BoundaryRefreshEntry { for: number; id: number; html: string; state?: Record<string, unknown>; records: Record<number, unknown>; }

state / records and the request props are encoded with @sigx/serialize. Failure is silent by design: a descriptor it can't honor (unknown key, unserializable props, a render throw) is omitted — the mutation already succeeded, and those reads converge through @sigx/cache invalidation.

Vite#

The sigxResume() plugin from @sigx/vite/resume runs the transform and emits .vite/sigx-resume-manifest.json, surfaced as resumeManifest from virtual:sigx-manifests.