zen-app-plugin 0.2.7 → 0.2.9

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/compress.js +1 -1
  2. package/package.json +1 -1
package/compress.js CHANGED
@@ -1 +1 @@
1
- !function(){const e=require("os"),t=require("simple-git"),s=require("shelljs"),n=require("pako"),i=t("./"),c=new RegExp("(https?:)?//((b|a)\\.(ebus))\\.vip/.+?\\.(svg|js|png|gif|jpe?g|ttf|woff2?|eot|css)","gi"),r=[".js",".css",".svg"],o=[".js",".css",".xml"],a=require("fs"),{join:u,dirname:f,resolve:l,extname:d}=require("path"),p=require("cos-nodejs-sdk-v5");let g,x,y,m;function S(e){const t=u(e,"package.json"),s=a.readFileSync(t,"utf8");return JSON.parse(s)}function O(e,t){a.readdirSync(e).forEach((s=>{if(0===s.indexOf(".")||s.indexOf(".html")>-1)return;let i=u(e,s),c=a.statSync(i);if(c.isDirectory()&&O(i,u(t,s)),c.isFile()){let e=u(t,s).replace(/\\/gi,"/"),c={Bucket:y.bucket,Region:y.region,Key:e,StorageClass:"STANDARD"},r=e.indexOf(".js")>-1;r||e.indexOf(".css")>-1?(c.Headers={"Content-Encoding":"gzip","Content-Type":r?"application/javascript":"text/css"},c.Body=Buffer.from(n.gzip(a.readFileSync(i,"utf8")))):c.Body=a.createReadStream(i),x.putObject(c,((t,s)=>{if(t)return console.log(t,s);console.log("//a.zeto.me/"+e)}))}}))}function h(e){const t=d(e);if(0===e.indexOf(".")||".html"===t)return;let i;if(i=e.indexOf("dist")>-1?g+e.substr(m.length+5):g+e.substr(m.length+7),s.mkdir("-p",f(i)),!r.includes(t))return s.cp(e,i);const l=a.readFileSync(e,"utf8").replace(c,(e=>e.indexOf("'")>-1||e.indexOf('"')>-1?e:function(e){let t=e.substr(e.indexOf(".vip")+4);t.startsWith("/f01")&&(t=t.substr(4));const n=u(g,t),i=d(n);if(!a.existsSync(n)||o.includes(i)){s.mkdir("-p",f(n));const t=e.indexOf(":")>-1?e:`https:${e}`;let i=`wget --timeout=15 -O "${n}" "${t}"`;(n.indexOf(".js")>-1||n.indexOf(".css")>-1)&&(i=`wget -qO- "${t}" | gzip > "${n}"`);const c=s.exec(i);if(0!==c.code)return console.error(`Failed to download ${i}: ${c.stderr}`),e}return t}(e)));a.writeFileSync(i,Buffer.from(n.gzip(l)),"utf8")}function j(e){const t=a.readdirSync(e);for(const s of t){if(s.startsWith("."))continue;const t=u(e,s),n=a.statSync(t);n.isDirectory()?j(t):n.isFile()&&h(t)}}exports.remote=function(t){m=t,y=JSON.parse(a.readFileSync(u(e.homedir(),".cc.json"))),x=new p({SecretId:y.id,SecretKey:y.key});const n=S(t);i.branchLocal(((e,i)=>{let c=n.name;const r=function(e,t){const s=u(e,"..",t,"src","main","resources","config","app");try{const e=a.readFileSync(s,"utf8");return JSON.parse(e).tag}catch(e){return""}}(t,c);let o=r||i.current;const f=u(t,"dist"),l=u(t,"public");["zen.js","zen.css","zen.wap.js","zen.wap.css"].forEach((e=>{const t=`wget --timeout=15 "https://b.ebus.vip/zeto/latest/${e}" -O - | gunzip > "${u(l,e)}"`;console.log(t),s.exec(t)})),O(f,`${c}/${o}`),a.existsSync(l)&&O(l,`${c}/${o}`)}))},exports.locale=function(e){m=e;const t=S(e).name;g=l(e,"..",t,"src","main","resources","static");const n=u(e,"public"),i=u(e,"dist");["zen.js","zen.css","zen.wap.js","zen.wap.css"].forEach((e=>{const t=`wget --timeout=15 "https://b.ebus.vip/zeto/latest/${e}" -O - | gunzip > "${u(n,e)}"`;console.log(t),s.exec(t)})),j(i),a.existsSync(n)&&j(n)}}();
1
+ !function(){const e=require("os"),t=require("simple-git"),s=require("shelljs"),n=require("pako"),i=t("./"),c=new RegExp("(https?:)?//((b|a)\\.(ebus))\\.vip/.+?\\.(svg|js|png|gif|jpe?g|ttf|woff2?|eot|css)","gi"),o=[".js",".css",".svg"],r=[".js",".css",".xml"],a=require("fs"),{join:f,dirname:l,resolve:u,extname:d}=require("path"),p=require("cos-nodejs-sdk-v5");let g,y,S,h;function x(e){const t=f(e,"package.json"),s=a.readFileSync(t,"utf8");return JSON.parse(s)}function m(e,t){a.readdirSync(e).forEach((s=>{if(0===s.indexOf(".")||s.indexOf(".html")>-1)return;let i=f(e,s),c=a.statSync(i);if(c.isDirectory()&&m(i,f(t,s)),c.isFile()){let e=f(t,s).replace(/\\/gi,"/"),c={Bucket:S.bucket,Region:S.region,Key:e,StorageClass:"STANDARD"},o=e.indexOf(".js")>-1;o||e.indexOf(".css")>-1?(c.Headers={"Content-Encoding":"gzip","Content-Type":o?"application/javascript":"text/css"},c.Body=Buffer.from(n.gzip(a.readFileSync(i,"utf8")))):c.Body=a.createReadStream(i),y.putObject(c,((t,s)=>{if(t)return console.log(t,s);console.log("//a.zeto.me/"+e)}))}}))}function O(e){const t=d(e);if(0===e.indexOf(".")||".html"===t)return;let i;if(i=e.indexOf("dist")>-1?g+e.substr(h.length+5):g+e.substr(h.length+7),s.mkdir("-p",l(i)),!o.includes(t))return s.cp(e,i);const u=a.readFileSync(e,"utf8").replace(c,(e=>e.indexOf("'")>-1||e.indexOf('"')>-1?e:function(e){let t=e.substr(e.indexOf(".vip")+4);t.startsWith("/f01")&&(t=t.substr(4));const n=f(g,t),i=d(n);if(!a.existsSync(n)||r.includes(i)){s.mkdir("-p",l(n));const t=e.indexOf(":")>-1?e:`https:${e}`;let i=`wget --timeout=15 -O "${n}" "${t}"`;(n.indexOf(".js")>-1||n.indexOf(".css")>-1)&&(i=`wget -qO- "${t}" | gzip > "${n}"`);const c=s.exec(i);if(0!==c.code)return console.error(`Failed to download ${i}: ${c.stderr}`),e}return t}(e)));a.writeFileSync(i,Buffer.from(n.gzip(u)),"utf8")}function b(e){const t=a.readdirSync(e);for(const s of t){if(s.startsWith("."))continue;const t=f(e,s),n=a.statSync(t);n.isDirectory()?b(t):n.isFile()&&O(t)}}function j(e,t){const s=a.readdirSync(e);for(const n of s){const s=f(e,n);if(a.statSync(s).isDirectory())j(s,t);else if(e.indexOf(".lowcode")>-1&&"data"===n){const e=a.readFileSync(s,"utf8"),{path:n,basic:i,actions:c=[]}=JSON.parse(e);if(!n)continue;const o=[];i.actions.forEach((({_id:e,label:t,mode:s,href:n})=>{const i={id:e,label:t};"link"===s&&n&&(i.link=n.substr(1)),o.push(i)})),c.forEach((({_id:e,label:t,mode:s,href:n})=>{const i={id:e,label:t};"link"===s&&n&&(i.link=n.substr(1)),o.push(i)})),t[n]=o}}}exports.remote=function(t){h=t,S=JSON.parse(a.readFileSync(f(e.homedir(),".cc.json"))),y=new p({SecretId:S.id,SecretKey:S.key});const n=x(t);i.branchLocal(((e,i)=>{let c=n.name;const o=function(e,t){const s=f(e,"..",t,"src","main","resources","config","app");try{const e=a.readFileSync(s,"utf8");return JSON.parse(e).tag}catch(e){return""}}(t,c);let r=o||i.current;const l=f(t,"dist"),u=f(t,"public");["zen.js","zen.css","zen.wap.js","zen.wap.css"].forEach((e=>{const t=`wget --timeout=15 "https://b.ebus.vip/zeto/latest/${e}" -O - | gunzip > "${f(u,e)}"`;console.log(t),s.exec(t)})),m(l,`${c}/${r}`),a.existsSync(u)&&m(u,`${c}/${r}`)}))},exports.locale=function(e){h=e;const t=x(e).name;g=u(e,"..",t,"src","main","resources","static");const n=f(e,"public"),i=f(e,"dist");["zen.js","zen.css","zen.wap.js","zen.wap.css"].forEach((e=>{const t=`wget --timeout=15 "https://b.ebus.vip/zeto/latest/${e}" -O - | gunzip > "${f(n,e)}"`;console.log(t),s.exec(t)})),b(i),a.existsSync(n)&&b(n);const c={};j(f(e,"src"),c),a.writeFileSync(f(g,"..","config","points"),JSON.stringify(c),"utf8")}}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-app-plugin",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "app代码生成器",
5
5
  "main": "index.js",
6
6
  "author": "zen",