webpack 4.19.0 → 4.19.1
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/LICENSE +20 -20
- package/SECURITY.md +9 -9
- package/buildin/amd-define.js +3 -3
- package/buildin/amd-options.js +2 -2
- package/buildin/global.js +20 -20
- package/buildin/module.js +22 -22
- package/buildin/system.js +7 -7
- package/hot/emitter.js +2 -2
- package/lib/BasicEvaluatedExpression.js +211 -211
- package/lib/ExternalModule.js +16 -4
- package/lib/SourceMapDevToolPlugin.js +1 -1
- package/lib/WebpackOptionsDefaulter.js +5 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +16 -1
- package/lib/dependencies/HarmonyExportExpressionDependency.js +7 -2
- package/lib/node/NodeMainTemplatePlugin.js +2 -2
- package/package.json +1 -1
- package/schemas/WebpackOptions.json +3 -0
- package/schemas/ajv.absolutePath.js +55 -55
- package/schemas/plugins/LoaderOptionsPlugin.json +26 -26
- package/schemas/plugins/WatchIgnorePlugin.json +16 -16
- package/schemas/plugins/debug/ProfilingPlugin.json +12 -12
- package/schemas/plugins/optimize/AggressiveSplittingPlugin.json +22 -22
- package/schemas/plugins/optimize/LimitChunkCountPlugin.json +15 -15
package/LICENSE
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright JS Foundation and other contributors
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
'Software'), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright JS Foundation and other contributors
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/SECURITY.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
# Reporting Security Issues
|
2
|
-
|
3
|
-
If you discover a security issue in webpack, please report it by sending an
|
4
|
-
email to [webpack@opencollective.com](mailto:webpack@opencollective.com).
|
5
|
-
|
6
|
-
This will allow us to assess the risk, and make a fix available before we add a
|
7
|
-
bug report to the GitHub repository.
|
8
|
-
|
9
|
-
Thanks for helping make webpack safe for everyone.
|
1
|
+
# Reporting Security Issues
|
2
|
+
|
3
|
+
If you discover a security issue in webpack, please report it by sending an
|
4
|
+
email to [webpack@opencollective.com](mailto:webpack@opencollective.com).
|
5
|
+
|
6
|
+
This will allow us to assess the risk, and make a fix available before we add a
|
7
|
+
bug report to the GitHub repository.
|
8
|
+
|
9
|
+
Thanks for helping make webpack safe for everyone.
|
package/buildin/amd-define.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module.exports = function() {
|
2
|
-
throw new Error("define cannot be used indirect");
|
3
|
-
};
|
1
|
+
module.exports = function() {
|
2
|
+
throw new Error("define cannot be used indirect");
|
3
|
+
};
|
package/buildin/amd-options.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
/* globals __webpack_amd_options__ */
|
2
|
-
module.exports = __webpack_amd_options__;
|
1
|
+
/* globals __webpack_amd_options__ */
|
2
|
+
module.exports = __webpack_amd_options__;
|
package/buildin/global.js
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
var g;
|
2
|
-
|
3
|
-
// This works in non-strict mode
|
4
|
-
g = (function() {
|
5
|
-
return this;
|
6
|
-
})();
|
7
|
-
|
8
|
-
try {
|
9
|
-
// This works if eval is allowed (see CSP)
|
10
|
-
g = g || Function("return this")() || (1, eval)("this");
|
11
|
-
} catch (e) {
|
12
|
-
// This works if the window reference is available
|
13
|
-
if (typeof window === "object") g = window;
|
14
|
-
}
|
15
|
-
|
16
|
-
// g can still be undefined, but nothing to do about it...
|
17
|
-
// We return undefined, instead of nothing here, so it's
|
18
|
-
// easier to handle this case. if(!global) { ...}
|
19
|
-
|
20
|
-
module.exports = g;
|
1
|
+
var g;
|
2
|
+
|
3
|
+
// This works in non-strict mode
|
4
|
+
g = (function() {
|
5
|
+
return this;
|
6
|
+
})();
|
7
|
+
|
8
|
+
try {
|
9
|
+
// This works if eval is allowed (see CSP)
|
10
|
+
g = g || Function("return this")() || (1, eval)("this");
|
11
|
+
} catch (e) {
|
12
|
+
// This works if the window reference is available
|
13
|
+
if (typeof window === "object") g = window;
|
14
|
+
}
|
15
|
+
|
16
|
+
// g can still be undefined, but nothing to do about it...
|
17
|
+
// We return undefined, instead of nothing here, so it's
|
18
|
+
// easier to handle this case. if(!global) { ...}
|
19
|
+
|
20
|
+
module.exports = g;
|
package/buildin/module.js
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
module.exports = function(module) {
|
2
|
-
if (!module.webpackPolyfill) {
|
3
|
-
module.deprecate = function() {};
|
4
|
-
module.paths = [];
|
5
|
-
// module.parent = undefined by default
|
6
|
-
if (!module.children) module.children = [];
|
7
|
-
Object.defineProperty(module, "loaded", {
|
8
|
-
enumerable: true,
|
9
|
-
get: function() {
|
10
|
-
return module.l;
|
11
|
-
}
|
12
|
-
});
|
13
|
-
Object.defineProperty(module, "id", {
|
14
|
-
enumerable: true,
|
15
|
-
get: function() {
|
16
|
-
return module.i;
|
17
|
-
}
|
18
|
-
});
|
19
|
-
module.webpackPolyfill = 1;
|
20
|
-
}
|
21
|
-
return module;
|
22
|
-
};
|
1
|
+
module.exports = function(module) {
|
2
|
+
if (!module.webpackPolyfill) {
|
3
|
+
module.deprecate = function() {};
|
4
|
+
module.paths = [];
|
5
|
+
// module.parent = undefined by default
|
6
|
+
if (!module.children) module.children = [];
|
7
|
+
Object.defineProperty(module, "loaded", {
|
8
|
+
enumerable: true,
|
9
|
+
get: function() {
|
10
|
+
return module.l;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
Object.defineProperty(module, "id", {
|
14
|
+
enumerable: true,
|
15
|
+
get: function() {
|
16
|
+
return module.i;
|
17
|
+
}
|
18
|
+
});
|
19
|
+
module.webpackPolyfill = 1;
|
20
|
+
}
|
21
|
+
return module;
|
22
|
+
};
|
package/buildin/system.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
// Provide a "System" global.
|
2
|
-
module.exports = {
|
3
|
-
// Make sure import is only used as "System.import"
|
4
|
-
import: function() {
|
5
|
-
throw new Error("System.import cannot be used indirectly");
|
6
|
-
}
|
7
|
-
};
|
1
|
+
// Provide a "System" global.
|
2
|
+
module.exports = {
|
3
|
+
// Make sure import is only used as "System.import"
|
4
|
+
import: function() {
|
5
|
+
throw new Error("System.import cannot be used indirectly");
|
6
|
+
}
|
7
|
+
};
|
package/hot/emitter.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
var EventEmitter = require("events");
|
2
|
-
module.exports = new EventEmitter();
|
1
|
+
var EventEmitter = require("events");
|
2
|
+
module.exports = new EventEmitter();
|
@@ -1,211 +1,211 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
|
6
|
-
"use strict";
|
7
|
-
|
8
|
-
const TypeUnknown = 0;
|
9
|
-
const TypeNull = 1;
|
10
|
-
const TypeString = 2;
|
11
|
-
const TypeNumber = 3;
|
12
|
-
const TypeBoolean = 4;
|
13
|
-
const TypeRegExp = 5;
|
14
|
-
const TypeConditional = 6;
|
15
|
-
const TypeArray = 7;
|
16
|
-
const TypeConstArray = 8;
|
17
|
-
const TypeIdentifier = 9;
|
18
|
-
const TypeWrapped = 10;
|
19
|
-
const TypeTemplateString = 11;
|
20
|
-
|
21
|
-
class BasicEvaluatedExpression {
|
22
|
-
constructor() {
|
23
|
-
this.type = TypeUnknown;
|
24
|
-
this.range = null;
|
25
|
-
this.falsy = false;
|
26
|
-
this.truthy = false;
|
27
|
-
this.bool = null;
|
28
|
-
this.number = null;
|
29
|
-
this.regExp = null;
|
30
|
-
this.string = null;
|
31
|
-
this.quasis = null;
|
32
|
-
this.array = null;
|
33
|
-
this.items = null;
|
34
|
-
this.options = null;
|
35
|
-
this.prefix = null;
|
36
|
-
this.postfix = null;
|
37
|
-
}
|
38
|
-
|
39
|
-
isNull() {
|
40
|
-
return this.type === TypeNull;
|
41
|
-
}
|
42
|
-
|
43
|
-
isString() {
|
44
|
-
return this.type === TypeString;
|
45
|
-
}
|
46
|
-
|
47
|
-
isNumber() {
|
48
|
-
return this.type === TypeNumber;
|
49
|
-
}
|
50
|
-
|
51
|
-
isBoolean() {
|
52
|
-
return this.type === TypeBoolean;
|
53
|
-
}
|
54
|
-
|
55
|
-
isRegExp() {
|
56
|
-
return this.type === TypeRegExp;
|
57
|
-
}
|
58
|
-
|
59
|
-
isConditional() {
|
60
|
-
return this.type === TypeConditional;
|
61
|
-
}
|
62
|
-
|
63
|
-
isArray() {
|
64
|
-
return this.type === TypeArray;
|
65
|
-
}
|
66
|
-
|
67
|
-
isConstArray() {
|
68
|
-
return this.type === TypeConstArray;
|
69
|
-
}
|
70
|
-
|
71
|
-
isIdentifier() {
|
72
|
-
return this.type === TypeIdentifier;
|
73
|
-
}
|
74
|
-
|
75
|
-
isWrapped() {
|
76
|
-
return this.type === TypeWrapped;
|
77
|
-
}
|
78
|
-
|
79
|
-
isTemplateString() {
|
80
|
-
return this.type === TypeTemplateString;
|
81
|
-
}
|
82
|
-
|
83
|
-
isTruthy() {
|
84
|
-
return this.truthy;
|
85
|
-
}
|
86
|
-
|
87
|
-
isFalsy() {
|
88
|
-
return this.falsy;
|
89
|
-
}
|
90
|
-
|
91
|
-
asBool() {
|
92
|
-
if (this.truthy) return true;
|
93
|
-
if (this.falsy) return false;
|
94
|
-
if (this.isBoolean()) return this.bool;
|
95
|
-
if (this.isNull()) return false;
|
96
|
-
if (this.isString()) return this.string !== "";
|
97
|
-
if (this.isNumber()) return this.number !== 0;
|
98
|
-
if (this.isRegExp()) return true;
|
99
|
-
if (this.isArray()) return true;
|
100
|
-
if (this.isConstArray()) return true;
|
101
|
-
if (this.isWrapped()) {
|
102
|
-
return (this.prefix && this.prefix.asBool()) ||
|
103
|
-
(this.postfix && this.postfix.asBool())
|
104
|
-
? true
|
105
|
-
: undefined;
|
106
|
-
}
|
107
|
-
if (this.isTemplateString()) {
|
108
|
-
for (const quasi of this.quasis) {
|
109
|
-
if (quasi.asBool()) return true;
|
110
|
-
}
|
111
|
-
// can't tell if string will be empty without executing
|
112
|
-
}
|
113
|
-
return undefined;
|
114
|
-
}
|
115
|
-
|
116
|
-
setString(string) {
|
117
|
-
this.type = TypeString;
|
118
|
-
this.string = string;
|
119
|
-
return this;
|
120
|
-
}
|
121
|
-
|
122
|
-
setNull() {
|
123
|
-
this.type = TypeNull;
|
124
|
-
return this;
|
125
|
-
}
|
126
|
-
|
127
|
-
setNumber(number) {
|
128
|
-
this.type = TypeNumber;
|
129
|
-
this.number = number;
|
130
|
-
return this;
|
131
|
-
}
|
132
|
-
|
133
|
-
setBoolean(bool) {
|
134
|
-
this.type = TypeBoolean;
|
135
|
-
this.bool = bool;
|
136
|
-
return this;
|
137
|
-
}
|
138
|
-
|
139
|
-
setRegExp(regExp) {
|
140
|
-
this.type = TypeRegExp;
|
141
|
-
this.regExp = regExp;
|
142
|
-
return this;
|
143
|
-
}
|
144
|
-
|
145
|
-
setIdentifier(identifier) {
|
146
|
-
this.type = TypeIdentifier;
|
147
|
-
this.identifier = identifier;
|
148
|
-
return this;
|
149
|
-
}
|
150
|
-
|
151
|
-
setWrapped(prefix, postfix) {
|
152
|
-
this.type = TypeWrapped;
|
153
|
-
this.prefix = prefix;
|
154
|
-
this.postfix = postfix;
|
155
|
-
return this;
|
156
|
-
}
|
157
|
-
|
158
|
-
setOptions(options) {
|
159
|
-
this.type = TypeConditional;
|
160
|
-
this.options = options;
|
161
|
-
return this;
|
162
|
-
}
|
163
|
-
|
164
|
-
addOptions(options) {
|
165
|
-
if (!this.options) {
|
166
|
-
this.type = TypeConditional;
|
167
|
-
this.options = [];
|
168
|
-
}
|
169
|
-
for (const item of options) {
|
170
|
-
this.options.push(item);
|
171
|
-
}
|
172
|
-
return this;
|
173
|
-
}
|
174
|
-
|
175
|
-
setItems(items) {
|
176
|
-
this.type = TypeArray;
|
177
|
-
this.items = items;
|
178
|
-
return this;
|
179
|
-
}
|
180
|
-
|
181
|
-
setArray(array) {
|
182
|
-
this.type = TypeConstArray;
|
183
|
-
this.array = array;
|
184
|
-
return this;
|
185
|
-
}
|
186
|
-
|
187
|
-
setTemplateString(quasis) {
|
188
|
-
this.type = TypeTemplateString;
|
189
|
-
this.quasis = quasis;
|
190
|
-
return this;
|
191
|
-
}
|
192
|
-
|
193
|
-
setTruthy() {
|
194
|
-
this.falsy = false;
|
195
|
-
this.truthy = true;
|
196
|
-
return this;
|
197
|
-
}
|
198
|
-
|
199
|
-
setFalsy() {
|
200
|
-
this.falsy = true;
|
201
|
-
this.truthy = false;
|
202
|
-
return this;
|
203
|
-
}
|
204
|
-
|
205
|
-
setRange(range) {
|
206
|
-
this.range = range;
|
207
|
-
return this;
|
208
|
-
}
|
209
|
-
}
|
210
|
-
|
211
|
-
module.exports = BasicEvaluatedExpression;
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
const TypeUnknown = 0;
|
9
|
+
const TypeNull = 1;
|
10
|
+
const TypeString = 2;
|
11
|
+
const TypeNumber = 3;
|
12
|
+
const TypeBoolean = 4;
|
13
|
+
const TypeRegExp = 5;
|
14
|
+
const TypeConditional = 6;
|
15
|
+
const TypeArray = 7;
|
16
|
+
const TypeConstArray = 8;
|
17
|
+
const TypeIdentifier = 9;
|
18
|
+
const TypeWrapped = 10;
|
19
|
+
const TypeTemplateString = 11;
|
20
|
+
|
21
|
+
class BasicEvaluatedExpression {
|
22
|
+
constructor() {
|
23
|
+
this.type = TypeUnknown;
|
24
|
+
this.range = null;
|
25
|
+
this.falsy = false;
|
26
|
+
this.truthy = false;
|
27
|
+
this.bool = null;
|
28
|
+
this.number = null;
|
29
|
+
this.regExp = null;
|
30
|
+
this.string = null;
|
31
|
+
this.quasis = null;
|
32
|
+
this.array = null;
|
33
|
+
this.items = null;
|
34
|
+
this.options = null;
|
35
|
+
this.prefix = null;
|
36
|
+
this.postfix = null;
|
37
|
+
}
|
38
|
+
|
39
|
+
isNull() {
|
40
|
+
return this.type === TypeNull;
|
41
|
+
}
|
42
|
+
|
43
|
+
isString() {
|
44
|
+
return this.type === TypeString;
|
45
|
+
}
|
46
|
+
|
47
|
+
isNumber() {
|
48
|
+
return this.type === TypeNumber;
|
49
|
+
}
|
50
|
+
|
51
|
+
isBoolean() {
|
52
|
+
return this.type === TypeBoolean;
|
53
|
+
}
|
54
|
+
|
55
|
+
isRegExp() {
|
56
|
+
return this.type === TypeRegExp;
|
57
|
+
}
|
58
|
+
|
59
|
+
isConditional() {
|
60
|
+
return this.type === TypeConditional;
|
61
|
+
}
|
62
|
+
|
63
|
+
isArray() {
|
64
|
+
return this.type === TypeArray;
|
65
|
+
}
|
66
|
+
|
67
|
+
isConstArray() {
|
68
|
+
return this.type === TypeConstArray;
|
69
|
+
}
|
70
|
+
|
71
|
+
isIdentifier() {
|
72
|
+
return this.type === TypeIdentifier;
|
73
|
+
}
|
74
|
+
|
75
|
+
isWrapped() {
|
76
|
+
return this.type === TypeWrapped;
|
77
|
+
}
|
78
|
+
|
79
|
+
isTemplateString() {
|
80
|
+
return this.type === TypeTemplateString;
|
81
|
+
}
|
82
|
+
|
83
|
+
isTruthy() {
|
84
|
+
return this.truthy;
|
85
|
+
}
|
86
|
+
|
87
|
+
isFalsy() {
|
88
|
+
return this.falsy;
|
89
|
+
}
|
90
|
+
|
91
|
+
asBool() {
|
92
|
+
if (this.truthy) return true;
|
93
|
+
if (this.falsy) return false;
|
94
|
+
if (this.isBoolean()) return this.bool;
|
95
|
+
if (this.isNull()) return false;
|
96
|
+
if (this.isString()) return this.string !== "";
|
97
|
+
if (this.isNumber()) return this.number !== 0;
|
98
|
+
if (this.isRegExp()) return true;
|
99
|
+
if (this.isArray()) return true;
|
100
|
+
if (this.isConstArray()) return true;
|
101
|
+
if (this.isWrapped()) {
|
102
|
+
return (this.prefix && this.prefix.asBool()) ||
|
103
|
+
(this.postfix && this.postfix.asBool())
|
104
|
+
? true
|
105
|
+
: undefined;
|
106
|
+
}
|
107
|
+
if (this.isTemplateString()) {
|
108
|
+
for (const quasi of this.quasis) {
|
109
|
+
if (quasi.asBool()) return true;
|
110
|
+
}
|
111
|
+
// can't tell if string will be empty without executing
|
112
|
+
}
|
113
|
+
return undefined;
|
114
|
+
}
|
115
|
+
|
116
|
+
setString(string) {
|
117
|
+
this.type = TypeString;
|
118
|
+
this.string = string;
|
119
|
+
return this;
|
120
|
+
}
|
121
|
+
|
122
|
+
setNull() {
|
123
|
+
this.type = TypeNull;
|
124
|
+
return this;
|
125
|
+
}
|
126
|
+
|
127
|
+
setNumber(number) {
|
128
|
+
this.type = TypeNumber;
|
129
|
+
this.number = number;
|
130
|
+
return this;
|
131
|
+
}
|
132
|
+
|
133
|
+
setBoolean(bool) {
|
134
|
+
this.type = TypeBoolean;
|
135
|
+
this.bool = bool;
|
136
|
+
return this;
|
137
|
+
}
|
138
|
+
|
139
|
+
setRegExp(regExp) {
|
140
|
+
this.type = TypeRegExp;
|
141
|
+
this.regExp = regExp;
|
142
|
+
return this;
|
143
|
+
}
|
144
|
+
|
145
|
+
setIdentifier(identifier) {
|
146
|
+
this.type = TypeIdentifier;
|
147
|
+
this.identifier = identifier;
|
148
|
+
return this;
|
149
|
+
}
|
150
|
+
|
151
|
+
setWrapped(prefix, postfix) {
|
152
|
+
this.type = TypeWrapped;
|
153
|
+
this.prefix = prefix;
|
154
|
+
this.postfix = postfix;
|
155
|
+
return this;
|
156
|
+
}
|
157
|
+
|
158
|
+
setOptions(options) {
|
159
|
+
this.type = TypeConditional;
|
160
|
+
this.options = options;
|
161
|
+
return this;
|
162
|
+
}
|
163
|
+
|
164
|
+
addOptions(options) {
|
165
|
+
if (!this.options) {
|
166
|
+
this.type = TypeConditional;
|
167
|
+
this.options = [];
|
168
|
+
}
|
169
|
+
for (const item of options) {
|
170
|
+
this.options.push(item);
|
171
|
+
}
|
172
|
+
return this;
|
173
|
+
}
|
174
|
+
|
175
|
+
setItems(items) {
|
176
|
+
this.type = TypeArray;
|
177
|
+
this.items = items;
|
178
|
+
return this;
|
179
|
+
}
|
180
|
+
|
181
|
+
setArray(array) {
|
182
|
+
this.type = TypeConstArray;
|
183
|
+
this.array = array;
|
184
|
+
return this;
|
185
|
+
}
|
186
|
+
|
187
|
+
setTemplateString(quasis) {
|
188
|
+
this.type = TypeTemplateString;
|
189
|
+
this.quasis = quasis;
|
190
|
+
return this;
|
191
|
+
}
|
192
|
+
|
193
|
+
setTruthy() {
|
194
|
+
this.falsy = false;
|
195
|
+
this.truthy = true;
|
196
|
+
return this;
|
197
|
+
}
|
198
|
+
|
199
|
+
setFalsy() {
|
200
|
+
this.falsy = true;
|
201
|
+
this.truthy = false;
|
202
|
+
return this;
|
203
|
+
}
|
204
|
+
|
205
|
+
setRange(range) {
|
206
|
+
this.range = range;
|
207
|
+
return this;
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
module.exports = BasicEvaluatedExpression;
|
package/lib/ExternalModule.js
CHANGED
@@ -74,7 +74,9 @@ class ExternalModule extends Module {
|
|
74
74
|
.slice(1)
|
75
75
|
.map(r => `[${JSON.stringify(r)}]`)
|
76
76
|
.join("");
|
77
|
-
return `module.exports = require(${
|
77
|
+
return `module.exports = require(${JSON.stringify(
|
78
|
+
moduleName
|
79
|
+
)})${objectLookup};`;
|
78
80
|
}
|
79
81
|
|
80
82
|
checkExternalVariable(variableToCheck, request) {
|
@@ -94,15 +96,25 @@ class ExternalModule extends Module {
|
|
94
96
|
}
|
95
97
|
|
96
98
|
getSourceForDefaultCase(optional, request) {
|
99
|
+
if (!Array.isArray(request)) {
|
100
|
+
// make it an array as the look up works the same basically
|
101
|
+
request = [request];
|
102
|
+
}
|
103
|
+
|
104
|
+
const variableName = request[0];
|
97
105
|
const missingModuleError = optional
|
98
|
-
? this.checkExternalVariable(
|
106
|
+
? this.checkExternalVariable(variableName, request.join("."))
|
99
107
|
: "";
|
100
|
-
|
108
|
+
const objectLookup = request
|
109
|
+
.slice(1)
|
110
|
+
.map(r => `[${JSON.stringify(r)}]`)
|
111
|
+
.join("");
|
112
|
+
return `${missingModuleError}module.exports = ${variableName}${objectLookup};`;
|
101
113
|
}
|
102
114
|
|
103
115
|
getSourceString(runtime) {
|
104
116
|
const request =
|
105
|
-
typeof this.request === "object"
|
117
|
+
typeof this.request === "object" && !Array.isArray(this.request)
|
106
118
|
? this.request[this.externalType]
|
107
119
|
: this.request;
|
108
120
|
switch (this.externalType) {
|
@@ -84,7 +84,7 @@ class SourceMapDevToolPlugin {
|
|
84
84
|
const fallbackModuleFilenameTemplate = this.fallbackModuleFilenameTemplate;
|
85
85
|
const requestShortener = compiler.requestShortener;
|
86
86
|
const options = this.options;
|
87
|
-
options.test = options.test || /\.(js|css)($|\?)/i;
|
87
|
+
options.test = options.test || /\.(m?js|css)($|\?)/i;
|
88
88
|
|
89
89
|
const matchObject = ModuleFilenameHelpers.matchObject.bind(
|
90
90
|
undefined,
|
@@ -327,7 +327,11 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
|
|
327
327
|
this.set("resolve.extensions", [".wasm", ".mjs", ".js", ".json"]);
|
328
328
|
this.set("resolve.mainFiles", ["index"]);
|
329
329
|
this.set("resolve.aliasFields", "make", options => {
|
330
|
-
if (
|
330
|
+
if (
|
331
|
+
options.target === "web" ||
|
332
|
+
options.target === "webworker" ||
|
333
|
+
options.target === "electron-renderer"
|
334
|
+
) {
|
331
335
|
return ["browser"];
|
332
336
|
} else {
|
333
337
|
return [];
|
@@ -54,10 +54,25 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|
54
54
|
parser.hooks.exportExpression.tap(
|
55
55
|
"HarmonyExportDependencyParserPlugin",
|
56
56
|
(statement, expr) => {
|
57
|
+
const comments = parser.getComments([
|
58
|
+
statement.range[0],
|
59
|
+
expr.range[0]
|
60
|
+
]);
|
57
61
|
const dep = new HarmonyExportExpressionDependency(
|
58
62
|
parser.state.module,
|
59
63
|
expr.range,
|
60
|
-
statement.range
|
64
|
+
statement.range,
|
65
|
+
comments
|
66
|
+
.map(c => {
|
67
|
+
switch (c.type) {
|
68
|
+
case "Block":
|
69
|
+
return `/*${c.value}*/`;
|
70
|
+
case "Line":
|
71
|
+
return `//${c.value}\n`;
|
72
|
+
}
|
73
|
+
return "";
|
74
|
+
})
|
75
|
+
.join("")
|
61
76
|
);
|
62
77
|
dep.loc = Object.create(statement.loc);
|
63
78
|
dep.loc.index = -1;
|
@@ -6,11 +6,12 @@
|
|
6
6
|
const NullDependency = require("./NullDependency");
|
7
7
|
|
8
8
|
class HarmonyExportExpressionDependency extends NullDependency {
|
9
|
-
constructor(originModule, range, rangeStatement) {
|
9
|
+
constructor(originModule, range, rangeStatement, prefix) {
|
10
10
|
super();
|
11
11
|
this.originModule = originModule;
|
12
12
|
this.range = range;
|
13
13
|
this.rangeStatement = rangeStatement;
|
14
|
+
this.prefix = prefix;
|
14
15
|
}
|
15
16
|
|
16
17
|
get type() {
|
@@ -31,7 +32,11 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
|
|
31
32
|
const content = this.getContent(dep.originModule, used);
|
32
33
|
|
33
34
|
if (dep.range) {
|
34
|
-
source.replace(
|
35
|
+
source.replace(
|
36
|
+
dep.rangeStatement[0],
|
37
|
+
dep.range[0] - 1,
|
38
|
+
content + "(" + dep.prefix
|
39
|
+
);
|
35
40
|
source.replace(dep.range[1], dep.rangeStatement[1] - 1, ");");
|
36
41
|
return;
|
37
42
|
}
|
@@ -96,7 +96,7 @@ module.exports = class NodeMainTemplatePlugin {
|
|
96
96
|
"var promise = new Promise(function(resolve, reject) {",
|
97
97
|
Template.indent([
|
98
98
|
"installedChunkData = installedChunks[chunkId] = [resolve, reject];",
|
99
|
-
"var filename = __dirname
|
99
|
+
"var filename = require('path').join(__dirname, " +
|
100
100
|
mainTemplate.getAssetPath(
|
101
101
|
JSON.stringify(`/${chunkFilename}`),
|
102
102
|
{
|
@@ -155,7 +155,7 @@ module.exports = class NodeMainTemplatePlugin {
|
|
155
155
|
contentHashType: "javascript"
|
156
156
|
}
|
157
157
|
) +
|
158
|
-
";",
|
158
|
+
");",
|
159
159
|
"require('fs').readFile(filename, 'utf-8', function(err, content) {",
|
160
160
|
Template.indent(
|
161
161
|
[
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "4.19.
|
3
|
+
"version": "4.19.1",
|
4
4
|
"author": "Tobias Koppers @sokra",
|
5
5
|
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
|
6
6
|
"license": "MIT",
|
@@ -1,55 +1,55 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const errorMessage = (schema, data, message) => ({
|
4
|
-
keyword: "absolutePath",
|
5
|
-
params: { absolutePath: data },
|
6
|
-
message: message,
|
7
|
-
parentSchema: schema
|
8
|
-
});
|
9
|
-
|
10
|
-
const getErrorFor = (shouldBeAbsolute, data, schema) => {
|
11
|
-
const message = shouldBeAbsolute
|
12
|
-
? `The provided value ${JSON.stringify(data)} is not an absolute path!`
|
13
|
-
: `A relative path is expected. However, the provided value ${JSON.stringify(
|
14
|
-
data
|
15
|
-
)} is an absolute path!`;
|
16
|
-
|
17
|
-
return errorMessage(schema, data, message);
|
18
|
-
};
|
19
|
-
|
20
|
-
module.exports = ajv =>
|
21
|
-
ajv.addKeyword("absolutePath", {
|
22
|
-
errors: true,
|
23
|
-
type: "string",
|
24
|
-
compile(expected, schema) {
|
25
|
-
function callback(data) {
|
26
|
-
let passes = true;
|
27
|
-
const isExclamationMarkPresent = data.includes("!");
|
28
|
-
const isCorrectAbsoluteOrRelativePath =
|
29
|
-
expected === /^(?:[A-Za-z]:\\|\/)/.test(data);
|
30
|
-
|
31
|
-
if (isExclamationMarkPresent) {
|
32
|
-
callback.errors = [
|
33
|
-
errorMessage(
|
34
|
-
schema,
|
35
|
-
data,
|
36
|
-
`The provided value ${JSON.stringify(
|
37
|
-
data
|
38
|
-
)} contans exclamation mark (!) which is not allowed because it's reserved for loader syntax.`
|
39
|
-
)
|
40
|
-
];
|
41
|
-
passes = false;
|
42
|
-
}
|
43
|
-
|
44
|
-
if (!isCorrectAbsoluteOrRelativePath) {
|
45
|
-
callback.errors = [getErrorFor(expected, data, schema)];
|
46
|
-
passes = false;
|
47
|
-
}
|
48
|
-
|
49
|
-
return passes;
|
50
|
-
}
|
51
|
-
callback.errors = [];
|
52
|
-
|
53
|
-
return callback;
|
54
|
-
}
|
55
|
-
});
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const errorMessage = (schema, data, message) => ({
|
4
|
+
keyword: "absolutePath",
|
5
|
+
params: { absolutePath: data },
|
6
|
+
message: message,
|
7
|
+
parentSchema: schema
|
8
|
+
});
|
9
|
+
|
10
|
+
const getErrorFor = (shouldBeAbsolute, data, schema) => {
|
11
|
+
const message = shouldBeAbsolute
|
12
|
+
? `The provided value ${JSON.stringify(data)} is not an absolute path!`
|
13
|
+
: `A relative path is expected. However, the provided value ${JSON.stringify(
|
14
|
+
data
|
15
|
+
)} is an absolute path!`;
|
16
|
+
|
17
|
+
return errorMessage(schema, data, message);
|
18
|
+
};
|
19
|
+
|
20
|
+
module.exports = ajv =>
|
21
|
+
ajv.addKeyword("absolutePath", {
|
22
|
+
errors: true,
|
23
|
+
type: "string",
|
24
|
+
compile(expected, schema) {
|
25
|
+
function callback(data) {
|
26
|
+
let passes = true;
|
27
|
+
const isExclamationMarkPresent = data.includes("!");
|
28
|
+
const isCorrectAbsoluteOrRelativePath =
|
29
|
+
expected === /^(?:[A-Za-z]:\\|\/)/.test(data);
|
30
|
+
|
31
|
+
if (isExclamationMarkPresent) {
|
32
|
+
callback.errors = [
|
33
|
+
errorMessage(
|
34
|
+
schema,
|
35
|
+
data,
|
36
|
+
`The provided value ${JSON.stringify(
|
37
|
+
data
|
38
|
+
)} contans exclamation mark (!) which is not allowed because it's reserved for loader syntax.`
|
39
|
+
)
|
40
|
+
];
|
41
|
+
passes = false;
|
42
|
+
}
|
43
|
+
|
44
|
+
if (!isCorrectAbsoluteOrRelativePath) {
|
45
|
+
callback.errors = [getErrorFor(expected, data, schema)];
|
46
|
+
passes = false;
|
47
|
+
}
|
48
|
+
|
49
|
+
return passes;
|
50
|
+
}
|
51
|
+
callback.errors = [];
|
52
|
+
|
53
|
+
return callback;
|
54
|
+
}
|
55
|
+
});
|
@@ -1,26 +1,26 @@
|
|
1
|
-
{
|
2
|
-
"type": "object",
|
3
|
-
"additionalProperties": true,
|
4
|
-
"properties": {
|
5
|
-
"debug": {
|
6
|
-
"description": "Whether loaders should be in debug mode or not. debug will be removed as of webpack 3",
|
7
|
-
"type": "boolean"
|
8
|
-
},
|
9
|
-
"minimize": {
|
10
|
-
"description": "Where loaders can be switched to minimize mode",
|
11
|
-
"type": "boolean"
|
12
|
-
},
|
13
|
-
"options": {
|
14
|
-
"description": "A configuration object that can be used to configure older loaders",
|
15
|
-
"type": "object",
|
16
|
-
"additionalProperties": true,
|
17
|
-
"properties": {
|
18
|
-
"context": {
|
19
|
-
"description": "The context that can be used to configure older loaders",
|
20
|
-
"type": "string",
|
21
|
-
"absolutePath": true
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"additionalProperties": true,
|
4
|
+
"properties": {
|
5
|
+
"debug": {
|
6
|
+
"description": "Whether loaders should be in debug mode or not. debug will be removed as of webpack 3",
|
7
|
+
"type": "boolean"
|
8
|
+
},
|
9
|
+
"minimize": {
|
10
|
+
"description": "Where loaders can be switched to minimize mode",
|
11
|
+
"type": "boolean"
|
12
|
+
},
|
13
|
+
"options": {
|
14
|
+
"description": "A configuration object that can be used to configure older loaders",
|
15
|
+
"type": "object",
|
16
|
+
"additionalProperties": true,
|
17
|
+
"properties": {
|
18
|
+
"context": {
|
19
|
+
"description": "The context that can be used to configure older loaders",
|
20
|
+
"type": "string",
|
21
|
+
"absolutePath": true
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
@@ -1,16 +1,16 @@
|
|
1
|
-
{
|
2
|
-
"description": "A list of RegExps or absolute paths to directories or files that should be ignored",
|
3
|
-
"type": "array",
|
4
|
-
"items": {
|
5
|
-
"description": "RegExp or absolute path to directories or files that should be ignored",
|
6
|
-
"oneOf": [
|
7
|
-
{
|
8
|
-
"type": "string"
|
9
|
-
},
|
10
|
-
{
|
11
|
-
"instanceof": "RegExp"
|
12
|
-
}
|
13
|
-
]
|
14
|
-
},
|
15
|
-
"minItems": 1
|
16
|
-
}
|
1
|
+
{
|
2
|
+
"description": "A list of RegExps or absolute paths to directories or files that should be ignored",
|
3
|
+
"type": "array",
|
4
|
+
"items": {
|
5
|
+
"description": "RegExp or absolute path to directories or files that should be ignored",
|
6
|
+
"oneOf": [
|
7
|
+
{
|
8
|
+
"type": "string"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"instanceof": "RegExp"
|
12
|
+
}
|
13
|
+
]
|
14
|
+
},
|
15
|
+
"minItems": 1
|
16
|
+
}
|
@@ -1,12 +1,12 @@
|
|
1
|
-
{
|
2
|
-
"type": "object",
|
3
|
-
"additionalProperties": false,
|
4
|
-
"properties": {
|
5
|
-
"outputPath": {
|
6
|
-
"description": "Path to the output file e.g. `profiling/events.json`. Defaults to `events.json`.",
|
7
|
-
"type": "string",
|
8
|
-
"absolutePath": false,
|
9
|
-
"minLength": 4
|
10
|
-
}
|
11
|
-
}
|
12
|
-
}
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"additionalProperties": false,
|
4
|
+
"properties": {
|
5
|
+
"outputPath": {
|
6
|
+
"description": "Path to the output file e.g. `profiling/events.json`. Defaults to `events.json`.",
|
7
|
+
"type": "string",
|
8
|
+
"absolutePath": false,
|
9
|
+
"minLength": 4
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
@@ -1,22 +1,22 @@
|
|
1
|
-
{
|
2
|
-
"type": "object",
|
3
|
-
"additionalProperties": false,
|
4
|
-
"properties": {
|
5
|
-
"minSize": {
|
6
|
-
"description": "Byte, split point. Default: 30720",
|
7
|
-
"type": "number"
|
8
|
-
},
|
9
|
-
"maxSize": {
|
10
|
-
"description": "Byte, maxsize of per file. Default: 51200",
|
11
|
-
"type": "number"
|
12
|
-
},
|
13
|
-
"chunkOverhead": {
|
14
|
-
"description": "Default: 0",
|
15
|
-
"type": "number"
|
16
|
-
},
|
17
|
-
"entryChunkMultiplicator": {
|
18
|
-
"description": "Default: 1",
|
19
|
-
"type": "number"
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"additionalProperties": false,
|
4
|
+
"properties": {
|
5
|
+
"minSize": {
|
6
|
+
"description": "Byte, split point. Default: 30720",
|
7
|
+
"type": "number"
|
8
|
+
},
|
9
|
+
"maxSize": {
|
10
|
+
"description": "Byte, maxsize of per file. Default: 51200",
|
11
|
+
"type": "number"
|
12
|
+
},
|
13
|
+
"chunkOverhead": {
|
14
|
+
"description": "Default: 0",
|
15
|
+
"type": "number"
|
16
|
+
},
|
17
|
+
"entryChunkMultiplicator": {
|
18
|
+
"description": "Default: 1",
|
19
|
+
"type": "number"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
{
|
2
|
-
"type": "object",
|
3
|
-
"additionalProperties": false,
|
4
|
-
"properties": {
|
5
|
-
"maxChunks": {
|
6
|
-
"description": "Limit the maximum number of chunks using a value greater greater than or equal to 1",
|
7
|
-
"type": "number",
|
8
|
-
"minimum": 1
|
9
|
-
},
|
10
|
-
"minChunkSize": {
|
11
|
-
"description": "Set a minimum chunk size",
|
12
|
-
"type": "number"
|
13
|
-
}
|
14
|
-
}
|
15
|
-
}
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"additionalProperties": false,
|
4
|
+
"properties": {
|
5
|
+
"maxChunks": {
|
6
|
+
"description": "Limit the maximum number of chunks using a value greater greater than or equal to 1",
|
7
|
+
"type": "number",
|
8
|
+
"minimum": 1
|
9
|
+
},
|
10
|
+
"minChunkSize": {
|
11
|
+
"description": "Set a minimum chunk size",
|
12
|
+
"type": "number"
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|