import type { PackageManagerId } from '../shared/package-managers.js'; import { type AlternateRenderTargetId } from '../add/alternate-render-targets.js'; import { type CompoundInnerBlocksPresetId } from '../add/compound-inner-blocks.js'; import { type BuiltInTemplateId } from './template-registry.js'; import type { InstallDependenciesOptions } from './scaffold-apply-utils.js'; import { type ScaffoldWordPressTargetVersion } from './scaffold-compatibility.js'; import type { DataStorageMode, PersistencePolicy, ScaffoldAnswers, ScaffoldProgressEvent, ScaffoldTemplateVariables } from './scaffold.js'; export interface BlockSpec { alternateRenderTargets: readonly AlternateRenderTargetId[]; block: { namespace: string; phpPrefix: string; slug: string; textDomain: string; }; compound: { innerBlocksPreset: CompoundInnerBlocksPresetId; }; metadata: { category: string; description: string; icon: string; keyword: string; title: string; }; persistence: { enabled: false; } | { dataStorageMode: DataStorageMode; enabled: true; persistencePolicy: PersistencePolicy; scope: 'compound-parent' | 'single'; }; project: { author: string; }; queryLoop: { allowedControls: readonly string[]; enabled: boolean; postType: string; }; runtime: { withMigrationUi: boolean; withTestPreset: boolean; withWpEnv: boolean; wpVersion: ScaffoldWordPressTargetVersion; }; template: { description: string; family: BuiltInTemplateId; features: string[]; }; } export interface BlockGenerationTarget { allowExistingDir: boolean; cwd: string; externalLayerId?: string; externalLayerSource?: string; externalLayerSourceLabel?: string; noInstall: boolean; packageManager: PackageManagerId; projectDir: string; repositoryReference?: string; variant?: string; } export interface PlanBlockInput { allowExistingDir?: boolean; alternateRenderTargets?: string; answers: ScaffoldAnswers; cwd?: string; dataStorageMode?: DataStorageMode; externalLayerId?: string; externalLayerSource?: string; externalLayerSourceLabel?: string; noInstall?: boolean; packageManager: PackageManagerId; persistencePolicy?: PersistencePolicy; projectDir: string; repositoryReference?: string; templateId: BuiltInTemplateId; variant?: string; withMigrationUi?: boolean; queryPostType?: string; withTestPreset?: boolean; withWpEnv?: boolean; wpVersion?: ScaffoldWordPressTargetVersion; } export interface PlanBlockResult { spec: BlockSpec; target: BlockGenerationTarget; } export interface ValidateBlockInput { plan: PlanBlockResult; } export interface ValidateBlockResult extends PlanBlockResult { } export interface RenderBlockInput { validated: ValidateBlockResult; } export interface RenderBlockResult extends ValidateBlockResult { cleanup?: () => Promise; gitignoreContent: string; postRender: { applyLocalDevPresets: boolean; applyMigrationUiCapability: boolean; seedPersistenceArtifacts: boolean; seedStarterManifestFiles: boolean; }; readmeContent: string; selectedVariant: null; templateDir: string; variables: ScaffoldTemplateVariables; warnings: string[]; } export interface ApplyBlockInput { rendered: RenderBlockResult; installDependencies?: ((options: InstallDependenciesOptions) => Promise) | undefined; onProgress?: ((event: ScaffoldProgressEvent) => void | Promise) | undefined; /** * Whether compiler-backed metadata and REST artifacts should be seeded. * Dry-run previews disable this and report the expected paths separately. */ seedCompilerArtifacts?: boolean; } export declare function createBuiltInBlockSpec({ alternateRenderTargets, answers, dataStorageMode, persistencePolicy, templateId, withMigrationUi, withTestPreset, withWpEnv, wpVersion }: Omit): BlockSpec; export declare function buildTemplateVariablesFromBlockSpec(spec: BlockSpec): ScaffoldTemplateVariables;