webpack 5.44.0 → 5.45.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.

@@ -3585,6 +3585,13 @@
3585
3585
  "type": "object",
3586
3586
  "additionalProperties": false,
3587
3587
  "properties": {
3588
+ "assert": {
3589
+ "description": "Match on import assertions of the dependency.",
3590
+ "type": "object",
3591
+ "additionalProperties": {
3592
+ "$ref": "#/definitions/RuleSetConditionOrConditions"
3593
+ }
3594
+ },
3588
3595
  "compiler": {
3589
3596
  "description": "Match the child compiler name.",
3590
3597
  "oneOf": [
package/types.d.ts CHANGED
@@ -80,7 +80,8 @@ import {
80
80
  WithStatement,
81
81
  YieldExpression
82
82
  } from "estree";
83
- import { ValidationError, validate as validateFunction } from "schema-utils";
83
+ import { validate as validateFunction } from "schema-utils";
84
+ import { default as ValidationError } from "schema-utils/declarations/ValidationError";
84
85
  import { ValidationErrorConfiguration } from "schema-utils/declarations/validate";
85
86
  import {
86
87
  AsArray,
@@ -1865,10 +1866,10 @@ declare class Compiler {
1865
1866
  records: object;
1866
1867
  managedPaths: Set<string>;
1867
1868
  immutablePaths: Set<string>;
1868
- modifiedFiles: Set<string>;
1869
- removedFiles: Set<string>;
1870
- fileTimestamps: Map<string, null | FileSystemInfoEntry | "ignore">;
1871
- contextTimestamps: Map<string, null | FileSystemInfoEntry | "ignore">;
1869
+ modifiedFiles: ReadonlySet<string>;
1870
+ removedFiles: ReadonlySet<string>;
1871
+ fileTimestamps: ReadonlyMap<string, null | FileSystemInfoEntry | "ignore">;
1872
+ contextTimestamps: ReadonlyMap<string, null | FileSystemInfoEntry | "ignore">;
1872
1873
  fsStartTime: number;
1873
1874
  resolverFactory: ResolverFactory;
1874
1875
  infrastructureLogger: any;
@@ -3966,10 +3967,12 @@ declare abstract class FileSystemInfo {
3966
3967
  logStatistics(): void;
3967
3968
  clear(): void;
3968
3969
  addFileTimestamps(
3969
- map: Map<string, null | FileSystemInfoEntry | "ignore">
3970
+ map: ReadonlyMap<string, null | FileSystemInfoEntry | "ignore">,
3971
+ immutable?: boolean
3970
3972
  ): void;
3971
3973
  addContextTimestamps(
3972
- map: Map<string, null | FileSystemInfoEntry | "ignore">
3974
+ map: ReadonlyMap<string, null | FileSystemInfoEntry | "ignore">,
3975
+ immutable?: boolean
3973
3976
  ): void;
3974
3977
  getFileTimestamp(
3975
3978
  path: string,
@@ -4732,21 +4735,44 @@ declare class JavascriptParser extends Parser {
4732
4735
  boolean | void
4733
4736
  >;
4734
4737
  label: HookMap<SyncBailHook<[LabeledStatement], boolean | void>>;
4735
- import: SyncBailHook<[Statement, ImportSource], boolean | void>;
4738
+ import: SyncBailHook<[ImportDeclaration, ImportSource], boolean | void>;
4736
4739
  importSpecifier: SyncBailHook<
4737
- [Statement, ImportSource, string, string],
4740
+ [ImportDeclaration, ImportSource, string, string],
4741
+ boolean | void
4742
+ >;
4743
+ export: SyncBailHook<
4744
+ [ExportNamedDeclaration | ExportAllDeclaration],
4745
+ boolean | void
4746
+ >;
4747
+ exportImport: SyncBailHook<
4748
+ [ExportNamedDeclaration | ExportAllDeclaration, ImportSource],
4749
+ boolean | void
4750
+ >;
4751
+ exportDeclaration: SyncBailHook<
4752
+ [ExportNamedDeclaration | ExportAllDeclaration, Declaration],
4753
+ boolean | void
4754
+ >;
4755
+ exportExpression: SyncBailHook<
4756
+ [ExportDefaultDeclaration, Declaration],
4738
4757
  boolean | void
4739
4758
  >;
4740
- export: SyncBailHook<[Statement], boolean | void>;
4741
- exportImport: SyncBailHook<[Statement, ImportSource], boolean | void>;
4742
- exportDeclaration: SyncBailHook<[Statement, Declaration], boolean | void>;
4743
- exportExpression: SyncBailHook<[Statement, Declaration], boolean | void>;
4744
4759
  exportSpecifier: SyncBailHook<
4745
- [Statement, string, string, undefined | number],
4760
+ [
4761
+ ExportNamedDeclaration | ExportAllDeclaration,
4762
+ string,
4763
+ string,
4764
+ undefined | number
4765
+ ],
4746
4766
  boolean | void
4747
4767
  >;
4748
4768
  exportImportSpecifier: SyncBailHook<
4749
- [Statement, ImportSource, string, string, undefined | number],
4769
+ [
4770
+ ExportNamedDeclaration | ExportAllDeclaration,
4771
+ ImportSource,
4772
+ string,
4773
+ string,
4774
+ undefined | number
4775
+ ],
4750
4776
  boolean | void
4751
4777
  >;
4752
4778
  preDeclarator: SyncBailHook<
@@ -6371,6 +6397,7 @@ declare class ModuleDependency extends Dependency {
6371
6397
  request: string;
6372
6398
  userRequest: string;
6373
6399
  range: any;
6400
+ assertions?: Record<string, any>;
6374
6401
  static Template: typeof DependencyTemplate;
6375
6402
  static NO_EXPORTS_REFERENCED: string[][];
6376
6403
  static EXPORTS_OBJECT_REFERENCED: string[][];
@@ -8927,6 +8954,7 @@ declare interface ResolveData {
8927
8954
  resolveOptions?: ResolveOptionsWebpackOptions;
8928
8955
  context: string;
8929
8956
  request: string;
8957
+ assertions?: Record<string, any>;
8930
8958
  dependencies: ModuleDependency[];
8931
8959
  createData: Object;
8932
8960
  fileDependencies: LazySet<string>;
@@ -9338,6 +9366,11 @@ declare interface RuleSetLogicalConditionsAbsolute {
9338
9366
  * A rule description with conditions and effects for modules.
9339
9367
  */
9340
9368
  declare interface RuleSetRule {
9369
+ /**
9370
+ * Match on import assertions of the dependency.
9371
+ */
9372
+ assert?: { [index: string]: RuleSetConditionOrConditions };
9373
+
9341
9374
  /**
9342
9375
  * Match the child compiler name.
9343
9376
  */
@@ -1,166 +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 TOMBSTONE = Symbol("tombstone");
9
- const UNDEFINED_MARKER = Symbol("undefined");
10
-
11
- /**
12
- * @template T
13
- * @typedef {T | undefined} Cell<T>
14
- */
15
-
16
- /**
17
- * @template T
18
- * @typedef {T | typeof TOMBSTONE | typeof UNDEFINED_MARKER} InternalCell<T>
19
- */
20
-
21
- /**
22
- * @template K
23
- * @template V
24
- * @param {[K, InternalCell<V>]} pair the internal cell
25
- * @returns {[K, Cell<V>]} its “safe” representation
26
- */
27
- const extractPair = pair => {
28
- const key = pair[0];
29
- const val = pair[1];
30
- if (val === UNDEFINED_MARKER || val === TOMBSTONE) {
31
- return [key, undefined];
32
- } else {
33
- return /** @type {[K, Cell<V>]} */ (pair);
34
- }
35
- };
36
-
37
- /**
38
- * @template K
39
- * @template V
40
- */
41
- class StackedMap {
42
- /**
43
- * @param {Map<K, InternalCell<V>>[]=} parentStack an optional parent
44
- */
45
- constructor(parentStack) {
46
- /** @type {Map<K, InternalCell<V>>} */
47
- this.map = new Map();
48
- /** @type {Map<K, InternalCell<V>>[]} */
49
- this.stack = parentStack === undefined ? [] : parentStack.slice();
50
- this.stack.push(this.map);
51
- }
52
-
53
- /**
54
- * @param {K} item the key of the element to add
55
- * @param {V} value the value of the element to add
56
- * @returns {void}
57
- */
58
- set(item, value) {
59
- this.map.set(item, value === undefined ? UNDEFINED_MARKER : value);
60
- }
61
-
62
- /**
63
- * @param {K} item the item to delete
64
- * @returns {void}
65
- */
66
- delete(item) {
67
- if (this.stack.length > 1) {
68
- this.map.set(item, TOMBSTONE);
69
- } else {
70
- this.map.delete(item);
71
- }
72
- }
73
-
74
- /**
75
- * @param {K} item the item to test
76
- * @returns {boolean} true if the item exists in this set
77
- */
78
- has(item) {
79
- const topValue = this.map.get(item);
80
- if (topValue !== undefined) {
81
- return topValue !== TOMBSTONE;
82
- }
83
- if (this.stack.length > 1) {
84
- for (let i = this.stack.length - 2; i >= 0; i--) {
85
- const value = this.stack[i].get(item);
86
- if (value !== undefined) {
87
- this.map.set(item, value);
88
- return value !== TOMBSTONE;
89
- }
90
- }
91
- this.map.set(item, TOMBSTONE);
92
- }
93
- return false;
94
- }
95
-
96
- /**
97
- * @param {K} item the key of the element to return
98
- * @returns {Cell<V>} the value of the element
99
- */
100
- get(item) {
101
- const topValue = this.map.get(item);
102
- if (topValue !== undefined) {
103
- return topValue === TOMBSTONE || topValue === UNDEFINED_MARKER
104
- ? undefined
105
- : topValue;
106
- }
107
- if (this.stack.length > 1) {
108
- for (let i = this.stack.length - 2; i >= 0; i--) {
109
- const value = this.stack[i].get(item);
110
- if (value !== undefined) {
111
- this.map.set(item, value);
112
- return value === TOMBSTONE || value === UNDEFINED_MARKER
113
- ? undefined
114
- : value;
115
- }
116
- }
117
- this.map.set(item, TOMBSTONE);
118
- }
119
- return undefined;
120
- }
121
-
122
- _compress() {
123
- if (this.stack.length === 1) return;
124
- this.map = new Map();
125
- for (const data of this.stack) {
126
- for (const pair of data) {
127
- if (pair[1] === TOMBSTONE) {
128
- this.map.delete(pair[0]);
129
- } else {
130
- this.map.set(pair[0], pair[1]);
131
- }
132
- }
133
- }
134
- this.stack = [this.map];
135
- }
136
-
137
- asArray() {
138
- this._compress();
139
- return Array.from(this.map.keys());
140
- }
141
-
142
- asSet() {
143
- this._compress();
144
- return new Set(this.map.keys());
145
- }
146
-
147
- asPairArray() {
148
- this._compress();
149
- return Array.from(this.map.entries(), extractPair);
150
- }
151
-
152
- asMap() {
153
- return new Map(this.asPairArray());
154
- }
155
-
156
- get size() {
157
- this._compress();
158
- return this.map.size;
159
- }
160
-
161
- createChild() {
162
- return new StackedMap(this.stack);
163
- }
164
- }
165
-
166
- module.exports = StackedMap;