Skip to content

Commit 5d10d62

Browse files
authored
Merge pull request #17 from shivxmsharma/feat/stability-blockquotes
feat(theme): emit stability blockquotes for JSDoc stability tags
2 parents e5b8286 + dba66c0 commit 5d10d62

File tree

8 files changed

+134
-103
lines changed

8 files changed

+134
-103
lines changed

pages/v5.x/globals.md

Lines changed: 52 additions & 60 deletions
Large diffs are not rendered by default.

pages/v5.x/webpack/namespaces/dependencies.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ implement this method to allow the occurrence order plugin to count correctly
125125

126126
#### `getReference(moduleGraph)`
127127

128+
> Stability: 0 - Deprecated
129+
128130
* `moduleGraph` {ModuleGraph}
129131
* Returns: {never}
130132

131133
Returns the referenced module and export
132134

133-
##### Deprecated
134-
135135
#### `getReferencedExports(moduleGraph, runtime)`
136136

137137
* `moduleGraph` {ModuleGraph}
@@ -333,13 +333,13 @@ implement this method to allow the occurrence order plugin to count correctly
333333

334334
#### `getReference(moduleGraph)`
335335

336+
> Stability: 0 - Deprecated
337+
336338
* `moduleGraph` {ModuleGraph}
337339
* Returns: {never}
338340

339341
Returns the referenced module and export
340342

341-
##### Deprecated
342-
343343
#### `getReferencedExports(moduleGraph, runtime)`
344344

345345
* `moduleGraph` {ModuleGraph}
@@ -516,13 +516,13 @@ implement this method to allow the occurrence order plugin to count correctly
516516

517517
#### `getReference(moduleGraph)`
518518

519+
> Stability: 0 - Deprecated
520+
519521
* `moduleGraph` {ModuleGraph}
520522
* Returns: {never}
521523

522524
Returns the referenced module and export
523525

524-
##### Deprecated
525-
526526
#### `getReferencedExports(moduleGraph, runtime)`
527527

528528
* `moduleGraph` {ModuleGraph}
@@ -693,13 +693,13 @@ implement this method to allow the occurrence order plugin to count correctly
693693

694694
#### `getReference(moduleGraph)`
695695

696+
> Stability: 0 - Deprecated
697+
696698
* `moduleGraph` {ModuleGraph}
697699
* Returns: {never}
698700

699701
Returns the referenced module and export
700702

701-
##### Deprecated
702-
703703
#### `getReferencedExports(moduleGraph, runtime)`
704704

705705
* `moduleGraph` {ModuleGraph}

pages/v5.x/webpack/namespaces/esm.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,14 @@ This data will be passed to restoreFromUnsafeCache later.
469469

470470
#### `needRebuild(fileTimestamps, contextTimestamps)`
471471

472+
> Stability: 0 - Deprecated
473+
472474
* `fileTimestamps` {Map}
473475
* `contextTimestamps` {Map}
474476
* Returns: {boolean}
475477

476478
Use needBuild instead
477479

478-
##### Deprecated
479-
480480
#### `originalSource()`
481481

482482
* Returns: {Source}
@@ -512,15 +512,15 @@ Use needBuild instead
512512

513513
#### `source(dependencyTemplates, runtimeTemplate[, type])`
514514

515+
> Stability: 0 - Deprecated
516+
515517
* `dependencyTemplates` {DependencyTemplates}
516518
* `runtimeTemplate` {RuntimeTemplate}
517519
* `type` {string}
518520
* Returns: {Source}
519521

520522
Use codeGeneration() instead
521523

522-
##### Deprecated
523-
524524
#### `updateCacheModule(module)`
525525

526526
* `module` {Module}
@@ -543,9 +543,9 @@ and properties.
543543

544544
#### Static method: `getSourceBasicTypes(module)`
545545

546+
> Stability: 0 - Deprecated
547+
546548
* `module` {Module}
547549
* Returns: {ReadonlySet}
548550

549551
In webpack 6, call getSourceBasicTypes() directly on the module instance instead of using this static method.
550-
551-
##### Deprecated

pages/v5.x/webpack/namespaces/javascript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,12 @@ Block pre walking iterates the scope for block variable declarations
353353

354354
#### `inScope(params, fn)`
355355

