@@ -8,32 +8,9 @@ import { compileFromFile } from 'json-schema-to-typescript';
88
99import { type ITypingsGeneratorBaseOptions , TypingsGenerator } from '@rushstack/typings-generator' ;
1010
11- interface IJsonSchemaTypingsGeneratorBaseOptions extends ITypingsGeneratorBaseOptions { }
12-
13- /**
14- * Adds a TSDoc release tag (e.g. `@public`, `@beta`) to all exported declarations
15- * in generated typings.
16- *
17- * `json-schema-to-typescript` does not emit release tags, so this function
18- * post-processes the output to ensure API Extractor treats these types with the
19- * correct release tag when they are re-exported from package entry points.
20- */
21- function _addTsDocTagToExports ( typingsData : string , tag : string ) : string {
22- // Normalize line endings for consistent regex matching.
23- // The TypingsGenerator base class applies NewlineKind.OsDefault when writing.
24- const normalized : string = typingsData . replace ( / \r \n / g, '\n' ) ;
25-
26- // Pass 1: For exports preceded by an existing JSDoc comment, insert
27- // the tag before the closing "*/".
28- let result : string = normalized . replace ( / \* \/ \n ( e x p o r t ) / g, ` *\n * ${ tag } \n */\n$1` ) ;
11+ import { _addTsDocTagToExports } from './TsDocTagHelpers' ;
2912
30- // Pass 2: For exports NOT preceded by a JSDoc comment, insert a new
31- // JSDoc block. The negative lookbehind ensures Pass 1
32- // results are not double-matched.
33- result = result . replace ( / (?< ! \* \/ \n ) ^ ( e x p o r t ) / gm, `/**\n * ${ tag } \n */\n$1` ) ;
34-
35- return result ;
36- }
13+ interface IJsonSchemaTypingsGeneratorBaseOptions extends ITypingsGeneratorBaseOptions { }
3714
3815export class JsonSchemaTypingsGenerator extends TypingsGenerator {
3916 public constructor ( options : IJsonSchemaTypingsGeneratorBaseOptions ) {
0 commit comments