@schemashift/zod-v3-v4 0.3.0 → 0.8.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/README.md +98 -0
- package/dist/index.cjs +463 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -1
- package/dist/index.d.ts +65 -1
- package/dist/index.js +463 -13
- package/dist/index.js.map +1 -1
- package/package.json +13 -2
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/transformer.ts","../src/mappings.ts","../src/handler.ts"],"sourcesContent":["export { createZodV3ToV4Handler } from './handler.js';\nexport { BEHAVIOR_CHANGES, V3_TO_V4_PATTERNS } from './mappings.js';\nexport { ZodV3ToV4Transformer } from './transformer.js';\n","import type { TransformError, TransformResult } from '@schemashift/core';\nimport { Node, type SourceFile } from 'ts-morph';\nimport { BEHAVIOR_CHANGES } 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 */\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.transformErrorProperties(sourceFile);\n this.checkBehaviorChanges(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 // Check if this is z.record() call\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 * Transform error.errors to error.issues\n */\n private transformErrorProperties(sourceFile: SourceFile): void {\n sourceFile.forEachDescendant((node) => {\n if (Node.isPropertyAccessExpression(node)) {\n const name = node.getName();\n\n // Check for .errors property access that might be on ZodError\n if (name === 'errors') {\n const object = node.getExpression();\n const objectText = object.getText();\n\n // Heuristic: if the variable is named error, err, or zodError, likely a ZodError\n if (\n objectText.toLowerCase().includes('error') ||\n objectText.toLowerCase().includes('err')\n ) {\n // Replace .errors with .issues\n const fullText = node.getText();\n const newText = fullText.replace(/\\.errors$/, '.issues');\n node.replaceWithText(newText);\n\n this.warnings.push(\n `${sourceFile.getFilePath()}:${node.getStartLineNumber()}: ` +\n '.errors renamed to .issues (ZodError property change)',\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 }\n }\n }\n });\n\n // Check for flatten() usage which is removed in v4\n const text = sourceFile.getFullText();\n if (text.includes('.flatten()')) {\n const matches = text.matchAll(/\\.flatten\\(\\)/g);\n for (const match of matches) {\n const pos = match.index ?? 0;\n const lineNumber = sourceFile.getLineAndColumnAtPos(pos).line;\n this.warnings.push(\n `${filePath}:${lineNumber}: .flatten() is removed in v4. ` +\n 'Use error.issues directly or implement custom flattening.',\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\n * 3. error.errors renamed to error.issues\n * 4. .uuid() has stricter validation (RFC 4122 compliant)\n * 5. z.function() input/output changed\n * 6. Branded types use different syntax\n * 7. z.discriminatedUnion() requires literal discriminator\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\n 'uuid', // Stricter validation\n 'record', // Requires key type\n 'discriminatedUnion', // Stricter discriminator requirements\n 'function', // Input/output parameter changes\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 // Add any deprecated methods here\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;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,sBAAsC;;;ACa/B,IAAM,oBAAoB;AAAA;AAAA,EAE/B,iBAAiB;AAAA;AAAA,EAGjB,aAAa;AAAA;AAAA,EAGb,YAAY;AACd;AAGO,IAAM,mBAAmB,oBAAI,IAAI;AAAA,EACtC;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF,CAAC;;;ADnBM,IAAM,uBAAN,MAA2B;AAAA,EACxB,SAA2B,CAAC;AAAA,EAC5B,WAAqB,CAAC;AAAA,EAE9B,UAAU,YAAyC;AACjD,SAAK,SAAS,CAAC;AACf,SAAK,WAAW,CAAC;AAEjB,UAAM,WAAW,WAAW,YAAY;AACxC,UAAM,eAAe,WAAW,YAAY;AAE5C,QAAI;AACF,WAAK,qBAAqB,UAAU;AACpC,WAAK,yBAAyB,UAAU;AACxC,WAAK,qBAAqB,UAAU;AAEpC,aAAO;AAAA,QACL,SAAS,KAAK,OAAO,WAAW;AAAA,QAChC;AAAA,QACA;AAAA,QACA,iBAAiB,WAAW,YAAY;AAAA,QACxC,QAAQ,KAAK;AAAA,QACb,UAAU,KAA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,WAAW,sBAAsB,GAAG,EAAE;AACzD,aAAK,SAAS;AAAA,UACZ,GAAG,QAAQ,IAAI,UAAU;AAAA,QAE3B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AElLO,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/transformer.ts","../src/mappings.ts","../src/handler.ts"],"sourcesContent":["export { createZodV3ToV4Handler } from './handler.js';\nexport { BEHAVIOR_CHANGES, V3_TO_V4_PATTERNS } from './mappings.js';\nexport { ZodV3ToV4Transformer } from './transformer.js';\n","import type { TransformError, TransformResult } from '@schemashift/core';\nimport { Node, type SourceFile } from 'ts-morph';\nimport {\n AUTO_TRANSFORMABLE,\n BEHAVIOR_CHANGES,\n DEPRECATED_METHODS,\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.checkDeprecatedMethods(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\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 * 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\n * 3. error.errors renamed to error.issues\n * 4. .uuid() has stricter validation (RFC 4122 compliant)\n * 5. z.function() input/output changed\n * 6. Branded types use different syntax\n * 7. z.discriminatedUnion() requires literal discriminator\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\n 'uuid', // Stricter validation\n 'record', // Requires key type\n 'discriminatedUnion', // Stricter discriminator requirements\n 'function', // Input/output parameter changes\n 'pipe', // Stricter type checking in v4\n 'catch', // .catch() on optional properties always returns catch value in v4\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]);\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// 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]);\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;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,sBAAsC;;;ACa/B,IAAM,oBAAoB;AAAA;AAAA,EAE/B,iBAAiB;AAAA;AAAA,EAGjB,aAAa;AAAA;AAAA,EAGb,YAAY;AACd;AAGO,IAAM,mBAAmB,oBAAI,IAAI;AAAA,EACtC;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF,CAAC;AAUM,IAAM,qBAAqB,oBAAI,IA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C7C,SAAO;AAAA,IACL,UAAU,YAAwB,UAA6C;AAC7E,aAAO,YAAY,UAAU,UAAU;AAAA,IACzC;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -30,6 +30,8 @@ declare const BEHAVIOR_CHANGES: Set<string>;
|
|
|
30
30
|
* - error.errors -> error.issues
|
|
31
31
|
* - Stricter UUID validation
|
|
32
32
|
* - Type inference changes in .default()
|
|
33
|
+
* - .flatten() removed
|
|
34
|
+
* - z.preprocess() -> z.pipe() migration
|
|
33
35
|
*/
|
|
34
36
|
declare class ZodV3ToV4Transformer {
|
|
35
37
|
private errors;
|
|
@@ -40,13 +42,75 @@ declare class ZodV3ToV4Transformer {
|
|
|
40
42
|
*/
|
|
41
43
|
private transformRecordCalls;
|
|
42
44
|
/**
|
|
43
|
-
*
|
|
45
|
+
* Build a set of variable names that are likely ZodError instances.
|
|
46
|
+
* Used by transformErrorProperties, transformFlatten, and transformFormat.
|
|
47
|
+
*/
|
|
48
|
+
private buildZodErrorVarSet;
|
|
49
|
+
/**
|
|
50
|
+
* Transform error.errors to error.issues using AST-based detection
|
|
51
|
+
* instead of heuristic name matching.
|
|
44
52
|
*/
|
|
45
53
|
private transformErrorProperties;
|
|
54
|
+
/**
|
|
55
|
+
* Auto-transform error.flatten() to z.flattenError(error) in v4.
|
|
56
|
+
*/
|
|
57
|
+
private transformFlatten;
|
|
58
|
+
/**
|
|
59
|
+
* Auto-transform error.format() to z.treeifyError(error) in v4.
|
|
60
|
+
*/
|
|
61
|
+
private transformFormat;
|
|
62
|
+
/**
|
|
63
|
+
* Auto-transform ._def property access to ._zod.def in v4.
|
|
64
|
+
*/
|
|
65
|
+
private transformDefAccess;
|
|
66
|
+
/**
|
|
67
|
+
* Transform .merge(otherSchema) to .extend(otherSchema.shape)
|
|
68
|
+
*/
|
|
69
|
+
private transformMerge;
|
|
70
|
+
/**
|
|
71
|
+
* Transform z.nativeEnum(X) to z.enum(X)
|
|
72
|
+
*/
|
|
73
|
+
private transformNativeEnum;
|
|
74
|
+
/**
|
|
75
|
+
* Check for deprecated methods and add warnings
|
|
76
|
+
*/
|
|
77
|
+
private checkDeprecatedMethods;
|
|
78
|
+
/**
|
|
79
|
+
* Auto-transform .superRefine() to .check() — callback signature is identical.
|
|
80
|
+
*/
|
|
81
|
+
private transformSuperRefine;
|
|
82
|
+
/**
|
|
83
|
+
* Auto-transform invalid_type_error/required_error params to unified `error` param.
|
|
84
|
+
*/
|
|
85
|
+
private transformErrorParams;
|
|
86
|
+
/**
|
|
87
|
+
* Detect instanceof Error patterns in catch blocks that reference ZodError.
|
|
88
|
+
* In v4, ZodError no longer extends Error.
|
|
89
|
+
*/
|
|
90
|
+
private checkInstanceofError;
|
|
91
|
+
/**
|
|
92
|
+
* Detect .refine()/.superRefine() followed by .transform() in the same chain.
|
|
93
|
+
* In v4, .transform() runs even when .refine() fails.
|
|
94
|
+
*/
|
|
95
|
+
private checkTransformRefineOrder;
|
|
96
|
+
/**
|
|
97
|
+
* Detect .default() combined with .optional() — behavior changed silently in v4.
|
|
98
|
+
* In v4, .default() always provides a value, making .optional() a no-op.
|
|
99
|
+
*/
|
|
100
|
+
private checkDefaultOptional;
|
|
46
101
|
/**
|
|
47
102
|
* Check for methods with behavior changes and add warnings
|
|
48
103
|
*/
|
|
49
104
|
private checkBehaviorChanges;
|
|
105
|
+
/**
|
|
106
|
+
* Detect .catch() combined with .optional() — behavior changed in v4.
|
|
107
|
+
* In v4, .catch() on optional properties always returns the catch value.
|
|
108
|
+
*/
|
|
109
|
+
private checkCatchOptional;
|
|
110
|
+
/**
|
|
111
|
+
* Detect imports of utility types that moved to 'zod/v4/core' in v4.
|
|
112
|
+
*/
|
|
113
|
+
private checkUtilityTypeImports;
|
|
50
114
|
}
|
|
51
115
|
|
|
52
116
|
export { BEHAVIOR_CHANGES, V3_TO_V4_PATTERNS, ZodV3ToV4Transformer, createZodV3ToV4Handler };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ declare const BEHAVIOR_CHANGES: Set<string>;
|
|
|
30
30
|
* - error.errors -> error.issues
|
|
31
31
|
* - Stricter UUID validation
|
|
32
32
|
* - Type inference changes in .default()
|
|
33
|
+
* - .flatten() removed
|
|
34
|
+
* - z.preprocess() -> z.pipe() migration
|
|
33
35
|
*/
|
|
34
36
|
declare class ZodV3ToV4Transformer {
|
|
35
37
|
private errors;
|
|
@@ -40,13 +42,75 @@ declare class ZodV3ToV4Transformer {
|
|
|
40
42
|
*/
|
|
41
43
|
private transformRecordCalls;
|
|
42
44
|
/**
|
|
43
|
-
*
|
|
45
|
+
* Build a set of variable names that are likely ZodError instances.
|
|
46
|
+
* Used by transformErrorProperties, transformFlatten, and transformFormat.
|
|
47
|
+
*/
|
|
48
|
+
private buildZodErrorVarSet;
|
|
49
|
+
/**
|
|
50
|
+
* Transform error.errors to error.issues using AST-based detection
|
|
51
|
+
* instead of heuristic name matching.
|
|
44
52
|
*/
|
|
45
53
|
private transformErrorProperties;
|
|
54
|
+
/**
|
|
55
|
+
* Auto-transform error.flatten() to z.flattenError(error) in v4.
|
|
56
|
+
*/
|
|
57
|
+
private transformFlatten;
|
|
58
|
+
/**
|
|
59
|
+
* Auto-transform error.format() to z.treeifyError(error) in v4.
|
|
60
|
+
*/
|
|
61
|
+
private transformFormat;
|
|
62
|
+
/**
|
|
63
|
+
* Auto-transform ._def property access to ._zod.def in v4.
|
|
64
|
+
*/
|
|
65
|
+
private transformDefAccess;
|
|
66
|
+
/**
|
|
67
|
+
* Transform .merge(otherSchema) to .extend(otherSchema.shape)
|
|
68
|
+
*/
|
|
69
|
+
private transformMerge;
|
|
70
|
+
/**
|
|
71
|
+
* Transform z.nativeEnum(X) to z.enum(X)
|
|
72
|
+
*/
|
|
73
|
+
private transformNativeEnum;
|
|
74
|
+
/**
|
|
75
|
+
* Check for deprecated methods and add warnings
|
|
76
|
+
*/
|
|
77
|
+
private checkDeprecatedMethods;
|
|
78
|
+
/**
|
|
79
|
+
* Auto-transform .superRefine() to .check() — callback signature is identical.
|
|
80
|
+
*/
|
|
81
|
+
private transformSuperRefine;
|
|
82
|
+
/**
|
|
83
|
+
* Auto-transform invalid_type_error/required_error params to unified `error` param.
|
|
84
|
+
*/
|
|
85
|
+
private transformErrorParams;
|
|
86
|
+
/**
|
|
87
|
+
* Detect instanceof Error patterns in catch blocks that reference ZodError.
|
|
88
|
+
* In v4, ZodError no longer extends Error.
|
|
89
|
+
*/
|
|
90
|
+
private checkInstanceofError;
|
|
91
|
+
/**
|
|
92
|
+
* Detect .refine()/.superRefine() followed by .transform() in the same chain.
|
|
93
|
+
* In v4, .transform() runs even when .refine() fails.
|
|
94
|
+
*/
|
|
95
|
+
private checkTransformRefineOrder;
|
|
96
|
+
/**
|
|
97
|
+
* Detect .default() combined with .optional() — behavior changed silently in v4.
|
|
98
|
+
* In v4, .default() always provides a value, making .optional() a no-op.
|
|
99
|
+
*/
|
|
100
|
+
private checkDefaultOptional;
|
|
46
101
|
/**
|
|
47
102
|
* Check for methods with behavior changes and add warnings
|
|
48
103
|
*/
|
|
49
104
|
private checkBehaviorChanges;
|
|
105
|
+
/**
|
|
106
|
+
* Detect .catch() combined with .optional() — behavior changed in v4.
|
|
107
|
+
* In v4, .catch() on optional properties always returns the catch value.
|
|
108
|
+
*/
|
|
109
|
+
private checkCatchOptional;
|
|
110
|
+
/**
|
|
111
|
+
* Detect imports of utility types that moved to 'zod/v4/core' in v4.
|
|
112
|
+
*/
|
|
113
|
+
private checkUtilityTypeImports;
|
|
50
114
|
}
|
|
51
115
|
|
|
52
116
|
export { BEHAVIOR_CHANGES, V3_TO_V4_PATTERNS, ZodV3ToV4Transformer, createZodV3ToV4Handler };
|