webpack 5.59.1 → 5.62.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.

Files changed (42) hide show
  1. package/hot/lazy-compilation-node.js +3 -1
  2. package/lib/Chunk.js +3 -2
  3. package/lib/Compilation.js +29 -16
  4. package/lib/Compiler.js +13 -11
  5. package/lib/HotModuleReplacementPlugin.js +3 -1
  6. package/lib/NormalModule.js +9 -3
  7. package/lib/WebpackOptionsApply.js +12 -9
  8. package/lib/cache/PackFileCacheStrategy.js +7 -4
  9. package/lib/config/defaults.js +4 -6
  10. package/lib/dependencies/AMDRequireDependency.js +6 -6
  11. package/lib/dependencies/CommonJsFullRequireDependency.js +5 -1
  12. package/lib/dependencies/CommonJsImportsParserPlugin.js +3 -1
  13. package/lib/dependencies/CommonJsRequireContextDependency.js +5 -1
  14. package/lib/dependencies/ContextDependency.js +1 -0
  15. package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +4 -1
  16. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +12 -3
  17. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +25 -17
  18. package/lib/dependencies/HarmonyImportDependency.js +21 -0
  19. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +17 -4
  20. package/lib/dependencies/HarmonyImportSpecifierDependency.js +24 -14
  21. package/lib/dependencies/RequireEnsureDependency.js +2 -2
  22. package/lib/hmr/LazyCompilationPlugin.js +9 -5
  23. package/lib/hmr/lazyCompilationBackend.js +47 -10
  24. package/lib/node/NodeTargetPlugin.js +2 -0
  25. package/lib/node/RequireChunkLoadingRuntimeModule.js +1 -1
  26. package/lib/optimize/ModuleConcatenationPlugin.js +5 -2
  27. package/lib/optimize/SplitChunksPlugin.js +8 -1
  28. package/lib/runtime/AsyncModuleRuntimeModule.js +2 -2
  29. package/lib/sharing/ConsumeSharedRuntimeModule.js +1 -1
  30. package/lib/sharing/ShareRuntimeModule.js +1 -1
  31. package/lib/util/createHash.js +12 -0
  32. package/lib/util/deprecation.js +10 -2
  33. package/lib/util/hash/BatchedHash.js +7 -4
  34. package/lib/util/hash/md4.js +20 -0
  35. package/lib/util/hash/wasm-hash.js +163 -0
  36. package/lib/util/hash/xxhash64.js +5 -139
  37. package/lib/webpack.js +1 -2
  38. package/module.d.ts +200 -0
  39. package/package.json +12 -10
  40. package/schemas/WebpackOptions.check.js +1 -1
  41. package/schemas/WebpackOptions.json +117 -27
  42. package/types.d.ts +73 -22
