webpack 5.81.0 → 5.82.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/bin/webpack.js +13 -2
- package/lib/Compilation.js +2 -0
- package/lib/CssModule.js +39 -7
- package/lib/WebpackOptionsApply.js +33 -40
- package/lib/cache/MemoryWithGcCachePlugin.js +2 -0
- package/lib/config/defaults.js +1 -0
- package/lib/css/CssGenerator.js +4 -0
- package/lib/css/CssLoadingRuntimeModule.js +9 -2
- package/lib/css/CssModulesPlugin.js +136 -33
- package/lib/css/CssParser.js +144 -80
- package/lib/css/walkCssTokens.js +96 -20
- package/lib/debug/ProfilingPlugin.js +2 -0
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +1 -0
- package/lib/javascript/BasicEvaluatedExpression.js +108 -1
- package/lib/javascript/JavascriptParser.js +132 -11
- package/lib/json/JsonData.js +25 -0
- package/lib/json/JsonGenerator.js +15 -3
- package/lib/json/JsonModulesPlugin.js +1 -0
- package/lib/json/JsonParser.js +2 -1
- package/lib/library/ModuleLibraryPlugin.js +2 -1
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +4 -0
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +22 -3
- package/lib/schemes/DataUriPlugin.js +4 -0
- package/lib/schemes/HttpUriPlugin.js +38 -0
- package/lib/sharing/utils.js +293 -7
- package/lib/stats/DefaultStatsPrinterPlugin.js +25 -0
- package/lib/util/StackedCacheMap.js +6 -0
- package/lib/util/StringXor.js +51 -0
- package/lib/util/compileBooleanMatcher.js +31 -0
- package/lib/util/deprecation.js +8 -0
- package/lib/util/identifier.js +4 -0
- package/lib/util/numberHash.js +75 -21
- package/lib/util/propertyAccess.js +5 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +4 -0
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -0
- package/lib/wasm-async/AsyncWebAssemblyParser.js +1 -1
- package/package.json +1 -1
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +25 -0
- package/types.d.ts +121 -26
@@ -944,6 +944,24 @@
|
|
944
944
|
}
|
945
945
|
}
|
946
946
|
},
|
947
|
+
"Extends": {
|
948
|
+
"description": "Extend configuration from another configuration (only works when using webpack-cli).",
|
949
|
+
"anyOf": [
|
950
|
+
{
|
951
|
+
"type": "array",
|
952
|
+
"items": {
|
953
|
+
"$ref": "#/definitions/ExtendsItem"
|
954
|
+
}
|
955
|
+
},
|
956
|
+
{
|
957
|
+
"$ref": "#/definitions/ExtendsItem"
|
958
|
+
}
|
959
|
+
]
|
960
|
+
},
|
961
|
+
"ExtendsItem": {
|
962
|
+
"description": "Path to the configuration to be extended (only works when using webpack-cli).",
|
963
|
+
"type": "string"
|
964
|
+
},
|
947
965
|
"ExternalItem": {
|
948
966
|
"description": "Specify dependency that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.",
|
949
967
|
"anyOf": [
|
@@ -5021,6 +5039,10 @@
|
|
5021
5039
|
"type": "object",
|
5022
5040
|
"additionalProperties": false,
|
5023
5041
|
"properties": {
|
5042
|
+
"onPolicyCreationFailure": {
|
5043
|
+
"description": "If the call to `trustedTypes.createPolicy(...)` fails -- e.g., due to the policy name missing from the CSP `trusted-types` list, or it being a duplicate name, etc. -- controls whether to continue with loading in the hope that `require-trusted-types-for 'script'` isn't enforced yet, versus fail immediately. Default behavior is 'stop'.",
|
5044
|
+
"enum": ["continue", "stop"]
|
5045
|
+
},
|
5024
5046
|
"policyName": {
|
5025
5047
|
"description": "The name of the Trusted Types policy created by webpack to serve bundle chunks.",
|
5026
5048
|
"type": "string",
|
@@ -5349,6 +5371,9 @@
|
|
5349
5371
|
"experiments": {
|
5350
5372
|
"$ref": "#/definitions/Experiments"
|
5351
5373
|
},
|
5374
|
+
"extends": {
|
5375
|
+
"$ref": "#/definitions/Extends"
|
5376
|
+
},
|
5352
5377
|
"externals": {
|
5353
5378
|
"$ref": "#/definitions/Externals"
|
5354
5379
|
},
|
package/types.d.ts
CHANGED
@@ -482,9 +482,9 @@ declare abstract class BasicEvaluatedExpression {
|
|
482
482
|
options?: BasicEvaluatedExpression[];
|
483
483
|
prefix?: BasicEvaluatedExpression;
|
484
484
|
postfix?: BasicEvaluatedExpression;
|
485
|
-
wrappedInnerExpressions:
|
485
|
+
wrappedInnerExpressions: BasicEvaluatedExpression[];
|
486
486
|
identifier?: string | VariableInfoInterface;
|
487
|
-
rootInfo: VariableInfoInterface;
|
487
|
+
rootInfo: string | VariableInfoInterface;
|
488
488
|
getMembers: () => string[];
|
489
489
|
getMembersOptionals: () => boolean[];
|
490
490
|
expression: NodeEstreeIndex;
|
@@ -525,43 +525,116 @@ declare abstract class BasicEvaluatedExpression {
|
|
525
525
|
* Can this expression have side effects?
|
526
526
|
*/
|
527
527
|
couldHaveSideEffects(): boolean;
|
528
|
-
|
528
|
+
|
529
|
+
/**
|
530
|
+
* Creates a boolean representation of this evaluated expression.
|
531
|
+
*/
|
532
|
+
asBool(): undefined | boolean;
|
533
|
+
|
534
|
+
/**
|
535
|
+
* Creates a nullish coalescing representation of this evaluated expression.
|
536
|
+
*/
|
529
537
|
asNullish(): undefined | boolean;
|
530
|
-
|
538
|
+
|
539
|
+
/**
|
540
|
+
* Creates a string representation of this evaluated expression.
|
541
|
+
*/
|
542
|
+
asString(): undefined | string;
|
531
543
|
setString(string?: any): BasicEvaluatedExpression;
|
532
544
|
setUndefined(): BasicEvaluatedExpression;
|
533
545
|
setNull(): BasicEvaluatedExpression;
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
546
|
+
|
547
|
+
/**
|
548
|
+
* Set's the value of this expression to a number
|
549
|
+
*/
|
550
|
+
setNumber(number: number): BasicEvaluatedExpression;
|
551
|
+
|
552
|
+
/**
|
553
|
+
* Set's the value of this expression to a BigInt
|
554
|
+
*/
|
555
|
+
setBigInt(bigint: bigint): BasicEvaluatedExpression;
|
556
|
+
|
557
|
+
/**
|
558
|
+
* Set's the value of this expression to a boolean
|
559
|
+
*/
|
560
|
+
setBoolean(bool: boolean): BasicEvaluatedExpression;
|
561
|
+
|
562
|
+
/**
|
563
|
+
* Set's the value of this expression to a regular expression
|
564
|
+
*/
|
565
|
+
setRegExp(regExp: RegExp): BasicEvaluatedExpression;
|
566
|
+
|
567
|
+
/**
|
568
|
+
* Set's the value of this expression to a particular identifier and its members.
|
569
|
+
*/
|
538
570
|
setIdentifier(
|
539
|
-
identifier
|
540
|
-
rootInfo
|
541
|
-
getMembers
|
542
|
-
getMembersOptionals?:
|
571
|
+
identifier: string | VariableInfoInterface,
|
572
|
+
rootInfo: string | VariableInfoInterface,
|
573
|
+
getMembers: () => string[],
|
574
|
+
getMembersOptionals?: () => boolean[]
|
543
575
|
): BasicEvaluatedExpression;
|
576
|
+
|
577
|
+
/**
|
578
|
+
* Wraps an array of expressions with a prefix and postfix expression.
|
579
|
+
*/
|
544
580
|
setWrapped(
|
545
|
-
prefix
|
546
|
-
postfix
|
547
|
-
innerExpressions
|
581
|
+
prefix: null | BasicEvaluatedExpression,
|
582
|
+
postfix: BasicEvaluatedExpression,
|
583
|
+
innerExpressions: BasicEvaluatedExpression[]
|
548
584
|
): BasicEvaluatedExpression;
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
585
|
+
|
586
|
+
/**
|
587
|
+
* Stores the options of a conditional expression.
|
588
|
+
*/
|
589
|
+
setOptions(options: BasicEvaluatedExpression[]): BasicEvaluatedExpression;
|
590
|
+
|
591
|
+
/**
|
592
|
+
* Adds options to a conditional expression.
|
593
|
+
*/
|
594
|
+
addOptions(options: BasicEvaluatedExpression[]): BasicEvaluatedExpression;
|
595
|
+
|
596
|
+
/**
|
597
|
+
* Set's the value of this expression to an array of expressions.
|
598
|
+
*/
|
599
|
+
setItems(items: BasicEvaluatedExpression[]): BasicEvaluatedExpression;
|
600
|
+
|
601
|
+
/**
|
602
|
+
* Set's the value of this expression to an array of strings.
|
603
|
+
*/
|
604
|
+
setArray(array: string[]): BasicEvaluatedExpression;
|
605
|
+
|
606
|
+
/**
|
607
|
+
* Set's the value of this expression to a processed/unprocessed template string. Used
|
608
|
+
* for evaluating TemplateLiteral expressions in the JavaScript Parser.
|
609
|
+
*/
|
553
610
|
setTemplateString(
|
554
|
-
quasis
|
555
|
-
parts
|
556
|
-
kind
|
611
|
+
quasis: BasicEvaluatedExpression[],
|
612
|
+
parts: BasicEvaluatedExpression[],
|
613
|
+
kind: "raw" | "cooked"
|
557
614
|
): BasicEvaluatedExpression;
|
558
|
-
templateStringKind
|
615
|
+
templateStringKind?: "raw" | "cooked";
|
559
616
|
setTruthy(): BasicEvaluatedExpression;
|
560
617
|
setFalsy(): BasicEvaluatedExpression;
|
561
|
-
|
562
|
-
|
618
|
+
|
619
|
+
/**
|
620
|
+
* Set's the value of the expression to nullish.
|
621
|
+
*/
|
622
|
+
setNullish(value: boolean): BasicEvaluatedExpression;
|
623
|
+
|
624
|
+
/**
|
625
|
+
* Set's the range for the expression.
|
626
|
+
*/
|
627
|
+
setRange(range: [number, number]): BasicEvaluatedExpression;
|
628
|
+
|
629
|
+
/**
|
630
|
+
* Set whether or not the expression has side effects.
|
631
|
+
*/
|
563
632
|
setSideEffects(sideEffects?: boolean): BasicEvaluatedExpression;
|
564
|
-
|
633
|
+
|
634
|
+
/**
|
635
|
+
* Set the expression node for the expression.
|
636
|
+
*/
|
637
|
+
setExpression(expression: NodeEstreeIndex): BasicEvaluatedExpression;
|
565
638
|
}
|
566
639
|
type BuildMeta = KnownBuildMeta & Record<string, any>;
|
567
640
|
declare abstract class ByTypeGenerator extends Generator {
|
@@ -2123,6 +2196,11 @@ declare interface Configuration {
|
|
2123
2196
|
*/
|
2124
2197
|
experiments?: Experiments;
|
2125
2198
|
|
2199
|
+
/**
|
2200
|
+
* Extend configuration from another configuration (only works when using webpack-cli).
|
2201
|
+
*/
|
2202
|
+
extends?: string | string[];
|
2203
|
+
|
2126
2204
|
/**
|
2127
2205
|
* Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
|
2128
2206
|
*/
|
@@ -10938,6 +11016,12 @@ declare interface RuntimeValueOptions {
|
|
10938
11016
|
buildDependencies?: string[];
|
10939
11017
|
version?: string | (() => string);
|
10940
11018
|
}
|
11019
|
+
|
11020
|
+
/**
|
11021
|
+
* Helper function for joining two ranges into a single range. This is useful
|
11022
|
+
* when working with AST nodes, as it allows you to combine the ranges of child nodes
|
11023
|
+
* to create the range of the _parent node_.
|
11024
|
+
*/
|
10941
11025
|
declare interface ScopeInfo {
|
10942
11026
|
definitions: StackedMap<string, ScopeInfo | VariableInfo>;
|
10943
11027
|
topLevelScope: boolean | "arrow";
|
@@ -11975,6 +12059,12 @@ declare interface SyntheticDependencyLocation {
|
|
11975
12059
|
declare const TOMBSTONE: unique symbol;
|
11976
12060
|
declare const TRANSITIVE: unique symbol;
|
11977
12061
|
declare const TRANSITIVE_ONLY: unique symbol;
|
12062
|
+
|
12063
|
+
/**
|
12064
|
+
* Helper function for joining two ranges into a single range. This is useful
|
12065
|
+
* when working with AST nodes, as it allows you to combine the ranges of child nodes
|
12066
|
+
* to create the range of the _parent node_.
|
12067
|
+
*/
|
11978
12068
|
declare interface TagInfo {
|
11979
12069
|
tag: any;
|
11980
12070
|
data: any;
|
@@ -12026,6 +12116,11 @@ declare class TopLevelSymbol {
|
|
12026
12116
|
* Use a Trusted Types policy to create urls for chunks.
|
12027
12117
|
*/
|
12028
12118
|
declare interface TrustedTypes {
|
12119
|
+
/**
|
12120
|
+
* If the call to `trustedTypes.createPolicy(...)` fails -- e.g., due to the policy name missing from the CSP `trusted-types` list, or it being a duplicate name, etc. -- controls whether to continue with loading in the hope that `require-trusted-types-for 'script'` isn't enforced yet, versus fail immediately. Default behavior is 'stop'.
|
12121
|
+
*/
|
12122
|
+
onPolicyCreationFailure?: "continue" | "stop";
|
12123
|
+
|
12029
12124
|
/**
|
12030
12125
|
* The name of the Trusted Types policy created by webpack to serve bundle chunks.
|
12031
12126
|
*/
|