zen-app-plugin 0.2.4 → 0.2.6

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/camelcase.js ADDED
@@ -0,0 +1 @@
1
+ !function(){const e=/[\p{Lu}]/u,r=/[\p{Ll}]/u,t=/^[\p{Lu}](?![\p{Lu}])/gu,s=/([\p{Alpha}\p{N}_]|$)/u,l=/[_.\- ]+/,a=new RegExp("^"+l.source),c=new RegExp(l.source+s.source,"gu"),p=new RegExp("\\d+"+s.source,"gu");exports.camelCase=function(s,n){if("string"!=typeof s&&!Array.isArray(s))throw new TypeError("Expected the input to be `string | string[]`");if(n={pascalCase:!1,preserveConsecutiveUppercase:!1,...n},0===(s=Array.isArray(s)?s.map((e=>e.trim())).filter((e=>e.length)).join("-"):s.trim()).length)return"";const o=!1===n.locale?e=>e.toLowerCase():e=>e.toLocaleLowerCase(n.locale),i=!1===n.locale?e=>e.toUpperCase():e=>e.toLocaleUpperCase(n.locale);if(1===s.length)return l.test(s)?"":n.pascalCase?i(s):o(s);return s!==o(s)&&(s=((t,s,l,a)=>{let c=!1,p=!1,n=!1,o=!1;for(let i=0;i<t.length;i++){const u=t[i];o=!(i>2)||"-"===t[i-3],c&&e.test(u)?(t=t.slice(0,i)+"-"+t.slice(i),c=!1,n=p,p=!0,i++):p&&n&&r.test(u)&&(!o||a)?(t=t.slice(0,i-1)+"-"+t.slice(i-1),n=p,p=!1,c=!0):(c=s(u)===u&&l(u)!==u,n=p,p=l(u)===u&&s(u)!==u)}return t})(s,o,i,n.preserveConsecutiveUppercase)),s=s.replace(a,""),s=n.preserveConsecutiveUppercase?((e,r)=>(t.lastIndex=0,e.replaceAll(t,(e=>r(e)))))(s,o):o(s),n.pascalCase&&(s=i(s.charAt(0))+s.slice(1)),((e,r)=>(c.lastIndex=0,p.lastIndex=0,e.replaceAll(p,((t,s,l)=>["_","-"].includes(e.charAt(l+t.length))?t:r(t))).replaceAll(c,((e,t)=>r(t)))))(s,i)}}();
package/makeIndex.js CHANGED
@@ -1 +1 @@
1
- !function(){const n=require("path"),e=require("fs"),t=["components","blocks"];let o;import("camelcase").then((n=>{o=n.default}));const i=function(t){const o=[],i=[],r=[];e.readdirSync(t).sort(((n,e)=>n.localeCompare(e))).forEach((c=>{const u=n.join(t,c,"index.js");if(e.existsSync(u))o.push(`import ${c} from './${c}/index';`),i.push(c);else{const u=n.join(t,c,c+".vue");if(e.existsSync(u))r.push(`${c}: () => import( /* webpackChunkName: "pages/${c}" */ "./${c}/${c}.vue")`);else{if(c.indexOf(".")>-1)return;s(n.join(t,c),c)&&(o.push(`import ${c} from './${c}/index';`),i.push(c))}}}));const c=r.length>0?`const vueFiles = {\n\t${r.join(",\n\t")}\n};`:"",u=`${o.join("\n")}\n${c}\nexport default {${c?"\n\t...vueFiles,":""}\n ${i.length>0?"..."+i.join(",\n\t..."):""}\n};`;e.writeFileSync(n.join(t,"index.js"),u,(()=>{}))},s=function(s,r,c){const u=n.join(s,"index.js");let p=[],a=[];if(!e.existsSync(s)||"."===r[0]||t.includes(r))return!1;const l=!e.existsSync(u);if(e.readdirSync(s).sort(((n,e)=>n.localeCompare(e))).forEach((t=>{const i=n.join(s,t,t+".vue");if(t.indexOf(".")>-1||!e.existsSync(i))return;const c=o(r.replace(/\//gi,"_")+"_"+t,{pascalCase:!0});p.push(`import ${c} from "./${t}/${t}";`),a.push(`'${r}/${t}': ${c}`)})),0===p.length)return!1;const f=`${p.join("\n")}\n\nexport default {\n\t${a.join(",\n\t")}\n}`;return e.writeFileSync(u,f),l&&i(c),!0};exports.makeRootIndex=i,exports.makeSonIndex=s,exports.makeComponentIndex=function(t){let o=n.join(t,"index.js"),i=e.readdirSync(t),s=[],r=[];i.map((o=>{if(o.indexOf(".")>-1)return;let i=n.join(t,o,o+".vue");e.existsSync(i)&&(r.push(o),s.unshift(`import ${o} from "./${o}/${o}";`))}));const c=`${s.join("\n")}\nexport default {\n ${r.join(",\n\t")}\n}\n`;return e.writeFileSync(o,c)}}();
1
+ !function(){const n=require("path"),e=require("fs"),t=["components","blocks"],{camelCase:i}=require("./camelcase"),o=function(t){const i=[],o=[],r=[];e.readdirSync(t).sort(((n,e)=>n.localeCompare(e))).forEach((c=>{const u=n.join(t,c,"index.js");if(e.existsSync(u))i.push(`import ${c} from './${c}/index';`),o.push(c);else{const u=n.join(t,c,c+".vue");if(e.existsSync(u))r.push(`${c}: () => import( /* webpackChunkName: "pages/${c}" */ "./${c}/${c}.vue")`);else{if(c.indexOf(".")>-1)return;s(n.join(t,c),c)&&(i.push(`import ${c} from './${c}/index';`),o.push(c))}}}));const c=r.length>0?`const vueFiles = {\n\t${r.join(",\n\t")}\n};`:"",u=`${i.join("\n")}\n${c}\nexport default {${c?"\n\t...vueFiles,":""}\n ${o.length>0?"..."+o.join(",\n\t..."):""}\n};`;e.writeFileSync(n.join(t,"index.js"),u,(()=>{}))},s=function(s,r,c){const u=n.join(s,"index.js");let p=[],a=[];if(!e.existsSync(s)||"."===r[0]||t.includes(r))return!1;const l=!e.existsSync(u);if(e.readdirSync(s).sort(((n,e)=>n.localeCompare(e))).forEach((t=>{const o=n.join(s,t,t+".vue");if(t.indexOf(".")>-1||!e.existsSync(o))return;const c=i(r.replace(/\//gi,"_")+"_"+t,{pascalCase:!0});p.push(`import ${c} from "./${t}/${t}";`),a.push(`'${r}/${t}': ${c}`)})),0===p.length)return!1;const $=`${p.join("\n")}\n\nexport default {\n\t${a.join(",\n\t")}\n}`;return e.writeFileSync(u,$),l&&o(c),!0};exports.makeRootIndex=o,exports.makeSonIndex=s,exports.makeComponentIndex=function(t){let i=n.join(t,"index.js"),o=e.readdirSync(t),s=[],r=[];o.map((i=>{if(i.indexOf(".")>-1)return;let o=n.join(t,i,i+".vue");e.existsSync(o)&&(r.push(i),s.unshift(`import ${i} from "./${i}/${i}";`))}));const c=`${s.join("\n")}\nexport default {\n ${r.join(",\n\t")}\n}\n`;return e.writeFileSync(i,c)}}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-app-plugin",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "app代码生成器",
5
5
  "main": "index.js",
6
6
  "author": "zen",