@@ -0,0 +1,163 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+
6
+ "use strict";
7
+
8
+ // 65536 is the size of a wasm memory page
9
+ // 64 is the maximum chunk size for every possible wasm hash implementation
10
+ // 4 is the maximum number of bytes per char for string encoding (max is utf-8)
11
+ // ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64
12
+ const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3;
13
+
14
+ class WasmHash {
15
+ /**
16
+ * @param {WebAssembly.Instance} instance wasm instance
17
+ * @param {WebAssembly.Instance[]} instancesPool pool of instances
18
+ * @param {number} chunkSize size of data chunks passed to wasm
19
+ * @param {number} digestSize size of digest returned by wasm
20
+ */
21
+ constructor(instance, instancesPool, chunkSize, digestSize) {
22
+ const exports = /** @type {any} */ (instance.exports);
23
+ exports.init();
24
+ this.exports = exports;
25
+ this.mem = Buffer.from(exports.memory.buffer, 0, 65536);
26
+ this.buffered = 0;
27
+ this.instancesPool = instancesPool;
28
+ this.chunkSize = chunkSize;
29
+ this.digestSize = digestSize;
30
+ }
31
+
32
+ reset() {
33
+ this.buffered = 0;
34
+ this.exports.init();
35
+ }
36
+
37
+ /**
38
+ * @param {Buffer | string} data data
39
+ * @param {BufferEncoding=} encoding encoding
40
+ * @returns {this} itself
41
+ */
42
+ update(data, encoding) {
43
+ if (typeof data === "string") {
44
+ while (data.length > MAX_SHORT_STRING) {
45
+ this._updateWithShortString(data.slice(0, MAX_SHORT_STRING), encoding);
46
+ data = data.slice(MAX_SHORT_STRING);
47
+ }
48
+ this._updateWithShortString(data, encoding);
49
+ return this;
50
+ }
51
+ this._updateWithBuffer(data);
52
+ return this;
53
+ }
54
+
55
+ /**
56
+ * @param {string} data data
57
+ * @param {BufferEncoding=} encoding encoding
58
+ * @returns {void}
59
+ */
60
+ _updateWithShortString(data, encoding) {
61
+ const { exports, buffered, mem, chunkSize } = this;
62
+ let endPos;
63
+ if (data.length < 70) {
64
+ if (!encoding || encoding === "utf-8" || encoding === "utf8") {
65
+ endPos = buffered;
66
+ for (let i = 0; i < data.length; i++) {
67
+ const cc = data.charCodeAt(i);
68
+ if (cc < 0x80) mem[endPos++] = cc;
69
+ else if (cc < 0x800) {
70
+ mem[endPos] = (cc >> 6) | 0xc0;
71
+ mem[endPos + 1] = (cc & 0x3f) | 0x80;
72
+ endPos += 2;
73
+ } else {
74
+ // bail-out for weird chars
75
+ endPos += mem.write(data.slice(i), endPos, encoding);
76
+ break;
77
+ }
78
+ }
79
+ } else if (encoding === "latin1") {
80
+ endPos = buffered;
81
+ for (let i = 0; i < data.length; i++) {
82
+ const cc = data.charCodeAt(i);
83
+ mem[endPos++] = cc;
84
+ }
85
+ } else {
86
+ endPos = buffered + mem.write(data, buffered, encoding);
87
+ }
88
+ } else {
89
+ endPos = buffered + mem.write(data, buffered, encoding);
90
+ }
91
+ if (endPos < chunkSize) {
92
+ this.buffered = endPos;
93
+ } else {
94
+ const l = endPos & ~(this.chunkSize - 1);
95
+ exports.update(l);
96
+ const newBuffered = endPos - l;
97
+ this.buffered = newBuffered;
98
+ if (newBuffered > 0) mem.copyWithin(0, l, endPos);
99
+ }
100
+ }
101
+
102
+ /**
103
+ * @param {Buffer} data data
104
+ * @returns {void}
105
+ */
106
+ _updateWithBuffer(data) {
107
+ const { exports, buffered, mem } = this;
108
+ const length = data.length;
109
+ if (buffered + length < this.chunkSize) {
110
+ data.copy(mem, buffered, 0, length);
111
+ this.buffered += length;
112
+ } else {
113
+ const l = (buffered + length) & ~(this.chunkSize - 1);
114
+ if (l > 65536) {
115
+ let i = 65536 - buffered;
116
+ data.copy(mem, buffered, 0, i);
117
+ exports.update(65536);
118
+ const stop = l - buffered - 65536;
119
+ while (i < stop) {
120
+ data.copy(mem, 0, i, i + 65536);
121
+ exports.update(65536);
122
+ i += 65536;
123
+ }
124
+ data.copy(mem, 0, i, l - buffered);
125
+ exports.update(l - buffered - i);
126
+ } else {
127
+ data.copy(mem, buffered, 0, l - buffered);
128
+ exports.update(l);
129
+ }
130
+ const newBuffered = length + buffered - l;
131
+ this.buffered = newBuffered;
132
+ if (newBuffered > 0) data.copy(mem, 0, length - newBuffered, length);
133
+ }
134
+ }
135
+
136
+ digest(type) {
137
+ const { exports, buffered, mem, digestSize } = this;
138
+ exports.final(buffered);
139
+ this.instancesPool.push(this);
140
+ const hex = mem.toString("latin1", 0, digestSize);
141
+ if (type === "hex") return hex;
142
+ if (type === "binary" || !type) return Buffer.from(hex, "hex");
143
+ return Buffer.from(hex, "hex").toString(type);
144
+ }
145
+ }
146
+
147
+ const create = (wasmModule, instancesPool, chunkSize, digestSize) => {
148
+ if (instancesPool.length > 0) {
149
+ const old = instancesPool.pop();
150
+ old.reset();
151
+ return old;
152
+ } else {
153
+ return new WasmHash(
154
+ new WebAssembly.Instance(wasmModule),
155
+ instancesPool,
156
+ chunkSize,
157
+ digestSize
158
+ );
159
+ }
160
+ };
161
+
162
+ module.exports = create;
163
+ module.exports.MAX_SHORT_STRING = MAX_SHORT_STRING;
@@ -5,150 +5,16 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ const create = require("./wasm-hash");
9
+
8
10
  //#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1
