@@ -10,6 +10,7 @@ import {
1010import { publicGenerators } from '../../src/generators/index.mjs' ;
1111import createGenerator from '../../src/generators.mjs' ;
1212import { parseChangelog , parseIndex } from '../../src/parsers/markdown.mjs' ;
13+ import { loadFromURL } from '../../src/utils/parser.mjs' ;
1314import { loadAndParse } from '../utils.mjs' ;
1415
1516const availableGenerators = Object . keys ( publicGenerators ) ;
@@ -21,6 +22,7 @@ const availableGenerators = Object.keys(publicGenerators);
2122 * @property {Array<keyof publicGenerators> } target - Specifies the generator target mode.
2223 * @property {string } version - Specifies the target Node.js version.
2324 * @property {string } changelog - Specifies the path to the Node.js CHANGELOG.md file.
25+ * @property {string } typeMap - Specifies the path to the Node.js Type Map.
2426 * @property {string } [gitRef] - Git ref/commit URL.
2527 * @property {number } [threads] - Number of threads to allow.
2628 */
@@ -112,6 +114,14 @@ export default {
112114 type : 'text' ,
113115 } ,
114116 } ,
117+ typeMap : {
118+ flags : [ '--type-map <path>' ] ,
119+ desc : 'The mapping of types to links' ,
120+ prompt : {
121+ message : 'Path to doc/api/type_map.json' ,
122+ type : 'text' ,
123+ } ,
124+ } ,
115125 } ,
116126 /**
117127 * Handles the action for generating API docs
@@ -121,6 +131,11 @@ export default {
121131 async action ( opts ) {
122132 const docs = await loadAndParse ( opts . input , opts . ignore ) ;
123133 const releases = await parseChangelog ( opts . changelog ) ;
134+
135+ const typeMap = opts . typeMap
136+ ? JSON . parse ( await loadFromURL ( opts . typeMap ) )
137+ : undefined ;
138+
124139 const index = opts . index && ( await parseIndex ( opts . index ) ) ;
125140
126141 const { runGenerators } = createGenerator ( docs ) ;
@@ -134,6 +149,7 @@ export default {
134149 gitRef : opts . gitRef ,
135150 threads : parseInt ( opts . threads , 10 ) ,
136151 index,
152+ typeMap,
137153 } ) ;
138154 } ,
139155} ;
0 commit comments