jetc 0.6.4 → 0.7.0
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/run.js +2 -0
- package/bin/server.js +8 -9
- package/index.js +22 -21
- package/license.txt +1 -1
- package/package.json +5 -8
- package/postinstall.js +1 -1
- package/bin/build.js +0 -2
- package/bin/update.js +0 -2
package/bin/run.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const a=require("fs"),d=require("path"),{parser:e}=require("jeti"),f=d.join(process.cwd(),process.argv[2]);function g(){var b=null;try{let c=a.readFileSync(f,"utf8"),h="(function() {\nconst module = {exports: {}};\nlet exports = module.exports;\n"+e(c)+"\nreturn module.exports;\n})()";b=eval(h)}catch(c){console.error(c),process.exit(1)}return b&&b.default||b}require.main===module&&(f&&a.existsSync(f)?g()():console.error("Error:",f,"not found."));
|
package/bin/server.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
function B(a){a=a.split("/");var c=a[a.length-1].split(".");a={css:"text/css",csv:"text/csv",eot:"application/vnd.ms-fontobject",gif:"image/gif",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",js:"application/javascript",json:"application/json",otf:"font/otf",pdf:"application/pdf",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",ttf:"font/ttf",txt:"text/plain",woff:"font/woff",woff2:"font/woff2",xml:"text/xml"};return
|
|
5
|
-
(c=c[c.length-1],a[c])?a[c]:null}const n=require("fs"),C=require("http");function D(){var a=process.argv
|
|
6
|
-
function F(a){
|
|
7
|
-
function G(){
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
require.main===module&&G();
|
|
2
|
+
function l(a){return n.existsSync(a)&&n.statSync(a).isDirectory()}function q(a){return n.existsSync(a)&&n.statSync(a).isFile()}function r(...a){a=a.join("/").split("/");var c=a.length;for(let b=1;b<c;b++)b>0&&b<c-1&&!a[b]?(a.splice(b,1),--c,--b):b>0&&a[b]==="."?(a.splice(b,1),--c,--b):b===1&&a[b]===".."&&a[b-1]==="."?(a.splice(b-1,1),--c,--b):b>0&&a[b]===".."&&a[b-1]!=="."&&a[b-1]!==".."&&(a.splice(b-1,2),c-=2,b-=2);return a.join("/")}
|
|
3
|
+
function t(a,c){try{return require.resolve(a,c).replace(/\\/g,"/")}catch(b){}return null}function u(a,c){return"\u001b["+a+"m"+c+"\u001b[39m"}function v(){return u(90,"["+(new Date).toLocaleString("en-US")+"]")}function z(a){return(a=B(a))?{"Content-Type":a}:null}
|
|
4
|
+
function B(a){a=a.split("/");var c=a[a.length-1].split(".");a={css:"text/css",csv:"text/csv",eot:"application/vnd.ms-fontobject",gif:"image/gif",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",js:"application/javascript",json:"application/json",otf:"font/otf",pdf:"application/pdf",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",ttf:"font/ttf",txt:"text/plain",woff:"font/woff",woff2:"font/woff2",xml:"text/xml"};return c.length>
|
|
5
|
+
1&&(c=c[c.length-1],a[c])?a[c]:null}const n=require("fs"),C=require("http");function D(){var a=process.argv,c=!1,b="",f=3E3,e=a.length;for(let k=2;k<e;k++){let d=a[k];d.startsWith("--port=")?f=parseInt(d.slice(7),10):d.startsWith("--all=")?c=d.slice(6):d==="--all"?c="/index.html":k===e-1&&(b=d)}return{g:c,folder:b,port:f}}function E(a,c){a=a.headers.accept;var b=!0;if(a){let f=B(c);b=!1;a.split(",").forEach(e=>{e=e.split(";")[0].trim();if(e===f||e==="*/*")b=!0})}return b}
|
|
6
|
+
function F(a){var c="";a=a.split("/").map(f=>{f=c+f;c=f+"/";return[f,f+"/node_modules"]}).reverse();var b=a.length;for(let f=0;f<b;f++)if(l(a[f][1]))return a[f][0];return null}
|
|
7
|
+
function G(){var {g:a,folder:c,port:b}=D(),f=C.createServer((e,k)=>{var d=e.url.split("?")[0],g=process.cwd().replace(/\\/g,"/"),m=c?r(g,c):g,p=r(m,a),w=r(m,d),A=r(w,"index.html"),h="";g="";if(q(w))h=w,g=d;else if(q(A))h=A,g=r(d,"index.html");else if(d.indexOf("/node_modules/")===0){if(d=d.split("/node_modules/"),p=F(m),m=d.pop(),p&&m&&(h=r(p,d.join("/node_modules/")),h=t(m,{paths:[h]})))d=h.split("/node_modules/"),d[0]="",g=d.join("/node_modules/")}else d!=="/"&&(h=t(r(".",d),{paths:[m]}))&&(g=h.slice(m.length)),
|
|
8
|
+
h||(h=t(d.slice(1),{paths:[m]}))&&(g=r("/node_modules/",h.split("/node_modules/").pop())),h||!a||d.split("/").pop().split(".").length>1||!q(p)||(h=p,g=r(a));var {filename:x,location:y}={filename:h,location:g};g="";if(x&&E(e,x)){try{g=n.readFileSync(x,"binary")}catch(H){g=H;e=e.url;k.writeHead(500,z(".txt"));k.write("500 Internal Server Error\n");k.end();console.log(v(),'"GET '+e+'" '+u(31,500)+" "+g);return}e=e.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(v(),'"GET '+e+'" 200 '+g.length+" "+y)}else e=e.url,k.writeHead(404,z(".txt")),k.write("404 Not Found\n"),k.end(),console.log(v(),'"GET '+e+'" '+u(31,404))});f.on("error",e=>console.error(e));f.listen(b,"localhost");console.log("Development server is running at http://localhost:"+b+"/\nPress Ctrl + C to shutdown.\n")}require.main===module&&G();
|
package/index.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
function z(...a){a=a.join("/").split("/");
|
|
3
|
-
class C{constructor(a){this.path=a;this.
|
|
4
|
-
function D(a,b,c){({name:b}=new C(b));a=y(a,b,"css");b=z(".",a);c.name=b;return{href:a,filename:b}}function E(a){return a&&"'jet module';"
|
|
1
|
+
const q=require("fs"),{closeContext:r,getContext:t,openContext:u,parser:v}=require("jeti");function w(a){return q.existsSync(a)&&q.statSync(a).isDirectory()}function x(a){return q.existsSync(a)&&q.statSync(a).isFile()}function y(a,b,c,d){for(let f=1;;f++){var e=b+(f>1?f:"")+"."+c;if(!q.existsSync(z(a,e))&&(d||[]).indexOf(e)===-1)break}return e}
|
|
2
|
+
function z(...a){a=a.join("/").split("/");var b=a.length;for(let c=1;c<b;c++)c>0&&c<b-1&&!a[c]?(a.splice(c,1),--b,--c):c>0&&a[c]==="."?(a.splice(c,1),--b,--c):c===1&&a[c]===".."&&a[c-1]==="."?(a.splice(c-1,1),--b,--c):c>0&&a[c]===".."&&a[c-1]!=="."&&a[c-1]!==".."&&(a.splice(c-1,2),b-=2,c-=2);return a.join("/")}function A(a,b){try{return require.resolve(a,b).replace(/\\/g,"/")}catch(c){}return null}function B(a){return a.g.length>0&&a.g[0]===""}
|
|
3
|
+
class C{constructor(a){this.path=a;this.g=this.path.split("/");this.filename=this.g.pop();this.folder=this.g.join("/");this.ext=this.name=null;a=this.filename.split(".");this.ext=a.length>1&&(a[0]||a.length>2)?a.pop():"";this.name=a.join(".")}mediaType(){return{css:"text/css",htm:"text/html",html:"text/html",js:"application/javascript",json:"application/json",scss:"text/scss",txt:"text/plain",xml:"text/xml"}[this.ext]||""}toString(){return this.path}}
|
|
4
|
+
function D(a,b,c){({name:b}=new C(b));a=y(a,b,"css");b=z(".",a);c.name=b;return{href:a,filename:b}}function E(a){return a&&a.slice(0,13)==="'jet module';"}function F(a){return a==="application/javascript"}
|
|
5
5
|
var G={"single-comment":"slash slash *!end-line end-line","multi-comment":"slash star *!(star slash) star slash",comment:"single-comment | multi-comment"},H={space:"+(whitespace | comment)"},I={"single-string":"single-quote *((escape any) | !single-quote) single-quote"},J={"double-string":"double-quote *((escape any) | !double-quote) double-quote"},K={"back-string":"back-quote *((escape any) | (dollar context) | !back-quote) back-quote"};
|
|
6
6
|
const L={...G,...H,...I,...J,...K,string:"single-string | double-string | back-string",identifier:"letter *(letter | digit)",number:"digit *(digit | e | x)",operator:"+symbol",context:"lbrace *(code | !rbrace) rbrace",expression:"lparen *(code | !rparen) rparen",selector:"lbracket *(code | !rbracket) rbracket",bracket:"lbrace | rbrace | lparen | rparen | lbracket | rbracket","extended-symbol":"symbol | punctuation | bracket",delimiter:"extended-symbol | string",compress:"*space delimiter *space",
|
|
7
7
|
code:"compress | space | identifier | number | string | context | expression | selector | operator | punctuation",grammar:"*(code | any)"},M={...G,...H,...I,...J,string:"single-string | double-string",delimiter:"comma | colon | semicolon | lbrace | rbrace",compress:"*space +delimiter *space",grammar:"*(compress | string | space | any)"},N={comment:"less exclamation dash dash *!(dash dash more) dash dash more",...I,...J,"attribute-name":"letter *(letter | digit | dash)","attribute-value":"single-string | double-string",
|
|
8
8
|
attribute:"attribute-name ?(equal attribute-value)","tag-name":"letter *(letter | digit | dash)","tag-body":"*(whitespace | attribute)","any-tag":"less ?slash tag-name tag-body more",head:"(H | h) (E | e) (A | a) (D | d)",script:"(S | s) (C | c) (R | r) (I | i) (P | p) (T | t)","start-head":"less head tag-body more","end-head":"less slash head more","content-head":"*(tag-script | !end-head)","start-script":"less script tag-body more","end-script":"less slash script more","content-script":"*!end-script",
|
|
9
9
|
"tag-head":"start-head content-head end-head","tag-script":"start-script content-script end-script",tag:"tag-head | tag-script | any-tag",grammar:"*(tag | comment | any)"},O={...G,...H,...I,...J,...K,string:"single-string | double-string | back-string",identifier:"letter *(letter | digit)",number:"digit *(digit | e | x)",operator:"+symbol",context:"lbrace *(code | !rbrace) rbrace",expression:"lparen *(code | !rparen) rparen",selector:"lbracket *(code | !rbracket) rbracket","import-source":"single-string | double-string",
|
|
10
10
|
"module-require":"require *space lparen *space import-source *space rparen",code:"module-require | identifier | number | space | string | context | expression | selector | operator | punctuation",grammar:"*(code | any)"},R={comment:P,compress:Q,delimiter:null,whitespace:P},U={attribute:null,"content-head":null,"content-script":null,"end-head":null,"start-head":null,"tag-head":S,"tag-script":T},W={"import-source":null,"module-require":V};
|
|
11
|
-
function Q(a,b){
|
|
12
|
-
function V(a,b){
|
|
13
|
-
function T(a,b){
|
|
14
|
-
|
|
15
|
-
function ba(a,b,c){
|
|
16
|
-
class ca{constructor(a,b,c,d){({resolve:d}=d||{});this.content=c||"";this.deps=[];this.root=this.path=this.name=this.module=this.
|
|
17
|
-
c=[d.name+"@"+d.version,f,c.slice(f.length)];break a}}c=null}c&&([this.module,this.root,this.path]=c)}else this.path="/"+b,this.root=a.root;if(this.path)this.name=z(this.module||a.
|
|
18
|
-
a=v(a,N,U);r();
|
|
19
|
-
class ea{constructor(a,b){this.aliases={};this.name=a;this.root=b}get(a){return this.aliases[a]}set(a,b){this.aliases[a]=b}}class fa{create(a,b){return this[a]=new ea(a,b)}get(a){return this[a]}}
|
|
20
|
-
function Y(a,b,c,d,e){
|
|
21
|
-
{};
|
|
22
|
-
class ha{constructor(a,b,c){this.content=[];this.deps=c;this.name=a;this.
|
|
23
|
-
|
|
24
|
-
f.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
function Q(a,b){var c=b.length,d="";for(let e=0;e<c;e+=2){let f=b[e+1];b[e]!=="whitespace"&&(d+=f)}return[a,d]}function S(a,b){var c=t(),{path:d}=c||{};c=' <link href="'+z("/",d)+'" rel="stylesheet">\n ';var e=b.length,f="",g="",h="";if(d){for(d=0;d<e;d+=2){let k=b[d],m=b[d+1];k==="start-head"?g=m:k==="end-head"?h=m:k==="content-head"&&(f=m)}return[a,g+f+c+h]}return[a,b.filter((k,m)=>m%2===1).join("")]}
|
|
12
|
+
function V(a,b){var c=t(),{aliases:d}=c||{},e=b.length,f=null;for(let g=0;g<e;g+=2){let h=b[g+1];b[g]==="import-source"&&(c?(f=h.slice(1,-1),f=d[f]||f,f=h[0]+f+h[h.length-1]):f=h)}return[a,"require("+f+")"]}
|
|
13
|
+
function T(a,b){var c=t(),{folder:d,name:e}=c||{},f=b.length,g="",h="",k="",m=!1;c&&!c.deps&&(c.deps=[]);for(let n=0;n<f;n+=2){let l=b[n],p=b[n+1];l==="attribute"?p.slice(0,4).toLowerCase()==="src="?(h=p.slice(5,-1),m=h.slice(-4)==="jeti"||h.slice(-13)==="jeti/index.js"):p.slice(0,5).toLowerCase()==="type="&&(k=p.slice(6,-1).toLowerCase()):l==="content-script"&&(g=p)}if(k==="application/jet"){if(!h&&!g)return[a,""];c&&(!h&&e&&(b=c.deps.map(n=>n.path),h=y(d,e,"js",b)),c.deps.push({content:g,path:h}));
|
|
14
|
+
return[a,'<script src="'+z("/",h)+'">\x3c/script>']}return m?[a,""]:[a,b.filter((n,l)=>l%2===1).join("")]}function P(a){return[a," "]}function X(a,b){u({path:b});a=v(a,N,U);r();return a}class aa extends Promise{config(a){return this.then(b=>{Object.assign(b.config,a);return b})}save(a,b){return this.then(c=>ba(a,c,b))}}
|
|
15
|
+
function ba(a,b,c){var d=b.fragments;(c||{}).remove&&a!=="."&&w(a)&&q.rmSync(a,{recursive:!0});Object.keys(d).forEach(e=>{var f=d[e].content;e=z(a,e);var g=(new C(e)).folder;w(g)||q.mkdirSync(g,{recursive:!0});q.writeFileSync(e,f)});return b}
|
|
16
|
+
class ca{constructor(a,b,c,d){({resolve:d}=d||{});this.content=c||"";this.deps=[];this.root=this.path=this.name=this.module=this.mediaType=this.location=null;if(d)if(c=a.root,d=new C(b),B(d)||d.g.length>0&&(d.g[0]==="."||d.g[0]==="..")){d=z(c,b);if(!(d=x(d)?b.slice(1):null)){{d=c;let f=B(new C(d));var e=z(f?"":".",d,b);if(e=A(e)){let g=process.cwd().replace(/\\/g,"/");d=f?d:z(g,d);d=e.slice(d.length)}else d=null}}if(this.path=d)this.root=c}else{a:{if(c=A(b,{paths:[c]})){let [f,g]=da(c);if(g){d=require(g);
|
|
17
|
+
c=[d.name+"@"+d.version,f,c.slice(f.length)];break a}}c=null}c&&([this.module,this.root,this.path]=c)}else this.path="/"+b,this.root=a.root;if(this.path)this.name=z(this.module||a.getName(),this.path),this.location=z(this.root,this.path),this.path="."+this.path,a=new C(this.path),this.folder=a.folder,this.mediaType=a.mediaType();else throw Error("Cannot find "+b);}getName(){return this.name}load(){this.content||(this.content=q.readFileSync(this.location,"utf8"))}parse(){if(this.mediaType==="text/html"){var a=
|
|
18
|
+
this.content,b=u({folder:this.root,name:(new C(this.path)).name});a=v(a,N,U);r();[this.content,this.deps]=[a,b.deps]}else F(this.mediaType)&&(a=this.content,b=u({folder:this.folder}),a=v(a),r(),[this.content,this.deps]=[a,b.deps])}h(){return{content:this.content,deps:this.deps,mediaType:this.mediaType}}translate(a){if(F(this.mediaType)){var b=this.content;u({aliases:a});a=v(b,O,W);r();this.content=a}}}
|
|
19
|
+
function da(a){a=a.split("/");var b="";a.pop();a=a.map(d=>{d=b+d;b=d+"/";return[d,d+"/package.json"]}).reverse();var c=a.length;for(let d=0;d<c;d++)if(x(a[d][1]))return a[d];return[]}class ea{constructor(a,b){this.aliases={};this.name=a;this.root=b}get(a){return this.aliases[a]}getName(){return this.name}set(a,b){this.aliases[a]=b}}class fa{create(a,b){return this[a]=new ea(a,b)}get(a){return this[a]}}
|
|
20
|
+
function Y(a,b,c,d,e){var f=a.config,g=a.fragments,h=a.modules,k=a.namespaces;({resolve:e}=e||{});d=new ca(b,c,d,{resolve:e});e=d.getName();var m=f&&f["module-name"];f&&f.externs&&f.externs.indexOf(c)>-1?e=c:!(f&&f.entries&&f.entries.indexOf(c)>-1)&&m&&(e=m+"/"+(e.slice(0,2)==="./"?e.slice(2):e));b.set(c,e);if(!g[e]&&!h[e]){m=!1;d.load();E(d.content)?(e=c,b.set(c,e)):c==="jete"||d.parse();if(d.root.indexOf("node_modules/")>-1){h[e]={};c=d.root;let l=d.module;l&&(b=k.get(l)||k.create(l,c))}else g[e]=
|
|
21
|
+
{};let n=[];d.deps.length&&(m=!0,d.deps.forEach(l=>{if(!(f&&f.externs&&f.externs.indexOf(l)>-1)||f&&f["include-externs"]){var p=null;typeof l==="string"?(p=b.get(l))||(p=Y(a,b,l,"",{resolve:!0})):l&&l.path&&(p=Y(a,b,l.path,l.content));n.push(p)}}),d.deps=n);m&&d.translate(b.aliases);d.root.indexOf("node_modules/")>-1?h[e]=d.h():g[e]=d.h()}return e}
|
|
22
|
+
class ha{constructor(a,b,c){this.content=[];this.deps=c;this.name=a;this.mediaType=b}getName(){return this.name}h(){var a=this.deps,b=this.mediaType;return{content:this.content.join(""),deps:a,mediaType:b}}}class ia{constructor(){this.all=[]}close(a){this[a]&&delete this[a]}create(a,b,c){this[b]=new ha(a,b,c);this.all.push(this[b]);return this[b]}get(a){return this[a]}getAll(){return this.all}}
|
|
23
|
+
class ja{close(a){this[a]&&delete this[a]}get(a){this[a]||(this[a]={});return this[a]}has(a,b){return(this[a]||{})[b]}put(a,b){this.get(a)[b]=!0}}
|
|
24
|
+
function Z(a,b){var c=a.config,d=a.i,e=a.modules,f=a.register,g=c.root;e=a.fragments[b]||e[b];if(!e)throw Error("Fragment not found "+b);var h=e.deps,k=e.mediaType;if(!f.has(k,b)){let m=d.get(k)||d.create(b,k,k==="text/html"?h:[]),n=m.name===b&&F(k);c=c&&c["module-name"];F(k)&&(e.content=E(e.content)?e.content.slice(13):"require('"+(n&&c?c:b)+"', function(module, exports) {\n"+e.content+"});\n");n&&!c&&m.content.push("(function(){function e(b,a){if('function'===typeof a)b=d[b]=a;else{a=d[b];if('function'===typeof a){{const c={exports:{}};a(c,c.exports);a=c}a=d[b]=a}b=a?a.exports:null}return b}const d={};e.load=function(b){const a=b.indexOf('.css')===b.length-4?'style':'script';return fetch(b).then(c=>200===c.status?c.text():'').then(c=>{if(c){const f=document.createElement(a);f.appendChild(document.createTextNode(c));document.head.appendChild(f)}})};'object'!==typeof window||window.require||(window.require=e)})();\n");
|
|
25
|
+
f.put(k,b);h.forEach(l=>{k==="text/html"&&(f.close("application/javascript"),d.close("application/javascript"));Z(a,l)});F(k)&&n&&Object.keys(f["text/html"]||{}).length===0&&(h=d.get("text/css"))&&D(g,b,h);if(k==="text/html"&&(h=d.get("text/css"))){let {href:l,filename:p}=D(g,b,h);e.content=X(e.content,l);m.deps.push(p)}m.content.push(e.content);n&&!c&&m.content.push("'object'===typeof window&&window.addEventListener('DOMContentLoaded',function(){require('"+b+"')});\n")}}
|
|
26
|
+
function ka(a,b,c){var d=c[b];if(!F(d.mediaType))throw Error("Entry must be a JavaScript to make a module");Object.keys(c).forEach(e=>{var f=c[e],g=f.content;f.mediaType==="text/css"&&(d.content="if('object'===typeof document){const a=document.createElement('style');"+(a?"a.id='"+a+"';":"")+"a.appendChild(document.createTextNode('"+g.replace(/\\/g,"\\\\").replace(/[']/g,"\\'")+"'));document.head.appendChild(a);}"+d.content,delete c[e])});d.content="'jet module';"+d.content}
|
|
27
|
+
module.exports={compress:function(a){var b=a.fragments;Object.keys(b).forEach(c=>{c=b[c];var d=c.content,e=c.mediaType;if(F(e)||e==="text/css")c.content=v(d,e==="text/css"?M:L,R).trim()});return a},entry:function(a){return new aa((b,c)=>{try{let {filename:d,folder:e}=new C(a),f={config:{root:z(process.cwd(),e),entries:[d]},fragments:{},modules:{}};b(f)}catch(d){c(d)}})},makemod:function(a){var b=a.config,c=a.fragments,d=b.entries,e=b&&b["module-name"];if(!e)throw Error("Config must include 'module-name' to make a module");
|
|
28
|
+
d.map(f=>ka(e,f,c));return a},pack:function(a){var b=a.config.entries,c=new ia,d=new ja;a.i=c;a.register=d;b.forEach(f=>Z(a,f));var e={};c.getAll().forEach(f=>{var g=f.getName();g&&(e[g]=f.h())});a.fragments=e;a.modules={};delete a.i;delete a.register;return a},parse:function(a){var b=a.config,c=b.entries,d=new fa,e=d.create(".",b.root);a.namespaces=d;b.entries=c.map(f=>Y(a,e,f));delete a.namespaces;return a}};
|
package/license.txt
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jetc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Jet.js Compiler and Server.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"postinstall": "node postinstall"
|
|
8
|
-
"start": "jetc-server",
|
|
9
|
-
"build": "jetc-build"
|
|
7
|
+
"postinstall": "node postinstall"
|
|
10
8
|
},
|
|
11
9
|
"files": [
|
|
12
10
|
"bin/",
|
|
@@ -16,13 +14,12 @@
|
|
|
16
14
|
"postinstall.js"
|
|
17
15
|
],
|
|
18
16
|
"bin": {
|
|
19
|
-
"jetc
|
|
20
|
-
"jetc-server": "bin/server.js"
|
|
21
|
-
"jetc-update": "bin/update.js"
|
|
17
|
+
"jetc": "bin/run.js",
|
|
18
|
+
"jetc-server": "bin/server.js"
|
|
22
19
|
},
|
|
23
20
|
"author": "Oleksandr Krayilo",
|
|
24
21
|
"license": "ISC",
|
|
25
22
|
"dependencies": {
|
|
26
|
-
"jeti": "^0.8.
|
|
23
|
+
"jeti": "^0.8.11"
|
|
27
24
|
}
|
|
28
25
|
}
|
package/postinstall.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a=require("fs"),d=require.main.paths[0].split("node_modules")[0],f=d+"package.json";if(require.main===module&&a.existsSync(f)){let b=require(f),e=!1;b.hasOwnProperty("scripts")||(b.scripts={});let c=b.scripts;c.hasOwnProperty("start")||(c.start="jetc-server --port=3000 --all src",e=!0);c.hasOwnProperty("build")||(c.build="jetc build.js",e=!0);e&&a.writeFileSync(f,JSON.stringify(b,null,2));let g=d+"build.js";a.existsSync(g)||a.copyFileSync("conf/build.js",g)};
|
package/bin/build.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';const b=require("fs"),d=require("path"),{parser:e}=require("jeti"),f=d.join(process.cwd(),process.argv[2]||"./build.js");function g(){let a=null;try{const c=b.readFileSync(f,"utf8"),h="(function() {\nconst module = {exports: {}};\nlet exports = module.exports;\n"+e(c)+"\nreturn module.exports;\n})()";a=eval(h)}catch(c){console.error(c),process.exit(1)}return a&&a.default||a}require.main===module&&(b.existsSync(f)?g()():console.error("Error:",f,"not found."));
|
package/bin/update.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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){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.");
|