webpack 4.41.2 → 4.41.6
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 +8 -5
- package/lib/CommonJsStuffPlugin.js +8 -6
- package/lib/DefinePlugin.js +8 -6
- package/lib/EvalSourceMapDevToolModuleTemplatePlugin.js +5 -0
- package/lib/FlagDependencyExportsPlugin.js +35 -16
- package/lib/HotModuleReplacement.runtime.js +11 -2
- package/lib/ProvidePlugin.js +4 -3
- package/lib/SourceMapDevToolPlugin.js +20 -16
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +5 -1
- package/lib/logging/Logger.js +15 -18
- package/lib/node/NodeMainTemplate.runtime.js +6 -1
- package/lib/node/NodeMainTemplateAsync.runtime.js +7 -1
- package/lib/optimize/ConcatenatedModule.js +5 -0
- package/lib/optimize/SideEffectsFlagPlugin.js +1 -1
- package/lib/util/identifier.js +25 -0
- package/lib/wasm/WebAssemblyModulesPlugin.js +14 -4
- package/lib/web/JsonpMainTemplate.runtime.js +8 -1
- package/lib/webworker/WebWorkerMainTemplate.runtime.js +9 -1
- package/package.json +8 -2
- package/schemas/WebpackOptions.json +2 -4
- package/schemas/ajv.absolutePath.js +6 -4
@@ -50,7 +50,8 @@ export type Externals =
|
|
50
50
|
request: string,
|
51
51
|
callback: (err?: Error, result?: string) => void
|
52
52
|
) => void)
|
53
|
-
| ExternalItem
|
53
|
+
| ExternalItem
|
54
|
+
)[];
|
54
55
|
/**
|
55
56
|
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
56
57
|
* via the `definition` "ExternalItem".
|
@@ -131,7 +132,7 @@ export type RuleSetCondition =
|
|
131
132
|
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
132
133
|
* via the `definition` "RuleSetConditions".
|
133
134
|
*/
|
134
|
-
export type RuleSetConditions =
|
135
|
+
export type RuleSetConditions = RuleSetCondition[];
|
135
136
|
/**
|
136
137
|
* One or multiple rule conditions
|
137
138
|
*
|
@@ -180,7 +181,7 @@ export type RuleSetConditionAbsolute =
|
|
180
181
|
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
181
182
|
* via the `definition` "RuleSetConditionsAbsolute".
|
182
183
|
*/
|
183
|
-
export type RuleSetConditionsAbsolute =
|
184
|
+
export type RuleSetConditionsAbsolute = RuleSetConditionAbsolute[];
|
184
185
|
/**
|
185
186
|
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
186
187
|
* via the `definition` "RuleSetLoader".
|
@@ -391,7 +392,8 @@ export interface WebpackOptions {
|
|
391
392
|
| "normal"
|
392
393
|
| "detailed"
|
393
394
|
| "verbose"
|
394
|
-
| "errors-warnings"
|
395
|
+
| "errors-warnings"
|
396
|
+
);
|
395
397
|
/**
|
396
398
|
* Environment to build for
|
397
399
|
*/
|
@@ -404,7 +406,8 @@ export interface WebpackOptions {
|
|
404
406
|
| "node-webkit"
|
405
407
|
| "electron-main"
|
406
408
|
| "electron-renderer"
|
407
|
-
| "electron-preload"
|
409
|
+
| "electron-preload"
|
410
|
+
)
|
408
411
|
| ((compiler: import("../lib/Compiler")) => void);
|
409
412
|
/**
|
410
413
|
* Enter watch mode, which rebuilds on file change.
|
@@ -45,18 +45,20 @@ class CommonJsStuffPlugin {
|
|
45
45
|
.tap("CommonJsStuffPlugin", expr => {
|
46
46
|
parser.state.module.buildMeta.moduleConcatenationBailout =
|
47
47
|
"module.loaded";
|
48
|
-
return ParserHelpers.toConstantDependency(
|
49
|
-
|
50
|
-
|
48
|
+
return ParserHelpers.toConstantDependency(
|
49
|
+
parser,
|
50
|
+
"module.l"
|
51
|
+
)(expr);
|
51
52
|
});
|
52
53
|
parser.hooks.expression
|
53
54
|
.for("module.id")
|
54
55
|
.tap("CommonJsStuffPlugin", expr => {
|
55
56
|
parser.state.module.buildMeta.moduleConcatenationBailout =
|
56
57
|
"module.id";
|
57
|
-
return ParserHelpers.toConstantDependency(
|
58
|
-
|
59
|
-
|
58
|
+
return ParserHelpers.toConstantDependency(
|
59
|
+
parser,
|
60
|
+
"module.i"
|
61
|
+
)(expr);
|
60
62
|
});
|
61
63
|
parser.hooks.expression
|
62
64
|
.for("module.exports")
|
package/lib/DefinePlugin.js
CHANGED
@@ -190,9 +190,10 @@ class DefinePlugin {
|
|
190
190
|
strCode
|
191
191
|
)(expr);
|
192
192
|
} else {
|
193
|
-
return ParserHelpers.toConstantDependency(
|
194
|
-
|
195
|
-
|
193
|
+
return ParserHelpers.toConstantDependency(
|
194
|
+
parser,
|
195
|
+
strCode
|
196
|
+
)(expr);
|
196
197
|
}
|
197
198
|
});
|
198
199
|
}
|
@@ -255,9 +256,10 @@ class DefinePlugin {
|
|
255
256
|
strCode
|
256
257
|
)(expr);
|
257
258
|
} else {
|
258
|
-
return ParserHelpers.toConstantDependency(
|
259
|
-
|
260
|
-
|
259
|
+
return ParserHelpers.toConstantDependency(
|
260
|
+
parser,
|
261
|
+
strCode
|
262
|
+
)(expr);
|
261
263
|
}
|
262
264
|
});
|
263
265
|
parser.hooks.typeof.for(key).tap("DefinePlugin", expr => {
|
@@ -6,6 +6,7 @@
|
|
6
6
|
|
7
7
|
const { RawSource } = require("webpack-sources");
|
8
8
|
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
|
9
|
+
const { absolutify } = require("./util/identifier");
|
9
10
|
|
10
11
|
const cache = new WeakMap();
|
11
12
|
|
@@ -60,7 +61,11 @@ class EvalSourceMapDevToolModuleTemplatePlugin {
|
|
60
61
|
obj[key] = sourceMap[key];
|
61
62
|
return obj;
|
62
63
|
}, {});
|
64
|
+
const context = this.compilation.compiler.options.context;
|
63
65
|
const modules = sourceMap.sources.map(source => {
|
66
|
+
if (source.startsWith("webpack://")) {
|
67
|
+
source = absolutify(context, source.slice(10));
|
68
|
+
}
|
64
69
|
const module = self.compilation.findModule(source);
|
65
70
|
return module || source;
|
66
71
|
});
|
@@ -7,14 +7,9 @@
|
|
7
7
|
const Queue = require("./util/Queue");
|
8
8
|
|
9
9
|
const addToSet = (a, b) => {
|
10
|
-
let changed = false;
|
11
10
|
for (const item of b) {
|
12
|
-
|
13
|
-
a.add(item);
|
14
|
-
changed = true;
|
15
|
-
}
|
11
|
+
a.add(item);
|
16
12
|
}
|
17
|
-
return changed;
|
18
13
|
};
|
19
14
|
|
20
15
|
class FlagDependencyExportsPlugin {
|
@@ -61,14 +56,11 @@ class FlagDependencyExportsPlugin {
|
|
61
56
|
// break if it should move to the worst state
|
62
57
|
if (exports === true) {
|
63
58
|
module.buildMeta.providedExports = true;
|
64
|
-
notifyDependencies();
|
65
59
|
return true;
|
66
60
|
}
|
67
61
|
// merge in new exports
|
68
62
|
if (Array.isArray(exports)) {
|
69
|
-
|
70
|
-
notifyDependencies();
|
71
|
-
}
|
63
|
+
addToSet(moduleProvidedExports, exports);
|
72
64
|
}
|
73
65
|
// store dependencies
|
74
66
|
const exportDeps = exportDesc.dependencies;
|
@@ -96,6 +88,26 @@ class FlagDependencyExportsPlugin {
|
|
96
88
|
}
|
97
89
|
};
|
98
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
|
+
|
99
111
|
// Start with all modules without provided exports
|
100
112
|
for (const module of modules) {
|
101
113
|
if (module.buildInfo.temporaryProvidedExports) {
|
@@ -114,18 +126,25 @@ class FlagDependencyExportsPlugin {
|
|
114
126
|
if (module.buildMeta.providedExports !== true) {
|
115
127
|
moduleWithExports =
|
116
128
|
module.buildMeta && module.buildMeta.exportsType;
|
117
|
-
moduleProvidedExports =
|
118
|
-
module.buildMeta.providedExports
|
119
|
-
)
|
120
|
-
? new Set(module.buildMeta.providedExports)
|
121
|
-
: new Set();
|
129
|
+
moduleProvidedExports = new Set();
|
122
130
|
providedExportsAreTemporary = false;
|
123
131
|
processDependenciesBlock(module);
|
124
132
|
module.buildInfo.temporaryProvidedExports = providedExportsAreTemporary;
|
125
133
|
if (!moduleWithExports) {
|
134
|
+
notifyDependencies();
|
126
135
|
module.buildMeta.providedExports = true;
|
136
|
+
} else if (module.buildMeta.providedExports === true) {
|
137
|
+
notifyDependencies();
|
138
|
+
} else if (!module.buildMeta.providedExports) {
|
127
139
|
notifyDependencies();
|
128
|
-
|
140
|
+
module.buildMeta.providedExports = Array.from(
|
141
|
+
moduleProvidedExports
|
142
|
+
);
|
143
|
+
} else {
|
144
|
+
notifyDependenciesIfDifferent(
|
145
|
+
moduleProvidedExports,
|
146
|
+
module.buildMeta.providedExports
|
147
|
+
);
|
129
148
|
module.buildMeta.providedExports = Array.from(
|
130
149
|
moduleProvidedExports
|
131
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
|
@@ -204,7 +214,6 @@ module.exports = function() {
|
|
204
214
|
/*foreachInstalledChunks*/
|
205
215
|
// eslint-disable-next-line no-lone-blocks
|
206
216
|
{
|
207
|
-
/*globals chunkId */
|
208
217
|
hotEnsureUpdateChunk(chunkId);
|
209
218
|
}
|
210
219
|
if (
|
package/lib/ProvidePlugin.js
CHANGED
@@ -62,9 +62,10 @@ class ProvidePlugin {
|
|
62
62
|
return false;
|
63
63
|
}
|
64
64
|
if (scopedName) {
|
65
|
-
ParserHelpers.toConstantDependency(
|
66
|
-
|
67
|
-
|
65
|
+
ParserHelpers.toConstantDependency(
|
66
|
+
parser,
|
67
|
+
nameIdentifier
|
68
|
+
)(expr);
|
68
69
|
}
|
69
70
|
return true;
|
70
71
|
});
|
@@ -9,6 +9,7 @@ const { ConcatSource, RawSource } = require("webpack-sources");
|
|
9
9
|
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
|
10
10
|
const SourceMapDevToolModuleOptionsPlugin = require("./SourceMapDevToolModuleOptionsPlugin");
|
11
11
|
const createHash = require("./util/createHash");
|
12
|
+
const { absolutify } = require("./util/identifier");
|
12
13
|
|
13
14
|
const validateOptions = require("schema-utils");
|
14
15
|
const schema = require("../schemas/plugins/SourceMapDevToolPlugin.json");
|
@@ -68,16 +69,24 @@ const getTaskForFile = (file, asset, chunk, options, compilation) => {
|
|
68
69
|
sourceMap = asset.map(options);
|
69
70
|
source = asset.source();
|
70
71
|
}
|
71
|
-
if (sourceMap)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
72
|
+
if (!sourceMap || typeof source !== "string") return;
|
73
|
+
const context = compilation.options.context;
|
74
|
+
const modules = sourceMap.sources.map(source => {
|
75
|
+
if (source.startsWith("webpack://")) {
|
76
|
+
source = absolutify(context, source.slice(10));
|
77
|
+
}
|
78
|
+
const module = compilation.findModule(source);
|
79
|
+
return module || source;
|
80
|
+
});
|
81
|
+
|
82
|
+
return {
|
83
|
+
chunk,
|
84
|
+
file,
|
85
|
+
asset,
|
86
|
+
source,
|
87
|
+
sourceMap,
|
88
|
+
modules
|
89
|
+
};
|
81
90
|
};
|
82
91
|
|
83
92
|
class SourceMapDevToolPlugin {
|
@@ -212,10 +221,7 @@ class SourceMapDevToolPlugin {
|
|
212
221
|
);
|
213
222
|
|
214
223
|
if (task) {
|
215
|
-
const modules = task.
|
216
|
-
const module = compilation.findModule(source);
|
217
|
-
return module || source;
|
218
|
-
});
|
224
|
+
const modules = task.modules;
|
219
225
|
|
220
226
|
for (let idx = 0; idx < modules.length; idx++) {
|
221
227
|
const module = modules[idx];
|
@@ -234,8 +240,6 @@ class SourceMapDevToolPlugin {
|
|
234
240
|
}
|
235
241
|
}
|
236
242
|
|
237
|
-
task.modules = modules;
|
238
|
-
|
239
243
|
tasks.push(task);
|
240
244
|
}
|
241
245
|
});
|
@@ -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
|
};
|
package/lib/logging/Logger.js
CHANGED
@@ -5,34 +5,31 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
-
/**
|
9
|
-
* @enum {string}
|
10
|
-
*/
|
11
8
|
const LogType = Object.freeze({
|
12
|
-
error: "error", // message, c style arguments
|
13
|
-
warn: "warn", // message, c style arguments
|
14
|
-
info: "info", // message, c style arguments
|
15
|
-
log: "log", // message, c style arguments
|
16
|
-
debug: "debug", // message, c style arguments
|
9
|
+
error: /** @type {"error"} */ ("error"), // message, c style arguments
|
10
|
+
warn: /** @type {"warn"} */ ("warn"), // message, c style arguments
|
11
|
+
info: /** @type {"info"} */ ("info"), // message, c style arguments
|
12
|
+
log: /** @type {"log"} */ ("log"), // message, c style arguments
|
13
|
+
debug: /** @type {"debug"} */ ("debug"), // message, c style arguments
|
17
14
|
|
18
|
-
trace: "trace", // no arguments
|
15
|
+
trace: /** @type {"trace"} */ ("trace"), // no arguments
|
19
16
|
|
20
|
-
group: "group", // [label]
|
21
|
-
groupCollapsed: "groupCollapsed", // [label]
|
22
|
-
groupEnd: "groupEnd", // [label]
|
17
|
+
group: /** @type {"group"} */ ("group"), // [label]
|
18
|
+
groupCollapsed: /** @type {"groupCollapsed"} */ ("groupCollapsed"), // [label]
|
19
|
+
groupEnd: /** @type {"groupEnd"} */ ("groupEnd"), // [label]
|
23
20
|
|
24
|
-
profile: "profile", // [profileName]
|
25
|
-
profileEnd: "profileEnd", // [profileName]
|
21
|
+
profile: /** @type {"profile"} */ ("profile"), // [profileName]
|
22
|
+
profileEnd: /** @type {"profileEnd"} */ ("profileEnd"), // [profileName]
|
26
23
|
|
27
|
-
time: "time", // name, time as [seconds, nanoseconds]
|
24
|
+
time: /** @type {"time"} */ ("time"), // name, time as [seconds, nanoseconds]
|
28
25
|
|
29
|
-
clear: "clear", // no arguments
|
30
|
-
status: "status" // message, arguments
|
26
|
+
clear: /** @type {"clear"} */ ("clear"), // no arguments
|
27
|
+
status: /** @type {"status"} */ ("status") // message, arguments
|
31
28
|
});
|
32
29
|
|
33
30
|
exports.LogType = LogType;
|
34
31
|
|
35
|
-
/** @typedef {keyof typeof LogType} LogTypeEnum */
|
32
|
+
/** @typedef {typeof LogType[keyof typeof LogType]} LogTypeEnum */
|
36
33
|
|
37
34
|
const LOG_SYMBOL = Symbol("webpack logger raw log method");
|
38
35
|
const TIMERS_SYMBOL = Symbol("webpack logger times");
|
@@ -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) {
|
@@ -330,6 +330,7 @@ class ConcatenatedModule extends Module {
|
|
330
330
|
);
|
331
331
|
|
332
332
|
this.dependencies = [];
|
333
|
+
this.blocks = [];
|
333
334
|
|
334
335
|
this.warnings = [];
|
335
336
|
this.errors = [];
|
@@ -348,6 +349,10 @@ class ConcatenatedModule extends Module {
|
|
348
349
|
)) {
|
349
350
|
this.dependencies.push(d);
|
350
351
|
}
|
352
|
+
// populate blocks
|
353
|
+
for (const d of m.blocks) {
|
354
|
+
this.blocks.push(d);
|
355
|
+
}
|
351
356
|
// populate file dependencies
|
352
357
|
if (m.buildInfo.fileDependencies) {
|
353
358
|
for (const file of m.buildInfo.fileDependencies) {
|
@@ -115,7 +115,7 @@ class SideEffectsFlagPlugin {
|
|
115
115
|
(dep instanceof HarmonyImportSpecifierDependency &&
|
116
116
|
!dep.namespaceObjectAsContext)
|
117
117
|
) {
|
118
|
-
const mapping = map.get(dep.
|
118
|
+
const mapping = map.get(dep._id);
|
119
119
|
if (mapping) {
|
120
120
|
dep.redirectedModule = mapping.module;
|
121
121
|
dep.redirectedId = mapping.exportName;
|
package/lib/util/identifier.js
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
const path = require("path");
|
3
3
|
|
4
|
+
/**
|
5
|
+
* @param {string} context context for relative path
|
6
|
+
* @param {string} relativePath path
|
7
|
+
* @returns {string} absolute path
|
8
|
+
*/
|
9
|
+
const requestToAbsolute = (context, relativePath) => {
|
10
|
+
if (relativePath.startsWith("./") || relativePath.startsWith("../"))
|
11
|
+
return path.join(context, relativePath);
|
12
|
+
return relativePath;
|
13
|
+
};
|
14
|
+
|
4
15
|
/**
|
5
16
|
* @typedef {Object} MakeRelativePathsCache
|
6
17
|
* @property {Map<string, Map<string, string>>=} relativePaths
|
@@ -100,3 +111,17 @@ exports.contextify = (context, request) => {
|
|
100
111
|
})
|
101
112
|
.join("!");
|
102
113
|
};
|
114
|
+
|
115
|
+
/**
|
116
|
+
* @param {string} context absolute context path
|
117
|
+
* @param {string} request any request string
|
118
|
+
* @returns {string} a new request string using absolute paths when possible
|
119
|
+
*/
|
120
|
+
const _absolutify = (context, request) => {
|
121
|
+
return request
|
122
|
+
.split("!")
|
123
|
+
.map(r => requestToAbsolute(context, r))
|
124
|
+
.join("!");
|
125
|
+
};
|
126
|
+
|
127
|
+
exports.absolutify = _absolutify;
|
@@ -5,15 +5,16 @@
|
|
5
5
|
"use strict";
|
6
6
|
|
7
7
|
const Generator = require("../Generator");
|
8
|
-
const WebAssemblyParser = require("./WebAssemblyParser");
|
9
|
-
const WebAssemblyGenerator = require("./WebAssemblyGenerator");
|
10
|
-
const WebAssemblyJavascriptGenerator = require("./WebAssemblyJavascriptGenerator");
|
11
|
-
const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
|
12
8
|
const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency");
|
9
|
+
const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
|
13
10
|
const WebAssemblyInInitialChunkError = require("./WebAssemblyInInitialChunkError");
|
14
11
|
|
15
12
|
/** @typedef {import("../Compiler")} Compiler */
|
16
13
|
|
14
|
+
let WebAssemblyGenerator;
|
15
|
+
let WebAssemblyJavascriptGenerator;
|
16
|
+
let WebAssemblyParser;
|
17
|
+
|
17
18
|
class WebAssemblyModulesPlugin {
|
18
19
|
constructor(options) {
|
19
20
|
this.options = options;
|
@@ -40,12 +41,21 @@ class WebAssemblyModulesPlugin {
|
|
40
41
|
normalModuleFactory.hooks.createParser
|
41
42
|
.for("webassembly/experimental")
|
42
43
|
.tap("WebAssemblyModulesPlugin", () => {
|
44
|
+
if (WebAssemblyParser === undefined) {
|
45
|
+
WebAssemblyParser = require("./WebAssemblyParser");
|
46
|
+
}
|
43
47
|
return new WebAssemblyParser();
|
44
48
|
});
|
45
49
|
|
46
50
|
normalModuleFactory.hooks.createGenerator
|
47
51
|
.for("webassembly/experimental")
|
48
52
|
.tap("WebAssemblyModulesPlugin", () => {
|
53
|
+
if (WebAssemblyGenerator === undefined) {
|
54
|
+
WebAssemblyGenerator = require("./WebAssemblyGenerator");
|
55
|
+
}
|
56
|
+
if (WebAssemblyJavascriptGenerator === undefined) {
|
57
|
+
WebAssemblyJavascriptGenerator = require("./WebAssemblyJavascriptGenerator");
|
58
|
+
}
|
49
59
|
return Generator.byType({
|
50
60
|
javascript: new WebAssemblyJavascriptGenerator(),
|
51
61
|
webassembly: new WebAssemblyGenerator(this.options)
|
@@ -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,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "4.41.
|
3
|
+
"version": "4.41.6",
|
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",
|
@@ -25,15 +25,17 @@
|
|
25
25
|
"node-libs-browser": "^2.2.1",
|
26
26
|
"schema-utils": "^1.0.0",
|
27
27
|
"tapable": "^1.1.3",
|
28
|
-
"terser-webpack-plugin": "^1.4.
|
28
|
+
"terser-webpack-plugin": "^1.4.3",
|
29
29
|
"watchpack": "^1.6.0",
|
30
30
|
"webpack-sources": "^1.4.1"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
33
|
+
"@babel/core": "^7.7.2",
|
33
34
|
"@types/node": "^10.12.21",
|
34
35
|
"@types/tapable": "^1.0.1",
|
35
36
|
"@types/webpack-sources": "^0.1.4",
|
36
37
|
"@yarnpkg/lockfile": "^1.1.0",
|
38
|
+
"babel-loader": "^8.0.6",
|
37
39
|
"benchmark": "^2.1.1",
|
38
40
|
"bundle-loader": "~0.5.0",
|
39
41
|
"coffee-loader": "^0.9.0",
|
@@ -88,6 +90,10 @@
|
|
88
90
|
"type": "git",
|
89
91
|
"url": "https://github.com/webpack/webpack.git"
|
90
92
|
},
|
93
|
+
"funding": {
|
94
|
+
"type": "opencollective",
|
95
|
+
"url": "https://opencollective.com/webpack"
|
96
|
+
},
|
91
97
|
"homepage": "https://github.com/webpack/webpack",
|
92
98
|
"main": "lib/webpack.js",
|
93
99
|
"web": "lib/webpack.web.js",
|
@@ -1428,8 +1428,7 @@
|
|
1428
1428
|
"$ref": "#/definitions/RuleSetCondition"
|
1429
1429
|
}
|
1430
1430
|
]
|
1431
|
-
}
|
1432
|
-
"tsType": "RuleSetConditionsRecursive"
|
1431
|
+
}
|
1433
1432
|
},
|
1434
1433
|
"RuleSetConditionsAbsolute": {
|
1435
1434
|
"type": "array",
|
@@ -1440,8 +1439,7 @@
|
|
1440
1439
|
"$ref": "#/definitions/RuleSetConditionAbsolute"
|
1441
1440
|
}
|
1442
1441
|
]
|
1443
|
-
}
|
1444
|
-
"tsType": "RuleSetConditionsAbsoluteRecursive"
|
1442
|
+
}
|
1445
1443
|
},
|
1446
1444
|
"RuleSetLoader": {
|
1447
1445
|
"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
|
}
|