@epxing/cli 0.5.0-beta.7 → 0.5.0-beta.8

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.
@@ -1,2 +1,2 @@
1
- import{a as C}from"./SIBBFYRW.mjs";import{a as c,b as d,c as A}from"./OVN5O3EZ.mjs";var $=d(A(),1);import k from"node:fs";import b from"node:path";var v=c(s=>/^(?:el-date-picker|el-time-picker|ElDatePicker|ElTimePicker)$/.test(s||""),"isPicker"),E=c(s=>/^(?:format|value-format|valueFormat)$/.test(s||""),"isFormat"),u=c(s=>s?.name??s?.value,"keyOf"),P={sourceType:"unambiguous",plugins:["jsx","typescript"]};function _(s){let m={yyyy:"YYYY",yy:"YY",dd:"DD",d:"D"};return s.replace(/\[[^\]]*\]|yyyy|yy|dddd|ddd|dd|d/g,p=>m[p]||p)}c(_,"normalizePickerFormat");function S(s,m){if(!(!s||typeof s!="object")){typeof s.type=="string"&&m(s);for(let[p,f]of Object.entries(s))p==="loc"||p==="comments"||p==="tokens"||(Array.isArray(f)?f.forEach(y=>S(y,m)):f&&typeof f=="object"&&S(f,m))}}c(S,"walk");function O(s,{filename:m="component.vue"}={}){let p=new Map,f=new Set,y=c(t=>s.slice(0,t).split(`
2
- `).length,"lineAt");function n(t,e){f.add(`L${y(t)}\uFF1A${e}`)}c(n,"warn");function g(t,e,i){let o=_(i);if(o===i)return;let x=s.slice(t,e);if(/\\/.test(x)){n(t,"\u65E5\u671F\u683C\u5F0F\u542BJS\u8F6C\u4E49\u5B57\u7B26\uFF0C\u8FFD\u8E2A\u539F\u503C\u540E\u4FEE\u590D\uFF0C\u907F\u514D\u6539\u53D8\u8F6C\u4E49\u8BED\u4E49");return}p.set(t,{start:t,end:e,text:_(x),before:i,after:o,line:y(t)})}c(g,"literal");function l(t,e){if(t?.type==="StringLiteral")return g(e+t.start,e+t.end,t.value),!0;if(t?.type==="TemplateLiteral"&&!t.expressions.length)return g(e+t.start,e+t.end,t.quasis[0].value.cooked||""),!0;if(t?.type==="ConditionalExpression"){let i=l(t.consequent,e),o=l(t.alternate,e);return i&&o}if(t?.type==="LogicalExpression"){let i=l(t.left,e),o=l(t.right,e);return i&&o}return n(e+(t?.start||0),`\u65E5\u671F\u63A7\u4EF6\u52A8\u6001\u683C\u5F0F ${s.slice(e+(t?.start||0),e+(t?.end||0)).slice(0,100)}\uFF1A\u8FFD\u8E2A\u53D8\u91CF/\u5BF9\u8C61/\u51FD\u6570\u7684\u683C\u5F0F\u6765\u6E90\uFF0C\u786E\u8BA4\u7528\u9014\u540E\u4FEE\u590D\uFF1B\u4E0D\u8981\u5168\u5C40\u66FF\u6362\u540C\u540D\u540E\u7AEF/\u65E5\u671F\u5E93\u683C\u5F0F`),!1}c(l,"expression");function w(t){if(!(!t||typeof t!="object")){if(t.type===1&&v(t.tag)){for(let e of t.props)if(e.type===6&&E(e.name)&&e.value)g(e.value.loc.start.offset,e.value.loc.end.offset,e.value.content);else if(e.type===7&&e.name==="bind"){if(!e.arg||!e.arg.isStatic)n(e.loc.start.offset,"\u65E5\u671F\u63A7\u4EF6 v-bind \u5BF9\u8C61/\u52A8\u6001\u5C5E\u6027\u540D\uFF1A\u8FFD\u8E2A format/valueFormat/value-format \u5E76\u4FEE\u590D\u65E7 token");else if(E(e.arg.content)&&e.exp){if(e.exp.loc.source!==e.exp.content){n(e.loc.start.offset,"\u65E5\u671F\u683C\u5F0F\u7ED1\u5B9A\u542BHTML\u5B9E\u4F53\uFF0C\u89E3\u7801\u5E76\u6838\u5BF9\u540E\u4FEE\u590D");continue}try{l((0,$.parseExpression)(e.exp.content,P),e.exp.loc.start.offset)}catch(i){n(e.loc.start.offset,`\u65E5\u671F\u683C\u5F0F\u8868\u8FBE\u5F0F\u65E0\u6CD5\u89E3\u6790\uFF1A${i.message}`)}}}}Array.isArray(t.children)&&t.children.forEach(w)}}c(w,"templateNode");function D(t,e){let i;try{i=(0,$.parse)(t,P)}catch(r){n(e,`\u811A\u672C\u65E0\u6CD5\u89E3\u6790\uFF0C\u65E5\u671F\u63A7\u4EF6\u9700\u590D\u6838\uFF1A${r.message}`);return}let o=new Set(["ElDatePicker","ElTimePicker"]),x=new Set(["h","createElement","_c","_h","createVNode","_createVNode","createBlock","_createBlock"]);S(i,r=>{if(r.type==="ImportDeclaration"&&r.source.value==="element-plus")for(let a of r.specifiers)v(u(a.imported))&&o.add(a.local.name);if(r.type==="ImportDeclaration"&&r.source.value==="vue")for(let a of r.specifiers)/^(h|createVNode|createBlock)$/.test(u(a.imported))&&x.add(a.local.name);r.type==="VariableDeclarator"&&r.id.type==="Identifier"&&r.init?.type==="CallExpression"&&/^(?:_?resolveComponent)$/.test(u(r.init.callee))&&v(r.init.arguments[0]?.value)&&o.add(r.id.name)});function F(r){return v(u(r))||o.has(u(r))||r?.type==="CallExpression"&&/^(?:_?resolveComponent)$/.test(u(r.callee))&&v(r.arguments[0]?.value)}c(F,"pickerTag");function T(r){if(r){if(r.type!=="ObjectExpression"){n(e+r.start,"\u65E5\u671F\u63A7\u4EF6\u5C5E\u6027\u6765\u81EA\u53D8\u91CF/\u51FD\u6570\uFF1A\u8FFD\u8E2A\u683C\u5F0F\u914D\u7F6E\u540E\u4FEE\u590D");return}for(let a of r.properties){if(a.type==="SpreadElement"){n(e+a.start,"\u65E5\u671F\u63A7\u4EF6\u5C5E\u6027\u5C55\u5F00\uFF1A\u8FFD\u8E2A\u5C55\u5F00\u5BF9\u8C61\u4E2D\u7684\u65E7\u683C\u5F0F");continue}if(a.computed){n(e+a.start,"\u65E5\u671F\u63A7\u4EF6\u52A8\u6001\u5C5E\u6027\u952E\uFF1A\u590D\u6838\u683C\u5F0F\u914D\u7F6E");continue}E(u(a.key))?l(a.value,e):["attrs","props"].includes(u(a.key))&&T(a.value)}}}c(T,"propsObject"),S(i,r=>{if(r.type==="JSXOpeningElement"&&F(r.name))for(let a of r.attributes){if(a.type==="JSXSpreadAttribute"){n(e+a.start,"\u65E5\u671F\u63A7\u4EF6 JSX \u5C5E\u6027\u5C55\u5F00\uFF1A\u8FFD\u8E2A\u683C\u5F0F\u914D\u7F6E\u540E\u4FEE\u590D");continue}E(u(a.name))&&l(a.value?.type==="JSXExpressionContainer"?a.value.expression:a.value,e)}if(r.type==="CallExpression"){let a=r.callee?.type==="MemberExpression"?u(r.callee.property):u(r.callee);x.has(a)&&F(r.arguments[0])&&T(r.arguments[1])}})}if(c(D,"script"),/\.vue$/i.test(m)){let t=[],e=C(s,{parseMode:"sfc",onError:c(i=>t.push(i),"onError")});for(let i of t)n(i.loc?.start?.offset||0,`\u6A21\u677F\u89E3\u6790\u63D0\u793A\uFF0C\u9700\u590D\u6838\uFF1A${i.message}`);for(let i of e.children)if(i.tag==="template"&&w(i),i.tag==="script"&&i.children?.length){let o=i.children[0].loc.start.offset,x=i.children.at(-1).loc.end.offset;D(s.slice(o,x),o)}}else D(s,0);let j=[...p.values()].sort((t,e)=>e.start-t.start),h=s;for(let t of j)h=h.slice(0,t.start)+t.text+h.slice(t.end);return{src:h,count:j.length,fixes:j.reverse(),warnings:[...f]}}c(O,"fixDateFormats");function M(s,{apply:m=!1}={}){let p=[];function f(y){if(k.existsSync(y)){for(let n of k.readdirSync(y,{withFileTypes:!0}))if(n.isDirectory()&&!/^(?:node_modules|\.git|lib|dist)$/.test(n.name))f(b.join(y,n.name));else if(n.isFile()&&/\.(?:vue|[cm]?js|jsx|ts|tsx)$/.test(n.name)){let g=b.join(y,n.name),l=O(k.readFileSync(g,"utf8"),{filename:g});m&&l.count&&k.writeFileSync(g,l.src),(l.count||l.warnings.length)&&p.push({file:b.relative(s,g),...l})}}}return c(f,"scan"),f(b.join(s,"src")),p}c(M,"fixProjectDateFormats");export{O as a,M as b};
1
+ import{a as O}from"./7NAADJFP.mjs";import{a as c,c as C,d as A}from"./J7B2EWKH.mjs";var $=C(A(),1),d=C(O(),1);import k from"node:fs";import b from"node:path";var v=c(s=>/^(?:el-date-picker|el-time-picker|ElDatePicker|ElTimePicker)$/.test(s||""),"isPicker"),E=c(s=>/^(?:format|value-format|valueFormat)$/.test(s||""),"isFormat"),u=c(s=>s?.name??s?.value,"keyOf"),P={sourceType:"unambiguous",plugins:["jsx","typescript"]};function _(s){let m={yyyy:"YYYY",yy:"YY",dd:"DD",d:"D"};return s.replace(/\[[^\]]*\]|yyyy|yy|dddd|ddd|dd|d/g,p=>m[p]||p)}c(_,"normalizePickerFormat");function S(s,m){if(!(!s||typeof s!="object")){typeof s.type=="string"&&m(s);for(let[p,f]of Object.entries(s))p==="loc"||p==="comments"||p==="tokens"||(Array.isArray(f)?f.forEach(y=>S(y,m)):f&&typeof f=="object"&&S(f,m))}}c(S,"walk");function Y(s,{filename:m="component.vue"}={}){let p=new Map,f=new Set,y=c(t=>s.slice(0,t).split(`
2
+ `).length,"lineAt");function n(t,e){f.add(`L${y(t)}\uFF1A${e}`)}c(n,"warn");function g(t,e,i){let o=_(i);if(o===i)return;let x=s.slice(t,e);if(/\\/.test(x)){n(t,"\u65E5\u671F\u683C\u5F0F\u542BJS\u8F6C\u4E49\u5B57\u7B26\uFF0C\u8FFD\u8E2A\u539F\u503C\u540E\u4FEE\u590D\uFF0C\u907F\u514D\u6539\u53D8\u8F6C\u4E49\u8BED\u4E49");return}p.set(t,{start:t,end:e,text:_(x),before:i,after:o,line:y(t)})}c(g,"literal");function l(t,e){if(t?.type==="StringLiteral")return g(e+t.start,e+t.end,t.value),!0;if(t?.type==="TemplateLiteral"&&!t.expressions.length)return g(e+t.start,e+t.end,t.quasis[0].value.cooked||""),!0;if(t?.type==="ConditionalExpression"){let i=l(t.consequent,e),o=l(t.alternate,e);return i&&o}if(t?.type==="LogicalExpression"){let i=l(t.left,e),o=l(t.right,e);return i&&o}return n(e+(t?.start||0),`\u65E5\u671F\u63A7\u4EF6\u52A8\u6001\u683C\u5F0F ${s.slice(e+(t?.start||0),e+(t?.end||0)).slice(0,100)}\uFF1A\u8FFD\u8E2A\u53D8\u91CF/\u5BF9\u8C61/\u51FD\u6570\u7684\u683C\u5F0F\u6765\u6E90\uFF0C\u786E\u8BA4\u7528\u9014\u540E\u4FEE\u590D\uFF1B\u4E0D\u8981\u5168\u5C40\u66FF\u6362\u540C\u540D\u540E\u7AEF/\u65E5\u671F\u5E93\u683C\u5F0F`),!1}c(l,"expression");function w(t){if(!(!t||typeof t!="object")){if(t.type===1&&v(t.tag)){for(let e of t.props)if(e.type===6&&E(e.name)&&e.value)g(e.value.loc.start.offset,e.value.loc.end.offset,e.value.content);else if(e.type===7&&e.name==="bind"){if(!e.arg||!e.arg.isStatic)n(e.loc.start.offset,"\u65E5\u671F\u63A7\u4EF6 v-bind \u5BF9\u8C61/\u52A8\u6001\u5C5E\u6027\u540D\uFF1A\u8FFD\u8E2A format/valueFormat/value-format \u5E76\u4FEE\u590D\u65E7 token");else if(E(e.arg.content)&&e.exp){if(e.exp.loc.source!==e.exp.content){n(e.loc.start.offset,"\u65E5\u671F\u683C\u5F0F\u7ED1\u5B9A\u542BHTML\u5B9E\u4F53\uFF0C\u89E3\u7801\u5E76\u6838\u5BF9\u540E\u4FEE\u590D");continue}try{l((0,$.parseExpression)(e.exp.content,P),e.exp.loc.start.offset)}catch(i){n(e.loc.start.offset,`\u65E5\u671F\u683C\u5F0F\u8868\u8FBE\u5F0F\u65E0\u6CD5\u89E3\u6790\uFF1A${i.message}`)}}}}Array.isArray(t.children)&&t.children.forEach(w)}}c(w,"templateNode");function D(t,e){let i;try{i=(0,$.parse)(t,P)}catch(r){n(e,`\u811A\u672C\u65E0\u6CD5\u89E3\u6790\uFF0C\u65E5\u671F\u63A7\u4EF6\u9700\u590D\u6838\uFF1A${r.message}`);return}let o=new Set(["ElDatePicker","ElTimePicker"]),x=new Set(["h","createElement","_c","_h","createVNode","_createVNode","createBlock","_createBlock"]);S(i,r=>{if(r.type==="ImportDeclaration"&&r.source.value==="element-plus")for(let a of r.specifiers)v(u(a.imported))&&o.add(a.local.name);if(r.type==="ImportDeclaration"&&r.source.value==="vue")for(let a of r.specifiers)/^(h|createVNode|createBlock)$/.test(u(a.imported))&&x.add(a.local.name);r.type==="VariableDeclarator"&&r.id.type==="Identifier"&&r.init?.type==="CallExpression"&&/^(?:_?resolveComponent)$/.test(u(r.init.callee))&&v(r.init.arguments[0]?.value)&&o.add(r.id.name)});function F(r){return v(u(r))||o.has(u(r))||r?.type==="CallExpression"&&/^(?:_?resolveComponent)$/.test(u(r.callee))&&v(r.arguments[0]?.value)}c(F,"pickerTag");function T(r){if(r){if(r.type!=="ObjectExpression"){n(e+r.start,"\u65E5\u671F\u63A7\u4EF6\u5C5E\u6027\u6765\u81EA\u53D8\u91CF/\u51FD\u6570\uFF1A\u8FFD\u8E2A\u683C\u5F0F\u914D\u7F6E\u540E\u4FEE\u590D");return}for(let a of r.properties){if(a.type==="SpreadElement"){n(e+a.start,"\u65E5\u671F\u63A7\u4EF6\u5C5E\u6027\u5C55\u5F00\uFF1A\u8FFD\u8E2A\u5C55\u5F00\u5BF9\u8C61\u4E2D\u7684\u65E7\u683C\u5F0F");continue}if(a.computed){n(e+a.start,"\u65E5\u671F\u63A7\u4EF6\u52A8\u6001\u5C5E\u6027\u952E\uFF1A\u590D\u6838\u683C\u5F0F\u914D\u7F6E");continue}E(u(a.key))?l(a.value,e):["attrs","props"].includes(u(a.key))&&T(a.value)}}}c(T,"propsObject"),S(i,r=>{if(r.type==="JSXOpeningElement"&&F(r.name))for(let a of r.attributes){if(a.type==="JSXSpreadAttribute"){n(e+a.start,"\u65E5\u671F\u63A7\u4EF6 JSX \u5C5E\u6027\u5C55\u5F00\uFF1A\u8FFD\u8E2A\u683C\u5F0F\u914D\u7F6E\u540E\u4FEE\u590D");continue}E(u(a.name))&&l(a.value?.type==="JSXExpressionContainer"?a.value.expression:a.value,e)}if(r.type==="CallExpression"){let a=r.callee?.type==="MemberExpression"?u(r.callee.property):u(r.callee);x.has(a)&&F(r.arguments[0])&&T(r.arguments[1])}})}if(c(D,"script"),/\.vue$/i.test(m)){let t=[],e=(0,d.parse)(s,{parseMode:"sfc",onError:c(i=>t.push(i),"onError")});for(let i of t)n(i.loc?.start?.offset||0,`\u6A21\u677F\u89E3\u6790\u63D0\u793A\uFF0C\u9700\u590D\u6838\uFF1A${i.message}`);for(let i of e.children)if(i.tag==="template"&&w(i),i.tag==="script"&&i.children?.length){let o=i.children[0].loc.start.offset,x=i.children.at(-1).loc.end.offset;D(s.slice(o,x),o)}}else D(s,0);let j=[...p.values()].sort((t,e)=>e.start-t.start),h=s;for(let t of j)h=h.slice(0,t.start)+t.text+h.slice(t.end);return{src:h,count:j.length,fixes:j.reverse(),warnings:[...f]}}c(Y,"fixDateFormats");function M(s,{apply:m=!1}={}){let p=[];function f(y){if(k.existsSync(y)){for(let n of k.readdirSync(y,{withFileTypes:!0}))if(n.isDirectory()&&!/^(?:node_modules|\.git|lib|dist)$/.test(n.name))f(b.join(y,n.name));else if(n.isFile()&&/\.(?:vue|[cm]?js|jsx|ts|tsx)$/.test(n.name)){let g=b.join(y,n.name),l=Y(k.readFileSync(g,"utf8"),{filename:g});m&&l.count&&k.writeFileSync(g,l.src),(l.count||l.warnings.length)&&p.push({file:b.relative(s,g),...l})}}}return c(f,"scan"),f(b.join(s,"src")),p}c(M,"fixProjectDateFormats");export{Y as a,M as b};
@@ -1,4 +1,4 @@
1
- import{a as o}from"./OVN5O3EZ.mjs";var a=`import { createRequire } from 'node:module'
1
+ import{a as o}from"./J7B2EWKH.mjs";var a=`import { createRequire } from 'node:module'
2
2
  import path from 'node:path'
3
3
  import { spawnSync } from 'node:child_process'
4
4