@plotdb/srcbuild 0.0.44 → 0.0.47

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 CHANGED
@@ -128,6 +128,22 @@ When using shorthands like `srcbuild.lsp(...)`, you can also specify correspondi
128
128
  common options will be overwritten by scoped options.
129
129
 
130
130
 
131
+ ## Using custom builders
132
+
133
+ Send adapters to watcher from `getAdapter()` of each custom builders:
134
+
135
+ require! <[@plotdb/srcbuild/dist/watch @plotdb/srcbuild/dist/ext/pug]>
136
+ pugbuilder = new pug(...)
137
+ watcher = new watch({adapters: [pugbuilder.getAdapter]})
138
+
139
+ By default, watcher watches the current working directory. Change watcher behavior with following constructor options:
140
+
141
+ - `adapters`: array of adapters to use to handle file change events.
142
+ - `ignored`: array of glob strings to ignore when watching for changes. by default `[".git"]`.
143
+ - `root`: directory, or array of directories to watch. by default `["."]`.
144
+ - `logger`: optional. logger object with logging functions such as `info`, `warn` and `error`.
145
+
146
+
131
147
  ## ODB / On demand build
132
148
 
133
149
  use `watch.demand(target-file)` to force rebuild by request. e.g.,
package/dist/ext/pug.js CHANGED
@@ -152,7 +152,7 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
152
152
  if (!(lng = lng || this$.i18n.language)) {
153
153
  return p;
154
154
  }
155
- return path.join(this$.intlbase, lng, p);
155
+ return path.join('/', this$.intlbase, lng, p);
156
156
  };
157
157
  ret.intlbase = function(p, lng){
158
158
  p == null && (p = "");
@@ -160,7 +160,7 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
160
160
  if (!(lng = lng || this$.i18n.language)) {
161
161
  return p;
162
162
  }
163
- return path.join(this$.intlbase, lng, p);
163
+ return path.join('/', this$.intlbase, lng, p);
164
164
  };
165
165
  (ret.filters || (ret.filters = {})).i18n = function(t, o){
166
166
  return this$.i18n.t((t || '').trim());
@@ -174,7 +174,8 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
174
174
  ret = pug.compileClientWithDependenciesTracked(code, import$({
175
175
  basedir: path.resolve(this.srcdir),
176
176
  filename: file,
177
- doctype: 'html'
177
+ doctype: 'html',
178
+ compileDebug: false
178
179
  }, this.extapi));
179
180
  root = path.resolve('.') + '/';
180
181
  return (ret.dependencies || []).map(function(it){
@@ -236,7 +237,8 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
236
237
  ret = pug.compileClient(code, import$({
237
238
  filename: src,
238
239
  basedir: path.resolve(this$.srcdir),
239
- doctype: 'html'
240
+ doctype: 'html',
241
+ compileDebug: false
240
242
  }, this$.extapi));
241
243
  ret = " (function() { " + ret + "; module.exports = template; })() ";
242
244
  fs.writeFileSync(desv, ret);
@@ -249,7 +251,8 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
249
251
  fs.writeFileSync(desh, pug.render(code, import$({
250
252
  filename: src,
251
253
  basedir: path.resolve(this$.srcdir),
252
- doctype: 'html'
254
+ doctype: 'html',
255
+ compileDebug: false
253
256
  }, this$.extapi)));
254
257
  t2 = Date.now();
255
258
  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,6 +17,11 @@ watch = function(opt){
17
17
  ignored: opt.ignored || ['.git'],
18
18
  ignoreInitial: true
19
19
  };
20
+ this._root = opt.root
21
+ ? Array.isArray(opt.root)
22
+ ? opt.root
23
+ : [opt.root]
24
+ : ['.'];
20
25
  this.log = opt.logger || aux.logger;
21
26
  this.init();
22
27
  return this;
@@ -31,14 +36,14 @@ watch.prototype = import$(Object.create(Object.prototype), {
31
36
  },
32
37
  init: function(){
33
38
  var this$ = this;
34
- this.watcher = chokidar.watch(['.'], this.chokidarCfg).on('add', function(it){
39
+ this.watcher = chokidar.watch(this._root, this.chokidarCfg).on('add', function(it){
35
40
  return this$.add(path.normalize(it));
36
41
  }).on('change', function(it){
37
42
  return this$.change(path.normalize(it));
38
43
  }).on('unlink', function(it){
39
44
  return this$.unlink(path.normalize(it));
40
45
  });
41
- this.log.info("watching src for file change".cyan);
46
+ this.log.info(("watching " + this._root.join(' ') + " for file change").cyan);
42
47
  this.changeDebounced = debounce(function(){
43
48
  var files;
44
49
  files = Array.from(this$.buf.change);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "zbryikt",
3
3
  "name": "@plotdb/srcbuild",
4
- "version": "0.0.44",
4
+ "version": "0.0.47",
5
5
  "description": "",
6
6
  "main": "./dist/main.js",
7
7
  "files": [