Skip to content

Commit a27f151

Browse files
moonglumFND
authored andcommitted
recombined Bundle implementations, avoiding inheritance hierarchy
no longer necessary without virtual bundles (cf. previous commit; separation was originally introduced in d6c7653) this also removes duplicated defaults
1 parent cfa3349 commit a27f151

File tree

2 files changed

+15
-33
lines changed

2 files changed

+15
-33
lines changed

lib/bundle/basic.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

lib/bundle/index.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
"use strict";
22

3-
let BasicBundle = require("./basic");
3+
let generateBundle = require("./bundler");
4+
let generateConfig = require("./config");
5+
let { generateError } = require("../util");
46

5-
module.exports = class Bundle extends BasicBundle {
7+
module.exports = class Bundle {
68
constructor(entryPoint, target, config, { browsers }) {
79
// extract bundle-specific fingerprinting, if any
810
config = Object.assign({}, config);
911
if(config.fingerprint !== undefined) {
1012
var fingerprint = config.fingerprint; // eslint-disable-line no-var
1113
delete config.fingerprint;
1214
}
13-
super(config, { browsers });
15+
this._config = generateConfig(config, { browsers });
1416

1517
this.entryPoint = entryPoint;
1618
this.target = target;
@@ -31,6 +33,15 @@ module.exports = class Bundle extends BasicBundle {
3133
return false;
3234
}
3335

34-
return super.compile(this.entryPoint);
36+
return generateBundle(this.entryPoint, this._config, this._cache).
37+
then(({ code, modules, cache }) => {
38+
this._modules = modules;
39+
this._cache = cache;
40+
return { code };
41+
}, err => ({
42+
// also report error from within bundle, to avoid it being overlooked
43+
code: generateError(err),
44+
error: err
45+
}));
3546
}
3647
};

0 commit comments

Comments
 (0)