webpack 5.48.0 → 5.51.1
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/README.md +4 -16
- package/hot/only-dev-server.js +1 -1
- package/hot/poll.js +1 -1
- package/hot/signal.js +1 -1
- package/lib/CompatibilityPlugin.js +21 -4
- package/lib/Compilation.js +8 -3
- package/lib/EvalSourceMapDevToolPlugin.js +2 -2
- package/lib/ExternalModuleFactoryPlugin.js +1 -1
- package/lib/FileSystemInfo.js +665 -193
- package/lib/HotModuleReplacementPlugin.js +4 -4
- package/lib/Module.js +1 -0
- package/lib/MultiCompiler.js +0 -2
- package/lib/NormalModule.js +51 -20
- package/lib/NormalModuleFactory.js +137 -74
- package/lib/Parser.js +1 -0
- package/lib/RuntimeGlobals.js +5 -0
- package/lib/SourceMapDevToolPlugin.js +2 -2
- package/lib/WebpackOptionsApply.js +8 -0
- package/lib/asset/AssetModulesPlugin.js +0 -1
- package/lib/config/defaults.js +27 -6
- package/lib/config/normalization.js +6 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +10 -1
- package/lib/hmr/HotModuleReplacement.runtime.js +5 -1
- package/lib/index.js +0 -3
- package/lib/javascript/JavascriptParser.js +2 -0
- package/lib/library/ModuleLibraryPlugin.js +4 -0
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +7 -1
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +2 -2
- package/lib/node/ReadFileCompileWasmPlugin.js +2 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +7 -1
- package/lib/optimize/ConcatenatedModule.js +3 -3
- package/lib/optimize/SplitChunksPlugin.js +4 -4
- package/lib/schemes/HttpUriPlugin.js +942 -25
- package/lib/serialization/BinaryMiddleware.js +293 -267
- package/lib/util/fs.js +40 -0
- package/lib/util/identifier.js +26 -8
- package/lib/wasm-async/{AsyncWasmChunkLoadingRuntimeModule.js → AsyncWasmLoadingRuntimeModule.js} +3 -3
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +18 -2
- package/lib/web/FetchCompileAsyncWasmPlugin.js +2 -2
- package/lib/web/FetchCompileWasmPlugin.js +2 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +21 -8
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +7 -1
- 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 +110 -14
- 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 a 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 a 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
@@ -2388,6 +2388,17 @@ declare class ContextExclusionPlugin {
|
|
2388
2388
|
*/
|
2389
2389
|
apply(compiler: Compiler): void;
|
2390
2390
|
}
|
2391
|
+
declare interface ContextFileSystemInfoEntry {
|
2392
|
+
safeTime: number;
|
2393
|
+
timestampHash?: string;
|
2394
|
+
resolved?: ResolvedContextFileSystemInfoEntry;
|
2395
|
+
symlinks?: Set<string>;
|
2396
|
+
}
|
2397
|
+
declare interface ContextHash {
|
2398
|
+
hash: string;
|
2399
|
+
resolved?: string;
|
2400
|
+
symlinks?: Set<string>;
|
2401
|
+
}
|
2391
2402
|
type ContextMode =
|
2392
2403
|
| "sync"
|
2393
2404
|
| "eager"
|
@@ -2455,6 +2466,13 @@ declare class ContextReplacementPlugin {
|
|
2455
2466
|
newContentRegExp: any;
|
2456
2467
|
apply(compiler?: any): void;
|
2457
2468
|
}
|
2469
|
+
declare interface ContextTimestampAndHash {
|
2470
|
+
safeTime: number;
|
2471
|
+
timestampHash?: string;
|
2472
|
+
hash: string;
|
2473
|
+
resolved?: ResolvedContextTimestampAndHash;
|
2474
|
+
symlinks?: Set<string>;
|
2475
|
+
}
|
2458
2476
|
type CreateStatsOptionsContext = KnownCreateStatsOptionsContext &
|
2459
2477
|
Record<string, any>;
|
2460
2478
|
type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
@@ -3249,6 +3267,11 @@ declare interface Experiments {
|
|
3249
3267
|
*/
|
3250
3268
|
asyncWebAssembly?: boolean;
|
3251
3269
|
|
3270
|
+
/**
|
3271
|
+
* Build http(s): urls using a lockfile and resource content cache.
|
3272
|
+
*/
|
3273
|
+
buildHttp?: boolean | HttpUriOptions;
|
3274
|
+
|
3252
3275
|
/**
|
3253
3276
|
* Enable build-time execution of modules from the module graph for plugins and loaders.
|
3254
3277
|
*/
|
@@ -3963,8 +3986,13 @@ declare abstract class FileSystemInfo {
|
|
3963
3986
|
logger?: WebpackLogger;
|
3964
3987
|
fileTimestampQueue: AsyncQueue<string, string, null | FileSystemInfoEntry>;
|
3965
3988
|
fileHashQueue: AsyncQueue<string, string, null | string>;
|
3966
|
-
contextTimestampQueue: AsyncQueue<
|
3967
|
-
|
3989
|
+
contextTimestampQueue: AsyncQueue<
|
3990
|
+
string,
|
3991
|
+
string,
|
3992
|
+
null | ContextFileSystemInfoEntry
|
3993
|
+
>;
|
3994
|
+
contextHashQueue: AsyncQueue<string, string, null | ContextHash>;
|
3995
|
+
contextTshQueue: AsyncQueue<string, string, null | ContextTimestampAndHash>;
|
3968
3996
|
managedItemQueue: AsyncQueue<string, string, null | string>;
|
3969
3997
|
managedItemDirectoryQueue: AsyncQueue<string, string, Set<string>>;
|
3970
3998
|
managedPaths: string[];
|
@@ -3992,7 +4020,7 @@ declare abstract class FileSystemInfo {
|
|
3992
4020
|
path: string,
|
3993
4021
|
callback: (
|
3994
4022
|
arg0?: WebpackError,
|
3995
|
-
arg1?: null |
|
4023
|
+
arg1?: null | "ignore" | ResolvedContextFileSystemInfoEntry
|
3996
4024
|
) => void
|
3997
4025
|
): void;
|
3998
4026
|
getFileHash(
|
@@ -4003,6 +4031,13 @@ declare abstract class FileSystemInfo {
|
|
4003
4031
|
path: string,
|
4004
4032
|
callback: (arg0?: WebpackError, arg1?: string) => void
|
4005
4033
|
): void;
|
4034
|
+
getContextTsh(
|
4035
|
+
path: string,
|
4036
|
+
callback: (
|
4037
|
+
arg0?: WebpackError,
|
4038
|
+
arg1?: ResolvedContextTimestampAndHash
|
4039
|
+
) => void
|
4040
|
+
): void;
|
4006
4041
|
resolveBuildDependencies(
|
4007
4042
|
context: string,
|
4008
4043
|
deps: Iterable<string>,
|
@@ -4040,7 +4075,6 @@ declare abstract class FileSystemInfo {
|
|
4040
4075
|
declare interface FileSystemInfoEntry {
|
4041
4076
|
safeTime: number;
|
4042
4077
|
timestamp?: number;
|
4043
|
-
timestampHash?: string;
|
4044
4078
|
}
|
4045
4079
|
declare interface FileSystemStats {
|
4046
4080
|
isDirectory: () => boolean;
|
@@ -4285,16 +4319,53 @@ declare interface HotModuleReplacementPluginLoaderContext {
|
|
4285
4319
|
declare class HotUpdateChunk extends Chunk {
|
4286
4320
|
constructor();
|
4287
4321
|
}
|
4288
|
-
|
4289
|
-
|
4322
|
+
|
4323
|
+
/**
|
4324
|
+
* Options for building http resources.
|
4325
|
+
*/
|
4326
|
+
declare interface HttpUriOptions {
|
4327
|
+
/**
|
4328
|
+
* Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
|
4329
|
+
*/
|
4330
|
+
cacheLocation?: string | false;
|
4290
4331
|
|
4291
4332
|
/**
|
4292
|
-
*
|
4333
|
+
* When set, anything that would lead to a modification of the lockfile or any resource content, will result in an error.
|
4293
4334
|
*/
|
4294
|
-
|
4335
|
+
frozen?: boolean;
|
4336
|
+
|
4337
|
+
/**
|
4338
|
+
* Location of the lockfile.
|
4339
|
+
*/
|
4340
|
+
lockfileLocation?: string;
|
4341
|
+
|
4342
|
+
/**
|
4343
|
+
* When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.
|
4344
|
+
*/
|
4345
|
+
upgrade?: boolean;
|
4295
4346
|
}
|
4296
|
-
declare class
|
4297
|
-
constructor(
|
4347
|
+
declare class HttpUriPlugin {
|
4348
|
+
constructor(options?: {
|
4349
|
+
/**
|
4350
|
+
* Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
|
4351
|
+
*/
|
4352
|
+
cacheLocation?: string | false;
|
4353
|
+
/**
|
4354
|
+
* When set, anything that would lead to a modification of the lockfile or any resource content, will result in an error.
|
4355
|
+
*/
|
4356
|
+
frozen?: boolean;
|
4357
|
+
/**
|
4358
|
+
* Location of the lockfile.
|
4359
|
+
*/
|
4360
|
+
lockfileLocation?: string;
|
4361
|
+
/**
|
4362
|
+
* When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.
|
4363
|
+
*/
|
4364
|
+
upgrade?: boolean;
|
4365
|
+
hashFunction?: string | typeof Hash;
|
4366
|
+
hashDigest?: string;
|
4367
|
+
hashDigestLength?: number;
|
4368
|
+
});
|
4298
4369
|
|
4299
4370
|
/**
|
4300
4371
|
* Apply the plugin
|
@@ -4462,6 +4533,10 @@ declare interface InputFileSystem {
|
|
4462
4533
|
arg0: string,
|
4463
4534
|
arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void
|
4464
4535
|
) => void;
|
4536
|
+
lstat?: (
|
4537
|
+
arg0: string,
|
4538
|
+
arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void
|
4539
|
+
) => void;
|
4465
4540
|
realpath?: (
|
4466
4541
|
arg0: string,
|
4467
4542
|
arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: string | Buffer) => void
|
@@ -6961,6 +7036,7 @@ declare class NaturalModuleIdsPlugin {
|
|
6961
7036
|
apply(compiler: Compiler): void;
|
6962
7037
|
}
|
6963
7038
|
declare interface NeedBuildContext {
|
7039
|
+
compilation: Compilation;
|
6964
7040
|
fileSystemInfo: FileSystemInfo;
|
6965
7041
|
valueCacheVersions: Map<string, string | Set<string>>;
|
6966
7042
|
}
|
@@ -7144,6 +7220,10 @@ declare class NormalModule extends Module {
|
|
7144
7220
|
* resource resolve data
|
7145
7221
|
*/
|
7146
7222
|
resourceResolveData?: Record<string, any>;
|
7223
|
+
/**
|
7224
|
+
* context directory for resolving
|
7225
|
+
*/
|
7226
|
+
context: string;
|
7147
7227
|
/**
|
7148
7228
|
* path + query of the matched resource (virtual)
|
7149
7229
|
*/
|
@@ -7227,6 +7307,7 @@ declare interface NormalModuleCompilationHooks {
|
|
7227
7307
|
readResourceForScheme: HookMap<
|
7228
7308
|
AsyncSeriesBailHook<[string, NormalModule], string | Buffer>
|
7229
7309
|
>;
|
7310
|
+
needBuild: AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>;
|
7230
7311
|
}
|
7231
7312
|
declare abstract class NormalModuleFactory extends ModuleFactory {
|
7232
7313
|
hooks: Readonly<{
|
@@ -7234,6 +7315,9 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
|
|
7234
7315
|
resolveForScheme: HookMap<
|
7235
7316
|
AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>
|
7236
7317
|
>;
|
7318
|
+
resolveInScheme: HookMap<
|
7319
|
+
AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>
|
7320
|
+
>;
|
7237
7321
|
factorize: AsyncSeriesBailHook<[ResolveData], any>;
|
7238
7322
|
beforeResolve: AsyncSeriesBailHook<[ResolveData], any>;
|
7239
7323
|
afterResolve: AsyncSeriesBailHook<[ResolveData], any>;
|
@@ -8419,6 +8503,7 @@ declare interface ParserOptionsByModuleTypeUnknown {
|
|
8419
8503
|
}
|
8420
8504
|
type ParserState = Record<string, any> & ParserStateBase;
|
8421
8505
|
declare interface ParserStateBase {
|
8506
|
+
source: string | Buffer;
|
8422
8507
|
current: NormalModule;
|
8423
8508
|
module: NormalModule;
|
8424
8509
|
compilation: Compilation;
|
@@ -8973,6 +9058,7 @@ declare interface ResolveData {
|
|
8973
9058
|
request: string;
|
8974
9059
|
assertions?: Record<string, any>;
|
8975
9060
|
dependencies: ModuleDependency[];
|
9061
|
+
dependencyType: string;
|
8976
9062
|
createData: Object;
|
8977
9063
|
fileDependencies: LazySet<string>;
|
8978
9064
|
missingDependencies: LazySet<string>;
|
@@ -9202,6 +9288,15 @@ declare interface ResolvePluginInstance {
|
|
9202
9288
|
apply: (resolver: Resolver) => void;
|
9203
9289
|
}
|
9204
9290
|
type ResolveRequest = BaseResolveRequest & Partial<ParsedIdentifier>;
|
9291
|
+
declare interface ResolvedContextFileSystemInfoEntry {
|
9292
|
+
safeTime: number;
|
9293
|
+
timestampHash?: string;
|
9294
|
+
}
|
9295
|
+
declare interface ResolvedContextTimestampAndHash {
|
9296
|
+
safeTime: number;
|
9297
|
+
timestampHash?: string;
|
9298
|
+
hash: string;
|
9299
|
+
}
|
9205
9300
|
declare abstract class Resolver {
|
9206
9301
|
fileSystem: FileSystem;
|
9207
9302
|
options: ResolveOptionsTypes;
|
@@ -9296,6 +9391,7 @@ declare interface ResourceDataWithData {
|
|
9296
9391
|
path: string;
|
9297
9392
|
query: string;
|
9298
9393
|
fragment: string;
|
9394
|
+
context?: string;
|
9299
9395
|
data: Record<string, any>;
|
9300
9396
|
}
|
9301
9397
|
type Rule = string | RegExp;
|
@@ -10272,9 +10368,9 @@ declare abstract class Snapshot {
|
|
10272
10368
|
fileTimestamps?: Map<string, FileSystemInfoEntry>;
|
10273
10369
|
fileHashes?: Map<string, string>;
|
10274
10370
|
fileTshs?: Map<string, string | TimestampAndHash>;
|
10275
|
-
contextTimestamps?: Map<string,
|
10371
|
+
contextTimestamps?: Map<string, ResolvedContextFileSystemInfoEntry>;
|
10276
10372
|
contextHashes?: Map<string, string>;
|
10277
|
-
contextTshs?: Map<string,
|
10373
|
+
contextTshs?: Map<string, ResolvedContextTimestampAndHash>;
|
10278
10374
|
missingExistence?: Map<string, boolean>;
|
10279
10375
|
managedItemInfo?: Map<string, string>;
|
10280
10376
|
managedFiles?: Set<string>;
|
@@ -11188,7 +11284,6 @@ declare class Template {
|
|
11188
11284
|
declare interface TimestampAndHash {
|
11189
11285
|
safeTime: number;
|
11190
11286
|
timestamp?: number;
|
11191
|
-
timestampHash?: string;
|
11192
11287
|
hash: string;
|
11193
11288
|
}
|
11194
11289
|
|
@@ -11982,6 +12077,7 @@ declare namespace exports {
|
|
11982
12077
|
export let hmrDownloadUpdateHandlers: string;
|
11983
12078
|
export let hmrModuleData: string;
|
11984
12079
|
export let hmrInvalidateModuleHandlers: string;
|
12080
|
+
export let hmrRuntimeStatePrefix: string;
|
11985
12081
|
export let amdDefine: string;
|
11986
12082
|
export let amdOptions: string;
|
11987
12083
|
export let system: string;
|
@@ -12194,7 +12290,7 @@ declare namespace exports {
|
|
12194
12290
|
}
|
12195
12291
|
export namespace experiments {
|
12196
12292
|
export namespace schemes {
|
12197
|
-
export { HttpUriPlugin
|
12293
|
+
export { HttpUriPlugin };
|
12198
12294
|
}
|
12199
12295
|
}
|
12200
12296
|
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;
|