webpack 4.16.4 → 4.16.5
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/hot/log-apply-result.js +44 -44
- package/lib/BasicEvaluatedExpression.js +211 -211
- package/lib/Compilation.js +12 -2
- package/lib/dependencies/ContextDependencyHelpers.js +78 -43
- package/lib/dependencies/ContextDependencyTemplateAsId.js +1 -0
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +1 -0
- package/package.json +1 -1
- package/schemas/ajv.absolutePath.js +55 -55
- package/schemas/plugins/BannerPlugin.json +96 -96
- package/schemas/plugins/DllPlugin.json +32 -32
- package/schemas/plugins/DllReferencePlugin.json +99 -99
- package/schemas/plugins/HashedModuleIdsPlugin.json +24 -24
- package/schemas/plugins/LoaderOptionsPlugin.json +26 -26
- package/schemas/plugins/SourceMapDevToolPlugin.json +187 -187
- 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/schemas/plugins/optimize/MinChunkSizePlugin.json +13 -13
@@ -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/Compilation.js
CHANGED
@@ -1025,6 +1025,7 @@ class Compilation extends Tapable {
|
|
1025
1025
|
addEntry(context, entry, name, callback) {
|
1026
1026
|
const slot = {
|
1027
1027
|
name: name,
|
1028
|
+
// TODO webpack 5 remove `request`
|
1028
1029
|
request: null,
|
1029
1030
|
module: null
|
1030
1031
|
};
|
@@ -1033,7 +1034,14 @@ class Compilation extends Tapable {
|
|
1033
1034
|
slot.request = entry.request;
|
1034
1035
|
}
|
1035
1036
|
|
1036
|
-
|
1037
|
+
// TODO webpack 5: merge modules instead when multiple entry modules are supported
|
1038
|
+
const idx = this._preparedEntrypoints.findIndex(slot => slot.name === name);
|
1039
|
+
if (idx >= 0) {
|
1040
|
+
// Overwrite existing entrypoint
|
1041
|
+
this._preparedEntrypoints[idx] = slot;
|
1042
|
+
} else {
|
1043
|
+
this._preparedEntrypoints.push(slot);
|
1044
|
+
}
|
1037
1045
|
this._addModuleChain(
|
1038
1046
|
context,
|
1039
1047
|
entry,
|
@@ -1049,7 +1057,9 @@ class Compilation extends Tapable {
|
|
1049
1057
|
slot.module = module;
|
1050
1058
|
} else {
|
1051
1059
|
const idx = this._preparedEntrypoints.indexOf(slot);
|
1052
|
-
|
1060
|
+
if (idx >= 0) {
|
1061
|
+
this._preparedEntrypoints.splice(idx, 1);
|
1062
|
+
}
|
1053
1063
|
}
|
1054
1064
|
return callback(null, module);
|
1055
1065
|
}
|
@@ -15,6 +15,32 @@ const quotemeta = str => {
|
|
15
15
|
return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
|
16
16
|
};
|
17
17
|
|
18
|
+
const splitContextFromPrefix = prefix => {
|
19
|
+
const idx = prefix.lastIndexOf("/");
|
20
|
+
let context = ".";
|
21
|
+
if (idx >= 0) {
|
22
|
+
context = prefix.substr(0, idx);
|
23
|
+
prefix = `.${prefix.substr(idx)}`;
|
24
|
+
}
|
25
|
+
return {
|
26
|
+
context,
|
27
|
+
prefix
|
28
|
+
};
|
29
|
+
};
|
30
|
+
|
31
|
+
const splitQueryFromPostfix = postfix => {
|
32
|
+
const idx = postfix.indexOf("?");
|
33
|
+
let query = "";
|
34
|
+
if (idx >= 0) {
|
35
|
+
query = postfix.substr(idx);
|
36
|
+
postfix = postfix.substr(0, idx);
|
37
|
+
}
|
38
|
+
return {
|
39
|
+
postfix,
|
40
|
+
query
|
41
|
+
};
|
42
|
+
};
|
43
|
+
|
18
44
|
ContextDependencyHelpers.create = (
|
19
45
|
Dep,
|
20
46
|
range,
|
@@ -23,38 +49,30 @@ ContextDependencyHelpers.create = (
|
|
23
49
|
options,
|
24
50
|
contextOptions
|
25
51
|
) => {
|
26
|
-
let dep;
|
27
|
-
let prefix;
|
28
|
-
let postfix;
|
29
|
-
let prefixRange;
|
30
|
-
let valueRange;
|
31
|
-
let idx;
|
32
|
-
let context;
|
33
|
-
let regExp;
|
34
52
|
if (param.isTemplateString()) {
|
35
|
-
|
36
|
-
|
53
|
+
let prefixRaw = param.quasis[0].string;
|
54
|
+
let postfixRaw =
|
37
55
|
param.quasis.length > 1
|
38
56
|
? param.quasis[param.quasis.length - 1].string
|
39
57
|
: "";
|
40
|
-
prefixRange = [param.quasis[0].range[0], param.quasis[0].range[1]];
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}
|
58
|
+
const prefixRange = [param.quasis[0].range[0], param.quasis[0].range[1]];
|
59
|
+
const postfixRange =
|
60
|
+
param.quasis.length > 1
|
61
|
+
? param.quasis[param.quasis.length - 1].range
|
62
|
+
: "";
|
63
|
+
const valueRange = param.range;
|
64
|
+
const { context, prefix } = splitContextFromPrefix(prefixRaw);
|
65
|
+
const { postfix, query } = splitQueryFromPostfix(postfixRaw);
|
48
66
|
// If there are more than two quasis, maybe the generated RegExp can be more precise?
|
49
|
-
regExp = new RegExp(
|
67
|
+
const regExp = new RegExp(
|
50
68
|
`^${quotemeta(prefix)}${options.wrappedContextRegExp.source}${quotemeta(
|
51
69
|
postfix
|
52
70
|
)}$`
|
53
71
|
);
|
54
|
-
dep = new Dep(
|
72
|
+
const dep = new Dep(
|
55
73
|
Object.assign(
|
56
74
|
{
|
57
|
-
request: context,
|
75
|
+
request: context + query,
|
58
76
|
recursive: options.wrappedContextRecursive,
|
59
77
|
regExp,
|
60
78
|
mode: "sync"
|
@@ -65,12 +83,20 @@ ContextDependencyHelpers.create = (
|
|
65
83
|
valueRange
|
66
84
|
);
|
67
85
|
dep.loc = expr.loc;
|
68
|
-
|
69
|
-
|
86
|
+
const replaces = [];
|
87
|
+
if (prefixRange && prefix !== prefixRaw) {
|
88
|
+
replaces.push({
|
70
89
|
range: prefixRange,
|
71
90
|
value: prefix
|
72
|
-
}
|
73
|
-
|
91
|
+
});
|
92
|
+
}
|
93
|
+
if (postfixRange && postfix !== postfixRaw) {
|
94
|
+
replaces.push({
|
95
|
+
range: postfixRange,
|
96
|
+
value: postfix
|
97
|
+
});
|
98
|
+
}
|
99
|
+
dep.replaces = replaces;
|
74
100
|
dep.critical =
|
75
101
|
options.wrappedContextCritical &&
|
76
102
|
"a part of the request of a dependency is an expression";
|
@@ -80,30 +106,26 @@ ContextDependencyHelpers.create = (
|
|
80
106
|
((param.prefix && param.prefix.isString()) ||
|
81
107
|
(param.postfix && param.postfix.isString()))
|
82
108
|
) {
|
83
|
-
|
84
|
-
|
109
|
+
let prefixRaw =
|
110
|
+
param.prefix && param.prefix.isString() ? param.prefix.string : "";
|
111
|
+
let postfixRaw =
|
85
112
|
param.postfix && param.postfix.isString() ? param.postfix.string : "";
|
86
|
-
prefixRange =
|
113
|
+
const prefixRange =
|
87
114
|
param.prefix && param.prefix.isString() ? param.prefix.range : null;
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
if (idx >= 0) {
|
95
|
-
context = prefix.substr(0, idx);
|
96
|
-
prefix = `.${prefix.substr(idx)}`;
|
97
|
-
}
|
98
|
-
regExp = new RegExp(
|
115
|
+
const postfixRange =
|
116
|
+
param.postfix && param.postfix.isString() ? param.postfix.range : null;
|
117
|
+
const valueRange = param.range;
|
118
|
+
const { context, prefix } = splitContextFromPrefix(prefixRaw);
|
119
|
+
const { postfix, query } = splitQueryFromPostfix(postfixRaw);
|
120
|
+
const regExp = new RegExp(
|
99
121
|
`^${quotemeta(prefix)}${options.wrappedContextRegExp.source}${quotemeta(
|
100
122
|
postfix
|
101
123
|
)}$`
|
102
124
|
);
|
103
|
-
dep = new Dep(
|
125
|
+
const dep = new Dep(
|
104
126
|
Object.assign(
|
105
127
|
{
|
106
|
-
request: context,
|
128
|
+
request: context + query,
|
107
129
|
recursive: options.wrappedContextRecursive,
|
108
130
|
regExp,
|
109
131
|
mode: "sync"
|
@@ -114,13 +136,26 @@ ContextDependencyHelpers.create = (
|
|
114
136
|
valueRange
|
115
137
|
);
|
116
138
|
dep.loc = expr.loc;
|
117
|
-
|
139
|
+
const replaces = [];
|
140
|
+
if (prefixRange && prefix !== prefixRaw) {
|
141
|
+
replaces.push({
|
142
|
+
range: prefixRange,
|
143
|
+
value: JSON.stringify(prefix)
|
144
|
+
});
|
145
|
+
}
|
146
|
+
if (postfixRange && postfix !== postfixRaw) {
|
147
|
+
replaces.push({
|
148
|
+
range: postfixRange,
|
149
|
+
value: JSON.stringify(postfix)
|
150
|
+
});
|
151
|
+
}
|
152
|
+
dep.replaces = replaces;
|
118
153
|
dep.critical =
|
119
154
|
options.wrappedContextCritical &&
|
120
155
|
"a part of the request of a dependency is an expression";
|
121
156
|
return dep;
|
122
157
|
} else {
|
123
|
-
dep = new Dep(
|
158
|
+
const dep = new Dep(
|
124
159
|
Object.assign(
|
125
160
|
{
|
126
161
|
request: options.exprContextRequest,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "4.16.
|
3
|
+
"version": "4.16.5",
|
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",
|