zod-v3-to-v4 1.6.0 → 1.6.1

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.
@@ -267,20 +267,17 @@ function convertNameToTopLevelApiAndWrapInUnion(node, options) {
267
267
  const { zodName, oldName, nameToWrap, renames } = options;
268
268
  const names = [nameToWrap];
269
269
  getCallExpressionsToConvert(node, { oldName: nameToWrap, names }).forEach((callExpression) => {
270
- // Remove deprecated names from the chain
271
270
  callExpression
272
271
  .getDescendantsOfKind(SyntaxKind.PropertyAccessExpression)
273
272
  .filter((expression) => names.includes(expression.getName()))
274
273
  .forEach((expression) => {
275
274
  const parent = expression.getFirstAncestorByKind(SyntaxKind.CallExpression);
276
- parent?.replaceWithText(expression.getExpression().getText());
275
+ const text = expression.getExpression().getText();
276
+ const unionText = renames
277
+ .map(({ name }) => `${text}.${name}()`)
278
+ .join(", ");
279
+ parent?.replaceWithText(`${zodName}.union([${unionText}])`);
277
280
  });
278
- // Nest the whole expression inside a union for ipv4() & ipv6()
279
- const text = callExpression.getText();
280
- const unionText = renames
281
- .map(({ name }) => `${text}.${name}()`)
282
- .join(", ");
283
- callExpression?.replaceWithText(`${zodName}.union([${unionText}])`);
284
281
  convertNameToTopLevelApi(callExpression, {
285
282
  zodName,
286
283
  oldName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-v3-to-v4",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Migrate Zod from v3 to v4",
5
5
  "keywords": [
6
6
  "zod",