@schemashift/zod-v3-v4 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -304,6 +304,7 @@ var ZodV3ToV4Transformer = class {
304
304
  this.transformDefAccess(sourceFile);
305
305
  this.transformFunctionValidation(sourceFile);
306
306
  this.transformOptionalShorthands(sourceFile);
307
+ this.transformPreprocess(sourceFile);
307
308
  this.checkDeprecatedMethods(sourceFile);
308
309
  this.checkDeprecatedFactories(sourceFile);
309
310
  this.checkStringFormatMethods(sourceFile);
@@ -1024,21 +1025,30 @@ var ZodV3ToV4Transformer = class {
1024
1025
  });
1025
1026
  }
1026
1027
  /**
1027
- * Check for .strip() which is deprecated in v4 (it was the default behavior).
1028
+ * Auto-remove .strip() which is deprecated in v4 (it was the default behavior).
1028
1029
  */
1029
1030
  checkStripDeprecation(sourceFile) {
1030
1031
  const filePath = sourceFile.getFilePath();
1032
+ const nodesToTransform = [];
1031
1033
  sourceFile.forEachDescendant((node) => {
1032
1034
  if (import_ts_morph.Node.isCallExpression(node)) {
1033
1035
  const expression = node.getExpression();
1034
1036
  if (import_ts_morph.Node.isPropertyAccessExpression(expression) && expression.getName() === "strip") {
1035
- const lineNumber = node.getStartLineNumber();
1036
- this.warnings.push(
1037
- `${filePath}:${lineNumber}: .strip() is deprecated in v4 (it was the default behavior). Remove .strip() \u2014 z.object() strips unknown keys by default. To convert a strict object back to stripping, use z.object(schema.shape).`
1038
- );
1037
+ nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });
1039
1038
  }
1040
1039
  }
1041
1040
  });
1041
+ nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());
1042
+ for (const { node, lineNumber } of nodesToTransform) {
1043
+ const expression = node.getExpression();
1044
+ if (import_ts_morph.Node.isPropertyAccessExpression(expression)) {
1045
+ const objectText = expression.getExpression().getText();
1046
+ node.replaceWithText(objectText);
1047
+ this.warnings.push(
1048
+ `${filePath}:${lineNumber}: .strip() auto-removed \u2014 it is the default behavior in v4.`
1049
+ );
1050
+ }
1051
+ }
1042
1052
  }
