jetc 0.7.2 → 0.7.4

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 (3) hide show
  1. package/bin/jetc.js +2 -0
  2. package/index.js +1 -1
  3. package/package.json +4 -4
package/bin/jetc.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ const a=require("fs"),d=require("path"),{parse: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/index.js CHANGED
@@ -15,7 +15,7 @@ return[a,'<script src="'+z("/",h)+'">\x3c/script>']}return m?[a,""]:[a,b.filter(
15
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
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
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}}}
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,location:this.path}),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
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
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
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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jetc",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Jet.js Compiler and Server.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,12 +14,12 @@
14
14
  "postinstall.js"
15
15
  ],
16
16
  "bin": {
17
- "jetc": "bin/run.js",
17
+ "jetc": "bin/jetc.js",
18
18
  "jetc-server": "bin/server.js"
19
19
  },
20
20
  "author": "Oleksandr Krayilo",
21
21
  "license": "ISC",
22
22
  "dependencies": {
23
- "jeti": "^0.9.0"
23
+ "jeti": "^0.9.1"
24
24
  }
25
- }
25
+ }