Skip to content

Commit ff30099

Browse files
timseTheLarkInn
authored andcommitted
refactor of ImportContextDependency to es6 (webpack#3814)
1 parent 5d398ca commit ff30099

1 file changed

Lines changed: 23 additions & 16 deletions

File tree

lib/dependencies/ImportContextDependency.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,34 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
var ContextDependency = require("./ContextDependency");
6-
var CriticalDependencyWarning = require("./CriticalDependencyWarning");
5+
"use strict";
6+
const ContextDependency = require("./ContextDependency");
7+
const CriticalDependencyWarning = require("./CriticalDependencyWarning");
8+
const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
79

8-
function ImportContextDependency(request, recursive, regExp, range, valueRange) {
9-
ContextDependency.call(this, request, recursive, regExp);
10-
this.range = range;
11-
this.valueRange = valueRange;
12-
this.async = true;
13-
}
14-
module.exports = ImportContextDependency;
10+
class ImportContextDependency extends ContextDependency {
11+
constructor(request, recursive, regExp, range, valueRange) {
12+
super(request, recursive, regExp);
13+
this.range = range;
14+
this.valueRange = valueRange;
15+
this.async = true;
16+
}
17+
18+
get type() {
19+
return "System.import context";
20+
}
1521

16-
ImportContextDependency.prototype = Object.create(ContextDependency.prototype);
17-
ImportContextDependency.prototype.constructor = ImportContextDependency;
18-
ImportContextDependency.prototype.type = "System.import context";
22+
getWarnings() {
23+
if(!this.critical) {
24+
return;
25+
}
1926

20-
ImportContextDependency.prototype.getWarnings = function() {
21-
if(this.critical) {
2227
return [
2328
new CriticalDependencyWarning(this.critical)
2429
];
2530
}
26-
};
31+
}
2732

28-
ImportContextDependency.Template = require("./ContextDependencyTemplateAsRequireCall");
33+
ImportContextDependency.Template = ContextDependencyTemplateAsRequireCall;
34+
35+
module.exports = ImportContextDependency;

0 commit comments

Comments
 (0)