webpack 5.71.0 → 5.73.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/BannerPlugin.js +3 -1
- package/lib/ChunkGraph.js +93 -6
- package/lib/Compilation.js +5 -1
- package/lib/Compiler.js +1 -1
- package/lib/DllReferencePlugin.js +1 -1
- package/lib/ExportsInfo.js +1 -1
- package/lib/Module.js +1 -0
- package/lib/NodeStuffPlugin.js +1 -1
- package/lib/NormalModule.js +4 -3
- package/lib/RuntimePlugin.js +7 -0
- package/lib/asset/AssetGenerator.js +36 -9
- package/lib/asset/AssetParser.js +1 -0
- package/lib/asset/AssetSourceGenerator.js +31 -6
- package/lib/asset/AssetSourceParser.js +1 -0
- package/lib/cache/PackFileCacheStrategy.js +8 -4
- package/lib/config/defaults.js +12 -4
- package/lib/container/RemoteRuntimeModule.js +8 -7
- package/lib/dependencies/CommonJsImportsParserPlugin.js +342 -61
- package/lib/dependencies/CommonJsRequireContextDependency.js +2 -2
- package/lib/dependencies/CommonJsRequireDependency.js +2 -1
- package/lib/dependencies/ContextDependency.js +15 -2
- package/lib/dependencies/ContextDependencyHelpers.js +18 -5
- package/lib/dependencies/ContextElementDependency.js +0 -16
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +35 -3
- package/lib/dependencies/ImportParserPlugin.js +31 -25
- package/lib/dependencies/JsonExportsDependency.js +17 -21
- package/lib/dependencies/LoaderDependency.js +13 -0
- package/lib/dependencies/LoaderImportDependency.js +13 -0
- package/lib/dependencies/ModuleDependency.js +11 -1
- package/lib/dependencies/RequireResolveContextDependency.js +2 -2
- package/lib/dependencies/RequireResolveDependency.js +2 -1
- package/lib/dependencies/URLPlugin.js +21 -0
- package/lib/index.js +1 -0
- package/lib/javascript/JavascriptParser.js +40 -19
- package/lib/json/JsonData.js +8 -0
- package/lib/json/JsonParser.js +4 -6
- package/lib/optimize/ConcatenatedModule.js +2 -1
- package/lib/optimize/ModuleConcatenationPlugin.js +21 -2
- package/lib/runtime/AsyncModuleRuntimeModule.js +34 -58
- package/lib/runtime/NonceRuntimeModule.js +24 -0
- package/lib/sharing/ProvideSharedPlugin.js +1 -2
- package/package.json +3 -3
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +37 -0
- package/schemas/plugins/BannerPlugin.check.js +1 -1
- package/schemas/plugins/BannerPlugin.json +4 -0
- package/types.d.ts +51 -3
@@ -1580,6 +1580,43 @@
|
|
1580
1580
|
"description": "Enable/disable parsing of magic comments in CommonJs syntax.",
|
1581
1581
|
"type": "boolean"
|
1582
1582
|
},
|
1583
|
+
"createRequire": {
|
1584
|
+
"description": "Enable/disable parsing \"import { createRequire } from \"module\"\" and evaluating createRequire().",
|
1585
|
+
"anyOf": [
|
1586
|
+
{
|
1587
|
+
"type": "boolean"
|
1588
|
+
},
|
1589
|
+
{
|
1590
|
+
"type": "string"
|
1591
|
+
}
|
1592
|
+
]
|
1593
|
+
},
|
1594
|
+
"dynamicImportMode": {
|
1595
|
+
"description": "Specifies global mode for dynamic import.",
|
1596
|
+
"enum": ["eager", "weak", "lazy", "lazy-once"]
|
1597
|
+
},
|
1598
|
+
"dynamicImportPrefetch": {
|
1599
|
+
"description": "Specifies global prefetch for dynamic import.",
|
1600
|
+
"anyOf": [
|
1601
|
+
{
|
1602
|
+
"type": "number"
|
1603
|
+
},
|
1604
|
+
{
|
1605
|
+
"type": "boolean"
|
1606
|
+
}
|
1607
|
+
]
|
1608
|
+
},
|
1609
|
+
"dynamicImportPreload": {
|
1610
|
+
"description": "Specifies global preload for dynamic import.",
|
1611
|
+
"anyOf": [
|
1612
|
+
{
|
1613
|
+
"type": "number"
|
1614
|
+
},
|
1615
|
+
{
|
1616
|
+
"type": "boolean"
|
1617
|
+
}
|
1618
|
+
]
|
1619
|
+
},
|
1583
1620
|
"exportsPresence": {
|
1584
1621
|
"description": "Specifies the behavior of invalid export names in \"import ... from ...\" and \"export ... from ...\".",
|
1585
1622
|
"enum": ["error", "warn", "auto", false]
|
@@ -3,4 +3,4 @@
|
|
3
3
|
* DO NOT MODIFY BY HAND.
|
4
4
|
* Run `yarn special-lint-fix` to update
|
5
5
|
*/
|
6
|
-
"use strict";function n(t,{instancePath:l="",parentData:
|
6
|
+
"use strict";function n(t,{instancePath:l="",parentData:e,parentDataProperty:s,rootData:a=t}={}){let r=null,o=0;const u=o;let i=!1;const p=o;if(o===p)if(Array.isArray(t)){const n=t.length;for(let l=0;l<n;l++){let n=t[l];const e=o,s=o;let a=!1,u=null;const i=o,p=o;let f=!1;const h=o;if(!(n instanceof RegExp)){const n={params:{}};null===r?r=[n]:r.push(n),o++}var c=h===o;if(f=f||c,!f){const t=o;if(o===t)if("string"==typeof n){if(n.length<1){const n={params:{}};null===r?r=[n]:r.push(n),o++}}else{const n={params:{type:"string"}};null===r?r=[n]:r.push(n),o++}c=t===o,f=f||c}if(f)o=p,null!==r&&(p?r.length=p:r=null);else{const n={params:{}};null===r?r=[n]:r.push(n),o++}if(i===o&&(a=!0,u=0),a)o=s,null!==r&&(s?r.length=s:r=null);else{const n={params:{passingSchemas:u}};null===r?r=[n]:r.push(n),o++}if(e!==o)break}}else{const n={params:{type:"array"}};null===r?r=[n]:r.push(n),o++}var f=p===o;if(i=i||f,!i){const n=o,l=o;let e=!1;const s=o;if(!(t instanceof RegExp)){const n={params:{}};null===r?r=[n]:r.push(n),o++}var h=s===o;if(e=e||h,!e){const n=o;if(o===n)if("string"==typeof t){if(t.length<1){const n={params:{}};null===r?r=[n]:r.push(n),o++}}else{const n={params:{type:"string"}};null===r?r=[n]:r.push(n),o++}h=n===o,e=e||h}if(e)o=l,null!==r&&(l?r.length=l:r=null);else{const n={params:{}};null===r?r=[n]:r.push(n),o++}f=n===o,i=i||f}if(!i){const t={params:{}};return null===r?r=[t]:r.push(t),o++,n.errors=r,!1}return o=u,null!==r&&(u?r.length=u:r=null),n.errors=r,0===o}function t(l,{instancePath:e="",parentData:s,parentDataProperty:a,rootData:r=l}={}){let o=null,u=0;const i=u;let p=!1;const c=u;if(u===c)if("string"==typeof l){if(l.length<1){const n={params:{}};null===o?o=[n]:o.push(n),u++}}else{const n={params:{type:"string"}};null===o?o=[n]:o.push(n),u++}var f=c===u;if(p=p||f,!p){const t=u;if(u===t)if(l&&"object"==typeof l&&!Array.isArray(l)){let t;if(void 0===l.banner&&(t="banner")){const n={params:{missingProperty:t}};null===o?o=[n]:o.push(n),u++}else{const t=u;for(const n in l)if("banner"!==n&&"entryOnly"!==n&&"exclude"!==n&&"footer"!==n&&"include"!==n&&"raw"!==n&&"test"!==n){const t={params:{additionalProperty:n}};null===o?o=[t]:o.push(t),u++;break}if(t===u){if(void 0!==l.banner){let n=l.banner;const t=u,e=u;let s=!1;const a=u;if("string"!=typeof n){const n={params:{type:"string"}};null===o?o=[n]:o.push(n),u++}var h=a===u;if(s=s||h,!s){const t=u;if(!(n instanceof Function)){const n={params:{}};null===o?o=[n]:o.push(n),u++}h=t===u,s=s||h}if(s)u=e,null!==o&&(e?o.length=e:o=null);else{const n={params:{}};null===o?o=[n]:o.push(n),u++}var y=t===u}else y=!0;if(y){if(void 0!==l.entryOnly){const n=u;if("boolean"!=typeof l.entryOnly){const n={params:{type:"boolean"}};null===o?o=[n]:o.push(n),u++}y=n===u}else y=!0;if(y){if(void 0!==l.exclude){const t=u,s=u;let a=!1,i=null;const p=u;if(n(l.exclude,{instancePath:e+"/exclude",parentData:l,parentDataProperty:"exclude",rootData:r})||(o=null===o?n.errors:o.concat(n.errors),u=o.length),p===u&&(a=!0,i=0),a)u=s,null!==o&&(s?o.length=s:o=null);else{const n={params:{passingSchemas:i}};null===o?o=[n]:o.push(n),u++}y=t===u}else y=!0;if(y){if(void 0!==l.footer){const n=u;if("boolean"!=typeof l.footer){const n={params:{type:"boolean"}};null===o?o=[n]:o.push(n),u++}y=n===u}else y=!0;if(y){if(void 0!==l.include){const t=u,s=u;let a=!1,i=null;const p=u;if(n(l.include,{instancePath:e+"/include",parentData:l,parentDataProperty:"include",rootData:r})||(o=null===o?n.errors:o.concat(n.errors),u=o.length),p===u&&(a=!0,i=0),a)u=s,null!==o&&(s?o.length=s:o=null);else{const n={params:{passingSchemas:i}};null===o?o=[n]:o.push(n),u++}y=t===u}else y=!0;if(y){if(void 0!==l.raw){const n=u;if("boolean"!=typeof l.raw){const n={params:{type:"boolean"}};null===o?o=[n]:o.push(n),u++}y=n===u}else y=!0;if(y)if(void 0!==l.test){const t=u,s=u;let a=!1,i=null;const p=u;if(n(l.test,{instancePath:e+"/test",parentData:l,parentDataProperty:"test",rootData:r})||(o=null===o?n.errors:o.concat(n.errors),u=o.length),p===u&&(a=!0,i=0),a)u=s,null!==o&&(s?o.length=s:o=null);else{const n={params:{passingSchemas:i}};null===o?o=[n]:o.push(n),u++}y=t===u}else y=!0}}}}}}}}else{const n={params:{type:"object"}};null===o?o=[n]:o.push(n),u++}if(f=t===u,p=p||f,!p){const n=u;if(!(l instanceof Function)){const n={params:{}};null===o?o=[n]:o.push(n),u++}f=n===u,p=p||f}}if(!p){const n={params:{}};return null===o?o=[n]:o.push(n),u++,t.errors=o,!1}return u=i,null!==o&&(i?o.length=i:o=null),t.errors=o,0===u}module.exports=t,module.exports.default=t;
|
package/types.d.ts
CHANGED
@@ -430,6 +430,11 @@ declare interface BannerPluginOptions {
|
|
430
430
|
*/
|
431
431
|
exclude?: string | RegExp | Rule[];
|
432
432
|
|
433
|
+
/**
|
434
|
+
* If true, banner will be placed at the end of the output.
|
435
|
+
*/
|
436
|
+
footer?: boolean;
|
437
|
+
|
433
438
|
/**
|
434
439
|
* Include all modules matching any of these conditions.
|
435
440
|
*/
|
@@ -812,6 +817,13 @@ declare class ChunkGraph {
|
|
812
817
|
chunk: Chunk,
|
813
818
|
sourceType: string
|
814
819
|
): undefined | Iterable<Module>;
|
820
|
+
setChunkModuleSourceTypes(
|
821
|
+
chunk: Chunk,
|
822
|
+
module: Module,
|
823
|
+
sourceTypes: Set<string>
|
824
|
+
): void;
|
825
|
+
getChunkModuleSourceTypes(chunk: Chunk, module: Module): Set<string>;
|
826
|
+
getModuleSourceTypes(module: Module): Set<string>;
|
815
827
|
getOrderedChunkModulesIterable(
|
816
828
|
chunk: Chunk,
|
817
829
|
comparator: (arg0: Module, arg1: Module) => 0 | 1 | -1
|
@@ -1247,6 +1259,11 @@ declare interface CodeGenerationContext {
|
|
1247
1259
|
* the compilation
|
1248
1260
|
*/
|
1249
1261
|
compilation?: Compilation;
|
1262
|
+
|
1263
|
+
/**
|
1264
|
+
* source types
|
1265
|
+
*/
|
1266
|
+
sourceTypes?: ReadonlySet<string>;
|
1250
1267
|
}
|
1251
1268
|
declare interface CodeGenerationResult {
|
1252
1269
|
/**
|
@@ -2486,11 +2503,11 @@ declare interface ContextHash {
|
|
2486
2503
|
}
|
2487
2504
|
type ContextMode =
|
2488
2505
|
| "weak"
|
2489
|
-
| "sync"
|
2490
2506
|
| "eager"
|
2491
|
-
| "async-weak"
|
2492
2507
|
| "lazy"
|
2493
|
-
| "lazy-once"
|
2508
|
+
| "lazy-once"
|
2509
|
+
| "sync"
|
2510
|
+
| "async-weak";
|
2494
2511
|
declare abstract class ContextModuleFactory extends ModuleFactory {
|
2495
2512
|
hooks: Readonly<{
|
2496
2513
|
beforeResolve: AsyncSeriesWaterfallHook<[any]>;
|
@@ -4885,6 +4902,15 @@ declare class JavascriptParser extends Parser {
|
|
4885
4902
|
undefined | null | BasicEvaluatedExpression
|
4886
4903
|
>
|
4887
4904
|
>;
|
4905
|
+
evaluateNewExpression: HookMap<
|
4906
|
+
SyncBailHook<[NewExpression], undefined | null | BasicEvaluatedExpression>
|
4907
|
+
>;
|
4908
|
+
evaluateCallExpression: HookMap<
|
4909
|
+
SyncBailHook<
|
4910
|
+
[CallExpression],
|
4911
|
+
undefined | null | BasicEvaluatedExpression
|
4912
|
+
>
|
4913
|
+
>;
|
4888
4914
|
evaluateCallExpressionMember: HookMap<
|
4889
4915
|
SyncBailHook<
|
4890
4916
|
[CallExpression, undefined | BasicEvaluatedExpression],
|
@@ -5393,6 +5419,7 @@ declare class JavascriptParser extends Parser {
|
|
5393
5419
|
isVariableDefined(name?: any): boolean;
|
5394
5420
|
getVariableInfo(name: string): ExportedVariableInfo;
|
5395
5421
|
setVariable(name: string, variableInfo: ExportedVariableInfo): void;
|
5422
|
+
evaluatedVariable(tagInfo?: any): VariableInfo;
|
5396
5423
|
parseCommentOptions(
|
5397
5424
|
range?: any
|
5398
5425
|
): { options: null; errors: null } | { options: object; errors: unknown[] };
|
@@ -5473,6 +5500,26 @@ declare interface JavascriptParserOptions {
|
|
5473
5500
|
*/
|
5474
5501
|
commonjsMagicComments?: boolean;
|
5475
5502
|
|
5503
|
+
/**
|
5504
|
+
* Enable/disable parsing "import { createRequire } from "module"" and evaluating createRequire().
|
5505
|
+
*/
|
5506
|
+
createRequire?: string | boolean;
|
5507
|
+
|
5508
|
+
/**
|
5509
|
+
* Specifies global mode for dynamic import.
|
5510
|
+
*/
|
5511
|
+
dynamicImportMode?: "weak" | "eager" | "lazy" | "lazy-once";
|
5512
|
+
|
5513
|
+
/**
|
5514
|
+
* Specifies global prefetch for dynamic import.
|
5515
|
+
*/
|
5516
|
+
dynamicImportPrefetch?: number | boolean;
|
5517
|
+
|
5518
|
+
/**
|
5519
|
+
* Specifies global preload for dynamic import.
|
5520
|
+
*/
|
5521
|
+
dynamicImportPreload?: number | boolean;
|
5522
|
+
|
5476
5523
|
/**
|
5477
5524
|
* Specifies the behavior of invalid export names in "import ... from ..." and "export ... from ...".
|
5478
5525
|
*/
|
@@ -13046,6 +13093,7 @@ declare namespace exports {
|
|
13046
13093
|
Asset,
|
13047
13094
|
AssetInfo,
|
13048
13095
|
EntryOptions,
|
13096
|
+
PathData,
|
13049
13097
|
AssetEmittedInfo,
|
13050
13098
|
MultiStats,
|
13051
13099
|
ParserState,
|