import type { Format } from 'ajv'; import { ModuleFederationOptions } from '@module-federation/rsbuild-plugin'; import { RsbuildPlugin } from '@rsbuild/core'; /** * Transactionally assembles independently compiled targets into one source-manifest-backed * physical package. Target code stays under `targets/`; only the * host-owned surface shell and target-selected build-manifest assets may be shared * across target graphs, and their bytes must be identical. */ export declare const assembleTapPackage: ({ buildManifest, output, targets, }: TapPackageAssemblyOptions) => Promise; /** * Fails a package build when generated artifacts retain a local file URL or * an absolute checkout path. This validates emitted bytes, not source text. */ export declare const assertPortableTapPackageArtifacts: ({ output, forbiddenRoots, }: TapPackageArtifactPortabilityOptions) => Promise; /** Validates staged build metadata before any project-owned target builder runs. */ export declare const assertValidTapMiniappBuildManifest: (manifest: string) => Promise; declare type Config = { manifest?: string; entryName?: string; output?: string; federation?: ModuleFederationOptions; /** Descriptor target updated by this build, such as desktop or mobile. */ packageTarget?: 'desktop' | 'mobile' | 'quickjs' | 'worker' | 'node' | 'workflow-host'; /** Filesystem root for this independently compiled target graph. */ packageOutputRoot?: string; }; declare type ExactSourceManifestV2 = Readonly<{ rawBytes: Uint8Array; parsedManifest: SourceManifestV2; sha256: string; byteLength: number; }>; export declare const pluginTap: (options?: Config) => RsbuildPlugin; /** Register the canonical JSON Schema formats shared by TAP package tooling. */ export declare function registerTapManifestAjvFormats(ajv: Registry): Registry; declare const SOURCE_MANIFEST_SCHEMA_VERSION = 2; declare type SourceManifestArtifactV2 = Readonly<{ path: string; digest: string; length: number; }>; declare type SourceManifestLocalDisplayV2 = Readonly<{ name?: string; slug?: string; }>; declare type SourceManifestRuntimeEffectV2 = Readonly<{ kind: string; resources: readonly string[]; }>; declare type SourceManifestTargetV2 = Readonly<{ target: string; path: string; digest: string; length: number; }>; declare type SourceManifestV2 = Readonly<{ schemaVersion: typeof SOURCE_MANIFEST_SCHEMA_VERSION; versionLabel: string; localDisplay?: SourceManifestLocalDisplayV2; targets: readonly SourceManifestTargetV2[]; artifacts: readonly SourceManifestArtifactV2[]; permissions: readonly string[]; runtimeEffects: readonly SourceManifestRuntimeEffectV2[]; }>; /** One independently permissioned document lane within an artifact type. */ export declare type TapArtifactDocumentDefinition = { id: string; displayName?: string | null; /** Package-qualified sync protocol identifier: `..v`. */ syncProtocol: string; /** Package-relative JSON schema validating full-document snapshots. */ snapshotSchema: string; /** Package-relative JSON schema validating single sync operations. */ operationSchema: string; /** Permission catalog action required to write this document lane. */ writeAction: string; /** Declared per-operation payload ceiling in bytes, bounded by the host. */ maxOperationBytes: number; /** Declared per-snapshot ceiling in bytes, bounded by the host. */ maxSnapshotBytes: number; }; /** Optional file-handler association between an artifact type and file formats. */ export declare type TapArtifactFileAssociation = { id: string; extensions: string[]; mimeTypes?: string[]; direction: TapArtifactFileDirection; }; /** Import/export direction of one artifact file association. */ export declare type TapArtifactFileDirection = 'import' | 'export' | 'import-export'; /** Closed set of platform-owned resource kinds an artifact type may consume. */ export declare type TapArtifactHostResourceKind = 'sync-transport' | 'snapshot-store' | 'presence-directory' | 'receipt-journal'; /** Reference to the package-owned migration entry point for an artifact type. */ export declare type TapArtifactMigrationRuntime = { contributionId: string; }; /** Artifact format versions one release can read and write. */ export declare type TapArtifactTypeCompatibility = { /** Oldest artifact format version this release can still read. */ minReaderVersion: number; /** Newest artifact format version this release can write. */ maxWriterVersion: number; }; /** * Typed build-manifest view of one `artifact.type` contribution. The declared * options stay open to forward-compatible schema keys, matching the generic * contribution member; Ajv enforces the closed contract before packaging. */ export declare type TapArtifactTypeContribution = { kind: 'artifact.type'; id: string; apiVersion?: number; lifecycleScope?: string; targets?: Record; authorization?: { allOf?: string[]; onDemand?: string[]; effects?: Array<{ kind: string; resources?: string[]; }>; }; options?: TapArtifactTypeOptions & Record; [key: string]: unknown; }; /** * Declarative options of one `artifact.type` contribution: a package-owned * durable collaborative artifact type signed into a package release. */ export declare type TapArtifactTypeOptions = { /** Package-qualified type identifier: `..v`. */ typeId: string; displayName: string; /** Independently permissioned document lanes, such as content and review. */ documents: TapArtifactDocumentDefinition[]; schemas?: TapArtifactTypeSchemas; /** Same-package `ui.renderer` contribution that previews this artifact type. */ previewRenderer?: string | null; /** Package-owned migration entry point hosted by an admitted non-UI runtime. */ migration?: TapArtifactMigrationRuntime | null; /** Optional file-handler and import/export associations for this artifact type. */ fileAssociations?: TapArtifactFileAssociation[]; /** Closed set of host resource kinds this artifact type is permitted to use. */ hostResources?: TapArtifactHostResourceKind[]; /** Artifact format versions this release can read and write. */ compatibility: TapArtifactTypeCompatibility; }; /** Optional type-wide schema assets for an artifact type. */ export declare type TapArtifactTypeSchemas = { anchorSchema?: string | null; threadSchema?: string | null; presenceSchema?: string | null; previewSchema?: string | null; }; declare interface TapJsonSchemaFormatRegistry { addFormat(name: string, format: Format): unknown; } export declare const tapLib: (options?: Config) => TapLibConfig; /** * Patch-stable Rslib configuration returned by {@link tapLib}. * * Rslib and Rspack config types contain dependency-private symbols. Publishing * those concrete types makes a linked SDK incompatible with a consumer using a * different compatible patch release. Keep the extension sections mutable and * structurally open while retaining the stable scalar contract owned by TAP. */ export declare type TapLibConfig = { format: 'mf' | 'esm'; bundle: true; autoExternal: false; dts: false; source?: Record; output: Record; tools: { rspack?: TapRspackTool; [key: string]: any; }; plugins: Array<{ name: string; apply?: any; setup: (api: any) => void | Promise; [key: string]: any; }>; }; /** * Creates the Rslib target selected by the SDK lifecycle environment. Project * configs may extend the returned config with their own builder plugins. */ export declare function tapLifecycleTarget(): TapLibConfig; /** Emitted-package scan used to reject machine-local build artifacts. */ export declare type TapPackageArtifactPortabilityOptions = { output: string; /** Absolute source or checkout roots that must never be embedded in output. */ forbiddenRoots?: readonly string[]; }; /** * Independently built target roots assembled into one immutable TAP package. * Every build-manifest target must be present exactly once. */ export declare type TapPackageAssemblyOptions = { buildManifest: string; output: string; targets: Partial>; }; export declare type TapPackageTarget = NonNullable; /** Generic verification input for an already assembled portable package. */ export declare type TapPackageVerificationOptions = { output: string; }; export declare type TapRspackConfig = { plugins?: any[]; module?: { rules?: any[]; [key: string]: any; }; resolve?: { alias?: false | Record>; [key: string]: any; }; output?: Record; [key: string]: any; }; export declare type TapRspackConfigMutator = (config: TapRspackNormalizedConfig, context: any) => void | TapRspackConfig | Promise; /** * Patch-stable subset of the normalized Rspack configuration supplied to * `tools.rspack` callbacks. * * The real Rspack declarations contain dependency-private symbols, so this * deliberately keeps extension values open while preserving contextual types * for the configuration seams miniapps commonly customize. */ export declare type TapRspackNormalizedConfig = { plugins: any[]; module: { rules?: any[]; [key: string]: any; }; resolve: { alias?: false | Record>; [key: string]: any; }; output: Record; [key: string]: any; }; export declare type TapRspackTool = TapRspackConfig | TapRspackConfigMutator | Array; /** * Re-verifies the complete immutable graph of an already assembled package. * Publication uses this path so `--from` cannot bypass assembly invariants. */ export declare const verifyTapPackage: ({ output, }: TapPackageVerificationOptions) => Promise; export { }