zen-app-plugin 0.3.0 → 0.3.1
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/compress.js +1 -1
- package/package.json +1 -1
package/compress.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){const e=require("os"),t=require("simple-git"),n=require("shelljs"),s=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"),n=a.readFileSync(t,"utf8");return JSON.parse(n)}function m(e,t){a.readdirSync(e).forEach((n=>{if(0===n.indexOf(".")||n.indexOf(".html")>-1)return;let i=f(e,n),c=a.statSync(i);if(c.isDirectory()&&m(i,f(t,n)),c.isFile()){let e=f(t,n).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(s.gzip(a.readFileSync(i,"utf8")))):c.Body=a.createReadStream(i),y.putObject(c,((t,n)=>{if(t)return console.log(t,n);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),n.mkdir("-p",l(i)),!o.includes(t))return n.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 s=f(g,t),i=d(s);if(!a.existsSync(s)||r.includes(i)){n.mkdir("-p",l(s));const t=e.indexOf(":")>-1?e:`https:${e}`;let i=`wget --timeout=15 -O "${s}" "${t}"`;(s.indexOf(".js")>-1||s.indexOf(".css")>-1)&&(i=`wget -qO- "${t}" | gzip > "${s}"`);const c=n.exec(i);if(0!==c.code)return console.error(`Failed to download ${i}: ${c.stderr}`),e}return t}(e)));a.writeFileSync(i,Buffer.from(s.gzip(u)),"utf8")}function b(e){const t=a.readdirSync(e);for(const n of t){if(n.startsWith("."))continue;const t=f(e,n),s=a.statSync(t);s.isDirectory()?b(t):s.isFile()&&O(t)}}function j(e,t){const n=a.readdirSync(e);for(const s of n){const n=f(e,s);if(a.statSync(n).isDirectory())j(n,t);else if(e.indexOf(".lowcode")>-1&&"data"===s){const e=a.readFileSync(n,"utf8"),{path:s,basic:i,actions:c=[]}=JSON.parse(e);if(!s)continue;const o=[];i.actions.forEach((({_id:e,label:t,mode:n,href:s})=>{const i={id:e,label:t};"link"===n&&s&&(i.link=s.substr(1)),o.push(i)})),c.forEach((({_id:e,label:t,mode:n,href:s})=>{const i={id:e,label:t};"link"===n&&s&&(i.link=s.substr(1)),o.push(i)})),o.length>0&&(t[s]=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 s=x(t);i.branchLocal(((e,i)=>{let c=s.name;const o=function(e,t){const n=f(e,"..",t,"src","main","resources","config","app");try{const e=a.readFileSync(n,"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),n.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 s=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(s,e)}"`;console.log(t),n.exec(t)})),b(i),a.existsSync(s)&&b(s);const c={};j(f(e,"src"),c),a.writeFileSync(f(g,"..","config","points"),JSON.stringify(c),"utf8")}}();
|
|
1
|
+
!function(){const e=require("os"),t=require("simple-git"),n=require("shelljs"),s=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"),n=a.readFileSync(t,"utf8");return JSON.parse(n)}function m(e,t){a.readdirSync(e).forEach((n=>{if(0===n.indexOf(".")||n.indexOf(".html")>-1)return;let i=f(e,n),c=a.statSync(i);if(c.isDirectory()&&m(i,f(t,n)),c.isFile()){let e=f(t,n).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(s.gzip(a.readFileSync(i,"utf8")))):c.Body=a.createReadStream(i),y.putObject(c,((t,n)=>{if(t)return console.log(t,n);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),n.mkdir("-p",l(i)),!o.includes(t))return n.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 s=f(g,t),i=d(s);if(!a.existsSync(s)||r.includes(i)){n.mkdir("-p",l(s));const t=e.indexOf(":")>-1?e:`https:${e}`;let i=`wget --timeout=15 -O "${s}" "${t}"`;(s.indexOf(".js")>-1||s.indexOf(".css")>-1)&&(i=`wget -qO- "${t}" | gzip > "${s}"`);const c=n.exec(i);if(0!==c.code)return console.error(`Failed to download ${i}: ${c.stderr}`),e}return t}(e)));a.writeFileSync(i,Buffer.from(s.gzip(u)),"utf8")}function b(e){const t=a.readdirSync(e);for(const n of t){if(n.startsWith("."))continue;const t=f(e,n),s=a.statSync(t);s.isDirectory()?b(t):s.isFile()&&O(t)}}function j(e,t){const n=a.readdirSync(e);for(const s of n){const n=f(e,s);if(a.statSync(n).isDirectory())j(n,t);else if(e.indexOf(".lowcode")>-1&&"data"===s){const e=a.readFileSync(n,"utf8"),{path:s,basic:i,actions:c=[]}=JSON.parse(e);if(!s)continue;const o=[];i.actions.forEach((({_id:e,label:t,mode:n,href:s})=>{const i={id:e+"",label:t};"link"===n&&s&&(i.link=s.substr(1)),o.push(i)})),c.forEach((({_id:e,label:t,mode:n,href:s})=>{const i={id:e+"",label:t};"link"===n&&s&&(i.link=s.substr(1)),o.push(i)})),o.length>0&&(t[s]=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 s=x(t);i.branchLocal(((e,i)=>{let c=s.name;const o=function(e,t){const n=f(e,"..",t,"src","main","resources","config","app");try{const e=a.readFileSync(n,"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),n.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 s=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(s,e)}"`;console.log(t),n.exec(t)})),b(i),a.existsSync(s)&&b(s);const c={};j(f(e,"src"),c),a.writeFileSync(f(g,"..","config","points"),JSON.stringify(c),"utf8")}}();
|