@express-zod-api/migration 24.1.0 → 25.0.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.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ESLintUtils } from '@typescript-eslint/utils';
2
2
 
3
3
  declare const _default: {
4
4
  rules: {
5
- v24: ESLintUtils.RuleModule<"change" | "add" | "move" | "remove", [], unknown, ESLintUtils.RuleListener>;
5
+ v25: ESLintUtils.RuleModule<"change" | "add" | "move" | "remove", [], unknown, ESLintUtils.RuleListener>;
6
6
  };
7
7
  };
8
8
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{ESLintUtils as l,AST_NODE_TYPES as r}from"@typescript-eslint/utils";import{readFileSync as u}from"node:fs";import{fileURLToPath as S}from"node:url";var d={numericRange:`${r.NewExpression}[callee.name='Documentation'] > ${r.ObjectExpression} > ${r.Property}[key.name='numericRange']`,optionalPropStyle:`${r.NewExpression}[callee.name='Integration'] > ${r.ObjectExpression} > ${r.Property}[key.name='optionalPropStyle']`,depicter:`${r.VariableDeclarator}[id.typeAnnotation.typeAnnotation.typeName.name='Depicter'] > ${r.ArrowFunctionExpression}`,nextCall:`${r.VariableDeclarator}[id.typeAnnotation.typeAnnotation.typeName.name='Depicter'] > ${r.ArrowFunctionExpression} ${r.CallExpression}[callee.name='next']`,zod:`${r.ImportDeclaration}[source.value='zod']`,ezFile:`${r.CallExpression}[arguments.0.type='${r.Literal}']:has( ${r.MemberExpression}[object.name='ez'][property.name='file'] )`},f=t=>Object.keys(t).reduce((e,n)=>Object.assign(e,{[d[n]]:t[n]}),{}),m=(t,e)=>[t.range[0],t.range[1]+(e.sourceCode.getTokenAfter(t)?.value===","?1:0)],c=t=>e=>t.report({node:e,messageId:"remove",data:{subject:e.key.name},fix:n=>n.removeRange(m(e,t))}),g=()=>{try{let t=S(new URL("zod/package.json",import.meta.url)),e=JSON.parse(u(t,"utf8"));if(typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string")return e.version}catch{}},y=l.RuleCreator.withoutDocs({meta:{type:"problem",fixable:"code",schema:[],messages:{change:"change {{ subject }} from {{ from }} to {{ to }}",add:"add {{ subject }} to {{ to }}",move:"move {{ subject }} to {{ to }}",remove:"remove {{ subject }}"}},defaultOptions:[],create:t=>f({numericRange:c(t),optionalPropStyle:c(t),depicter:e=>{let[n,a]=e.params;if(n?.type!==r.Identifier)return;let s=n.name;if(a?.type!==r.ObjectPattern)return;let i=a.properties.find(o=>o.type===r.Property&&o.key.type===r.Identifier&&o.key.name==="next");t.report({node:e,messageId:"change",data:{subject:"arguments",from:`[${s}, { next, ...rest }]`,to:`[{ zodSchema: ${s}, jsonSchema }, { ...rest }]`},fix:o=>{let p=[o.replaceText(n,`{ zodSchema: ${s}, jsonSchema }`)];return i&&p.push(o.removeRange(m(i,t))),p}})},nextCall:e=>t.report({node:e,messageId:"change",data:{subject:"statement",from:"next()",to:"jsonSchema"},fix:n=>n.replaceText(e,"jsonSchema")}),zod:e=>{g()?.startsWith("4.")||t.report({node:e.source,messageId:"change",data:{subject:"import",from:"zod",to:"zod/v4"},fix:n=>n.replaceText(e.source,'"zod/v4"')})},ezFile:e=>{let[n]=e.arguments,a=n.value==="buffer"?"ez.buffer()":n.value==="base64"?"z.base64()":n.value==="binary"?"ez.buffer().or(z.string())":"z.string()";t.report({node:e,messageId:"change",data:{subject:"schema",from:"ez.file()",to:a},fix:s=>s.replaceText(e,a)})}})}),z={rules:{v24:y}};export{z as default};
1
+ import{ESLintUtils as s,AST_NODE_TYPES as r}from"@typescript-eslint/utils";var o={zod:`${r.ImportDeclaration}[source.value='zod/v4']`,dateInOutExample:`${r.CallExpression}[callee.object.name='ez'][callee.property.name=/date(In|Out)/] >${r.ObjectExpression} > ${r.Property}[key.name='example']`,getExamples:`${r.CallExpression}[callee.name='getExamples']`},m=t=>Object.keys(t).reduce((e,a)=>Object.assign(e,{[o[a]]:t[a]}),{}),p=s.RuleCreator.withoutDocs({meta:{type:"problem",fixable:"code",schema:[],messages:{change:"change {{ subject }} from {{ from }} to {{ to }}",add:"add {{ subject }} to {{ to }}",move:"move {{ subject }} to {{ to }}",remove:"remove {{ subject }}"}},defaultOptions:[],create:t=>m({zod:e=>t.report({node:e.source,messageId:"change",data:{subject:"import",from:"zod/v4",to:"zod"},fix:a=>a.replaceText(e.source,'"zod"')}),dateInOutExample:e=>t.report({node:e,messageId:"change",data:{subject:"property",from:"example",to:"examples"},fix:a=>a.replaceText(e,`examples: [${t.sourceCode.getText(e.value)}]`)}),getExamples:e=>t.report({node:e,messageId:"change",data:{subject:"method",from:"getExamples()",to:".meta()?.examples || []"},fix:a=>a.replaceText(e,`(${t.sourceCode.getText(e.arguments[0])}.meta()?.examples || [])`)})})}),n={rules:{v25:p}};export{n as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@express-zod-api/migration",
3
- "version": "24.1.0",
3
+ "version": "25.0.0",
4
4
  "license": "MIT",
5
5
  "description": "Migration scripts for express-zod-api",
6
6
  "repository": {
@@ -15,19 +15,13 @@
15
15
  "bugs": "https://github.com/RobinTail/express-zod-api/issues",
16
16
  "funding": "https://github.com/sponsors/RobinTail",
17
17
  "type": "module",
18
- "main": "dist/index.cjs",
19
- "types": "dist/index.d.cts",
18
+ "main": "dist/index.js",
19
+ "types": "dist/index.d.ts",
20
20
  "module": "dist/index.js",
21
21
  "exports": {
22
22
  ".": {
23
- "import": {
24
- "types": "./dist/index.d.ts",
25
- "default": "./dist/index.js"
26
- },
27
- "require": {
28
- "types": "./dist/index.d.cts",
29
- "default": "./dist/index.cjs"
30
- }
23
+ "types": "./dist/index.d.ts",
24
+ "default": "./dist/index.js"
31
25
  }
32
26
  },
33
27
  "files": [
@@ -45,6 +39,6 @@
45
39
  "pretest": "tsc --noEmit",
46
40
  "test": "vitest run --globals",
47
41
  "build": "tsup",
48
- "postbuild": "attw --pack"
42
+ "postbuild": "attw --pack --profile esm-only"
49
43
  }
50
44
  }
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";var i=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},E=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of g(e))!y.call(t,o)&&o!==n&&i(t,o,{get:()=>e[o],enumerable:!(a=S(e,o))||a.enumerable});return t};var x=t=>E(i({},"__esModule",{value:!0}),t);var L={};T(L,{default:()=>$});module.exports=x(L);var b=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href,m=b();var r=require("@typescript-eslint/utils"),u=require("node:fs"),d=require("node:url"),h={numericRange:`${r.AST_NODE_TYPES.NewExpression}[callee.name='Documentation'] > ${r.AST_NODE_TYPES.ObjectExpression} > ${r.AST_NODE_TYPES.Property}[key.name='numericRange']`,optionalPropStyle:`${r.AST_NODE_TYPES.NewExpression}[callee.name='Integration'] > ${r.AST_NODE_TYPES.ObjectExpression} > ${r.AST_NODE_TYPES.Property}[key.name='optionalPropStyle']`,depicter:`${r.AST_NODE_TYPES.VariableDeclarator}[id.typeAnnotation.typeAnnotation.typeName.name='Depicter'] > ${r.AST_NODE_TYPES.ArrowFunctionExpression}`,nextCall:`${r.AST_NODE_TYPES.VariableDeclarator}[id.typeAnnotation.typeAnnotation.typeName.name='Depicter'] > ${r.AST_NODE_TYPES.ArrowFunctionExpression} ${r.AST_NODE_TYPES.CallExpression}[callee.name='next']`,zod:`${r.AST_NODE_TYPES.ImportDeclaration}[source.value='zod']`,ezFile:`${r.AST_NODE_TYPES.CallExpression}[arguments.0.type='${r.AST_NODE_TYPES.Literal}']:has( ${r.AST_NODE_TYPES.MemberExpression}[object.name='ez'][property.name='file'] )`},j=t=>Object.keys(t).reduce((e,n)=>Object.assign(e,{[h[n]]:t[n]}),{}),f=(t,e)=>[t.range[0],t.range[1]+(e.sourceCode.getTokenAfter(t)?.value===","?1:0)],l=t=>e=>t.report({node:e,messageId:"remove",data:{subject:e.key.name},fix:n=>n.removeRange(f(e,t))}),z=()=>{try{let t=(0,d.fileURLToPath)(new URL("zod/package.json",m)),e=JSON.parse((0,u.readFileSync)(t,"utf8"));if(typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string")return e.version}catch{}},v=r.ESLintUtils.RuleCreator.withoutDocs({meta:{type:"problem",fixable:"code",schema:[],messages:{change:"change {{ subject }} from {{ from }} to {{ to }}",add:"add {{ subject }} to {{ to }}",move:"move {{ subject }} to {{ to }}",remove:"remove {{ subject }}"}},defaultOptions:[],create:t=>j({numericRange:l(t),optionalPropStyle:l(t),depicter:e=>{let[n,a]=e.params;if(n?.type!==r.AST_NODE_TYPES.Identifier)return;let o=n.name;if(a?.type!==r.AST_NODE_TYPES.ObjectPattern)return;let c=a.properties.find(s=>s.type===r.AST_NODE_TYPES.Property&&s.key.type===r.AST_NODE_TYPES.Identifier&&s.key.name==="next");t.report({node:e,messageId:"change",data:{subject:"arguments",from:`[${o}, { next, ...rest }]`,to:`[{ zodSchema: ${o}, jsonSchema }, { ...rest }]`},fix:s=>{let p=[s.replaceText(n,`{ zodSchema: ${o}, jsonSchema }`)];return c&&p.push(s.removeRange(f(c,t))),p}})},nextCall:e=>t.report({node:e,messageId:"change",data:{subject:"statement",from:"next()",to:"jsonSchema"},fix:n=>n.replaceText(e,"jsonSchema")}),zod:e=>{z()?.startsWith("4.")||t.report({node:e.source,messageId:"change",data:{subject:"import",from:"zod",to:"zod/v4"},fix:n=>n.replaceText(e.source,'"zod/v4"')})},ezFile:e=>{let[n]=e.arguments,a=n.value==="buffer"?"ez.buffer()":n.value==="base64"?"z.base64()":n.value==="binary"?"ez.buffer().or(z.string())":"z.string()";t.report({node:e,messageId:"change",data:{subject:"schema",from:"ez.file()",to:a},fix:o=>o.replaceText(e,a)})}})}),$={rules:{v24:v}};
package/dist/index.d.cts DELETED
@@ -1,9 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
-
3
- declare const _default: {
4
- rules: {
5
- v24: ESLintUtils.RuleModule<"change" | "add" | "move" | "remove", [], unknown, ESLintUtils.RuleListener>;
6
- };
7
- };
8
-
9
- export = _default;