|
1 | 1 | /* |
2 | 2 | MIT License http://www.opensource.org/licenses/mit-license.php |
3 | 3 | Author Tobias Koppers @sokra |
4 | | -*/ |
5 | | -var Module = require("./Module"); |
6 | | -var RawSource = require("webpack-sources").RawSource; |
7 | | - |
8 | | -function DllModule(context, dependencies, name, type) { |
9 | | - Module.call(this); |
10 | | - this.context = context; |
11 | | - this.dependencies = dependencies; |
12 | | - this.name = name; |
13 | | - this.built = false; |
14 | | - this.cacheable = true; |
15 | | - this.type = type; |
| 4 | + */ |
| 5 | +"use strict"; |
| 6 | + |
| 7 | +const Module = require("./Module"); |
| 8 | +const RawSource = require("webpack-sources").RawSource; |
| 9 | + |
| 10 | +class DllModule extends Module { |
| 11 | + constructor(context, dependencies, name, type) { |
| 12 | + super(); |
| 13 | + this.context = context; |
| 14 | + this.dependencies = dependencies; |
| 15 | + this.name = name; |
| 16 | + this.built = false; |
| 17 | + this.cacheable = true; |
| 18 | + this.type = type; |
| 19 | + } |
| 20 | + |
| 21 | + identifier() { |
| 22 | + return `dll ${this.name}`; |
| 23 | + } |
| 24 | + |
| 25 | + readableIdentifier() { |
| 26 | + return `dll ${this.name}`; |
| 27 | + } |
| 28 | + |
| 29 | + disconnect() { |
| 30 | + this.built = false; |
| 31 | + super.disconnect(); |
| 32 | + } |
| 33 | + |
| 34 | + build(options, compilation, resolver, fs, callback) { |
| 35 | + this.built = true; |
| 36 | + return callback(); |
| 37 | + } |
| 38 | + |
| 39 | + source() { |
| 40 | + return new RawSource("module.exports = __webpack_require__;"); |
| 41 | + } |
| 42 | + |
| 43 | + needRebuild() { |
| 44 | + return false; |
| 45 | + } |
| 46 | + |
| 47 | + size() { |
| 48 | + return 12; |
| 49 | + } |
| 50 | + |
| 51 | + updateHash(hash) { |
| 52 | + hash.update("dll module"); |
| 53 | + hash.update(this.name || ""); |
| 54 | + super.updateHash(hash); |
| 55 | + } |
16 | 56 | } |
17 | | -module.exports = DllModule; |
18 | | - |
19 | | -DllModule.prototype = Object.create(Module.prototype); |
20 | | -DllModule.prototype.constructor = DllModule; |
21 | | - |
22 | | -DllModule.prototype.identifier = function() { |
23 | | - return "dll " + this.name; |
24 | | -}; |
25 | | - |
26 | | -DllModule.prototype.readableIdentifier = function() { |
27 | | - return "dll " + this.name; |
28 | | -}; |
29 | | - |
30 | | -DllModule.prototype.disconnect = function disconnect() { |
31 | | - this.built = false; |
32 | | - Module.prototype.disconnect.call(this); |
33 | | -}; |
34 | 57 |
|
35 | | -DllModule.prototype.build = function build(options, compilation, resolver, fs, callback) { |
36 | | - this.built = true; |
37 | | - return callback(); |
38 | | -}; |
39 | | - |
40 | | -DllModule.prototype.source = function() { |
41 | | - return new RawSource("module.exports = __webpack_require__;"); |
42 | | -}; |
43 | | - |
44 | | -DllModule.prototype.needRebuild = function needRebuild() { |
45 | | - return false; |
46 | | -}; |
47 | | - |
48 | | -DllModule.prototype.size = function() { |
49 | | - return 12; |
50 | | -}; |
51 | | - |
52 | | -DllModule.prototype.updateHash = function(hash) { |
53 | | - hash.update("dll module"); |
54 | | - hash.update(this.name || ""); |
55 | | - Module.prototype.updateHash.call(this, hash); |
56 | | -}; |
| 58 | +module.exports = DllModule; |
0 commit comments