Skip to content

Commit d6927b4

Browse files
authored
feat: implement deprecate flag to schema (#20432)
1 parent d258c8b commit d6927b4

5 files changed

Lines changed: 150 additions & 25 deletions

File tree

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+
Implement `deprecate` flag in schema for better TypeScript support to show which options are already deprecated by the configuration

declarations/WebpackOptions.d.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,14 +1385,17 @@ export interface ModuleOptions {
13851385
*/
13861386
exprContextCritical?: boolean;
13871387
/**
1388+
* @deprecated
13881389
* Enable recursive directory lookup for full dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.exprContextRecursive'.
13891390
*/
13901391
exprContextRecursive?: boolean;
13911392
/**
1393+
* @deprecated
13921394
* Sets the default regular expression for full dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.exprContextRegExp'.
13931395
*/
13941396
exprContextRegExp?: RegExp | boolean;
13951397
/**
1398+
* @deprecated
13961399
* Set the default request for full dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.exprContextRequest'.
13971400
*/
13981401
exprContextRequest?: string;
@@ -1413,26 +1416,32 @@ export interface ModuleOptions {
14131416
*/
14141417
rules?: RuleSetRules;
14151418
/**
1419+
* @deprecated
14161420
* Emit errors instead of warnings when imported names don't exist in imported module. Deprecated: This option has moved to 'module.parser.javascript.strictExportPresence'.
14171421
*/
14181422
strictExportPresence?: boolean;
14191423
/**
1424+
* @deprecated
14201425
* Handle the this context correctly according to the spec for namespace objects. Deprecated: This option has moved to 'module.parser.javascript.strictThisContextOnImports'.
14211426
*/
14221427
strictThisContextOnImports?: boolean;
14231428
/**
1429+
* @deprecated
14241430
* Enable warnings when using the require function in a not statically analyse-able way. Deprecated: This option has moved to 'module.parser.javascript.unknownContextCritical'.
14251431
*/
14261432
unknownContextCritical?: boolean;
14271433
/**
1434+
* @deprecated
14281435
* Enable recursive directory lookup when using the require function in a not statically analyse-able way. Deprecated: This option has moved to 'module.parser.javascript.unknownContextRecursive'.
14291436
*/
14301437
unknownContextRecursive?: boolean;
14311438
/**
1439+
* @deprecated
14321440
* Sets the regular expression when using the require function in a not statically analyse-able way. Deprecated: This option has moved to 'module.parser.javascript.unknownContextRegExp'.
14331441
*/
14341442
unknownContextRegExp?: RegExp | boolean;
14351443
/**
1444+
* @deprecated
14361445
* Sets the request when using the require function in a not statically analyse-able way. Deprecated: This option has moved to 'module.parser.javascript.unknownContextRequest'.
14371446
*/
14381447
unknownContextRequest?: string;
@@ -1441,14 +1450,17 @@ export interface ModuleOptions {
14411450
*/
14421451
unsafeCache?: boolean | import("../lib/Compilation").UnsafeCachePredicate;
14431452
/**
1453+
* @deprecated
14441454
* Enable warnings for partial dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.wrappedContextCritical'.
14451455
*/
14461456
wrappedContextCritical?: boolean;
14471457
/**
1458+
* @deprecated
14481459
* Enable recursive directory lookup for partial dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.wrappedContextRecursive'.
14491460
*/
14501461
wrappedContextRecursive?: boolean;
14511462
/**
1463+
* @deprecated
14521464
* Set the inner regular expression for partial dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.wrappedContextRegExp'.
14531465
*/
14541466
wrappedContextRegExp?: RegExp;
@@ -1849,10 +1861,12 @@ export interface Optimization {
18491861
*/
18501862
minimizer?: ("..." | Falsy | WebpackPluginInstance | WebpackPluginFunction)[];
18511863
/**
1864+
* @deprecated
18521865
* 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).
18531866
*/
18541867
moduleIds?: "natural" | "named" | "hashed" | "deterministic" | "size" | false;
18551868
/**
1869+
* @deprecated
18561870
* Avoid emitting assets when errors occur (deprecated: use 'emitOnErrors' instead).
18571871
*/
18581872
noEmitOnErrors?: boolean;
@@ -2327,6 +2341,7 @@ export interface Output {
23272341
*/
23282342
strictModuleErrorHandling?: StrictModuleErrorHandling;
23292343
/**
2344+
* @deprecated
23302345
* Handles exceptions in module loading correctly at a performance cost (Deprecated). This will handle module error compatible with the Node.js CommonJS way.
23312346
*/
23322347
strictModuleExceptionHandling?: StrictModuleExceptionHandling;
@@ -2586,6 +2601,7 @@ export interface StatsOptions {
25862601
*/
25872602
builtAt?: boolean;
25882603
/**
2604+
* @deprecated
25892605
* Add information about cached (not built) modules (deprecated: use 'cachedModules' instead).
25902606
*/
25912607
cached?: boolean;
@@ -2869,6 +2885,7 @@ export interface StatsOptions {
28692885
*/
28702886
relatedAssets?: boolean;
28712887
/**
2888+
* @deprecated
28722889
* Add information about runtime modules (deprecated: use 'runtimeModules' instead).
28732890
*/
28742891
runtime?: boolean;
@@ -3364,6 +3381,7 @@ export interface JavascriptParserOptions {
33643381
*/
33653382
requireJs?: boolean;
33663383
/**
3384+
* @deprecated
33673385
* Deprecated in favor of "exportsPresence". Emit errors instead of warnings when imported names don't exist in imported module.
33683386
*/
33693387
strictExportPresence?: boolean;
@@ -3576,10 +3594,12 @@ export interface OptimizationNormalized {
35763594
*/
35773595
minimizer?: ("..." | WebpackPluginInstance | WebpackPluginFunction)[];
35783596
/**
3597+
* @deprecated
35793598
* 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).
35803599
*/
35813600
moduleIds?: "natural" | "named" | "hashed" | "deterministic" | "size" | false;
35823601
/**
3602+
* @deprecated
35833603
* Avoid emitting assets when errors occur (deprecated: use 'emitOnErrors' instead).
35843604
*/
35853605
noEmitOnErrors?: boolean;
@@ -3797,6 +3817,7 @@ export interface OutputNormalized {
37973817
*/
37983818
strictModuleErrorHandling?: StrictModuleErrorHandling;
37993819
/**
3820+
* @deprecated
38003821
* Handles exceptions in module loading correctly at a performance cost (Deprecated). This will handle module error compatible with the Node.js CommonJS way.
38013822
*/
38023823
strictModuleExceptionHandling?: StrictModuleExceptionHandling;

schemas/WebpackOptions.json

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,8 @@
20162016
},
20172017
"strictExportPresence": {
20182018
"description": "Deprecated in favor of \"exportsPresence\". Emit errors instead of warnings when imported names don't exist in imported module.",
2019-
"type": "boolean"
2019+
"type": "boolean",
2020+
"deprecated": true
20202021
},
20212022
"strictThisContextOnImports": {
20222023
"description": "Handle the this context correctly according to the spec for namespace objects.",
@@ -2499,7 +2500,8 @@
24992500
},
25002501
"exprContextRecursive": {
25012502
"description": "Enable recursive directory lookup for full dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.exprContextRecursive'.",
2502-
"type": "boolean"
2503+
"type": "boolean",
2504+
"deprecated": true
25032505
},
25042506
"exprContextRegExp": {
25052507
"description": "Sets the default regular expression for full dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.exprContextRegExp'.",
@@ -2511,11 +2513,13 @@
25112513
{
25122514
"type": "boolean"
25132515
}
2514-
]
2516+
],
2517+
"deprecated": true
25152518
},
25162519
"exprContextRequest": {
25172520
"description": "Set the default request for full dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.exprContextRequest'.",
2518-
"type": "string"
2521+
"type": "string",
2522+
"deprecated": true
25192523
},
25202524
"generator": {
25212525
"$ref": "#/definitions/GeneratorOptionsByModuleType"
@@ -2536,19 +2540,23 @@
25362540
},
25372541
"strictExportPresence": {
25382542
"description": "Emit errors instead of warnings when imported names don't exist in imported module. Deprecated: This option has moved to 'module.parser.javascript.strictExportPresence'.",
2539-
"type": "boolean"
2543+
"type": "boolean",
2544+
"deprecated": true
25402545
},
25412546
"strictThisContextOnImports": {
25422547
"description": "Handle the this context correctly according to the spec for namespace objects. Deprecated: This option has moved to 'module.parser.javascript.strictThisContextOnImports'.",
2543-
"type": "boolean"
2548+
"type": "boolean",
2549+
"deprecated": true
25442550
},
25452551
"unknownContextCritical": {
25462552
"description": "Enable warnings when using the require function in a not statically analyse-able way. Deprecated: This option has moved to 'module.parser.javascript.unknownContextCritical'.",
2547-
"type": "boolean"
2553+
"type": "boolean",
2554+
"deprecated": true
25482555
},
25492556
"unknownContextRecursive": {
25502557
"description": "Enable recursive directory lookup when using the require function in a not statically analyse-able way. Deprecated: This option has moved to 'module.parser.javascript.unknownContextRecursive'.",
2551-
"type": "boolean"
2558+
"type": "boolean",
2559+
"deprecated": true
25522560
},
25532561
"unknownContextRegExp": {
25542562
"description": "Sets the regular expression when using the require function in a not statically analyse-able way. Deprecated: This option has moved to 'module.parser.javascript.unknownContextRegExp'.",
@@ -2560,11 +2568,13 @@
25602568
{
25612569
"type": "boolean"
25622570
}
2563-
]
2571+
],
2572+
"deprecated": true
25642573
},
25652574
"unknownContextRequest": {
25662575
"description": "Sets the request when using the require function in a not statically analyse-able way. Deprecated: This option has moved to 'module.parser.javascript.unknownContextRequest'.",
2567-
"type": "string"
2576+
"type": "string",
2577+
"deprecated": true
25682578
},
25692579
"unsafeCache": {
25702580
"description": "Cache the resolving of module requests.",
@@ -2580,16 +2590,19 @@
25802590
},
25812591
"wrappedContextCritical": {
25822592
"description": "Enable warnings for partial dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.wrappedContextCritical'.",
2583-
"type": "boolean"
2593+
"type": "boolean",
2594+
"deprecated": true
25842595
},
25852596
"wrappedContextRecursive": {
25862597
"description": "Enable recursive directory lookup for partial dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.wrappedContextRecursive'.",
2587-
"type": "boolean"
2598+
"type": "boolean",
2599+
"deprecated": true
25882600
},
25892601
"wrappedContextRegExp": {
25902602
"description": "Set the inner regular expression for partial dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.wrappedContextRegExp'.",
25912603
"instanceof": "RegExp",
2592-
"tsType": "RegExp"
2604+
"tsType": "RegExp",
2605+
"deprecated": true
25932606
}
25942607
}
25952608
},
@@ -2806,14 +2819,23 @@
28062819
},
28072820
"moduleIds": {
28082821
"description": "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).",
2809-
"enum": ["natural", "named", "hashed", "deterministic", "size", false]
2822+
"enum": [
2823+
"natural",
2824+
"named",
2825+
"hashed",
2826+
"deterministic",
2827+
"size",
2828+
false
2829+
],
2830+
"deprecated": true
28102831
},
28112832
"noEmitOnErrors": {
28122833
"description": "Avoid emitting assets when errors occur (deprecated: use 'emitOnErrors' instead).",
28132834
"type": "boolean",
28142835
"cli": {
28152836
"exclude": true
2816-
}
2837+
},
2838+
"deprecated": true
28172839
},
28182840
"nodeEnv": {
28192841
"description": "Set process.env.NODE_ENV to a specific value.",
@@ -2970,14 +2992,23 @@
29702992
},
29712993
"moduleIds": {
29722994
"description": "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).",
2973-
"enum": ["natural", "named", "hashed", "deterministic", "size", false]
2995+
"enum": [
2996+
"natural",
2997+
"named",
2998+
"hashed",
2999+
"deterministic",
3000+
"size",
3001+
false
3002+
],
3003+
"deprecated": true
29743004
},
29753005
"noEmitOnErrors": {
29763006
"description": "Avoid emitting assets when errors occur (deprecated: use 'emitOnErrors' instead).",
29773007
"type": "boolean",
29783008
"cli": {
29793009
"exclude": true
2980-
}
3010+
},
3011+
"deprecated": true
29813012
},
29823013
"nodeEnv": {
29833014
"description": "Set process.env.NODE_ENV to a specific value.",
@@ -5266,7 +5297,8 @@
52665297
},
52675298
"cached": {
52685299
"description": "Add information about cached (not built) modules (deprecated: use 'cachedModules' instead).",
5269-
"type": "boolean"
5300+
"type": "boolean",
5301+
"deprecated": true
52705302
},
52715303
"cachedAssets": {
52725304
"description": "Show cached assets (setting this to `false` only shows emitted files).",
@@ -5655,7 +5687,8 @@
56555687
},
56565688
"runtime": {
56575689
"description": "Add information about runtime modules (deprecated: use 'runtimeModules' instead).",
5658-
"type": "boolean"
5690+
"type": "boolean",
5691+
"deprecated": true
56595692
},
56605693
"runtimeModules": {
56615694
"description": "Add information about runtime modules.",
@@ -5728,7 +5761,8 @@
57285761
},
57295762
"StrictModuleExceptionHandling": {
57305763
"description": "Handles exceptions in module loading correctly at a performance cost (Deprecated). This will handle module error compatible with the Node.js CommonJS way.",
5731-
"type": "boolean"
5764+
"type": "boolean",
5765+
"deprecated": true
57325766
},
57335767
"Target": {
57345768
"description": "Environment to build for. An array of environments to build for all of them when possible.",

0 commit comments

Comments
 (0)