Skip to content

Commit cc66616

Browse files
fix: add @deprecated to methods
1 parent 7cdc173 commit cc66616

17 files changed

Lines changed: 280 additions & 62 deletions

.changeset/jolly-groups-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"webpack": patch
3+
---
4+
5+
All deprecated methods and options now have `@deprecated` flag in types.

declarations/WebpackOptions.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,7 @@ export interface ModuleOptions {
13831383
*/
13841384
defaultRules?: RuleSetRules;
13851385
/**
1386+
* @deprecated
13861387
* Enable warnings for full dynamic dependencies.
13871388
*/
13881389
exprContextCritical?: boolean;
@@ -1867,7 +1868,6 @@ export interface Optimization {
18671868
*/
18681869
minimizer?: ("..." | Falsy | WebpackPluginInstance | WebpackPluginFunction)[];
18691870
/**
1870-
* @deprecated
18711871
* Define the algorithm to choose module ids (natural: numeric ids in order of usage, named: readable ids for better debugging, hashed: (deprecated) short hashes as ids for better long term caching, deterministic: numeric hash ids for better long term caching, size: numeric ids focused on minimal initial download size, false: no algorithm used, as custom one can be provided via plugin).
18721872
*/
18731873
moduleIds?: "natural" | "named" | "hashed" | "deterministic" | "size" | false;
@@ -3608,7 +3608,6 @@ export interface OptimizationNormalized {
36083608
*/
36093609
minimizer?: ("..." | WebpackPluginInstance | WebpackPluginFunction)[];
36103610
/**
3611-
* @deprecated
36123611
* Define the algorithm to choose module ids (natural: numeric ids in order of usage, named: readable ids for better debugging, hashed: (deprecated) short hashes as ids for better long term caching, deterministic: numeric hash ids for better long term caching, size: numeric ids focused on minimal initial download size, false: no algorithm used, as custom one can be provided via plugin).
36133612
*/
36143613
moduleIds?: "natural" | "named" | "hashed" | "deterministic" | "size" | false;

lib/Chunk.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class Chunk {
148148
}
149149

150150
/**
151+
* @deprecated
151152
* @returns {boolean} true, if the chunk contains an entry module
152153
*/
153154
hasEntryModule() {
@@ -161,6 +162,7 @@ class Chunk {
161162
}
162163

163164
/**
165+
* @deprecated
164166
* @param {Module} module the module
165167
* @returns {boolean} true, if the chunk could be added
166168
*/
@@ -176,6 +178,7 @@ class Chunk {
176178
}
177179

178180
/**
181+
* @deprecated
179182
* @param {Module} module the module
180183
* @returns {void}
181184
*/
@@ -188,6 +191,7 @@ class Chunk {
188191
}
189192

190193
/**
194+
* @deprecated
191195
* @returns {number} the number of module which are contained in this chunk
192196
*/
193197
getNumberOfModules() {
@@ -198,6 +202,10 @@ class Chunk {
198202
).getNumberOfChunkModules(this);
199203
}
200204

205+
/**
206+
* @deprecated
207+
* @returns {Iterable<Module>} modules
208+
*/
201209
get modulesIterable() {
202210
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
203211
this,
@@ -211,6 +219,7 @@ class Chunk {
211219
}
212220

213221
/**
222+
* @deprecated
214223
* @param {Chunk} otherChunk the chunk to compare with
215224
* @returns {-1 | 0 | 1} the comparison result
216225
*/
@@ -224,6 +233,7 @@ class Chunk {
224233
}
225234

226235
/**
236+
* @deprecated
227237
* @param {Module} module the module
228238
* @returns {boolean} true, if the chunk contains the module
229239
*/
@@ -236,6 +246,7 @@ class Chunk {
236246
}
237247

238248
/**
249+
* @deprecated
239250
* @returns {Module[]} the modules for this chunk
240251
*/
241252
getModules() {
@@ -247,6 +258,7 @@ class Chunk {
247258
}
248259

249260
/**
261+
* @deprecated
250262
* @returns {void}
251263
*/
252264
remove() {
@@ -260,6 +272,7 @@ class Chunk {
260272
}
261273

262274
/**
275+
* @deprecated
263276
* @param {Module} module the module
264277
* @param {Chunk} otherChunk the target chunk
265278
* @returns {void}
@@ -275,6 +288,7 @@ class Chunk {
275288
}
276289

277290
/**
291+
* @deprecated
278292
* @param {Chunk} otherChunk the other chunk
279293
* @returns {boolean} true, if the specified chunk has been integrated
280294
*/
@@ -293,6 +307,7 @@ class Chunk {
293307
}
294308

295309
/**
310+
* @deprecated
296311
* @param {Chunk} otherChunk the other chunk
297312
* @returns {boolean} true, if chunks could be integrated
298313
*/
@@ -306,6 +321,7 @@ class Chunk {
306321
}
307322

308323
/**
324+
* @deprecated
309325
* @returns {boolean} true, if this chunk contains no module
310326
*/
311327
isEmpty() {
@@ -318,6 +334,7 @@ class Chunk {
318334
}
319335

320336
/**
337+
* @deprecated
321338
* @returns {number} total size of all modules in this chunk
322339
*/
323340
modulesSize() {
@@ -330,6 +347,7 @@ class Chunk {
330347
}
331348

332349
/**
350+
* @deprecated
333351
* @param {ChunkSizeOptions} options options object
334352
* @returns {number} total size of this chunk
335353
*/
@@ -343,6 +361,7 @@ class Chunk {
343361
}
344362

345363
/**
364+
* @deprecated
346365
* @param {Chunk} otherChunk the other chunk
347366
* @param {ChunkSizeOptions} options options object
348367
* @returns {number} total size of the chunk or false if the chunk can't be integrated
@@ -357,6 +376,7 @@ class Chunk {
357376
}
358377

359378
/**
379+
* @deprecated
360380
* @param {ModuleFilterPredicate} filterFn function used to filter modules
361381
* @returns {ChunkModuleMaps} module map information
362382
*/
@@ -402,6 +422,7 @@ class Chunk {
402422
}
403423

404424
/**
425+
* @deprecated
405426
* @param {ModuleFilterPredicate} filterFn predicate function used to filter modules
406427
* @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks
407428
* @returns {boolean} return true if module exists in graph

lib/ChunkGraph.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,6 +1879,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
18791879
}
18801880

18811881
// TODO remove in webpack 6
1882+
// BACKWARD-COMPAT START
18821883
/**
18831884
* @deprecated
18841885
* @param {Module} module the module
@@ -1889,7 +1890,6 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
18891890
chunkGraphForModuleMap.set(module, chunkGraph);
18901891
}
18911892

1892-
// TODO remove in webpack 6
18931893
/**
18941894
* @deprecated
18951895
* @param {Module} module the module
@@ -1899,7 +1899,6 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
18991899
chunkGraphForModuleMap.delete(module);
19001900
}
19011901

1902-
// TODO remove in webpack 6
19031902
/**
19041903
* @deprecated
19051904
* @param {Chunk} chunk the chunk
@@ -1933,7 +1932,6 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
19331932
return newFn(chunk);
19341933
}
19351934

1936-
// TODO remove in webpack 6
19371935
/**
19381936
* @deprecated
19391937
* @param {Chunk} chunk the chunk
@@ -1944,7 +1942,6 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
19441942
chunkGraphForChunkMap.set(chunk, chunkGraph);
19451943
}
19461944

1947-
// TODO remove in webpack 6
19481945
/**
19491946
* @deprecated
19501947
* @param {Chunk} chunk the chunk
@@ -1953,6 +1950,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
19531950
static clearChunkGraphForChunk(chunk) {
19541951
chunkGraphForChunkMap.delete(chunk);
19551952
}
1953+
// BACKWARD-COMPAT END
19561954
}
19571955

19581956
// TODO remove in webpack 6

lib/Compilation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,7 +3274,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
32743274
chunkGraphInit.set(entrypoint, (modulesList = []));
32753275
}
32763276
for (const module of includedModules) {
3277-
this.assignDepth(module);
3277+
this.assignDepths([module]);
32783278
modulesList.push(module);
32793279
}
32803280
}
@@ -4176,7 +4176,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
41764176
}
41774177

41784178
/**
4179-
* @param {Set<Module>} modules module to assign depth
4179+
* @param {Module[] | Set<Module>} modules module to assign depth
41804180
* @returns {void}
41814181
*/
41824182
assignDepths(modules) {

0 commit comments

Comments
 (0)