@plotdb/srcbuild 0.0.45 → 0.0.48
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/pug.js +25 -11
- package/dist/pug-cli +2 -1
- package/dist/pug-cli.js +2 -1
- package/dist/view/pug.js +1 -1
- package/dist/watch.js +7 -5
- package/package.json +1 -1
package/dist/ext/pug.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by LiveScript 1.6.0
|
|
2
|
-
var fs, path, fsExtra, pug, livescript, uglifyJs, uglifycss, stylus, jsYaml, marked, colors, base, aux, pugbuild;
|
|
2
|
+
var fs, path, fsExtra, pug, livescript, uglifyJs, uglifycss, stylus, jsYaml, marked, colors, base, aux, cwd, pugbuild;
|
|
3
3
|
fs = require('fs');
|
|
4
4
|
path = require('path');
|
|
5
5
|
fsExtra = require('fs-extra');
|
|
@@ -13,6 +13,7 @@ marked = require('marked');
|
|
|
13
13
|
colors = require('@plotdb/colors');
|
|
14
14
|
base = require('./base');
|
|
15
15
|
aux = require('../aux');
|
|
16
|
+
cwd = process.cwd();
|
|
16
17
|
pugbuild = function(opt){
|
|
17
18
|
opt == null && (opt = {});
|
|
18
19
|
this.i18n = opt.i18n || null;
|
|
@@ -152,7 +153,7 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
152
153
|
if (!(lng = lng || this$.i18n.language)) {
|
|
153
154
|
return p;
|
|
154
155
|
}
|
|
155
|
-
return path.join(this$.intlbase, lng, p);
|
|
156
|
+
return path.join('/', this$.intlbase, lng, p);
|
|
156
157
|
};
|
|
157
158
|
ret.intlbase = function(p, lng){
|
|
158
159
|
p == null && (p = "");
|
|
@@ -160,7 +161,7 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
160
161
|
if (!(lng = lng || this$.i18n.language)) {
|
|
161
162
|
return p;
|
|
162
163
|
}
|
|
163
|
-
return path.join(this$.intlbase, lng, p);
|
|
164
|
+
return path.join('/', this$.intlbase, lng, p);
|
|
164
165
|
};
|
|
165
166
|
(ret.filters || (ret.filters = {})).i18n = function(t, o){
|
|
166
167
|
return this$.i18n.t((t || '').trim());
|
|
@@ -174,7 +175,8 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
174
175
|
ret = pug.compileClientWithDependenciesTracked(code, import$({
|
|
175
176
|
basedir: path.resolve(this.srcdir),
|
|
176
177
|
filename: file,
|
|
177
|
-
doctype: 'html'
|
|
178
|
+
doctype: 'html',
|
|
179
|
+
compileDebug: false
|
|
178
180
|
}, this.extapi));
|
|
179
181
|
root = path.resolve('.') + '/';
|
|
180
182
|
return (ret.dependencies || []).map(function(it){
|
|
@@ -199,11 +201,21 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
199
201
|
return null;
|
|
200
202
|
},
|
|
201
203
|
map: function(file, intl){
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
var alt;
|
|
205
|
+
if (~file.indexOf(this.srcdir)) {
|
|
206
|
+
return {
|
|
207
|
+
src: file,
|
|
208
|
+
desh: file.replace(this.srcdir, path.join(this.desdir, intl)).replace(/.pug$/, '.html'),
|
|
209
|
+
desv: file.replace(this.srcdir, path.join(this.viewdir, intl)).replace(/.pug/, '.js')
|
|
210
|
+
};
|
|
211
|
+
} else {
|
|
212
|
+
alt = path.resolve(path.join('/', path.relative('.', file)));
|
|
213
|
+
return {
|
|
214
|
+
src: file,
|
|
215
|
+
desh: path.join(cwd, this.desdir, '.@root', intl, alt).replace(/.pug$/, '.html'),
|
|
216
|
+
desv: path.join(cwd, this.viewdir, '.@root', intl, alt).replace(/.pug$/, '.js')
|
|
217
|
+
};
|
|
218
|
+
}
|
|
207
219
|
},
|
|
208
220
|
build: function(files){
|
|
209
221
|
var _, lngs, ref$, consume, this$ = this;
|
|
@@ -236,7 +248,8 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
236
248
|
ret = pug.compileClient(code, import$({
|
|
237
249
|
filename: src,
|
|
238
250
|
basedir: path.resolve(this$.srcdir),
|
|
239
|
-
doctype: 'html'
|
|
251
|
+
doctype: 'html',
|
|
252
|
+
compileDebug: false
|
|
240
253
|
}, this$.extapi));
|
|
241
254
|
ret = " (function() { " + ret + "; module.exports = template; })() ";
|
|
242
255
|
fs.writeFileSync(desv, ret);
|
|
@@ -249,7 +262,8 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
249
262
|
fs.writeFileSync(desh, pug.render(code, import$({
|
|
250
263
|
filename: src,
|
|
251
264
|
basedir: path.resolve(this$.srcdir),
|
|
252
|
-
doctype: 'html'
|
|
265
|
+
doctype: 'html',
|
|
266
|
+
compileDebug: false
|
|
253
267
|
}, this$.extapi)));
|
|
254
268
|
t2 = Date.now();
|
|
255
269
|
results$.push(this$.log.info(src + " --> " + desh + " ( " + (t2 - t1) + "ms )"));
|
package/dist/pug-cli
CHANGED
|
@@ -32,7 +32,8 @@ extapi = builder.getExtapi();
|
|
|
32
32
|
ret = pug.render(fs.readFileSync(src).toString(), import$({
|
|
33
33
|
filename: src,
|
|
34
34
|
basedir: opt.basedir,
|
|
35
|
-
doctype: 'html'
|
|
35
|
+
doctype: 'html',
|
|
36
|
+
compileDebug: false
|
|
36
37
|
}, extapi));
|
|
37
38
|
if (des) {
|
|
38
39
|
fsExtra.ensureDirSync(path.dirname(des));
|
package/dist/pug-cli.js
CHANGED
|
@@ -31,7 +31,8 @@ extapi = builder.getExtapi();
|
|
|
31
31
|
ret = pug.render(fs.readFileSync(src).toString(), import$({
|
|
32
32
|
filename: src,
|
|
33
33
|
basedir: opt.basedir,
|
|
34
|
-
doctype: 'html'
|
|
34
|
+
doctype: 'html',
|
|
35
|
+
compileDebug: false
|
|
35
36
|
}, extapi));
|
|
36
37
|
if (des) {
|
|
37
38
|
fsExtra.ensureDirSync(path.dirname(des));
|
package/dist/view/pug.js
CHANGED
|
@@ -80,7 +80,7 @@ pugViewEngine = function(options){
|
|
|
80
80
|
if (!(lc.isCached = obj.mtime != null && lc.useCache)) {
|
|
81
81
|
obj.mtime = lc.mtime;
|
|
82
82
|
}
|
|
83
|
-
ret = pug.compileClient(obj.buf, import$((ref$ = import$({}, opt), ref$.filename = src, ref$.basedir = opt.basedir, ref$.doctype = 'html', ref$), extapi));
|
|
83
|
+
ret = pug.compileClient(obj.buf, import$((ref$ = import$({}, opt), ref$.filename = src, ref$.basedir = opt.basedir, ref$.doctype = 'html', ref$.compileDebug = false, ref$), extapi));
|
|
84
84
|
ret = " (function() { " + ret + "; module.exports = template; })() ";
|
|
85
85
|
return fsExtra.ensureDir(path.dirname(desv)).then(function(){
|
|
86
86
|
return fsp.writeFile(desv, ret);
|
package/dist/watch.js
CHANGED
|
@@ -17,9 +17,11 @@ watch = function(opt){
|
|
|
17
17
|
ignored: opt.ignored || ['.git'],
|
|
18
18
|
ignoreInitial: true
|
|
19
19
|
};
|
|
20
|
-
this._root = opt.root
|
|
21
|
-
? opt.root
|
|
22
|
-
|
|
20
|
+
this._root = opt.root
|
|
21
|
+
? Array.isArray(opt.root)
|
|
22
|
+
? opt.root
|
|
23
|
+
: [opt.root]
|
|
24
|
+
: ['.'];
|
|
23
25
|
this.log = opt.logger || aux.logger;
|
|
24
26
|
this.init();
|
|
25
27
|
return this;
|
|
@@ -34,14 +36,14 @@ watch.prototype = import$(Object.create(Object.prototype), {
|
|
|
34
36
|
},
|
|
35
37
|
init: function(){
|
|
36
38
|
var this$ = this;
|
|
37
|
-
this.watcher = chokidar.watch(this._root
|
|
39
|
+
this.watcher = chokidar.watch(this._root, this.chokidarCfg).on('add', function(it){
|
|
38
40
|
return this$.add(path.normalize(it));
|
|
39
41
|
}).on('change', function(it){
|
|
40
42
|
return this$.change(path.normalize(it));
|
|
41
43
|
}).on('unlink', function(it){
|
|
42
44
|
return this$.unlink(path.normalize(it));
|
|
43
45
|
});
|
|
44
|
-
this.log.info("watching
|
|
46
|
+
this.log.info(("watching " + this._root.join(' ') + " for file change").cyan);
|
|
45
47
|
this.changeDebounced = debounce(function(){
|
|
46
48
|
var files;
|
|
47
49
|
files = Array.from(this$.buf.change);
|