webpack 4.29.1 → 4.29.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/bin/webpack.js +3 -0
- package/declarations/WebpackOptions.d.ts +1 -1
- package/declarations/plugins/BannerPlugin.d.ts +7 -9
- package/declarations/plugins/IgnorePlugin.d.ts +2 -2
- package/declarations/plugins/ProgressPlugin.d.ts +2 -2
- package/lib/AmdMainTemplatePlugin.js +2 -2
- package/lib/ContextModule.js +67 -39
- package/lib/JsonGenerator.js +2 -3
- package/lib/Parser.js +2 -2
- package/lib/Stats.js +2 -2
- package/lib/UmdMainTemplatePlugin.js +6 -6
- package/lib/WatchIgnorePlugin.js +2 -2
- package/lib/WebpackError.js +3 -1
- package/lib/WebpackOptionsApply.js +8 -8
- package/lib/WebpackOptionsDefaulter.js +4 -8
- package/lib/optimize/SideEffectsFlagPlugin.js +1 -1
- package/lib/optimize/SplitChunksPlugin.js +15 -15
- package/lib/util/StackedSetMap.js +4 -6
- package/lib/util/deterministicGrouping.js +2 -2
- package/lib/util/identifier.js +4 -5
- package/lib/wasm/WebAssemblyGenerator.js +11 -3
- package/package.json +25 -26
package/bin/webpack.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
|
3
|
+
// @ts-ignore
|
3
4
|
process.exitCode = 0;
|
4
5
|
|
5
6
|
/**
|
@@ -164,5 +165,7 @@ if (installedClis.length === 0) {
|
|
164
165
|
" and "
|
165
166
|
)} together. To work with the "webpack" command you need only one CLI package, please remove one of them or use them directly via their binary.`
|
166
167
|
);
|
168
|
+
|
169
|
+
// @ts-ignore
|
167
170
|
process.exitCode = 1;
|
168
171
|
}
|
@@ -15,7 +15,7 @@ export type Entry = EntryDynamic | EntryStatic;
|
|
15
15
|
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
16
16
|
* via the `definition` "EntryDynamic".
|
17
17
|
*/
|
18
|
-
export type EntryDynamic = (
|
18
|
+
export type EntryDynamic = () => EntryStatic | Promise<EntryStatic>;
|
19
19
|
/**
|
20
20
|
* This interface was referenced by `WebpackOptions`'s JSON-Schema
|
21
21
|
* via the `definition` "EntryStatic".
|
@@ -11,15 +11,13 @@ export type BannerPluginArgument =
|
|
11
11
|
/**
|
12
12
|
* The banner as function, it will be wrapped in a comment
|
13
13
|
*/
|
14
|
-
export type BannerFunction = (
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
) => string;
|
14
|
+
export type BannerFunction = (data: {
|
15
|
+
hash: string;
|
16
|
+
chunk: import("../../lib/Chunk");
|
17
|
+
filename: string;
|
18
|
+
basename: string;
|
19
|
+
query: string;
|
20
|
+
}) => string;
|
23
21
|
export type Rules = Rule[] | Rule;
|
24
22
|
export type Rule = RegExp | string;
|
25
23
|
|
@@ -19,9 +19,9 @@ export type IgnorePluginOptions =
|
|
19
19
|
/**
|
20
20
|
* A filter function for context
|
21
21
|
*/
|
22
|
-
checkContext?: (
|
22
|
+
checkContext?: (context: string) => boolean;
|
23
23
|
/**
|
24
24
|
* A filter function for resource and context
|
25
25
|
*/
|
26
|
-
checkResource?: (
|
26
|
+
checkResource?: (resource: string, context: string) => boolean;
|
27
27
|
};
|
@@ -8,11 +8,11 @@ export type ProgressPluginArgument = ProgressPluginOptions | HandlerFunction;
|
|
8
8
|
/**
|
9
9
|
* Function that executes for every progress step
|
10
10
|
*/
|
11
|
-
export type HandlerFunction = (
|
11
|
+
export type HandlerFunction = (
|
12
12
|
percentage: number,
|
13
13
|
msg: string,
|
14
14
|
...args: string[]
|
15
|
-
) => void
|
15
|
+
) => void;
|
16
16
|
|
17
17
|
export interface ProgressPluginOptions {
|
18
18
|
/**
|
@@ -40,8 +40,8 @@ class AmdMainTemplatePlugin {
|
|
40
40
|
const onRenderWithEntry = (source, chunk, hash) => {
|
41
41
|
const externals = chunk.getModules().filter(m => m.external);
|
42
42
|
const externalsDepsArray = JSON.stringify(
|
43
|
-
externals.map(
|
44
|
-
|
43
|
+
externals.map(m =>
|
44
|
+
typeof m.request === "object" ? m.request.amd : m.request
|
45
45
|
)
|
46
46
|
);
|
47
47
|
const externalsArguments = externals
|
package/lib/ContextModule.js
CHANGED
@@ -380,13 +380,12 @@ function webpackContext(req) {
|
|
380
380
|
${returnModuleObject}
|
381
381
|
}
|
382
382
|
function webpackContextResolve(req) {
|
383
|
-
|
384
|
-
if(!(id + 1)) { // check for number or string
|
383
|
+
if(!__webpack_require__.o(map, req)) {
|
385
384
|
var e = new Error("Cannot find module '" + req + "'");
|
386
385
|
e.code = 'MODULE_NOT_FOUND';
|
387
386
|
throw e;
|
388
387
|
}
|
389
|
-
return
|
388
|
+
return map[req];
|
390
389
|
}
|
391
390
|
webpackContext.keys = function webpackContextKeys() {
|
392
391
|
return Object.keys(map);
|
@@ -414,13 +413,12 @@ function webpackContext(req) {
|
|
414
413
|
${returnModuleObject}
|
415
414
|
}
|
416
415
|
function webpackContextResolve(req) {
|
417
|
-
|
418
|
-
if(!(id + 1)) { // check for number or string
|
416
|
+
if(!__webpack_require__.o(map, req)) {
|
419
417
|
var e = new Error("Cannot find module '" + req + "'");
|
420
418
|
e.code = 'MODULE_NOT_FOUND';
|
421
419
|
throw e;
|
422
420
|
}
|
423
|
-
return
|
421
|
+
return map[req];
|
424
422
|
}
|
425
423
|
webpackContext.keys = function webpackContextKeys() {
|
426
424
|
return Object.keys(map);
|
@@ -452,13 +450,12 @@ function webpackAsyncContextResolve(req) {
|
|
452
450
|
// Here Promise.resolve().then() is used instead of new Promise() to prevent
|
453
451
|
// uncaught exception popping up in devtools
|
454
452
|
return Promise.resolve().then(function() {
|
455
|
-
|
456
|
-
if(!(id + 1)) { // check for number or string
|
453
|
+
if(!__webpack_require__.o(map, req)) {
|
457
454
|
var e = new Error("Cannot find module '" + req + "'");
|
458
455
|
e.code = 'MODULE_NOT_FOUND';
|
459
456
|
throw e;
|
460
457
|
}
|
461
|
-
return
|
458
|
+
return map[req];
|
462
459
|
});
|
463
460
|
}
|
464
461
|
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
@@ -488,13 +485,12 @@ function webpackAsyncContextResolve(req) {
|
|
488
485
|
// Here Promise.resolve().then() is used instead of new Promise() to prevent
|
489
486
|
// uncaught exception popping up in devtools
|
490
487
|
return Promise.resolve().then(function() {
|
491
|
-
|
492
|
-
if(!(id + 1)) { // check for number or string
|
488
|
+
if(!__webpack_require__.o(map, req)) {
|
493
489
|
var e = new Error("Cannot find module '" + req + "'");
|
494
490
|
e.code = 'MODULE_NOT_FOUND';
|
495
491
|
throw e;
|
496
492
|
}
|
497
|
-
return
|
493
|
+
return map[req];
|
498
494
|
});
|
499
495
|
}
|
500
496
|
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
@@ -527,13 +523,12 @@ function webpackAsyncContext(req) {
|
|
527
523
|
}
|
528
524
|
function webpackAsyncContextResolve(req) {
|
529
525
|
return ${promise}.then(function() {
|
530
|
-
|
531
|
-
if(!(id + 1)) { // check for number or string
|
526
|
+
if(!__webpack_require__.o(map, req)) {
|
532
527
|
var e = new Error("Cannot find module '" + req + "'");
|
533
528
|
e.code = 'MODULE_NOT_FOUND';
|
534
529
|
throw e;
|
535
530
|
}
|
536
|
-
return
|
531
|
+
return map[req];
|
537
532
|
});
|
538
533
|
}
|
539
534
|
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
@@ -546,59 +541,92 @@ module.exports = webpackAsyncContext;`;
|
|
546
541
|
|
547
542
|
getLazySource(blocks, id) {
|
548
543
|
let hasMultipleOrNoChunks = false;
|
544
|
+
let hasNoChunk = true;
|
549
545
|
const fakeMap = this.getFakeMap(blocks.map(b => b.dependencies[0]));
|
546
|
+
const hasFakeMap = typeof fakeMap === "object";
|
550
547
|
const map = blocks
|
551
548
|
.filter(block => block.dependencies[0].module)
|
552
|
-
.map(block =>
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
549
|
+
.map(block => {
|
550
|
+
const chunks = block.chunkGroup ? block.chunkGroup.chunks : [];
|
551
|
+
if (chunks.length > 0) {
|
552
|
+
hasNoChunk = false;
|
553
|
+
}
|
554
|
+
if (chunks.length !== 1) {
|
555
|
+
hasMultipleOrNoChunks = true;
|
556
|
+
}
|
557
|
+
return {
|
558
|
+
dependency: block.dependencies[0],
|
559
|
+
block: block,
|
560
|
+
userRequest: block.dependencies[0].userRequest,
|
561
|
+
chunks
|
562
|
+
};
|
563
|
+
})
|
557
564
|
.sort((a, b) => {
|
558
565
|
if (a.userRequest === b.userRequest) return 0;
|
559
566
|
return a.userRequest < b.userRequest ? -1 : 1;
|
560
567
|
})
|
561
568
|
.reduce((map, item) => {
|
562
|
-
const chunks =
|
563
|
-
|
564
|
-
if (
|
565
|
-
|
566
|
-
}
|
567
|
-
|
568
|
-
|
569
|
-
|
569
|
+
const chunks = item.chunks;
|
570
|
+
|
571
|
+
if (hasNoChunk && !hasFakeMap) {
|
572
|
+
map[item.userRequest] = item.dependency.module.id;
|
573
|
+
} else {
|
574
|
+
const arrayStart = [item.dependency.module.id];
|
575
|
+
if (typeof fakeMap === "object") {
|
576
|
+
arrayStart.push(fakeMap[item.dependency.module.id]);
|
577
|
+
}
|
578
|
+
map[item.userRequest] = arrayStart.concat(
|
579
|
+
chunks.map(chunk => chunk.id)
|
580
|
+
);
|
570
581
|
}
|
571
|
-
map[item.userRequest] = arrayStart.concat(
|
572
|
-
chunks.map(chunk => chunk.id)
|
573
|
-
);
|
574
582
|
|
575
583
|
return map;
|
576
584
|
}, Object.create(null));
|
577
585
|
|
578
|
-
const
|
579
|
-
const
|
586
|
+
const shortMode = hasNoChunk && !hasFakeMap;
|
587
|
+
const chunksStartPosition = hasFakeMap ? 2 : 1;
|
588
|
+
const requestPrefix = hasNoChunk
|
589
|
+
? "Promise.resolve()"
|
590
|
+
: hasMultipleOrNoChunks
|
580
591
|
? `Promise.all(ids.slice(${chunksStartPosition}).map(__webpack_require__.e))`
|
581
592
|
: `__webpack_require__.e(ids[${chunksStartPosition}])`;
|
582
593
|
const returnModuleObject = this.getReturnModuleObjectSource(
|
583
594
|
fakeMap,
|
584
|
-
"ids[1]"
|
595
|
+
shortMode ? "invalid" : "ids[1]"
|
585
596
|
);
|
586
597
|
|
587
|
-
|
598
|
+
const webpackAsyncContext =
|
599
|
+
requestPrefix === "Promise.resolve()"
|
600
|
+
? `${shortMode ? "" : ""}
|
588
601
|
function webpackAsyncContext(req) {
|
589
|
-
|
590
|
-
|
602
|
+
return Promise.resolve().then(function() {
|
603
|
+
if(!__webpack_require__.o(map, req)) {
|
604
|
+
var e = new Error("Cannot find module '" + req + "'");
|
605
|
+
e.code = 'MODULE_NOT_FOUND';
|
606
|
+
throw e;
|
607
|
+
}
|
608
|
+
|
609
|
+
${shortMode ? "var id = map[req];" : "var ids = map[req], id = ids[0];"}
|
610
|
+
${returnModuleObject}
|
611
|
+
});
|
612
|
+
}`
|
613
|
+
: `function webpackAsyncContext(req) {
|
614
|
+
if(!__webpack_require__.o(map, req)) {
|
591
615
|
return Promise.resolve().then(function() {
|
592
616
|
var e = new Error("Cannot find module '" + req + "'");
|
593
617
|
e.code = 'MODULE_NOT_FOUND';
|
594
618
|
throw e;
|
595
619
|
});
|
596
620
|
}
|
621
|
+
|
622
|
+
var ids = map[req], id = ids[0];
|
597
623
|
return ${requestPrefix}.then(function() {
|
598
|
-
var id = ids[0];
|
599
624
|
${returnModuleObject}
|
600
625
|
});
|
601
|
-
}
|
626
|
+
}`;
|
627
|
+
|
628
|
+
return `var map = ${JSON.stringify(map, null, "\t")};
|
629
|
+
${webpackAsyncContext}
|
602
630
|
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
603
631
|
return Object.keys(map);
|
604
632
|
};
|
package/lib/JsonGenerator.js
CHANGED
@@ -12,9 +12,8 @@ const stringifySafe = data => {
|
|
12
12
|
return undefined; // Invalid JSON
|
13
13
|
}
|
14
14
|
|
15
|
-
return stringified.replace(
|
16
|
-
|
17
|
-
str => (str === "\u2029" ? "\\u2029" : "\\u2028")
|
15
|
+
return stringified.replace(/\u2028|\u2029/g, str =>
|
16
|
+
str === "\u2029" ? "\\u2029" : "\\u2028"
|
18
17
|
); // invalid in JavaScript but valid JSON
|
19
18
|
};
|
20
19
|
|
package/lib/Parser.js
CHANGED
@@ -1335,8 +1335,8 @@ class Parser extends Tapable {
|
|
1335
1335
|
statement.kind === "const"
|
1336
1336
|
? this.hooks.varDeclarationConst
|
1337
1337
|
: statement.kind === "let"
|
1338
|
-
|
1339
|
-
|
1338
|
+
? this.hooks.varDeclarationLet
|
1339
|
+
: this.hooks.varDeclarationVar;
|
1340
1340
|
for (const declarator of statement.declarations) {
|
1341
1341
|
switch (declarator.type) {
|
1342
1342
|
case "VariableDeclarator": {
|
package/lib/Stats.js
CHANGED
@@ -236,12 +236,12 @@ class UmdMainTemplatePlugin {
|
|
236
236
|
amdFactory +
|
237
237
|
");\n"
|
238
238
|
: this.names.amd && this.namedDefine === true
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
239
|
+
? " define(" +
|
240
|
+
libraryName(this.names.amd) +
|
241
|
+
", [], " +
|
242
|
+
amdFactory +
|
243
|
+
");\n"
|
244
|
+
: " define([], " + amdFactory + ");\n") +
|
245
245
|
(this.names.root || this.names.commonjs
|
246
246
|
? getAuxilaryComment("commonjs") +
|
247
247
|
" else if(typeof exports === 'object')\n" +
|
package/lib/WatchIgnorePlugin.js
CHANGED
@@ -17,8 +17,8 @@ class IgnoringWatchFileSystem {
|
|
17
17
|
|
18
18
|
watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) {
|
19
19
|
const ignored = path =>
|
20
|
-
this.paths.some(
|
21
|
-
p
|
20
|
+
this.paths.some(p =>
|
21
|
+
p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0
|
22
22
|
);
|
23
23
|
|
24
24
|
const notIgnored = path => !ignored(path);
|
package/lib/WebpackError.js
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
*/
|
5
5
|
"use strict";
|
6
6
|
|
7
|
+
const inspect = require("util").inspect.custom;
|
8
|
+
|
7
9
|
class WebpackError extends Error {
|
8
10
|
/**
|
9
11
|
* Creates an instance of WebpackError.
|
@@ -21,7 +23,7 @@ class WebpackError extends Error {
|
|
21
23
|
Error.captureStackTrace(this, this.constructor);
|
22
24
|
}
|
23
25
|
|
24
|
-
inspect() {
|
26
|
+
[inspect]() {
|
25
27
|
return this.stack + (this.details ? `\n${this.details}` : "");
|
26
28
|
}
|
27
29
|
}
|
@@ -260,10 +260,10 @@ class WebpackOptionsApply extends OptionsApply {
|
|
260
260
|
"MappingURL=[url]\n//# source" +
|
261
261
|
"MappingURL=[url]\n*/"
|
262
262
|
: legacy
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
263
|
+
? "\n/*\n//@ source" + "MappingURL=[url]\n*/"
|
264
|
+
: modern
|
265
|
+
? "\n//# source" + "MappingURL=[url]"
|
266
|
+
: null;
|
267
267
|
const Plugin = evalWrapped
|
268
268
|
? EvalSourceMapDevToolPlugin
|
269
269
|
: SourceMapDevToolPlugin;
|
@@ -286,10 +286,10 @@ class WebpackOptionsApply extends OptionsApply {
|
|
286
286
|
legacy && modern
|
287
287
|
? "\n//@ sourceURL=[url]\n//# sourceURL=[url]"
|
288
288
|
: legacy
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
289
|
+
? "\n//@ sourceURL=[url]"
|
290
|
+
: modern
|
291
|
+
? "\n//# sourceURL=[url]"
|
292
|
+
: null;
|
293
293
|
new EvalDevToolModulePlugin({
|
294
294
|
sourceUrlComment: comment,
|
295
295
|
moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
|
@@ -33,10 +33,8 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
|
|
33
33
|
|
34
34
|
this.set("entry", "./src");
|
35
35
|
|
36
|
-
this.set(
|
37
|
-
"
|
38
|
-
"make",
|
39
|
-
options => (options.mode === "development" ? "eval" : false)
|
36
|
+
this.set("devtool", "make", options =>
|
37
|
+
options.mode === "development" ? "eval" : false
|
40
38
|
);
|
41
39
|
this.set("cache", "make", options => options.mode === "development");
|
42
40
|
|
@@ -193,10 +191,8 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
|
|
193
191
|
});
|
194
192
|
this.set("performance.maxAssetSize", 250000);
|
195
193
|
this.set("performance.maxEntrypointSize", 250000);
|
196
|
-
this.set(
|
197
|
-
"
|
198
|
-
"make",
|
199
|
-
options => (isProductionLikeMode(options) ? "warning" : false)
|
194
|
+
this.set("performance.hints", "make", options =>
|
195
|
+
isProductionLikeMode(options) ? "warning" : false
|
200
196
|
);
|
201
197
|
|
202
198
|
this.set("optimization", "call", value => Object.assign({}, value));
|
@@ -123,7 +123,7 @@ class SideEffectsFlagPlugin {
|
|
123
123
|
dep,
|
124
124
|
reason.explanation
|
125
125
|
? reason.explanation +
|
126
|
-
|
126
|
+
" (skipped side-effect-free modules)"
|
127
127
|
: "(skipped side-effect-free modules)"
|
128
128
|
);
|
129
129
|
// removing the currect reason, by not adding it to the newReasons array
|
@@ -534,8 +534,8 @@ module.exports = class SplitChunksPlugin {
|
|
534
534
|
cacheGroupSource.minSize !== undefined
|
535
535
|
? cacheGroupSource.minSize
|
536
536
|
: cacheGroupSource.enforce
|
537
|
-
|
538
|
-
|
537
|
+
? 0
|
538
|
+
: this.options.minSize,
|
539
539
|
minSizeForMaxSize:
|
540
540
|
cacheGroupSource.minSize !== undefined
|
541
541
|
? cacheGroupSource.minSize
|
@@ -544,26 +544,26 @@ module.exports = class SplitChunksPlugin {
|
|
544
544
|
cacheGroupSource.maxSize !== undefined
|
545
545
|
? cacheGroupSource.maxSize
|
546
546
|
: cacheGroupSource.enforce
|
547
|
-
|
548
|
-
|
547
|
+
? 0
|
548
|
+
: this.options.maxSize,
|
549
549
|
minChunks:
|
550
550
|
cacheGroupSource.minChunks !== undefined
|
551
551
|
? cacheGroupSource.minChunks
|
552
552
|
: cacheGroupSource.enforce
|
553
|
-
|
554
|
-
|
553
|
+
? 1
|
554
|
+
: this.options.minChunks,
|
555
555
|
maxAsyncRequests:
|
556
556
|
cacheGroupSource.maxAsyncRequests !== undefined
|
557
557
|
? cacheGroupSource.maxAsyncRequests
|
558
558
|
: cacheGroupSource.enforce
|
559
|
-
|
560
|
-
|
559
|
+
? Infinity
|
560
|
+
: this.options.maxAsyncRequests,
|
561
561
|
maxInitialRequests:
|
562
562
|
cacheGroupSource.maxInitialRequests !== undefined
|
563
563
|
? cacheGroupSource.maxInitialRequests
|
564
564
|
: cacheGroupSource.enforce
|
565
|
-
|
566
|
-
|
565
|
+
? Infinity
|
566
|
+
: this.options.maxInitialRequests,
|
567
567
|
getName:
|
568
568
|
cacheGroupSource.getName !== undefined
|
569
569
|
? cacheGroupSource.getName
|
@@ -683,11 +683,11 @@ module.exports = class SplitChunksPlugin {
|
|
683
683
|
const maxRequests = chunk.isOnlyInitial()
|
684
684
|
? item.cacheGroup.maxInitialRequests
|
685
685
|
: chunk.canBeInitial()
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
686
|
+
? Math.min(
|
687
|
+
item.cacheGroup.maxInitialRequests,
|
688
|
+
item.cacheGroup.maxAsyncRequests
|
689
|
+
)
|
690
|
+
: item.cacheGroup.maxAsyncRequests;
|
691
691
|
return (
|
692
692
|
!isFinite(maxRequests) || getRequests(chunk) < maxRequests
|
693
693
|
);
|
@@ -96,12 +96,10 @@ class StackedSetMap {
|
|
96
96
|
|
97
97
|
asPairArray() {
|
98
98
|
this._compress();
|
99
|
-
return Array.from(
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
? [pair[0], undefined]
|
104
|
-
: pair)
|
99
|
+
return Array.from(this.map.entries(), pair =>
|
100
|
+
/** @type {[TODO, TODO]} */ (pair[1] === UNDEFINED_MARKER
|
101
|
+
? [pair[0], undefined]
|
102
|
+
: pair)
|
105
103
|
);
|
106
104
|
}
|
107
105
|
|
@@ -156,8 +156,8 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|
156
156
|
// We hit an edgecase where the working set is already smaller than minSize
|
157
157
|
// We merge it with the smallest result node to keep minSize intact
|
158
158
|
if (result.length > 0) {
|
159
|
-
const smallestGroup = result.reduce(
|
160
|
-
|
159
|
+
const smallestGroup = result.reduce((min, group) =>
|
160
|
+
min.size > group.size ? group : min
|
161
161
|
);
|
162
162
|
for (const node of initialGroup.nodes) smallestGroup.nodes.push(node);
|
163
163
|
smallestGroup.nodes.sort((a, b) => {
|
package/lib/util/identifier.js
CHANGED
@@ -36,11 +36,10 @@ const normalizePathSeparator = p => p.replace(/\\/g, "/");
|
|
36
36
|
const _makePathsRelative = (context, identifier) => {
|
37
37
|
return identifier
|
38
38
|
.split(/([|! ])/)
|
39
|
-
.map(
|
40
|
-
str
|
41
|
-
|
42
|
-
|
43
|
-
: str
|
39
|
+
.map(str =>
|
40
|
+
looksLikeAbsolutePath(str)
|
41
|
+
? normalizePathSeparator(path.relative(context, str))
|
42
|
+
: str
|
44
43
|
)
|
45
44
|
.join("");
|
46
45
|
};
|
@@ -177,9 +177,12 @@ const rewriteImportedGlobals = state => bin => {
|
|
177
177
|
|
178
178
|
globalType.mutability = "var";
|
179
179
|
|
180
|
-
const init =
|
180
|
+
const init = [
|
181
|
+
createDefaultInitForGlobal(globalType),
|
182
|
+
t.instruction("end")
|
183
|
+
];
|
181
184
|
|
182
|
-
newGlobals.push(t.global(globalType,
|
185
|
+
newGlobals.push(t.global(globalType, init));
|
183
186
|
|
184
187
|
path.remove();
|
185
188
|
}
|
@@ -196,7 +199,10 @@ const rewriteImportedGlobals = state => bin => {
|
|
196
199
|
|
197
200
|
const initialGlobalidx = init.args[0];
|
198
201
|
|
199
|
-
node.init = [
|
202
|
+
node.init = [
|
203
|
+
createDefaultInitForGlobal(node.globalType),
|
204
|
+
t.instruction("end")
|
205
|
+
];
|
200
206
|
|
201
207
|
additionalInitCode.push(
|
202
208
|
/**
|
@@ -316,6 +322,8 @@ const addInitFunction = ({
|
|
316
322
|
funcBody.push(instr);
|
317
323
|
}
|
318
324
|
|
325
|
+
funcBody.push(t.instruction("end"));
|
326
|
+
|
319
327
|
const funcResults = [];
|
320
328
|
|
321
329
|
// Code section
|
package/package.json
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "4.29.
|
3
|
+
"version": "4.29.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",
|
7
7
|
"dependencies": {
|
8
|
-
"@webassemblyjs/ast": "1.
|
9
|
-
"@webassemblyjs/helper-module-context": "1.
|
10
|
-
"@webassemblyjs/wasm-edit": "1.
|
11
|
-
"@webassemblyjs/wasm-parser": "1.
|
8
|
+
"@webassemblyjs/ast": "1.8.3",
|
9
|
+
"@webassemblyjs/helper-module-context": "1.8.3",
|
10
|
+
"@webassemblyjs/wasm-edit": "1.8.3",
|
11
|
+
"@webassemblyjs/wasm-parser": "1.8.3",
|
12
12
|
"acorn": "^6.0.5",
|
13
13
|
"acorn-dynamic-import": "^4.0.0",
|
14
14
|
"ajv": "^6.1.0",
|
@@ -24,62 +24,61 @@
|
|
24
24
|
"mkdirp": "~0.5.0",
|
25
25
|
"neo-async": "^2.5.0",
|
26
26
|
"node-libs-browser": "^2.0.0",
|
27
|
-
"schema-utils": "^0.
|
27
|
+
"schema-utils": "^1.0.0",
|
28
28
|
"tapable": "^1.1.0",
|
29
29
|
"terser-webpack-plugin": "^1.1.0",
|
30
30
|
"watchpack": "^1.5.0",
|
31
31
|
"webpack-sources": "^1.3.0"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
|
-
"@types/node": "^
|
34
|
+
"@types/node": "^10.12.21",
|
35
35
|
"@types/tapable": "^1.0.1",
|
36
36
|
"@types/webpack-sources": "^0.1.4",
|
37
37
|
"benchmark": "^2.1.1",
|
38
38
|
"bundle-loader": "~0.5.0",
|
39
|
-
"codacy-coverage": "^2.0.1",
|
40
39
|
"coffee-loader": "^0.9.0",
|
41
|
-
"coffeescript": "^
|
40
|
+
"coffeescript": "^2.3.2",
|
42
41
|
"coveralls": "^3.0.2",
|
43
|
-
"css-loader": "^
|
42
|
+
"css-loader": "^2.1.0",
|
44
43
|
"es6-promise-polyfill": "^1.1.1",
|
45
44
|
"eslint": "^5.8.0",
|
46
|
-
"eslint-config-prettier": "^
|
47
|
-
"eslint-plugin-jest": "^
|
45
|
+
"eslint-config-prettier": "^4.0.0",
|
46
|
+
"eslint-plugin-jest": "^22.2.2",
|
48
47
|
"eslint-plugin-node": "^8.0.0",
|
49
48
|
"eslint-plugin-prettier": "^3.0.0",
|
50
|
-
"express": "~4.
|
51
|
-
"file-loader": "^
|
49
|
+
"express": "~4.16.4",
|
50
|
+
"file-loader": "^3.0.1",
|
52
51
|
"glob": "^7.1.3",
|
53
52
|
"husky": "^1.1.3",
|
54
53
|
"i18n-webpack-plugin": "^1.0.0",
|
55
54
|
"istanbul": "^0.4.5",
|
56
55
|
"jade": "^1.11.0",
|
57
56
|
"jade-loader": "~0.8.0",
|
58
|
-
"jest": "24.
|
59
|
-
"jest-junit": "^
|
57
|
+
"jest": "24.1.0",
|
58
|
+
"jest-junit": "^6.2.1",
|
60
59
|
"json-loader": "^0.5.7",
|
61
60
|
"json-schema-to-typescript": "^6.0.1",
|
62
|
-
"less": "^
|
61
|
+
"less": "^3.9.0",
|
63
62
|
"less-loader": "^4.0.3",
|
64
63
|
"lint-staged": "^8.0.4",
|
65
64
|
"lodash": "^4.17.4",
|
66
65
|
"prettier": "^1.14.3",
|
67
66
|
"pug": "^2.0.3",
|
68
67
|
"pug-loader": "^2.4.0",
|
69
|
-
"raw-loader": "
|
70
|
-
"react": "^
|
71
|
-
"react-dom": "^
|
68
|
+
"raw-loader": "^1.0.0",
|
69
|
+
"react": "^16.8.0",
|
70
|
+
"react-dom": "^16.8.0",
|
72
71
|
"rimraf": "^2.6.2",
|
73
72
|
"script-loader": "~0.7.0",
|
74
73
|
"simple-git": "^1.65.0",
|
75
|
-
"style-loader": "^0.
|
74
|
+
"style-loader": "^0.23.1",
|
76
75
|
"typescript": "^3.0.0-rc",
|
77
|
-
"url-loader": "^
|
76
|
+
"url-loader": "^1.1.2",
|
78
77
|
"val-loader": "^1.0.2",
|
79
|
-
"vm-browserify": "~
|
78
|
+
"vm-browserify": "~1.1.0",
|
80
79
|
"wast-loader": "^1.5.5",
|
81
|
-
"webpack-dev-middleware": "^
|
82
|
-
"worker-loader": "^
|
80
|
+
"webpack-dev-middleware": "^3.5.1",
|
81
|
+
"worker-loader": "^2.0.0",
|
83
82
|
"xxhashjs": "^0.2.1"
|
84
83
|
},
|
85
84
|
"engines": {
|
@@ -108,7 +107,7 @@
|
|
108
107
|
"test": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest",
|
109
108
|
"test:update-snapshots": "yarn jest -u",
|
110
109
|
"test:integration": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\"",
|
111
|
-
"test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/
|
110
|
+
"test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\"",
|
112
111
|
"test:unit": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
|
113
112
|
"travis:integration": "yarn cover:init && yarn cover:integration --ci $JEST",
|
114
113
|
"travis:basic": "yarn test:basic --ci $JEST",
|