zen-app-plugin 0.5.13 → 0.5.15

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/plugin.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-app-plugin",
3
- "version": "0.5.13",
3
+ "version": "0.5.15",
4
4
  "description": "app代码生成器",
5
5
  "main": "index.js",
6
6
  "author": "zen",
package/plugin.js CHANGED
@@ -1 +1 @@
1
- !function(){const e=require("path"),n=require("fs"),t=require("chokidar"),o=require("./makeIndex"),{remote:s,locale:i}=require("./compress"),{makeRootIndex:r,makeSonIndex:p,makeComponentIndex:c}=o,l=["components","blocks"];module.exports=class{constructor(e){this.target=e,this.watchList=[]}init(o){const s=e.join(o,"src"),i=e.join(o,"src","pages");if(n.existsSync(i)){const o=t.watch(i,{depth:2,usePolling:!1});this.watchList.push(o),o.on("addDir",(t=>{const o=e.join(t,"index.js");if(n.existsSync(o)||t.indexOf(".lowcode")>-1)return;const s=e.resolve(t).split(e.sep),r=s.pop();let c=s[s.length-1];const a=e.join(t,r+".vue");if(n.existsSync(a)||"pages"===c||l.includes(r)||l.includes(c))return;s.length-s.indexOf(c)==1&&(c=s[s.length-2]+e.sep+c),n.writeFileSync(a,"<template>\n <div>Zen Page</div>\n</template>\n\n<script>\nexport default {\n data() {\n return {};\n },\n created() { },\n};\n<\/script>"),p(s.join(e.sep),c,i)})),o.on("unlinkDir",(n=>{const t=e.resolve(n).split(e.sep);t.pop();const o=t.join(e.sep);let s=t.pop();"pages"===s?r(i):(t.length-t.indexOf("pages")==2&&(s=t.pop()+e.sep+s),p(o,s))})),r(i),o.on("error",(function(e){console.error("webpack AutoCodePlugin Error happened: ",e)}))}const a=e.join(s,"components"),d=t.watch(a,{depth:1,usePolling:!1});this.watchList.push(d),d.on("addDir",(t=>{const o=e.resolve(t).split(e.sep),s=o.pop(),i=e.join(t,s+".vue"),r=e.join(t,s+".js");if(n.existsSync(i)||n.existsSync(r)||"components"===s||"components"!==o[o.length-1])return;n.writeFileSync(i,"<template>\n <div>Zen Component</div>\n</template>\n\n<script>\nexport default {\n data() {\n return {};\n },\n created() { },\n};\n<\/script>"),c(a)})),d.on("unlinkDir",(n=>{const t=e.resolve(n).split(e.sep);"components"===t[t.length-2]&&c(a)}))}apply(e){const{mode:n,context:t}=e.options;if("development"===n)return this.init(t);e.hooks.done.tap("ZenAppPlugin",(e=>{e.compilation.errors.length>0||setTimeout((()=>{"local"===this.target?i(t):s(t,this.target)}),600)}))}}}();
1
+ !function(){const e=require("path"),n=require("fs"),t=require("chokidar"),o=require("./makeIndex"),{remote:s,locale:i}=require("./compress"),{makeRootIndex:r,makeSonIndex:p,makeComponentIndex:c}=o,l=["components","blocks"];module.exports=class{constructor(e){this.target=e,this.watchList=[]}init(o){const s=e.join(o,"src"),i=e.join(o,"src","pages");if(n.existsSync(i)){const o=t.watch(i,{depth:2,usePolling:!1});this.watchList.push(o),o.on("addDir",(t=>{const o=e.join(t,"index.js");if(n.existsSync(o)||t.indexOf(".lowcode")>-1)return;const s=e.resolve(t).split(e.sep),r=s.pop();let c=s[s.length-1];const a=e.join(t,r+".vue");if(n.existsSync(a)||l.includes(r)||l.includes(c))return;s.length-s.indexOf(c)==1&&(c=s[s.length-2]+e.sep+c),n.writeFileSync(a,"<template>\n <div>Zen Page</div>\n</template>\n\n<script>\nexport default {\n data() {\n return {};\n },\n created() { },\n};\n<\/script>"),p(s.join(e.sep),c,i)})),o.on("unlinkDir",(n=>{const t=e.resolve(n).split(e.sep);t.pop();const o=t.join(e.sep);let s=t.pop();"pages"===s?r(i):(t.length-t.indexOf("pages")==2&&(s=t.pop()+e.sep+s),p(o,s,i))})),r(i),o.on("error",(function(e){console.error("webpack AutoCodePlugin Error happened: ",e)}))}const a=e.join(s,"components"),d=t.watch(a,{depth:1,usePolling:!1});this.watchList.push(d),d.on("addDir",(t=>{const o=e.resolve(t).split(e.sep),s=o.pop(),i=e.join(t,s+".vue"),r=e.join(t,s+".js");if(n.existsSync(i)||n.existsSync(r)||"components"===s||"components"!==o[o.length-1])return;n.writeFileSync(i,"<template>\n <div>Zen Component</div>\n</template>\n\n<script>\nexport default {\n data() {\n return {};\n },\n created() { },\n};\n<\/script>"),c(a)})),d.on("unlinkDir",(n=>{const t=e.resolve(n).split(e.sep);"components"===t[t.length-2]&&c(a)}))}apply(e){const{mode:n,context:t}=e.options;if("development"===n)return this.init(t);e.hooks.done.tap("ZenAppPlugin",(e=>{e.compilation.errors.length>0||setTimeout((()=>{"local"===this.target?i(t):s(t,this.target)}),600)}))}}}();