356+
> Stability: 0 - Deprecated
357+
356358
* `params` {string|Identifier|Property|MemberExpression|ObjectPattern|ArrayPattern|RestElement|AssignmentPattern[]}
357359
* `fn` {object}
358360
* Returns: {void}
359361

360-
##### Deprecated
361-
362362
#### `isAsiPosition(pos)`
363363

364364
* `pos` {number}

pages/v5.x/webpack/namespaces/runtime.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,14 @@ This data will be passed to restoreFromUnsafeCache later.
477477

478478
#### `needRebuild(fileTimestamps, contextTimestamps)`
479479

480+
> Stability: 0 - Deprecated
481+
480482
* `fileTimestamps` {Map}
481483
* `contextTimestamps` {Map}
482484
* Returns: {boolean}
483485

484486
Use needBuild instead
485487

486-
##### Deprecated
487-
488488
#### `originalSource()`
489489

490490
* Returns: {Source}
@@ -520,15 +520,15 @@ Use needBuild instead
520520

521521
#### `source(dependencyTemplates, runtimeTemplate[, type])`
522522

523+
> Stability: 0 - Deprecated
524+
523525
* `dependencyTemplates` {DependencyTemplates}
524526
* `runtimeTemplate` {RuntimeTemplate}
525527
* `type` {string}
526528
* Returns: {Source}
527529

528530
Use codeGeneration() instead
529531

530-
##### Deprecated
531-
532532
#### `updateCacheModule(module)`
533533

534534
* `module` {Module}
@@ -546,13 +546,13 @@ and properties.
546546

547547
#### Static method: `getSourceBasicTypes(module)`
548548

549+
> Stability: 0 - Deprecated
550+
549551
* `module` {Module}
550552
* Returns: {ReadonlySet}
551553

552554
In webpack 6, call getSourceBasicTypes() directly on the module instance instead of using this static method.
553555

554-
##### Deprecated
555-
556556
***
557557

558558
## Class: `LoadScriptRuntimeModule`
@@ -1025,14 +1025,14 @@ This data will be passed to restoreFromUnsafeCache later.
10251025

10261026
#### `needRebuild(fileTimestamps, contextTimestamps)`
10271027

1028+
> Stability: 0 - Deprecated
1029+
10281030
* `fileTimestamps` {Map}
10291031
* `contextTimestamps` {Map}
10301032
* Returns: {boolean}
10311033

10321034
Use needBuild instead
10331035

1034-
##### Deprecated
1035-
10361036
#### `originalSource()`
10371037

10381038
* Returns: {Source}
@@ -1068,15 +1068,15 @@ Use needBuild instead
10681068

10691069
#### `source(dependencyTemplates, runtimeTemplate[, type])`
10701070

1071+
> Stability: 0 - Deprecated
1072+
10711073
* `dependencyTemplates` {DependencyTemplates}
10721074
* `runtimeTemplate` {RuntimeTemplate}
10731075
* `type` {string}
10741076
* Returns: {Source}
10751077

10761078
Use codeGeneration() instead
10771079

1078-
##### Deprecated
1079-
10801080
#### `updateCacheModule(module)`
10811081

10821082
* `module` {Module}
@@ -1099,9 +1099,9 @@ and properties.
10991099

11001100
#### Static method: `getSourceBasicTypes(module)`
11011101

1102+
> Stability: 0 - Deprecated
1103+
11021104
* `module` {Module}
11031105
* Returns: {ReadonlySet}
11041106

11051107
In webpack 6, call getSourceBasicTypes() directly on the module instance instead of using this static method.
1106-
1107-
##### Deprecated

pages/v5.x/webpack/namespaces/web.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,14 @@ This data will be passed to restoreFromUnsafeCache later.
469469

470470
#### `needRebuild(fileTimestamps, contextTimestamps)`
471471

472+
> Stability: 0 - Deprecated
473+
472474
* `fileTimestamps` {Map}
473475
* `contextTimestamps` {Map}
474476
* Returns: {boolean}
475477

476478
Use needBuild instead
477479

478-
##### Deprecated
479-
480480
#### `originalSource()`
481481

482482
* Returns: {Source}
@@ -512,15 +512,15 @@ Use needBuild instead
512512

513513
#### `source(dependencyTemplates, runtimeTemplate[, type])`
514514

515+
> Stability: 0 - Deprecated
516+
515517
* `dependencyTemplates` {DependencyTemplates}
516518
* `runtimeTemplate` {RuntimeTemplate}
517519
* `type` {string}
518520
* Returns: {Source}
519521