1043
1053
  /**
1044
1054
  * Check for errorMap usage patterns where precedence changed in v4.
@@ -1055,6 +1065,39 @@ var ZodV3ToV4Transformer = class {
1055
1065
  );
1056
1066
  }
1057
1067
  }
1068
+ /**
1069
+ * Auto-transform z.preprocess(fn, schema) to z.pipe(z.unknown(), z.transform(fn), schema).
1070
+ */
1071
+ transformPreprocess(sourceFile) {
1072
+ const filePath = sourceFile.getFilePath();
1073
+ const nodesToTransform = [];
1074
+ sourceFile.forEachDescendant((node) => {
1075
+ if (import_ts_morph.Node.isCallExpression(node)) {
1076
+ const expression = node.getExpression();
1077
+ if (import_ts_morph.Node.isPropertyAccessExpression(expression)) {
1078
+ const name = expression.getName();
1079
+ const object = expression.getExpression();
1080
+ if (name === "preprocess" && object.getText() === "z") {
1081
+ nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });
1082
+ }
1083
+ }
1084
+ }
1085
+ });
1086
+ nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());
1087
+ for (const { node, lineNumber } of nodesToTransform) {
1088
+ const args = node.getArguments();
1089
+ if (args.length === 2) {
1090
+ const fn = args[0]?.getText();
1091
+ const schema = args[1]?.getText();
1092
+ if (fn && schema) {
1093
+ node.replaceWithText(`z.pipe(z.unknown(), z.transform(${fn}), ${schema})`);
1094
+ this.warnings.push(
1095
+ `${filePath}:${lineNumber}: z.preprocess() auto-transformed to z.pipe(). Removed in v4 \u2014 use z.pipe() with z.transform() instead.`
1096
+ );
1097
+ }
1098
+ }
1099
+ }
1100
+ }
1058
1101
  /**
1059
1102
  * Check for ctx.addIssue() / ctx.addIssues() which are deprecated in v4.
1060
1103
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/behavior-test-generator.ts","../src/transformer.ts","../src/mappings.ts","../src/handler.ts"],"sourcesContent":["export {\n type BehavioralPattern,\n type BehaviorTestResult,\n type DetectedPattern,\n detectBehavioralPatterns,\n type GeneratedBehaviorTest,\n generateBehaviorTests,\n} from './behavior-test-generator.js';\nexport { createZodV3ToV4Handler } from './handler.js';\nexport { BEHAVIOR_CHANGES, V3_TO_V4_PATTERNS } from './mappings.js';\nexport { ZodV3ToV4Transformer } from './transformer.js';\n","/**\n * Zod v4 Behavioral Test Generator\n *\n * Detects silent behavioral changes between Zod v3 and v4 and generates\n * regression tests to catch them.\n */\n\nexport interface BehavioralPattern {\n name: string;\n description: string;\n regex: RegExp;\n testTemplate: string;\n}\n\nexport interface DetectedPattern {\n pattern: BehavioralPattern;\n filePath: string;\n lineNumber: number;\n matchedText: string;\n}\n\nexport interface GeneratedBehaviorTest {\n filePath: string;\n testCode: string;\n patterns: string[];\n}\n\nexport interface BehaviorTestResult {\n tests: GeneratedBehaviorTest[];\n totalPatterns: number;\n}\n\nconst V4_BEHAVIORAL_PATTERNS: BehavioralPattern[] = [\n {\n name: 'default-optional',\n description: '.default() + .optional() behaves differently in v4',\n regex:\n /\\.default\\([^)]*\\)[\\s\\S]{0,20}\\.optional\\(\\)|\\.optional\\(\\)[\\s\\S]{0,20}\\.default\\([^)]*\\)/,\n testTemplate: [\n \" it('verifies .default() + .optional() behavior (v4 change)', () => {\",\n ' // v3: undefined input returns undefined (.optional() wins)',\n ' // v4: undefined input returns default value (.default() always applies)',\n \" const schema = z.string().default('fallback').optional();\",\n ' const result = schema.parse(undefined);',\n \" expect(result).toBe('fallback');\",\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-instanceof',\n description: 'ZodError no longer extends Error in v4',\n regex: /instanceof\\s+Error|instanceof\\s+ZodError/,\n testTemplate: [\n \" it('verifies ZodError instanceof check (v4 change)', () => {\",\n ' // v3: ZodError extends Error',\n ' // v4: ZodError does NOT extend Error',\n ' try {',\n ' z.string().parse(123);',\n ' } catch (e) {',\n ' expect(e).toBeDefined();',\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'transform-after-refine',\n description: '.transform() after .refine() may change execution order in v4',\n regex: /\\.refine\\([^)]*\\)[\\s\\S]{0,30}\\.transform\\(/,\n testTemplate: [\n \" it('verifies .refine() then .transform() ordering (v4 change)', () => {\",\n ' const schema = z.string()',\n \" .refine((val) => val.length > 0, 'Must not be empty')\",\n ' .transform((val) => val.toUpperCase());',\n \" const result = schema.safeParse('hello');\",\n ' expect(result.success).toBe(true);',\n ' if (result.success) {',\n \" expect(result.data).toBe('HELLO');\",\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'catch-optional',\n description: '.catch() + .optional() interaction changed in v4',\n regex: /\\.catch\\([^)]*\\)[\\s\\S]{0,20}\\.optional\\(\\)|\\.optional\\(\\)[\\s\\S]{0,20}\\.catch\\([^)]*\\)/,\n testTemplate: [\n \" it('verifies .catch() + .optional() behavior (v4 change)', () => {\",\n \" const schema = z.string().catch('default').optional();\",\n ' const result = schema.parse(undefined);',\n ' expect(result).toBeDefined();',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-message-format',\n description: 'Error messages changed from \"Required\" to descriptive messages',\n regex: /['\"]Required['\"]/,\n testTemplate: [\n \" it('verifies error message format (v4 change)', () => {\",\n ' // v3: \"Required\" for missing fields',\n ' // v4: \"Invalid input: expected string, received undefined\"',\n ' const schema = z.object({ name: z.string() });',\n ' const result = schema.safeParse({});',\n ' expect(result.success).toBe(false);',\n ' if (!result.success) {',\n \" const msg = result.error.issues[0]?.message ?? '';\",\n ' expect(msg.length).toBeGreaterThan(0);',\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-flatten',\n description: 'error.flatten() moved to z.flattenError(error) in v4',\n regex: /\\.flatten\\(\\)/,\n testTemplate: [\n \" it('verifies error flattening (v4 change)', () => {\",\n ' // v3: error.flatten()',\n ' // v4: z.flattenError(error)',\n ' const schema = z.object({ name: z.string() });',\n ' const result = schema.safeParse({});',\n ' if (!result.success) {',\n ' expect(result.error).toBeDefined();',\n ' }',\n ' });',\n ].join('\\n'),\n },\n];\n\n/**\n * Detect v4 behavioral patterns in source code.\n */\nexport function detectBehavioralPatterns(sourceCode: string, filePath: string): DetectedPattern[] {\n const results: DetectedPattern[] = [];\n const lines = sourceCode.split('\\n');\n\n for (const pattern of V4_BEHAVIORAL_PATTERNS) {\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? '';\n if (pattern.regex.test(line)) {\n results.push({\n pattern,\n filePath,\n lineNumber: i + 1,\n matchedText: line.trim(),\n });\n }\n }\n\n // Multi-line match fallback\n if (\n pattern.regex.test(sourceCode) &&\n !results.some((r) => r.pattern.name === pattern.name && r.filePath === filePath)\n ) {\n const match = pattern.regex.exec(sourceCode);\n if (match) {\n const lineNumber = sourceCode.slice(0, match.index).split('\\n').length;\n results.push({\n pattern,\n filePath,\n lineNumber,\n matchedText: match[0].trim().slice(0, 80),\n });\n }\n }\n }\n\n return results;\n}\n\n/**\n * Generate behavioral regression tests for detected patterns.\n */\nexport function generateBehaviorTests(\n files: Array<{ filePath: string; sourceCode: string }>,\n): BehaviorTestResult {\n const allPatterns: DetectedPattern[] = [];\n const testsByFile = new Map<string, Set<string>>();\n\n for (const { filePath, sourceCode } of files) {\n const detected = detectBehavioralPatterns(sourceCode, filePath);\n allPatterns.push(...detected);\n\n for (const d of detected) {\n const existing = testsByFile.get(filePath) ?? new Set();\n existing.add(d.pattern.name);\n testsByFile.set(filePath, existing);\n }\n }\n\n const tests: GeneratedBehaviorTest[] = [];\n\n for (const [filePath, patternNames] of testsByFile) {\n const patterns = [...patternNames];\n const testBlocks = patterns\n .map((name) => V4_BEHAVIORAL_PATTERNS.find((p) => p.name === name)?.testTemplate ?? '')\n .filter(Boolean);\n\n if (testBlocks.length === 0) continue;\n\n const shortPath = filePath.split('/').slice(-2).join('/');\n const testCode = [\n \"import { describe, expect, it } from 'vitest';\",\n \"import { z } from 'zod';\",\n '',\n '/**',\n ' * Behavioral regression tests for Zod v3 to v4 migration',\n ` * Source: ${shortPath}`,\n ' * Generated by SchemaShift',\n ' */',\n `describe('v4 behavioral changes: ${shortPath}', () => {`,\n ...testBlocks.map((b) => b),\n '});',\n ].join('\\n');\n\n tests.push({ filePath, testCode, patterns });\n }\n\n return { tests, totalPatterns: allPatterns.length };\n}\n","import type { TransformError, TransformResult } from '@schemashift/core';\nimport { Node, type SourceFile } from 'ts-morph';\nimport {\n AUTO_TRANSFORMABLE,\n BEHAVIOR_CHANGES,\n DEPRECATED_FACTORIES,\n DEPRECATED_METHODS,\n STRING_FORMAT_TO_TOPLEVEL,\n UTILITY_TYPES,\n} from './mappings.js';\n\n/**\n * Zod v3 to v4 Transformer\n *\n * Handles breaking changes between Zod v3 and v4:\n * - z.record() now requires explicit key type\n * - error.errors -> error.issues\n * - Stricter UUID validation\n * - Type inference changes in .default()\n * - .flatten() removed\n * - z.preprocess() -> z.pipe() migration\n */\nexport class ZodV3ToV4Transformer {\n private errors: TransformError[] = [];\n private warnings: string[] = [];\n\n transform(sourceFile: SourceFile): TransformResult {\n this.errors = [];\n this.warnings = [];\n\n const filePath = sourceFile.getFilePath();\n const originalCode = sourceFile.getFullText();\n\n try {\n this.transformRecordCalls(sourceFile);\n this.transformMerge(sourceFile);\n this.transformNativeEnum(sourceFile);\n this.transformSuperRefine(sourceFile);\n this.transformErrorProperties(sourceFile);\n this.transformErrorParams(sourceFile);\n this.transformFlatten(sourceFile);\n this.transformFormat(sourceFile);\n this.transformDefAccess(sourceFile);\n this.transformFunctionValidation(sourceFile);\n this.transformOptionalShorthands(sourceFile);\n this.checkDeprecatedMethods(sourceFile);\n this.checkDeprecatedFactories(sourceFile);\n this.checkStringFormatMethods(sourceFile);\n this.checkBehaviorChanges(sourceFile);\n this.checkInstanceofError(sourceFile);\n this.checkTransformRefineOrder(sourceFile);\n this.checkDefaultOptional(sourceFile);\n this.checkCatchOptional(sourceFile);\n this.checkUtilityTypeImports(sourceFile);\n this.checkNonemptyTypeChange(sourceFile);\n this.checkCoerceInputType(sourceFile);\n this.checkDeepPartialRemoval(sourceFile);\n this.checkStripDeprecation(sourceFile);\n this.checkErrorMapPrecedence(sourceFile);\n this.checkAddIssueMethods(sourceFile);\n\n return {\n success: this.errors.length === 0,\n filePath,\n originalCode,\n transformedCode: sourceFile.getFullText(),\n errors: this.errors,\n warnings: this.warnings,\n };\n } catch (error) {\n this.errors.push({\n message: error instanceof Error ? error.message : 'Unknown error',\n });\n return {\n success: false,\n filePath,\n originalCode,\n errors: this.errors,\n warnings: this.warnings,\n };\n }\n }\n\n /**\n * Transform z.record(valueSchema) to z.record(z.string(), valueSchema)\n */\n private transformRecordCalls(sourceFile: SourceFile): void {\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n const object = expression.getExpression();\n\n if (name === 'record' && object.getText() === 'z') {\n const args = node.getArguments();\n\n // If only one argument, add z.string() as key type\n if (args.length === 1) {\n const valueSchema = args[0]?.getText();\n if (valueSchema) {\n node.replaceWithText(`z.record(z.string(), ${valueSchema})`);\n\n this.warnings.push(\n `${sourceFile.getFilePath()}:${node.getStartLineNumber()}: ` +\n 'z.record() updated to include explicit key type z.string()',\n );\n }\n }\n }\n }\n }\n });\n }\n\n /**\n * Build a set of variable names that are likely ZodError instances.\n * Used by transformErrorProperties, transformFlatten, and transformFormat.\n */\n private buildZodErrorVarSet(sourceFile: SourceFile): Set<string> {\n const zodErrorVars = new Set<string>();\n\n sourceFile.forEachDescendant((node) => {\n // Check variable declarations with ZodError type annotation\n if (Node.isVariableDeclaration(node)) {\n const typeNode = node.getTypeNode();\n if (typeNode?.getText().includes('ZodError')) {\n zodErrorVars.add(node.getName());\n }\n }\n\n // Check catch clause parameters\n if (Node.isCatchClause(node)) {\n const param = node.getVariableDeclaration();\n if (param) {\n const block = node.getBlock();\n const blockText = block.getText();\n if (blockText.includes('instanceof ZodError') || blockText.includes('ZodError')) {\n zodErrorVars.add(param.getName());\n }\n }\n }\n\n // Check for .safeParse() result — the error is in result.error\n if (Node.isVariableDeclaration(node)) {\n const initializer = node.getInitializer();\n if (initializer?.getText().includes('.safeParse(')) {\n zodErrorVars.add(`${node.getName()}.error`);\n }\n }\n\n // Check for new ZodError patterns\n if (Node.isNewExpression(node)) {\n if (node.getExpression().getText() === 'ZodError') {\n const parent = node.getParent();\n if (parent && Node.isVariableDeclaration(parent)) {\n zodErrorVars.add(parent.getName());\n }\n }\n }\n });\n\n return zodErrorVars;\n }\n\n /**\n * Transform error.errors to error.issues using AST-based detection\n * instead of heuristic name matching.\n */\n private transformErrorProperties(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n // Now transform .errors -> .issues only on identified ZodError variables\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node)) {\n const name = node.getName();\n if (name === 'errors') {\n const object = node.getExpression();\n const objectText = object.getText();\n\n // Check if this object is a known ZodError variable\n const isZodError =\n zodErrorVars.has(objectText) ||\n // Also check if accessing .error.errors (safeParse pattern)\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n const fullText = node.getText();\n const newText = fullText.replace(/\\.errors$/, '.issues');\n node.replaceWithText(newText);\n\n this.warnings.push(\n `${filePath}:${node.getStartLineNumber()}: ` +\n '.errors renamed to .issues (ZodError property change)',\n );\n }\n }\n }\n });\n }\n\n /**\n * Auto-transform error.flatten() to z.flattenError(error) in v4.\n */\n private transformFlatten(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n objectText: string;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'flatten') {\n const objectText = expression.getExpression().getText();\n const isZodError =\n zodErrorVars.has(objectText) ||\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n nodesToTransform.push({\n node,\n objectText,\n lineNumber: node.getStartLineNumber(),\n });\n } else {\n this.warnings.push(\n `${filePath}:${node.getStartLineNumber()}: .flatten() is removed in v4. ` +\n 'Use z.flattenError(error) or access error.issues directly. ' +\n 'See: https://zod.dev/v4/changelog',\n );\n }\n }\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, objectText, lineNumber } of nodesToTransform) {\n node.replaceWithText(`z.flattenError(${objectText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .flatten() auto-transformed to z.flattenError(). ` +\n 'Removed in v4 — now a standalone function.',\n );\n }\n }\n\n /**\n * Auto-transform error.format() to z.treeifyError(error) in v4.\n */\n private transformFormat(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n objectText: string;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'format') {\n const objectText = expression.getExpression().getText();\n const isZodError =\n zodErrorVars.has(objectText) ||\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n nodesToTransform.push({\n node,\n objectText,\n lineNumber: node.getStartLineNumber(),\n });\n }\n // Skip non-ZodError .format() calls to avoid false positives\n }\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, objectText, lineNumber } of nodesToTransform) {\n node.replaceWithText(`z.treeifyError(${objectText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .format() auto-transformed to z.treeifyError(). ` +\n 'Removed in v4 — now a standalone function.',\n );\n }\n }\n\n /**\n * Auto-transform ._def property access to ._zod.def in v4.\n */\n private transformDefAccess(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').PropertyAccessExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node) && node.getName() === '_def') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const objectText = node.getExpression().getText();\n node.replaceWithText(`${objectText}._zod.def`);\n this.warnings.push(\n `${filePath}:${lineNumber}: ._def auto-transformed to ._zod.def. ` +\n 'Internal API — structure may change between releases.',\n );\n }\n }\n\n /**\n * Transform .merge(otherSchema) to .extend(otherSchema.shape)\n */\n private transformMerge(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{ node: import('ts-morph').CallExpression; lineNumber: number }> =\n [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'merge') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n });\n\n // Process in reverse order\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const args = node.getArguments();\n if (args.length === 1) {\n const argText = args[0]?.getText();\n if (argText) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const objectText = expression.getExpression().getText();\n node.replaceWithText(`${objectText}.extend(${argText}.shape)`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .merge() renamed to .extend() with .shape access. ` +\n 'Verify the merged schema exposes .shape.',\n );\n }\n }\n }\n }\n }\n\n /**\n * Transform z.nativeEnum(X) to z.enum(X)\n */\n private transformNativeEnum(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n const newText = fullText.replace(/\\bz\\.nativeEnum\\(/g, 'z.enum(');\n if (newText !== fullText) {\n sourceFile.replaceWithText(newText);\n this.warnings.push(\n `${filePath}: z.nativeEnum() renamed to z.enum() in v4. ` +\n 'Verify enum values are compatible.',\n );\n }\n }\n\n /**\n * Check for deprecated methods and add warnings\n */\n private checkDeprecatedMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (DEPRECATED_METHODS.has(name) && !AUTO_TRANSFORMABLE.has(name)) {\n const lineNumber = node.getStartLineNumber();\n switch (name) {\n case 'strict':\n this.warnings.push(\n `${filePath}:${lineNumber}: .strict() is deprecated in v4. ` +\n 'Use z.strictObject() instead.',\n );\n break;\n case 'passthrough':\n this.warnings.push(\n `${filePath}:${lineNumber}: .passthrough() is deprecated in v4. ` +\n 'Use z.looseObject() instead.',\n );\n break;\n // merge is handled by transformMerge\n }\n }\n }\n }\n });\n }\n\n /**\n * Auto-transform .superRefine() to .check() — callback signature is identical.\n */\n private transformSuperRefine(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').PropertyAccessExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node) && node.getName() === 'superRefine') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n });\n\n // Process in reverse to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const parent = node.getParent();\n if (parent && Node.isCallExpression(parent)) {\n const objectText = node.getExpression().getText();\n const args = parent.getArguments();\n let argsText = args.map((a) => a.getText()).join(', ');\n\n // Also transform ctx.addIssue() -> ctx.issues.push() inside the callback\n if (args.length > 0) {\n const callbackText = args[0]?.getText() ?? '';\n // Detect the context parameter name (2nd param in arrow/function)\n const paramMatch = callbackText.match(\n /^\\s*\\(?\\s*\\w+\\s*,\\s*(\\w+)\\s*\\)?(?:\\s*:\\s*[^)]+)?\\s*=>/,\n );\n if (paramMatch?.[1]) {\n const ctxName = paramMatch[1];\n const addIssuePattern = new RegExp(`${ctxName}\\\\.addIssue\\\\(`, 'g');\n if (addIssuePattern.test(callbackText)) {\n argsText = callbackText.replace(\n new RegExp(`${ctxName}\\\\.addIssue\\\\(`, 'g'),\n `${ctxName}.issues.push(`,\n );\n // Re-add remaining args if any\n if (args.length > 1) {\n const remaining = args\n .slice(1)\n .map((a) => a.getText())\n .join(', ');\n argsText = `${argsText}, ${remaining}`;\n }\n }\n }\n }\n\n parent.replaceWithText(`${objectText}.check(${argsText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .superRefine() auto-transformed to .check() (deprecated in v4).`,\n );\n }\n }\n }\n\n /**\n * Auto-transform invalid_type_error/required_error params to unified `error` param.\n */\n private transformErrorParams(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').ObjectLiteralExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isObjectLiteralExpression(node)) {\n const properties = node.getProperties();\n const propNames = properties\n .filter((p) => Node.isPropertyAssignment(p))\n .map((p) => (Node.isPropertyAssignment(p) ? p.getName() : ''));\n\n const hasInvalidType = propNames.includes('invalid_type_error');\n const hasRequired = propNames.includes('required_error');\n\n if (hasInvalidType || hasRequired) {\n // Only transform if this is an argument to a z.xxx() factory call\n const parent = node.getParent();\n if (parent && Node.isCallExpression(parent)) {\n const expr = parent.getExpression();\n if (Node.isPropertyAccessExpression(expr) && expr.getExpression().getText() === 'z') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n }\n }\n });\n\n // Process in reverse to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const properties = node.getProperties();\n let invalidTypeValue: string | undefined;\n let requiredValue: string | undefined;\n const otherProps: string[] = [];\n\n for (const prop of properties) {\n if (Node.isPropertyAssignment(prop)) {\n const name = prop.getName();\n const value = prop.getInitializer()?.getText() ?? '';\n if (name === 'invalid_type_error') {\n invalidTypeValue = value;\n } else if (name === 'required_error') {\n requiredValue = value;\n } else {\n otherProps.push(prop.getText());\n }\n }\n }\n\n let errorValue: string;\n if (invalidTypeValue && requiredValue) {\n // Both present: generate error function\n errorValue = `error: (issue) => issue.input === undefined ? ${requiredValue} : ${invalidTypeValue}`;\n } else if (requiredValue) {\n errorValue = `error: ${requiredValue}`;\n } else if (invalidTypeValue) {\n errorValue = `error: ${invalidTypeValue}`;\n } else {\n continue;\n }\n\n const allProps = [errorValue, ...otherProps].join(', ');\n node.replaceWithText(`{ ${allProps} }`);\n\n this.warnings.push(\n `${filePath}:${lineNumber}: invalid_type_error/required_error auto-transformed to unified error param.`,\n );\n }\n }\n\n /**\n * Detect instanceof Error patterns in catch blocks that reference ZodError.\n * In v4, ZodError no longer extends Error.\n */\n private checkInstanceofError(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCatchClause(node)) {\n const block = node.getBlock();\n const blockText = block.getText();\n\n // Check if the catch block references ZodError AND uses instanceof Error\n if (blockText.includes('ZodError') && blockText.includes('instanceof Error')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: ZodError no longer extends Error in v4. ` +\n '`instanceof Error` checks on ZodError will return false. ' +\n 'Use `instanceof ZodError` or check for `.issues` property instead.',\n );\n }\n }\n });\n }\n\n /**\n * Detect .refine()/.superRefine() followed by .transform() in the same chain.\n * In v4, .transform() runs even when .refine() fails.\n */\n private checkTransformRefineOrder(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'transform') {\n // Walk up the chain to see if .refine() or .superRefine() precedes\n const chainText = node.getText();\n if (\n chainText.includes('.refine(') ||\n chainText.includes('.superRefine(') ||\n chainText.includes('.check(')\n ) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: In v4, .transform() executes even if preceding .refine() fails. ` +\n 'Consider using .pipe() to sequence validation before transforms.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Detect .default() combined with .optional() — behavior changed silently in v4.\n * In v4, .default() always provides a value, making .optional() a no-op.\n */\n private checkDefaultOptional(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (\n Node.isPropertyAccessExpression(expression) &&\n (expression.getName() === 'optional' || expression.getName() === 'default')\n ) {\n const chainText = node.getText();\n const hasDefault = chainText.includes('.default(');\n const hasOptional = chainText.includes('.optional(');\n\n if (hasDefault && hasOptional) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .default() + .optional() behavior changed in v4. ` +\n '.default() now always provides a value, making .optional() effectively a no-op. ' +\n 'Review whether .optional() is still needed.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Check for methods with behavior changes and add warnings\n */\n private checkBehaviorChanges(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n\n if (BEHAVIOR_CHANGES.has(name)) {\n const lineNumber = node.getStartLineNumber();\n\n switch (name) {\n case 'default':\n this.warnings.push(\n `${filePath}:${lineNumber}: .default() has stricter type inference in v4. ` +\n 'Verify default value matches schema type exactly.',\n );\n break;\n\n case 'uuid':\n this.warnings.push(\n `${filePath}:${lineNumber}: .uuid() now enforces strict RFC 4122 compliance. ` +\n 'Non-standard UUIDs may fail validation.',\n );\n break;\n\n case 'discriminatedUnion':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.discriminatedUnion() now requires ` +\n 'a literal type for the discriminator property.',\n );\n break;\n\n case 'function':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.function() parameter handling has changed. ` +\n 'Review input/output schema definitions.',\n );\n break;\n\n case 'pipe':\n this.warnings.push(\n `${filePath}:${lineNumber}: .pipe() has stricter type checking in v4. ` +\n 'If you get type errors, add explicit type annotations to .transform() return types ' +\n 'or cast through unknown as a last resort.',\n );\n break;\n }\n }\n }\n }\n });\n }\n\n /**\n * Detect .catch() combined with .optional() — behavior changed in v4.\n * In v4, .catch() on optional properties always returns the catch value.\n */\n private checkCatchOptional(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (\n Node.isPropertyAccessExpression(expression) &&\n (expression.getName() === 'optional' || expression.getName() === 'catch')\n ) {\n const chainText = node.getText();\n if (chainText.includes('.catch(') && chainText.includes('.optional(')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .catch() + .optional() behavior changed in v4. ` +\n '.catch() on optional properties now always returns the catch value, ' +\n 'even when the property is absent from input.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Detect imports of utility types that moved to 'zod/v4/core' in v4.\n */\n private checkUtilityTypeImports(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n for (const importDecl of sourceFile.getImportDeclarations()) {\n const moduleSpecifier = importDecl.getModuleSpecifierValue();\n if (moduleSpecifier !== 'zod') continue;\n\n const namedImports = importDecl.getNamedImports();\n for (const namedImport of namedImports) {\n const name = namedImport.getName();\n if (UTILITY_TYPES.has(name)) {\n const lineNumber = importDecl.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: '${name}' may need to be imported from 'zod/v4/core' in v4. ` +\n 'Internal utility types have moved to a separate subpackage.',\n );\n }\n }\n }\n }\n\n /**\n * Warn about string format methods that moved to top-level functions in v4.\n * e.g., z.string().email() → z.email() (instance methods are deprecated but still work)\n */\n private checkStringFormatMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (STRING_FORMAT_TO_TOPLEVEL.has(name)) {\n // Check if this is chained on z.string()\n const chainText = node.getText();\n if (chainText.includes('z.string()') || chainText.includes('.string()')) {\n const topLevel = STRING_FORMAT_TO_TOPLEVEL.get(name);\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .${name}() is deprecated as an instance method in v4. ` +\n `Use ${topLevel} as a top-level function instead. The instance method still works but may be removed in future versions.`,\n );\n }\n }\n }\n }\n });\n }\n\n /**\n * Check for deprecated factory functions (z.promise(), z.ostring(), etc.)\n */\n private checkDeprecatedFactories(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n const object = expression.getExpression();\n\n if (object.getText() === 'z' && DEPRECATED_FACTORIES.has(name)) {\n const lineNumber = node.getStartLineNumber();\n switch (name) {\n case 'promise':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.promise() is deprecated in v4. ` +\n 'Await values before parsing instead of wrapping in z.promise().',\n );\n break;\n case 'ostring':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.ostring() is removed in v4. ` +\n 'Use z.string().optional() instead.',\n );\n break;\n case 'onumber':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.onumber() is removed in v4. ` +\n 'Use z.number().optional() instead.',\n );\n break;\n case 'oboolean':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.oboolean() is removed in v4. ` +\n 'Use z.boolean().optional() instead.',\n );\n break;\n case 'preprocess':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.preprocess() is removed in v4. ` +\n 'Use z.pipe(z.unknown(), z.transform(fn), targetSchema) instead.',\n );\n break;\n }\n }\n }\n }\n });\n }\n\n /**\n * Transform z.function().args().returns() to z.function({ input, output }) in v4.\n */\n private transformFunctionValidation(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (name === 'args' || name === 'returns') {\n // Check if this is part of a z.function() chain\n const chainText = node.getText();\n if (\n chainText.includes('z.function()') &&\n (chainText.includes('.args(') || chainText.includes('.returns('))\n ) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: z.function().args().returns() is removed in v4. ` +\n 'Use z.function({ input: z.tuple([...]), output: schema }) instead. ' +\n 'The result is no longer a Zod schema — use .implement() to wrap functions.',\n );\n }\n }\n }\n }\n });\n }\n\n /**\n * Transform z.ostring(), z.onumber(), z.oboolean() to explicit .optional() calls.\n */\n private transformOptionalShorthands(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n const replacements: Array<{ pattern: RegExp; replacement: string; name: string }> = [\n { pattern: /\\bz\\.ostring\\(\\)/g, replacement: 'z.string().optional()', name: 'z.ostring()' },\n { pattern: /\\bz\\.onumber\\(\\)/g, replacement: 'z.number().optional()', name: 'z.onumber()' },\n {\n pattern: /\\bz\\.oboolean\\(\\)/g,\n replacement: 'z.boolean().optional()',\n name: 'z.oboolean()',\n },\n ];\n\n let newText = fullText;\n for (const { pattern, replacement, name } of replacements) {\n if (pattern.test(newText)) {\n newText = newText.replace(pattern, replacement);\n this.warnings.push(\n `${filePath}: ${name} auto-transformed to ${replacement}. Removed in v4.`,\n );\n }\n }\n\n if (newText !== fullText) {\n sourceFile.replaceWithText(newText);\n }\n }\n\n /**\n * Check for .nonempty() which has a type inference change in v4.\n * v3: [string, ...string[]] (tuple with rest)\n * v4: string[] (matches .min(1))\n */\n private checkNonemptyTypeChange(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'nonempty') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .nonempty() type inference changed in v4. ` +\n 'v3 inferred [T, ...T[]] (tuple with rest), v4 infers T[] (same as .min(1)). ' +\n 'If you rely on the tuple type, use z.tuple([z.string()], z.string()) instead.',\n );\n }\n }\n });\n }\n\n /**\n * Check for z.coerce.* usage — input type changed to unknown in v4.\n */\n private checkCoerceInputType(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n if (fullText.includes('z.coerce.')) {\n // Find line numbers for each occurrence\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node)) {\n const text = node.getText();\n if (text.startsWith('z.coerce.')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: z.coerce.* input type changed to 'unknown' in v4. ` +\n 'Previously, z.coerce.string() had input type string. ' +\n 'This enables more accurate type inference but may affect type guards.',\n );\n }\n }\n });\n }\n }\n\n /**\n * Check for .deepPartial() which was removed entirely in v4.\n */\n private checkDeepPartialRemoval(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'deepPartial') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .deepPartial() is removed in v4. ` +\n 'This was a long-deprecated anti-pattern. Use recursive partial types or ' +\n 'restructure schemas to avoid deep partial requirements.',\n );\n }\n }\n });\n }\n\n /**\n * Check for .strip() which is deprecated in v4 (it was the default behavior).\n */\n private checkStripDeprecation(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'strip') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .strip() is deprecated in v4 (it was the default behavior). ` +\n 'Remove .strip() — z.object() strips unknown keys by default. ' +\n 'To convert a strict object back to stripping, use z.object(schema.shape).',\n );\n }\n }\n });\n }\n\n /**\n * Check for errorMap usage patterns where precedence changed in v4.\n * In v4, schema-level error maps take precedence over parse-time error maps (inverted from v3).\n */\n private checkErrorMapPrecedence(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n // Check if file uses both schema-level and parse-time error maps\n const hasSchemaErrorMap = fullText.includes('errorMap:') || fullText.includes('error:');\n const hasParseErrorMap =\n (fullText.includes('.parse(') && fullText.includes('errorMap')) ||\n (fullText.includes('.safeParse(') && fullText.includes('errorMap'));\n\n if (hasSchemaErrorMap && hasParseErrorMap) {\n this.warnings.push(\n `${filePath}: Error map precedence changed in v4. ` +\n 'Schema-level error maps now take precedence over parse-time error maps (inverted from v3). ' +\n 'Review error map usage to ensure correct error messages.',\n );\n }\n }\n\n /**\n * Check for ctx.addIssue() / ctx.addIssues() which are deprecated in v4.\n */\n private checkAddIssueMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n if (fullText.includes('.addIssue(') || fullText.includes('.addIssues(')) {\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (name === 'addIssue' || name === 'addIssues') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .${name}() is deprecated in v4. ` +\n 'Directly manipulate the issues array instead: ctx.issues.push({...}). ' +\n 'Note: .superRefine() callbacks using addIssue should migrate to .check() with issues.push().',\n );\n }\n }\n }\n });\n }\n }\n}\n","/**\n * Zod v3 to v4 Breaking Changes\n *\n * Key changes in Zod v4:\n * 1. z.record() now requires explicit key type\n * 2. .default() has stricter type inference (matches output type, not input)\n * 3. error.errors renamed to error.issues\n * 4. .uuid() has stricter validation (RFC 9562/4122 compliant)\n * 5. z.function() completely overhauled — .args()/.returns() removed\n * 6. Branded types use different syntax\n * 7. z.discriminatedUnion() requires literal discriminator\n * 8. String format methods moved to top-level (e.g., .email() → z.email())\n * 9. .deepPartial() removed (was deprecated anti-pattern)\n * 10. z.promise() deprecated (await values before parsing)\n * 11. .strip() deprecated (default behavior)\n * 12. .nonempty() type inference changed (no longer tuple type)\n * 13. z.coerce.* input type changed to unknown\n * 14. z.partialRecord() added for optional key behavior\n * 15. z.guid() added for lenient UUID matching\n * 16. z.iso.* validators for date/time/datetime/duration\n * 17. .prefault() added (restores v3 .default() parse behavior)\n * 18. .addIssue()/.addIssues() deprecated in favor of issues.push()\n * 19. ZodError precedence reversal: schema-level error maps override parse-time\n * 20. z.ostring()/z.onumber() etc. removed (optional shorthands)\n */\n\n// Patterns that need transformation\nexport const V3_TO_V4_PATTERNS = {\n // z.record(valueSchema) -> z.record(z.string(), valueSchema)\n recordSingleArg: /z\\.record\\((?!z\\.string\\(\\)|z\\.number\\(\\)|z\\.symbol\\(\\))/g,\n\n // error.errors -> error.issues\n errorErrors: /\\.errors\\b/g,\n\n // .brand<T>() -> .brand<T>() (same but check for proper usage)\n brandUsage: /\\.brand<([^>]+)>\\(\\)/g,\n};\n\n// Methods that have changed behavior\nexport const BEHAVIOR_CHANGES = new Set([\n 'default', // Type inference changed; now matches output type, use .prefault() for v3 behavior\n 'uuid', // Stricter RFC 9562/4122 validation; use z.guid() for lenient matching\n 'record', // Requires key type\n 'discriminatedUnion', // Stricter discriminator requirements\n 'function', // Complete overhaul — .args()/.returns() removed\n 'pipe', // Stricter type checking in v4\n 'catch', // .catch() on optional properties always returns catch value in v4\n 'nonempty', // Type inference changed: string[] instead of [string, ...string[]]\n 'coerce', // Input type changed to unknown for all z.coerce.* schemas\n]);\n\n// Error property renames\nexport const ERROR_RENAMES: Record<string, string> = {\n errors: 'issues',\n formErrors: 'formErrors', // Unchanged\n fieldErrors: 'fieldErrors', // Unchanged\n};\n\n// Methods that are deprecated in v4\nexport const DEPRECATED_METHODS = new Set([\n 'merge', // Use .extend() instead\n 'superRefine', // Use .check() instead\n 'strict', // Use z.strictObject() instead\n 'passthrough', // Use z.looseObject() instead\n 'deepPartial', // Removed entirely — was deprecated anti-pattern\n 'strip', // Deprecated — default behavior in v4\n 'nonstrict', // Removed entirely\n]);\n\n// Factory functions deprecated/removed in v4\nexport const DEPRECATED_FACTORIES = new Set([\n 'promise', // z.promise() deprecated — await values before parsing\n 'ostring', // z.ostring() removed (optional shorthand)\n 'onumber', // z.onumber() removed\n 'oboolean', // z.oboolean() removed\n 'preprocess', // z.preprocess() removed — use z.pipe() instead\n]);\n\n// Method renames in v4\nexport const METHOD_RENAMES: Record<string, string> = {\n merge: 'extend',\n};\n\n// Factory function renames in v4\nexport const FACTORY_RENAMES: Record<string, string> = {\n nativeEnum: 'enum',\n};\n\n// Error params that changed in v4 (unified under `error`)\nexport const ERROR_PARAM_NAMES = new Set(['invalid_type_error', 'required_error']);\n\n// Methods that can be automatically transformed (renamed) in v4\nexport const AUTO_TRANSFORMABLE = new Set([\n 'superRefine', // -> .check()\n 'flatten', // error.flatten() -> z.flattenError(error)\n 'format', // error.format() -> z.treeifyError(error)\n]);\n\n// Utility types that moved to 'zod/v4/core' in v4\nexport const UTILITY_TYPES = new Set([\n 'ZodType',\n 'ZodSchema',\n 'ZodRawShape',\n 'ZodTypeAny',\n 'ZodFirstPartyTypeKind',\n]);\n\n// String format methods that moved from instance methods to top-level functions\nexport const STRING_FORMAT_TO_TOPLEVEL = new Map<string, string>([\n ['email', 'z.email()'],\n ['url', 'z.url()'],\n ['uuid', 'z.uuid()'],\n ['emoji', 'z.emoji()'],\n ['nanoid', 'z.nanoid()'],\n ['cuid', 'z.cuid()'],\n ['cuid2', 'z.cuid2()'],\n ['ulid', 'z.ulid()'],\n ['ipv4', 'z.ipv4()'],\n ['ipv6', 'z.ipv6()'],\n ['cidrv4', 'z.cidrv4()'],\n ['cidrv6', 'z.cidrv6()'],\n ['base64', 'z.base64()'],\n ['base64url', 'z.base64url()'],\n]);\n\n// New ISO validators in v4 (informational — no transform needed, just awareness)\nexport const NEW_ISO_VALIDATORS = new Set([\n 'z.iso.date()',\n 'z.iso.time()',\n 'z.iso.datetime()',\n 'z.iso.duration()',\n]);\n\n// Runtime behavior patterns that silently break in v4 (no compile-time error)\nexport const RUNTIME_BREAK_PATTERNS = new Set([\n 'instanceofError', // ZodError no longer extends Error\n 'transformAfterRefine', // .transform() runs even when .refine() fails\n 'defaultOptional', // .default() + .optional() behavior change\n 'errorMapPrecedence', // Schema-level error maps now override parse-time\n 'nonemptyType', // .nonempty() returns string[] instead of [string, ...string[]]\n 'coerceInputType', // z.coerce.* input is now unknown instead of specific type\n]);\n","import type { TransformHandler, TransformOptions, TransformResult } from '@schemashift/core';\nimport type { SourceFile } from 'ts-morph';\nimport { ZodV3ToV4Transformer } from './transformer.js';\n\nexport function createZodV3ToV4Handler(): TransformHandler {\n const transformer = new ZodV3ToV4Transformer();\n return {\n transform(sourceFile: SourceFile, _options: TransformOptions): TransformResult {\n return transformer.transform(sourceFile);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;A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A,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AE3gCO,SAAS,yBAA2C;AACzD,QAAM,cAAc,IAAI,qBAAqB;AAC7C,SAAO;AAAA,IACL,UAAU,YAAwB,UAA6C;AAC7E,aAAO,YAAY,UAAU,UAAU;AAAA,IACzC;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/behavior-test-generator.ts","../src/transformer.ts","../src/mappings.ts","../src/handler.ts"],"sourcesContent":["export {\n type BehavioralPattern,\n type BehaviorTestResult,\n type DetectedPattern,\n detectBehavioralPatterns,\n type GeneratedBehaviorTest,\n generateBehaviorTests,\n} from './behavior-test-generator.js';\nexport { createZodV3ToV4Handler } from './handler.js';\nexport { BEHAVIOR_CHANGES, V3_TO_V4_PATTERNS } from './mappings.js';\nexport { ZodV3ToV4Transformer } from './transformer.js';\n","/**\n * Zod v4 Behavioral Test Generator\n *\n * Detects silent behavioral changes between Zod v3 and v4 and generates\n * regression tests to catch them.\n */\n\nexport interface BehavioralPattern {\n name: string;\n description: string;\n regex: RegExp;\n testTemplate: string;\n}\n\nexport interface DetectedPattern {\n pattern: BehavioralPattern;\n filePath: string;\n lineNumber: number;\n matchedText: string;\n}\n\nexport interface GeneratedBehaviorTest {\n filePath: string;\n testCode: string;\n patterns: string[];\n}\n\nexport interface BehaviorTestResult {\n tests: GeneratedBehaviorTest[];\n totalPatterns: number;\n}\n\nconst V4_BEHAVIORAL_PATTERNS: BehavioralPattern[] = [\n {\n name: 'default-optional',\n description: '.default() + .optional() behaves differently in v4',\n regex:\n /\\.default\\([^)]*\\)[\\s\\S]{0,20}\\.optional\\(\\)|\\.optional\\(\\)[\\s\\S]{0,20}\\.default\\([^)]*\\)/,\n testTemplate: [\n \" it('verifies .default() + .optional() behavior (v4 change)', () => {\",\n ' // v3: undefined input returns undefined (.optional() wins)',\n ' // v4: undefined input returns default value (.default() always applies)',\n \" const schema = z.string().default('fallback').optional();\",\n ' const result = schema.parse(undefined);',\n \" expect(result).toBe('fallback');\",\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-instanceof',\n description: 'ZodError no longer extends Error in v4',\n regex: /instanceof\\s+Error|instanceof\\s+ZodError/,\n testTemplate: [\n \" it('verifies ZodError instanceof check (v4 change)', () => {\",\n ' // v3: ZodError extends Error',\n ' // v4: ZodError does NOT extend Error',\n ' try {',\n ' z.string().parse(123);',\n ' } catch (e) {',\n ' expect(e).toBeDefined();',\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'transform-after-refine',\n description: '.transform() after .refine() may change execution order in v4',\n regex: /\\.refine\\([^)]*\\)[\\s\\S]{0,30}\\.transform\\(/,\n testTemplate: [\n \" it('verifies .refine() then .transform() ordering (v4 change)', () => {\",\n ' const schema = z.string()',\n \" .refine((val) => val.length > 0, 'Must not be empty')\",\n ' .transform((val) => val.toUpperCase());',\n \" const result = schema.safeParse('hello');\",\n ' expect(result.success).toBe(true);',\n ' if (result.success) {',\n \" expect(result.data).toBe('HELLO');\",\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'catch-optional',\n description: '.catch() + .optional() interaction changed in v4',\n regex: /\\.catch\\([^)]*\\)[\\s\\S]{0,20}\\.optional\\(\\)|\\.optional\\(\\)[\\s\\S]{0,20}\\.catch\\([^)]*\\)/,\n testTemplate: [\n \" it('verifies .catch() + .optional() behavior (v4 change)', () => {\",\n \" const schema = z.string().catch('default').optional();\",\n ' const result = schema.parse(undefined);',\n ' expect(result).toBeDefined();',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-message-format',\n description: 'Error messages changed from \"Required\" to descriptive messages',\n regex: /['\"]Required['\"]/,\n testTemplate: [\n \" it('verifies error message format (v4 change)', () => {\",\n ' // v3: \"Required\" for missing fields',\n ' // v4: \"Invalid input: expected string, received undefined\"',\n ' const schema = z.object({ name: z.string() });',\n ' const result = schema.safeParse({});',\n ' expect(result.success).toBe(false);',\n ' if (!result.success) {',\n \" const msg = result.error.issues[0]?.message ?? '';\",\n ' expect(msg.length).toBeGreaterThan(0);',\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-flatten',\n description: 'error.flatten() moved to z.flattenError(error) in v4',\n regex: /\\.flatten\\(\\)/,\n testTemplate: [\n \" it('verifies error flattening (v4 change)', () => {\",\n ' // v3: error.flatten()',\n ' // v4: z.flattenError(error)',\n ' const schema = z.object({ name: z.string() });',\n ' const result = schema.safeParse({});',\n ' if (!result.success) {',\n ' expect(result.error).toBeDefined();',\n ' }',\n ' });',\n ].join('\\n'),\n },\n];\n\n/**\n * Detect v4 behavioral patterns in source code.\n */\nexport function detectBehavioralPatterns(sourceCode: string, filePath: string): DetectedPattern[] {\n const results: DetectedPattern[] = [];\n const lines = sourceCode.split('\\n');\n\n for (const pattern of V4_BEHAVIORAL_PATTERNS) {\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? '';\n if (pattern.regex.test(line)) {\n results.push({\n pattern,\n filePath,\n lineNumber: i + 1,\n matchedText: line.trim(),\n });\n }\n }\n\n // Multi-line match fallback\n if (\n pattern.regex.test(sourceCode) &&\n !results.some((r) => r.pattern.name === pattern.name && r.filePath === filePath)\n ) {\n const match = pattern.regex.exec(sourceCode);\n if (match) {\n const lineNumber = sourceCode.slice(0, match.index).split('\\n').length;\n results.push({\n pattern,\n filePath,\n lineNumber,\n matchedText: match[0].trim().slice(0, 80),\n });\n }\n }\n }\n\n return results;\n}\n\n/**\n * Generate behavioral regression tests for detected patterns.\n */\nexport function generateBehaviorTests(\n files: Array<{ filePath: string; sourceCode: string }>,\n): BehaviorTestResult {\n const allPatterns: DetectedPattern[] = [];\n const testsByFile = new Map<string, Set<string>>();\n\n for (const { filePath, sourceCode } of files) {\n const detected = detectBehavioralPatterns(sourceCode, filePath);\n allPatterns.push(...detected);\n\n for (const d of detected) {\n const existing = testsByFile.get(filePath) ?? new Set();\n existing.add(d.pattern.name);\n testsByFile.set(filePath, existing);\n }\n }\n\n const tests: GeneratedBehaviorTest[] = [];\n\n for (const [filePath, patternNames] of testsByFile) {\n const patterns = [...patternNames];\n const testBlocks = patterns\n .map((name) => V4_BEHAVIORAL_PATTERNS.find((p) => p.name === name)?.testTemplate ?? '')\n .filter(Boolean);\n\n if (testBlocks.length === 0) continue;\n\n const shortPath = filePath.split('/').slice(-2).join('/');\n const testCode = [\n \"import { describe, expect, it } from 'vitest';\",\n \"import { z } from 'zod';\",\n '',\n '/**',\n ' * Behavioral regression tests for Zod v3 to v4 migration',\n ` * Source: ${shortPath}`,\n ' * Generated by SchemaShift',\n ' */',\n `describe('v4 behavioral changes: ${shortPath}', () => {`,\n ...testBlocks.map((b) => b),\n '});',\n ].join('\\n');\n\n tests.push({ filePath, testCode, patterns });\n }\n\n return { tests, totalPatterns: allPatterns.length };\n}\n","import type { TransformError, TransformResult } from '@schemashift/core';\nimport { Node, type SourceFile } from 'ts-morph';\nimport {\n AUTO_TRANSFORMABLE,\n BEHAVIOR_CHANGES,\n DEPRECATED_FACTORIES,\n DEPRECATED_METHODS,\n STRING_FORMAT_TO_TOPLEVEL,\n UTILITY_TYPES,\n} from './mappings.js';\n\n/**\n * Zod v3 to v4 Transformer\n *\n * Handles breaking changes between Zod v3 and v4:\n * - z.record() now requires explicit key type\n * - error.errors -> error.issues\n * - Stricter UUID validation\n * - Type inference changes in .default()\n * - .flatten() removed\n * - z.preprocess() -> z.pipe() migration\n */\nexport class ZodV3ToV4Transformer {\n private errors: TransformError[] = [];\n private warnings: string[] = [];\n\n transform(sourceFile: SourceFile): TransformResult {\n this.errors = [];\n this.warnings = [];\n\n const filePath = sourceFile.getFilePath();\n const originalCode = sourceFile.getFullText();\n\n try {\n this.transformRecordCalls(sourceFile);\n this.transformMerge(sourceFile);\n this.transformNativeEnum(sourceFile);\n this.transformSuperRefine(sourceFile);\n this.transformErrorProperties(sourceFile);\n this.transformErrorParams(sourceFile);\n this.transformFlatten(sourceFile);\n this.transformFormat(sourceFile);\n this.transformDefAccess(sourceFile);\n this.transformFunctionValidation(sourceFile);\n this.transformOptionalShorthands(sourceFile);\n this.transformPreprocess(sourceFile);\n this.checkDeprecatedMethods(sourceFile);\n this.checkDeprecatedFactories(sourceFile);\n this.checkStringFormatMethods(sourceFile);\n this.checkBehaviorChanges(sourceFile);\n this.checkInstanceofError(sourceFile);\n this.checkTransformRefineOrder(sourceFile);\n this.checkDefaultOptional(sourceFile);\n this.checkCatchOptional(sourceFile);\n this.checkUtilityTypeImports(sourceFile);\n this.checkNonemptyTypeChange(sourceFile);\n this.checkCoerceInputType(sourceFile);\n this.checkDeepPartialRemoval(sourceFile);\n this.checkStripDeprecation(sourceFile);\n this.checkErrorMapPrecedence(sourceFile);\n this.checkAddIssueMethods(sourceFile);\n\n return {\n success: this.errors.length === 0,\n filePath,\n originalCode,\n transformedCode: sourceFile.getFullText(),\n errors: this.errors,\n warnings: this.warnings,\n };\n } catch (error) {\n this.errors.push({\n message: error instanceof Error ? error.message : 'Unknown error',\n });\n return {\n success: false,\n filePath,\n originalCode,\n errors: this.errors,\n warnings: this.warnings,\n };\n }\n }\n\n /**\n * Transform z.record(valueSchema) to z.record(z.string(), valueSchema)\n */\n private transformRecordCalls(sourceFile: SourceFile): void {\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n const object = expression.getExpression();\n\n if (name === 'record' && object.getText() === 'z') {\n const args = node.getArguments();\n\n // If only one argument, add z.string() as key type\n if (args.length === 1) {\n const valueSchema = args[0]?.getText();\n if (valueSchema) {\n node.replaceWithText(`z.record(z.string(), ${valueSchema})`);\n\n this.warnings.push(\n `${sourceFile.getFilePath()}:${node.getStartLineNumber()}: ` +\n 'z.record() updated to include explicit key type z.string()',\n );\n }\n }\n }\n }\n }\n });\n }\n\n /**\n * Build a set of variable names that are likely ZodError instances.\n * Used by transformErrorProperties, transformFlatten, and transformFormat.\n */\n private buildZodErrorVarSet(sourceFile: SourceFile): Set<string> {\n const zodErrorVars = new Set<string>();\n\n sourceFile.forEachDescendant((node) => {\n // Check variable declarations with ZodError type annotation\n if (Node.isVariableDeclaration(node)) {\n const typeNode = node.getTypeNode();\n if (typeNode?.getText().includes('ZodError')) {\n zodErrorVars.add(node.getName());\n }\n }\n\n // Check catch clause parameters\n if (Node.isCatchClause(node)) {\n const param = node.getVariableDeclaration();\n if (param) {\n const block = node.getBlock();\n const blockText = block.getText();\n if (blockText.includes('instanceof ZodError') || blockText.includes('ZodError')) {\n zodErrorVars.add(param.getName());\n }\n }\n }\n\n // Check for .safeParse() result — the error is in result.error\n if (Node.isVariableDeclaration(node)) {\n const initializer = node.getInitializer();\n if (initializer?.getText().includes('.safeParse(')) {\n zodErrorVars.add(`${node.getName()}.error`);\n }\n }\n\n // Check for new ZodError patterns\n if (Node.isNewExpression(node)) {\n if (node.getExpression().getText() === 'ZodError') {\n const parent = node.getParent();\n if (parent && Node.isVariableDeclaration(parent)) {\n zodErrorVars.add(parent.getName());\n }\n }\n }\n });\n\n return zodErrorVars;\n }\n\n /**\n * Transform error.errors to error.issues using AST-based detection\n * instead of heuristic name matching.\n */\n private transformErrorProperties(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n // Now transform .errors -> .issues only on identified ZodError variables\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node)) {\n const name = node.getName();\n if (name === 'errors') {\n const object = node.getExpression();\n const objectText = object.getText();\n\n // Check if this object is a known ZodError variable\n const isZodError =\n zodErrorVars.has(objectText) ||\n // Also check if accessing .error.errors (safeParse pattern)\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n const fullText = node.getText();\n const newText = fullText.replace(/\\.errors$/, '.issues');\n node.replaceWithText(newText);\n\n this.warnings.push(\n `${filePath}:${node.getStartLineNumber()}: ` +\n '.errors renamed to .issues (ZodError property change)',\n );\n }\n }\n }\n });\n }\n\n /**\n * Auto-transform error.flatten() to z.flattenError(error) in v4.\n */\n private transformFlatten(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n objectText: string;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'flatten') {\n const objectText = expression.getExpression().getText();\n const isZodError =\n zodErrorVars.has(objectText) ||\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n nodesToTransform.push({\n node,\n objectText,\n lineNumber: node.getStartLineNumber(),\n });\n } else {\n this.warnings.push(\n `${filePath}:${node.getStartLineNumber()}: .flatten() is removed in v4. ` +\n 'Use z.flattenError(error) or access error.issues directly. ' +\n 'See: https://zod.dev/v4/changelog',\n );\n }\n }\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, objectText, lineNumber } of nodesToTransform) {\n node.replaceWithText(`z.flattenError(${objectText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .flatten() auto-transformed to z.flattenError(). ` +\n 'Removed in v4 — now a standalone function.',\n );\n }\n }\n\n /**\n * Auto-transform error.format() to z.treeifyError(error) in v4.\n */\n private transformFormat(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n objectText: string;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'format') {\n const objectText = expression.getExpression().getText();\n const isZodError =\n zodErrorVars.has(objectText) ||\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n nodesToTransform.push({\n node,\n objectText,\n lineNumber: node.getStartLineNumber(),\n });\n }\n // Skip non-ZodError .format() calls to avoid false positives\n }\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, objectText, lineNumber } of nodesToTransform) {\n node.replaceWithText(`z.treeifyError(${objectText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .format() auto-transformed to z.treeifyError(). ` +\n 'Removed in v4 — now a standalone function.',\n );\n }\n }\n\n /**\n * Auto-transform ._def property access to ._zod.def in v4.\n */\n private transformDefAccess(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').PropertyAccessExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node) && node.getName() === '_def') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const objectText = node.getExpression().getText();\n node.replaceWithText(`${objectText}._zod.def`);\n this.warnings.push(\n `${filePath}:${lineNumber}: ._def auto-transformed to ._zod.def. ` +\n 'Internal API — structure may change between releases.',\n );\n }\n }\n\n /**\n * Transform .merge(otherSchema) to .extend(otherSchema.shape)\n */\n private transformMerge(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{ node: import('ts-morph').CallExpression; lineNumber: number }> =\n [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'merge') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n });\n\n // Process in reverse order\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const args = node.getArguments();\n if (args.length === 1) {\n const argText = args[0]?.getText();\n if (argText) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const objectText = expression.getExpression().getText();\n node.replaceWithText(`${objectText}.extend(${argText}.shape)`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .merge() renamed to .extend() with .shape access. ` +\n 'Verify the merged schema exposes .shape.',\n );\n }\n }\n }\n }\n }\n\n /**\n * Transform z.nativeEnum(X) to z.enum(X)\n */\n private transformNativeEnum(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n const newText = fullText.replace(/\\bz\\.nativeEnum\\(/g, 'z.enum(');\n if (newText !== fullText) {\n sourceFile.replaceWithText(newText);\n this.warnings.push(\n `${filePath}: z.nativeEnum() renamed to z.enum() in v4. ` +\n 'Verify enum values are compatible.',\n );\n }\n }\n\n /**\n * Check for deprecated methods and add warnings\n */\n private checkDeprecatedMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (DEPRECATED_METHODS.has(name) && !AUTO_TRANSFORMABLE.has(name)) {\n const lineNumber = node.getStartLineNumber();\n switch (name) {\n case 'strict':\n this.warnings.push(\n `${filePath}:${lineNumber}: .strict() is deprecated in v4. ` +\n 'Use z.strictObject() instead.',\n );\n break;\n case 'passthrough':\n this.warnings.push(\n `${filePath}:${lineNumber}: .passthrough() is deprecated in v4. ` +\n 'Use z.looseObject() instead.',\n );\n break;\n // merge is handled by transformMerge\n }\n }\n }\n }\n });\n }\n\n /**\n * Auto-transform .superRefine() to .check() — callback signature is identical.\n */\n private transformSuperRefine(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').PropertyAccessExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node) && node.getName() === 'superRefine') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n });\n\n // Process in reverse to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const parent = node.getParent();\n if (parent && Node.isCallExpression(parent)) {\n const objectText = node.getExpression().getText();\n const args = parent.getArguments();\n let argsText = args.map((a) => a.getText()).join(', ');\n\n // Also transform ctx.addIssue() -> ctx.issues.push() inside the callback\n if (args.length > 0) {\n const callbackText = args[0]?.getText() ?? '';\n // Detect the context parameter name (2nd param in arrow/function)\n const paramMatch = callbackText.match(\n /^\\s*\\(?\\s*\\w+\\s*,\\s*(\\w+)\\s*\\)?(?:\\s*:\\s*[^)]+)?\\s*=>/,\n );\n if (paramMatch?.[1]) {\n const ctxName = paramMatch[1];\n const addIssuePattern = new RegExp(`${ctxName}\\\\.addIssue\\\\(`, 'g');\n if (addIssuePattern.test(callbackText)) {\n argsText = callbackText.replace(\n new RegExp(`${ctxName}\\\\.addIssue\\\\(`, 'g'),\n `${ctxName}.issues.push(`,\n );\n // Re-add remaining args if any\n if (args.length > 1) {\n const remaining = args\n .slice(1)\n .map((a) => a.getText())\n .join(', ');\n argsText = `${argsText}, ${remaining}`;\n }\n }\n }\n }\n\n parent.replaceWithText(`${objectText}.check(${argsText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .superRefine() auto-transformed to .check() (deprecated in v4).`,\n );\n }\n }\n }\n\n /**\n * Auto-transform invalid_type_error/required_error params to unified `error` param.\n */\n private transformErrorParams(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').ObjectLiteralExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isObjectLiteralExpression(node)) {\n const properties = node.getProperties();\n const propNames = properties\n .filter((p) => Node.isPropertyAssignment(p))\n .map((p) => (Node.isPropertyAssignment(p) ? p.getName() : ''));\n\n const hasInvalidType = propNames.includes('invalid_type_error');\n const hasRequired = propNames.includes('required_error');\n\n if (hasInvalidType || hasRequired) {\n // Only transform if this is an argument to a z.xxx() factory call\n const parent = node.getParent();\n if (parent && Node.isCallExpression(parent)) {\n const expr = parent.getExpression();\n if (Node.isPropertyAccessExpression(expr) && expr.getExpression().getText() === 'z') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n }\n }\n });\n\n // Process in reverse to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const properties = node.getProperties();\n let invalidTypeValue: string | undefined;\n let requiredValue: string | undefined;\n const otherProps: string[] = [];\n\n for (const prop of properties) {\n if (Node.isPropertyAssignment(prop)) {\n const name = prop.getName();\n const value = prop.getInitializer()?.getText() ?? '';\n if (name === 'invalid_type_error') {\n invalidTypeValue = value;\n } else if (name === 'required_error') {\n requiredValue = value;\n } else {\n otherProps.push(prop.getText());\n }\n }\n }\n\n let errorValue: string;\n if (invalidTypeValue && requiredValue) {\n // Both present: generate error function\n errorValue = `error: (issue) => issue.input === undefined ? ${requiredValue} : ${invalidTypeValue}`;\n } else if (requiredValue) {\n errorValue = `error: ${requiredValue}`;\n } else if (invalidTypeValue) {\n errorValue = `error: ${invalidTypeValue}`;\n } else {\n continue;\n }\n\n const allProps = [errorValue, ...otherProps].join(', ');\n node.replaceWithText(`{ ${allProps} }`);\n\n this.warnings.push(\n `${filePath}:${lineNumber}: invalid_type_error/required_error auto-transformed to unified error param.`,\n );\n }\n }\n\n /**\n * Detect instanceof Error patterns in catch blocks that reference ZodError.\n * In v4, ZodError no longer extends Error.\n */\n private checkInstanceofError(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCatchClause(node)) {\n const block = node.getBlock();\n const blockText = block.getText();\n\n // Check if the catch block references ZodError AND uses instanceof Error\n if (blockText.includes('ZodError') && blockText.includes('instanceof Error')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: ZodError no longer extends Error in v4. ` +\n '`instanceof Error` checks on ZodError will return false. ' +\n 'Use `instanceof ZodError` or check for `.issues` property instead.',\n );\n }\n }\n });\n }\n\n /**\n * Detect .refine()/.superRefine() followed by .transform() in the same chain.\n * In v4, .transform() runs even when .refine() fails.\n */\n private checkTransformRefineOrder(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'transform') {\n // Walk up the chain to see if .refine() or .superRefine() precedes\n const chainText = node.getText();\n if (\n chainText.includes('.refine(') ||\n chainText.includes('.superRefine(') ||\n chainText.includes('.check(')\n ) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: In v4, .transform() executes even if preceding .refine() fails. ` +\n 'Consider using .pipe() to sequence validation before transforms.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Detect .default() combined with .optional() — behavior changed silently in v4.\n * In v4, .default() always provides a value, making .optional() a no-op.\n */\n private checkDefaultOptional(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (\n Node.isPropertyAccessExpression(expression) &&\n (expression.getName() === 'optional' || expression.getName() === 'default')\n ) {\n const chainText = node.getText();\n const hasDefault = chainText.includes('.default(');\n const hasOptional = chainText.includes('.optional(');\n\n if (hasDefault && hasOptional) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .default() + .optional() behavior changed in v4. ` +\n '.default() now always provides a value, making .optional() effectively a no-op. ' +\n 'Review whether .optional() is still needed.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Check for methods with behavior changes and add warnings\n */\n private checkBehaviorChanges(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n\n if (BEHAVIOR_CHANGES.has(name)) {\n const lineNumber = node.getStartLineNumber();\n\n switch (name) {\n case 'default':\n this.warnings.push(\n `${filePath}:${lineNumber}: .default() has stricter type inference in v4. ` +\n 'Verify default value matches schema type exactly.',\n );\n break;\n\n case 'uuid':\n this.warnings.push(\n `${filePath}:${lineNumber}: .uuid() now enforces strict RFC 4122 compliance. ` +\n 'Non-standard UUIDs may fail validation.',\n );\n break;\n\n case 'discriminatedUnion':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.discriminatedUnion() now requires ` +\n 'a literal type for the discriminator property.',\n );\n break;\n\n case 'function':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.function() parameter handling has changed. ` +\n 'Review input/output schema definitions.',\n );\n break;\n\n case 'pipe':\n this.warnings.push(\n `${filePath}:${lineNumber}: .pipe() has stricter type checking in v4. ` +\n 'If you get type errors, add explicit type annotations to .transform() return types ' +\n 'or cast through unknown as a last resort.',\n );\n break;\n }\n }\n }\n }\n });\n }\n\n /**\n * Detect .catch() combined with .optional() — behavior changed in v4.\n * In v4, .catch() on optional properties always returns the catch value.\n */\n private checkCatchOptional(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (\n Node.isPropertyAccessExpression(expression) &&\n (expression.getName() === 'optional' || expression.getName() === 'catch')\n ) {\n const chainText = node.getText();\n if (chainText.includes('.catch(') && chainText.includes('.optional(')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .catch() + .optional() behavior changed in v4. ` +\n '.catch() on optional properties now always returns the catch value, ' +\n 'even when the property is absent from input.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Detect imports of utility types that moved to 'zod/v4/core' in v4.\n */\n private checkUtilityTypeImports(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n for (const importDecl of sourceFile.getImportDeclarations()) {\n const moduleSpecifier = importDecl.getModuleSpecifierValue();\n if (moduleSpecifier !== 'zod') continue;\n\n const namedImports = importDecl.getNamedImports();\n for (const namedImport of namedImports) {\n const name = namedImport.getName();\n if (UTILITY_TYPES.has(name)) {\n const lineNumber = importDecl.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: '${name}' may need to be imported from 'zod/v4/core' in v4. ` +\n 'Internal utility types have moved to a separate subpackage.',\n );\n }\n }\n }\n }\n\n /**\n * Warn about string format methods that moved to top-level functions in v4.\n * e.g., z.string().email() → z.email() (instance methods are deprecated but still work)\n */\n private checkStringFormatMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (STRING_FORMAT_TO_TOPLEVEL.has(name)) {\n // Check if this is chained on z.string()\n const chainText = node.getText();\n if (chainText.includes('z.string()') || chainText.includes('.string()')) {\n const topLevel = STRING_FORMAT_TO_TOPLEVEL.get(name);\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .${name}() is deprecated as an instance method in v4. ` +\n `Use ${topLevel} as a top-level function instead. The instance method still works but may be removed in future versions.`,\n );\n }\n }\n }\n }\n });\n }\n\n /**\n * Check for deprecated factory functions (z.promise(), z.ostring(), etc.)\n */\n private checkDeprecatedFactories(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n const object = expression.getExpression();\n\n if (object.getText() === 'z' && DEPRECATED_FACTORIES.has(name)) {\n const lineNumber = node.getStartLineNumber();\n switch (name) {\n case 'promise':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.promise() is deprecated in v4. ` +\n 'Await values before parsing instead of wrapping in z.promise().',\n );\n break;\n case 'ostring':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.ostring() is removed in v4. ` +\n 'Use z.string().optional() instead.',\n );\n break;\n case 'onumber':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.onumber() is removed in v4. ` +\n 'Use z.number().optional() instead.',\n );\n break;\n case 'oboolean':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.oboolean() is removed in v4. ` +\n 'Use z.boolean().optional() instead.',\n );\n break;\n case 'preprocess':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.preprocess() is removed in v4. ` +\n 'Use z.pipe(z.unknown(), z.transform(fn), targetSchema) instead.',\n );\n break;\n }\n }\n }\n }\n });\n }\n\n /**\n * Transform z.function().args().returns() to z.function({ input, output }) in v4.\n */\n private transformFunctionValidation(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (name === 'args' || name === 'returns') {\n // Check if this is part of a z.function() chain\n const chainText = node.getText();\n if (\n chainText.includes('z.function()') &&\n (chainText.includes('.args(') || chainText.includes('.returns('))\n ) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: z.function().args().returns() is removed in v4. ` +\n 'Use z.function({ input: z.tuple([...]), output: schema }) instead. ' +\n 'The result is no longer a Zod schema — use .implement() to wrap functions.',\n );\n }\n }\n }\n }\n });\n }\n\n /**\n * Transform z.ostring(), z.onumber(), z.oboolean() to explicit .optional() calls.\n */\n private transformOptionalShorthands(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n const replacements: Array<{ pattern: RegExp; replacement: string; name: string }> = [\n { pattern: /\\bz\\.ostring\\(\\)/g, replacement: 'z.string().optional()', name: 'z.ostring()' },\n { pattern: /\\bz\\.onumber\\(\\)/g, replacement: 'z.number().optional()', name: 'z.onumber()' },\n {\n pattern: /\\bz\\.oboolean\\(\\)/g,\n replacement: 'z.boolean().optional()',\n name: 'z.oboolean()',\n },\n ];\n\n let newText = fullText;\n for (const { pattern, replacement, name } of replacements) {\n if (pattern.test(newText)) {\n newText = newText.replace(pattern, replacement);\n this.warnings.push(\n `${filePath}: ${name} auto-transformed to ${replacement}. Removed in v4.`,\n );\n }\n }\n\n if (newText !== fullText) {\n sourceFile.replaceWithText(newText);\n }\n }\n\n /**\n * Check for .nonempty() which has a type inference change in v4.\n * v3: [string, ...string[]] (tuple with rest)\n * v4: string[] (matches .min(1))\n */\n private checkNonemptyTypeChange(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'nonempty') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .nonempty() type inference changed in v4. ` +\n 'v3 inferred [T, ...T[]] (tuple with rest), v4 infers T[] (same as .min(1)). ' +\n 'If you rely on the tuple type, use z.tuple([z.string()], z.string()) instead.',\n );\n }\n }\n });\n }\n\n /**\n * Check for z.coerce.* usage — input type changed to unknown in v4.\n */\n private checkCoerceInputType(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n if (fullText.includes('z.coerce.')) {\n // Find line numbers for each occurrence\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node)) {\n const text = node.getText();\n if (text.startsWith('z.coerce.')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: z.coerce.* input type changed to 'unknown' in v4. ` +\n 'Previously, z.coerce.string() had input type string. ' +\n 'This enables more accurate type inference but may affect type guards.',\n );\n }\n }\n });\n }\n }\n\n /**\n * Check for .deepPartial() which was removed entirely in v4.\n */\n private checkDeepPartialRemoval(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'deepPartial') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .deepPartial() is removed in v4. ` +\n 'This was a long-deprecated anti-pattern. Use recursive partial types or ' +\n 'restructure schemas to avoid deep partial requirements.',\n );\n }\n }\n });\n }\n\n /**\n * Auto-remove .strip() which is deprecated in v4 (it was the default behavior).\n */\n private checkStripDeprecation(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'strip') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const objectText = expression.getExpression().getText();\n node.replaceWithText(objectText);\n this.warnings.push(\n `${filePath}:${lineNumber}: .strip() auto-removed — it is the default behavior in v4.`,\n );\n }\n }\n }\n\n /**\n * Check for errorMap usage patterns where precedence changed in v4.\n * In v4, schema-level error maps take precedence over parse-time error maps (inverted from v3).\n */\n private checkErrorMapPrecedence(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n // Check if file uses both schema-level and parse-time error maps\n const hasSchemaErrorMap = fullText.includes('errorMap:') || fullText.includes('error:');\n const hasParseErrorMap =\n (fullText.includes('.parse(') && fullText.includes('errorMap')) ||\n (fullText.includes('.safeParse(') && fullText.includes('errorMap'));\n\n if (hasSchemaErrorMap && hasParseErrorMap) {\n this.warnings.push(\n `${filePath}: Error map precedence changed in v4. ` +\n 'Schema-level error maps now take precedence over parse-time error maps (inverted from v3). ' +\n 'Review error map usage to ensure correct error messages.',\n );\n }\n }\n\n /**\n * Auto-transform z.preprocess(fn, schema) to z.pipe(z.unknown(), z.transform(fn), schema).\n */\n private transformPreprocess(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n const object = expression.getExpression();\n if (name === 'preprocess' && object.getText() === 'z') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n }\n });\n\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const args = node.getArguments();\n if (args.length === 2) {\n const fn = args[0]?.getText();\n const schema = args[1]?.getText();\n if (fn && schema) {\n node.replaceWithText(`z.pipe(z.unknown(), z.transform(${fn}), ${schema})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: z.preprocess() auto-transformed to z.pipe(). ` +\n 'Removed in v4 — use z.pipe() with z.transform() instead.',\n );\n }\n }\n }\n }\n\n /**\n * Check for ctx.addIssue() / ctx.addIssues() which are deprecated in v4.\n */\n private checkAddIssueMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n if (fullText.includes('.addIssue(') || fullText.includes('.addIssues(')) {\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (name === 'addIssue' || name === 'addIssues') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .${name}() is deprecated in v4. ` +\n 'Directly manipulate the issues array instead: ctx.issues.push({...}). ' +\n 'Note: .superRefine() callbacks using addIssue should migrate to .check() with issues.push().',\n );\n }\n }\n }\n });\n }\n }\n}\n","/**\n * Zod v3 to v4 Breaking Changes\n *\n * Key changes in Zod v4:\n * 1. z.record() now requires explicit key type\n * 2. .default() has stricter type inference (matches output type, not input)\n * 3. error.errors renamed to error.issues\n * 4. .uuid() has stricter validation (RFC 9562/4122 compliant)\n * 5. z.function() completely overhauled — .args()/.returns() removed\n * 6. Branded types use different syntax\n * 7. z.discriminatedUnion() requires literal discriminator\n * 8. String format methods moved to top-level (e.g., .email() → z.email())\n * 9. .deepPartial() removed (was deprecated anti-pattern)\n * 10. z.promise() deprecated (await values before parsing)\n * 11. .strip() deprecated (default behavior)\n * 12. .nonempty() type inference changed (no longer tuple type)\n * 13. z.coerce.* input type changed to unknown\n * 14. z.partialRecord() added for optional key behavior\n * 15. z.guid() added for lenient UUID matching\n * 16. z.iso.* validators for date/time/datetime/duration\n * 17. .prefault() added (restores v3 .default() parse behavior)\n * 18. .addIssue()/.addIssues() deprecated in favor of issues.push()\n * 19. ZodError precedence reversal: schema-level error maps override parse-time\n * 20. z.ostring()/z.onumber() etc. removed (optional shorthands)\n */\n\n// Patterns that need transformation\nexport const V3_TO_V4_PATTERNS = {\n // z.record(valueSchema) -> z.record(z.string(), valueSchema)\n recordSingleArg: /z\\.record\\((?!z\\.string\\(\\)|z\\.number\\(\\)|z\\.symbol\\(\\))/g,\n\n // error.errors -> error.issues\n errorErrors: /\\.errors\\b/g,\n\n // .brand<T>() -> .brand<T>() (same but check for proper usage)\n brandUsage: /\\.brand<([^>]+)>\\(\\)/g,\n};\n\n// Methods that have changed behavior\nexport const BEHAVIOR_CHANGES = new Set([\n 'default', // Type inference changed; now matches output type, use .prefault() for v3 behavior\n 'uuid', // Stricter RFC 9562/4122 validation; use z.guid() for lenient matching\n 'record', // Requires key type\n 'discriminatedUnion', // Stricter discriminator requirements\n 'function', // Complete overhaul — .args()/.returns() removed\n 'pipe', // Stricter type checking in v4\n 'catch', // .catch() on optional properties always returns catch value in v4\n 'nonempty', // Type inference changed: string[] instead of [string, ...string[]]\n 'coerce', // Input type changed to unknown for all z.coerce.* schemas\n]);\n\n// Error property renames\nexport const ERROR_RENAMES: Record<string, string> = {\n errors: 'issues',\n formErrors: 'formErrors', // Unchanged\n fieldErrors: 'fieldErrors', // Unchanged\n};\n\n// Methods that are deprecated in v4\nexport const DEPRECATED_METHODS = new Set([\n 'merge', // Use .extend() instead\n 'superRefine', // Use .check() instead\n 'strict', // Use z.strictObject() instead\n 'passthrough', // Use z.looseObject() instead\n 'deepPartial', // Removed entirely — was deprecated anti-pattern\n 'strip', // Deprecated — default behavior in v4\n 'nonstrict', // Removed entirely\n]);\n\n// Factory functions deprecated/removed in v4\nexport const DEPRECATED_FACTORIES = new Set([\n 'promise', // z.promise() deprecated — await values before parsing\n 'ostring', // z.ostring() removed (optional shorthand)\n 'onumber', // z.onumber() removed\n 'oboolean', // z.oboolean() removed\n 'preprocess', // z.preprocess() removed — use z.pipe() instead\n]);\n\n// Method renames in v4\nexport const METHOD_RENAMES: Record<string, string> = {\n merge: 'extend',\n};\n\n// Factory function renames in v4\nexport const FACTORY_RENAMES: Record<string, string> = {\n nativeEnum: 'enum',\n};\n\n// Error params that changed in v4 (unified under `error`)\nexport const ERROR_PARAM_NAMES = new Set(['invalid_type_error', 'required_error']);\n\n// Methods that can be automatically transformed (renamed) in v4\nexport const AUTO_TRANSFORMABLE = new Set([\n 'superRefine', // -> .check()\n 'flatten', // error.flatten() -> z.flattenError(error)\n 'format', // error.format() -> z.treeifyError(error)\n]);\n\n// Utility types that moved to 'zod/v4/core' in v4\nexport const UTILITY_TYPES = new Set([\n 'ZodType',\n 'ZodSchema',\n 'ZodRawShape',\n 'ZodTypeAny',\n 'ZodFirstPartyTypeKind',\n]);\n\n// String format methods that moved from instance methods to top-level functions\nexport const STRING_FORMAT_TO_TOPLEVEL = new Map<string, string>([\n ['email', 'z.email()'],\n ['url', 'z.url()'],\n ['uuid', 'z.uuid()'],\n ['emoji', 'z.emoji()'],\n ['nanoid', 'z.nanoid()'],\n ['cuid', 'z.cuid()'],\n ['cuid2', 'z.cuid2()'],\n ['ulid', 'z.ulid()'],\n ['ipv4', 'z.ipv4()'],\n ['ipv6', 'z.ipv6()'],\n ['cidrv4', 'z.cidrv4()'],\n ['cidrv6', 'z.cidrv6()'],\n ['base64', 'z.base64()'],\n ['base64url', 'z.base64url()'],\n]);\n\n// New ISO validators in v4 (informational — no transform needed, just awareness)\nexport const NEW_ISO_VALIDATORS = new Set([\n 'z.iso.date()',\n 'z.iso.time()',\n 'z.iso.datetime()',\n 'z.iso.duration()',\n]);\n\n// Runtime behavior patterns that silently break in v4 (no compile-time error)\nexport const RUNTIME_BREAK_PATTERNS = new Set([\n 'instanceofError', // ZodError no longer extends Error\n 'transformAfterRefine', // .transform() runs even when .refine() fails\n 'defaultOptional', // .default() + .optional() behavior change\n 'errorMapPrecedence', // Schema-level error maps now override parse-time\n 'nonemptyType', // .nonempty() returns string[] instead of [string, ...string[]]\n 'coerceInputType', // z.coerce.* input is now unknown instead of specific type\n]);\n","import type { TransformHandler, TransformOptions, TransformResult } from '@schemashift/core';\nimport type { SourceFile } from 'ts-morph';\nimport { ZodV3ToV4Transformer } from './transformer.js';\n\nexport function createZodV3ToV4Handler(): TransformHandler {\n const transformer = new ZodV3ToV4Transformer();\n return {\n transform(sourceFile: SourceFile, _options: TransformOptions): TransformResult {\n return transformer.transform(sourceFile);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;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AAmB;AAC3C,mBAAK,SAAS;AAAA,gBACZ,GAAG,QAAQ,IAAI,UAAU,MAAM,IAAI;AAAA,cAGrC;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AElkCO,SAAS,yBAA2C;AACzD,QAAM,cAAc,IAAI,qBAAqB;AAC7C,SAAO;AAAA,IACL,UAAU,YAAwB,UAA6C;AAC7E,aAAO,YAAY,UAAU,UAAU;AAAA,IACzC;AAAA,EACF;AACF;","names":[]}
package/dist/index.d.cts CHANGED
@@ -195,7 +195,7 @@ declare class ZodV3ToV4Transformer {
195
195
  */
196
196
  private checkDeepPartialRemoval;
197
197
  /**
198
- * Check for .strip() which is deprecated in v4 (it was the default behavior).
198
+ * Auto-remove .strip() which is deprecated in v4 (it was the default behavior).
199
199
  */
200
200
  private checkStripDeprecation;
201
201
  /**
@@ -203,6 +203,10 @@ declare class ZodV3ToV4Transformer {
203
203
  * In v4, schema-level error maps take precedence over parse-time error maps (inverted from v3).
204
204
  */
205
205
  private checkErrorMapPrecedence;
206
+ /**
207
+ * Auto-transform z.preprocess(fn, schema) to z.pipe(z.unknown(), z.transform(fn), schema).
208
+ */
209
+ private transformPreprocess;
206
210
  /**
207
211
  * Check for ctx.addIssue() / ctx.addIssues() which are deprecated in v4.
208
212
  */
package/dist/index.d.ts CHANGED
@@ -195,7 +195,7 @@ declare class ZodV3ToV4Transformer {
195
195
  */
196
196
  private checkDeepPartialRemoval;
197
197
  /**
198
- * Check for .strip() which is deprecated in v4 (it was the default behavior).
198
+ * Auto-remove .strip() which is deprecated in v4 (it was the default behavior).
199
199
  */
200
200
  private checkStripDeprecation;
201
201
  /**
@@ -203,6 +203,10 @@ declare class ZodV3ToV4Transformer {
203
203
  * In v4, schema-level error maps take precedence over parse-time error maps (inverted from v3).
204
204
  */
205
205
  private checkErrorMapPrecedence;
206
+ /**
207
+ * Auto-transform z.preprocess(fn, schema) to z.pipe(z.unknown(), z.transform(fn), schema).
208
+ */
209
+ private transformPreprocess;
206
210
  /**
207
211
  * Check for ctx.addIssue() / ctx.addIssues() which are deprecated in v4.
208
212
  */
package/dist/index.js CHANGED
@@ -273,6 +273,7 @@ var ZodV3ToV4Transformer = class {
273
273
  this.transformDefAccess(sourceFile);
274
274
  this.transformFunctionValidation(sourceFile);
275
275
  this.transformOptionalShorthands(sourceFile);
276
+ this.transformPreprocess(sourceFile);
276
277
  this.checkDeprecatedMethods(sourceFile);
277
278
  this.checkDeprecatedFactories(sourceFile);
278
279
  this.checkStringFormatMethods(sourceFile);
@@ -993,21 +994,30 @@ var ZodV3ToV4Transformer = class {
993
994
  });
994
995
  }
995
996
  /**
996
- * Check for .strip() which is deprecated in v4 (it was the default behavior).
997
+ * Auto-remove .strip() which is deprecated in v4 (it was the default behavior).
997
998
  */
998
999
  checkStripDeprecation(sourceFile) {
999
1000
  const filePath = sourceFile.getFilePath();
1001
+ const nodesToTransform = [];
1000
1002
  sourceFile.forEachDescendant((node) => {
1001
1003
  if (Node.isCallExpression(node)) {
1002
1004
  const expression = node.getExpression();
1003
1005
  if (Node.isPropertyAccessExpression(expression) && expression.getName() === "strip") {
1004
- const lineNumber = node.getStartLineNumber();
1005
- this.warnings.push(
1006
- `${filePath}:${lineNumber}: .strip() is deprecated in v4 (it was the default behavior). Remove .strip() \u2014 z.object() strips unknown keys by default. To convert a strict object back to stripping, use z.object(schema.shape).`
1007
- );
1006
+ nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });
1008
1007
  }
1009
1008
  }
1010
1009
  });
