import { a as ImportSource, i as AdapterInput, o as MarkerFileContext, s as defineAdapter, t as CollectedWarning } from "./logger-Byc7DAuP.mjs"; //#region src/run.d.ts interface RunTransformOptions { /** * Glob pattern(s) for files to transform * @example "src/**\/*.tsx" or ["src/**\/*.ts", "src/**\/*.tsx"] */ files: string | string[]; /** * File glob(s) to scan for cross-file component selector usage, or `null` to opt out. * * When set to a glob pattern, files matching this glob that are NOT in `files` trigger * the bridge strategy (stable bridge className for incremental migration when consumers * are not transformed). Files in both globs use the marker sidecar strategy (both * consumer and target are transformed). * * Required when `externalInterface` is `"auto"`. * * @example "src/**\/*.tsx" * @example null // opt out of cross-file scanning */ consumerPaths: string | string[] | null; /** * Adapter for customizing the transform. * Controls value resolution and resolver-provided imports. * * Use `externalInterface: "auto"` to auto-detect which exported components * need external className/style and polymorphic `as` support by scanning * consumer code specified via `consumerPaths` (or `files`). * * Note: `"auto"` requires prepass scanning to succeed. If prepass fails, * runTransform throws instead of silently falling back. */ adapter: AdapterInput; /** * Dry run - don't write changes to files * @default false */ dryRun?: boolean; /** * Print transformed output to stdout * @default false */ print?: boolean; /** * jscodeshift parser to use. * * When set to `"ts"` or `"tsx"` (including the default), runTransform also * builds TypeScript compiler metadata for more accurate wrapper interfaces. * * @default "tsx" */ parser?: "babel" | "babylon" | "flow" | "ts" | "tsx"; /** * Commands to run after transformation to format the output files. * Each command string will be invoked with the transformed file paths appended as arguments. * @example ["pnpm prettier --write", "pnpm eslint --fix"] */ formatterCommands?: string[]; /** * Maximum number of examples shown per warning category in the summary. * @default 3 */ maxExamples?: number; /** * Suppress console output: both the per-file runner messages and the final * warning summary report. Warnings are still collected and returned. * @default false */ silent?: boolean; /** * When true, allow the codemod to leave individual styled declarations as-is when * they hit an unsupported pattern while transforming the rest of the file. This * enables incremental migration: a file with one unconvertible component still * produces useful output for the others. * * When false (default), any per-decl bail escalates to a whole-file bail — the * safer/stricter behavior matching the pre-partial-migration semantics. * * @default false */ allowPartialMigration?: boolean; /** * Also collect per-file outcomes as if each file were transformed by itself, * while reusing the same prepass. Useful for candidate finders that recommend * files to run individually. * * @default false */ collectStandaloneFileResults?: boolean; /** * Absolute paths of files to treat as already converted to StyleX, even though * they are not. Cascade-conflict checks then "see past" these files so a * consumer's own unsupported patterns surface instead of being masked by the * cascade bail. Intended for analysis-only/dry runs (e.g. the migration plan). */ assumeConvertedFiles?: string[]; } interface RunTransformResult { /** Number of files that had errors */ errors: number; /** Number of files that were unchanged */ unchanged: number; /** Number of files that were skipped */ skipped: number; /** Number of files that were transformed */ transformed: number; /** Total time in seconds */ timeElapsed: number; /** Warnings emitted during transformation */ warnings: CollectedWarning[]; /** Per-file outcomes from the dependency-ordered run. */ fileResults: TransformFileResult[]; /** Per-file outcomes from isolated transforms, populated when requested. */ standaloneFileResults?: TransformFileResult[]; /** Warnings from isolated transforms, populated when requested. */ standaloneWarnings?: CollectedWarning[]; } /** * Run the styled-components to StyleX transform on files matching the glob pattern. * * @example * ```ts * import { runTransform } from 'styled-components-to-stylex-codemod'; * import { defineAdapter } from 'styled-components-to-stylex-codemod'; * * const adapter = defineAdapter({ * styleMerger: null, * useSxProp: false, * usePhysicalProperties: true, * externalInterface() { * return { styles: false, as: false, ref: false }; * }, * resolveValue(ctx) { * if (ctx.kind !== "theme") return null; * return { * expr: `themeVars.${ctx.path.replace(/\\./g, "_")}`, * imports: [{ from: { kind: "specifier", value: "./theme.stylex" }, names: [{ imported: "themeVars" }] }], * }; * }, * resolveCall() { * return null; * }, * resolveSelector() { * return undefined; * }, * }); * * await runTransform({ * files: 'src/**\/*.tsx', * consumerPaths: null, * adapter, * dryRun: true, * }); * ``` */ declare function runTransform(options: RunTransformOptions): Promise; type TransformFileResult = { filePath: string; status: "error" | "skipped" | "unchanged" | "transformed"; }; //#endregion //#region src/migration-plan.d.ts interface MigrationPlanOptions { /** Glob pattern(s) for the files the codemod would transform. */ files: string | string[]; /** Glob pattern(s) of additional files to scan for consumers, or `null`. */ consumerPaths: string | string[] | null; /** Adapter for the transform (same adapter you would pass to `runTransform`). */ adapter: AdapterInput; /** jscodeshift parser to use. @default "tsx" */ parser?: "babel" | "babylon" | "flow" | "ts" | "tsx"; /** * Safety cap on fixpoint analysis passes used to reveal cascade-masked * blockers. Analysis throws if it doesn't stabilize within this many passes * (rather than returning a partial plan). @default 50 */ maxAnalysisPasses?: number; } interface ImportedExportUsage { /** Exported name consumers import (`"default"` for a default import, `"*"` for a namespace). */ exportName: string; /** Number of distinct files importing this export. */ consumerCount: number; } interface ManualConversionReason { /** The bail message explaining why the codemod cannot convert the file. */ message: string; /** Source locations where the unsupported pattern occurs. */ locations: Array<{ filePath: string; line: number; column: number; }>; } interface ManualConversionFile { /** Path of the file that must be converted by hand. */ filePath: string; /** 1-based position in the recommended bottom-up conversion order. */ order: number; /** Number of distinct files that import from this file. */ consumerCount: number; /** * Number of files that auto-convert once this file is converted, because this * file is their ONLY remaining blocker (single cascade blocker, no unsupported * patterns of their own). Converting this file is sufficient for these. */ soleBlockerFileCount: number; /** * Number of files that cascade-bail on this file (raw chain involvement). * Includes files that also have other blockers, so converting this file alone * does not necessarily unblock all of them. Always ≥ `soleBlockerFileCount`. */ blockedFileCount: number; /** Which exports consumers import, so you know what to convert first. */ importedExports: ImportedExportUsage[]; /** Why the codemod cannot convert this file automatically. */ reasons: ManualConversionReason[]; /** Other files in this plan that this file imports (must be converted first). */ dependsOn: string[]; } interface MigrationPlan { /** Files to convert by hand, ordered by unblock impact (dependencies first). */ manualConversionFiles: ManualConversionFile[]; /** Total number of files matched by the `files` glob. */ totalFiles: number; /** * Number of distinct files that auto-convert once ALL listed files are * converted (cascade-blocked files that have no unsupported patterns of their * own). This is the whole-plan payoff, not attributable to any single file. */ unlocksFileCount: number; } /** * Run the codemod in analysis-only (dry) mode and compute the ordered list of * files that block the rest of the migration and must be converted manually. */ declare function analyzeMigrationPlan(options: MigrationPlanOptions): Promise; /** Render a {@link MigrationPlan} as a human-readable, actionable report. */ declare function formatMigrationPlan(plan: MigrationPlan): string; //#endregion export { type AdapterInput, type ImportSource, type ImportedExportUsage, type ManualConversionFile, type ManualConversionReason, type MarkerFileContext, type MigrationPlan, type MigrationPlanOptions, analyzeMigrationPlan, defineAdapter, formatMigrationPlan, runTransform };