520522
Use codeGeneration() instead
521523

522-
##### Deprecated
523-
524524
#### `updateCacheModule(module)`
525525

526526
* `module` {Module}
@@ -543,13 +543,13 @@ and properties.
543543

544544
#### Static method: `getSourceBasicTypes(module)`
545545

546+
> Stability: 0 - Deprecated
547+
546548
* `module` {Module}
547549
* Returns: {ReadonlySet}
548550

549551
In webpack 6, call getSourceBasicTypes() directly on the module instance instead of using this static method.
550552

551-
##### Deprecated
552-
553553
***
554554

555555
## Class: `FetchCompileAsyncWasmPlugin`
@@ -1064,14 +1064,14 @@ This data will be passed to restoreFromUnsafeCache later.
10641064

10651065
#### `needRebuild(fileTimestamps, contextTimestamps)`
10661066

1067+
> Stability: 0 - Deprecated
1068+
10671069
* `fileTimestamps` {Map}
10681070
* `contextTimestamps` {Map}
10691071
* Returns: {boolean}
10701072

10711073
Use needBuild instead
10721074

1073-
##### Deprecated
1074-
10751075
#### `originalSource()`
10761076

10771077
* Returns: {Source}
@@ -1107,15 +1107,15 @@ Use needBuild instead
11071107

11081108
#### `source(dependencyTemplates, runtimeTemplate[, type])`
11091109

1110+
> Stability: 0 - Deprecated
1111+
11101112
* `dependencyTemplates` {DependencyTemplates}
11111113
* `runtimeTemplate` {RuntimeTemplate}
11121114
* `type` {string}
11131115
* Returns: {Source}
11141116

11151117
Use codeGeneration() instead
11161118

1117-
##### Deprecated
1118-
11191119
#### `updateCacheModule(module)`
11201120

11211121
* `module` {Module}
@@ -1138,13 +1138,13 @@ and properties.
11381138

11391139
#### Static method: `getSourceBasicTypes(module)`
11401140

1141+
> Stability: 0 - Deprecated
1142+
11411143
* `module` {Module}
11421144
* Returns: {ReadonlySet}
11431145

11441146
In webpack 6, call getSourceBasicTypes() directly on the module instance instead of using this static method.
11451147

1146-
##### Deprecated
1147-
11481148
***
11491149

11501150
## Class: `JsonpTemplatePlugin`
@@ -1166,9 +1166,9 @@ Apply the plugin
11661166

11671167
#### Static method: `getCompilationHooks(compilation)`
11681168

1169+
> Stability: 0 - Deprecated
1170+
11691171
* `compilation` {Compilation}
11701172
* Returns: {JsonpCompilationPluginHooks}
11711173

11721174
use JsonpChunkLoadingRuntimeModule.getCompilationHooks instead
1173-
1174-
##### Deprecated

plugins/theme/helpers/index.mjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,38 @@ export default (ctx) => ({
3030
typedList(entries) {
3131
return entries.map(ctx.helpers.typedListItem).join("\n");
3232
},
33+
34+
stabilityBlockquote(comment) {
35+
if (!comment) return null;
36+
37+
const deprecated = comment.blockTags?.find((t) => t.tag === "@deprecated");
38+
const isExperimental =
39+
comment.modifierTags?.has("@experimental") ||
40+
comment.modifierTags?.has("@beta");
41+
const legacy = comment.blockTags?.find((t) => t.tag === "@legacy");
42+
43+
if (deprecated) {
44+
const message = deprecated.content?.length
45+
? ctx.helpers.getCommentParts(deprecated.content).trim()
46+
: "";
47+
return message
48+
? `> Stability: 0 - Deprecated: ${message}`
49+
: `> Stability: 0 - Deprecated`;
50+
}
51+
52+
if (isExperimental) {
53+
return `> Stability: 1 - Experimental`;
54+
}
55+
56+
if (legacy) {
57+
const message = legacy.content?.length
58+
? ctx.helpers.getCommentParts(legacy.content).trim()
59+
: "";
60+
return message
61+
? `> Stability: 3 - Legacy: ${message}`
62+
: `> Stability: 3 - Legacy`;
63+
}
64+
65+
return null;
66+
},
3367
});

0 commit comments

Comments
 (0)