@plotdb/srcbuild 0.0.56 → 0.0.57
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/dist/ext/bundle.js +569 -202
- package/dist/ext/pug.js +90 -14
- package/dist/lib.pug +8 -6
- package/package.json +19 -1
package/dist/ext/bundle.js
CHANGED
|
@@ -1,237 +1,612 @@
|
|
|
1
1
|
// Generated by LiveScript 1.6.0
|
|
2
|
-
var
|
|
3
|
-
fs = require('fs');
|
|
2
|
+
var path, uglifyJs, uglifycss, debounce, base, aux, fs, spec, specmgr, build;
|
|
4
3
|
path = require('path');
|
|
5
|
-
fsExtra = require('fs-extra');
|
|
6
4
|
uglifyJs = require('uglify-js');
|
|
7
5
|
uglifycss = require('uglifycss');
|
|
8
|
-
|
|
6
|
+
debounce = require('@loadingio/debounce.js');
|
|
9
7
|
base = require('./base');
|
|
10
8
|
aux = require('../aux');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
:
|
|
22
|
-
|
|
9
|
+
fs = require("fs-extra");
|
|
10
|
+
spec = function(o){
|
|
11
|
+
var ref$;
|
|
12
|
+
o == null && (o = {});
|
|
13
|
+
this.mgr = o.manager;
|
|
14
|
+
this.log = o.log;
|
|
15
|
+
this.o = JSON.parse(JSON.stringify({
|
|
16
|
+
name: o.name,
|
|
17
|
+
type: o.type,
|
|
18
|
+
codesrc: o.codesrc,
|
|
19
|
+
specsrc: o.specsrc,
|
|
20
|
+
deps: o.deps
|
|
21
|
+
}));
|
|
22
|
+
this.type = (ref$ = this.o).type;
|
|
23
|
+
this.name = ref$.name;
|
|
24
|
+
this.src = (Array.isArray(o.src)
|
|
25
|
+
? o.src
|
|
26
|
+
: [o.src]).filter(function(it){
|
|
27
|
+
return it;
|
|
28
|
+
});
|
|
29
|
+
this.codesrc = new Set(this.o.codesrc || []);
|
|
30
|
+
this.specsrc = new Set(this.o.specsrc || []);
|
|
31
|
+
this.deps = new Set(this.o.deps || []);
|
|
32
|
+
return this;
|
|
33
|
+
};
|
|
34
|
+
spec.prototype = import$(Object.create(Object.prototype), {
|
|
35
|
+
toObject: function(){
|
|
36
|
+
var ref$;
|
|
37
|
+
return ref$ = {
|
|
38
|
+
codesrc: Array.from(this.codesrc),
|
|
39
|
+
specsrc: Array.from(this.specsrc),
|
|
40
|
+
deps: Array.from(this.deps)
|
|
41
|
+
}, ref$.type = this.type, ref$.name = this.name, ref$;
|
|
42
|
+
},
|
|
43
|
+
cacheFn: function(){
|
|
44
|
+
return this.mgr.getCacheName(this);
|
|
45
|
+
},
|
|
46
|
+
syncCache: function(){
|
|
47
|
+
var fn, this$ = this;
|
|
48
|
+
fn = this.cacheFn();
|
|
49
|
+
return fs.ensureDir(path.dirname(fn)).then(function(){
|
|
50
|
+
fs.writeFile(fn, JSON.stringify(this$.toObject()));
|
|
51
|
+
return this$.log.info("bundle dependency written to " + fn);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
specmgr = function(o){
|
|
56
|
+
o == null && (o = {});
|
|
57
|
+
this.log = o.log;
|
|
58
|
+
this.cachedir = o.cachedir;
|
|
59
|
+
this.evthdr = {};
|
|
60
|
+
this._ = {};
|
|
61
|
+
this.codesrc = {};
|
|
62
|
+
this.specsrc = {};
|
|
63
|
+
this.deps = {};
|
|
64
|
+
this._dirty = new Set();
|
|
65
|
+
return this;
|
|
66
|
+
};
|
|
67
|
+
specmgr.prototype = import$(Object.create(Object.prototype), {
|
|
68
|
+
on: function(n, cb){
|
|
69
|
+
var this$ = this;
|
|
70
|
+
return (Array.isArray(n)
|
|
71
|
+
? n
|
|
72
|
+
: [n]).map(function(n){
|
|
73
|
+
var ref$;
|
|
74
|
+
return ((ref$ = this$.evthdr)[n] || (ref$[n] = [])).push(cb);
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
fire: function(n){
|
|
78
|
+
var v, res$, i$, to$, ref$, len$, cb, results$ = [];
|
|
79
|
+
res$ = [];
|
|
80
|
+
for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
|
|
81
|
+
res$.push(arguments[i$]);
|
|
82
|
+
}
|
|
83
|
+
v = res$;
|
|
84
|
+
for (i$ = 0, len$ = (ref$ = this.evthdr[n] || []).length; i$ < len$; ++i$) {
|
|
85
|
+
cb = ref$[i$];
|
|
86
|
+
results$.push(cb.apply(this, v));
|
|
87
|
+
}
|
|
88
|
+
return results$;
|
|
89
|
+
},
|
|
90
|
+
key: function(o){
|
|
91
|
+
o == null && (o = {});
|
|
92
|
+
if (typeof o === 'object') {
|
|
93
|
+
return o.type + "/" + o.name;
|
|
94
|
+
} else {
|
|
95
|
+
return o;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
getCacheName: function(spec){
|
|
99
|
+
return path.join(this.cachedir, spec.type, spec.name + ".dep");
|
|
100
|
+
},
|
|
101
|
+
setDirty: function(o){
|
|
102
|
+
o == null && (o = {});
|
|
103
|
+
this._dirty.add(this.key(o));
|
|
104
|
+
return this.clearDirty();
|
|
105
|
+
},
|
|
106
|
+
clearDirty: debounce(1000, function(){
|
|
107
|
+
var specs, this$ = this;
|
|
108
|
+
specs = Array.from(this._dirty).map(function(k){
|
|
109
|
+
return this$.get(k);
|
|
110
|
+
}).filter(function(it){
|
|
111
|
+
return it;
|
|
112
|
+
});
|
|
113
|
+
this.fire('build-by-spec', specs);
|
|
114
|
+
specs.map(function(s){
|
|
115
|
+
return s.syncCache();
|
|
116
|
+
});
|
|
117
|
+
return this._dirty.clear();
|
|
118
|
+
}),
|
|
119
|
+
add: function(o, opt){
|
|
120
|
+
var k, that, s, this$ = this;
|
|
121
|
+
o == null && (o = {});
|
|
122
|
+
opt == null && (opt = {});
|
|
123
|
+
k = this.key(o);
|
|
124
|
+
if (that = this._[k] && !opt.force) {
|
|
125
|
+
return that;
|
|
126
|
+
}
|
|
127
|
+
this._[k] = s = new spec(import$({
|
|
128
|
+
log: this.log,
|
|
129
|
+
manager: this
|
|
130
|
+
}, o));
|
|
131
|
+
s.codesrc.forEach(function(n){
|
|
132
|
+
return this$.link({
|
|
133
|
+
codesrc: n,
|
|
134
|
+
spec: s
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
s.specsrc.forEach(function(n){
|
|
138
|
+
return this$.link({
|
|
139
|
+
specsrc: n,
|
|
140
|
+
spec: s
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
s.deps.forEach(function(n){
|
|
144
|
+
return this$.link({
|
|
145
|
+
deps: n,
|
|
146
|
+
spec: s
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
if (!opt.init) {
|
|
150
|
+
this.setDirty(s);
|
|
151
|
+
}
|
|
152
|
+
return s;
|
|
153
|
+
},
|
|
154
|
+
set: function(o, opt){
|
|
155
|
+
o == null && (o = {});
|
|
156
|
+
opt == null && (opt = {});
|
|
157
|
+
return this.add(o, import$({
|
|
158
|
+
force: true
|
|
159
|
+
}, opt));
|
|
160
|
+
},
|
|
161
|
+
hasCode: function(f){
|
|
162
|
+
return !!this.codesrc[f] || !!this.deps[f];
|
|
163
|
+
},
|
|
164
|
+
touchCode: function(files){
|
|
165
|
+
var keys, this$ = this;
|
|
166
|
+
files = Array.isArray(files)
|
|
167
|
+
? files
|
|
168
|
+
: [files];
|
|
169
|
+
keys = new Set();
|
|
170
|
+
files.map(function(f){
|
|
171
|
+
if (typeof f === 'object') {
|
|
172
|
+
f = f.file;
|
|
173
|
+
}
|
|
174
|
+
if (this$.codesrc[f]) {
|
|
175
|
+
Array.from(this$.codesrc[f]).forEach(function(k){
|
|
176
|
+
return keys.add(k);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (this$.deps[f]) {
|
|
180
|
+
return Array.from(this$.deps[f]).forEach(function(k){
|
|
181
|
+
return keys.add(k);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
return this.fire('build-by-spec', Array.from(keys).map(function(k){
|
|
186
|
+
return this$.get(k);
|
|
187
|
+
}));
|
|
188
|
+
},
|
|
189
|
+
update: function(o){
|
|
190
|
+
var k, dirty, s, this$ = this;
|
|
191
|
+
o == null && (o = {});
|
|
192
|
+
k = this.key(o);
|
|
193
|
+
dirty = false;
|
|
194
|
+
if (!(s = this._[k])) {
|
|
195
|
+
this.add(o);
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
if (Array.from(s.codesrc).join(',') !== (o.codesrc || []).join(',')) {
|
|
199
|
+
dirty = true;
|
|
200
|
+
}
|
|
201
|
+
if (s.src.join(',') !== (o.src || []).join(',')) {
|
|
202
|
+
dirty = true;
|
|
203
|
+
}
|
|
204
|
+
s.src = (Array.isArray(o.src)
|
|
205
|
+
? o.src
|
|
206
|
+
: [o.src]).filter(function(it){
|
|
207
|
+
return it;
|
|
208
|
+
});
|
|
209
|
+
s.codesrc = new Set(o.codesrc || []);
|
|
210
|
+
s.deps = new Set(o.deps || []);
|
|
211
|
+
(Array.isArray(o.specsrc)
|
|
212
|
+
? o.specsrc
|
|
213
|
+
: [o.specsrc]).forEach(function(n){
|
|
214
|
+
if (!s.specsrc.has(n)) {
|
|
215
|
+
dirty = true;
|
|
216
|
+
}
|
|
217
|
+
return s.specsrc.add(n);
|
|
218
|
+
});
|
|
219
|
+
s.codesrc.forEach(function(n){
|
|
220
|
+
return this$.link({
|
|
221
|
+
codesrc: n,
|
|
222
|
+
spec: s
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
s.specsrc.forEach(function(n){
|
|
226
|
+
return this$.link({
|
|
227
|
+
specsrc: n,
|
|
228
|
+
spec: s
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
s.deps.forEach(function(n){
|
|
232
|
+
return this$.link({
|
|
233
|
+
deps: n,
|
|
234
|
+
spec: s
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
if (dirty) {
|
|
238
|
+
this.setDirty(s);
|
|
239
|
+
}
|
|
240
|
+
return dirty;
|
|
241
|
+
},
|
|
242
|
+
get: function(o){
|
|
243
|
+
o == null && (o = {});
|
|
244
|
+
return this._[this.key(o)];
|
|
245
|
+
},
|
|
246
|
+
'delete': function(o){
|
|
247
|
+
var s, this$ = this;
|
|
248
|
+
o == null && (o = {});
|
|
249
|
+
s = this._[this.key(o)];
|
|
250
|
+
s.codesrc.forEach(function(n){
|
|
251
|
+
return this$.unlink({
|
|
252
|
+
codesrc: n,
|
|
253
|
+
spec: s
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
s.specsrc.forEach(function(n){
|
|
257
|
+
return this$.unlink({
|
|
258
|
+
specsrc: n,
|
|
259
|
+
spec: s
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
s.deps.forEach(function(n){
|
|
263
|
+
return this$.unlink({
|
|
264
|
+
deps: n,
|
|
265
|
+
spec: s
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
return this.setDirty(o);
|
|
269
|
+
},
|
|
270
|
+
link: function(o){
|
|
271
|
+
var f, s, that;
|
|
272
|
+
o == null && (o = {});
|
|
273
|
+
f = o.codesrc
|
|
274
|
+
? 'codesrc'
|
|
275
|
+
: o.specsrc ? 'specsrc' : 'deps';
|
|
276
|
+
s = (that = this[f][o[f]])
|
|
277
|
+
? that
|
|
278
|
+
: this[f][o[f]] = new Set();
|
|
279
|
+
if (!s) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
return s.add(this.key(o.spec));
|
|
283
|
+
},
|
|
284
|
+
unlink: function(o){
|
|
285
|
+
var f, s, ref$, key$, ref1$;
|
|
286
|
+
o == null && (o = {});
|
|
287
|
+
f = o.codesrc
|
|
288
|
+
? 'codesrc'
|
|
289
|
+
: o.specsrc ? 'specsrc' : 'deps';
|
|
290
|
+
if (!(s = this[f][o[f]])) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
s.remove(this.key(o.spec));
|
|
294
|
+
if (s.size) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
return ref1$ = (ref$ = this[f])[key$ = o[f]], delete ref$[key$], ref1$;
|
|
298
|
+
},
|
|
299
|
+
delSpecsrc: function(n){
|
|
300
|
+
var s, ref$, ref1$, this$ = this;
|
|
301
|
+
if (!(s = this.specsrc[n])) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
s.forEach(function(k){
|
|
305
|
+
var spec;
|
|
306
|
+
if (!(spec = this$.get(k))) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
spec.unlink({
|
|
310
|
+
specsrc: n
|
|
311
|
+
});
|
|
312
|
+
return this$.setDirty(k);
|
|
313
|
+
});
|
|
314
|
+
return ref1$ = (ref$ = this.specsrc)[n], delete ref$[n], ref1$;
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
build = function(o){
|
|
318
|
+
o == null && (o = {});
|
|
319
|
+
this.mgr = o.manager;
|
|
320
|
+
this.defcfg = o.config || null;
|
|
321
|
+
this.cachedir = path.join(o.base || '.', '.bundle-dep');
|
|
322
|
+
this.cfgfn = o.configFile ? path.join(o.base || '.', o.configFile) : null;
|
|
323
|
+
this.reldir = typeof o.relativePath === 'string'
|
|
324
|
+
? o.relativePath
|
|
325
|
+
: o.relativePath && this.cfgfn
|
|
326
|
+
? path.dirname(this.cfgfn)
|
|
23
327
|
: process.cwd();
|
|
24
|
-
this.
|
|
25
|
-
|
|
328
|
+
this.log = o.logger || aux.logger;
|
|
329
|
+
this.reload();
|
|
330
|
+
this.init(import$({
|
|
26
331
|
srcdir: 'static',
|
|
27
332
|
desdir: 'static'
|
|
28
|
-
},
|
|
333
|
+
}, o));
|
|
334
|
+
return this;
|
|
29
335
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
if (
|
|
336
|
+
build.prototype = import$(Object.create(base.prototype), {
|
|
337
|
+
getPath: function(f){
|
|
338
|
+
var version, p;
|
|
339
|
+
if (typeof f === 'string') {
|
|
340
|
+
return f;
|
|
341
|
+
}
|
|
342
|
+
if (this.mgr) {
|
|
343
|
+
return this.mgr.getUrl(f);
|
|
344
|
+
}
|
|
345
|
+
version = f.version || 'main';
|
|
346
|
+
p = f.path
|
|
347
|
+
? f.path
|
|
348
|
+
: f.type === 'css'
|
|
349
|
+
? 'index.min.css'
|
|
350
|
+
: f.type === 'block' ? 'index.html' : 'index.min.js';
|
|
351
|
+
return path.join(this.desdir, "assets/lib/" + f.name + "/" + version + "/" + p);
|
|
352
|
+
},
|
|
353
|
+
reload: function(){
|
|
354
|
+
this.reset();
|
|
355
|
+
this.loadCfg({
|
|
356
|
+
init: true
|
|
357
|
+
});
|
|
358
|
+
return this.loadCaches();
|
|
359
|
+
},
|
|
360
|
+
reset: function(){
|
|
361
|
+
var this$ = this;
|
|
362
|
+
this.specmgr = new specmgr({
|
|
363
|
+
cachedir: this.cachedir,
|
|
364
|
+
log: this.log
|
|
365
|
+
});
|
|
366
|
+
return this.specmgr.on('build-by-spec', function(specs){
|
|
367
|
+
return specs.forEach(function(spec){
|
|
368
|
+
return this$.buildBySpec(spec);
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
},
|
|
372
|
+
loadCfg: function(opt){
|
|
373
|
+
var cfgs, cfg, e, i$, len$, ref$, fn, lresult$, type, lresult1$, name, list, codesrc, results$ = [], this$ = this;
|
|
374
|
+
opt == null && (opt = {});
|
|
375
|
+
cfgs = opt.init
|
|
376
|
+
? [['', this.defcfg]]
|
|
377
|
+
: [];
|
|
378
|
+
if (this.cfgfn && fs.existsSync(this.cfgfn)) {
|
|
34
379
|
try {
|
|
35
|
-
|
|
380
|
+
cfg = JSON.parse(fs.readFileSync(this.cfgfn).toString());
|
|
36
381
|
} catch (e$) {
|
|
37
382
|
e = e$;
|
|
38
|
-
|
|
39
|
-
|
|
383
|
+
this.log.error(("parse error of config file " + this.cfgfn).red);
|
|
384
|
+
cfg = {};
|
|
40
385
|
}
|
|
386
|
+
cfgs.push([this.cfgfn, cfg]);
|
|
41
387
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
388
|
+
for (i$ = 0, len$ = cfgs.length; i$ < len$; ++i$) {
|
|
389
|
+
ref$ = cfgs[i$], fn = ref$[0], cfg = ref$[1];
|
|
390
|
+
lresult$ = [];
|
|
391
|
+
for (type in cfg) {
|
|
392
|
+
lresult1$ = [];
|
|
393
|
+
for (name in ref$ = cfg[type]) {
|
|
45
394
|
list = ref$[name];
|
|
46
|
-
|
|
395
|
+
codesrc = list.map(fn$);
|
|
396
|
+
lresult1$.push(this.specmgr.update({
|
|
397
|
+
type: type,
|
|
398
|
+
name: name,
|
|
399
|
+
src: list,
|
|
400
|
+
codesrc: codesrc,
|
|
401
|
+
deps: [fn],
|
|
402
|
+
specsrc: [fn]
|
|
403
|
+
}));
|
|
47
404
|
}
|
|
405
|
+
lresult$.push(lresult1$);
|
|
48
406
|
}
|
|
407
|
+
results$.push(lresult$);
|
|
49
408
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
f = list[i$];
|
|
57
|
-
this.fileList.add(f);
|
|
58
|
-
this.fileMap[f] = {
|
|
59
|
-
type: type,
|
|
60
|
-
name: name
|
|
61
|
-
};
|
|
62
|
-
}
|
|
409
|
+
return results$;
|
|
410
|
+
function fn$(n){
|
|
411
|
+
if (typeof n === 'string') {
|
|
412
|
+
return path.join(this$.reldir, n);
|
|
413
|
+
} else {
|
|
414
|
+
return this$.getPath(n);
|
|
63
415
|
}
|
|
64
416
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
417
|
+
},
|
|
418
|
+
loadCaches: function(){
|
|
419
|
+
var traverse, files, this$ = this;
|
|
420
|
+
if (!fs.existsSync(this.cachedir)) {
|
|
421
|
+
return;
|
|
68
422
|
}
|
|
423
|
+
traverse = function(dir){
|
|
424
|
+
var files, ret, i$, len$, file;
|
|
425
|
+
files = fs.readdirSync(dir).map(function(n){
|
|
426
|
+
return path.join(dir, n);
|
|
427
|
+
});
|
|
428
|
+
ret = [];
|
|
429
|
+
for (i$ = 0, len$ = files.length; i$ < len$; ++i$) {
|
|
430
|
+
file = files[i$];
|
|
431
|
+
if (fs.statSync(file).isDirectory()) {
|
|
432
|
+
ret = ret.concat(traverse(file));
|
|
433
|
+
}
|
|
434
|
+
if (/\.dep$/.exec(file)) {
|
|
435
|
+
ret.push(file);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return ret;
|
|
439
|
+
};
|
|
440
|
+
files = traverse(this.cachedir);
|
|
441
|
+
return files.forEach(function(n){
|
|
442
|
+
var json, e;
|
|
443
|
+
try {
|
|
444
|
+
json = JSON.parse(fs.readFileSync(n).toString());
|
|
445
|
+
} catch (e$) {
|
|
446
|
+
e = e$;
|
|
447
|
+
console.log(e);
|
|
448
|
+
this$.log.error(("parse error of cache file " + n).red);
|
|
449
|
+
}
|
|
450
|
+
return this$.specmgr.set(json, {
|
|
451
|
+
init: true
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
},
|
|
455
|
+
delSpecsrc: function(n){
|
|
456
|
+
return specmgr.delSpecsrc(n);
|
|
457
|
+
},
|
|
458
|
+
addSpec: function(opts){
|
|
459
|
+
var this$ = this;
|
|
460
|
+
opts == null && (opts = []);
|
|
461
|
+
opts = (Array.isArray(opts)
|
|
462
|
+
? opts
|
|
463
|
+
: [opts]).filter(function(it){
|
|
464
|
+
return it;
|
|
465
|
+
});
|
|
466
|
+
return opts.map(function(o){
|
|
467
|
+
var codesrc, specsrc, deps, ref$, ref1$;
|
|
468
|
+
if (o.type === 'block') {
|
|
469
|
+
return this$.mgr.bundle({
|
|
470
|
+
blocks: o.codesrc || (o.codesrc = [])
|
|
471
|
+
}).then(function(r){
|
|
472
|
+
var deps, codesrc, specsrc, ref$, ref1$;
|
|
473
|
+
if (!(r && r.deps)) {
|
|
474
|
+
this$.log.warn("block bundle requires block > 4.8.0 to work properly");
|
|
475
|
+
}
|
|
476
|
+
deps = r.deps || {
|
|
477
|
+
js: [],
|
|
478
|
+
css: [],
|
|
479
|
+
block: []
|
|
480
|
+
};
|
|
481
|
+
deps = (deps.js.concat(deps.css, deps.block)).map(function(f){
|
|
482
|
+
return this$.getPath(f);
|
|
483
|
+
});
|
|
484
|
+
codesrc = (o.src || (o.src = [])).map(function(f){
|
|
485
|
+
return this$.getPath(f);
|
|
486
|
+
});
|
|
487
|
+
specsrc = Array.isArray(o.specsrc)
|
|
488
|
+
? o.specsrc
|
|
489
|
+
: [o.specsrc];
|
|
490
|
+
return this$.specmgr.update((ref$ = (ref1$ = {}, ref1$.name = o.name, ref1$.type = o.type, ref1$.src = o.src, ref1$), ref$.codesrc = codesrc, ref$.specsrc = specsrc, ref$.deps = deps, ref$));
|
|
491
|
+
});
|
|
492
|
+
} else {
|
|
493
|
+
codesrc = (o.src || (o.src = [])).map(function(f){
|
|
494
|
+
return this$.getPath(f);
|
|
495
|
+
});
|
|
496
|
+
specsrc = (Array.isArray(o.specsrc)
|
|
497
|
+
? o.specsrc
|
|
498
|
+
: [o.specsrc]).filter(function(it){
|
|
499
|
+
return it;
|
|
500
|
+
});
|
|
501
|
+
deps = (Array.isArray(o.deps)
|
|
502
|
+
? o.deps
|
|
503
|
+
: [o.deps]).filter(function(it){
|
|
504
|
+
return it;
|
|
505
|
+
});
|
|
506
|
+
return this$.specmgr.update((ref$ = (ref1$ = {}, ref1$.name = o.name, ref1$.type = o.type, ref1$.src = o.src, ref1$), ref$.codesrc = codesrc, ref$.specsrc = specsrc, ref$.deps = deps, ref$));
|
|
507
|
+
}
|
|
508
|
+
});
|
|
69
509
|
},
|
|
70
510
|
getDependencies: function(file){
|
|
71
|
-
return
|
|
72
|
-
? []
|
|
73
|
-
: [this.configFile];
|
|
511
|
+
return [];
|
|
74
512
|
},
|
|
75
513
|
isSupported: function(file){
|
|
76
|
-
return this.
|
|
514
|
+
return this.specmgr.hasCode(file);
|
|
77
515
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
re = new RegExp("^" + this.desdir + "/(css|js)/pack/(.+?)(.min)?.(css|js)");
|
|
81
|
-
if (!(ret = re.exec(file))) {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
return (this.config[ret[1]][ret[2]] || [])[0];
|
|
516
|
+
purge: function(files){
|
|
517
|
+
return this.build(files);
|
|
85
518
|
},
|
|
86
519
|
build: function(files, opt){
|
|
87
|
-
var force,
|
|
520
|
+
var force, this$ = this;
|
|
88
521
|
force = typeof opt === 'boolean' ? opt : false;
|
|
89
522
|
if (opt == null) {
|
|
90
523
|
opt = {};
|
|
91
524
|
}
|
|
92
525
|
if (files.filter(function(it){
|
|
93
|
-
return it.file === this$.
|
|
526
|
+
return it.file === this$.cfgfn;
|
|
94
527
|
}).length) {
|
|
95
|
-
this.
|
|
96
|
-
files = Array.from(this.fileList).map(function(it){
|
|
97
|
-
return {
|
|
98
|
-
file: it
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
files.splice(files.indexOf(this.configFile), 1);
|
|
102
|
-
return this.build(files, true);
|
|
103
|
-
}
|
|
104
|
-
if (opt.odb) {
|
|
105
|
-
dirty = {};
|
|
106
|
-
(dirty[key$ = opt.type] || (dirty[key$] = {}))[opt.name] = true;
|
|
107
|
-
nfs = files.map(function(f){
|
|
108
|
-
return path.join(this$._relativePath, f);
|
|
109
|
-
});
|
|
110
|
-
ofs = ((ref$ = this.config)[key$ = opt.type] || (ref$[key$] = {}))[opt.name] || [];
|
|
111
|
-
if (nfs.length !== ofs.length || nfs.filter(function(it){
|
|
112
|
-
return !in$(it, ofs);
|
|
113
|
-
}).length) {
|
|
114
|
-
force = true;
|
|
115
|
-
}
|
|
116
|
-
((ref$ = this.config)[key$ = opt.type] || (ref$[key$] = {}))[opt.name] = nfs;
|
|
117
|
-
for (i$ = 0, len$ = (ref$ = this.config[opt.type][opt.name]).length; i$ < len$; ++i$) {
|
|
118
|
-
file = ref$[i$];
|
|
119
|
-
this.fileMap[file] = {
|
|
120
|
-
type: opt.type,
|
|
121
|
-
name: opt.name
|
|
122
|
-
};
|
|
123
|
-
this.fileList.add(file);
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
dirty = {};
|
|
127
|
-
for (i$ = 0, len$ = files.length; i$ < len$; ++i$) {
|
|
128
|
-
file = files[i$];
|
|
129
|
-
if (!(ret = this.fileMap[file.file])) {
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
(dirty[key$ = ret.type] || (dirty[key$] = {}))[ret.name] = true;
|
|
133
|
-
}
|
|
528
|
+
return this.loadCfg();
|
|
134
529
|
}
|
|
135
|
-
|
|
136
|
-
for (type in dirty) {
|
|
137
|
-
for (name in dirty[type]) {
|
|
138
|
-
desdir = path.join(this.desdir, type, 'pack');
|
|
139
|
-
des = path.join(desdir, name + "." + type);
|
|
140
|
-
if (!force && aux.newer(des, (this.config[type][name] || []).concat([this.configFile]))) {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
ps.push(this.buildByName({
|
|
144
|
-
type: type,
|
|
145
|
-
name: name
|
|
146
|
-
}));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return Promise.all(ps);
|
|
530
|
+
return this.specmgr.touchCode(files);
|
|
150
531
|
},
|
|
151
|
-
|
|
152
|
-
var name, type,
|
|
532
|
+
desPath: function(arg$){
|
|
533
|
+
var name, type, _desdir, ext, des, desMin, desdir;
|
|
153
534
|
name = arg$.name, type = arg$.type;
|
|
535
|
+
_desdir = path.join(this.desdir, 'assets', 'bundle');
|
|
536
|
+
ext = type === 'block' ? 'html' : type;
|
|
537
|
+
des = path.join(_desdir, name + "." + ext);
|
|
538
|
+
desMin = path.join(_desdir, name + ".min." + ext);
|
|
539
|
+
desdir = path.dirname(des);
|
|
540
|
+
return {
|
|
541
|
+
desdir: desdir,
|
|
542
|
+
des: des,
|
|
543
|
+
desMin: desMin
|
|
544
|
+
};
|
|
545
|
+
},
|
|
546
|
+
buildBySpec: function(spec){
|
|
547
|
+
var this$ = this;
|
|
154
548
|
return Promise.resolve().then(function(){
|
|
155
|
-
var t1, srcs, desdir, des, desMin;
|
|
549
|
+
var name, type, t1, srcs, ref$, desdir, des, desMin, ext;
|
|
550
|
+
name = spec.name, type = spec.type;
|
|
156
551
|
t1 = Date.now();
|
|
157
|
-
srcs =
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
552
|
+
srcs = Array.from(spec.codesrc);
|
|
553
|
+
ref$ = this$.desPath({
|
|
554
|
+
name: name,
|
|
555
|
+
type: type
|
|
556
|
+
}), desdir = ref$.desdir, des = ref$.des, desMin = ref$.desMin;
|
|
557
|
+
ext = type === 'block' ? 'html' : type;
|
|
558
|
+
return fs.ensureDir(desdir).then(function(){
|
|
559
|
+
var ps;
|
|
560
|
+
if (type === 'block') {
|
|
561
|
+
return this$.mgr.bundle({
|
|
562
|
+
blocks: spec.src
|
|
563
|
+
}).then(function(ret){
|
|
564
|
+
var code;
|
|
565
|
+
code = ret.code || ret;
|
|
566
|
+
return Promise.all([fs.writeFile(des, code), fs.writeFile(desMin, code)]);
|
|
165
567
|
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
})), Promise.all(srcs.map(function(f){
|
|
183
|
-
return new Promise(function(res, rej){
|
|
184
|
-
var fm;
|
|
185
|
-
fm = f.replace(/\.(js|css)$/, '.min.$1');
|
|
186
|
-
return fs.readFile(fm, function(e, b){
|
|
187
|
-
if (e) {
|
|
188
|
-
return fs.readFile(f, function(e, b){
|
|
189
|
-
if (e) {
|
|
190
|
-
return rej(e);
|
|
191
|
-
} else {
|
|
192
|
-
return res({
|
|
193
|
-
name: fm,
|
|
194
|
-
code: b.toString()
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
} else {
|
|
199
|
-
return res({
|
|
200
|
-
name: f,
|
|
201
|
-
code: b.toString()
|
|
202
|
-
});
|
|
203
|
-
}
|
|
568
|
+
} else {
|
|
569
|
+
ps = srcs.map(function(f){
|
|
570
|
+
var fMin;
|
|
571
|
+
f = f.replace(".min." + ext, "." + ext);
|
|
572
|
+
fMin = f.replace("." + ext, ".min." + ext);
|
|
573
|
+
return fs.readFile(f)['catch'](function(){
|
|
574
|
+
return "";
|
|
575
|
+
}).then(function(b){
|
|
576
|
+
return fs.readFile(fMin)['catch'](function(){
|
|
577
|
+
return "";
|
|
578
|
+
}).then(function(bm){
|
|
579
|
+
return {
|
|
580
|
+
name: f,
|
|
581
|
+
code: b.toString(),
|
|
582
|
+
codeMin: bm.toString()
|
|
583
|
+
};
|
|
204
584
|
});
|
|
205
585
|
});
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
return fs.writeFile(desMin, minified, function(e, b){
|
|
231
|
-
return res(b);
|
|
232
|
-
});
|
|
233
|
-
})
|
|
234
|
-
]);
|
|
586
|
+
});
|
|
587
|
+
return Promise.all(ps).then(function(ret){
|
|
588
|
+
var normal, minified;
|
|
589
|
+
normal = ret.map(function(it){
|
|
590
|
+
return it.code || it.codeMin;
|
|
591
|
+
}).join('');
|
|
592
|
+
minified = ret.map(function(o){
|
|
593
|
+
if (o.codeMin) {
|
|
594
|
+
return o.codeMin;
|
|
595
|
+
}
|
|
596
|
+
if (!o.code) {
|
|
597
|
+
return "";
|
|
598
|
+
}
|
|
599
|
+
return type === 'js'
|
|
600
|
+
? uglifyJs.minify(o.code).code
|
|
601
|
+
: type === 'css'
|
|
602
|
+
? uglifycss.processString(o.code, {
|
|
603
|
+
uglyComments: true
|
|
604
|
+
})
|
|
605
|
+
: o.code;
|
|
606
|
+
}).join('');
|
|
607
|
+
return Promise.all([fs.writeFile(des, normal), fs.writeFile(desMin, minified)]);
|
|
608
|
+
});
|
|
609
|
+
}
|
|
235
610
|
}).then(function(){
|
|
236
611
|
var ret, size, sizeMin, elapsed;
|
|
237
612
|
ret = {
|
|
@@ -242,27 +617,19 @@ bundlebuild.prototype = import$(Object.create(base.prototype), {
|
|
|
242
617
|
sizeMin: fs.statSync(desMin).size
|
|
243
618
|
};
|
|
244
619
|
size = ret.size, sizeMin = ret.sizeMin, elapsed = ret.elapsed;
|
|
245
|
-
this$.log.info("bundle " +
|
|
246
|
-
this$.log.info("bundle " +
|
|
620
|
+
this$.log.info("bundle " + des + " ( " + size + " bytes / " + elapsed + "ms )");
|
|
621
|
+
this$.log.info("bundle " + desMin + " ( " + sizeMin + " bytes / " + elapsed + "ms )");
|
|
247
622
|
return ret;
|
|
248
623
|
})['catch'](function(e){
|
|
249
624
|
this$.log.error((des + " failed: ").red);
|
|
250
625
|
return this$.log.error(e.message.toString());
|
|
251
626
|
});
|
|
252
627
|
});
|
|
253
|
-
},
|
|
254
|
-
purge: function(files){
|
|
255
|
-
return this.build(files);
|
|
256
628
|
}
|
|
257
629
|
});
|
|
258
|
-
module.exports =
|
|
630
|
+
module.exports = build;
|
|
259
631
|
function import$(obj, src){
|
|
260
632
|
var own = {}.hasOwnProperty;
|
|
261
633
|
for (var key in src) if (own.call(src, key)) obj[key] = src[key];
|
|
262
634
|
return obj;
|
|
263
|
-
}
|
|
264
|
-
function in$(x, xs){
|
|
265
|
-
var i = -1, l = xs.length >>> 0;
|
|
266
|
-
while (++i < l) if (x === xs[i]) return true;
|
|
267
|
-
return false;
|
|
268
635
|
}
|
package/dist/ext/pug.js
CHANGED
|
@@ -85,6 +85,66 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
85
85
|
}
|
|
86
86
|
}],
|
|
87
87
|
filters: import$(this.filters || {}, {
|
|
88
|
+
'bundle': function(text, _opt){
|
|
89
|
+
var opts, ret;
|
|
90
|
+
opts = Array.isArray(_opt.options)
|
|
91
|
+
? _opt.options
|
|
92
|
+
: [_opt.options];
|
|
93
|
+
opts = opts.filter(function(it){
|
|
94
|
+
var ref$;
|
|
95
|
+
return it && ((ref$ = it.type) === 'js' || ref$ === 'css' || ref$ === 'block');
|
|
96
|
+
});
|
|
97
|
+
ret = "";
|
|
98
|
+
opts.forEach(function(o){
|
|
99
|
+
var list, name, str, spec, des, relDesMin, relDes;
|
|
100
|
+
list = o.files;
|
|
101
|
+
list.forEach(function(d){
|
|
102
|
+
if (!d.type) {
|
|
103
|
+
return d.type = o.type;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
if (o.type === 'block' && !(o.sort != null || o.sort)) {
|
|
107
|
+
list.sort(function(a, b){
|
|
108
|
+
var i$, ref$, len$, n, ref1$, c, d;
|
|
109
|
+
for (i$ = 0, len$ = (ref$ = ['ns', 'name', 'version', 'path']).length; i$ < len$; ++i$) {
|
|
110
|
+
n = ref$[i$];
|
|
111
|
+
ref1$ = [a[n] || '', b[n] || ''], c = ref1$[0], d = ref1$[1];
|
|
112
|
+
if (c < d) {
|
|
113
|
+
return -1;
|
|
114
|
+
} else if (c > d) {
|
|
115
|
+
return 1;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return 0;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
if (o.name) {
|
|
122
|
+
name = o.name;
|
|
123
|
+
} else {
|
|
124
|
+
str = (o.type + ":") + list.join(';');
|
|
125
|
+
name = crypto.createHash('md5').update(str).digest('hex');
|
|
126
|
+
name = path.join(name.substring(0, 4), name.substring(4));
|
|
127
|
+
}
|
|
128
|
+
spec = {
|
|
129
|
+
name: name,
|
|
130
|
+
type: o.type,
|
|
131
|
+
src: list,
|
|
132
|
+
specsrc: _opt.filename
|
|
133
|
+
};
|
|
134
|
+
this$.bundler.addSpec(spec);
|
|
135
|
+
des = this$.bundler.desPath(spec);
|
|
136
|
+
relDesMin = path.relative(this$.desdir, des.desMin);
|
|
137
|
+
relDes = path.relative(this$.desdir, des.des);
|
|
138
|
+
if (o.type === 'css') {
|
|
139
|
+
return ret += "<link rel=\"stylesheet\" type=\"text/css\" href=\"/" + relDesMin + "\"/>";
|
|
140
|
+
} else if (o.type === 'js') {
|
|
141
|
+
return ret += "<script type=\"text/javascript\" src=\"/" + relDesMin + "\"></script>";
|
|
142
|
+
} else if (o.type === 'block') {
|
|
143
|
+
return ret += "<link rel=\"block\" href=\"/" + relDesMin + "\">";
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return ret;
|
|
147
|
+
},
|
|
88
148
|
'lsc': function(text, opt){
|
|
89
149
|
var code, codeMin;
|
|
90
150
|
code = livescript.compile(text, {
|
|
@@ -145,19 +205,32 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
145
205
|
return crypto.createHash('md5').update(str).digest('hex');
|
|
146
206
|
},
|
|
147
207
|
hashfile: function(arg$){
|
|
148
|
-
var type, name, files;
|
|
149
|
-
type = arg$.type, name = arg$.name, files = arg$.files;
|
|
208
|
+
var type, name, files, src, spec;
|
|
209
|
+
type = arg$.type, name = arg$.name, files = arg$.files, src = arg$.src;
|
|
150
210
|
if (!this$.bundler) {
|
|
151
211
|
return;
|
|
152
212
|
}
|
|
153
213
|
files = files.map(function(file){
|
|
154
|
-
|
|
214
|
+
if (/^https?:/.exec(file.url || file)) {
|
|
215
|
+
return file.url || file;
|
|
216
|
+
}
|
|
217
|
+
if (file.url || typeof file === 'string') {
|
|
218
|
+
return path.join(this$.desdir, file.url || file);
|
|
219
|
+
}
|
|
220
|
+
if (typeof file === 'object') {
|
|
221
|
+
return import$({
|
|
222
|
+
type: type
|
|
223
|
+
}, file);
|
|
224
|
+
}
|
|
225
|
+
return file;
|
|
155
226
|
});
|
|
156
|
-
|
|
227
|
+
spec = {
|
|
157
228
|
type: type,
|
|
158
229
|
name: name,
|
|
159
|
-
|
|
160
|
-
|
|
230
|
+
src: files,
|
|
231
|
+
specsrc: [src]
|
|
232
|
+
};
|
|
233
|
+
return this$.bundler.addSpec(spec);
|
|
161
234
|
}
|
|
162
235
|
};
|
|
163
236
|
if (this.i18n) {
|
|
@@ -190,14 +263,15 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
190
263
|
return ret;
|
|
191
264
|
},
|
|
192
265
|
getDependencies: function(file){
|
|
193
|
-
var code, ret, root;
|
|
266
|
+
var code, opt, ret, root;
|
|
194
267
|
code = fs.readFileSync(file);
|
|
195
|
-
|
|
268
|
+
opt = import$({
|
|
196
269
|
basedir: path.resolve(this.srcdir),
|
|
197
270
|
filename: file,
|
|
198
271
|
doctype: 'html',
|
|
199
272
|
compileDebug: false
|
|
200
|
-
}, this.extapi)
|
|
273
|
+
}, this.extapi);
|
|
274
|
+
ret = pug.compileClientWithDependenciesTracked(code, opt);
|
|
201
275
|
root = path.resolve('.') + '/';
|
|
202
276
|
return (ret.dependencies || []).map(function(it){
|
|
203
277
|
return it.replace(root, '');
|
|
@@ -249,7 +323,7 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
249
323
|
: ((ref$ = this$.i18n).options || (ref$.options = {})).fallbackLng)
|
|
250
324
|
: Promise.resolve();
|
|
251
325
|
return p.then(function(){
|
|
252
|
-
var i$, ref$, len$, ref1$, file, mtime, src, desh, desv, code, t1, desvdir, ret, t2, desdir, e, results$ = [];
|
|
326
|
+
var i$, ref$, len$, ref1$, file, mtime, src, desh, desv, code, t1, desvdir, opt, ret, t2, desdir, e, results$ = [];
|
|
253
327
|
for (i$ = 0, len$ = (ref$ = files).length; i$ < len$; ++i$) {
|
|
254
328
|
ref1$ = ref$[i$], file = ref1$.file, mtime = ref1$.mtime;
|
|
255
329
|
ref1$ = this$.map(file, intl), src = ref1$.src, desh = ref1$.desh, desv = ref1$.desv;
|
|
@@ -265,12 +339,13 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
265
339
|
if (!this$._noView) {
|
|
266
340
|
desvdir = path.dirname(desv);
|
|
267
341
|
fsExtra.ensureDirSync(desvdir);
|
|
268
|
-
|
|
342
|
+
opt = import$({
|
|
269
343
|
filename: src,
|
|
270
344
|
basedir: path.resolve(this$.srcdir),
|
|
271
345
|
doctype: 'html',
|
|
272
346
|
compileDebug: false
|
|
273
|
-
}, this$.extapi)
|
|
347
|
+
}, this$.extapi);
|
|
348
|
+
ret = pug.compileClient(code, opt);
|
|
274
349
|
ret = " (function() { " + ret + "; module.exports = template; })() ";
|
|
275
350
|
fs.writeFileSync(desv, ret);
|
|
276
351
|
t2 = Date.now();
|
|
@@ -279,12 +354,13 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
279
354
|
if (!/^\/\/- ?view ?/.exec(code)) {
|
|
280
355
|
desdir = path.dirname(desh);
|
|
281
356
|
fsExtra.ensureDirSync(desdir);
|
|
282
|
-
|
|
357
|
+
opt = import$({
|
|
283
358
|
filename: src,
|
|
284
359
|
basedir: path.resolve(this$.srcdir),
|
|
285
360
|
doctype: 'html',
|
|
286
361
|
compileDebug: false
|
|
287
|
-
}, this$.extapi)
|
|
362
|
+
}, this$.extapi);
|
|
363
|
+
fs.writeFileSync(desh, pug.render(code, opt));
|
|
288
364
|
t2 = Date.now();
|
|
289
365
|
results$.push(this$.log.info(src + " --> " + desh + " ( " + (t2 - t1) + "ms )"));
|
|
290
366
|
}
|
package/dist/lib.pug
CHANGED
|
@@ -36,9 +36,10 @@ mixin script(os,cfg)
|
|
|
36
36
|
if cfg && cfg.pack
|
|
37
37
|
-
|
|
38
38
|
var name = md5(str);
|
|
39
|
-
var filename = "/js/pack/" + name + "." + (typeof(cfg.min) == "undefined" || cfg.min ? "min" : "") + ".js";
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
//var filename = "/js/pack/" + name + "." + (typeof(cfg.min) == "undefined" || cfg.min ? "min" : "") + ".js";
|
|
40
|
+
var fn = "/assets/bundle/" + name + "." + (typeof(cfg.min) == "undefined" || cfg.min ? "min" : "") + ".js";
|
|
41
|
+
hashfile({type: "js", name: name, files: urls, src: locals.filename});
|
|
42
|
+
script(type="text/javascript",src=fn + libLoader._v)
|
|
42
43
|
|
|
43
44
|
mixin css(os,cfg)
|
|
44
45
|
-
|
|
@@ -63,6 +64,7 @@ mixin css(os,cfg)
|
|
|
63
64
|
if cfg && cfg.pack
|
|
64
65
|
-
|
|
65
66
|
var name = md5(str);
|
|
66
|
-
var filename = "/css/pack/" + name + "." + (typeof(cfg.min) == "undefined" || cfg.min ? "min" : "") + ".css";
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
//var filename = "/css/pack/" + name + "." + (typeof(cfg.min) == "undefined" || cfg.min ? "min" : "") + ".css";
|
|
68
|
+
var fn = "/assets/bundle/" + name + "." + (typeof(cfg.min) == "undefined" || cfg.min ? "min" : "") + ".css";
|
|
69
|
+
hashfile({type: "css", name: name, files: urls, src: locals.filename});
|
|
70
|
+
link(rel="stylesheet",type="text/css",href=fn + libLoader._v)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "zbryikt",
|
|
3
3
|
"name": "@plotdb/srcbuild",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.57",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "./dist/main.js",
|
|
7
7
|
"files": [
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@loadingio/debounce.js": "^1.0.1",
|
|
30
|
+
"@plotdb/block": "^4.8.0",
|
|
30
31
|
"@plotdb/colors": "^0.0.1",
|
|
31
32
|
"anymatch": "^3.1.2",
|
|
32
33
|
"browserify": "^17.0.0",
|
|
@@ -47,17 +48,34 @@
|
|
|
47
48
|
"yargs": "^17.2.1"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
51
|
+
"@loadingio/bootstrap.ext": "^0.0.9",
|
|
52
|
+
"@plotdb/csscope": "^4.1.2",
|
|
53
|
+
"@plotdb/rescope": "^4.2.2",
|
|
54
|
+
"@plotdb/semver": "^0.0.3",
|
|
55
|
+
"@loadingio/ldquery": "^3.0.4",
|
|
56
|
+
"bootstrap": "^4.6.1",
|
|
57
|
+
"express": "^4.18.2",
|
|
50
58
|
"fedep": "^1.1.7",
|
|
59
|
+
"jsdom": "^20.0.3",
|
|
51
60
|
"ldcolor": "^1.0.0",
|
|
52
61
|
"ldcover": "^3.2.1",
|
|
53
62
|
"ldloader": "^3.0.1",
|
|
54
63
|
"ldview": "^1.3.0",
|
|
64
|
+
"proxise": "^1.0.1",
|
|
55
65
|
"shaderlib": "github:zbryikt/shaderlib"
|
|
56
66
|
},
|
|
57
67
|
"frontendDependencies": {
|
|
58
68
|
"root": "web/static/assets/lib",
|
|
59
69
|
"modules": [
|
|
70
|
+
"bootstrap",
|
|
71
|
+
"@loadingio/ldquery",
|
|
72
|
+
"@loadingio/bootstrap.ext",
|
|
60
73
|
"@loadingio/debounce.js",
|
|
74
|
+
"proxise",
|
|
75
|
+
"@plotdb/semver",
|
|
76
|
+
"@plotdb/rescope",
|
|
77
|
+
"@plotdb/csscope",
|
|
78
|
+
"@plotdb/block",
|
|
61
79
|
"ldcover",
|
|
62
80
|
"ldloader",
|
|
63
81
|
"ldcolor",
|