webpack 5.90.2 → 5.90.3
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.
Potentially problematic release.
This version of webpack might be problematic. Click here for more details.
- package/lib/Compilation.js +1 -1
- package/lib/ContextModule.js +2 -1
- package/lib/CssModule.js +0 -3
- package/lib/DelegatedModule.js +2 -1
- package/lib/DllModule.js +2 -1
- package/lib/ExternalModule.js +2 -1
- package/lib/Module.js +24 -3
- package/lib/MultiCompiler.js +36 -10
- package/lib/NormalModule.js +236 -85
- package/lib/NormalModuleFactory.js +162 -31
- package/lib/RawModule.js +2 -1
- package/lib/ResolverFactory.js +2 -0
- package/lib/RuntimeModule.js +2 -1
- package/lib/Stats.js +2 -2
- package/lib/asset/RawDataUrlModule.js +2 -1
- package/lib/buildChunkGraph.js +111 -336
- package/lib/container/ContainerEntryModule.js +2 -1
- package/lib/container/FallbackModule.js +2 -1
- package/lib/container/RemoteModule.js +2 -1
- package/lib/css/CssLoadingRuntimeModule.js +1 -1
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +15 -5
- package/lib/dependencies/WorkerDependency.js +1 -1
- package/lib/dependencies/WorkerPlugin.js +4 -4
- package/lib/hmr/LazyCompilationPlugin.js +2 -1
- package/lib/optimize/ConcatenatedModule.js +2 -1
- package/lib/sharing/ConsumeSharedModule.js +2 -1
- package/lib/sharing/ProvideSharedModule.js +2 -1
- package/lib/util/memoize.js +2 -0
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +2 -1
- package/lib/webpack.js +5 -3
- package/package.json +1 -1
- package/types.d.ts +122 -78
@@ -38,10 +38,17 @@ const {
|
|
38
38
|
/** @typedef {import("../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
|
39
39
|
/** @typedef {import("./Generator")} Generator */
|
40
40
|
/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
|
41
|
+
/** @typedef {import("./ModuleFactory").ModuleFactoryCreateDataContextInfo} ModuleFactoryCreateDataContextInfo */
|
41
42
|
/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */
|
43
|
+
/** @typedef {import("./NormalModule").GeneratorOptions} GeneratorOptions */
|
44
|
+
/** @typedef {import("./NormalModule").LoaderItem} LoaderItem */
|
42
45
|
/** @typedef {import("./NormalModule").NormalModuleCreateData} NormalModuleCreateData */
|
46
|
+
/** @typedef {import("./NormalModule").ParserOptions} ParserOptions */
|
43
47
|
/** @typedef {import("./Parser")} Parser */
|
44
48
|
/** @typedef {import("./ResolverFactory")} ResolverFactory */
|
49
|
+
/** @typedef {import("./ResolverFactory").ResolveContext} ResolveContext */
|
50
|
+
/** @typedef {import("./ResolverFactory").ResolveRequest} ResolveRequest */
|
51
|
+
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
45
52
|
/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */
|
46
53
|
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
47
54
|
|
@@ -67,27 +74,43 @@ const {
|
|
67
74
|
/**
|
68
75
|
* @typedef {Object} ResourceData
|
69
76
|
* @property {string} resource
|
70
|
-
* @property {string} path
|
71
|
-
* @property {string} query
|
72
|
-
* @property {string} fragment
|
77
|
+
* @property {string=} path
|
78
|
+
* @property {string=} query
|
79
|
+
* @property {string=} fragment
|
73
80
|
* @property {string=} context
|
74
81
|
*/
|
75
82
|
|
76
83
|
/** @typedef {ResourceData & { data: Record<string, any> }} ResourceDataWithData */
|
77
84
|
|
78
|
-
/**
|
85
|
+
/**
|
86
|
+
* @typedef {Object} ParsedLoaderRequest
|
79
87
|
* @property {string} loader loader
|
80
88
|
* @property {string|undefined} options options
|
81
89
|
*/
|
82
90
|
|
91
|
+
/**
|
92
|
+
* @template T
|
93
|
+
* @callback Callback
|
94
|
+
* @param {(Error | null)=} err
|
95
|
+
* @param {T=} stats
|
96
|
+
* @returns {void}
|
97
|
+
*/
|
98
|
+
|
83
99
|
const EMPTY_RESOLVE_OPTIONS = {};
|
100
|
+
/** @type {ParserOptions} */
|
84
101
|
const EMPTY_PARSER_OPTIONS = {};
|
102
|
+
/** @type {GeneratorOptions} */
|
85
103
|
const EMPTY_GENERATOR_OPTIONS = {};
|
104
|
+
/** @type {ParsedLoaderRequest[]} */
|
86
105
|
const EMPTY_ELEMENTS = [];
|
87
106
|
|
88
107
|
const MATCH_RESOURCE_REGEX = /^([^!]+)!=!/;
|
89
108
|
const LEADING_DOT_EXTENSION_REGEX = /^[^.]/;
|
90
109
|
|
110
|
+
/**
|
111
|
+
* @param {LoaderItem} data data
|
112
|
+
* @returns {string} ident
|
113
|
+
*/
|
91
114
|
const loaderToIdent = data => {
|
92
115
|
if (!data.options) {
|
93
116
|
return data.loader;
|
@@ -104,6 +127,11 @@ const loaderToIdent = data => {
|
|
104
127
|
return data.loader + "?" + JSON.stringify(data.options);
|
105
128
|
};
|
106
129
|
|
130
|
+
/**
|
131
|
+
* @param {LoaderItem[]} loaders loaders
|
132
|
+
* @param {string} resource resource
|
133
|
+
* @returns {string} stringified loaders and resource
|
134
|
+
*/
|
107
135
|
const stringifyLoadersAndResource = (loaders, resource) => {
|
108
136
|
let str = "";
|
109
137
|
for (const loader of loaders) {
|
@@ -112,6 +140,11 @@ const stringifyLoadersAndResource = (loaders, resource) => {
|
|
112
140
|
return str + resource;
|
113
141
|
};
|
114
142
|
|
143
|
+
/**
|
144
|
+
* @param {number} times times
|
145
|
+
* @param {(err?: null | Error) => void} callback callback
|
146
|
+
* @returns {(err?: null | Error) => void} callback
|
147
|
+
*/
|
115
148
|
const needCalls = (times, callback) => {
|
116
149
|
return err => {
|
117
150
|
if (--times === 0) {
|
@@ -124,6 +157,14 @@ const needCalls = (times, callback) => {
|
|
124
157
|
};
|
125
158
|
};
|
126
159
|
|
160
|
+
/**
|
161
|
+
* @template T
|
162
|
+
* @template O
|
163
|
+
* @param {T} globalOptions global options
|
164
|
+
* @param {string} type type
|
165
|
+
* @param {O} localOptions local options
|
166
|
+
* @returns {T & O | T | O} result
|
167
|
+
*/
|
127
168
|
const mergeGlobalOptions = (globalOptions, type, localOptions) => {
|
128
169
|
const parts = type.split("/");
|
129
170
|
let result;
|
@@ -147,11 +188,22 @@ const mergeGlobalOptions = (globalOptions, type, localOptions) => {
|
|
147
188
|
};
|
148
189
|
|
149
190
|
// TODO webpack 6 remove
|
191
|
+
/**
|
192
|
+
* @param {string} name name
|
193
|
+
* @param {TODO} hook hook
|
194
|
+
* @returns {string} result
|
195
|
+
*/
|
150
196
|
const deprecationChangedHookMessage = (name, hook) => {
|
151
197
|
const names = hook.taps
|
152
|
-
.map(
|
153
|
-
|
154
|
-
|
198
|
+
.map(
|
199
|
+
/**
|
200
|
+
* @param {TODO} tapped tapped
|
201
|
+
* @returns {string} name
|
202
|
+
*/
|
203
|
+
tapped => {
|
204
|
+
return tapped.name;
|
205
|
+
}
|
206
|
+
)
|
155
207
|
.join(", ");
|
156
208
|
|
157
209
|
return (
|
@@ -226,14 +278,19 @@ class NormalModuleFactory extends ModuleFactory {
|
|
226
278
|
createModule: new AsyncSeriesBailHook(["createData", "resolveData"]),
|
227
279
|
/** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], Module>} */
|
228
280
|
module: new SyncWaterfallHook(["module", "createData", "resolveData"]),
|
281
|
+
/** @type {HookMap<SyncBailHook<[ParserOptions], Parser>>} */
|
229
282
|
createParser: new HookMap(() => new SyncBailHook(["parserOptions"])),
|
283
|
+
/** @type {HookMap<SyncBailHook<[TODO, ParserOptions], void>>} */
|
230
284
|
parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])),
|
285
|
+
/** @type {HookMap<SyncBailHook<[GeneratorOptions], Generator>>} */
|
231
286
|
createGenerator: new HookMap(
|
232
287
|
() => new SyncBailHook(["generatorOptions"])
|
233
288
|
),
|
289
|
+
/** @type {HookMap<SyncBailHook<[TODO, GeneratorOptions], void>>} */
|
234
290
|
generator: new HookMap(
|
235
291
|
() => new SyncHook(["generator", "generatorOptions"])
|
236
292
|
),
|
293
|
+
/** @type {HookMap<SyncBailHook<[TODO, ResolveData], Module>>} */
|
237
294
|
createModuleClass: new HookMap(
|
238
295
|
() => new SyncBailHook(["createData", "resolveData"])
|
239
296
|
)
|
@@ -251,7 +308,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|
251
308
|
this.fs = fs;
|
252
309
|
this._globalParserOptions = options.parser;
|
253
310
|
this._globalGeneratorOptions = options.generator;
|
254
|
-
/** @type {Map<string, WeakMap<Object,
|
311
|
+
/** @type {Map<string, WeakMap<Object, Parser>>} */
|
255
312
|
this.parserCache = new Map();
|
256
313
|
/** @type {Map<string, WeakMap<Object, Generator>>} */
|
257
314
|
this.generatorCache = new Map();
|
@@ -313,7 +370,9 @@ class NormalModuleFactory extends ModuleFactory {
|
|
313
370
|
|
314
371
|
// TODO webpack 6 make it required and move javascript/wasm/asset properties to own module
|
315
372
|
createdModule = this.hooks.createModuleClass
|
316
|
-
.for(
|
373
|
+
.for(
|
374
|
+
/** @type {ModuleSettings} */ (createData.settings).type
|
375
|
+
)
|
317
376
|
.call(createData, resolveData);
|
318
377
|
|
319
378
|
if (!createdModule) {
|
@@ -415,7 +474,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|
415
474
|
: 0
|
416
475
|
)
|
417
476
|
.split(/!+/);
|
418
|
-
unresolvedResource = rawElements.pop();
|
477
|
+
unresolvedResource = /** @type {string} */ (rawElements.pop());
|
419
478
|
elements = rawElements.map(el => {
|
420
479
|
const { path, query } = cachedParseResourceWithoutFragment(el);
|
421
480
|
return {
|
@@ -433,6 +492,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|
433
492
|
elements = EMPTY_ELEMENTS;
|
434
493
|
}
|
435
494
|
|
495
|
+
/** @type {ResolveContext} */
|
436
496
|
const resolveContext = {
|
437
497
|
fileDependencies,
|
438
498
|
missingDependencies,
|
@@ -442,6 +502,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|
442
502
|
/** @type {ResourceDataWithData} */
|
443
503
|
let resourceData;
|
444
504
|
|
505
|
+
/** @type {undefined | LoaderItem[]} */
|
445
506
|
let loaders;
|
446
507
|
|
447
508
|
const continueCallback = needCalls(2, err => {
|
@@ -449,7 +510,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|
449
510
|
|
450
511
|
// translate option idents
|
451
512
|
try {
|
452
|
-
for (const item of loaders) {
|
513
|
+
for (const item of /** @type {LoaderItem[]} */ (loaders)) {
|
453
514
|
if (typeof item.options === "string" && item.options[0] === "?") {
|
454
515
|
const ident = item.options.slice(1);
|
455
516
|
if (ident === "[[missing ident]]") {
|
@@ -469,7 +530,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|
469
530
|
}
|
470
531
|
}
|
471
532
|
} catch (e) {
|
472
|
-
return callback(e);
|
533
|
+
return callback(/** @type {Error} */ (e));
|
473
534
|
}
|
474
535
|
|
475
536
|
if (!resourceData) {
|
@@ -481,8 +542,12 @@ class NormalModuleFactory extends ModuleFactory {
|
|
481
542
|
(matchResourceData !== undefined
|
482
543
|
? `${matchResourceData.resource}!=!`
|
483
544
|
: "") +
|
484
|
-
stringifyLoadersAndResource(
|
545
|
+
stringifyLoadersAndResource(
|
546
|
+
/** @type {LoaderItem[]} */ (loaders),
|
547
|
+
resourceData.resource
|
548
|
+
);
|
485
549
|
|
550
|
+
/** @type {ModuleSettings} */
|
486
551
|
const settings = {};
|
487
552
|
const useLoadersPost = [];
|
488
553
|
const useLoaders = [];
|
@@ -553,22 +618,32 @@ class NormalModuleFactory extends ModuleFactory {
|
|
553
618
|
}
|
554
619
|
}
|
555
620
|
|
556
|
-
|
621
|
+
/** @type {undefined | LoaderItem[]} */
|
622
|
+
let postLoaders;
|
623
|
+
/** @type {undefined | LoaderItem[]} */
|
624
|
+
let normalLoaders;
|
625
|
+
/** @type {undefined | LoaderItem[]} */
|
626
|
+
let preLoaders;
|
557
627
|
|
558
628
|
const continueCallback = needCalls(3, err => {
|
559
629
|
if (err) {
|
560
630
|
return callback(err);
|
561
631
|
}
|
562
|
-
const allLoaders = postLoaders;
|
632
|
+
const allLoaders = /** @type {LoaderItem[]} */ (postLoaders);
|
563
633
|
if (matchResourceData === undefined) {
|
564
|
-
for (const loader of
|
565
|
-
|
634
|
+
for (const loader of /** @type {LoaderItem[]} */ (loaders))
|
635
|
+
allLoaders.push(loader);
|
636
|
+
for (const loader of /** @type {LoaderItem[]} */ (normalLoaders))
|
637
|
+
allLoaders.push(loader);
|
566
638
|
} else {
|
567
|
-
for (const loader of
|
568
|
-
|
639
|
+
for (const loader of /** @type {LoaderItem[]} */ (normalLoaders))
|
640
|
+
allLoaders.push(loader);
|
641
|
+
for (const loader of /** @type {LoaderItem[]} */ (loaders))
|
642
|
+
allLoaders.push(loader);
|
569
643
|
}
|
570
|
-
for (const loader of
|
571
|
-
|
644
|
+
for (const loader of /** @type {LoaderItem[]} */ (preLoaders))
|
645
|
+
allLoaders.push(loader);
|
646
|
+
let type = /** @type {string} */ (settings.type);
|
572
647
|
const resolveOptions = settings.resolve;
|
573
648
|
const layer = settings.layer;
|
574
649
|
if (layer !== undefined && !layers) {
|
@@ -605,7 +680,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|
605
680
|
resolveOptions
|
606
681
|
});
|
607
682
|
} catch (e) {
|
608
|
-
return callback(e);
|
683
|
+
return callback(/** @type {Error} */ (e));
|
609
684
|
}
|
610
685
|
callback();
|
611
686
|
});
|
@@ -647,7 +722,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|
647
722
|
this.resolveRequestArray(
|
648
723
|
contextInfo,
|
649
724
|
contextScheme ? this.context : context,
|
650
|
-
elements,
|
725
|
+
/** @type {LoaderItem[]} */ (elements),
|
651
726
|
loaderResolver,
|
652
727
|
resolveContext,
|
653
728
|
(err, result) => {
|
@@ -657,6 +732,9 @@ class NormalModuleFactory extends ModuleFactory {
|
|
657
732
|
}
|
658
733
|
);
|
659
734
|
|
735
|
+
/**
|
736
|
+
* @param {string} context context
|
737
|
+
*/
|
660
738
|
const defaultResolve = context => {
|
661
739
|
if (/^($|\?)/.test(unresolvedResource)) {
|
662
740
|
resourceData = {
|
@@ -835,6 +913,14 @@ class NormalModuleFactory extends ModuleFactory {
|
|
835
913
|
});
|
836
914
|
}
|
837
915
|
|
916
|
+
/**
|
917
|
+
* @param {ModuleFactoryCreateDataContextInfo} contextInfo context info
|
918
|
+
* @param {string} context context
|
919
|
+
* @param {string} unresolvedResource unresolved resource
|
920
|
+
* @param {ResolverWithOptions} resolver resolver
|
921
|
+
* @param {ResolveContext} resolveContext resolver context
|
922
|
+
* @param {(err: null | Error, res?: string | false, req?: ResolveRequest) => void} callback callback
|
923
|
+
*/
|
838
924
|
resolveResource(
|
839
925
|
contextInfo,
|
840
926
|
context,
|
@@ -899,6 +985,16 @@ ${hints.join("\n\n")}`;
|
|
899
985
|
);
|
900
986
|
}
|
901
987
|
|
988
|
+
/**
|
989
|
+
* @param {Error} error error
|
990
|
+
* @param {ModuleFactoryCreateDataContextInfo} contextInfo context info
|
991
|
+
* @param {string} context context
|
992
|
+
* @param {string} unresolvedResource unresolved resource
|
993
|
+
* @param {ResolverWithOptions} resolver resolver
|
994
|
+
* @param {ResolveContext} resolveContext resolver context
|
995
|
+
* @param {Callback<string[]>} callback callback
|
996
|
+
* @private
|
997
|
+
*/
|
902
998
|
_resolveResourceErrorHints(
|
903
999
|
error,
|
904
1000
|
contextInfo,
|
@@ -1010,11 +1106,20 @@ If changing the source code is not an option there is also a resolve options cal
|
|
1010
1106
|
],
|
1011
1107
|
(err, hints) => {
|
1012
1108
|
if (err) return callback(err);
|
1013
|
-
callback(null, hints.filter(Boolean));
|
1109
|
+
callback(null, /** @type {string[]} */ (hints).filter(Boolean));
|
1014
1110
|
}
|
1015
1111
|
);
|
1016
1112
|
}
|
1017
1113
|
|
1114
|
+
/**
|
1115
|
+
* @param {ModuleFactoryCreateDataContextInfo} contextInfo context info
|
1116
|
+
* @param {string} context context
|
1117
|
+
* @param {LoaderItem[]} array array
|
1118
|
+
* @param {ResolverWithOptions} resolver resolver
|
1119
|
+
* @param {ResolveContext} resolveContext resolve context
|
1120
|
+
* @param {Callback<LoaderItem[]>} callback callback
|
1121
|
+
* @returns {void} result
|
1122
|
+
*/
|
1018
1123
|
resolveRequestArray(
|
1019
1124
|
contextInfo,
|
1020
1125
|
context,
|
@@ -1023,6 +1128,7 @@ If changing the source code is not an option there is also a resolve options cal
|
|
1023
1128
|
resolveContext,
|
1024
1129
|
callback
|
1025
1130
|
) {
|
1131
|
+
// LoaderItem
|
1026
1132
|
if (array.length === 0) return callback(null, array);
|
1027
1133
|
asyncLib.map(
|
1028
1134
|
array,
|
@@ -1064,10 +1170,11 @@ If changing the source code is not an option there is also a resolve options cal
|
|
1064
1170
|
? "module"
|
1065
1171
|
: /\.cjs$/i.test(parsedResult.path)
|
1066
1172
|
? "commonjs"
|
1067
|
-
:
|
1173
|
+
: /** @type {ResolveRequest} */
|
1174
|
+
(resolveRequest).descriptionFileData === undefined
|
1068
1175
|
? undefined
|
1069
|
-
:
|
1070
|
-
|
1176
|
+
: /** @type {ResolveRequest} */
|
1177
|
+
(resolveRequest).descriptionFileData.type;
|
1071
1178
|
const resolved = {
|
1072
1179
|
loader: parsedResult.path,
|
1073
1180
|
type,
|
@@ -1077,16 +1184,25 @@ If changing the source code is not an option there is also a resolve options cal
|
|
1077
1184
|
? parsedResult.query.slice(1)
|
1078
1185
|
: undefined
|
1079
1186
|
: item.options,
|
1080
|
-
ident:
|
1187
|
+
ident:
|
1188
|
+
item.options === undefined
|
1189
|
+
? undefined
|
1190
|
+
: /** @type {string} */ (item.ident)
|
1081
1191
|
};
|
1082
|
-
|
1192
|
+
|
1193
|
+
return callback(null, /** @type {LoaderItem} */ (resolved));
|
1083
1194
|
}
|
1084
1195
|
);
|
1085
1196
|
},
|
1086
|
-
callback
|
1197
|
+
/** @type {Callback<TODO>} */ (callback)
|
1087
1198
|
);
|
1088
1199
|
}
|
1089
1200
|
|
1201
|
+
/**
|
1202
|
+
* @param {string} type type
|
1203
|
+
* @param {ParserOptions} parserOptions parser options
|
1204
|
+
* @returns {Parser} parser
|
1205
|
+
*/
|
1090
1206
|
getParser(type, parserOptions = EMPTY_PARSER_OPTIONS) {
|
1091
1207
|
let cache = this.parserCache.get(type);
|
1092
1208
|
|
@@ -1107,7 +1223,7 @@ If changing the source code is not an option there is also a resolve options cal
|
|
1107
1223
|
|
1108
1224
|
/**
|
1109
1225
|
* @param {string} type type
|
1110
|
-
* @param {
|
1226
|
+
* @param {ParserOptions} parserOptions parser options
|
1111
1227
|
* @returns {Parser} parser
|
1112
1228
|
*/
|
1113
1229
|
createParser(type, parserOptions = {}) {
|
@@ -1124,6 +1240,11 @@ If changing the source code is not an option there is also a resolve options cal
|
|
1124
1240
|
return parser;
|
1125
1241
|
}
|
1126
1242
|
|
1243
|
+
/**
|
1244
|
+
* @param {string} type type of generator
|
1245
|
+
* @param {GeneratorOptions} generatorOptions generator options
|
1246
|
+
* @returns {Generator} generator
|
1247
|
+
*/
|
1127
1248
|
getGenerator(type, generatorOptions = EMPTY_GENERATOR_OPTIONS) {
|
1128
1249
|
let cache = this.generatorCache.get(type);
|
1129
1250
|
|
@@ -1142,6 +1263,11 @@ If changing the source code is not an option there is also a resolve options cal
|
|
1142
1263
|
return generator;
|
1143
1264
|
}
|
1144
1265
|
|
1266
|
+
/**
|
1267
|
+
* @param {string} type type of generator
|
1268
|
+
* @param {GeneratorOptions} generatorOptions generator options
|
1269
|
+
* @returns {Generator} generator
|
1270
|
+
*/
|
1145
1271
|
createGenerator(type, generatorOptions = {}) {
|
1146
1272
|
generatorOptions = mergeGlobalOptions(
|
1147
1273
|
this._globalGeneratorOptions,
|
@@ -1158,6 +1284,11 @@ If changing the source code is not an option there is also a resolve options cal
|
|
1158
1284
|
return generator;
|
1159
1285
|
}
|
1160
1286
|
|
1287
|
+
/**
|
1288
|
+
* @param {Parameters<ResolverFactory["get"]>[0]} type type of resolver
|
1289
|
+
* @param {Parameters<ResolverFactory["get"]>[1]=} resolveOptions options
|
1290
|
+
* @returns {ReturnType<ResolverFactory["get"]>} the resolver
|
1291
|
+
*/
|
1161
1292
|
getResolver(type, resolveOptions) {
|
1162
1293
|
return this.resolverFactory.get(type, resolveOptions);
|
1163
1294
|
}
|
package/lib/RawModule.js
CHANGED
@@ -19,6 +19,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
19
19
|
/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */
|
20
20
|
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
|
21
21
|
/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */
|
22
|
+
/** @typedef {import("./Module").SourceTypes} SourceTypes */
|
22
23
|
/** @typedef {import("./RequestShortener")} RequestShortener */
|
23
24
|
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
24
25
|
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
@@ -46,7 +47,7 @@ class RawModule extends Module {
|
|
46
47
|
}
|
47
48
|
|
48
49
|
/**
|
49
|
-
* @returns {
|
50
|
+
* @returns {SourceTypes} types available (do not mutate)
|
50
51
|
*/
|
51
52
|
getSourceTypes() {
|
52
53
|
return TYPES;
|
package/lib/ResolverFactory.js
CHANGED
@@ -13,7 +13,9 @@ const {
|
|
13
13
|
resolveByProperty
|
14
14
|
} = require("./util/cleverMerge");
|
15
15
|
|
16
|
+
/** @typedef {import("enhanced-resolve").ResolveContext} ResolveContext */
|
16
17
|
/** @typedef {import("enhanced-resolve").ResolveOptions} ResolveOptions */
|
18
|
+
/** @typedef {import("enhanced-resolve").ResolveRequest} ResolveRequest */
|
17
19
|
/** @typedef {import("enhanced-resolve").Resolver} Resolver */
|
18
20
|
/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} WebpackResolveOptions */
|
19
21
|
/** @typedef {import("../declarations/WebpackOptions").ResolvePluginInstance} ResolvePluginInstance */
|
package/lib/RuntimeModule.js
CHANGED
@@ -19,6 +19,7 @@ const { WEBPACK_MODULE_TYPE_RUNTIME } = require("./ModuleTypeConstants");
|
|
19
19
|
/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */
|
20
20
|
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
|
21
21
|
/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */
|
22
|
+
/** @typedef {import("./Module").SourceTypes} SourceTypes */
|
22
23
|
/** @typedef {import("./RequestShortener")} RequestShortener */
|
23
24
|
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
24
25
|
/** @typedef {import("./WebpackError")} WebpackError */
|
@@ -123,7 +124,7 @@ class RuntimeModule extends Module {
|
|
123
124
|
}
|
124
125
|
|
125
126
|
/**
|
126
|
-
* @returns {
|
127
|
+
* @returns {SourceTypes} types available (do not mutate)
|
127
128
|
*/
|
128
129
|
getSourceTypes() {
|
129
130
|
return TYPES;
|
package/lib/Stats.js
CHANGED
@@ -50,7 +50,7 @@ class Stats {
|
|
50
50
|
}
|
51
51
|
|
52
52
|
/**
|
53
|
-
* @param {(string|StatsOptions)=} options stats options
|
53
|
+
* @param {(string | boolean | StatsOptions)=} options stats options
|
54
54
|
* @returns {StatsCompilation} json output
|
55
55
|
*/
|
56
56
|
toJson(options) {
|
@@ -66,7 +66,7 @@ class Stats {
|
|
66
66
|
}
|
67
67
|
|
68
68
|
/**
|
69
|
-
* @param {(string|StatsOptions)=} options stats options
|
69
|
+
* @param {(string | boolean | StatsOptions)=} options stats options
|
70
70
|
* @returns {string} string output
|
71
71
|
*/
|
72
72
|
toString(options) {
|
@@ -17,6 +17,7 @@ const makeSerializable = require("../util/makeSerializable");
|
|
17
17
|
/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */
|
18
18
|
/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */
|
19
19
|
/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */
|
20
|
+
/** @typedef {import("../Module").SourceTypes} SourceTypes */
|
20
21
|
/** @typedef {import("../RequestShortener")} RequestShortener */
|
21
22
|
/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
22
23
|
/** @typedef {import("../WebpackError")} WebpackError */
|
@@ -42,7 +43,7 @@ class RawDataUrlModule extends Module {
|
|
42
43
|
}
|
43
44
|
|
44
45
|
/**
|
45
|
-
* @returns {
|
46
|
+
* @returns {SourceTypes} types available (do not mutate)
|
46
47
|
*/
|
47
48
|
getSourceTypes() {
|
48
49
|
return TYPES;
|