-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
43 lines (36 loc) · 1.26 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Bundl
*/
var bundlClassMethods = require('./lib/bundl_class.js');
var bundlInstanceMethods = require('./lib/bundl_instance.js');
var discoverRelativePath = require('discover-source-path');
var each = require('seebigs-each');
var path = require('path');
class Bundl {
constructor(targets, options) {
var _this = this;
var relativeTo = discoverRelativePath(3); // careful when moving!
var opts = Object.assign({}, options);
opts.srcDir = opts.srcDir ? path.resolve(relativeTo, opts.srcDir) : relativeTo;
opts.outputDir = opts.outputDir ? path.resolve(relativeTo, opts.outputDir) : relativeTo + '/bundled';
opts.watch = opts.watch ? path.resolve(relativeTo, opts.watch) : void 0;
_this.options = opts;
_this.isBundl = true;
_this._ = {
CHAIN_STAGE: 'stringy',
CHAIN_SRC: [],
CHANGEMAP: {},
RESOURCES: {},
ACTIVE_BUNDLE_COUNT: 0,
LINES: 2, // allow for "preface"
};
each(bundlInstanceMethods, function (method, name) {
_this[name] = method;
});
_this.add.call(_this, targets);
}
}
each(bundlClassMethods, function (method, name) {
Bundl[name] = method;
});
module.exports = Bundl;