1010
+ nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());
1011
+ for (const { node, lineNumber } of nodesToTransform) {
1012
+ const expression = node.getExpression();
1013
+ if (Node.isPropertyAccessExpression(expression)) {
1014
+ const objectText = expression.getExpression().getText();
1015
+ node.replaceWithText(objectText);
1016
+ this.warnings.push(
1017
+ `${filePath}:${lineNumber}: .strip() auto-removed \u2014 it is the default behavior in v4.`
1018
+ );
1019
+ }
1020
+ }
1011
1021
  }
1012
1022
  /**
1013
1023
  * Check for errorMap usage patterns where precedence changed in v4.
@@ -1024,6 +1034,39 @@ var ZodV3ToV4Transformer = class {
1024
1034
  );
1025
1035
  }
1026
1036
  }
1037
+ /**
1038
+ * Auto-transform z.preprocess(fn, schema) to z.pipe(z.unknown(), z.transform(fn), schema).
1039
+ */
1040
+ transformPreprocess(sourceFile) {
1041
+ const filePath = sourceFile.getFilePath();
1042
+ const nodesToTransform = [];
1043
+ sourceFile.forEachDescendant((node) => {
1044
+ if (Node.isCallExpression(node)) {
1045
+ const expression = node.getExpression();
1046
+ if (Node.isPropertyAccessExpression(expression)) {
1047
+ const name = expression.getName();
1048
+ const object = expression.getExpression();
1049
+ if (name === "preprocess" && object.getText() === "z") {
1050
+ nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });
1051
+ }
1052
+ }
1053
+ }
1054
+ });
1055
+ nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());
1056
+ for (const { node, lineNumber } of nodesToTransform) {
1057
+ const args = node.getArguments();
1058
+ if (args.length === 2) {
1059
+ const fn = args[0]?.getText();
1060
+ const schema = args[1]?.getText();
1061
+ if (fn && schema) {
1062
+ node.replaceWithText(`z.pipe(z.unknown(), z.transform(${fn}), ${schema})`);
1063
+ this.warnings.push(
1064
+ `${filePath}:${lineNumber}: z.preprocess() auto-transformed to z.pipe(). Removed in v4 \u2014 use z.pipe() with z.transform() instead.`
1065
+ );
1066
+ }
1067
+ }
1068
+ }
1069
+ }
1027
1070
  /**
1028
1071
  * Check for ctx.addIssue() / ctx.addIssues() which are deprecated in v4.
1029
1072
  */
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/behavior-test-generator.ts","../src/transformer.ts","../src/mappings.ts","../src/handler.ts"],"sourcesContent":["/**\n * Zod v4 Behavioral Test Generator\n *\n * Detects silent behavioral changes between Zod v3 and v4 and generates\n * regression tests to catch them.\n */\n\nexport interface BehavioralPattern {\n name: string;\n description: string;\n regex: RegExp;\n testTemplate: string;\n}\n\nexport interface DetectedPattern {\n pattern: BehavioralPattern;\n filePath: string;\n lineNumber: number;\n matchedText: string;\n}\n\nexport interface GeneratedBehaviorTest {\n filePath: string;\n testCode: string;\n patterns: string[];\n}\n\nexport interface BehaviorTestResult {\n tests: GeneratedBehaviorTest[];\n totalPatterns: number;\n}\n\nconst V4_BEHAVIORAL_PATTERNS: BehavioralPattern[] = [\n {\n name: 'default-optional',\n description: '.default() + .optional() behaves differently in v4',\n regex:\n /\\.default\\([^)]*\\)[\\s\\S]{0,20}\\.optional\\(\\)|\\.optional\\(\\)[\\s\\S]{0,20}\\.default\\([^)]*\\)/,\n testTemplate: [\n \" it('verifies .default() + .optional() behavior (v4 change)', () => {\",\n ' // v3: undefined input returns undefined (.optional() wins)',\n ' // v4: undefined input returns default value (.default() always applies)',\n \" const schema = z.string().default('fallback').optional();\",\n ' const result = schema.parse(undefined);',\n \" expect(result).toBe('fallback');\",\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-instanceof',\n description: 'ZodError no longer extends Error in v4',\n regex: /instanceof\\s+Error|instanceof\\s+ZodError/,\n testTemplate: [\n \" it('verifies ZodError instanceof check (v4 change)', () => {\",\n ' // v3: ZodError extends Error',\n ' // v4: ZodError does NOT extend Error',\n ' try {',\n ' z.string().parse(123);',\n ' } catch (e) {',\n ' expect(e).toBeDefined();',\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'transform-after-refine',\n description: '.transform() after .refine() may change execution order in v4',\n regex: /\\.refine\\([^)]*\\)[\\s\\S]{0,30}\\.transform\\(/,\n testTemplate: [\n \" it('verifies .refine() then .transform() ordering (v4 change)', () => {\",\n ' const schema = z.string()',\n \" .refine((val) => val.length > 0, 'Must not be empty')\",\n ' .transform((val) => val.toUpperCase());',\n \" const result = schema.safeParse('hello');\",\n ' expect(result.success).toBe(true);',\n ' if (result.success) {',\n \" expect(result.data).toBe('HELLO');\",\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'catch-optional',\n description: '.catch() + .optional() interaction changed in v4',\n regex: /\\.catch\\([^)]*\\)[\\s\\S]{0,20}\\.optional\\(\\)|\\.optional\\(\\)[\\s\\S]{0,20}\\.catch\\([^)]*\\)/,\n testTemplate: [\n \" it('verifies .catch() + .optional() behavior (v4 change)', () => {\",\n \" const schema = z.string().catch('default').optional();\",\n ' const result = schema.parse(undefined);',\n ' expect(result).toBeDefined();',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-message-format',\n description: 'Error messages changed from \"Required\" to descriptive messages',\n regex: /['\"]Required['\"]/,\n testTemplate: [\n \" it('verifies error message format (v4 change)', () => {\",\n ' // v3: \"Required\" for missing fields',\n ' // v4: \"Invalid input: expected string, received undefined\"',\n ' const schema = z.object({ name: z.string() });',\n ' const result = schema.safeParse({});',\n ' expect(result.success).toBe(false);',\n ' if (!result.success) {',\n \" const msg = result.error.issues[0]?.message ?? '';\",\n ' expect(msg.length).toBeGreaterThan(0);',\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-flatten',\n description: 'error.flatten() moved to z.flattenError(error) in v4',\n regex: /\\.flatten\\(\\)/,\n testTemplate: [\n \" it('verifies error flattening (v4 change)', () => {\",\n ' // v3: error.flatten()',\n ' // v4: z.flattenError(error)',\n ' const schema = z.object({ name: z.string() });',\n ' const result = schema.safeParse({});',\n ' if (!result.success) {',\n ' expect(result.error).toBeDefined();',\n ' }',\n ' });',\n ].join('\\n'),\n },\n];\n\n/**\n * Detect v4 behavioral patterns in source code.\n */\nexport function detectBehavioralPatterns(sourceCode: string, filePath: string): DetectedPattern[] {\n const results: DetectedPattern[] = [];\n const lines = sourceCode.split('\\n');\n\n for (const pattern of V4_BEHAVIORAL_PATTERNS) {\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? '';\n if (pattern.regex.test(line)) {\n results.push({\n pattern,\n filePath,\n lineNumber: i + 1,\n matchedText: line.trim(),\n });\n }\n }\n\n // Multi-line match fallback\n if (\n pattern.regex.test(sourceCode) &&\n !results.some((r) => r.pattern.name === pattern.name && r.filePath === filePath)\n ) {\n const match = pattern.regex.exec(sourceCode);\n if (match) {\n const lineNumber = sourceCode.slice(0, match.index).split('\\n').length;\n results.push({\n pattern,\n filePath,\n lineNumber,\n matchedText: match[0].trim().slice(0, 80),\n });\n }\n }\n }\n\n return results;\n}\n\n/**\n * Generate behavioral regression tests for detected patterns.\n */\nexport function generateBehaviorTests(\n files: Array<{ filePath: string; sourceCode: string }>,\n): BehaviorTestResult {\n const allPatterns: DetectedPattern[] = [];\n const testsByFile = new Map<string, Set<string>>();\n\n for (const { filePath, sourceCode } of files) {\n const detected = detectBehavioralPatterns(sourceCode, filePath);\n allPatterns.push(...detected);\n\n for (const d of detected) {\n const existing = testsByFile.get(filePath) ?? new Set();\n existing.add(d.pattern.name);\n testsByFile.set(filePath, existing);\n }\n }\n\n const tests: GeneratedBehaviorTest[] = [];\n\n for (const [filePath, patternNames] of testsByFile) {\n const patterns = [...patternNames];\n const testBlocks = patterns\n .map((name) => V4_BEHAVIORAL_PATTERNS.find((p) => p.name === name)?.testTemplate ?? '')\n .filter(Boolean);\n\n if (testBlocks.length === 0) continue;\n\n const shortPath = filePath.split('/').slice(-2).join('/');\n const testCode = [\n \"import { describe, expect, it } from 'vitest';\",\n \"import { z } from 'zod';\",\n '',\n '/**',\n ' * Behavioral regression tests for Zod v3 to v4 migration',\n ` * Source: ${shortPath}`,\n ' * Generated by SchemaShift',\n ' */',\n `describe('v4 behavioral changes: ${shortPath}', () => {`,\n ...testBlocks.map((b) => b),\n '});',\n ].join('\\n');\n\n tests.push({ filePath, testCode, patterns });\n }\n\n return { tests, totalPatterns: allPatterns.length };\n}\n","import type { TransformError, TransformResult } from '@schemashift/core';\nimport { Node, type SourceFile } from 'ts-morph';\nimport {\n AUTO_TRANSFORMABLE,\n BEHAVIOR_CHANGES,\n DEPRECATED_FACTORIES,\n DEPRECATED_METHODS,\n STRING_FORMAT_TO_TOPLEVEL,\n UTILITY_TYPES,\n} from './mappings.js';\n\n/**\n * Zod v3 to v4 Transformer\n *\n * Handles breaking changes between Zod v3 and v4:\n * - z.record() now requires explicit key type\n * - error.errors -> error.issues\n * - Stricter UUID validation\n * - Type inference changes in .default()\n * - .flatten() removed\n * - z.preprocess() -> z.pipe() migration\n */\nexport class ZodV3ToV4Transformer {\n private errors: TransformError[] = [];\n private warnings: string[] = [];\n\n transform(sourceFile: SourceFile): TransformResult {\n this.errors = [];\n this.warnings = [];\n\n const filePath = sourceFile.getFilePath();\n const originalCode = sourceFile.getFullText();\n\n try {\n this.transformRecordCalls(sourceFile);\n this.transformMerge(sourceFile);\n this.transformNativeEnum(sourceFile);\n this.transformSuperRefine(sourceFile);\n this.transformErrorProperties(sourceFile);\n this.transformErrorParams(sourceFile);\n this.transformFlatten(sourceFile);\n this.transformFormat(sourceFile);\n this.transformDefAccess(sourceFile);\n this.transformFunctionValidation(sourceFile);\n this.transformOptionalShorthands(sourceFile);\n this.checkDeprecatedMethods(sourceFile);\n this.checkDeprecatedFactories(sourceFile);\n this.checkStringFormatMethods(sourceFile);\n this.checkBehaviorChanges(sourceFile);\n this.checkInstanceofError(sourceFile);\n this.checkTransformRefineOrder(sourceFile);\n this.checkDefaultOptional(sourceFile);\n this.checkCatchOptional(sourceFile);\n this.checkUtilityTypeImports(sourceFile);\n this.checkNonemptyTypeChange(sourceFile);\n this.checkCoerceInputType(sourceFile);\n this.checkDeepPartialRemoval(sourceFile);\n this.checkStripDeprecation(sourceFile);\n this.checkErrorMapPrecedence(sourceFile);\n this.checkAddIssueMethods(sourceFile);\n\n return {\n success: this.errors.length === 0,\n filePath,\n originalCode,\n transformedCode: sourceFile.getFullText(),\n errors: this.errors,\n warnings: this.warnings,\n };\n } catch (error) {\n this.errors.push({\n message: error instanceof Error ? error.message : 'Unknown error',\n });\n return {\n success: false,\n filePath,\n originalCode,\n errors: this.errors,\n warnings: this.warnings,\n };\n }\n }\n\n /**\n * Transform z.record(valueSchema) to z.record(z.string(), valueSchema)\n */\n private transformRecordCalls(sourceFile: SourceFile): void {\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n const object = expression.getExpression();\n\n if (name === 'record' && object.getText() === 'z') {\n const args = node.getArguments();\n\n // If only one argument, add z.string() as key type\n if (args.length === 1) {\n const valueSchema = args[0]?.getText();\n if (valueSchema) {\n node.replaceWithText(`z.record(z.string(), ${valueSchema})`);\n\n this.warnings.push(\n `${sourceFile.getFilePath()}:${node.getStartLineNumber()}: ` +\n 'z.record() updated to include explicit key type z.string()',\n );\n }\n }\n }\n }\n }\n });\n }\n\n /**\n * Build a set of variable names that are likely ZodError instances.\n * Used by transformErrorProperties, transformFlatten, and transformFormat.\n */\n private buildZodErrorVarSet(sourceFile: SourceFile): Set<string> {\n const zodErrorVars = new Set<string>();\n\n sourceFile.forEachDescendant((node) => {\n // Check variable declarations with ZodError type annotation\n if (Node.isVariableDeclaration(node)) {\n const typeNode = node.getTypeNode();\n if (typeNode?.getText().includes('ZodError')) {\n zodErrorVars.add(node.getName());\n }\n }\n\n // Check catch clause parameters\n if (Node.isCatchClause(node)) {\n const param = node.getVariableDeclaration();\n if (param) {\n const block = node.getBlock();\n const blockText = block.getText();\n if (blockText.includes('instanceof ZodError') || blockText.includes('ZodError')) {\n zodErrorVars.add(param.getName());\n }\n }\n }\n\n // Check for .safeParse() result — the error is in result.error\n if (Node.isVariableDeclaration(node)) {\n const initializer = node.getInitializer();\n if (initializer?.getText().includes('.safeParse(')) {\n zodErrorVars.add(`${node.getName()}.error`);\n }\n }\n\n // Check for new ZodError patterns\n if (Node.isNewExpression(node)) {\n if (node.getExpression().getText() === 'ZodError') {\n const parent = node.getParent();\n if (parent && Node.isVariableDeclaration(parent)) {\n zodErrorVars.add(parent.getName());\n }\n }\n }\n });\n\n return zodErrorVars;\n }\n\n /**\n * Transform error.errors to error.issues using AST-based detection\n * instead of heuristic name matching.\n */\n private transformErrorProperties(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n // Now transform .errors -> .issues only on identified ZodError variables\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node)) {\n const name = node.getName();\n if (name === 'errors') {\n const object = node.getExpression();\n const objectText = object.getText();\n\n // Check if this object is a known ZodError variable\n const isZodError =\n zodErrorVars.has(objectText) ||\n // Also check if accessing .error.errors (safeParse pattern)\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n const fullText = node.getText();\n const newText = fullText.replace(/\\.errors$/, '.issues');\n node.replaceWithText(newText);\n\n this.warnings.push(\n `${filePath}:${node.getStartLineNumber()}: ` +\n '.errors renamed to .issues (ZodError property change)',\n );\n }\n }\n }\n });\n }\n\n /**\n * Auto-transform error.flatten() to z.flattenError(error) in v4.\n */\n private transformFlatten(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n objectText: string;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'flatten') {\n const objectText = expression.getExpression().getText();\n const isZodError =\n zodErrorVars.has(objectText) ||\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n nodesToTransform.push({\n node,\n objectText,\n lineNumber: node.getStartLineNumber(),\n });\n } else {\n this.warnings.push(\n `${filePath}:${node.getStartLineNumber()}: .flatten() is removed in v4. ` +\n 'Use z.flattenError(error) or access error.issues directly. ' +\n 'See: https://zod.dev/v4/changelog',\n );\n }\n }\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, objectText, lineNumber } of nodesToTransform) {\n node.replaceWithText(`z.flattenError(${objectText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .flatten() auto-transformed to z.flattenError(). ` +\n 'Removed in v4 — now a standalone function.',\n );\n }\n }\n\n /**\n * Auto-transform error.format() to z.treeifyError(error) in v4.\n */\n private transformFormat(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n objectText: string;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'format') {\n const objectText = expression.getExpression().getText();\n const isZodError =\n zodErrorVars.has(objectText) ||\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n nodesToTransform.push({\n node,\n objectText,\n lineNumber: node.getStartLineNumber(),\n });\n }\n // Skip non-ZodError .format() calls to avoid false positives\n }\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, objectText, lineNumber } of nodesToTransform) {\n node.replaceWithText(`z.treeifyError(${objectText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .format() auto-transformed to z.treeifyError(). ` +\n 'Removed in v4 — now a standalone function.',\n );\n }\n }\n\n /**\n * Auto-transform ._def property access to ._zod.def in v4.\n */\n private transformDefAccess(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').PropertyAccessExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node) && node.getName() === '_def') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const objectText = node.getExpression().getText();\n node.replaceWithText(`${objectText}._zod.def`);\n this.warnings.push(\n `${filePath}:${lineNumber}: ._def auto-transformed to ._zod.def. ` +\n 'Internal API — structure may change between releases.',\n );\n }\n }\n\n /**\n * Transform .merge(otherSchema) to .extend(otherSchema.shape)\n */\n private transformMerge(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{ node: import('ts-morph').CallExpression; lineNumber: number }> =\n [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'merge') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n });\n\n // Process in reverse order\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const args = node.getArguments();\n if (args.length === 1) {\n const argText = args[0]?.getText();\n if (argText) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const objectText = expression.getExpression().getText();\n node.replaceWithText(`${objectText}.extend(${argText}.shape)`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .merge() renamed to .extend() with .shape access. ` +\n 'Verify the merged schema exposes .shape.',\n );\n }\n }\n }\n }\n }\n\n /**\n * Transform z.nativeEnum(X) to z.enum(X)\n */\n private transformNativeEnum(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n const newText = fullText.replace(/\\bz\\.nativeEnum\\(/g, 'z.enum(');\n if (newText !== fullText) {\n sourceFile.replaceWithText(newText);\n this.warnings.push(\n `${filePath}: z.nativeEnum() renamed to z.enum() in v4. ` +\n 'Verify enum values are compatible.',\n );\n }\n }\n\n /**\n * Check for deprecated methods and add warnings\n */\n private checkDeprecatedMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (DEPRECATED_METHODS.has(name) && !AUTO_TRANSFORMABLE.has(name)) {\n const lineNumber = node.getStartLineNumber();\n switch (name) {\n case 'strict':\n this.warnings.push(\n `${filePath}:${lineNumber}: .strict() is deprecated in v4. ` +\n 'Use z.strictObject() instead.',\n );\n break;\n case 'passthrough':\n this.warnings.push(\n `${filePath}:${lineNumber}: .passthrough() is deprecated in v4. ` +\n 'Use z.looseObject() instead.',\n );\n break;\n // merge is handled by transformMerge\n }\n }\n }\n }\n });\n }\n\n /**\n * Auto-transform .superRefine() to .check() — callback signature is identical.\n */\n private transformSuperRefine(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').PropertyAccessExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node) && node.getName() === 'superRefine') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n });\n\n // Process in reverse to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const parent = node.getParent();\n if (parent && Node.isCallExpression(parent)) {\n const objectText = node.getExpression().getText();\n const args = parent.getArguments();\n let argsText = args.map((a) => a.getText()).join(', ');\n\n // Also transform ctx.addIssue() -> ctx.issues.push() inside the callback\n if (args.length > 0) {\n const callbackText = args[0]?.getText() ?? '';\n // Detect the context parameter name (2nd param in arrow/function)\n const paramMatch = callbackText.match(\n /^\\s*\\(?\\s*\\w+\\s*,\\s*(\\w+)\\s*\\)?(?:\\s*:\\s*[^)]+)?\\s*=>/,\n );\n if (paramMatch?.[1]) {\n const ctxName = paramMatch[1];\n const addIssuePattern = new RegExp(`${ctxName}\\\\.addIssue\\\\(`, 'g');\n if (addIssuePattern.test(callbackText)) {\n argsText = callbackText.replace(\n new RegExp(`${ctxName}\\\\.addIssue\\\\(`, 'g'),\n `${ctxName}.issues.push(`,\n );\n // Re-add remaining args if any\n if (args.length > 1) {\n const remaining = args\n .slice(1)\n .map((a) => a.getText())\n .join(', ');\n argsText = `${argsText}, ${remaining}`;\n }\n }\n }\n }\n\n parent.replaceWithText(`${objectText}.check(${argsText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .superRefine() auto-transformed to .check() (deprecated in v4).`,\n );\n }\n }\n }\n\n /**\n * Auto-transform invalid_type_error/required_error params to unified `error` param.\n */\n private transformErrorParams(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').ObjectLiteralExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isObjectLiteralExpression(node)) {\n const properties = node.getProperties();\n const propNames = properties\n .filter((p) => Node.isPropertyAssignment(p))\n .map((p) => (Node.isPropertyAssignment(p) ? p.getName() : ''));\n\n const hasInvalidType = propNames.includes('invalid_type_error');\n const hasRequired = propNames.includes('required_error');\n\n if (hasInvalidType || hasRequired) {\n // Only transform if this is an argument to a z.xxx() factory call\n const parent = node.getParent();\n if (parent && Node.isCallExpression(parent)) {\n const expr = parent.getExpression();\n if (Node.isPropertyAccessExpression(expr) && expr.getExpression().getText() === 'z') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n }\n }\n });\n\n // Process in reverse to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const properties = node.getProperties();\n let invalidTypeValue: string | undefined;\n let requiredValue: string | undefined;\n const otherProps: string[] = [];\n\n for (const prop of properties) {\n if (Node.isPropertyAssignment(prop)) {\n const name = prop.getName();\n const value = prop.getInitializer()?.getText() ?? '';\n if (name === 'invalid_type_error') {\n invalidTypeValue = value;\n } else if (name === 'required_error') {\n requiredValue = value;\n } else {\n otherProps.push(prop.getText());\n }\n }\n }\n\n let errorValue: string;\n if (invalidTypeValue && requiredValue) {\n // Both present: generate error function\n errorValue = `error: (issue) => issue.input === undefined ? ${requiredValue} : ${invalidTypeValue}`;\n } else if (requiredValue) {\n errorValue = `error: ${requiredValue}`;\n } else if (invalidTypeValue) {\n errorValue = `error: ${invalidTypeValue}`;\n } else {\n continue;\n }\n\n const allProps = [errorValue, ...otherProps].join(', ');\n node.replaceWithText(`{ ${allProps} }`);\n\n this.warnings.push(\n `${filePath}:${lineNumber}: invalid_type_error/required_error auto-transformed to unified error param.`,\n );\n }\n }\n\n /**\n * Detect instanceof Error patterns in catch blocks that reference ZodError.\n * In v4, ZodError no longer extends Error.\n */\n private checkInstanceofError(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCatchClause(node)) {\n const block = node.getBlock();\n const blockText = block.getText();\n\n // Check if the catch block references ZodError AND uses instanceof Error\n if (blockText.includes('ZodError') && blockText.includes('instanceof Error')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: ZodError no longer extends Error in v4. ` +\n '`instanceof Error` checks on ZodError will return false. ' +\n 'Use `instanceof ZodError` or check for `.issues` property instead.',\n );\n }\n }\n });\n }\n\n /**\n * Detect .refine()/.superRefine() followed by .transform() in the same chain.\n * In v4, .transform() runs even when .refine() fails.\n */\n private checkTransformRefineOrder(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'transform') {\n // Walk up the chain to see if .refine() or .superRefine() precedes\n const chainText = node.getText();\n if (\n chainText.includes('.refine(') ||\n chainText.includes('.superRefine(') ||\n chainText.includes('.check(')\n ) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: In v4, .transform() executes even if preceding .refine() fails. ` +\n 'Consider using .pipe() to sequence validation before transforms.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Detect .default() combined with .optional() — behavior changed silently in v4.\n * In v4, .default() always provides a value, making .optional() a no-op.\n */\n private checkDefaultOptional(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (\n Node.isPropertyAccessExpression(expression) &&\n (expression.getName() === 'optional' || expression.getName() === 'default')\n ) {\n const chainText = node.getText();\n const hasDefault = chainText.includes('.default(');\n const hasOptional = chainText.includes('.optional(');\n\n if (hasDefault && hasOptional) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .default() + .optional() behavior changed in v4. ` +\n '.default() now always provides a value, making .optional() effectively a no-op. ' +\n 'Review whether .optional() is still needed.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Check for methods with behavior changes and add warnings\n */\n private checkBehaviorChanges(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n\n if (BEHAVIOR_CHANGES.has(name)) {\n const lineNumber = node.getStartLineNumber();\n\n switch (name) {\n case 'default':\n this.warnings.push(\n `${filePath}:${lineNumber}: .default() has stricter type inference in v4. ` +\n 'Verify default value matches schema type exactly.',\n );\n break;\n\n case 'uuid':\n this.warnings.push(\n `${filePath}:${lineNumber}: .uuid() now enforces strict RFC 4122 compliance. ` +\n 'Non-standard UUIDs may fail validation.',\n );\n break;\n\n case 'discriminatedUnion':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.discriminatedUnion() now requires ` +\n 'a literal type for the discriminator property.',\n );\n break;\n\n case 'function':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.function() parameter handling has changed. ` +\n 'Review input/output schema definitions.',\n );\n break;\n\n case 'pipe':\n this.warnings.push(\n `${filePath}:${lineNumber}: .pipe() has stricter type checking in v4. ` +\n 'If you get type errors, add explicit type annotations to .transform() return types ' +\n 'or cast through unknown as a last resort.',\n );\n break;\n }\n }\n }\n }\n });\n }\n\n /**\n * Detect .catch() combined with .optional() — behavior changed in v4.\n * In v4, .catch() on optional properties always returns the catch value.\n */\n private checkCatchOptional(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (\n Node.isPropertyAccessExpression(expression) &&\n (expression.getName() === 'optional' || expression.getName() === 'catch')\n ) {\n const chainText = node.getText();\n if (chainText.includes('.catch(') && chainText.includes('.optional(')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .catch() + .optional() behavior changed in v4. ` +\n '.catch() on optional properties now always returns the catch value, ' +\n 'even when the property is absent from input.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Detect imports of utility types that moved to 'zod/v4/core' in v4.\n */\n private checkUtilityTypeImports(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n for (const importDecl of sourceFile.getImportDeclarations()) {\n const moduleSpecifier = importDecl.getModuleSpecifierValue();\n if (moduleSpecifier !== 'zod') continue;\n\n const namedImports = importDecl.getNamedImports();\n for (const namedImport of namedImports) {\n const name = namedImport.getName();\n if (UTILITY_TYPES.has(name)) {\n const lineNumber = importDecl.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: '${name}' may need to be imported from 'zod/v4/core' in v4. ` +\n 'Internal utility types have moved to a separate subpackage.',\n );\n }\n }\n }\n }\n\n /**\n * Warn about string format methods that moved to top-level functions in v4.\n * e.g., z.string().email() → z.email() (instance methods are deprecated but still work)\n */\n private checkStringFormatMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (STRING_FORMAT_TO_TOPLEVEL.has(name)) {\n // Check if this is chained on z.string()\n const chainText = node.getText();\n if (chainText.includes('z.string()') || chainText.includes('.string()')) {\n const topLevel = STRING_FORMAT_TO_TOPLEVEL.get(name);\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .${name}() is deprecated as an instance method in v4. ` +\n `Use ${topLevel} as a top-level function instead. The instance method still works but may be removed in future versions.`,\n );\n }\n }\n }\n }\n });\n }\n\n /**\n * Check for deprecated factory functions (z.promise(), z.ostring(), etc.)\n */\n private checkDeprecatedFactories(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n const object = expression.getExpression();\n\n if (object.getText() === 'z' && DEPRECATED_FACTORIES.has(name)) {\n const lineNumber = node.getStartLineNumber();\n switch (name) {\n case 'promise':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.promise() is deprecated in v4. ` +\n 'Await values before parsing instead of wrapping in z.promise().',\n );\n break;\n case 'ostring':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.ostring() is removed in v4. ` +\n 'Use z.string().optional() instead.',\n );\n break;\n case 'onumber':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.onumber() is removed in v4. ` +\n 'Use z.number().optional() instead.',\n );\n break;\n case 'oboolean':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.oboolean() is removed in v4. ` +\n 'Use z.boolean().optional() instead.',\n );\n break;\n case 'preprocess':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.preprocess() is removed in v4. ` +\n 'Use z.pipe(z.unknown(), z.transform(fn), targetSchema) instead.',\n );\n break;\n }\n }\n }\n }\n });\n }\n\n /**\n * Transform z.function().args().returns() to z.function({ input, output }) in v4.\n */\n private transformFunctionValidation(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (name === 'args' || name === 'returns') {\n // Check if this is part of a z.function() chain\n const chainText = node.getText();\n if (\n chainText.includes('z.function()') &&\n (chainText.includes('.args(') || chainText.includes('.returns('))\n ) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: z.function().args().returns() is removed in v4. ` +\n 'Use z.function({ input: z.tuple([...]), output: schema }) instead. ' +\n 'The result is no longer a Zod schema — use .implement() to wrap functions.',\n );\n }\n }\n }\n }\n });\n }\n\n /**\n * Transform z.ostring(), z.onumber(), z.oboolean() to explicit .optional() calls.\n */\n private transformOptionalShorthands(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n const replacements: Array<{ pattern: RegExp; replacement: string; name: string }> = [\n { pattern: /\\bz\\.ostring\\(\\)/g, replacement: 'z.string().optional()', name: 'z.ostring()' },\n { pattern: /\\bz\\.onumber\\(\\)/g, replacement: 'z.number().optional()', name: 'z.onumber()' },\n {\n pattern: /\\bz\\.oboolean\\(\\)/g,\n replacement: 'z.boolean().optional()',\n name: 'z.oboolean()',\n },\n ];\n\n let newText = fullText;\n for (const { pattern, replacement, name } of replacements) {\n if (pattern.test(newText)) {\n newText = newText.replace(pattern, replacement);\n this.warnings.push(\n `${filePath}: ${name} auto-transformed to ${replacement}. Removed in v4.`,\n );\n }\n }\n\n if (newText !== fullText) {\n sourceFile.replaceWithText(newText);\n }\n }\n\n /**\n * Check for .nonempty() which has a type inference change in v4.\n * v3: [string, ...string[]] (tuple with rest)\n * v4: string[] (matches .min(1))\n */\n private checkNonemptyTypeChange(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'nonempty') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .nonempty() type inference changed in v4. ` +\n 'v3 inferred [T, ...T[]] (tuple with rest), v4 infers T[] (same as .min(1)). ' +\n 'If you rely on the tuple type, use z.tuple([z.string()], z.string()) instead.',\n );\n }\n }\n });\n }\n\n /**\n * Check for z.coerce.* usage — input type changed to unknown in v4.\n */\n private checkCoerceInputType(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n if (fullText.includes('z.coerce.')) {\n // Find line numbers for each occurrence\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node)) {\n const text = node.getText();\n if (text.startsWith('z.coerce.')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: z.coerce.* input type changed to 'unknown' in v4. ` +\n 'Previously, z.coerce.string() had input type string. ' +\n 'This enables more accurate type inference but may affect type guards.',\n );\n }\n }\n });\n }\n }\n\n /**\n * Check for .deepPartial() which was removed entirely in v4.\n */\n private checkDeepPartialRemoval(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'deepPartial') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .deepPartial() is removed in v4. ` +\n 'This was a long-deprecated anti-pattern. Use recursive partial types or ' +\n 'restructure schemas to avoid deep partial requirements.',\n );\n }\n }\n });\n }\n\n /**\n * Check for .strip() which is deprecated in v4 (it was the default behavior).\n */\n private checkStripDeprecation(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'strip') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .strip() is deprecated in v4 (it was the default behavior). ` +\n 'Remove .strip() — z.object() strips unknown keys by default. ' +\n 'To convert a strict object back to stripping, use z.object(schema.shape).',\n );\n }\n }\n });\n }\n\n /**\n * Check for errorMap usage patterns where precedence changed in v4.\n * In v4, schema-level error maps take precedence over parse-time error maps (inverted from v3).\n */\n private checkErrorMapPrecedence(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n // Check if file uses both schema-level and parse-time error maps\n const hasSchemaErrorMap = fullText.includes('errorMap:') || fullText.includes('error:');\n const hasParseErrorMap =\n (fullText.includes('.parse(') && fullText.includes('errorMap')) ||\n (fullText.includes('.safeParse(') && fullText.includes('errorMap'));\n\n if (hasSchemaErrorMap && hasParseErrorMap) {\n this.warnings.push(\n `${filePath}: Error map precedence changed in v4. ` +\n 'Schema-level error maps now take precedence over parse-time error maps (inverted from v3). ' +\n 'Review error map usage to ensure correct error messages.',\n );\n }\n }\n\n /**\n * Check for ctx.addIssue() / ctx.addIssues() which are deprecated in v4.\n */\n private checkAddIssueMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n if (fullText.includes('.addIssue(') || fullText.includes('.addIssues(')) {\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (name === 'addIssue' || name === 'addIssues') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .${name}() is deprecated in v4. ` +\n 'Directly manipulate the issues array instead: ctx.issues.push({...}). ' +\n 'Note: .superRefine() callbacks using addIssue should migrate to .check() with issues.push().',\n );\n }\n }\n }\n });\n }\n }\n}\n","/**\n * Zod v3 to v4 Breaking Changes\n *\n * Key changes in Zod v4:\n * 1. z.record() now requires explicit key type\n * 2. .default() has stricter type inference (matches output type, not input)\n * 3. error.errors renamed to error.issues\n * 4. .uuid() has stricter validation (RFC 9562/4122 compliant)\n * 5. z.function() completely overhauled — .args()/.returns() removed\n * 6. Branded types use different syntax\n * 7. z.discriminatedUnion() requires literal discriminator\n * 8. String format methods moved to top-level (e.g., .email() → z.email())\n * 9. .deepPartial() removed (was deprecated anti-pattern)\n * 10. z.promise() deprecated (await values before parsing)\n * 11. .strip() deprecated (default behavior)\n * 12. .nonempty() type inference changed (no longer tuple type)\n * 13. z.coerce.* input type changed to unknown\n * 14. z.partialRecord() added for optional key behavior\n * 15. z.guid() added for lenient UUID matching\n * 16. z.iso.* validators for date/time/datetime/duration\n * 17. .prefault() added (restores v3 .default() parse behavior)\n * 18. .addIssue()/.addIssues() deprecated in favor of issues.push()\n * 19. ZodError precedence reversal: schema-level error maps override parse-time\n * 20. z.ostring()/z.onumber() etc. removed (optional shorthands)\n */\n\n// Patterns that need transformation\nexport const V3_TO_V4_PATTERNS = {\n // z.record(valueSchema) -> z.record(z.string(), valueSchema)\n recordSingleArg: /z\\.record\\((?!z\\.string\\(\\)|z\\.number\\(\\)|z\\.symbol\\(\\))/g,\n\n // error.errors -> error.issues\n errorErrors: /\\.errors\\b/g,\n\n // .brand<T>() -> .brand<T>() (same but check for proper usage)\n brandUsage: /\\.brand<([^>]+)>\\(\\)/g,\n};\n\n// Methods that have changed behavior\nexport const BEHAVIOR_CHANGES = new Set([\n 'default', // Type inference changed; now matches output type, use .prefault() for v3 behavior\n 'uuid', // Stricter RFC 9562/4122 validation; use z.guid() for lenient matching\n 'record', // Requires key type\n 'discriminatedUnion', // Stricter discriminator requirements\n 'function', // Complete overhaul — .args()/.returns() removed\n 'pipe', // Stricter type checking in v4\n 'catch', // .catch() on optional properties always returns catch value in v4\n 'nonempty', // Type inference changed: string[] instead of [string, ...string[]]\n 'coerce', // Input type changed to unknown for all z.coerce.* schemas\n]);\n\n// Error property renames\nexport const ERROR_RENAMES: Record<string, string> = {\n errors: 'issues',\n formErrors: 'formErrors', // Unchanged\n fieldErrors: 'fieldErrors', // Unchanged\n};\n\n// Methods that are deprecated in v4\nexport const DEPRECATED_METHODS = new Set([\n 'merge', // Use .extend() instead\n 'superRefine', // Use .check() instead\n 'strict', // Use z.strictObject() instead\n 'passthrough', // Use z.looseObject() instead\n 'deepPartial', // Removed entirely — was deprecated anti-pattern\n 'strip', // Deprecated — default behavior in v4\n 'nonstrict', // Removed entirely\n]);\n\n// Factory functions deprecated/removed in v4\nexport const DEPRECATED_FACTORIES = new Set([\n 'promise', // z.promise() deprecated — await values before parsing\n 'ostring', // z.ostring() removed (optional shorthand)\n 'onumber', // z.onumber() removed\n 'oboolean', // z.oboolean() removed\n 'preprocess', // z.preprocess() removed — use z.pipe() instead\n]);\n\n// Method renames in v4\nexport const METHOD_RENAMES: Record<string, string> = {\n merge: 'extend',\n};\n\n// Factory function renames in v4\nexport const FACTORY_RENAMES: Record<string, string> = {\n nativeEnum: 'enum',\n};\n\n// Error params that changed in v4 (unified under `error`)\nexport const ERROR_PARAM_NAMES = new Set(['invalid_type_error', 'required_error']);\n\n// Methods that can be automatically transformed (renamed) in v4\nexport const AUTO_TRANSFORMABLE = new Set([\n 'superRefine', // -> .check()\n 'flatten', // error.flatten() -> z.flattenError(error)\n 'format', // error.format() -> z.treeifyError(error)\n]);\n\n// Utility types that moved to 'zod/v4/core' in v4\nexport const UTILITY_TYPES = new Set([\n 'ZodType',\n 'ZodSchema',\n 'ZodRawShape',\n 'ZodTypeAny',\n 'ZodFirstPartyTypeKind',\n]);\n\n// String format methods that moved from instance methods to top-level functions\nexport const STRING_FORMAT_TO_TOPLEVEL = new Map<string, string>([\n ['email', 'z.email()'],\n ['url', 'z.url()'],\n ['uuid', 'z.uuid()'],\n ['emoji', 'z.emoji()'],\n ['nanoid', 'z.nanoid()'],\n ['cuid', 'z.cuid()'],\n ['cuid2', 'z.cuid2()'],\n ['ulid', 'z.ulid()'],\n ['ipv4', 'z.ipv4()'],\n ['ipv6', 'z.ipv6()'],\n ['cidrv4', 'z.cidrv4()'],\n ['cidrv6', 'z.cidrv6()'],\n ['base64', 'z.base64()'],\n ['base64url', 'z.base64url()'],\n]);\n\n// New ISO validators in v4 (informational — no transform needed, just awareness)\nexport const NEW_ISO_VALIDATORS = new Set([\n 'z.iso.date()',\n 'z.iso.time()',\n 'z.iso.datetime()',\n 'z.iso.duration()',\n]);\n\n// Runtime behavior patterns that silently break in v4 (no compile-time error)\nexport const RUNTIME_BREAK_PATTERNS = new Set([\n 'instanceofError', // ZodError no longer extends Error\n 'transformAfterRefine', // .transform() runs even when .refine() fails\n 'defaultOptional', // .default() + .optional() behavior change\n 'errorMapPrecedence', // Schema-level error maps now override parse-time\n 'nonemptyType', // .nonempty() returns string[] instead of [string, ...string[]]\n 'coerceInputType', // z.coerce.* input is now unknown instead of specific type\n]);\n","import type { TransformHandler, TransformOptions, TransformResult } from '@schemashift/core';\nimport type { SourceFile } from 'ts-morph';\nimport { ZodV3ToV4Transformer } from './transformer.js';\n\nexport function createZodV3ToV4Handler(): TransformHandler {\n const transformer = new ZodV3ToV4Transformer();\n return {\n transform(sourceFile: SourceFile, _options: TransformOptions): TransformResult {\n return transformer.transform(sourceFile);\n },\n };\n}\n"],"mappings":";AAgCA,IAAM,yBAA8C;AAAA,EAClD;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OACE;AAAA,IACF,cAAc;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,IACP,cAAc;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA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AAS,WAAW,KAAK,SAAS,SAAS,QAAQ;AACtF,UAAM,mBACH,SAAS,SAAS,SAAS,KAAK,SAAS,SAAS,UAAU,KAC5D,SAAS,SAAS,aAAa,KAAK,SAAS,SAAS,UAAU;AAEnE,QAAI,qBAAqB,kBAAkB;AACzC,WAAK,SAAS;AAAA,QACZ,GAAG,QAAQ;AAAA,MAGb;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKQ,qBAAqB,YAA8B;AACzD,UAAM,WAAW,WAAW,YAAY;AACxC,UAAM,WAAW,WAAW,YAAY;AAExC,QAAI,SAAS,SAAS,YAAY,KAAK,SAAS,SAAS,aAAa,GAAG;AACvE,iBAAW,kBAAkB,CAAC,SAAS;AACrC,YAAI,KAAK,iBAAiB,IAAI,GAAG;AAC/B,gBAAM,aAAa,KAAK,cAAc;AACtC,cAAI,KAAK,2BAA2B,UAAU,GAAG;AAC/C,kBAAM,OAAO,WAAW,QAAQ;AAChC,gBAAI,SAAS,cAAc,SAAS,aAAa;AAC/C,oBAAM,aAAa,KAAK,mBAAmB;AAC3C,mBAAK,SAAS;AAAA,gBACZ,GAAG,QAAQ,IAAI,UAAU,MAAM,IAAI;AAAA,cAGrC;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AE3gCO,SAAS,yBAA2C;AACzD,QAAM,cAAc,IAAI,qBAAqB;AAC7C,SAAO;AAAA,IACL,UAAU,YAAwB,UAA6C;AAC7E,aAAO,YAAY,UAAU,UAAU;AAAA,IACzC;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/behavior-test-generator.ts","../src/transformer.ts","../src/mappings.ts","../src/handler.ts"],"sourcesContent":["/**\n * Zod v4 Behavioral Test Generator\n *\n * Detects silent behavioral changes between Zod v3 and v4 and generates\n * regression tests to catch them.\n */\n\nexport interface BehavioralPattern {\n name: string;\n description: string;\n regex: RegExp;\n testTemplate: string;\n}\n\nexport interface DetectedPattern {\n pattern: BehavioralPattern;\n filePath: string;\n lineNumber: number;\n matchedText: string;\n}\n\nexport interface GeneratedBehaviorTest {\n filePath: string;\n testCode: string;\n patterns: string[];\n}\n\nexport interface BehaviorTestResult {\n tests: GeneratedBehaviorTest[];\n totalPatterns: number;\n}\n\nconst V4_BEHAVIORAL_PATTERNS: BehavioralPattern[] = [\n {\n name: 'default-optional',\n description: '.default() + .optional() behaves differently in v4',\n regex:\n /\\.default\\([^)]*\\)[\\s\\S]{0,20}\\.optional\\(\\)|\\.optional\\(\\)[\\s\\S]{0,20}\\.default\\([^)]*\\)/,\n testTemplate: [\n \" it('verifies .default() + .optional() behavior (v4 change)', () => {\",\n ' // v3: undefined input returns undefined (.optional() wins)',\n ' // v4: undefined input returns default value (.default() always applies)',\n \" const schema = z.string().default('fallback').optional();\",\n ' const result = schema.parse(undefined);',\n \" expect(result).toBe('fallback');\",\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-instanceof',\n description: 'ZodError no longer extends Error in v4',\n regex: /instanceof\\s+Error|instanceof\\s+ZodError/,\n testTemplate: [\n \" it('verifies ZodError instanceof check (v4 change)', () => {\",\n ' // v3: ZodError extends Error',\n ' // v4: ZodError does NOT extend Error',\n ' try {',\n ' z.string().parse(123);',\n ' } catch (e) {',\n ' expect(e).toBeDefined();',\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'transform-after-refine',\n description: '.transform() after .refine() may change execution order in v4',\n regex: /\\.refine\\([^)]*\\)[\\s\\S]{0,30}\\.transform\\(/,\n testTemplate: [\n \" it('verifies .refine() then .transform() ordering (v4 change)', () => {\",\n ' const schema = z.string()',\n \" .refine((val) => val.length > 0, 'Must not be empty')\",\n ' .transform((val) => val.toUpperCase());',\n \" const result = schema.safeParse('hello');\",\n ' expect(result.success).toBe(true);',\n ' if (result.success) {',\n \" expect(result.data).toBe('HELLO');\",\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'catch-optional',\n description: '.catch() + .optional() interaction changed in v4',\n regex: /\\.catch\\([^)]*\\)[\\s\\S]{0,20}\\.optional\\(\\)|\\.optional\\(\\)[\\s\\S]{0,20}\\.catch\\([^)]*\\)/,\n testTemplate: [\n \" it('verifies .catch() + .optional() behavior (v4 change)', () => {\",\n \" const schema = z.string().catch('default').optional();\",\n ' const result = schema.parse(undefined);',\n ' expect(result).toBeDefined();',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-message-format',\n description: 'Error messages changed from \"Required\" to descriptive messages',\n regex: /['\"]Required['\"]/,\n testTemplate: [\n \" it('verifies error message format (v4 change)', () => {\",\n ' // v3: \"Required\" for missing fields',\n ' // v4: \"Invalid input: expected string, received undefined\"',\n ' const schema = z.object({ name: z.string() });',\n ' const result = schema.safeParse({});',\n ' expect(result.success).toBe(false);',\n ' if (!result.success) {',\n \" const msg = result.error.issues[0]?.message ?? '';\",\n ' expect(msg.length).toBeGreaterThan(0);',\n ' }',\n ' });',\n ].join('\\n'),\n },\n {\n name: 'error-flatten',\n description: 'error.flatten() moved to z.flattenError(error) in v4',\n regex: /\\.flatten\\(\\)/,\n testTemplate: [\n \" it('verifies error flattening (v4 change)', () => {\",\n ' // v3: error.flatten()',\n ' // v4: z.flattenError(error)',\n ' const schema = z.object({ name: z.string() });',\n ' const result = schema.safeParse({});',\n ' if (!result.success) {',\n ' expect(result.error).toBeDefined();',\n ' }',\n ' });',\n ].join('\\n'),\n },\n];\n\n/**\n * Detect v4 behavioral patterns in source code.\n */\nexport function detectBehavioralPatterns(sourceCode: string, filePath: string): DetectedPattern[] {\n const results: DetectedPattern[] = [];\n const lines = sourceCode.split('\\n');\n\n for (const pattern of V4_BEHAVIORAL_PATTERNS) {\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? '';\n if (pattern.regex.test(line)) {\n results.push({\n pattern,\n filePath,\n lineNumber: i + 1,\n matchedText: line.trim(),\n });\n }\n }\n\n // Multi-line match fallback\n if (\n pattern.regex.test(sourceCode) &&\n !results.some((r) => r.pattern.name === pattern.name && r.filePath === filePath)\n ) {\n const match = pattern.regex.exec(sourceCode);\n if (match) {\n const lineNumber = sourceCode.slice(0, match.index).split('\\n').length;\n results.push({\n pattern,\n filePath,\n lineNumber,\n matchedText: match[0].trim().slice(0, 80),\n });\n }\n }\n }\n\n return results;\n}\n\n/**\n * Generate behavioral regression tests for detected patterns.\n */\nexport function generateBehaviorTests(\n files: Array<{ filePath: string; sourceCode: string }>,\n): BehaviorTestResult {\n const allPatterns: DetectedPattern[] = [];\n const testsByFile = new Map<string, Set<string>>();\n\n for (const { filePath, sourceCode } of files) {\n const detected = detectBehavioralPatterns(sourceCode, filePath);\n allPatterns.push(...detected);\n\n for (const d of detected) {\n const existing = testsByFile.get(filePath) ?? new Set();\n existing.add(d.pattern.name);\n testsByFile.set(filePath, existing);\n }\n }\n\n const tests: GeneratedBehaviorTest[] = [];\n\n for (const [filePath, patternNames] of testsByFile) {\n const patterns = [...patternNames];\n const testBlocks = patterns\n .map((name) => V4_BEHAVIORAL_PATTERNS.find((p) => p.name === name)?.testTemplate ?? '')\n .filter(Boolean);\n\n if (testBlocks.length === 0) continue;\n\n const shortPath = filePath.split('/').slice(-2).join('/');\n const testCode = [\n \"import { describe, expect, it } from 'vitest';\",\n \"import { z } from 'zod';\",\n '',\n '/**',\n ' * Behavioral regression tests for Zod v3 to v4 migration',\n ` * Source: ${shortPath}`,\n ' * Generated by SchemaShift',\n ' */',\n `describe('v4 behavioral changes: ${shortPath}', () => {`,\n ...testBlocks.map((b) => b),\n '});',\n ].join('\\n');\n\n tests.push({ filePath, testCode, patterns });\n }\n\n return { tests, totalPatterns: allPatterns.length };\n}\n","import type { TransformError, TransformResult } from '@schemashift/core';\nimport { Node, type SourceFile } from 'ts-morph';\nimport {\n AUTO_TRANSFORMABLE,\n BEHAVIOR_CHANGES,\n DEPRECATED_FACTORIES,\n DEPRECATED_METHODS,\n STRING_FORMAT_TO_TOPLEVEL,\n UTILITY_TYPES,\n} from './mappings.js';\n\n/**\n * Zod v3 to v4 Transformer\n *\n * Handles breaking changes between Zod v3 and v4:\n * - z.record() now requires explicit key type\n * - error.errors -> error.issues\n * - Stricter UUID validation\n * - Type inference changes in .default()\n * - .flatten() removed\n * - z.preprocess() -> z.pipe() migration\n */\nexport class ZodV3ToV4Transformer {\n private errors: TransformError[] = [];\n private warnings: string[] = [];\n\n transform(sourceFile: SourceFile): TransformResult {\n this.errors = [];\n this.warnings = [];\n\n const filePath = sourceFile.getFilePath();\n const originalCode = sourceFile.getFullText();\n\n try {\n this.transformRecordCalls(sourceFile);\n this.transformMerge(sourceFile);\n this.transformNativeEnum(sourceFile);\n this.transformSuperRefine(sourceFile);\n this.transformErrorProperties(sourceFile);\n this.transformErrorParams(sourceFile);\n this.transformFlatten(sourceFile);\n this.transformFormat(sourceFile);\n this.transformDefAccess(sourceFile);\n this.transformFunctionValidation(sourceFile);\n this.transformOptionalShorthands(sourceFile);\n this.transformPreprocess(sourceFile);\n this.checkDeprecatedMethods(sourceFile);\n this.checkDeprecatedFactories(sourceFile);\n this.checkStringFormatMethods(sourceFile);\n this.checkBehaviorChanges(sourceFile);\n this.checkInstanceofError(sourceFile);\n this.checkTransformRefineOrder(sourceFile);\n this.checkDefaultOptional(sourceFile);\n this.checkCatchOptional(sourceFile);\n this.checkUtilityTypeImports(sourceFile);\n this.checkNonemptyTypeChange(sourceFile);\n this.checkCoerceInputType(sourceFile);\n this.checkDeepPartialRemoval(sourceFile);\n this.checkStripDeprecation(sourceFile);\n this.checkErrorMapPrecedence(sourceFile);\n this.checkAddIssueMethods(sourceFile);\n\n return {\n success: this.errors.length === 0,\n filePath,\n originalCode,\n transformedCode: sourceFile.getFullText(),\n errors: this.errors,\n warnings: this.warnings,\n };\n } catch (error) {\n this.errors.push({\n message: error instanceof Error ? error.message : 'Unknown error',\n });\n return {\n success: false,\n filePath,\n originalCode,\n errors: this.errors,\n warnings: this.warnings,\n };\n }\n }\n\n /**\n * Transform z.record(valueSchema) to z.record(z.string(), valueSchema)\n */\n private transformRecordCalls(sourceFile: SourceFile): void {\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n const object = expression.getExpression();\n\n if (name === 'record' && object.getText() === 'z') {\n const args = node.getArguments();\n\n // If only one argument, add z.string() as key type\n if (args.length === 1) {\n const valueSchema = args[0]?.getText();\n if (valueSchema) {\n node.replaceWithText(`z.record(z.string(), ${valueSchema})`);\n\n this.warnings.push(\n `${sourceFile.getFilePath()}:${node.getStartLineNumber()}: ` +\n 'z.record() updated to include explicit key type z.string()',\n );\n }\n }\n }\n }\n }\n });\n }\n\n /**\n * Build a set of variable names that are likely ZodError instances.\n * Used by transformErrorProperties, transformFlatten, and transformFormat.\n */\n private buildZodErrorVarSet(sourceFile: SourceFile): Set<string> {\n const zodErrorVars = new Set<string>();\n\n sourceFile.forEachDescendant((node) => {\n // Check variable declarations with ZodError type annotation\n if (Node.isVariableDeclaration(node)) {\n const typeNode = node.getTypeNode();\n if (typeNode?.getText().includes('ZodError')) {\n zodErrorVars.add(node.getName());\n }\n }\n\n // Check catch clause parameters\n if (Node.isCatchClause(node)) {\n const param = node.getVariableDeclaration();\n if (param) {\n const block = node.getBlock();\n const blockText = block.getText();\n if (blockText.includes('instanceof ZodError') || blockText.includes('ZodError')) {\n zodErrorVars.add(param.getName());\n }\n }\n }\n\n // Check for .safeParse() result — the error is in result.error\n if (Node.isVariableDeclaration(node)) {\n const initializer = node.getInitializer();\n if (initializer?.getText().includes('.safeParse(')) {\n zodErrorVars.add(`${node.getName()}.error`);\n }\n }\n\n // Check for new ZodError patterns\n if (Node.isNewExpression(node)) {\n if (node.getExpression().getText() === 'ZodError') {\n const parent = node.getParent();\n if (parent && Node.isVariableDeclaration(parent)) {\n zodErrorVars.add(parent.getName());\n }\n }\n }\n });\n\n return zodErrorVars;\n }\n\n /**\n * Transform error.errors to error.issues using AST-based detection\n * instead of heuristic name matching.\n */\n private transformErrorProperties(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n // Now transform .errors -> .issues only on identified ZodError variables\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node)) {\n const name = node.getName();\n if (name === 'errors') {\n const object = node.getExpression();\n const objectText = object.getText();\n\n // Check if this object is a known ZodError variable\n const isZodError =\n zodErrorVars.has(objectText) ||\n // Also check if accessing .error.errors (safeParse pattern)\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n const fullText = node.getText();\n const newText = fullText.replace(/\\.errors$/, '.issues');\n node.replaceWithText(newText);\n\n this.warnings.push(\n `${filePath}:${node.getStartLineNumber()}: ` +\n '.errors renamed to .issues (ZodError property change)',\n );\n }\n }\n }\n });\n }\n\n /**\n * Auto-transform error.flatten() to z.flattenError(error) in v4.\n */\n private transformFlatten(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n objectText: string;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'flatten') {\n const objectText = expression.getExpression().getText();\n const isZodError =\n zodErrorVars.has(objectText) ||\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n nodesToTransform.push({\n node,\n objectText,\n lineNumber: node.getStartLineNumber(),\n });\n } else {\n this.warnings.push(\n `${filePath}:${node.getStartLineNumber()}: .flatten() is removed in v4. ` +\n 'Use z.flattenError(error) or access error.issues directly. ' +\n 'See: https://zod.dev/v4/changelog',\n );\n }\n }\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, objectText, lineNumber } of nodesToTransform) {\n node.replaceWithText(`z.flattenError(${objectText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .flatten() auto-transformed to z.flattenError(). ` +\n 'Removed in v4 — now a standalone function.',\n );\n }\n }\n\n /**\n * Auto-transform error.format() to z.treeifyError(error) in v4.\n */\n private transformFormat(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const zodErrorVars = this.buildZodErrorVarSet(sourceFile);\n\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n objectText: string;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'format') {\n const objectText = expression.getExpression().getText();\n const isZodError =\n zodErrorVars.has(objectText) ||\n (objectText.endsWith('.error') &&\n zodErrorVars.has(`${objectText.replace(/\\.error$/, '')}.error`));\n\n if (isZodError) {\n nodesToTransform.push({\n node,\n objectText,\n lineNumber: node.getStartLineNumber(),\n });\n }\n // Skip non-ZodError .format() calls to avoid false positives\n }\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, objectText, lineNumber } of nodesToTransform) {\n node.replaceWithText(`z.treeifyError(${objectText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .format() auto-transformed to z.treeifyError(). ` +\n 'Removed in v4 — now a standalone function.',\n );\n }\n }\n\n /**\n * Auto-transform ._def property access to ._zod.def in v4.\n */\n private transformDefAccess(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').PropertyAccessExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node) && node.getName() === '_def') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const objectText = node.getExpression().getText();\n node.replaceWithText(`${objectText}._zod.def`);\n this.warnings.push(\n `${filePath}:${lineNumber}: ._def auto-transformed to ._zod.def. ` +\n 'Internal API — structure may change between releases.',\n );\n }\n }\n\n /**\n * Transform .merge(otherSchema) to .extend(otherSchema.shape)\n */\n private transformMerge(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{ node: import('ts-morph').CallExpression; lineNumber: number }> =\n [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'merge') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n });\n\n // Process in reverse order\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const args = node.getArguments();\n if (args.length === 1) {\n const argText = args[0]?.getText();\n if (argText) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const objectText = expression.getExpression().getText();\n node.replaceWithText(`${objectText}.extend(${argText}.shape)`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .merge() renamed to .extend() with .shape access. ` +\n 'Verify the merged schema exposes .shape.',\n );\n }\n }\n }\n }\n }\n\n /**\n * Transform z.nativeEnum(X) to z.enum(X)\n */\n private transformNativeEnum(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n const newText = fullText.replace(/\\bz\\.nativeEnum\\(/g, 'z.enum(');\n if (newText !== fullText) {\n sourceFile.replaceWithText(newText);\n this.warnings.push(\n `${filePath}: z.nativeEnum() renamed to z.enum() in v4. ` +\n 'Verify enum values are compatible.',\n );\n }\n }\n\n /**\n * Check for deprecated methods and add warnings\n */\n private checkDeprecatedMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (DEPRECATED_METHODS.has(name) && !AUTO_TRANSFORMABLE.has(name)) {\n const lineNumber = node.getStartLineNumber();\n switch (name) {\n case 'strict':\n this.warnings.push(\n `${filePath}:${lineNumber}: .strict() is deprecated in v4. ` +\n 'Use z.strictObject() instead.',\n );\n break;\n case 'passthrough':\n this.warnings.push(\n `${filePath}:${lineNumber}: .passthrough() is deprecated in v4. ` +\n 'Use z.looseObject() instead.',\n );\n break;\n // merge is handled by transformMerge\n }\n }\n }\n }\n });\n }\n\n /**\n * Auto-transform .superRefine() to .check() — callback signature is identical.\n */\n private transformSuperRefine(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').PropertyAccessExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node) && node.getName() === 'superRefine') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n });\n\n // Process in reverse to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const parent = node.getParent();\n if (parent && Node.isCallExpression(parent)) {\n const objectText = node.getExpression().getText();\n const args = parent.getArguments();\n let argsText = args.map((a) => a.getText()).join(', ');\n\n // Also transform ctx.addIssue() -> ctx.issues.push() inside the callback\n if (args.length > 0) {\n const callbackText = args[0]?.getText() ?? '';\n // Detect the context parameter name (2nd param in arrow/function)\n const paramMatch = callbackText.match(\n /^\\s*\\(?\\s*\\w+\\s*,\\s*(\\w+)\\s*\\)?(?:\\s*:\\s*[^)]+)?\\s*=>/,\n );\n if (paramMatch?.[1]) {\n const ctxName = paramMatch[1];\n const addIssuePattern = new RegExp(`${ctxName}\\\\.addIssue\\\\(`, 'g');\n if (addIssuePattern.test(callbackText)) {\n argsText = callbackText.replace(\n new RegExp(`${ctxName}\\\\.addIssue\\\\(`, 'g'),\n `${ctxName}.issues.push(`,\n );\n // Re-add remaining args if any\n if (args.length > 1) {\n const remaining = args\n .slice(1)\n .map((a) => a.getText())\n .join(', ');\n argsText = `${argsText}, ${remaining}`;\n }\n }\n }\n }\n\n parent.replaceWithText(`${objectText}.check(${argsText})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: .superRefine() auto-transformed to .check() (deprecated in v4).`,\n );\n }\n }\n }\n\n /**\n * Auto-transform invalid_type_error/required_error params to unified `error` param.\n */\n private transformErrorParams(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').ObjectLiteralExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isObjectLiteralExpression(node)) {\n const properties = node.getProperties();\n const propNames = properties\n .filter((p) => Node.isPropertyAssignment(p))\n .map((p) => (Node.isPropertyAssignment(p) ? p.getName() : ''));\n\n const hasInvalidType = propNames.includes('invalid_type_error');\n const hasRequired = propNames.includes('required_error');\n\n if (hasInvalidType || hasRequired) {\n // Only transform if this is an argument to a z.xxx() factory call\n const parent = node.getParent();\n if (parent && Node.isCallExpression(parent)) {\n const expr = parent.getExpression();\n if (Node.isPropertyAccessExpression(expr) && expr.getExpression().getText() === 'z') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n }\n }\n });\n\n // Process in reverse to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const properties = node.getProperties();\n let invalidTypeValue: string | undefined;\n let requiredValue: string | undefined;\n const otherProps: string[] = [];\n\n for (const prop of properties) {\n if (Node.isPropertyAssignment(prop)) {\n const name = prop.getName();\n const value = prop.getInitializer()?.getText() ?? '';\n if (name === 'invalid_type_error') {\n invalidTypeValue = value;\n } else if (name === 'required_error') {\n requiredValue = value;\n } else {\n otherProps.push(prop.getText());\n }\n }\n }\n\n let errorValue: string;\n if (invalidTypeValue && requiredValue) {\n // Both present: generate error function\n errorValue = `error: (issue) => issue.input === undefined ? ${requiredValue} : ${invalidTypeValue}`;\n } else if (requiredValue) {\n errorValue = `error: ${requiredValue}`;\n } else if (invalidTypeValue) {\n errorValue = `error: ${invalidTypeValue}`;\n } else {\n continue;\n }\n\n const allProps = [errorValue, ...otherProps].join(', ');\n node.replaceWithText(`{ ${allProps} }`);\n\n this.warnings.push(\n `${filePath}:${lineNumber}: invalid_type_error/required_error auto-transformed to unified error param.`,\n );\n }\n }\n\n /**\n * Detect instanceof Error patterns in catch blocks that reference ZodError.\n * In v4, ZodError no longer extends Error.\n */\n private checkInstanceofError(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCatchClause(node)) {\n const block = node.getBlock();\n const blockText = block.getText();\n\n // Check if the catch block references ZodError AND uses instanceof Error\n if (blockText.includes('ZodError') && blockText.includes('instanceof Error')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: ZodError no longer extends Error in v4. ` +\n '`instanceof Error` checks on ZodError will return false. ' +\n 'Use `instanceof ZodError` or check for `.issues` property instead.',\n );\n }\n }\n });\n }\n\n /**\n * Detect .refine()/.superRefine() followed by .transform() in the same chain.\n * In v4, .transform() runs even when .refine() fails.\n */\n private checkTransformRefineOrder(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'transform') {\n // Walk up the chain to see if .refine() or .superRefine() precedes\n const chainText = node.getText();\n if (\n chainText.includes('.refine(') ||\n chainText.includes('.superRefine(') ||\n chainText.includes('.check(')\n ) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: In v4, .transform() executes even if preceding .refine() fails. ` +\n 'Consider using .pipe() to sequence validation before transforms.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Detect .default() combined with .optional() — behavior changed silently in v4.\n * In v4, .default() always provides a value, making .optional() a no-op.\n */\n private checkDefaultOptional(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (\n Node.isPropertyAccessExpression(expression) &&\n (expression.getName() === 'optional' || expression.getName() === 'default')\n ) {\n const chainText = node.getText();\n const hasDefault = chainText.includes('.default(');\n const hasOptional = chainText.includes('.optional(');\n\n if (hasDefault && hasOptional) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .default() + .optional() behavior changed in v4. ` +\n '.default() now always provides a value, making .optional() effectively a no-op. ' +\n 'Review whether .optional() is still needed.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Check for methods with behavior changes and add warnings\n */\n private checkBehaviorChanges(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n\n if (BEHAVIOR_CHANGES.has(name)) {\n const lineNumber = node.getStartLineNumber();\n\n switch (name) {\n case 'default':\n this.warnings.push(\n `${filePath}:${lineNumber}: .default() has stricter type inference in v4. ` +\n 'Verify default value matches schema type exactly.',\n );\n break;\n\n case 'uuid':\n this.warnings.push(\n `${filePath}:${lineNumber}: .uuid() now enforces strict RFC 4122 compliance. ` +\n 'Non-standard UUIDs may fail validation.',\n );\n break;\n\n case 'discriminatedUnion':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.discriminatedUnion() now requires ` +\n 'a literal type for the discriminator property.',\n );\n break;\n\n case 'function':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.function() parameter handling has changed. ` +\n 'Review input/output schema definitions.',\n );\n break;\n\n case 'pipe':\n this.warnings.push(\n `${filePath}:${lineNumber}: .pipe() has stricter type checking in v4. ` +\n 'If you get type errors, add explicit type annotations to .transform() return types ' +\n 'or cast through unknown as a last resort.',\n );\n break;\n }\n }\n }\n }\n });\n }\n\n /**\n * Detect .catch() combined with .optional() — behavior changed in v4.\n * In v4, .catch() on optional properties always returns the catch value.\n */\n private checkCatchOptional(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (\n Node.isPropertyAccessExpression(expression) &&\n (expression.getName() === 'optional' || expression.getName() === 'catch')\n ) {\n const chainText = node.getText();\n if (chainText.includes('.catch(') && chainText.includes('.optional(')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .catch() + .optional() behavior changed in v4. ` +\n '.catch() on optional properties now always returns the catch value, ' +\n 'even when the property is absent from input.',\n );\n }\n }\n }\n });\n }\n\n /**\n * Detect imports of utility types that moved to 'zod/v4/core' in v4.\n */\n private checkUtilityTypeImports(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n for (const importDecl of sourceFile.getImportDeclarations()) {\n const moduleSpecifier = importDecl.getModuleSpecifierValue();\n if (moduleSpecifier !== 'zod') continue;\n\n const namedImports = importDecl.getNamedImports();\n for (const namedImport of namedImports) {\n const name = namedImport.getName();\n if (UTILITY_TYPES.has(name)) {\n const lineNumber = importDecl.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: '${name}' may need to be imported from 'zod/v4/core' in v4. ` +\n 'Internal utility types have moved to a separate subpackage.',\n );\n }\n }\n }\n }\n\n /**\n * Warn about string format methods that moved to top-level functions in v4.\n * e.g., z.string().email() → z.email() (instance methods are deprecated but still work)\n */\n private checkStringFormatMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (STRING_FORMAT_TO_TOPLEVEL.has(name)) {\n // Check if this is chained on z.string()\n const chainText = node.getText();\n if (chainText.includes('z.string()') || chainText.includes('.string()')) {\n const topLevel = STRING_FORMAT_TO_TOPLEVEL.get(name);\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .${name}() is deprecated as an instance method in v4. ` +\n `Use ${topLevel} as a top-level function instead. The instance method still works but may be removed in future versions.`,\n );\n }\n }\n }\n }\n });\n }\n\n /**\n * Check for deprecated factory functions (z.promise(), z.ostring(), etc.)\n */\n private checkDeprecatedFactories(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n const object = expression.getExpression();\n\n if (object.getText() === 'z' && DEPRECATED_FACTORIES.has(name)) {\n const lineNumber = node.getStartLineNumber();\n switch (name) {\n case 'promise':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.promise() is deprecated in v4. ` +\n 'Await values before parsing instead of wrapping in z.promise().',\n );\n break;\n case 'ostring':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.ostring() is removed in v4. ` +\n 'Use z.string().optional() instead.',\n );\n break;\n case 'onumber':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.onumber() is removed in v4. ` +\n 'Use z.number().optional() instead.',\n );\n break;\n case 'oboolean':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.oboolean() is removed in v4. ` +\n 'Use z.boolean().optional() instead.',\n );\n break;\n case 'preprocess':\n this.warnings.push(\n `${filePath}:${lineNumber}: z.preprocess() is removed in v4. ` +\n 'Use z.pipe(z.unknown(), z.transform(fn), targetSchema) instead.',\n );\n break;\n }\n }\n }\n }\n });\n }\n\n /**\n * Transform z.function().args().returns() to z.function({ input, output }) in v4.\n */\n private transformFunctionValidation(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (name === 'args' || name === 'returns') {\n // Check if this is part of a z.function() chain\n const chainText = node.getText();\n if (\n chainText.includes('z.function()') &&\n (chainText.includes('.args(') || chainText.includes('.returns('))\n ) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: z.function().args().returns() is removed in v4. ` +\n 'Use z.function({ input: z.tuple([...]), output: schema }) instead. ' +\n 'The result is no longer a Zod schema — use .implement() to wrap functions.',\n );\n }\n }\n }\n }\n });\n }\n\n /**\n * Transform z.ostring(), z.onumber(), z.oboolean() to explicit .optional() calls.\n */\n private transformOptionalShorthands(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n const replacements: Array<{ pattern: RegExp; replacement: string; name: string }> = [\n { pattern: /\\bz\\.ostring\\(\\)/g, replacement: 'z.string().optional()', name: 'z.ostring()' },\n { pattern: /\\bz\\.onumber\\(\\)/g, replacement: 'z.number().optional()', name: 'z.onumber()' },\n {\n pattern: /\\bz\\.oboolean\\(\\)/g,\n replacement: 'z.boolean().optional()',\n name: 'z.oboolean()',\n },\n ];\n\n let newText = fullText;\n for (const { pattern, replacement, name } of replacements) {\n if (pattern.test(newText)) {\n newText = newText.replace(pattern, replacement);\n this.warnings.push(\n `${filePath}: ${name} auto-transformed to ${replacement}. Removed in v4.`,\n );\n }\n }\n\n if (newText !== fullText) {\n sourceFile.replaceWithText(newText);\n }\n }\n\n /**\n * Check for .nonempty() which has a type inference change in v4.\n * v3: [string, ...string[]] (tuple with rest)\n * v4: string[] (matches .min(1))\n */\n private checkNonemptyTypeChange(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'nonempty') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .nonempty() type inference changed in v4. ` +\n 'v3 inferred [T, ...T[]] (tuple with rest), v4 infers T[] (same as .min(1)). ' +\n 'If you rely on the tuple type, use z.tuple([z.string()], z.string()) instead.',\n );\n }\n }\n });\n }\n\n /**\n * Check for z.coerce.* usage — input type changed to unknown in v4.\n */\n private checkCoerceInputType(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n if (fullText.includes('z.coerce.')) {\n // Find line numbers for each occurrence\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node)) {\n const text = node.getText();\n if (text.startsWith('z.coerce.')) {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: z.coerce.* input type changed to 'unknown' in v4. ` +\n 'Previously, z.coerce.string() had input type string. ' +\n 'This enables more accurate type inference but may affect type guards.',\n );\n }\n }\n });\n }\n }\n\n /**\n * Check for .deepPartial() which was removed entirely in v4.\n */\n private checkDeepPartialRemoval(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'deepPartial') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .deepPartial() is removed in v4. ` +\n 'This was a long-deprecated anti-pattern. Use recursive partial types or ' +\n 'restructure schemas to avoid deep partial requirements.',\n );\n }\n }\n });\n }\n\n /**\n * Auto-remove .strip() which is deprecated in v4 (it was the default behavior).\n */\n private checkStripDeprecation(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression) && expression.getName() === 'strip') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n });\n\n // Process in reverse order to preserve positions\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const objectText = expression.getExpression().getText();\n node.replaceWithText(objectText);\n this.warnings.push(\n `${filePath}:${lineNumber}: .strip() auto-removed — it is the default behavior in v4.`,\n );\n }\n }\n }\n\n /**\n * Check for errorMap usage patterns where precedence changed in v4.\n * In v4, schema-level error maps take precedence over parse-time error maps (inverted from v3).\n */\n private checkErrorMapPrecedence(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n // Check if file uses both schema-level and parse-time error maps\n const hasSchemaErrorMap = fullText.includes('errorMap:') || fullText.includes('error:');\n const hasParseErrorMap =\n (fullText.includes('.parse(') && fullText.includes('errorMap')) ||\n (fullText.includes('.safeParse(') && fullText.includes('errorMap'));\n\n if (hasSchemaErrorMap && hasParseErrorMap) {\n this.warnings.push(\n `${filePath}: Error map precedence changed in v4. ` +\n 'Schema-level error maps now take precedence over parse-time error maps (inverted from v3). ' +\n 'Review error map usage to ensure correct error messages.',\n );\n }\n }\n\n /**\n * Auto-transform z.preprocess(fn, schema) to z.pipe(z.unknown(), z.transform(fn), schema).\n */\n private transformPreprocess(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const nodesToTransform: Array<{\n node: import('ts-morph').CallExpression;\n lineNumber: number;\n }> = [];\n\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n const object = expression.getExpression();\n if (name === 'preprocess' && object.getText() === 'z') {\n nodesToTransform.push({ node, lineNumber: node.getStartLineNumber() });\n }\n }\n }\n });\n\n nodesToTransform.sort((a, b) => b.node.getStart() - a.node.getStart());\n\n for (const { node, lineNumber } of nodesToTransform) {\n const args = node.getArguments();\n if (args.length === 2) {\n const fn = args[0]?.getText();\n const schema = args[1]?.getText();\n if (fn && schema) {\n node.replaceWithText(`z.pipe(z.unknown(), z.transform(${fn}), ${schema})`);\n this.warnings.push(\n `${filePath}:${lineNumber}: z.preprocess() auto-transformed to z.pipe(). ` +\n 'Removed in v4 — use z.pipe() with z.transform() instead.',\n );\n }\n }\n }\n }\n\n /**\n * Check for ctx.addIssue() / ctx.addIssues() which are deprecated in v4.\n */\n private checkAddIssueMethods(sourceFile: SourceFile): void {\n const filePath = sourceFile.getFilePath();\n const fullText = sourceFile.getFullText();\n\n if (fullText.includes('.addIssue(') || fullText.includes('.addIssues(')) {\n sourceFile.forEachDescendant((node) => {\n if (Node.isCallExpression(node)) {\n const expression = node.getExpression();\n if (Node.isPropertyAccessExpression(expression)) {\n const name = expression.getName();\n if (name === 'addIssue' || name === 'addIssues') {\n const lineNumber = node.getStartLineNumber();\n this.warnings.push(\n `${filePath}:${lineNumber}: .${name}() is deprecated in v4. ` +\n 'Directly manipulate the issues array instead: ctx.issues.push({...}). ' +\n 'Note: .superRefine() callbacks using addIssue should migrate to .check() with issues.push().',\n );\n }\n }\n }\n });\n }\n }\n}\n","/**\n * Zod v3 to v4 Breaking Changes\n *\n * Key changes in Zod v4:\n * 1. z.record() now requires explicit key type\n * 2. .default() has stricter type inference (matches output type, not input)\n * 3. error.errors renamed to error.issues\n * 4. .uuid() has stricter validation (RFC 9562/4122 compliant)\n * 5. z.function() completely overhauled — .args()/.returns() removed\n * 6. Branded types use different syntax\n * 7. z.discriminatedUnion() requires literal discriminator\n * 8. String format methods moved to top-level (e.g., .email() → z.email())\n * 9. .deepPartial() removed (was deprecated anti-pattern)\n * 10. z.promise() deprecated (await values before parsing)\n * 11. .strip() deprecated (default behavior)\n * 12. .nonempty() type inference changed (no longer tuple type)\n * 13. z.coerce.* input type changed to unknown\n * 14. z.partialRecord() added for optional key behavior\n * 15. z.guid() added for lenient UUID matching\n * 16. z.iso.* validators for date/time/datetime/duration\n * 17. .prefault() added (restores v3 .default() parse behavior)\n * 18. .addIssue()/.addIssues() deprecated in favor of issues.push()\n * 19. ZodError precedence reversal: schema-level error maps override parse-time\n * 20. z.ostring()/z.onumber() etc. removed (optional shorthands)\n */\n\n// Patterns that need transformation\nexport const V3_TO_V4_PATTERNS = {\n // z.record(valueSchema) -> z.record(z.string(), valueSchema)\n recordSingleArg: /z\\.record\\((?!z\\.string\\(\\)|z\\.number\\(\\)|z\\.symbol\\(\\))/g,\n\n // error.errors -> error.issues\n errorErrors: /\\.errors\\b/g,\n\n // .brand<T>() -> .brand<T>() (same but check for proper usage)\n brandUsage: /\\.brand<([^>]+)>\\(\\)/g,\n};\n\n// Methods that have changed behavior\nexport const BEHAVIOR_CHANGES = new Set([\n 'default', // Type inference changed; now matches output type, use .prefault() for v3 behavior\n 'uuid', // Stricter RFC 9562/4122 validation; use z.guid() for lenient matching\n 'record', // Requires key type\n 'discriminatedUnion', // Stricter discriminator requirements\n 'function', // Complete overhaul — .args()/.returns() removed\n 'pipe', // Stricter type checking in v4\n 'catch', // .catch() on optional properties always returns catch value in v4\n 'nonempty', // Type inference changed: string[] instead of [string, ...string[]]\n 'coerce', // Input type changed to unknown for all z.coerce.* schemas\n]);\n\n// Error property renames\nexport const ERROR_RENAMES: Record<string, string> = {\n errors: 'issues',\n formErrors: 'formErrors', // Unchanged\n fieldErrors: 'fieldErrors', // Unchanged\n};\n\n// Methods that are deprecated in v4\nexport const DEPRECATED_METHODS = new Set([\n 'merge', // Use .extend() instead\n 'superRefine', // Use .check() instead\n 'strict', // Use z.strictObject() instead\n 'passthrough', // Use z.looseObject() instead\n 'deepPartial', // Removed entirely — was deprecated anti-pattern\n 'strip', // Deprecated — default behavior in v4\n 'nonstrict', // Removed entirely\n]);\n\n// Factory functions deprecated/removed in v4\nexport const DEPRECATED_FACTORIES = new Set([\n 'promise', // z.promise() deprecated — await values before parsing\n 'ostring', // z.ostring() removed (optional shorthand)\n 'onumber', // z.onumber() removed\n 'oboolean', // z.oboolean() removed\n 'preprocess', // z.preprocess() removed — use z.pipe() instead\n]);\n\n// Method renames in v4\nexport const METHOD_RENAMES: Record<string, string> = {\n merge: 'extend',\n};\n\n// Factory function renames in v4\nexport const FACTORY_RENAMES: Record<string, string> = {\n nativeEnum: 'enum',\n};\n\n// Error params that changed in v4 (unified under `error`)\nexport const ERROR_PARAM_NAMES = new Set(['invalid_type_error', 'required_error']);\n\n// Methods that can be automatically transformed (renamed) in v4\nexport const AUTO_TRANSFORMABLE = new Set([\n 'superRefine', // -> .check()\n 'flatten', // error.flatten() -> z.flattenError(error)\n 'format', // error.format() -> z.treeifyError(error)\n]);\n\n// Utility types that moved to 'zod/v4/core' in v4\nexport const UTILITY_TYPES = new Set([\n 'ZodType',\n 'ZodSchema',\n 'ZodRawShape',\n 'ZodTypeAny',\n 'ZodFirstPartyTypeKind',\n]);\n\n// String format methods that moved from instance methods to top-level functions\nexport const STRING_FORMAT_TO_TOPLEVEL = new Map<string, string>([\n ['email', 'z.email()'],\n ['url', 'z.url()'],\n ['uuid', 'z.uuid()'],\n ['emoji', 'z.emoji()'],\n ['nanoid', 'z.nanoid()'],\n ['cuid', 'z.cuid()'],\n ['cuid2', 'z.cuid2()'],\n ['ulid', 'z.ulid()'],\n ['ipv4', 'z.ipv4()'],\n ['ipv6', 'z.ipv6()'],\n ['cidrv4', 'z.cidrv4()'],\n ['cidrv6', 'z.cidrv6()'],\n ['base64', 'z.base64()'],\n ['base64url', 'z.base64url()'],\n]);\n\n// New ISO validators in v4 (informational — no transform needed, just awareness)\nexport const NEW_ISO_VALIDATORS = new Set([\n 'z.iso.date()',\n 'z.iso.time()',\n 'z.iso.datetime()',\n 'z.iso.duration()',\n]);\n\n// Runtime behavior patterns that silently break in v4 (no compile-time error)\nexport const RUNTIME_BREAK_PATTERNS = new Set([\n 'instanceofError', // ZodError no longer extends Error\n 'transformAfterRefine', // .transform() runs even when .refine() fails\n 'defaultOptional', // .default() + .optional() behavior change\n 'errorMapPrecedence', // Schema-level error maps now override parse-time\n 'nonemptyType', // .nonempty() returns string[] instead of [string, ...string[]]\n 'coerceInputType', // z.coerce.* input is now unknown instead of specific type\n]);\n","import type { TransformHandler, TransformOptions, TransformResult } from '@schemashift/core';\nimport type { SourceFile } from 'ts-morph';\nimport { ZodV3ToV4Transformer } from './transformer.js';\n\nexport function createZodV3ToV4Handler(): TransformHandler {\n const transformer = new ZodV3ToV4Transformer();\n return {\n transform(sourceFile: SourceFile, _options: TransformOptions): TransformResult {\n return transformer.transform(sourceFile);\n },\n };\n}\n"],"mappings":";AAgCA,IAAM,yBAA8C;AAAA,EAClD;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OACE;AAAA,IACF,cAAc;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,IACP,cAAc;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,IACP,cAAc;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,O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AA,EAKQ,qBAAqB,YAA8B;AACzD,UAAM,WAAW,WAAW,YAAY;AACxC,UAAM,WAAW,WAAW,YAAY;AAExC,QAAI,SAAS,SAAS,YAAY,KAAK,SAAS,SAAS,aAAa,GAAG;AACvE,iBAAW,kBAAkB,CAAC,SAAS;AACrC,YAAI,KAAK,iBAAiB,IAAI,GAAG;AAC/B,gBAAM,aAAa,KAAK,cAAc;AACtC,cAAI,KAAK,2BAA2B,UAAU,GAAG;AAC/C,kBAAM,OAAO,WAAW,QAAQ;AAChC,gBAAI,SAAS,cAAc,SAAS,aAAa;AAC/C,oBAAM,aAAa,KAAK,mBAAmB;AAC3C,mBAAK,SAAS;AAAA,gBACZ,GAAG,QAAQ,IAAI,UAAU,MAAM,IAAI;AAAA,cAGrC;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AElkCO,SAAS,yBAA2C;AACzD,QAAM,cAAc,IAAI,qBAAqB;AAC7C,SAAO;AAAA,IACL,UAAU,YAAwB,UAA6C;AAC7E,aAAO,YAAY,UAAU,UAAU;AAAA,IACzC;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schemashift/zod-v3-v4",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Zod v3 to v4 upgrade transformer for SchemaShift — handles 17+ breaking changes with auto-transforms and runtime warnings",
5
5
  "keywords": [
6
6
  "zod",
@@ -42,7 +42,7 @@
42
42
  "typecheck": "tsc --noEmit"
43
43
  },
44
44
  "dependencies": {
45
- "@schemashift/core": "0.12.0",
45
+ "@schemashift/core": "0.13.0",
46
46
  "ts-morph": "27.0.2"
47
47
  },
48
48
  "publishConfig": {