webpack 5.48.0 → 5.49.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.
Potentially problematic release.
This version of webpack might be problematic. Click here for more details.
- package/hot/only-dev-server.js +1 -1
- package/hot/poll.js +1 -1
- package/hot/signal.js +1 -1
- package/lib/Compilation.js +5 -2
- package/lib/ExternalModuleFactoryPlugin.js +1 -1
- package/lib/HotModuleReplacementPlugin.js +4 -4
- package/lib/Module.js +1 -0
- package/lib/MultiCompiler.js +0 -2
- package/lib/NormalModule.js +38 -17
- package/lib/NormalModuleFactory.js +137 -74
- package/lib/WebpackOptionsApply.js +8 -0
- package/lib/asset/AssetModulesPlugin.js +0 -1
- package/lib/config/defaults.js +26 -5
- package/lib/config/normalization.js +6 -1
- package/lib/hmr/HotModuleReplacement.runtime.js +5 -1
- package/lib/index.js +0 -3
- package/lib/optimize/SplitChunksPlugin.js +4 -4
- package/lib/schemes/HttpUriPlugin.js +942 -25
- package/lib/serialization/BinaryMiddleware.js +0 -2
- package/package.json +1 -1
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +43 -0
- package/schemas/plugins/schemes/HttpUriPlugin.check.d.ts +7 -0
- package/schemas/plugins/schemes/HttpUriPlugin.check.js +6 -0
- package/schemas/plugins/schemes/HttpUriPlugin.json +42 -0
- package/types.d.ts +60 -7
- package/lib/schemes/HttpsUriPlugin.js +0 -63
package/lib/config/defaults.js
CHANGED
@@ -171,7 +171,7 @@ const applyWebpackOptionsDefaults = options => {
|
|
171
171
|
|
172
172
|
applySnapshotDefaults(options.snapshot, { production });
|
173
173
|
|
174
|
-
applyExperimentsDefaults(options.experiments);
|
174
|
+
applyExperimentsDefaults(options.experiments, { production, development });
|
175
175
|
|
176
176
|
applyModuleDefaults(options.module, {
|
177
177
|
cache,
|
@@ -193,7 +193,10 @@ const applyWebpackOptionsDefaults = options => {
|
|
193
193
|
module: options.module
|
194
194
|
});
|
195
195
|
|
196
|
-
applyExternalsPresetsDefaults(options.externalsPresets, {
|
196
|
+
applyExternalsPresetsDefaults(options.externalsPresets, {
|
197
|
+
targetProperties,
|
198
|
+
buildHttp: !!options.experiments.buildHttp
|
199
|
+
});
|
197
200
|
|
198
201
|
applyLoaderDefaults(options.loader, { targetProperties });
|
199
202
|
|
@@ -245,13 +248,26 @@ const applyWebpackOptionsDefaults = options => {
|
|
245
248
|
|
246
249
|
/**
|
247
250
|
* @param {Experiments} experiments options
|
251
|
+
* @param {Object} options options
|
252
|
+
* @param {boolean} options.production is production
|
253
|
+
* @param {boolean} options.development is development mode
|
248
254
|
* @returns {void}
|
249
255
|
*/
|
250
|
-
const applyExperimentsDefaults = experiments => {
|
256
|
+
const applyExperimentsDefaults = (experiments, { production, development }) => {
|
251
257
|
D(experiments, "topLevelAwait", false);
|
252
258
|
D(experiments, "syncWebAssembly", false);
|
253
259
|
D(experiments, "asyncWebAssembly", false);
|
254
260
|
D(experiments, "outputModule", false);
|
261
|
+
D(experiments, "asset", false);
|
262
|
+
D(experiments, "executeModule", false);
|
263
|
+
D(experiments, "layers", false);
|
264
|
+
D(experiments, "lazyCompilation", false);
|
265
|
+
D(experiments, "buildHttp", false);
|
266
|
+
|
267
|
+
if (typeof experiments.buildHttp === "object") {
|
268
|
+
D(experiments.buildHttp, "frozen", production);
|
269
|
+
D(experiments.buildHttp, "upgrade", development);
|
270
|
+
}
|
255
271
|
};
|
256
272
|
|
257
273
|
/**
|
@@ -860,13 +876,18 @@ const applyOutputDefaults = (
|
|
860
876
|
* @param {ExternalsPresets} externalsPresets options
|
861
877
|
* @param {Object} options options
|
862
878
|
* @param {TargetProperties | false} options.targetProperties target properties
|
879
|
+
* @param {boolean} options.buildHttp buildHttp experiment enabled
|
863
880
|
* @returns {void}
|
864
881
|
*/
|
865
882
|
const applyExternalsPresetsDefaults = (
|
866
883
|
externalsPresets,
|
867
|
-
{ targetProperties }
|
884
|
+
{ targetProperties, buildHttp }
|
868
885
|
) => {
|
869
|
-
D(
|
886
|
+
D(
|
887
|
+
externalsPresets,
|
888
|
+
"web",
|
889
|
+
!buildHttp && targetProperties && targetProperties.web
|
890
|
+
);
|
870
891
|
D(externalsPresets, "node", targetProperties && targetProperties.node);
|
871
892
|
D(externalsPresets, "nwjs", targetProperties && targetProperties.nwjs);
|
872
893
|
D(
|
@@ -171,7 +171,12 @@ const getNormalizedWebpackOptions = config => {
|
|
171
171
|
Promise.resolve().then(fn).then(getNormalizedEntryStatic)
|
172
172
|
)(config.entry)
|
173
173
|
: getNormalizedEntryStatic(config.entry),
|
174
|
-
experiments:
|
174
|
+
experiments: nestedConfig(config.experiments, experiments => ({
|
175
|
+
...experiments,
|
176
|
+
buildHttp: optionalNestedConfig(experiments.buildHttp, options =>
|
177
|
+
options === true ? {} : options
|
178
|
+
)
|
179
|
+
})),
|
175
180
|
externals: config.externals,
|
176
181
|
externalsPresets: cloneObject(config.externalsPresets),
|
177
182
|
externalsType: config.externalsType,
|
@@ -252,7 +252,11 @@ module.exports = function () {
|
|
252
252
|
.then($hmrDownloadManifest$)
|
253
253
|
.then(function (update) {
|
254
254
|
if (!update) {
|
255
|
-
return setStatus(applyInvalidatedModules() ? "ready" : "idle")
|
255
|
+
return setStatus(applyInvalidatedModules() ? "ready" : "idle").then(
|
256
|
+
function () {
|
257
|
+
return null;
|
258
|
+
}
|
259
|
+
);
|
256
260
|
}
|
257
261
|
|
258
262
|
return setStatus("prepare").then(function () {
|
package/lib/index.js
CHANGED
@@ -17,7 +17,7 @@ const {
|
|
17
17
|
} = require("../util/comparators");
|
18
18
|
const createHash = require("../util/createHash");
|
19
19
|
const deterministicGrouping = require("../util/deterministicGrouping");
|
20
|
-
const
|
20
|
+
const { makePathsRelative } = require("../util/identifier");
|
21
21
|
const memoize = require("../util/memoize");
|
22
22
|
const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
23
23
|
|
@@ -748,7 +748,7 @@ module.exports = class SplitChunksPlugin {
|
|
748
748
|
* @returns {void}
|
749
749
|
*/
|
750
750
|
apply(compiler) {
|
751
|
-
const
|
751
|
+
const cachedMakePathsRelative = makePathsRelative.bindContextCache(
|
752
752
|
compiler.context,
|
753
753
|
compiler.root
|
754
754
|
);
|
@@ -1596,11 +1596,11 @@ module.exports = class SplitChunksPlugin {
|
|
1596
1596
|
getKey(module) {
|
1597
1597
|
const cache = getKeyCache.get(module);
|
1598
1598
|
if (cache !== undefined) return cache;
|
1599
|
-
const ident =
|
1599
|
+
const ident = cachedMakePathsRelative(module.identifier());
|
1600
1600
|
const nameForCondition =
|
1601
1601
|
module.nameForCondition && module.nameForCondition();
|
1602
1602
|
const name = nameForCondition
|
1603
|
-
?
|
1603
|
+
? cachedMakePathsRelative(nameForCondition)
|
1604
1604
|
: ident.replace(/^.*!|\?[^?!]*$/g, "");
|
1605
1605
|
const fullKey =
|
1606
1606
|
name +
|