webpack 4.41.5 → 4.43.0
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/declarations/WebpackOptions.d.ts +3 -3
- package/lib/ConstPlugin.js +5 -0
- package/lib/DllPlugin.js +2 -2
- package/lib/FlagAllModulesAsUsedPlugin.js +38 -0
- package/lib/FlagDependencyExportsPlugin.js +33 -7
- package/lib/FlagDependencyUsagePlugin.js +1 -1
- package/lib/HotModuleReplacement.runtime.js +81 -8
- package/lib/Parser.js +21 -8
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +5 -1
- package/lib/node/NodeMainTemplate.runtime.js +6 -1
- package/lib/node/NodeMainTemplateAsync.runtime.js +7 -1
- package/lib/optimize/ConcatenatedModule.js +132 -159
- package/lib/web/JsonpMainTemplate.runtime.js +8 -1
- package/lib/webworker/WebWorkerMainTemplate.runtime.js +9 -1
- package/package.json +9 -8
- package/schemas/WebpackOptions.json +4 -14
- package/schemas/ajv.absolutePath.js +6 -4
@@ -132,7 +132,7 @@ export type RuleSetCondition =
|
|
132
132
|
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
133
133
|
* via the `definition` "RuleSetConditions".
|
134
134
|
*/
|
135
|
-
export type RuleSetConditions =
|
135
|
+
export type RuleSetConditions = RuleSetCondition[];
|
136
136
|
/**
|
137
137
|
* One or multiple rule conditions
|
138
138
|
*
|
@@ -181,7 +181,7 @@ export type RuleSetConditionAbsolute =
|
|
181
181
|
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
182
182
|
* via the `definition` "RuleSetConditionsAbsolute".
|
183
183
|
*/
|
184
|
-
export type RuleSetConditionsAbsolute =
|
184
|
+
export type RuleSetConditionsAbsolute = RuleSetConditionAbsolute[];
|
185
185
|
/**
|
186
186
|
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
187
187
|
* via the `definition` "RuleSetLoader".
|
@@ -1118,7 +1118,7 @@ export interface OutputOptions {
|
|
1118
1118
|
/**
|
1119
1119
|
* The filename of the Hot Update Chunks. They are inside the output.path directory.
|
1120
1120
|
*/
|
1121
|
-
hotUpdateChunkFilename?: string
|
1121
|
+
hotUpdateChunkFilename?: string;
|
1122
1122
|
/**
|
1123
1123
|
* The JSONP function used by webpack for async loading of hot update chunks.
|
1124
1124
|
*/
|
package/lib/ConstPlugin.js
CHANGED
@@ -119,6 +119,7 @@ class ConstPlugin {
|
|
119
119
|
|
120
120
|
const handler = parser => {
|
121
121
|
parser.hooks.statementIf.tap("ConstPlugin", statement => {
|
122
|
+
if (parser.scope.isAsmJs) return;
|
122
123
|
const param = parser.evaluateExpression(statement.test);
|
123
124
|
const bool = param.asBool();
|
124
125
|
if (typeof bool === "boolean") {
|
@@ -189,6 +190,7 @@ class ConstPlugin {
|
|
189
190
|
parser.hooks.expressionConditionalOperator.tap(
|
190
191
|
"ConstPlugin",
|
191
192
|
expression => {
|
193
|
+
if (parser.scope.isAsmJs) return;
|
192
194
|
const param = parser.evaluateExpression(expression.test);
|
193
195
|
const bool = param.asBool();
|
194
196
|
if (typeof bool === "boolean") {
|
@@ -224,6 +226,7 @@ class ConstPlugin {
|
|
224
226
|
parser.hooks.expressionLogicalOperator.tap(
|
225
227
|
"ConstPlugin",
|
226
228
|
expression => {
|
229
|
+
if (parser.scope.isAsmJs) return;
|
227
230
|
if (
|
228
231
|
expression.operator === "&&" ||
|
229
232
|
expression.operator === "||"
|
@@ -309,6 +312,7 @@ class ConstPlugin {
|
|
309
312
|
parser.hooks.evaluateIdentifier
|
310
313
|
.for("__resourceQuery")
|
311
314
|
.tap("ConstPlugin", expr => {
|
315
|
+
if (parser.scope.isAsmJs) return;
|
312
316
|
if (!parser.state.module) return;
|
313
317
|
return ParserHelpers.evaluateToString(
|
314
318
|
getQuery(parser.state.module.resource)
|
@@ -317,6 +321,7 @@ class ConstPlugin {
|
|
317
321
|
parser.hooks.expression
|
318
322
|
.for("__resourceQuery")
|
319
323
|
.tap("ConstPlugin", () => {
|
324
|
+
if (parser.scope.isAsmJs) return;
|
320
325
|
if (!parser.state.module) return;
|
321
326
|
parser.state.current.addVariable(
|
322
327
|
"__resourceQuery",
|
package/lib/DllPlugin.js
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
"use strict";
|
6
6
|
|
7
7
|
const DllEntryPlugin = require("./DllEntryPlugin");
|
8
|
+
const FlagAllModulesAsUsedPlugin = require("./FlagAllModulesAsUsedPlugin");
|
8
9
|
const LibManifestPlugin = require("./LibManifestPlugin");
|
9
|
-
const FlagInitialModulesAsUsedPlugin = require("./FlagInitialModulesAsUsedPlugin");
|
10
10
|
|
11
11
|
const validateOptions = require("schema-utils");
|
12
12
|
const schema = require("../schemas/plugins/DllPlugin.json");
|
@@ -41,7 +41,7 @@ class DllPlugin {
|
|
41
41
|
});
|
42
42
|
new LibManifestPlugin(this.options).apply(compiler);
|
43
43
|
if (!this.options.entryOnly) {
|
44
|
-
new
|
44
|
+
new FlagAllModulesAsUsedPlugin("DllPlugin").apply(compiler);
|
45
45
|
}
|
46
46
|
}
|
47
47
|
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
/** @typedef {import("./Compiler")} Compiler */
|
9
|
+
|
10
|
+
class FlagAllModulesAsUsedPlugin {
|
11
|
+
constructor(explanation) {
|
12
|
+
this.explanation = explanation;
|
13
|
+
}
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @param {Compiler} compiler webpack compiler
|
17
|
+
* @returns {void}
|
18
|
+
*/
|
19
|
+
apply(compiler) {
|
20
|
+
compiler.hooks.compilation.tap(
|
21
|
+
"FlagAllModulesAsUsedPlugin",
|
22
|
+
compilation => {
|
23
|
+
compilation.hooks.optimizeDependencies.tap(
|
24
|
+
"FlagAllModulesAsUsedPlugin",
|
25
|
+
modules => {
|
26
|
+
for (const module of modules) {
|
27
|
+
module.used = true;
|
28
|
+
module.usedExports = true;
|
29
|
+
module.addReason(null, null, this.explanation);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
);
|
33
|
+
}
|
34
|
+
);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
module.exports = FlagAllModulesAsUsedPlugin;
|
@@ -7,11 +7,9 @@
|
|
7
7
|
const Queue = require("./util/Queue");
|
8
8
|
|
9
9
|
const addToSet = (a, b) => {
|
10
|
-
const size = a.size;
|
11
10
|
for (const item of b) {
|
12
11
|
a.add(item);
|
13
12
|
}
|
14
|
-
return a.size !== size;
|
15
13
|
};
|
16
14
|
|
17
15
|
class FlagDependencyExportsPlugin {
|
@@ -58,14 +56,11 @@ class FlagDependencyExportsPlugin {
|
|
58
56
|
// break if it should move to the worst state
|
59
57
|
if (exports === true) {
|
60
58
|
module.buildMeta.providedExports = true;
|
61
|
-
notifyDependencies();
|
62
59
|
return true;
|
63
60
|
}
|
64
61
|
// merge in new exports
|
65
62
|
if (Array.isArray(exports)) {
|
66
|
-
|
67
|
-
notifyDependencies();
|
68
|
-
}
|
63
|
+
addToSet(moduleProvidedExports, exports);
|
69
64
|
}
|
70
65
|
// store dependencies
|
71
66
|
const exportDeps = exportDesc.dependencies;
|
@@ -93,6 +88,26 @@ class FlagDependencyExportsPlugin {
|
|
93
88
|
}
|
94
89
|
};
|
95
90
|
|
91
|
+
const notifyDependenciesIfDifferent = (set, array) => {
|
92
|
+
const deps = dependencies.get(module);
|
93
|
+
if (deps !== undefined) {
|
94
|
+
if (set.size === array.length) {
|
95
|
+
let i = 0;
|
96
|
+
let different = false;
|
97
|
+
for (const item of set) {
|
98
|
+
if (item !== array[i++]) {
|
99
|
+
different = true;
|
100
|
+
break;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
if (!different) return;
|
104
|
+
}
|
105
|
+
for (const dep of deps) {
|
106
|
+
queue.enqueue(dep);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
};
|
110
|
+
|
96
111
|
// Start with all modules without provided exports
|
97
112
|
for (const module of modules) {
|
98
113
|
if (module.buildInfo.temporaryProvidedExports) {
|
@@ -116,9 +131,20 @@ class FlagDependencyExportsPlugin {
|
|
116
131
|
processDependenciesBlock(module);
|
117
132
|
module.buildInfo.temporaryProvidedExports = providedExportsAreTemporary;
|
118
133
|
if (!moduleWithExports) {
|
134
|
+
notifyDependencies();
|
119
135
|
module.buildMeta.providedExports = true;
|
136
|
+
} else if (module.buildMeta.providedExports === true) {
|
137
|
+
notifyDependencies();
|
138
|
+
} else if (!module.buildMeta.providedExports) {
|
120
139
|
notifyDependencies();
|
121
|
-
|
140
|
+
module.buildMeta.providedExports = Array.from(
|
141
|
+
moduleProvidedExports
|
142
|
+
);
|
143
|
+
} else {
|
144
|
+
notifyDependenciesIfDifferent(
|
145
|
+
moduleProvidedExports,
|
146
|
+
module.buildMeta.providedExports
|
147
|
+
);
|
122
148
|
module.buildMeta.providedExports = Array.from(
|
123
149
|
moduleProvidedExports
|
124
150
|
);
|
@@ -2,7 +2,17 @@
|
|
2
2
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
3
|
Author Tobias Koppers @sokra
|
4
4
|
*/
|
5
|
-
|
5
|
+
// eslint-disable no-unused-vars
|
6
|
+
var $hash$ = undefined;
|
7
|
+
var $requestTimeout$ = undefined;
|
8
|
+
var installedModules = undefined;
|
9
|
+
var $require$ = undefined;
|
10
|
+
var hotDownloadManifest = undefined;
|
11
|
+
var hotDownloadUpdateChunk = undefined;
|
12
|
+
var hotDisposeChunk = undefined;
|
13
|
+
var modules = undefined;
|
14
|
+
var chunkId = undefined;
|
15
|
+
|
6
16
|
module.exports = function() {
|
7
17
|
var hotApplyOnUpdate = true;
|
8
18
|
// eslint-disable-next-line no-unused-vars
|
@@ -99,6 +109,7 @@ module.exports = function() {
|
|
99
109
|
_declinedDependencies: {},
|
100
110
|
_selfAccepted: false,
|
101
111
|
_selfDeclined: false,
|
112
|
+
_selfInvalidated: false,
|
102
113
|
_disposeHandlers: [],
|
103
114
|
_main: hotCurrentChildModule !== moduleId,
|
104
115
|
|
@@ -129,6 +140,29 @@ module.exports = function() {
|
|
129
140
|
var idx = hot._disposeHandlers.indexOf(callback);
|
130
141
|
if (idx >= 0) hot._disposeHandlers.splice(idx, 1);
|
131
142
|
},
|
143
|
+
invalidate: function() {
|
144
|
+
this._selfInvalidated = true;
|
145
|
+
switch (hotStatus) {
|
146
|
+
case "idle":
|
147
|
+
hotUpdate = {};
|
148
|
+
hotUpdate[moduleId] = modules[moduleId];
|
149
|
+
hotSetStatus("ready");
|
150
|
+
break;
|
151
|
+
case "ready":
|
152
|
+
hotApplyInvalidatedModule(moduleId);
|
153
|
+
break;
|
154
|
+
case "prepare":
|
155
|
+
case "check":
|
156
|
+
case "dispose":
|
157
|
+
case "apply":
|
158
|
+
(hotQueuedInvalidatedModules =
|
159
|
+
hotQueuedInvalidatedModules || []).push(moduleId);
|
160
|
+
break;
|
161
|
+
default:
|
162
|
+
// ignore requests in error states
|
163
|
+
break;
|
164
|
+
}
|
165
|
+
},
|
132
166
|
|
133
167
|
// Management API
|
134
168
|
check: hotCheck,
|
@@ -170,7 +204,7 @@ module.exports = function() {
|
|
170
204
|
var hotDeferred;
|
171
205
|
|
172
206
|
// The update info
|
173
|
-
var hotUpdate, hotUpdateNewHash;
|
207
|
+
var hotUpdate, hotUpdateNewHash, hotQueuedInvalidatedModules;
|
174
208
|
|
175
209
|
function toModuleId(id) {
|
176
210
|
var isNumber = +id + "" === id;
|
@@ -185,7 +219,7 @@ module.exports = function() {
|
|
185
219
|
hotSetStatus("check");
|
186
220
|
return hotDownloadManifest(hotRequestTimeout).then(function(update) {
|
187
221
|
if (!update) {
|
188
|
-
hotSetStatus("idle");
|
222
|
+
hotSetStatus(hotApplyInvalidatedModules() ? "ready" : "idle");
|
189
223
|
return null;
|
190
224
|
}
|
191
225
|
hotRequestedFilesMap = {};
|
@@ -204,7 +238,6 @@ module.exports = function() {
|
|
204
238
|
/*foreachInstalledChunks*/
|
205
239
|
// eslint-disable-next-line no-lone-blocks
|
206
240
|
{
|
207
|
-
/*globals chunkId */
|
208
241
|
hotEnsureUpdateChunk(chunkId);
|
209
242
|
}
|
210
243
|
if (
|
@@ -279,6 +312,11 @@ module.exports = function() {
|
|
279
312
|
if (hotStatus !== "ready")
|
280
313
|
throw new Error("apply() is only allowed in ready status");
|
281
314
|
options = options || {};
|
315
|
+
return hotApplyInternal(options);
|
316
|
+
}
|
317
|
+
|
318
|
+
function hotApplyInternal(options) {
|
319
|
+
hotApplyInvalidatedModules();
|
282
320
|
|
283
321
|
var cb;
|
284
322
|
var i;
|
@@ -301,7 +339,11 @@ module.exports = function() {
|
|
301
339
|
var moduleId = queueItem.id;
|
302
340
|
var chain = queueItem.chain;
|
303
341
|
module = installedModules[moduleId];
|
304
|
-
if (
|
342
|
+
if (
|
343
|
+
!module ||
|
344
|
+
(module.hot._selfAccepted && !module.hot._selfInvalidated)
|
345
|
+
)
|
346
|
+
continue;
|
305
347
|
if (module.hot._selfDeclined) {
|
306
348
|
return {
|
307
349
|
type: "self-declined",
|
@@ -469,10 +511,13 @@ module.exports = function() {
|
|
469
511
|
installedModules[moduleId] &&
|
470
512
|
installedModules[moduleId].hot._selfAccepted &&
|
471
513
|
// removed self-accepted modules should not be required
|
472
|
-
appliedUpdate[moduleId] !== warnUnexpectedRequire
|
514
|
+
appliedUpdate[moduleId] !== warnUnexpectedRequire &&
|
515
|
+
// when called invalidate self-accepting is not possible
|
516
|
+
!installedModules[moduleId].hot._selfInvalidated
|
473
517
|
) {
|
474
518
|
outdatedSelfAcceptedModules.push({
|
475
519
|
module: moduleId,
|
520
|
+
parents: installedModules[moduleId].parents.slice(),
|
476
521
|
errorHandler: installedModules[moduleId].hot._selfAccepted
|
477
522
|
});
|
478
523
|
}
|
@@ -545,7 +590,11 @@ module.exports = function() {
|
|
545
590
|
// Now in "apply" phase
|
546
591
|
hotSetStatus("apply");
|
547
592
|
|
548
|
-
|
593
|
+
if (hotUpdateNewHash !== undefined) {
|
594
|
+
hotCurrentHash = hotUpdateNewHash;
|
595
|
+
hotUpdateNewHash = undefined;
|
596
|
+
}
|
597
|
+
hotUpdate = undefined;
|
549
598
|
|
550
599
|
// insert new code
|
551
600
|
for (moduleId in appliedUpdate) {
|
@@ -598,7 +647,8 @@ module.exports = function() {
|
|
598
647
|
for (i = 0; i < outdatedSelfAcceptedModules.length; i++) {
|
599
648
|
var item = outdatedSelfAcceptedModules[i];
|
600
649
|
moduleId = item.module;
|
601
|
-
hotCurrentParents =
|
650
|
+
hotCurrentParents = item.parents;
|
651
|
+
hotCurrentChildModule = moduleId;
|
602
652
|
try {
|
603
653
|
$require$(moduleId);
|
604
654
|
} catch (err) {
|
@@ -640,9 +690,32 @@ module.exports = function() {
|
|
640
690
|
return Promise.reject(error);
|
641
691
|
}
|
642
692
|
|
693
|
+
if (hotQueuedInvalidatedModules) {
|
694
|
+
return hotApplyInternal(options).then(function(list) {
|
695
|
+
outdatedModules.forEach(function(moduleId) {
|
696
|
+
if (list.indexOf(moduleId) < 0) list.push(moduleId);
|
697
|
+
});
|
698
|
+
return list;
|
699
|
+
});
|
700
|
+
}
|
701
|
+
|
643
702
|
hotSetStatus("idle");
|
644
703
|
return new Promise(function(resolve) {
|
645
704
|
resolve(outdatedModules);
|
646
705
|
});
|
647
706
|
}
|
707
|
+
|
708
|
+
function hotApplyInvalidatedModules() {
|
709
|
+
if (hotQueuedInvalidatedModules) {
|
710
|
+
if (!hotUpdate) hotUpdate = {};
|
711
|
+
hotQueuedInvalidatedModules.forEach(hotApplyInvalidatedModule);
|
712
|
+
hotQueuedInvalidatedModules = undefined;
|
713
|
+
return true;
|
714
|
+
}
|
715
|
+
}
|
716
|
+
|
717
|
+
function hotApplyInvalidatedModule(moduleId) {
|
718
|
+
if (!Object.prototype.hasOwnProperty.call(hotUpdate, moduleId))
|
719
|
+
hotUpdate[moduleId] = modules[moduleId];
|
720
|
+
}
|
648
721
|
};
|
package/lib/Parser.js
CHANGED
@@ -1229,7 +1229,7 @@ class Parser extends Tapable {
|
|
1229
1229
|
this.walkPattern(param);
|
1230
1230
|
}
|
1231
1231
|
if (statement.body.type === "BlockStatement") {
|
1232
|
-
this.
|
1232
|
+
this.detectMode(statement.body.body);
|
1233
1233
|
this.prewalkStatement(statement.body);
|
1234
1234
|
this.walkStatement(statement.body);
|
1235
1235
|
} else {
|
@@ -1697,7 +1697,7 @@ class Parser extends Tapable {
|
|
1697
1697
|
this.walkPattern(param);
|
1698
1698
|
}
|
1699
1699
|
if (expression.body.type === "BlockStatement") {
|
1700
|
-
this.
|
1700
|
+
this.detectMode(expression.body.body);
|
1701
1701
|
this.prewalkStatement(expression.body);
|
1702
1702
|
this.walkStatement(expression.body);
|
1703
1703
|
} else {
|
@@ -1713,7 +1713,7 @@ class Parser extends Tapable {
|
|
1713
1713
|
this.walkPattern(param);
|
1714
1714
|
}
|
1715
1715
|
if (expression.body.type === "BlockStatement") {
|
1716
|
-
this.
|
1716
|
+
this.detectMode(expression.body.body);
|
1717
1717
|
this.prewalkStatement(expression.body);
|
1718
1718
|
this.walkStatement(expression.body);
|
1719
1719
|
} else {
|
@@ -1894,6 +1894,7 @@ class Parser extends Tapable {
|
|
1894
1894
|
this.scope.renames.set(params[i].name, param);
|
1895
1895
|
}
|
1896
1896
|
if (functionExpression.body.type === "BlockStatement") {
|
1897
|
+
this.detectMode(functionExpression.body.body);
|
1897
1898
|
this.prewalkStatement(functionExpression.body);
|
1898
1899
|
this.walkStatement(functionExpression.body);
|
1899
1900
|
} else {
|
@@ -2001,6 +2002,7 @@ class Parser extends Tapable {
|
|
2001
2002
|
inTry: false,
|
2002
2003
|
inShorthand: false,
|
2003
2004
|
isStrict: oldScope.isStrict,
|
2005
|
+
isAsmJs: oldScope.isAsmJs,
|
2004
2006
|
definitions: oldScope.definitions.createChild(),
|
2005
2007
|
renames: oldScope.renames.createChild()
|
2006
2008
|
};
|
@@ -2024,6 +2026,7 @@ class Parser extends Tapable {
|
|
2024
2026
|
inTry: false,
|
2025
2027
|
inShorthand: false,
|
2026
2028
|
isStrict: oldScope.isStrict,
|
2029
|
+
isAsmJs: oldScope.isAsmJs,
|
2027
2030
|
definitions: oldScope.definitions.createChild(),
|
2028
2031
|
renames: oldScope.renames.createChild()
|
2029
2032
|
};
|
@@ -2049,6 +2052,7 @@ class Parser extends Tapable {
|
|
2049
2052
|
inTry: oldScope.inTry,
|
2050
2053
|
inShorthand: false,
|
2051
2054
|
isStrict: oldScope.isStrict,
|
2055
|
+
isAsmJs: oldScope.isAsmJs,
|
2052
2056
|
definitions: oldScope.definitions.createChild(),
|
2053
2057
|
renames: oldScope.renames.createChild()
|
2054
2058
|
};
|
@@ -2058,15 +2062,23 @@ class Parser extends Tapable {
|
|
2058
2062
|
this.scope = oldScope;
|
2059
2063
|
}
|
2060
2064
|
|
2065
|
+
// TODO webpack 5: remove this methods
|
2066
|
+
// only for backward-compat
|
2061
2067
|
detectStrictMode(statements) {
|
2062
|
-
|
2068
|
+
this.detectMode(statements);
|
2069
|
+
}
|
2070
|
+
|
2071
|
+
detectMode(statements) {
|
2072
|
+
const isLiteral =
|
2063
2073
|
statements.length >= 1 &&
|
2064
2074
|
statements[0].type === "ExpressionStatement" &&
|
2065
|
-
statements[0].expression.type === "Literal"
|
2066
|
-
|
2067
|
-
if (isStrict) {
|
2075
|
+
statements[0].expression.type === "Literal";
|
2076
|
+
if (isLiteral && statements[0].expression.value === "use strict") {
|
2068
2077
|
this.scope.isStrict = true;
|
2069
2078
|
}
|
2079
|
+
if (isLiteral && statements[0].expression.value === "use asm") {
|
2080
|
+
this.scope.isAsmJs = true;
|
2081
|
+
}
|
2070
2082
|
}
|
2071
2083
|
|
2072
2084
|
enterPatterns(patterns, onIdent) {
|
@@ -2272,13 +2284,14 @@ class Parser extends Tapable {
|
|
2272
2284
|
inTry: false,
|
2273
2285
|
inShorthand: false,
|
2274
2286
|
isStrict: false,
|
2287
|
+
isAsmJs: false,
|
2275
2288
|
definitions: new StackedSetMap(),
|
2276
2289
|
renames: new StackedSetMap()
|
2277
2290
|
};
|
2278
2291
|
const state = (this.state = initialState || {});
|
2279
2292
|
this.comments = comments;
|
2280
2293
|
if (this.hooks.program.call(ast, comments) === undefined) {
|
2281
|
-
this.
|
2294
|
+
this.detectMode(ast.body);
|
2282
2295
|
this.prewalkStatements(ast.body);
|
2283
2296
|
this.blockPrewalkStatements(ast.body);
|
2284
2297
|
this.walkStatements(ast.body);
|
@@ -304,9 +304,13 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
304
304
|
}
|
305
305
|
|
306
306
|
if (Array.isArray(importedModule.buildMeta.providedExports)) {
|
307
|
+
const activeFromOtherStarExports = this._discoverActiveExportsFromOtherStartExports();
|
307
308
|
return {
|
308
309
|
exports: importedModule.buildMeta.providedExports.filter(
|
309
|
-
id =>
|
310
|
+
id =>
|
311
|
+
id !== "default" &&
|
312
|
+
!activeFromOtherStarExports.has(id) &&
|
313
|
+
!this.activeExports.has(id)
|
310
314
|
),
|
311
315
|
dependencies: [importedModule]
|
312
316
|
};
|
@@ -2,7 +2,12 @@
|
|
2
2
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
3
|
Author Tobias Koppers @sokra
|
4
4
|
*/
|
5
|
-
|
5
|
+
// eslint-disable-next-line no-unused-vars
|
6
|
+
var $hotChunkFilename$ = undefined;
|
7
|
+
var hotAddUpdateChunk = undefined;
|
8
|
+
var installedChunks = undefined;
|
9
|
+
var $hotMainFilename$ = undefined;
|
10
|
+
|
6
11
|
module.exports = function() {
|
7
12
|
// eslint-disable-next-line no-unused-vars
|
8
13
|
function hotDownloadUpdateChunk(chunkId) {
|
@@ -2,7 +2,13 @@
|
|
2
2
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
3
|
Author Tobias Koppers @sokra
|
4
4
|
*/
|
5
|
-
|
5
|
+
// eslint-disable-next-line no-unused-vars
|
6
|
+
var $hotChunkFilename$ = undefined;
|
7
|
+
var $require$ = undefined;
|
8
|
+
var hotAddUpdateChunk = undefined;
|
9
|
+
var $hotMainFilename$ = undefined;
|
10
|
+
var installedChunks = undefined;
|
11
|
+
|
6
12
|
module.exports = function() {
|
7
13
|
// eslint-disable-next-line no-unused-vars
|
8
14
|
function hotDownloadUpdateChunk(chunkId) {
|
@@ -22,6 +22,23 @@ const createHash = require("../util/createHash");
|
|
22
22
|
/** @typedef {import("../Dependency")} Dependency */
|
23
23
|
/** @typedef {import("../Compilation")} Compilation */
|
24
24
|
/** @typedef {import("../util/createHash").Hash} Hash */
|
25
|
+
/** @typedef {import("../RequestShortener")} RequestShortener */
|
26
|
+
|
27
|
+
const joinIterableWithComma = iterable => {
|
28
|
+
// This is more performant than Array.from().join(", ")
|
29
|
+
// as it doesn't create an array
|
30
|
+
let str = "";
|
31
|
+
let first = true;
|
32
|
+
for (const item of iterable) {
|
33
|
+
if (first) {
|
34
|
+
first = false;
|
35
|
+
} else {
|
36
|
+
str += ", ";
|
37
|
+
}
|
38
|
+
str += item;
|
39
|
+
}
|
40
|
+
return str;
|
41
|
+
};
|
25
42
|
|
26
43
|
/**
|
27
44
|
* @typedef {Object} ConcatenationEntry
|
@@ -287,6 +304,41 @@ const getPathInAst = (ast, node) => {
|
|
287
304
|
}
|
288
305
|
};
|
289
306
|
|
307
|
+
const getHarmonyExportImportedSpecifierDependencyExports = dep => {
|
308
|
+
const importModule = dep._module;
|
309
|
+
if (!importModule) return [];
|
310
|
+
if (dep._id) {
|
311
|
+
// export { named } from "module"
|
312
|
+
return [
|
313
|
+
{
|
314
|
+
name: dep.name,
|
315
|
+
id: dep._id,
|
316
|
+
module: importModule
|
317
|
+
}
|
318
|
+
];
|
319
|
+
}
|
320
|
+
if (dep.name) {
|
321
|
+
// export * as abc from "module"
|
322
|
+
return [
|
323
|
+
{
|
324
|
+
name: dep.name,
|
325
|
+
id: true,
|
326
|
+
module: importModule
|
327
|
+
}
|
328
|
+
];
|
329
|
+
}
|
330
|
+
// export * from "module"
|
331
|
+
return importModule.buildMeta.providedExports
|
332
|
+
.filter(exp => exp !== "default" && !dep.activeExports.has(exp))
|
333
|
+
.map(exp => {
|
334
|
+
return {
|
335
|
+
name: exp,
|
336
|
+
id: exp,
|
337
|
+
module: importModule
|
338
|
+
};
|
339
|
+
});
|
340
|
+
};
|
341
|
+
|
290
342
|
class ConcatenatedModule extends Module {
|
291
343
|
constructor(rootModule, modules, concatenationList) {
|
292
344
|
super("javascript/esm", null);
|
@@ -626,10 +678,7 @@ class ConcatenatedModule extends Module {
|
|
626
678
|
);
|
627
679
|
innerDependencyTemplates.set(
|
628
680
|
HarmonyExportSpecifierDependency,
|
629
|
-
new
|
630
|
-
dependencyTemplates.get(HarmonyExportSpecifierDependency),
|
631
|
-
this.rootModule
|
632
|
-
)
|
681
|
+
new NullTemplate()
|
633
682
|
);
|
634
683
|
innerDependencyTemplates.set(
|
635
684
|
HarmonyExportExpressionDependency,
|
@@ -640,19 +689,11 @@ class ConcatenatedModule extends Module {
|
|
640
689
|
);
|
641
690
|
innerDependencyTemplates.set(
|
642
691
|
HarmonyExportImportedSpecifierDependency,
|
643
|
-
new
|
644
|
-
dependencyTemplates.get(HarmonyExportImportedSpecifierDependency),
|
645
|
-
this.rootModule,
|
646
|
-
moduleToInfoMap
|
647
|
-
)
|
692
|
+
new NullTemplate()
|
648
693
|
);
|
649
694
|
innerDependencyTemplates.set(
|
650
695
|
HarmonyCompatibilityDependency,
|
651
|
-
new
|
652
|
-
dependencyTemplates.get(HarmonyCompatibilityDependency),
|
653
|
-
this.rootModule,
|
654
|
-
moduleToInfoMap
|
655
|
-
)
|
696
|
+
new NullTemplate()
|
656
697
|
);
|
657
698
|
|
658
699
|
// Must use full identifier in our cache here to ensure that the source
|
@@ -1105,11 +1146,62 @@ class ConcatenatedModule extends Module {
|
|
1105
1146
|
}
|
1106
1147
|
}
|
1107
1148
|
|
1149
|
+
// Map with all root exposed used exports
|
1150
|
+
/** @type {Map<string, function(RequestShortener): string>} */
|
1151
|
+
const exportsMap = new Map();
|
1152
|
+
|
1153
|
+
// Set with all root exposed unused exports
|
1154
|
+
/** @type {Set<string>} */
|
1155
|
+
const unusedExports = new Set();
|
1156
|
+
|
1157
|
+
for (const dep of this.rootModule.dependencies) {
|
1158
|
+
if (dep instanceof HarmonyExportSpecifierDependency) {
|
1159
|
+
const used = this.rootModule.isUsed(dep.name);
|
1160
|
+
if (used) {
|
1161
|
+
const info = moduleToInfoMap.get(this.rootModule);
|
1162
|
+
if (!exportsMap.has(used)) {
|
1163
|
+
exportsMap.set(
|
1164
|
+
used,
|
1165
|
+
() => `/* binding */ ${info.internalNames.get(dep.id)}`
|
1166
|
+
);
|
1167
|
+
}
|
1168
|
+
} else {
|
1169
|
+
unusedExports.add(dep.name || "namespace");
|
1170
|
+
}
|
1171
|
+
} else if (dep instanceof HarmonyExportImportedSpecifierDependency) {
|
1172
|
+
const exportDefs = getHarmonyExportImportedSpecifierDependencyExports(
|
1173
|
+
dep
|
1174
|
+
);
|
1175
|
+
for (const def of exportDefs) {
|
1176
|
+
const info = moduleToInfoMap.get(def.module);
|
1177
|
+
const used = dep.originModule.isUsed(def.name);
|
1178
|
+
if (used) {
|
1179
|
+
if (!exportsMap.has(used)) {
|
1180
|
+
exportsMap.set(used, requestShortener => {
|
1181
|
+
const finalName = getFinalName(
|
1182
|
+
info,
|
1183
|
+
def.id,
|
1184
|
+
moduleToInfoMap,
|
1185
|
+
requestShortener,
|
1186
|
+
false,
|
1187
|
+
this.rootModule.buildMeta.strictHarmonyModule
|
1188
|
+
);
|
1189
|
+
return `/* reexport */ ${finalName}`;
|
1190
|
+
});
|
1191
|
+
}
|
1192
|
+
} else {
|
1193
|
+
unusedExports.add(def.name);
|
1194
|
+
}
|
1195
|
+
}
|
1196
|
+
}
|
1197
|
+
}
|
1198
|
+
|
1108
1199
|
const result = new ConcatSource();
|
1109
1200
|
|
1110
1201
|
// add harmony compatibility flag (must be first because of possible circular dependencies)
|
1111
1202
|
const usedExports = this.rootModule.usedExports;
|
1112
1203
|
if (usedExports === true || usedExports === null) {
|
1204
|
+
result.add(`// ESM COMPAT FLAG\n`);
|
1113
1205
|
result.add(
|
1114
1206
|
runtimeTemplate.defineEsModuleFlagStatement({
|
1115
1207
|
exportsArgument: this.exportsArgument
|
@@ -1117,9 +1209,33 @@ class ConcatenatedModule extends Module {
|
|
1117
1209
|
);
|
1118
1210
|
}
|
1119
1211
|
|
1212
|
+
// define exports
|
1213
|
+
if (exportsMap.size > 0) {
|
1214
|
+
result.add(`\n// EXPORTS\n`);
|
1215
|
+
for (const [key, value] of exportsMap) {
|
1216
|
+
result.add(
|
1217
|
+
`__webpack_require__.d(${this.exportsArgument}, ${JSON.stringify(
|
1218
|
+
key
|
1219
|
+
)}, function() { return ${value(requestShortener)}; });\n`
|
1220
|
+
);
|
1221
|
+
}
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
// list unused exports
|
1225
|
+
if (unusedExports.size > 0) {
|
1226
|
+
result.add(
|
1227
|
+
`\n// UNUSED EXPORTS: ${joinIterableWithComma(unusedExports)}\n`
|
1228
|
+
);
|
1229
|
+
}
|
1230
|
+
|
1120
1231
|
// define required namespace objects (must be before evaluation modules)
|
1121
1232
|
for (const info of modulesWithInfo) {
|
1122
1233
|
if (info.namespaceObjectSource) {
|
1234
|
+
result.add(
|
1235
|
+
`\n// NAMESPACE OBJECT: ${info.module.readableIdentifier(
|
1236
|
+
requestShortener
|
1237
|
+
)}\n`
|
1238
|
+
);
|
1123
1239
|
result.add(info.namespaceObjectSource);
|
1124
1240
|
}
|
1125
1241
|
}
|
@@ -1321,38 +1437,6 @@ class HarmonyImportSideEffectDependencyConcatenatedTemplate {
|
|
1321
1437
|
}
|
1322
1438
|
}
|
1323
1439
|
|
1324
|
-
class HarmonyExportSpecifierDependencyConcatenatedTemplate {
|
1325
|
-
constructor(originalTemplate, rootModule) {
|
1326
|
-
this.originalTemplate = originalTemplate;
|
1327
|
-
this.rootModule = rootModule;
|
1328
|
-
}
|
1329
|
-
|
1330
|
-
getHarmonyInitOrder(dep) {
|
1331
|
-
if (dep.originModule === this.rootModule) {
|
1332
|
-
return this.originalTemplate.getHarmonyInitOrder(dep);
|
1333
|
-
}
|
1334
|
-
return NaN;
|
1335
|
-
}
|
1336
|
-
|
1337
|
-
harmonyInit(dep, source, runtime, dependencyTemplates) {
|
1338
|
-
if (dep.originModule === this.rootModule) {
|
1339
|
-
this.originalTemplate.harmonyInit(
|
1340
|
-
dep,
|
1341
|
-
source,
|
1342
|
-
runtime,
|
1343
|
-
dependencyTemplates
|
1344
|
-
);
|
1345
|
-
return;
|
1346
|
-
}
|
1347
|
-
}
|
1348
|
-
|
1349
|
-
apply(dep, source, runtime, dependencyTemplates) {
|
1350
|
-
if (dep.originModule === this.rootModule) {
|
1351
|
-
this.originalTemplate.apply(dep, source, runtime, dependencyTemplates);
|
1352
|
-
}
|
1353
|
-
}
|
1354
|
-
}
|
1355
|
-
|
1356
1440
|
class HarmonyExportExpressionDependencyConcatenatedTemplate {
|
1357
1441
|
constructor(originalTemplate, rootModule) {
|
1358
1442
|
this.originalTemplate = originalTemplate;
|
@@ -1386,119 +1470,8 @@ class HarmonyExportExpressionDependencyConcatenatedTemplate {
|
|
1386
1470
|
}
|
1387
1471
|
}
|
1388
1472
|
|
1389
|
-
class
|
1390
|
-
|
1391
|
-
this.originalTemplate = originalTemplate;
|
1392
|
-
this.rootModule = rootModule;
|
1393
|
-
this.modulesMap = modulesMap;
|
1394
|
-
}
|
1395
|
-
|
1396
|
-
getExports(dep) {
|
1397
|
-
const importModule = dep._module;
|
1398
|
-
if (dep._id) {
|
1399
|
-
// export { named } from "module"
|
1400
|
-
return [
|
1401
|
-
{
|
1402
|
-
name: dep.name,
|
1403
|
-
id: dep._id,
|
1404
|
-
module: importModule
|
1405
|
-
}
|
1406
|
-
];
|
1407
|
-
}
|
1408
|
-
if (dep.name) {
|
1409
|
-
// export * as abc from "module"
|
1410
|
-
return [
|
1411
|
-
{
|
1412
|
-
name: dep.name,
|
1413
|
-
id: true,
|
1414
|
-
module: importModule
|
1415
|
-
}
|
1416
|
-
];
|
1417
|
-
}
|
1418
|
-
// export * from "module"
|
1419
|
-
return importModule.buildMeta.providedExports
|
1420
|
-
.filter(exp => exp !== "default" && !dep.activeExports.has(exp))
|
1421
|
-
.map(exp => {
|
1422
|
-
return {
|
1423
|
-
name: exp,
|
1424
|
-
id: exp,
|
1425
|
-
module: importModule
|
1426
|
-
};
|
1427
|
-
});
|
1428
|
-
}
|
1429
|
-
|
1430
|
-
getHarmonyInitOrder(dep) {
|
1431
|
-
const module = dep._module;
|
1432
|
-
const info = this.modulesMap.get(module);
|
1433
|
-
if (!info) {
|
1434
|
-
return this.originalTemplate.getHarmonyInitOrder(dep);
|
1435
|
-
}
|
1436
|
-
return NaN;
|
1437
|
-
}
|
1438
|
-
|
1439
|
-
harmonyInit(dep, source, runtime, dependencyTemplates) {
|
1440
|
-
const module = dep._module;
|
1441
|
-
const info = this.modulesMap.get(module);
|
1442
|
-
if (!info) {
|
1443
|
-
this.originalTemplate.harmonyInit(
|
1444
|
-
dep,
|
1445
|
-
source,
|
1446
|
-
runtime,
|
1447
|
-
dependencyTemplates
|
1448
|
-
);
|
1449
|
-
return;
|
1450
|
-
}
|
1451
|
-
}
|
1452
|
-
|
1453
|
-
apply(dep, source, runtime, dependencyTemplates) {
|
1454
|
-
if (dep.originModule === this.rootModule) {
|
1455
|
-
if (this.modulesMap.get(dep._module)) {
|
1456
|
-
const exportDefs = this.getExports(dep);
|
1457
|
-
for (const def of exportDefs) {
|
1458
|
-
const info = this.modulesMap.get(def.module);
|
1459
|
-
const used = dep.originModule.isUsed(def.name);
|
1460
|
-
if (!used) {
|
1461
|
-
source.insert(
|
1462
|
-
-1,
|
1463
|
-
`/* unused concated harmony import ${def.name} */\n`
|
1464
|
-
);
|
1465
|
-
continue;
|
1466
|
-
}
|
1467
|
-
let finalName;
|
1468
|
-
const strictFlag = dep.originModule.buildMeta.strictHarmonyModule
|
1469
|
-
? "_strict"
|
1470
|
-
: "";
|
1471
|
-
if (def.id === true) {
|
1472
|
-
finalName = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns${strictFlag}__`;
|
1473
|
-
} else {
|
1474
|
-
const exportData = Buffer.from(def.id, "utf-8").toString("hex");
|
1475
|
-
finalName = `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${strictFlag}__`;
|
1476
|
-
}
|
1477
|
-
const exportsName = this.rootModule.exportsArgument;
|
1478
|
-
const content =
|
1479
|
-
`/* concated harmony reexport ${def.name} */` +
|
1480
|
-
`__webpack_require__.d(${exportsName}, ` +
|
1481
|
-
`${JSON.stringify(used)}, ` +
|
1482
|
-
`function() { return ${finalName}; });\n`;
|
1483
|
-
source.insert(-1, content);
|
1484
|
-
}
|
1485
|
-
} else {
|
1486
|
-
this.originalTemplate.apply(dep, source, runtime, dependencyTemplates);
|
1487
|
-
}
|
1488
|
-
}
|
1489
|
-
}
|
1490
|
-
}
|
1491
|
-
|
1492
|
-
class HarmonyCompatibilityDependencyConcatenatedTemplate {
|
1493
|
-
constructor(originalTemplate, rootModule, modulesMap) {
|
1494
|
-
this.originalTemplate = originalTemplate;
|
1495
|
-
this.rootModule = rootModule;
|
1496
|
-
this.modulesMap = modulesMap;
|
1497
|
-
}
|
1498
|
-
|
1499
|
-
apply(dep, source, runtime, dependencyTemplates) {
|
1500
|
-
// do nothing
|
1501
|
-
}
|
1473
|
+
class NullTemplate {
|
1474
|
+
apply() {}
|
1502
1475
|
}
|
1503
1476
|
|
1504
1477
|
module.exports = ConcatenatedModule;
|
@@ -2,7 +2,14 @@
|
|
2
2
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
3
|
Author Tobias Koppers @sokra
|
4
4
|
*/
|
5
|
-
|
5
|
+
// eslint-disable-next-line no-unused-vars
|
6
|
+
var hotAddUpdateChunk = undefined;
|
7
|
+
var parentHotUpdateCallback = undefined;
|
8
|
+
var $require$ = undefined;
|
9
|
+
var $hotMainFilename$ = undefined;
|
10
|
+
var $hotChunkFilename$ = undefined;
|
11
|
+
var $crossOriginLoading$ = undefined;
|
12
|
+
|
6
13
|
module.exports = function() {
|
7
14
|
// eslint-disable-next-line no-unused-vars
|
8
15
|
function webpackHotUpdateCallback(chunkId, moreModules) {
|
@@ -2,7 +2,15 @@
|
|
2
2
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
3
|
Author Tobias Koppers @sokra
|
4
4
|
*/
|
5
|
-
|
5
|
+
// eslint-disable-next-line no-unused-vars
|
6
|
+
var hotAddUpdateChunk = undefined;
|
7
|
+
var parentHotUpdateCallback = undefined;
|
8
|
+
var $require$ = undefined;
|
9
|
+
var $hotChunkFilename$ = undefined;
|
10
|
+
var $hotMainFilename$ = undefined;
|
11
|
+
var installedChunks = undefined;
|
12
|
+
var importScripts = undefined;
|
13
|
+
|
6
14
|
module.exports = function() {
|
7
15
|
// eslint-disable-next-line no-unused-vars
|
8
16
|
function webpackHotUpdateCallback(chunkId, moreModules) {
|
package/package.json
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.43.0",
|
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",
|
7
7
|
"dependencies": {
|
8
|
-
"@webassemblyjs/ast": "1.
|
9
|
-
"@webassemblyjs/helper-module-context": "1.
|
10
|
-
"@webassemblyjs/wasm-edit": "1.
|
11
|
-
"@webassemblyjs/wasm-parser": "1.
|
12
|
-
"acorn": "^6.
|
8
|
+
"@webassemblyjs/ast": "1.9.0",
|
9
|
+
"@webassemblyjs/helper-module-context": "1.9.0",
|
10
|
+
"@webassemblyjs/wasm-edit": "1.9.0",
|
11
|
+
"@webassemblyjs/wasm-parser": "1.9.0",
|
12
|
+
"acorn": "^6.4.1",
|
13
13
|
"ajv": "^6.10.2",
|
14
14
|
"ajv-keywords": "^3.4.1",
|
15
15
|
"chrome-trace-event": "^1.0.2",
|
@@ -20,13 +20,13 @@
|
|
20
20
|
"loader-utils": "^1.2.3",
|
21
21
|
"memory-fs": "^0.4.1",
|
22
22
|
"micromatch": "^3.1.10",
|
23
|
-
"mkdirp": "^0.5.
|
23
|
+
"mkdirp": "^0.5.3",
|
24
24
|
"neo-async": "^2.6.1",
|
25
25
|
"node-libs-browser": "^2.2.1",
|
26
26
|
"schema-utils": "^1.0.0",
|
27
27
|
"tapable": "^1.1.3",
|
28
28
|
"terser-webpack-plugin": "^1.4.3",
|
29
|
-
"watchpack": "^1.6.
|
29
|
+
"watchpack": "^1.6.1",
|
30
30
|
"webpack-sources": "^1.4.1"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
@@ -80,6 +80,7 @@
|
|
80
80
|
"vm-browserify": "~1.1.0",
|
81
81
|
"wast-loader": "^1.5.5",
|
82
82
|
"webpack-dev-middleware": "^3.5.1",
|
83
|
+
"webassembly-feature": "1.3.0",
|
83
84
|
"worker-loader": "^2.0.0",
|
84
85
|
"xxhashjs": "^0.2.1"
|
85
86
|
},
|
@@ -940,16 +940,8 @@
|
|
940
940
|
},
|
941
941
|
"hotUpdateChunkFilename": {
|
942
942
|
"description": "The filename of the Hot Update Chunks. They are inside the output.path directory.",
|
943
|
-
"
|
944
|
-
|
945
|
-
"type": "string",
|
946
|
-
"absolutePath": false
|
947
|
-
},
|
948
|
-
{
|
949
|
-
"instanceof": "Function",
|
950
|
-
"tsType": "Function"
|
951
|
-
}
|
952
|
-
]
|
943
|
+
"type": "string",
|
944
|
+
"absolutePath": false
|
953
945
|
},
|
954
946
|
"hotUpdateFunction": {
|
955
947
|
"description": "The JSONP function used by webpack for async loading of hot update chunks.",
|
@@ -1428,8 +1420,7 @@
|
|
1428
1420
|
"$ref": "#/definitions/RuleSetCondition"
|
1429
1421
|
}
|
1430
1422
|
]
|
1431
|
-
}
|
1432
|
-
"tsType": "RuleSetConditionsRecursive"
|
1423
|
+
}
|
1433
1424
|
},
|
1434
1425
|
"RuleSetConditionsAbsolute": {
|
1435
1426
|
"type": "array",
|
@@ -1440,8 +1431,7 @@
|
|
1440
1431
|
"$ref": "#/definitions/RuleSetConditionAbsolute"
|
1441
1432
|
}
|
1442
1433
|
]
|
1443
|
-
}
|
1444
|
-
"tsType": "RuleSetConditionsAbsoluteRecursive"
|
1434
|
+
}
|
1445
1435
|
},
|
1446
1436
|
"RuleSetLoader": {
|
1447
1437
|
"type": "string",
|
@@ -25,8 +25,6 @@ module.exports = ajv =>
|
|
25
25
|
function callback(data) {
|
26
26
|
let passes = true;
|
27
27
|
const isExclamationMarkPresent = data.includes("!");
|
28
|
-
const isCorrectAbsoluteOrRelativePath =
|
29
|
-
expected === /^(?:[A-Za-z]:\\|\/)/.test(data);
|
30
28
|
|
31
29
|
if (isExclamationMarkPresent) {
|
32
30
|
callback.errors = [
|
@@ -40,8 +38,12 @@ module.exports = ajv =>
|
|
40
38
|
];
|
41
39
|
passes = false;
|
42
40
|
}
|
43
|
-
|
44
|
-
|
41
|
+
// ?:[A-Za-z]:\\ - Windows absolute path
|
42
|
+
// \\\\ - Windows network absolute path
|
43
|
+
// \/ - Unix-like OS absolute path
|
44
|
+
const isCorrectAbsolutePath =
|
45
|
+
expected === /^(?:[A-Za-z]:\\|\\\\|\/)/.test(data);
|
46
|
+
if (!isCorrectAbsolutePath) {
|
45
47
|
callback.errors = [getErrorFor(expected, data, schema)];
|
46
48
|
passes = false;
|
47
49
|
}
|