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
@@ -688,6 +688,17 @@
|
|
688
688
|
"description": "Support WebAssembly as asynchronous EcmaScript Module.",
|
689
689
|
"type": "boolean"
|
690
690
|
},
|
691
|
+
"buildHttp": {
|
692
|
+
"description": "Build http(s): urls using a lockfile and resource content cache.",
|
693
|
+
"anyOf": [
|
694
|
+
{
|
695
|
+
"type": "boolean"
|
696
|
+
},
|
697
|
+
{
|
698
|
+
"$ref": "#/definitions/HttpUriOptions"
|
699
|
+
}
|
700
|
+
]
|
701
|
+
},
|
691
702
|
"executeModule": {
|
692
703
|
"description": "Enable build-time execution of modules from the module graph for plugins and loaders.",
|
693
704
|
"type": "boolean"
|
@@ -1184,6 +1195,38 @@
|
|
1184
1195
|
"type": "string",
|
1185
1196
|
"absolutePath": false
|
1186
1197
|
},
|
1198
|
+
"HttpUriOptions": {
|
1199
|
+
"description": "Options for building http resources.",
|
1200
|
+
"type": "object",
|
1201
|
+
"additionalProperties": false,
|
1202
|
+
"properties": {
|
1203
|
+
"cacheLocation": {
|
1204
|
+
"description": "Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.",
|
1205
|
+
"anyOf": [
|
1206
|
+
{
|
1207
|
+
"enum": [false]
|
1208
|
+
},
|
1209
|
+
{
|
1210
|
+
"type": "string",
|
1211
|
+
"absolutePath": true
|
1212
|
+
}
|
1213
|
+
]
|
1214
|
+
},
|
1215
|
+
"frozen": {
|
1216
|
+
"description": "When set, anything that would lead to an modification of the lockfile or any resource content, will result in an error.",
|
1217
|
+
"type": "boolean"
|
1218
|
+
},
|
1219
|
+
"lockfileLocation": {
|
1220
|
+
"description": "Location of the lockfile.",
|
1221
|
+
"type": "string",
|
1222
|
+
"absolutePath": true
|
1223
|
+
},
|
1224
|
+
"upgrade": {
|
1225
|
+
"description": "When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.",
|
1226
|
+
"type": "boolean"
|
1227
|
+
}
|
1228
|
+
}
|
1229
|
+
},
|
1187
1230
|
"IgnoreWarnings": {
|
1188
1231
|
"description": "Ignore specific warnings.",
|
1189
1232
|
"type": "array",
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/*
|
2
|
+
* This file was automatically generated.
|
3
|
+
* DO NOT MODIFY BY HAND.
|
4
|
+
* Run `yarn special-lint-fix` to update
|
5
|
+
*/
|
6
|
+
const o=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function t(e,{instancePath:n="",parentData:s,parentDataProperty:l,rootData:a=e}={}){let i=null,r=0;const c=r;let p=!1,u=null;const f=r;if(r==r)if(e&&"object"==typeof e&&!Array.isArray(e)){const t=r;for(const o in e)if("cacheLocation"!==o&&"frozen"!==o&&"lockfileLocation"!==o&&"upgrade"!==o){const t={params:{additionalProperty:o}};null===i?i=[t]:i.push(t),r++;break}if(t===r){if(void 0!==e.cacheLocation){let t=e.cacheLocation;const n=r,s=r;let l=!1;const a=r;if(!1!==t){const o={params:{}};null===i?i=[o]:i.push(o),r++}var h=a===r;if(l=l||h,!l){const e=r;if(r===e)if("string"==typeof t){if(t.includes("!")||!0!==o.test(t)){const o={params:{}};null===i?i=[o]:i.push(o),r++}}else{const o={params:{type:"string"}};null===i?i=[o]:i.push(o),r++}h=e===r,l=l||h}if(l)r=s,null!==i&&(s?i.length=s:i=null);else{const o={params:{}};null===i?i=[o]:i.push(o),r++}var d=n===r}else d=!0;if(d){if(void 0!==e.frozen){const o=r;if("boolean"!=typeof e.frozen){const o={params:{type:"boolean"}};null===i?i=[o]:i.push(o),r++}d=o===r}else d=!0;if(d){if(void 0!==e.lockfileLocation){let t=e.lockfileLocation;const n=r;if(r===n)if("string"==typeof t){if(t.includes("!")||!0!==o.test(t)){const o={params:{}};null===i?i=[o]:i.push(o),r++}}else{const o={params:{type:"string"}};null===i?i=[o]:i.push(o),r++}d=n===r}else d=!0;if(d)if(void 0!==e.upgrade){const o=r;if("boolean"!=typeof e.upgrade){const o={params:{type:"boolean"}};null===i?i=[o]:i.push(o),r++}d=o===r}else d=!0}}}}else{const o={params:{type:"object"}};null===i?i=[o]:i.push(o),r++}if(f===r&&(p=!0,u=0),!p){const o={params:{passingSchemas:u}};return null===i?i=[o]:i.push(o),r++,t.errors=i,!1}return r=c,null!==i&&(c?i.length=c:i=null),t.errors=i,0===r}module.exports=t,module.exports.default=t;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
{
|
2
|
+
"definitions": {
|
3
|
+
"HttpUriOptions": {
|
4
|
+
"description": "Options for building http resources.",
|
5
|
+
"type": "object",
|
6
|
+
"additionalProperties": false,
|
7
|
+
"properties": {
|
8
|
+
"cacheLocation": {
|
9
|
+
"description": "Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.",
|
10
|
+
"anyOf": [
|
11
|
+
{
|
12
|
+
"enum": [false]
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"type": "string",
|
16
|
+
"absolutePath": true
|
17
|
+
}
|
18
|
+
]
|
19
|
+
},
|
20
|
+
"frozen": {
|
21
|
+
"description": "When set, anything that would lead to an modification of the lockfile or any resource content, will result in an error.",
|
22
|
+
"type": "boolean"
|
23
|
+
},
|
24
|
+
"lockfileLocation": {
|
25
|
+
"description": "Location of the lockfile.",
|
26
|
+
"type": "string",
|
27
|
+
"absolutePath": true
|
28
|
+
},
|
29
|
+
"upgrade": {
|
30
|
+
"description": "When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.",
|
31
|
+
"type": "boolean"
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"title": "HttpUriPluginOptions",
|
37
|
+
"oneOf": [
|
38
|
+
{
|
39
|
+
"$ref": "#/definitions/HttpUriOptions"
|
40
|
+
}
|
41
|
+
]
|
42
|
+
}
|
package/types.d.ts
CHANGED
@@ -3249,6 +3249,11 @@ declare interface Experiments {
|
|
3249
3249
|
*/
|
3250
3250
|
asyncWebAssembly?: boolean;
|
3251
3251
|
|
3252
|
+
/**
|
3253
|
+
* Build http(s): urls using a lockfile and resource content cache.
|
3254
|
+
*/
|
3255
|
+
buildHttp?: boolean | HttpUriOptions;
|
3256
|
+
|
3252
3257
|
/**
|
3253
3258
|
* Enable build-time execution of modules from the module graph for plugins and loaders.
|
3254
3259
|
*/
|
@@ -4285,16 +4290,53 @@ declare interface HotModuleReplacementPluginLoaderContext {
|
|
4285
4290
|
declare class HotUpdateChunk extends Chunk {
|
4286
4291
|
constructor();
|
4287
4292
|
}
|
4288
|
-
declare class HttpUriPlugin {
|
4289
|
-
constructor();
|
4290
4293
|
|
4294
|
+
/**
|
4295
|
+
* Options for building http resources.
|
4296
|
+
*/
|
4297
|
+
declare interface HttpUriOptions {
|
4291
4298
|
/**
|
4292
|
-
*
|
4299
|
+
* Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
|
4293
4300
|
*/
|
4294
|
-
|
4301
|
+
cacheLocation?: string | false;
|
4302
|
+
|
4303
|
+
/**
|
4304
|
+
* When set, anything that would lead to an modification of the lockfile or any resource content, will result in an error.
|
4305
|
+
*/
|
4306
|
+
frozen?: boolean;
|
4307
|
+
|
4308
|
+
/**
|
4309
|
+
* Location of the lockfile.
|
4310
|
+
*/
|
4311
|
+
lockfileLocation?: string;
|
4312
|
+
|
4313
|
+
/**
|
4314
|
+
* When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.
|
4315
|
+
*/
|
4316
|
+
upgrade?: boolean;
|
4295
4317
|
}
|
4296
|
-
declare class
|
4297
|
-
constructor(
|
4318
|
+
declare class HttpUriPlugin {
|
4319
|
+
constructor(options?: {
|
4320
|
+
/**
|
4321
|
+
* Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
|
4322
|
+
*/
|
4323
|
+
cacheLocation?: string | false;
|
4324
|
+
/**
|
4325
|
+
* When set, anything that would lead to an modification of the lockfile or any resource content, will result in an error.
|
4326
|
+
*/
|
4327
|
+
frozen?: boolean;
|
4328
|
+
/**
|
4329
|
+
* Location of the lockfile.
|
4330
|
+
*/
|
4331
|
+
lockfileLocation?: string;
|
4332
|
+
/**
|
4333
|
+
* When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.
|
4334
|
+
*/
|
4335
|
+
upgrade?: boolean;
|
4336
|
+
hashFunction?: string | typeof Hash;
|
4337
|
+
hashDigest?: string;
|
4338
|
+
hashDigestLength?: number;
|
4339
|
+
});
|
4298
4340
|
|
4299
4341
|
/**
|
4300
4342
|
* Apply the plugin
|
@@ -6961,6 +7003,7 @@ declare class NaturalModuleIdsPlugin {
|
|
6961
7003
|
apply(compiler: Compiler): void;
|
6962
7004
|
}
|
6963
7005
|
declare interface NeedBuildContext {
|
7006
|
+
compilation: Compilation;
|
6964
7007
|
fileSystemInfo: FileSystemInfo;
|
6965
7008
|
valueCacheVersions: Map<string, string | Set<string>>;
|
6966
7009
|
}
|
@@ -7144,6 +7187,10 @@ declare class NormalModule extends Module {
|
|
7144
7187
|
* resource resolve data
|
7145
7188
|
*/
|
7146
7189
|
resourceResolveData?: Record<string, any>;
|
7190
|
+
/**
|
7191
|
+
* context directory for resolving
|
7192
|
+
*/
|
7193
|
+
context: string;
|
7147
7194
|
/**
|
7148
7195
|
* path + query of the matched resource (virtual)
|
7149
7196
|
*/
|
@@ -7227,6 +7274,7 @@ declare interface NormalModuleCompilationHooks {
|
|
7227
7274
|
readResourceForScheme: HookMap<
|
7228
7275
|
AsyncSeriesBailHook<[string, NormalModule], string | Buffer>
|
7229
7276
|
>;
|
7277
|
+
needBuild: AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>;
|
7230
7278
|
}
|
7231
7279
|
declare abstract class NormalModuleFactory extends ModuleFactory {
|
7232
7280
|
hooks: Readonly<{
|
@@ -7234,6 +7282,9 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
|
|
7234
7282
|
resolveForScheme: HookMap<
|
7235
7283
|
AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>
|
7236
7284
|
>;
|
7285
|
+
resolveInScheme: HookMap<
|
7286
|
+
AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>
|
7287
|
+
>;
|
7237
7288
|
factorize: AsyncSeriesBailHook<[ResolveData], any>;
|
7238
7289
|
beforeResolve: AsyncSeriesBailHook<[ResolveData], any>;
|
7239
7290
|
afterResolve: AsyncSeriesBailHook<[ResolveData], any>;
|
@@ -8973,6 +9024,7 @@ declare interface ResolveData {
|
|
8973
9024
|
request: string;
|
8974
9025
|
assertions?: Record<string, any>;
|
8975
9026
|
dependencies: ModuleDependency[];
|
9027
|
+
dependencyType: string;
|
8976
9028
|
createData: Object;
|
8977
9029
|
fileDependencies: LazySet<string>;
|
8978
9030
|
missingDependencies: LazySet<string>;
|
@@ -9296,6 +9348,7 @@ declare interface ResourceDataWithData {
|
|
9296
9348
|
path: string;
|
9297
9349
|
query: string;
|
9298
9350
|
fragment: string;
|
9351
|
+
context?: string;
|
9299
9352
|
data: Record<string, any>;
|
9300
9353
|
}
|
9301
9354
|
type Rule = string | RegExp;
|
@@ -12194,7 +12247,7 @@ declare namespace exports {
|
|
12194
12247
|
}
|
12195
12248
|
export namespace experiments {
|
12196
12249
|
export namespace schemes {
|
12197
|
-
export { HttpUriPlugin
|
12250
|
+
export { HttpUriPlugin };
|
12198
12251
|
}
|
12199
12252
|
}
|
12200
12253
|
export type WebpackPluginFunction = (
|
@@ -1,63 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
|
6
|
-
"use strict";
|
7
|
-
|
8
|
-
const { URL } = require("url");
|
9
|
-
const NormalModule = require("../NormalModule");
|
10
|
-
|
11
|
-
/** @typedef {import("../Compiler")} Compiler */
|
12
|
-
|
13
|
-
class HttpsUriPlugin {
|
14
|
-
/**
|
15
|
-
* Apply the plugin
|
16
|
-
* @param {Compiler} compiler the compiler instance
|
17
|
-
* @returns {void}
|
18
|
-
*/
|
19
|
-
apply(compiler) {
|
20
|
-
compiler.hooks.compilation.tap(
|
21
|
-
"HttpsUriPlugin",
|
22
|
-
(compilation, { normalModuleFactory }) => {
|
23
|
-
normalModuleFactory.hooks.resolveForScheme
|
24
|
-
.for("https")
|
25
|
-
.tap("HttpsUriPlugin", resourceData => {
|
26
|
-
const url = new URL(resourceData.resource);
|
27
|
-
resourceData.path = url.origin + url.pathname;
|
28
|
-
resourceData.query = url.search;
|
29
|
-
resourceData.fragment = url.hash;
|
30
|
-
return /** @type {true} */ (true);
|
31
|
-
});
|
32
|
-
NormalModule.getCompilationHooks(compilation)
|
33
|
-
.readResourceForScheme.for("https")
|
34
|
-
.tapAsync("HttpsUriPlugin", (resource, module, callback) => {
|
35
|
-
return require("https").get(new URL(resource), res => {
|
36
|
-
if (res.statusCode !== 200) {
|
37
|
-
res.destroy();
|
38
|
-
return callback(
|
39
|
-
new Error(`https request status code = ${res.statusCode}`)
|
40
|
-
);
|
41
|
-
}
|
42
|
-
|
43
|
-
const bufferArr = [];
|
44
|
-
|
45
|
-
res.on("data", chunk => {
|
46
|
-
bufferArr.push(chunk);
|
47
|
-
});
|
48
|
-
|
49
|
-
res.on("end", () => {
|
50
|
-
if (!res.complete) {
|
51
|
-
return callback(new Error("https request was terminated"));
|
52
|
-
}
|
53
|
-
|
54
|
-
callback(null, Buffer.concat(bufferArr));
|
55
|
-
});
|
56
|
-
});
|
57
|
-
});
|
58
|
-
}
|
59
|
-
);
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
module.exports = HttpsUriPlugin;
|