webpack 5.46.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/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 +44 -19
- package/lib/NormalModuleFactory.js +145 -76
- package/lib/Template.js +1 -4
- package/lib/WebpackOptionsApply.js +8 -0
- package/lib/asset/AssetGenerator.js +1 -1
- package/lib/asset/AssetModulesPlugin.js +0 -1
- package/lib/config/defaults.js +44 -17
- package/lib/config/normalization.js +6 -1
- package/lib/dependencies/AMDRequireDependency.js +2 -8
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +6 -3
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +4 -2
- package/lib/dependencies/HarmonyImportDependency.js +5 -1
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +40 -5
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +2 -2
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +10 -2
- package/lib/dependencies/ModuleDependency.js +8 -1
- package/lib/hmr/HotModuleReplacement.runtime.js +5 -1
- package/lib/index.js +0 -3
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +2 -8
- package/lib/javascript/JavascriptModulesPlugin.js +48 -29
- package/lib/javascript/JavascriptParser.js +14 -9
- package/lib/optimize/SplitChunksPlugin.js +4 -4
- package/lib/rules/{DescriptionDataMatcherRulePlugin.js → ObjectMatcherRulePlugin.js} +14 -10
- package/lib/schemes/HttpUriPlugin.js +942 -25
- package/lib/serialization/BinaryMiddleware.js +0 -2
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +2 -2
- package/package.json +3 -2
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +50 -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 +148 -18
- 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",
|
@@ -3585,6 +3628,13 @@
|
|
3585
3628
|
"type": "object",
|
3586
3629
|
"additionalProperties": false,
|
3587
3630
|
"properties": {
|
3631
|
+
"assert": {
|
3632
|
+
"description": "Match on import assertions of the dependency.",
|
3633
|
+
"type": "object",
|
3634
|
+
"additionalProperties": {
|
3635
|
+
"$ref": "#/definitions/RuleSetConditionOrConditions"
|
3636
|
+
}
|
3637
|
+
},
|
3588
3638
|
"compiler": {
|
3589
3639
|
"description": "Match the child compiler name.",
|
3590
3640
|
"oneOf": [
|
@@ -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
@@ -1099,6 +1099,11 @@ declare interface ChunkRenderContext {
|
|
1099
1099
|
* init fragments for the chunk
|
1100
1100
|
*/
|
1101
1101
|
chunkInitFragments: InitFragment<ChunkRenderContext>[];
|
1102
|
+
|
1103
|
+
/**
|
1104
|
+
* rendering in strict context
|
1105
|
+
*/
|
1106
|
+
strictMode: boolean;
|
1102
1107
|
}
|
1103
1108
|
declare interface ChunkSizeOptions {
|
1104
1109
|
/**
|
@@ -1787,7 +1792,9 @@ declare interface CompilationAssets {
|
|
1787
1792
|
[index: string]: Source;
|
1788
1793
|
}
|
1789
1794
|
declare interface CompilationHooksAsyncWebAssemblyModulesPlugin {
|
1790
|
-
renderModuleContent: SyncWaterfallHook<
|
1795
|
+
renderModuleContent: SyncWaterfallHook<
|
1796
|
+
[Source, Module, WebAssemblyRenderContext]
|
1797
|
+
>;
|
1791
1798
|
}
|
1792
1799
|
declare interface CompilationHooksJavascriptModulesPlugin {
|
1793
1800
|
renderModuleContent: SyncWaterfallHook<[Source, Module, ChunkRenderContext]>;
|
@@ -3242,6 +3249,11 @@ declare interface Experiments {
|
|
3242
3249
|
*/
|
3243
3250
|
asyncWebAssembly?: boolean;
|
3244
3251
|
|
3252
|
+
/**
|
3253
|
+
* Build http(s): urls using a lockfile and resource content cache.
|
3254
|
+
*/
|
3255
|
+
buildHttp?: boolean | HttpUriOptions;
|
3256
|
+
|
3245
3257
|
/**
|
3246
3258
|
* Enable build-time execution of modules from the module graph for plugins and loaders.
|
3247
3259
|
*/
|
@@ -4278,16 +4290,53 @@ declare interface HotModuleReplacementPluginLoaderContext {
|
|
4278
4290
|
declare class HotUpdateChunk extends Chunk {
|
4279
4291
|
constructor();
|
4280
4292
|
}
|
4281
|
-
declare class HttpUriPlugin {
|
4282
|
-
constructor();
|
4283
4293
|
|
4294
|
+
/**
|
4295
|
+
* Options for building http resources.
|
4296
|
+
*/
|
4297
|
+
declare interface HttpUriOptions {
|
4284
4298
|
/**
|
4285
|
-
*
|
4299
|
+
* Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
|
4286
4300
|
*/
|
4287
|
-
|
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;
|
4288
4317
|
}
|
4289
|
-
declare class
|
4290
|
-
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
|
+
});
|
4291
4340
|
|
4292
4341
|
/**
|
4293
4342
|
* Apply the plugin
|
@@ -4517,7 +4566,7 @@ declare class JavascriptModulesPlugin {
|
|
4517
4566
|
module: Module,
|
4518
4567
|
renderContext: ChunkRenderContext,
|
4519
4568
|
hooks: CompilationHooksJavascriptModulesPlugin,
|
4520
|
-
factory: boolean
|
4569
|
+
factory: boolean
|
4521
4570
|
): Source;
|
4522
4571
|
renderChunk(
|
4523
4572
|
renderContext: RenderContext,
|
@@ -4735,21 +4784,44 @@ declare class JavascriptParser extends Parser {
|
|
4735
4784
|
boolean | void
|
4736
4785
|
>;
|
4737
4786
|
label: HookMap<SyncBailHook<[LabeledStatement], boolean | void>>;
|
4738
|
-
import: SyncBailHook<[
|
4787
|
+
import: SyncBailHook<[ImportDeclaration, ImportSource], boolean | void>;
|
4739
4788
|
importSpecifier: SyncBailHook<
|
4740
|
-
[
|
4789
|
+
[ImportDeclaration, ImportSource, string, string],
|
4790
|
+
boolean | void
|
4791
|
+
>;
|
4792
|
+
export: SyncBailHook<
|
4793
|
+
[ExportNamedDeclaration | ExportAllDeclaration],
|
4794
|
+
boolean | void
|
4795
|
+
>;
|
4796
|
+
exportImport: SyncBailHook<
|
4797
|
+
[ExportNamedDeclaration | ExportAllDeclaration, ImportSource],
|
4798
|
+
boolean | void
|
4799
|
+
>;
|
4800
|
+
exportDeclaration: SyncBailHook<
|
4801
|
+
[ExportNamedDeclaration | ExportAllDeclaration, Declaration],
|
4802
|
+
boolean | void
|
4803
|
+
>;
|
4804
|
+
exportExpression: SyncBailHook<
|
4805
|
+
[ExportDefaultDeclaration, Declaration],
|
4741
4806
|
boolean | void
|
4742
4807
|
>;
|
4743
|
-
export: SyncBailHook<[Statement], boolean | void>;
|
4744
|
-
exportImport: SyncBailHook<[Statement, ImportSource], boolean | void>;
|
4745
|
-
exportDeclaration: SyncBailHook<[Statement, Declaration], boolean | void>;
|
4746
|
-
exportExpression: SyncBailHook<[Statement, Declaration], boolean | void>;
|
4747
4808
|
exportSpecifier: SyncBailHook<
|
4748
|
-
[
|
4809
|
+
[
|
4810
|
+
ExportNamedDeclaration | ExportAllDeclaration,
|
4811
|
+
string,
|
4812
|
+
string,
|
4813
|
+
undefined | number
|
4814
|
+
],
|
4749
4815
|
boolean | void
|
4750
4816
|
>;
|
4751
4817
|
exportImportSpecifier: SyncBailHook<
|
4752
|
-
[
|
4818
|
+
[
|
4819
|
+
ExportNamedDeclaration | ExportAllDeclaration,
|
4820
|
+
ImportSource,
|
4821
|
+
string,
|
4822
|
+
string,
|
4823
|
+
undefined | number
|
4824
|
+
],
|
4753
4825
|
boolean | void
|
4754
4826
|
>;
|
4755
4827
|
preDeclarator: SyncBailHook<
|
@@ -6132,6 +6204,11 @@ declare interface MainRenderContext {
|
|
6132
6204
|
* hash to be used for render call
|
6133
6205
|
*/
|
6134
6206
|
hash: string;
|
6207
|
+
|
6208
|
+
/**
|
6209
|
+
* rendering in strict context
|
6210
|
+
*/
|
6211
|
+
strictMode: boolean;
|
6135
6212
|
}
|
6136
6213
|
declare abstract class MainTemplate {
|
6137
6214
|
hooks: Readonly<{
|
@@ -6374,6 +6451,7 @@ declare class ModuleDependency extends Dependency {
|
|
6374
6451
|
request: string;
|
6375
6452
|
userRequest: string;
|
6376
6453
|
range: any;
|
6454
|
+
assertions?: Record<string, any>;
|
6377
6455
|
static Template: typeof DependencyTemplate;
|
6378
6456
|
static NO_EXPORTS_REFERENCED: string[][];
|
6379
6457
|
static EXPORTS_OBJECT_REFERENCED: string[][];
|
@@ -6925,6 +7003,7 @@ declare class NaturalModuleIdsPlugin {
|
|
6925
7003
|
apply(compiler: Compiler): void;
|
6926
7004
|
}
|
6927
7005
|
declare interface NeedBuildContext {
|
7006
|
+
compilation: Compilation;
|
6928
7007
|
fileSystemInfo: FileSystemInfo;
|
6929
7008
|
valueCacheVersions: Map<string, string | Set<string>>;
|
6930
7009
|
}
|
@@ -7108,6 +7187,10 @@ declare class NormalModule extends Module {
|
|
7108
7187
|
* resource resolve data
|
7109
7188
|
*/
|
7110
7189
|
resourceResolveData?: Record<string, any>;
|
7190
|
+
/**
|
7191
|
+
* context directory for resolving
|
7192
|
+
*/
|
7193
|
+
context: string;
|
7111
7194
|
/**
|
7112
7195
|
* path + query of the matched resource (virtual)
|
7113
7196
|
*/
|
@@ -7191,6 +7274,7 @@ declare interface NormalModuleCompilationHooks {
|
|
7191
7274
|
readResourceForScheme: HookMap<
|
7192
7275
|
AsyncSeriesBailHook<[string, NormalModule], string | Buffer>
|
7193
7276
|
>;
|
7277
|
+
needBuild: AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>;
|
7194
7278
|
}
|
7195
7279
|
declare abstract class NormalModuleFactory extends ModuleFactory {
|
7196
7280
|
hooks: Readonly<{
|
@@ -7198,6 +7282,9 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
|
|
7198
7282
|
resolveForScheme: HookMap<
|
7199
7283
|
AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>
|
7200
7284
|
>;
|
7285
|
+
resolveInScheme: HookMap<
|
7286
|
+
AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>
|
7287
|
+
>;
|
7201
7288
|
factorize: AsyncSeriesBailHook<[ResolveData], any>;
|
7202
7289
|
beforeResolve: AsyncSeriesBailHook<[ResolveData], any>;
|
7203
7290
|
afterResolve: AsyncSeriesBailHook<[ResolveData], any>;
|
@@ -8805,6 +8892,11 @@ declare interface RenderContext {
|
|
8805
8892
|
* results of code generation
|
8806
8893
|
*/
|
8807
8894
|
codeGenerationResults: CodeGenerationResults;
|
8895
|
+
|
8896
|
+
/**
|
8897
|
+
* rendering in strict context
|
8898
|
+
*/
|
8899
|
+
strictMode: boolean;
|
8808
8900
|
}
|
8809
8901
|
type RenderManifestEntry =
|
8810
8902
|
| RenderManifestEntryTemplated
|
@@ -8930,7 +9022,9 @@ declare interface ResolveData {
|
|
8930
9022
|
resolveOptions?: ResolveOptionsWebpackOptions;
|
8931
9023
|
context: string;
|
8932
9024
|
request: string;
|
9025
|
+
assertions?: Record<string, any>;
|
8933
9026
|
dependencies: ModuleDependency[];
|
9027
|
+
dependencyType: string;
|
8934
9028
|
createData: Object;
|
8935
9029
|
fileDependencies: LazySet<string>;
|
8936
9030
|
missingDependencies: LazySet<string>;
|
@@ -9254,6 +9348,7 @@ declare interface ResourceDataWithData {
|
|
9254
9348
|
path: string;
|
9255
9349
|
query: string;
|
9256
9350
|
fragment: string;
|
9351
|
+
context?: string;
|
9257
9352
|
data: Record<string, any>;
|
9258
9353
|
}
|
9259
9354
|
type Rule = string | RegExp;
|
@@ -9341,6 +9436,11 @@ declare interface RuleSetLogicalConditionsAbsolute {
|
|
9341
9436
|
* A rule description with conditions and effects for modules.
|
9342
9437
|
*/
|
9343
9438
|
declare interface RuleSetRule {
|
9439
|
+
/**
|
9440
|
+
* Match on import assertions of the dependency.
|
9441
|
+
*/
|
9442
|
+
assert?: { [index: string]: RuleSetConditionOrConditions };
|
9443
|
+
|
9344
9444
|
/**
|
9345
9445
|
* Match the child compiler name.
|
9346
9446
|
*/
|
@@ -11129,7 +11229,6 @@ declare class Template {
|
|
11129
11229
|
runtimeModules: RuntimeModule[],
|
11130
11230
|
renderContext: RenderContext & {
|
11131
11231
|
codeGenerationResults?: CodeGenerationResults;
|
11132
|
-
useStrict?: boolean;
|
11133
11232
|
}
|
11134
11233
|
): Source;
|
11135
11234
|
static renderChunkRuntimeModules(
|
@@ -11462,6 +11561,37 @@ declare abstract class Watching {
|
|
11462
11561
|
resume(): void;
|
11463
11562
|
close(callback: CallbackFunction<void>): void;
|
11464
11563
|
}
|
11564
|
+
declare interface WebAssemblyRenderContext {
|
11565
|
+
/**
|
11566
|
+
* the chunk
|
11567
|
+
*/
|
11568
|
+
chunk: Chunk;
|
11569
|
+
|
11570
|
+
/**
|
11571
|
+
* the dependency templates
|
11572
|
+
*/
|
11573
|
+
dependencyTemplates: DependencyTemplates;
|
11574
|
+
|
11575
|
+
/**
|
11576
|
+
* the runtime template
|
11577
|
+
*/
|
11578
|
+
runtimeTemplate: RuntimeTemplate;
|
11579
|
+
|
11580
|
+
/**
|
11581
|
+
* the module graph
|
11582
|
+
*/
|
11583
|
+
moduleGraph: ModuleGraph;
|
11584
|
+
|
11585
|
+
/**
|
11586
|
+
* the chunk graph
|
11587
|
+
*/
|
11588
|
+
chunkGraph: ChunkGraph;
|
11589
|
+
|
11590
|
+
/**
|
11591
|
+
* results of code generation
|
11592
|
+
*/
|
11593
|
+
codeGenerationResults: CodeGenerationResults;
|
11594
|
+
}
|
11465
11595
|
declare class WebWorkerTemplatePlugin {
|
11466
11596
|
constructor();
|
11467
11597
|
|
@@ -12117,7 +12247,7 @@ declare namespace exports {
|
|
12117
12247
|
}
|
12118
12248
|
export namespace experiments {
|
12119
12249
|
export namespace schemes {
|
12120
|
-
export { HttpUriPlugin
|
12250
|
+
export { HttpUriPlugin };
|
12121
12251
|
}
|
12122
12252
|
}
|
12123
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;
|