@schemashift/zod-v3-v4 0.2.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 +205 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +52 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +175 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
BEHAVIOR_CHANGES: () => BEHAVIOR_CHANGES,
|
|
24
|
+
V3_TO_V4_PATTERNS: () => V3_TO_V4_PATTERNS,
|
|
25
|
+
ZodV3ToV4Transformer: () => ZodV3ToV4Transformer,
|
|
26
|
+
createZodV3ToV4Handler: () => createZodV3ToV4Handler
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
|
|
30
|
+
// src/transformer.ts
|
|
31
|
+
var import_ts_morph = require("ts-morph");
|
|
32
|
+
|
|
33
|
+
// src/mappings.ts
|
|
34
|
+
var V3_TO_V4_PATTERNS = {
|
|
35
|
+
// z.record(valueSchema) -> z.record(z.string(), valueSchema)
|
|
36
|
+
recordSingleArg: /z\.record\((?!z\.string\(\)|z\.number\(\)|z\.symbol\(\))/g,
|
|
37
|
+
// error.errors -> error.issues
|
|
38
|
+
errorErrors: /\.errors\b/g,
|
|
39
|
+
// .brand<T>() -> .brand<T>() (same but check for proper usage)
|
|
40
|
+
brandUsage: /\.brand<([^>]+)>\(\)/g
|
|
41
|
+
};
|
|
42
|
+
var BEHAVIOR_CHANGES = /* @__PURE__ */ new Set([
|
|
43
|
+
"default",
|
|
44
|
+
// Type inference changed
|
|
45
|
+
"uuid",
|
|
46
|
+
// Stricter validation
|
|
47
|
+
"record",
|
|
48
|
+
// Requires key type
|
|
49
|
+
"discriminatedUnion",
|
|
50
|
+
// Stricter discriminator requirements
|
|
51
|
+
"function"
|
|
52
|
+
// Input/output parameter changes
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
// src/transformer.ts
|
|
56
|
+
var ZodV3ToV4Transformer = class {
|
|
57
|
+
errors = [];
|
|
58
|
+
warnings = [];
|
|
59
|
+
transform(sourceFile) {
|
|
60
|
+
this.errors = [];
|
|
61
|
+
this.warnings = [];
|
|
62
|
+
const filePath = sourceFile.getFilePath();
|
|
63
|
+
const originalCode = sourceFile.getFullText();
|
|
64
|
+
try {
|
|
65
|
+
this.transformRecordCalls(sourceFile);
|
|
66
|
+
this.transformErrorProperties(sourceFile);
|
|
67
|
+
this.checkBehaviorChanges(sourceFile);
|
|
68
|
+
return {
|
|
69
|
+
success: this.errors.length === 0,
|
|
70
|
+
filePath,
|
|
71
|
+
originalCode,
|
|
72
|
+
transformedCode: sourceFile.getFullText(),
|
|
73
|
+
errors: this.errors,
|
|
74
|
+
warnings: this.warnings
|
|
75
|
+
};
|
|
76
|
+
} catch (error) {
|
|
77
|
+
this.errors.push({
|
|
78
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
success: false,
|
|
82
|
+
filePath,
|
|
83
|
+
originalCode,
|
|
84
|
+
errors: this.errors,
|
|
85
|
+
warnings: this.warnings
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Transform z.record(valueSchema) to z.record(z.string(), valueSchema)
|
|
91
|
+
*/
|
|
92
|
+
transformRecordCalls(sourceFile) {
|
|
93
|
+
sourceFile.forEachDescendant((node) => {
|
|
94
|
+
if (import_ts_morph.Node.isCallExpression(node)) {
|
|
95
|
+
const expression = node.getExpression();
|
|
96
|
+
if (import_ts_morph.Node.isPropertyAccessExpression(expression)) {
|
|
97
|
+
const name = expression.getName();
|
|
98
|
+
const object = expression.getExpression();
|
|
99
|
+
if (name === "record" && object.getText() === "z") {
|
|
100
|
+
const args = node.getArguments();
|
|
101
|
+
if (args.length === 1) {
|
|
102
|
+
const valueSchema = args[0]?.getText();
|
|
103
|
+
if (valueSchema) {
|
|
104
|
+
node.replaceWithText(`z.record(z.string(), ${valueSchema})`);
|
|
105
|
+
this.warnings.push(
|
|
106
|
+
`${sourceFile.getFilePath()}:${node.getStartLineNumber()}: z.record() updated to include explicit key type z.string()`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Transform error.errors to error.issues
|
|
117
|
+
*/
|
|
118
|
+
transformErrorProperties(sourceFile) {
|
|
119
|
+
sourceFile.forEachDescendant((node) => {
|
|
120
|
+
if (import_ts_morph.Node.isPropertyAccessExpression(node)) {
|
|
121
|
+
const name = node.getName();
|
|
122
|
+
if (name === "errors") {
|
|
123
|
+
const object = node.getExpression();
|
|
124
|
+
const objectText = object.getText();
|
|
125
|
+
if (objectText.toLowerCase().includes("error") || objectText.toLowerCase().includes("err")) {
|
|
126
|
+
const fullText = node.getText();
|
|
127
|
+
const newText = fullText.replace(/\.errors$/, ".issues");
|
|
128
|
+
node.replaceWithText(newText);
|
|
129
|
+
this.warnings.push(
|
|
130
|
+
`${sourceFile.getFilePath()}:${node.getStartLineNumber()}: .errors renamed to .issues (ZodError property change)`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check for methods with behavior changes and add warnings
|
|
139
|
+
*/
|
|
140
|
+
checkBehaviorChanges(sourceFile) {
|
|
141
|
+
const filePath = sourceFile.getFilePath();
|
|
142
|
+
sourceFile.forEachDescendant((node) => {
|
|
143
|
+
if (import_ts_morph.Node.isCallExpression(node)) {
|
|
144
|
+
const expression = node.getExpression();
|
|
145
|
+
if (import_ts_morph.Node.isPropertyAccessExpression(expression)) {
|
|
146
|
+
const name = expression.getName();
|
|
147
|
+
if (BEHAVIOR_CHANGES.has(name)) {
|
|
148
|
+
const lineNumber = node.getStartLineNumber();
|
|
149
|
+
switch (name) {
|
|
150
|
+
case "default":
|
|
151
|
+
this.warnings.push(
|
|
152
|
+
`${filePath}:${lineNumber}: .default() has stricter type inference in v4. Verify default value matches schema type exactly.`
|
|
153
|
+
);
|
|
154
|
+
break;
|
|
155
|
+
case "uuid":
|
|
156
|
+
this.warnings.push(
|
|
157
|
+
`${filePath}:${lineNumber}: .uuid() now enforces strict RFC 4122 compliance. Non-standard UUIDs may fail validation.`
|
|
158
|
+
);
|
|
159
|
+
break;
|
|
160
|
+
case "discriminatedUnion":
|
|
161
|
+
this.warnings.push(
|
|
162
|
+
`${filePath}:${lineNumber}: z.discriminatedUnion() now requires a literal type for the discriminator property.`
|
|
163
|
+
);
|
|
164
|
+
break;
|
|
165
|
+
case "function":
|
|
166
|
+
this.warnings.push(
|
|
167
|
+
`${filePath}:${lineNumber}: z.function() parameter handling has changed. Review input/output schema definitions.`
|
|
168
|
+
);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
const text = sourceFile.getFullText();
|
|
176
|
+
if (text.includes(".flatten()")) {
|
|
177
|
+
const matches = text.matchAll(/\.flatten\(\)/g);
|
|
178
|
+
for (const match of matches) {
|
|
179
|
+
const pos = match.index ?? 0;
|
|
180
|
+
const lineNumber = sourceFile.getLineAndColumnAtPos(pos).line;
|
|
181
|
+
this.warnings.push(
|
|
182
|
+
`${filePath}:${lineNumber}: .flatten() is removed in v4. Use error.issues directly or implement custom flattening.`
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// src/handler.ts
|
|
190
|
+
function createZodV3ToV4Handler() {
|
|
191
|
+
const transformer = new ZodV3ToV4Transformer();
|
|
192
|
+
return {
|
|
193
|
+
transform(sourceFile, _options) {
|
|
194
|
+
return transformer.transform(sourceFile);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
199
|
+
0 && (module.exports = {
|
|
200
|
+
BEHAVIOR_CHANGES,
|
|
201
|
+
V3_TO_V4_PATTERNS,
|
|
202
|
+
ZodV3ToV4Transformer,
|
|
203
|
+
createZodV3ToV4Handler
|
|
204
|
+
});
|
|
205
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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;AA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W,QAAQ;AAEhC,cAAI,iBAAiB,IAAI,IAAI,GAAG;AAC9B,kBAAM,aAAa,KAAK,mBAAmB;AAE3C,oBAAQ,MAAM;AAAA,cACZ,KAAK;AACH,qBAAK,SAAS;AAAA,kBACZ,GAAG,QAAQ,IAAI,UAAU;AAAA,gBAE3B;AACA;AAAA,cAEF,KAAK;AACH,qBAAK,SAAS;AAAA,kBACZ,GAAG,QAAQ,IAAI,UAAU;AAAA,gBAE3B;AACA;AAAA,cAEF,KAAK;AACH,qBAAK,SAAS;AAAA,kBACZ,GAAG,QAAQ,IAAI,UAAU;AAAA,gBAE3B;AACA;AAAA,cAEF,KAAK;AACH,qBAAK,SAAS;AAAA,kBACZ,GAAG,QAAQ,IAAI,UAAU;AAAA,gBAE3B;AACA;AAAA,YACJ;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAGD,UAAM,OAAO,WAAW,YAAY;AACpC,QAAI,KAAK,SAAS,YAAY,GAAG;AAC/B,YAAM,UAAU,KAAK,SAAS,gBAAgB;AAC9C,iBAAW,SAAS,SAAS;AAC3B,cAAM,MAAM,MAAM,SAAS;AAC3B,cAAM,aAAa,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":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { TransformHandler, TransformResult } from '@schemashift/core';
|
|
2
|
+
import { SourceFile } from 'ts-morph';
|
|
3
|
+
|
|
4
|
+
declare function createZodV3ToV4Handler(): TransformHandler;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Zod v3 to v4 Breaking Changes
|
|
8
|
+
*
|
|
9
|
+
* Key changes in Zod v4:
|
|
10
|
+
* 1. z.record() now requires explicit key type
|
|
11
|
+
* 2. .default() has stricter type inference
|
|
12
|
+
* 3. error.errors renamed to error.issues
|
|
13
|
+
* 4. .uuid() has stricter validation (RFC 4122 compliant)
|
|
14
|
+
* 5. z.function() input/output changed
|
|
15
|
+
* 6. Branded types use different syntax
|
|
16
|
+
* 7. z.discriminatedUnion() requires literal discriminator
|
|
17
|
+
*/
|
|
18
|
+
declare const V3_TO_V4_PATTERNS: {
|
|
19
|
+
recordSingleArg: RegExp;
|
|
20
|
+
errorErrors: RegExp;
|
|
21
|
+
brandUsage: RegExp;
|
|
22
|
+
};
|
|
23
|
+
declare const BEHAVIOR_CHANGES: Set<string>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Zod v3 to v4 Transformer
|
|
27
|
+
*
|
|
28
|
+
* Handles breaking changes between Zod v3 and v4:
|
|
29
|
+
* - z.record() now requires explicit key type
|
|
30
|
+
* - error.errors -> error.issues
|
|
31
|
+
* - Stricter UUID validation
|
|
32
|
+
* - Type inference changes in .default()
|
|
33
|
+
*/
|
|
34
|
+
declare class ZodV3ToV4Transformer {
|
|
35
|
+
private errors;
|
|
36
|
+
private warnings;
|
|
37
|
+
transform(sourceFile: SourceFile): TransformResult;
|
|
38
|
+
/**
|
|
39
|
+
* Transform z.record(valueSchema) to z.record(z.string(), valueSchema)
|
|
40
|
+
*/
|
|
41
|
+
private transformRecordCalls;
|
|
42
|
+
/**
|
|
43
|
+
* Transform error.errors to error.issues
|
|
44
|
+
*/
|
|
45
|
+
private transformErrorProperties;
|
|
46
|
+
/**
|
|
47
|
+
* Check for methods with behavior changes and add warnings
|
|
48
|
+
*/
|
|
49
|
+
private checkBehaviorChanges;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { BEHAVIOR_CHANGES, V3_TO_V4_PATTERNS, ZodV3ToV4Transformer, createZodV3ToV4Handler };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { TransformHandler, TransformResult } from '@schemashift/core';
|
|
2
|
+
import { SourceFile } from 'ts-morph';
|
|
3
|
+
|
|
4
|
+
declare function createZodV3ToV4Handler(): TransformHandler;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Zod v3 to v4 Breaking Changes
|
|
8
|
+
*
|
|
9
|
+
* Key changes in Zod v4:
|
|
10
|
+
* 1. z.record() now requires explicit key type
|
|
11
|
+
* 2. .default() has stricter type inference
|
|
12
|
+
* 3. error.errors renamed to error.issues
|
|
13
|
+
* 4. .uuid() has stricter validation (RFC 4122 compliant)
|
|
14
|
+
* 5. z.function() input/output changed
|
|
15
|
+
* 6. Branded types use different syntax
|
|
16
|
+
* 7. z.discriminatedUnion() requires literal discriminator
|
|
17
|
+
*/
|
|
18
|
+
declare const V3_TO_V4_PATTERNS: {
|
|
19
|
+
recordSingleArg: RegExp;
|
|
20
|
+
errorErrors: RegExp;
|
|
21
|
+
brandUsage: RegExp;
|
|
22
|
+
};
|
|
23
|
+
declare const BEHAVIOR_CHANGES: Set<string>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Zod v3 to v4 Transformer
|
|
27
|
+
*
|
|
28
|
+
* Handles breaking changes between Zod v3 and v4:
|
|
29
|
+
* - z.record() now requires explicit key type
|
|
30
|
+
* - error.errors -> error.issues
|
|
31
|
+
* - Stricter UUID validation
|
|
32
|
+
* - Type inference changes in .default()
|
|
33
|
+
*/
|
|
34
|
+
declare class ZodV3ToV4Transformer {
|
|
35
|
+
private errors;
|
|
36
|
+
private warnings;
|
|
37
|
+
transform(sourceFile: SourceFile): TransformResult;
|
|
38
|
+
/**
|
|
39
|
+
* Transform z.record(valueSchema) to z.record(z.string(), valueSchema)
|
|
40
|
+
*/
|
|
41
|
+
private transformRecordCalls;
|
|
42
|
+
/**
|
|
43
|
+
* Transform error.errors to error.issues
|
|
44
|
+
*/
|
|
45
|
+
private transformErrorProperties;
|
|
46
|
+
/**
|
|
47
|
+
* Check for methods with behavior changes and add warnings
|
|
48
|
+
*/
|
|
49
|
+
private checkBehaviorChanges;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { BEHAVIOR_CHANGES, V3_TO_V4_PATTERNS, ZodV3ToV4Transformer, createZodV3ToV4Handler };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// src/transformer.ts
|
|
2
|
+
import { Node } from "ts-morph";
|
|
3
|
+
|
|
4
|
+
// src/mappings.ts
|
|
5
|
+
var V3_TO_V4_PATTERNS = {
|
|
6
|
+
// z.record(valueSchema) -> z.record(z.string(), valueSchema)
|
|
7
|
+
recordSingleArg: /z\.record\((?!z\.string\(\)|z\.number\(\)|z\.symbol\(\))/g,
|
|
8
|
+
// error.errors -> error.issues
|
|
9
|
+
errorErrors: /\.errors\b/g,
|
|
10
|
+
// .brand<T>() -> .brand<T>() (same but check for proper usage)
|
|
11
|
+
brandUsage: /\.brand<([^>]+)>\(\)/g
|
|
12
|
+
};
|
|
13
|
+
var BEHAVIOR_CHANGES = /* @__PURE__ */ new Set([
|
|
14
|
+
"default",
|
|
15
|
+
// Type inference changed
|
|
16
|
+
"uuid",
|
|
17
|
+
// Stricter validation
|
|
18
|
+
"record",
|
|
19
|
+
// Requires key type
|
|
20
|
+
"discriminatedUnion",
|
|
21
|
+
// Stricter discriminator requirements
|
|
22
|
+
"function"
|
|
23
|
+
// Input/output parameter changes
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
// src/transformer.ts
|
|
27
|
+
var ZodV3ToV4Transformer = class {
|
|
28
|
+
errors = [];
|
|
29
|
+
warnings = [];
|
|
30
|
+
transform(sourceFile) {
|
|
31
|
+
this.errors = [];
|
|
32
|
+
this.warnings = [];
|
|
33
|
+
const filePath = sourceFile.getFilePath();
|
|
34
|
+
const originalCode = sourceFile.getFullText();
|
|
35
|
+
try {
|
|
36
|
+
this.transformRecordCalls(sourceFile);
|
|
37
|
+
this.transformErrorProperties(sourceFile);
|
|
38
|
+
this.checkBehaviorChanges(sourceFile);
|
|
39
|
+
return {
|
|
40
|
+
success: this.errors.length === 0,
|
|
41
|
+
filePath,
|
|
42
|
+
originalCode,
|
|
43
|
+
transformedCode: sourceFile.getFullText(),
|
|
44
|
+
errors: this.errors,
|
|
45
|
+
warnings: this.warnings
|
|
46
|
+
};
|
|
47
|
+
} catch (error) {
|
|
48
|
+
this.errors.push({
|
|
49
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
filePath,
|
|
54
|
+
originalCode,
|
|
55
|
+
errors: this.errors,
|
|
56
|
+
warnings: this.warnings
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Transform z.record(valueSchema) to z.record(z.string(), valueSchema)
|
|
62
|
+
*/
|
|
63
|
+
transformRecordCalls(sourceFile) {
|
|
64
|
+
sourceFile.forEachDescendant((node) => {
|
|
65
|
+
if (Node.isCallExpression(node)) {
|
|
66
|
+
const expression = node.getExpression();
|
|
67
|
+
if (Node.isPropertyAccessExpression(expression)) {
|
|
68
|
+
const name = expression.getName();
|
|
69
|
+
const object = expression.getExpression();
|
|
70
|
+
if (name === "record" && object.getText() === "z") {
|
|
71
|
+
const args = node.getArguments();
|
|
72
|
+
if (args.length === 1) {
|
|
73
|
+
const valueSchema = args[0]?.getText();
|
|
74
|
+
if (valueSchema) {
|
|
75
|
+
node.replaceWithText(`z.record(z.string(), ${valueSchema})`);
|
|
76
|
+
this.warnings.push(
|
|
77
|
+
`${sourceFile.getFilePath()}:${node.getStartLineNumber()}: z.record() updated to include explicit key type z.string()`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Transform error.errors to error.issues
|
|
88
|
+
*/
|
|
89
|
+
transformErrorProperties(sourceFile) {
|
|
90
|
+
sourceFile.forEachDescendant((node) => {
|
|
91
|
+
if (Node.isPropertyAccessExpression(node)) {
|
|
92
|
+
const name = node.getName();
|
|
93
|
+
if (name === "errors") {
|
|
94
|
+
const object = node.getExpression();
|
|
95
|
+
const objectText = object.getText();
|
|
96
|
+
if (objectText.toLowerCase().includes("error") || objectText.toLowerCase().includes("err")) {
|
|
97
|
+
const fullText = node.getText();
|
|
98
|
+
const newText = fullText.replace(/\.errors$/, ".issues");
|
|
99
|
+
node.replaceWithText(newText);
|
|
100
|
+
this.warnings.push(
|
|
101
|
+
`${sourceFile.getFilePath()}:${node.getStartLineNumber()}: .errors renamed to .issues (ZodError property change)`
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check for methods with behavior changes and add warnings
|
|
110
|
+
*/
|
|
111
|
+
checkBehaviorChanges(sourceFile) {
|
|
112
|
+
const filePath = sourceFile.getFilePath();
|
|
113
|
+
sourceFile.forEachDescendant((node) => {
|
|
114
|
+
if (Node.isCallExpression(node)) {
|
|
115
|
+
const expression = node.getExpression();
|
|
116
|
+
if (Node.isPropertyAccessExpression(expression)) {
|
|
117
|
+
const name = expression.getName();
|
|
118
|
+
if (BEHAVIOR_CHANGES.has(name)) {
|
|
119
|
+
const lineNumber = node.getStartLineNumber();
|
|
120
|
+
switch (name) {
|
|
121
|
+
case "default":
|
|
122
|
+
this.warnings.push(
|
|
123
|
+
`${filePath}:${lineNumber}: .default() has stricter type inference in v4. Verify default value matches schema type exactly.`
|
|
124
|
+
);
|
|
125
|
+
break;
|
|
126
|
+
case "uuid":
|
|
127
|
+
this.warnings.push(
|
|
128
|
+
`${filePath}:${lineNumber}: .uuid() now enforces strict RFC 4122 compliance. Non-standard UUIDs may fail validation.`
|
|
129
|
+
);
|
|
130
|
+
break;
|
|
131
|
+
case "discriminatedUnion":
|
|
132
|
+
this.warnings.push(
|
|
133
|
+
`${filePath}:${lineNumber}: z.discriminatedUnion() now requires a literal type for the discriminator property.`
|
|
134
|
+
);
|
|
135
|
+
break;
|
|
136
|
+
case "function":
|
|
137
|
+
this.warnings.push(
|
|
138
|
+
`${filePath}:${lineNumber}: z.function() parameter handling has changed. Review input/output schema definitions.`
|
|
139
|
+
);
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
const text = sourceFile.getFullText();
|
|
147
|
+
if (text.includes(".flatten()")) {
|
|
148
|
+
const matches = text.matchAll(/\.flatten\(\)/g);
|
|
149
|
+
for (const match of matches) {
|
|
150
|
+
const pos = match.index ?? 0;
|
|
151
|
+
const lineNumber = sourceFile.getLineAndColumnAtPos(pos).line;
|
|
152
|
+
this.warnings.push(
|
|
153
|
+
`${filePath}:${lineNumber}: .flatten() is removed in v4. Use error.issues directly or implement custom flattening.`
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// src/handler.ts
|
|
161
|
+
function createZodV3ToV4Handler() {
|
|
162
|
+
const transformer = new ZodV3ToV4Transformer();
|
|
163
|
+
return {
|
|
164
|
+
transform(sourceFile, _options) {
|
|
165
|
+
return transformer.transform(sourceFile);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
BEHAVIOR_CHANGES,
|
|
171
|
+
V3_TO_V4_PATTERNS,
|
|
172
|
+
ZodV3ToV4Transformer,
|
|
173
|
+
createZodV3ToV4Handler
|
|
174
|
+
};
|
|
175
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transformer.ts","../src/mappings.ts","../src/handler.ts"],"sourcesContent":["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":";AACA,SAAS,YAA6B;;;ACa/B,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;AAC9B,kBAAM,aAAa,KAAK,mBAAmB;AAE3C,oBAAQ,MAAM;AAAA,cACZ,KAAK;AACH,qBAAK,SAAS;AAAA,kBACZ,GAAG,QAAQ,IAAI,UAAU;AAAA,gBAE3B;AACA;AAAA,cAEF,KAAK;AACH,qBAAK,SAAS;AAAA,kBACZ,GAAG,QAAQ,IAAI,UAAU;AAAA,gBAE3B;AACA;AAAA,cAEF,KAAK;AACH,qBAAK,SAAS;AAAA,kBACZ,GAAG,QAAQ,IAAI,UAAU;AAAA,gBAE3B;AACA;AAAA,cAEF,KAAK;AACH,qBAAK,SAAS;AAAA,kBACZ,GAAG,QAAQ,IAAI,UAAU;AAAA,gBAE3B;AACA;AAAA,YACJ;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAGD,UAAM,OAAO,WAAW,YAAY;AACpC,QAAI,KAAK,SAAS,YAAY,GAAG;AAC/B,YAAM,UAAU,KAAK,SAAS,gBAAgB;AAC9C,iBAAW,SAAS,SAAS;AAC3B,cAAM,MAAM,MAAM,SAAS;AAC3B,cAAM,aAAa,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":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@schemashift/zod-v3-v4",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsup",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"typecheck": "tsc --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@schemashift/core": "0.2.0",
|
|
30
|
+
"ts-morph": "27.0.2"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
}
|
|
35
|
+
}
|