jetc 0.6.1 → 0.6.3

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/bin/server.js CHANGED
@@ -5,5 +5,6 @@ function B(a){a=a.split("/");var c=a[a.length-1].split(".");a={css:"text/css",cs
5
5
  (c=c[c.length-1],a[c])?a[c]:null}const n=require("fs"),C=require("http");function D(){var a=process.argv;let c=!1,b="",f=3E3;const d=a.length;for(let k=2;k<d;k++){const e=a[k];e.startsWith("--port=")?f=parseInt(e.slice(7),10):"--all"===e?c=!0:k===d-1&&(b=e)}return{a:c,folder:b,port:f}}function E(a,c){a=a.headers.accept;let b=!0;if(a){const f=B(c);b=!1;a.split(",").forEach(d=>{d=d.split(";")[0].trim();if(d===f||"*/*"===d)b=!0})}return b}
6
6
  function F(a){let c="";a=a.split("/").map(f=>{f=c+f;c=f+"/";return[f,f+"/node_modules"]}).reverse();const b=a.length;for(let f=0;f<b;f++)if(l(a[f][1]))return a[f][0];return null}
7
7
  function G(){const {a,folder:c,port:b}=D(),f=C.createServer((d,k)=>{{var e=d.url.split("?")[0];var g=process.cwd().replace(/\\/g,"/");var m=c?t(g,c):g,p=t(m,"index.html");const q=t(m,e),A=t(q,"index.html");var h="";g="";if(r(q))h=q,g=e;else if(r(A))h=A,g=t(e,"index.html");else if(0===e.indexOf("/node_modules/")){if(e=e.split("/node_modules/"),p=F(m),m=e.pop(),p&&m&&(h=t(p,e.join("/node_modules/")),h=u(m,{paths:[h]})))e=h.split("/node_modules/"),e[0]="",g=e.join("/node_modules/")}else(h=u(t(".",e),
8
- {paths:[m]}))?g=h.slice(m.length):(h=u(e.slice(1),{paths:[m]}))&&(g=t("/node_modules/",h.split("/node_modules/").pop())),h||!a||1<e.split("/").pop().split(".").length||!r(p)||(h=p,g=t("/index.html"));g={filename:h,location:g}}const {filename:x,location:y}=g;g="";if(x&&E(d,x)){try{g=n.readFileSync(x,"binary")}catch(q){g=q;d=d.url;k.writeHead(500,z(".txt"));k.write("500 Internal Server Error\n");k.end();console.log(w(),d+" "+v(31,500)+" "+g);return}d=d.url;h=Object.assign({},{Location:y},z(y),{"Cache-Control":"max-age=0, no-cache, must-revalidate, proxy-revalidate",
9
- Expires:"Thu, 01 Jan 1970 00:00:00 GMT","Last-Modified":(new Date).toUTCString()});k.writeHead(200,h);k.write(g,"binary");k.end();console.log(w(),d+" 200 "+g.length+" "+y)}else d=d.url,k.writeHead(404,z(".txt")),k.write("404 Not Found\n"),k.end(),console.log(w(),d+" "+v(31,404))});f.on("error",d=>console.error(d));f.listen(b,"localhost");console.log("Development server is running at http://localhost:"+b+"/\nPress Ctrl + C to shutdown.\n")}require.main===module&&G();
8
+ {paths:[m]}))?g=h.slice(m.length):(h=u(e.slice(1),{paths:[m]}))&&(g=t("/node_modules/",h.split("/node_modules/").pop())),h||!a||1<e.split("/").pop().split(".").length||!r(p)||(h=p,g=t("/index.html"));g={filename:h,location:g}}const {filename:x,location:y}=g;g="";if(x&&E(d,x)){try{g=n.readFileSync(x,"binary")}catch(q){g=q;d=d.url;k.writeHead(500,z(".txt"));k.write("500 Internal Server Error\n");k.end();console.log(w(),'"GET '+d+'" '+v(31,500)+" "+g);return}d=d.url;h=Object.assign({},{Location:y},z(y),
9
+ {"Cache-Control":"max-age=0, no-cache, must-revalidate, proxy-revalidate",Expires:"Thu, 01 Jan 1970 00:00:00 GMT","Last-Modified":(new Date).toUTCString()});k.writeHead(200,h);k.write(g,"binary");k.end();console.log(w(),'"GET '+d+'" 200 '+g.length+" "+y)}else d=d.url,k.writeHead(404,z(".txt")),k.write("404 Not Found\n"),k.end(),console.log(w(),'"GET '+d+'" '+v(31,404))});f.on("error",d=>console.error(d));f.listen(b,"localhost");console.log("Development server is running at http://localhost:"+b+"/\nPress Ctrl + C to shutdown.\n")}
10
+ require.main===module&&G();
package/bin/update.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';const c=require("fs"),{execSync:d}=require("child_process");if(require.main===module)if(c.existsSync("./package.json")){var e;{let a=null;try{const b=c.readFileSync("./package.json","utf8");a=JSON.parse(b)}catch(b){console.error(b),process.exit(1)}e=a}var f=e.dependencies;if(f)for(const a in f)console.log("Updating",a,"..."),d("npm install "+a+"@latest",{stdio:"inherit"}),console.log("")}else console.error("Error:","./package.json","not found.");
2
+ 'use strict';const c=require("fs"),{execSync:d}=require("child_process");if(require.main===module)if(c.existsSync("./package.json")){var e;{let a=null;try{const b=c.readFileSync("./package.json","utf8");a=JSON.parse(b)}catch(b){console.error(b),process.exit(1)}e=a}var f=e.dependencies;if(f)for(const a in f){const b="npm install "+a+("file:"!==f[a].slice(0,5)?"@latest":"");console.log("Updating",a,"...");d(b,{stdio:"inherit"});console.log("")}}else console.error("Error:","./package.json","not found.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jetc",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Jet.js Compiler and Server.",
5
5
  "main": "index.js",
6
6
  "scripts": {