@plotdb/registry 0.0.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/README.md +150 -0
- package/bin/ngxgen.js +34 -0
- package/build +19 -0
- package/dist/config.ngx +43 -0
- package/dist/index.js +11 -0
- package/dist/ngxgen.js +33 -0
- package/dist/provider.js +212 -0
- package/dist/providers/github.js +88 -0
- package/dist/providers/index.js +9 -0
- package/dist/providers/npm.js +68 -0
- package/dist/route.js +81 -0
- package/dist/unbox.js +70 -0
- package/doc/design.md +68 -0
- package/doc/draft.md +98 -0
- package/package.json +69 -0
- package/sample/config.ngx +54 -0
- package/sample/config.yaml +7 -0
- package/src/config.ngx +43 -0
- package/src/index.ls +2 -0
- package/src/ngxgen.ls +27 -0
- package/src/provider.ls +112 -0
- package/src/providers/github.ls +38 -0
- package/src/providers/index.ls +3 -0
- package/src/providers/npm.ls +34 -0
- package/src/route.ls +46 -0
- package/src/unbox.ls +31 -0
- package/web/.view/index.js +171 -0
- package/web/server.ls +38 -0
- package/web/src/pug/index.ls +22 -0
- package/web/src/pug/index.pug +15 -0
- package/web/static/favicon.ico +0 -0
- package/web/static/index.html +1 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require! <[node-fetch lderror ../provider ../unbox]>
|
|
2
|
+
|
|
3
|
+
pvd = new provider do
|
|
4
|
+
name: \github
|
|
5
|
+
fetch-real-version: ({root, path, name, cachetime, version, version-type, force, opt}) ->
|
|
6
|
+
jsonurl = "https://registry.npmjs.org/#name"
|
|
7
|
+
node-fetch jsonurl, {method: \GET}
|
|
8
|
+
.then (r) -> if r.status != 200 => lderror.reject 404 else r.json!
|
|
9
|
+
.then (r) ->
|
|
10
|
+
# TODO range version
|
|
11
|
+
v = if version-type == \latest => r["dist-tags"].latest else version
|
|
12
|
+
if !(url = r.versions{}[v].{}dist.tarball) => return lderror.reject 404
|
|
13
|
+
{version: v, url}
|
|
14
|
+
|
|
15
|
+
fetch-bundle-file: ({root, path, name, cachetime, version, remote-info, version-type, force, opt}) ->
|
|
16
|
+
headers = if (opt or {}).token => {"Authorization": "token #{opt.token}"} else {}
|
|
17
|
+
node-fetch remote-info.url, {method: \GET, headers}
|
|
18
|
+
.then (r) -> r.buffer!
|
|
19
|
+
.then (buf) -> unbox.untar {path, buf}
|
|
20
|
+
|
|
21
|
+
module.exports = pvd
|
|
22
|
+
/*
|
|
23
|
+
params =
|
|
24
|
+
root: 'npmlib'
|
|
25
|
+
name: 'ldcover'
|
|
26
|
+
version: 'latest'
|
|
27
|
+
cachetime: 60 * 60
|
|
28
|
+
|
|
29
|
+
pvd.fetch-module params
|
|
30
|
+
.catch (e) ->
|
|
31
|
+
if !(lderror.id(e) in [404 998]) => return Promise.reject e
|
|
32
|
+
else console.log "return code: ", lderror.id(e)
|
|
33
|
+
.then -> console.log \done.
|
|
34
|
+
*/
|
package/src/route.ls
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require! <[pthk lderror]>
|
|
2
|
+
fs = require "fs-extra"
|
|
3
|
+
|
|
4
|
+
handle = ({provider, id, root}) ->
|
|
5
|
+
[paths, obj, id] = [{}, {}, pthk.rectify(id)]
|
|
6
|
+
Promise.resolve!
|
|
7
|
+
.then ->
|
|
8
|
+
if !/^[-_a-zA-Z0-9@./]+$/.exec(id) => return lderror.reject 404
|
|
9
|
+
ids = id.split(\/)
|
|
10
|
+
obj <<< if ids.length > 3 =>
|
|
11
|
+
name: "#{ids.0}/#{ids.1}"
|
|
12
|
+
version: ids.2
|
|
13
|
+
path: ids.slice(3).join(\/)
|
|
14
|
+
else
|
|
15
|
+
name: ids.0
|
|
16
|
+
version: ids.1
|
|
17
|
+
path: ids.slice(2).join(\/)
|
|
18
|
+
if !(obj.name and obj.version and obj.path) => return lderror.reject 404
|
|
19
|
+
provider.fetch {
|
|
20
|
+
root: root.fs
|
|
21
|
+
name: obj.name
|
|
22
|
+
version: obj.version
|
|
23
|
+
force: false
|
|
24
|
+
cachetime: 60 * 60
|
|
25
|
+
}
|
|
26
|
+
.catch (e) ->
|
|
27
|
+
if lderror.id(e) == 998 => return # skip fetching. as if fetch successfully.
|
|
28
|
+
if lderror.id(e) != 404 => return Promise.reject e
|
|
29
|
+
lderror.reject 404
|
|
30
|
+
|
|
31
|
+
route = ({provider, root}) ->
|
|
32
|
+
if !root.pub.endsWith \/ => root.pub = "#{root.pub}/"
|
|
33
|
+
(req, res) ->
|
|
34
|
+
url = req.originalUrl
|
|
35
|
+
id = url.replace(root.pub, '').replace(/[#?].*$/,'')
|
|
36
|
+
handle {provider, id, root}
|
|
37
|
+
.then ->
|
|
38
|
+
res.set { "X-Accel-Redirect": pthk.join(root.internal, id) }
|
|
39
|
+
res.send!
|
|
40
|
+
.catch (e) ->
|
|
41
|
+
if lderror.id(e) != 404 =>
|
|
42
|
+
console.log e
|
|
43
|
+
res.status 500 .send!
|
|
44
|
+
res.status 404 .send!
|
|
45
|
+
|
|
46
|
+
module.exports = route
|
package/src/unbox.ls
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require! <[yauzl tar pthk stream]>
|
|
2
|
+
fs = require "fs-extra"
|
|
3
|
+
|
|
4
|
+
unzip = ({path, buf}) ->
|
|
5
|
+
(res, rej) <- new Promise _
|
|
6
|
+
(e, zipfile) <- yauzl.from-buffer buf, {autoClose: false, lazyEntries: true}, _
|
|
7
|
+
if e => return rej e
|
|
8
|
+
zipfile.read-entry!
|
|
9
|
+
zipfile.on \end, -> zipfile.close!; res!
|
|
10
|
+
zipfile.on \entry, (entry) ->
|
|
11
|
+
if /\/$/.test(entry.file-name) => return zipfile.read-entry!
|
|
12
|
+
(e, rs) <- zipfile.openReadStream entry, _
|
|
13
|
+
if e => return rej e
|
|
14
|
+
rs.on \end, -> zipfile.read-entry!
|
|
15
|
+
dirs = entry.file-name.split(\/)
|
|
16
|
+
# TODO this depends on how remote zip their packages.
|
|
17
|
+
if !(fn = dirs.slice 1 .join \/) => fn = entry.file-name
|
|
18
|
+
desfile = pthk.join(path.base.version, pthk.rectify(fn))
|
|
19
|
+
desdir = pthk.dirname desfile
|
|
20
|
+
fs.ensure-dir desdir
|
|
21
|
+
.then -> rs.pipe fs.createWriteStream(desfile)
|
|
22
|
+
|
|
23
|
+
untar = ({path, buf}) ->
|
|
24
|
+
stream.Readable.from buf
|
|
25
|
+
.pipe ws = tar.x strip: 1, cwd: path.base.version
|
|
26
|
+
(res, rej) <- new Promise _
|
|
27
|
+
ws.on \close, -> res!
|
|
28
|
+
ws.on \error, -> rej it
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
module.exports = {unzip, untar}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
(function() { function pug_attr(t,e,n,r){if(!1===e||null==e||!e&&("class"===t||"style"===t))return"";if(!0===e)return" "+(r?t:t+'="'+t+'"');var f=typeof e;return"object"!==f&&"function"!==f||"function"!=typeof e.toJSON||(e=e.toJSON()),"string"==typeof e||(e=JSON.stringify(e),n||-1===e.indexOf('"'))?(n&&(e=pug_escape(e))," "+t+'="'+e+'"'):" "+t+"='"+e.replace(/'/g,"'")+"'"}
|
|
2
|
+
function pug_escape(e){var a=""+e,t=pug_match_html.exec(a);if(!t)return e;var r,c,n,s="";for(r=t.index,c=0;r<a.length;r++){switch(a.charCodeAt(r)){case 34:n=""";break;case 38:n="&";break;case 60:n="<";break;case 62:n=">";break;default:continue}c!==r&&(s+=a.substring(c,r)),c=r+1,s+=n}return c!==r?s+a.substring(c,r):s}
|
|
3
|
+
var pug_match_html=/["&<>]/;
|
|
4
|
+
function pug_rethrow(e,n,r,t){if(!(e instanceof Error))throw e;if(!("undefined"==typeof window&&n||t))throw e.message+=" on line "+r,e;var o,a,i,s;try{t=t||require("fs").readFileSync(n,{encoding:"utf8"}),o=3,a=t.split("\n"),i=Math.max(r-o,0),s=Math.min(a.length,r+o)}catch(t){return e.message+=" - could not read from "+n+" ("+t.message+")",void pug_rethrow(e,null,r)}o=a.slice(i,s).map(function(e,n){var t=n+i+1;return(t==r?" > ":" ")+t+"| "+e}).join("\n"),e.path=n;try{e.message=(n||"Pug")+":"+r+"\n"+o+"\n\n"+e.message}catch(e){}throw e}function template(locals) {var pug_html = "", pug_mixins = {}, pug_interp;var pug_debug_filename, pug_debug_line;try {;
|
|
5
|
+
var locals_for_with = (locals || {});
|
|
6
|
+
|
|
7
|
+
(function (Array, c, defer, libLoader, url, version) {
|
|
8
|
+
;pug_debug_line = 1;pug_debug_filename = "src\u002Fpug\u002Findex.pug";
|
|
9
|
+
pug_html = pug_html + "\u003C!DOCTYPE html\u003E";
|
|
10
|
+
;pug_debug_line = 2;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
11
|
+
if(!libLoader) {
|
|
12
|
+
libLoader = {
|
|
13
|
+
js: {url: {}},
|
|
14
|
+
css: {url: {}},
|
|
15
|
+
root: function(r) { libLoader._r = r; },
|
|
16
|
+
_r: "/assets/lib",
|
|
17
|
+
_v: "",
|
|
18
|
+
version: function(v) { libLoader._v = (v ? "?v=" + v : ""); }
|
|
19
|
+
}
|
|
20
|
+
if(version) { libLoader.version(version); }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
;pug_debug_line = 15;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
24
|
+
pug_mixins["script"] = pug_interp = function(os,cfg){
|
|
25
|
+
var block = (this && this.block), attributes = (this && this.attributes) || {};
|
|
26
|
+
;pug_debug_line = 16;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
27
|
+
if(!Array.isArray(os)) { os = [os]; }
|
|
28
|
+
;pug_debug_line = 18;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
29
|
+
// iterate os
|
|
30
|
+
;(function(){
|
|
31
|
+
var $$obj = os;
|
|
32
|
+
if ('number' == typeof $$obj.length) {
|
|
33
|
+
for (var pug_index0 = 0, $$l = $$obj.length; pug_index0 < $$l; pug_index0++) {
|
|
34
|
+
var o = $$obj[pug_index0];
|
|
35
|
+
;pug_debug_line = 19;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
36
|
+
c = o;
|
|
37
|
+
if(typeof(o) == "string") { url = o; c = cfg || {};}
|
|
38
|
+
else if(o.url) { url = o.url; }
|
|
39
|
+
else { url = libLoader._r + "/" + o.name + "/" + (o.version || 'main') + "/" + (o.path || "index.min.js"); }
|
|
40
|
+
;pug_debug_line = 24;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
41
|
+
if (!libLoader.js.url[url]) {
|
|
42
|
+
;pug_debug_line = 25;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
43
|
+
libLoader.js.url[url] = true;
|
|
44
|
+
;pug_debug_line = 26;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
45
|
+
defer = (typeof(c.defer) == "undefined" ? true : !!c.defer);
|
|
46
|
+
;pug_debug_line = 27;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
47
|
+
if (/^https?:\/\/./.exec(url)) {
|
|
48
|
+
;pug_debug_line = 28;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
49
|
+
pug_html = pug_html + "\u003Cscript" + (" type=\"text\u002Fjavascript\""+pug_attr("src", url, true, true)+pug_attr("defer", defer, true, true)+pug_attr("async", !!c.async, true, true)) + "\u003E\u003C\u002Fscript\u003E";
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
;pug_debug_line = 30;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
53
|
+
pug_html = pug_html + "\u003Cscript" + (" type=\"text\u002Fjavascript\""+pug_attr("src", url + libLoader._v, true, true)+pug_attr("defer", defer, true, true)+pug_attr("async", !!c.async, true, true)) + "\u003E\u003C\u002Fscript\u003E";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
var $$l = 0;
|
|
59
|
+
for (var pug_index0 in $$obj) {
|
|
60
|
+
$$l++;
|
|
61
|
+
var o = $$obj[pug_index0];
|
|
62
|
+
;pug_debug_line = 19;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
63
|
+
c = o;
|
|
64
|
+
if(typeof(o) == "string") { url = o; c = cfg || {};}
|
|
65
|
+
else if(o.url) { url = o.url; }
|
|
66
|
+
else { url = libLoader._r + "/" + o.name + "/" + (o.version || 'main') + "/" + (o.path || "index.min.js"); }
|
|
67
|
+
;pug_debug_line = 24;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
68
|
+
if (!libLoader.js.url[url]) {
|
|
69
|
+
;pug_debug_line = 25;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
70
|
+
libLoader.js.url[url] = true;
|
|
71
|
+
;pug_debug_line = 26;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
72
|
+
defer = (typeof(c.defer) == "undefined" ? true : !!c.defer);
|
|
73
|
+
;pug_debug_line = 27;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
74
|
+
if (/^https?:\/\/./.exec(url)) {
|
|
75
|
+
;pug_debug_line = 28;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
76
|
+
pug_html = pug_html + "\u003Cscript" + (" type=\"text\u002Fjavascript\""+pug_attr("src", url, true, true)+pug_attr("defer", defer, true, true)+pug_attr("async", !!c.async, true, true)) + "\u003E\u003C\u002Fscript\u003E";
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
;pug_debug_line = 30;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
80
|
+
pug_html = pug_html + "\u003Cscript" + (" type=\"text\u002Fjavascript\""+pug_attr("src", url + libLoader._v, true, true)+pug_attr("defer", defer, true, true)+pug_attr("async", !!c.async, true, true)) + "\u003E\u003C\u002Fscript\u003E";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}).call(this);
|
|
86
|
+
|
|
87
|
+
};
|
|
88
|
+
;pug_debug_line = 32;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
89
|
+
pug_mixins["css"] = pug_interp = function(os,cfg){
|
|
90
|
+
var block = (this && this.block), attributes = (this && this.attributes) || {};
|
|
91
|
+
;pug_debug_line = 33;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
92
|
+
if(!Array.isArray(os)) { os = [os]; }
|
|
93
|
+
;pug_debug_line = 35;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
94
|
+
// iterate os
|
|
95
|
+
;(function(){
|
|
96
|
+
var $$obj = os;
|
|
97
|
+
if ('number' == typeof $$obj.length) {
|
|
98
|
+
for (var pug_index1 = 0, $$l = $$obj.length; pug_index1 < $$l; pug_index1++) {
|
|
99
|
+
var o = $$obj[pug_index1];
|
|
100
|
+
;pug_debug_line = 36;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
101
|
+
c = o;
|
|
102
|
+
if(typeof(o) == "string") { url = o; c = cfg || {};}
|
|
103
|
+
else if(o.url) { url = o.url; }
|
|
104
|
+
else { url = libLoader._r + "/" + o.name + "/" + (o.version || 'main') + "/" + (o.path || "index.min.css"); }
|
|
105
|
+
;pug_debug_line = 41;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
106
|
+
if (!libLoader.css.url[url]) {
|
|
107
|
+
;pug_debug_line = 42;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
108
|
+
libLoader.css.url[url] = true;
|
|
109
|
+
;pug_debug_line = 43;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
110
|
+
pug_html = pug_html + "\u003Clink" + (" rel=\"stylesheet\" type=\"text\u002Fcss\""+pug_attr("href", url + libLoader._v, true, true)) + "\u003E";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
var $$l = 0;
|
|
115
|
+
for (var pug_index1 in $$obj) {
|
|
116
|
+
$$l++;
|
|
117
|
+
var o = $$obj[pug_index1];
|
|
118
|
+
;pug_debug_line = 36;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
119
|
+
c = o;
|
|
120
|
+
if(typeof(o) == "string") { url = o; c = cfg || {};}
|
|
121
|
+
else if(o.url) { url = o.url; }
|
|
122
|
+
else { url = libLoader._r + "/" + o.name + "/" + (o.version || 'main') + "/" + (o.path || "index.min.css"); }
|
|
123
|
+
;pug_debug_line = 41;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
124
|
+
if (!libLoader.css.url[url]) {
|
|
125
|
+
;pug_debug_line = 42;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
126
|
+
libLoader.css.url[url] = true;
|
|
127
|
+
;pug_debug_line = 43;pug_debug_filename = "\u002FUsers\u002Ftkirby\u002Fworkspace\u002Fzbryikt\u002Fplotdb\u002Fprojects\u002Fregistry\u002Fnode_modules\u002F@plotdb\u002Fsrcbuild\u002Fdist\u002Flib.pug";
|
|
128
|
+
pug_html = pug_html + "\u003Clink" + (" rel=\"stylesheet\" type=\"text\u002Fcss\""+pug_attr("href", url + libLoader._v, true, true)) + "\u003E";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}).call(this);
|
|
133
|
+
|
|
134
|
+
};
|
|
135
|
+
;pug_debug_line = 2;pug_debug_filename = "src\u002Fpug\u002Findex.pug";
|
|
136
|
+
pug_html = pug_html + "\u003Chtml\u003E";
|
|
137
|
+
;pug_debug_line = 3;pug_debug_filename = "src\u002Fpug\u002Findex.pug";
|
|
138
|
+
pug_html = pug_html + "\u003Chead\u003E";
|
|
139
|
+
;pug_debug_line = 4;pug_debug_filename = "src\u002Fpug\u002Findex.pug";
|
|
140
|
+
pug_mixins["css"]([
|
|
141
|
+
{name: "bootstrap", path: "css/bootstrap.min.css"}
|
|
142
|
+
]);
|
|
143
|
+
pug_html = pug_html + "\u003C\u002Fhead\u003E";
|
|
144
|
+
;pug_debug_line = 7;pug_debug_filename = "src\u002Fpug\u002Findex.pug";
|
|
145
|
+
pug_html = pug_html + "\u003Cbody\u003E";
|
|
146
|
+
;pug_debug_line = 8;pug_debug_filename = "src\u002Fpug\u002Findex.pug";
|
|
147
|
+
pug_mixins["script"]([
|
|
148
|
+
{name: "proxise"},
|
|
149
|
+
{name: "@loadingio/debounce.js", path: "debounce.min.js"},
|
|
150
|
+
{name: "@plotdb/csscope"},
|
|
151
|
+
{name: "@plotdb/rescope"},
|
|
152
|
+
{name: "@plotdb/block"}
|
|
153
|
+
]);
|
|
154
|
+
;pug_debug_line = 15;pug_debug_filename = "src\u002Fpug\u002Findex.pug";
|
|
155
|
+
pug_html = pug_html + "\u003Cscript type=\"module\"\u003E";
|
|
156
|
+
;pug_debug_line = 15;pug_debug_filename = "src\u002Fpug\u002Findex.pug";
|
|
157
|
+
pug_html = pug_html + "var provider,rsp;provider={jsdelivr:function(n){var e,r,t,i;e=n.name,r=n.version,t=n.path;i=\"https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002F\"+e+(r?\"@\"+r:\"\")+\"\u002F\"+(t||\"dist\u002Findex.min.js\");return fetch(i).then(function(n){var e;e=n.headers.get(\"x-jsd-version\");return n.text().then(function(n){return{version:e||r,content:n}})})},unpkg:function(n){var e,r,t;e=n.name,r=n.version,t=n.path;return Promise.resolve().then(function(){var n;n=\"https:\u002F\u002Funpkg.com\u002F\"+e+(r?\"@\"+r:\"\")+\"\u002F\"+(t||\"dist\u002Findex.min.js\");return fetch(n).then(function(n){var e;e=(\u002F^https:\\\u002F\\\u002Funpkg.com\\\u002F([^@]+)@([^\u002F]+)\\\u002F\u002F.exec(n.url)||[])[2];return n.text().then(function(n){return{version:e||r,content:n}})})})}};rsp=new rescope({registry:provider.jsdelivr});rsp.init().then(function(){return rsp.load([{name:\"ldview\",version:\"^0.1\"}]).then(function(n){return console.log(\"\u003E\",n)})});\u003C\u002Fscript\u003E\u003C\u002Fbody\u003E\u003C\u002Fhtml\u003E";
|
|
158
|
+
}.call(this, "Array" in locals_for_with ?
|
|
159
|
+
locals_for_with.Array :
|
|
160
|
+
typeof Array !== 'undefined' ? Array : undefined, "c" in locals_for_with ?
|
|
161
|
+
locals_for_with.c :
|
|
162
|
+
typeof c !== 'undefined' ? c : undefined, "defer" in locals_for_with ?
|
|
163
|
+
locals_for_with.defer :
|
|
164
|
+
typeof defer !== 'undefined' ? defer : undefined, "libLoader" in locals_for_with ?
|
|
165
|
+
locals_for_with.libLoader :
|
|
166
|
+
typeof libLoader !== 'undefined' ? libLoader : undefined, "url" in locals_for_with ?
|
|
167
|
+
locals_for_with.url :
|
|
168
|
+
typeof url !== 'undefined' ? url : undefined, "version" in locals_for_with ?
|
|
169
|
+
locals_for_with.version :
|
|
170
|
+
typeof version !== 'undefined' ? version : undefined));
|
|
171
|
+
;} catch (err) {pug_rethrow(err, pug_debug_filename, pug_debug_line);};return pug_html;}; module.exports = template; })()
|
package/web/server.ls
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require! <[fs express path @plotdb/colors lderror]>
|
|
2
|
+
require! <[../src/provider ../src/route ../src/providers/github ../src/providers/npm]>
|
|
3
|
+
|
|
4
|
+
lib = fs.realpathSync path.dirname __filename
|
|
5
|
+
|
|
6
|
+
if !fs.exists-sync path.join(lib, \secret.json) =>
|
|
7
|
+
console.log "please add a `secret.json` file with a access token for github access, such as:"
|
|
8
|
+
console.log ""
|
|
9
|
+
console.log ' {"token": "your-access-token-goes-here"}'
|
|
10
|
+
console.log ""
|
|
11
|
+
process.exit!
|
|
12
|
+
|
|
13
|
+
token = JSON.parse(fs.read-file-sync path.join(lib, \secret.json) .toString!)
|
|
14
|
+
custom = new provider do
|
|
15
|
+
check: ({name, version, path}) ->
|
|
16
|
+
return if !(/^(ld|pth|@plotdb)/.exec(name)) => lderror.reject 403 else Promise.resolve!
|
|
17
|
+
|
|
18
|
+
github.opt token
|
|
19
|
+
custom.chain([github, npm])
|
|
20
|
+
|
|
21
|
+
server = do
|
|
22
|
+
init: (opt={}) ->
|
|
23
|
+
app = express!
|
|
24
|
+
app.use \/, express.static \static
|
|
25
|
+
app.get '/lib/*', route({
|
|
26
|
+
provider: custom
|
|
27
|
+
root:
|
|
28
|
+
pub: \/lib/
|
|
29
|
+
fs: \/var/lib/cdn/cache/lib
|
|
30
|
+
internal: \/ilib/
|
|
31
|
+
})
|
|
32
|
+
console.log "[Server] Express Initialized in #{app.get \env} Mode".green
|
|
33
|
+
server = app.listen opt.port, ->
|
|
34
|
+
delta = if opt.start-time => "( takes #{Date.now! - opt.start-time}ms )" else ''
|
|
35
|
+
console.log "[SERVER] listening on port #{server.address!port} #delta".cyan
|
|
36
|
+
|
|
37
|
+
server.init {port: 9900}
|
|
38
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
provider =
|
|
2
|
+
jsdelivr: ({name, version, path}) ->
|
|
3
|
+
url = "https://cdn.jsdelivr.net/npm/#{name}#{if version => '@' + version else ''}/#{path or 'dist/index.min.js'}"
|
|
4
|
+
fetch url
|
|
5
|
+
.then (response) ->
|
|
6
|
+
v = response.headers.get(\x-jsd-version)
|
|
7
|
+
response.text!then -> {version: v or version, content: it}
|
|
8
|
+
|
|
9
|
+
unpkg: ({name, version, path}) ->
|
|
10
|
+
Promise.resolve!then ->
|
|
11
|
+
url = "https://unpkg.com/#{name}#{if version => '@' + version else ''}/#{path or 'dist/index.min.js'}"
|
|
12
|
+
fetch url
|
|
13
|
+
.then (response) ->
|
|
14
|
+
v = (/^https:\/\/unpkg.com\/([^@]+)@([^/]+)\//.exec(response.url) or []).2
|
|
15
|
+
response.text!then -> {version: v or version, content: it}
|
|
16
|
+
|
|
17
|
+
rsp = new rescope registry: provider.jsdelivr
|
|
18
|
+
|
|
19
|
+
rsp.init!
|
|
20
|
+
.then ->
|
|
21
|
+
rsp.load [{name: "ldview", version: "^0.1"}]
|
|
22
|
+
.then -> console.log ">", it
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
doctype html
|
|
2
|
+
html
|
|
3
|
+
head
|
|
4
|
+
+css([
|
|
5
|
+
{name: "bootstrap", path: "css/bootstrap.min.css"}
|
|
6
|
+
])
|
|
7
|
+
body
|
|
8
|
+
+script([
|
|
9
|
+
{name: "proxise"},
|
|
10
|
+
{name: "@loadingio/debounce.js", path: "debounce.min.js"},
|
|
11
|
+
{name: "@plotdb/csscope"},
|
|
12
|
+
{name: "@plotdb/rescope"},
|
|
13
|
+
{name: "@plotdb/block"}
|
|
14
|
+
])
|
|
15
|
+
script(type="module"): include:lsc index.ls
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="/assets/lib/bootstrap/main/css/bootstrap.min.css"></head><body><script type="text/javascript" src="/assets/lib/proxise/main/index.min.js" defer></script><script type="text/javascript" src="/assets/lib/@loadingio/debounce.js/main/debounce.min.js" defer></script><script type="text/javascript" src="/assets/lib/@plotdb/csscope/main/index.min.js" defer></script><script type="text/javascript" src="/assets/lib/@plotdb/rescope/main/index.min.js" defer></script><script type="text/javascript" src="/assets/lib/@plotdb/block/main/index.min.js" defer></script><script type="module">var provider,rsp;provider={jsdelivr:function(n){var e,r,t,i;e=n.name,r=n.version,t=n.path;i="https://cdn.jsdelivr.net/npm/"+e+(r?"@"+r:"")+"/"+(t||"dist/index.min.js");return fetch(i).then(function(n){var e;e=n.headers.get("x-jsd-version");return n.text().then(function(n){return{version:e||r,content:n}})})},unpkg:function(n){var e,r,t;e=n.name,r=n.version,t=n.path;return Promise.resolve().then(function(){var n;n="https://unpkg.com/"+e+(r?"@"+r:"")+"/"+(t||"dist/index.min.js");return fetch(n).then(function(n){var e;e=(/^https:\/\/unpkg.com\/([^@]+)@([^/]+)\//.exec(n.url)||[])[2];return n.text().then(function(n){return{version:e||r,content:n}})})})}};rsp=new rescope({registry:provider.jsdelivr});rsp.init().then(function(){return rsp.load([{name:"ldview",version:"^0.1"}]).then(function(n){return console.log(">",n)})});</script></body></html>
|