9
11
  const xxhash64 = new WebAssembly.Module(
10
12
  Buffer.from(
11
- // 1180 bytes
12
- "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQA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9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEACfyACIAE1AgBCh5Wvr5i23puef36FQheJQs/W077Sx6vZQn5C+fPd8Zn2masWfCECIAFBBGoLIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAiACQh2IhUL5893xmfaZqxZ+IgIgAkIgiIUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL",
13
15
  "base64"
14
16
  )
15
17
  );
16
18
  //#endregion
17
19
 
18
- class XxHash64 {
19
- /**
20
- * @param {WebAssembly.Instance} instance wasm instance
21
- */
22
- constructor(instance) {
23
- const exports = /** @type {any} */ (instance.exports);
24
- exports.init();
25
- this.exports = exports;
26
- this.mem = Buffer.from(exports.memory.buffer, 0, 65536);
27
- this.buffered = 0;
28
- }
29
-
30
- reset() {
31
- this.buffered = 0;
32
- this.exports.init();
33
- }
34
-
35
- /**
36
- * @param {Buffer | string} data data
37
- * @param {BufferEncoding=} encoding encoding
38
- * @returns {this} itself
39
- */
40
- update(data, encoding) {
41
- if (typeof data === "string") {
42
- if (data.length < 21845) {
43
- this._updateWithShortString(data, encoding);
44
- return this;
45
- } else {
46
- data = Buffer.from(data, encoding);
47
- }
48
- }
49
- this._updateWithBuffer(data);
50
- return this;
51
- }
52
-
53
- /**
54
- * @param {string} data data
55
- * @param {BufferEncoding=} encoding encoding
56
- * @returns {void}
57
- */
58
- _updateWithShortString(data, encoding) {
59
- const { exports, buffered, mem } = this;
60
- let endPos;
61
- if (data.length < 70) {
62
- if (!encoding || encoding === "utf-8" || encoding === "utf8") {
63
- endPos = buffered;
64
- for (let i = 0; i < data.length; i++) {
65
- const cc = data.charCodeAt(i);
66
- if (cc < 0x80) mem[endPos++] = cc;
67
- else if (cc < 0x800) {
68
- mem[endPos] = (cc >> 6) | 0xc0;
69
- mem[endPos + 1] = (cc & 0x3f) | 0x80;
70
- endPos += 2;
71
- } else {
72
- // bail-out for weird chars
73
- endPos += mem.write(data.slice(endPos), endPos, encoding);
74
- break;
75
- }
76
- }
77
- } else if (encoding === "latin1") {
78
- endPos = buffered;
79
- for (let i = 0; i < data.length; i++) {
80
- const cc = data.charCodeAt(i);
81
- mem[endPos++] = cc;
82
- }
83
- } else {
84
- endPos = buffered + mem.write(data, buffered, encoding);
85
- }
86
- } else {
87
- endPos = buffered + mem.write(data, buffered, encoding);
88
- }
89
- if (endPos < 32) {
90
- this.buffered = endPos;
91
- } else {
92
- const l = (endPos >> 5) << 5;
93
- exports.update(l);
94
- const newBuffered = endPos - l;
95
- this.buffered = newBuffered;
96
- if (newBuffered > 0) mem.copyWithin(0, l, endPos);
97
- }
98
- }
99
-
100
- /**
101
- * @param {Buffer} data data
102
- * @returns {void}
103
- */
104
- _updateWithBuffer(data) {
105
- const { exports, buffered, mem } = this;
106
- const length = data.length;
107
- if (buffered + length < 32) {
108
- data.copy(mem, buffered, 0, length);
109
- this.buffered += length;
110
- } else {
111
- const l = ((buffered + length) >> 5) << 5;
112
- if (l > 65536) {
113
- let i = 65536 - buffered;
114
- data.copy(mem, buffered, 0, i);
115
- exports.update(65536);
116
- const stop = l - buffered - 65536;
117
- while (i < stop) {
118
- data.copy(mem, 0, i, i + 65536);
119
- exports.update(65536);
120
- i += 65536;
121
- }
122
- data.copy(mem, 0, i, l - buffered);
123
- exports.update(l - buffered - i);
124
- } else {
125
- data.copy(mem, buffered, 0, l - buffered);
126
- exports.update(l);
127
- }
128
- const newBuffered = length + buffered - l;
129
- this.buffered = newBuffered;
130
- if (newBuffered > 0) data.copy(mem, 0, length - newBuffered, length);
131
- }
132
- }
133
-
134
- digest(type) {
135
- const { exports, buffered, mem } = this;
136
- exports.final(buffered);
137
- instancesPool.push(this);
138
- return mem.toString("latin1", 0, 16);
139
- }
140
- }
141
-
142
- const instancesPool = [];
143
-
144
- const create = () => {
145
- if (instancesPool.length > 0) {
146
- const old = instancesPool.pop();
147
- old.reset();
148
- return old;
149
- } else {
150
- return new XxHash64(new WebAssembly.Instance(xxhash64));
151
- }
152
- };
153
-
154
- module.exports = create;
20
+ module.exports = create.bind(null, xxhash64, [], 32, 16);
package/lib/webpack.js CHANGED
@@ -61,8 +61,7 @@ const createMultiCompiler = (childOptions, options) => {
61
61
  const createCompiler = rawOptions => {
62
62
  const options = getNormalizedWebpackOptions(rawOptions);
63
63
  applyWebpackOptionsBaseDefaults(options);
64
- const compiler = new Compiler(options.context);
65
- compiler.options = options;
64
+ const compiler = new Compiler(options.context, options);
66
65
  new NodeEnvironmentPlugin({
67
66
  infrastructureLogging: options.infrastructureLogging
68
67
  }).apply(compiler);
package/module.d.ts ADDED
@@ -0,0 +1,200 @@
1
+ declare namespace webpack {
2
+ type HotEvent =
3
+ | {
4
+ type: "disposed";
5
+ /** The module in question. */
6
+ moduleId: number;
7
+ }
8
+ | {
9
+ type: "self-declined" | "unaccepted";
10
+ /** The module in question. */
11
+ moduleId: number;
12
+ /** the chain from where the update was propagated. */
13
+ chain: number[];
14
+ }
15
+ | {
16
+ type: "declined";
17
+ /** The module in question. */
18
+ moduleId: number;
19
+ /** the chain from where the update was propagated. */
20
+ chain: number[];
21
+ /** the module id of the declining parent */
22
+ parentId: number;
23
+ }
24
+ | {
25
+ type: "accepted";
26
+ /** The module in question. */
27
+ moduleId: number;
28
+ /** the chain from where the update was propagated. */
29
+ chain: number[];
30
+ /** the modules that are outdated and will be disposed */
31
+ outdatedModules: number[];
32
+ /** the accepted dependencies that are outdated */
33
+ outdatedDependencies: {
34
+ [id: number]: number[];
35
+ };
36
+ }
37
+ | {
38
+ type: "accept-error-handler-errored";
39
+ /** The module in question. */
40
+ moduleId: number;
41
+ /** the module id owning the accept handler. */
42
+ dependencyId: number;
43
+ /** the thrown error */
44
+ error: Error;
45
+ /** the error thrown by the module before the error handler tried to handle it. */
46
+ originalError: Error;
47
+ }
48
+ | {
49
+ type: "self-accept-error-handler-errored";
50
+ /** The module in question. */
51
+ moduleId: number;
52
+ /** the thrown error */
53
+ error: Error;
54
+ /** the error thrown by the module before the error handler tried to handle it. */
55
+ originalError: Error;
56
+ }
57
+ | {
58
+ type: "accept-errored";
59
+ /** The module in question. */
60
+ moduleId: number;
61
+ /** the module id owning the accept handler. */
62
+ dependencyId: number;
63
+ /** the thrown error */
64
+ error: Error;
65
+ }
66
+ | {
67
+ type: "self-accept-errored";
68
+ /** The module in question. */
69
+ moduleId: number;
70
+ /** the thrown error */
71
+ error: Error;
72
+ };
73
+
74
+ interface ApplyOptions {
75
+ ignoreUnaccepted?: boolean;
76
+ ignoreDeclined?: boolean;
77
+ ignoreErrored?: boolean;
78
+ onDeclined?(callback: (info: HotEvent) => void): void;
79
+ onUnaccepted?(callback: (info: HotEvent) => void): void;
80
+ onAccepted?(callback: (info: HotEvent) => void): void;
81
+ onDisposed?(callback: (info: HotEvent) => void): void;
82
+ onErrored?(callback: (info: HotEvent) => void): void;
83
+ }
84
+
85
+ const enum HotUpdateStatus {
86
+ idle = "idle",
87
+ check = "check",
88
+ prepare = "prepare",
89
+ ready = "ready",
90
+ dispose = "dispose",
91
+ apply = "apply",
92
+ abort = "abort",
93
+ fail = "fail"
94
+ }
95
+
96
+ interface Hot {
97
+ accept: {
98
+ (
99
+ modules: string | string[],
100
+ callback?: (outdatedDependencies: string[]) => void,
101
+ errorHandler?: (
102
+ err: Error,
103
+ context: { moduleId: string | number; dependencyId: string | number }
104
+ ) => void
105
+ ): void;
106
+ (
107
+ errorHandler: (
108
+ err: Error,
109
+ ids: { moduleId: string | number; module: NodeJS.Module }
110
+ ) => void
111
+ ): void;
112
+ };
113
+ status(): HotUpdateStatus;
114
+ decline(module?: string | string[]): void;
115
+ dispose(callback: (data: object) => void): void;
116
+ addDisposeHandler(callback: (data: object) => void): void;
117
+ removeDisposeHandler(callback: (data: object) => void): void;
118
+ invalidate(): void;
119
+ addStatusHandler(callback: (status: HotUpdateStatus) => void): void;
120
+ removeStatusHandler(callback: (status: HotUpdateStatus) => void): void;
121
+ data: object;
122
+ check(
123
+ autoApply?: boolean | ApplyOptions
124
+ ): Promise<(string | number)[] | null>;
125
+ apply(options?: ApplyOptions): Promise<(string | number)[] | null>;
126
+ }
127
+
128
+ interface ExportInfo {
129
+ used: boolean;
130
+ provideInfo: boolean | null | undefined;
131
+ useInfo: boolean | null | undefined;
132
+ }
133
+
134
+ interface ExportsInfo {
135
+ [k: string]: ExportInfo & ExportsInfo;
136
+ }
137
+
138
+ interface Context {
139
+ resolve(dependency: string): string | number;
140
+ keys(): Array<string>;
141
+ id: string | number;
142
+ (dependency: string): unknown;
143
+ }
144
+ }
145
+
146
+ interface ImportMeta {
147
+ url: string;
148
+ webpack: number;
149
+ webpackHot: webpack.Hot;
150
+ }
151
+
152
+ declare const __resourceQuery: string;
153
+ declare var __webpack_public_path__: string;
154
+ declare var __webpack_nonce__: string;
155
+ declare const __webpack_chunkname__: string;
156
+ declare var __webpack_base_uri__: string;
157
+ declare var __webpack_runtime_id__: string;
158
+ declare const __webpack_hash__: string;
159
+ declare const __webpack_modules__: Record<string | number, NodeJS.Module>;
160
+ declare const __webpack_require__: (id: string | number) => unknown;
161
+ declare var __webpack_chunk_load__: (chunkId: string | number) => Promise<void>;
162
+ declare var __webpack_get_script_filename__: (
163
+ chunkId: string | number
164
+ ) => string;
165
+ declare var __webpack_is_included__: (request: string) => boolean;
166
+ declare var __webpack_exports_info__: webpack.ExportsInfo;
167
+ declare const __webpack_share_scopes__: Record<
168
+ string,
169
+ Record<
170
+ string,
171
+ { loaded?: 1; get: () => Promise<unknown>; from: string; eager: boolean }
172
+ >
173
+ >;
174
+ declare var __webpack_init_sharing__: (scope: string) => Promise<void>;
175
+ declare var __non_webpack_require__: (id: any) => unknown;
176
+ declare const __system_context__: object;
177
+
178
+ declare namespace NodeJS {
179
+ interface Module {
180
+ hot: webpack.Hot;
181
+ }
182
+
183
+ interface Require {
184
+ ensure(
185
+ dependencies: string[],
186
+ callback: (require: (module: string) => void) => void,
187
+ errorCallback?: (error: Error) => void,
188
+ chunkName?: string
189
+ ): void;
190
+ context(
191
+ request: string,
192
+ includeSubdirectories?: boolean,
193
+ filter?: RegExp,
194
+ mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once"
195
+ ): webpack.Context;
196
+ include(dependency: string): void;
197
+ resolveWeak(dependency: string): void;
198
+ onError?: (error: Error) => void;
199
+ }
200
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.59.1",
3
+ "version": "5.62.1",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "@babel/core": "^7.11.1",
40
40
  "@babel/preset-react": "^7.10.4",
41
41
  "@types/es-module-lexer": "^0.4.1",
42
- "@types/jest": "^27.0.1",
42
+ "@types/jest": "^27.0.2",
43
43
  "@types/node": "^15.0.1",
44
44
  "assemblyscript": "^0.19.16",
45
45
  "babel-loader": "^8.1.0",
@@ -66,11 +66,11 @@
66
66
  "husky": "^6.0.0",
67
67
  "is-ci": "^3.0.0",
68
68
  "istanbul": "^0.4.5",
69
- "jest": "^27.0.6",
70
- "jest-circus": "^27.0.6",
71
- "jest-cli": "^27.0.6",
72
- "jest-diff": "^27.0.2",
73
- "jest-junit": "^12.0.0",
69
+ "jest": "^27.3.1",
70
+ "jest-circus": "^27.3.1",
71
+ "jest-cli": "^27.3.1",
72
+ "jest-diff": "^27.3.1",
73
+ "jest-junit": "^13.0.0",
74
74
  "json-loader": "^0.5.7",
75
75
  "json5": "^2.1.3",
76
76
  "less": "^4.0.0",
@@ -132,6 +132,7 @@
132
132
  "hot/",
133
133
  "schemas/",
134
134
  "SECURITY.md",
135
+ "module.d.ts",
135
136
  "types.d.ts"
136
137
  ],
137
138
  "scripts": {
@@ -153,17 +154,18 @@
153
154
  "type-report": "rimraf coverage && yarn cover:types && yarn cover:report && open-cli coverage/lcov-report/index.html",
154
155
  "pretest": "yarn lint",
155
156
  "prelint": "yarn setup",
156
- "lint": "yarn code-lint && yarn special-lint && yarn type-lint && yarn typings-lint && yarn yarn-lint && yarn pretty-lint && yarn spellcheck",
157
+ "lint": "yarn code-lint && yarn special-lint && yarn type-lint && yarn typings-test && yarn module-typings-test && yarn yarn-lint && yarn pretty-lint && yarn spellcheck",
157
158
  "code-lint": "eslint . --ext '.js' --cache",
158
159
  "type-lint": "tsc",
159
- "typings-lint": "tsc -p tsconfig.test.json",
160
+ "typings-test": "tsc -p tsconfig.types.test.json",
161
+ "module-typings-test": "tsc -p tsconfig.module.test.json",
160
162
  "spellcheck": "cspell \"{.github,benchmark,bin,examples,hot,lib,schemas,setup,tooling}/**/*.{md,yml,yaml,js,json}\" \"*.md\"",
161
163
  "special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals",
162
164
  "special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write",
163
165
  "fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix",
164
166
  "prepare": "husky install",
165
167
  "pretty-lint-base": "prettier \"*.{ts,json,yml,yaml,md}\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.json\" \"examples/*.md\"",
166
- "pretty-lint-base-all": "yarn pretty-lint-base \"*.js\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.js\" \"test/*.js\" \"test/helpers/*.js\" \"test/{configCases,watchCases,statsCases,hotCases,benchmarkCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
168
+ "pretty-lint-base-all": "yarn pretty-lint-base \"*.js\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.js\" \"module.d.ts\" \"test/*.js\" \"test/helpers/*.js\" \"test/{configCases,watchCases,statsCases,hotCases,benchmarkCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
167
169
  "pretty-lint-fix": "yarn pretty-lint-base-all --loglevel warn --write",
168
170
  "pretty-lint": "yarn pretty-lint-base --check",
169
171
  "yarn-lint": "yarn-deduplicate --fail --list -s highest yarn.lock",