@@ -41,7 +41,7 @@ interface IExtractorConfigTokenContext {
4141 */
4242 packageName : string ;
4343
44- rootFolder : string ;
44+ projectFolder : string ;
4545}
4646
4747/**
@@ -61,7 +61,7 @@ export interface IExtractorConfigPrepareOptions {
6161 *
6262 * @remarks
6363 *
64- * If this is omitted, then the `rootFolder ` must not be specified using the `<lookup>` token.
64+ * If this is omitted, then the `projectFolder ` must not be specified using the `<lookup>` token.
6565 */
6666 configObjectFullPath : string | undefined ;
6767
@@ -89,7 +89,7 @@ export interface IExtractorConfigPrepareOptions {
8989}
9090
9191interface IExtractorConfigParameters {
92- rootFolder : string ;
92+ projectFolder : string ;
9393 packageJson : INodePackageJson | undefined ;
9494 packageJsonFullPath : string | undefined ;
9595 mainEntryPointFile : string ;
@@ -131,8 +131,8 @@ export class ExtractorConfig {
131131
132132 private static readonly _declarationFileExtensionRegExp : RegExp = / \. d \. t s $ / i;
133133
134- /** {@inheritDoc IConfigCompiler.rootFolder } */
135- public readonly rootFolder : string ;
134+ /** {@inheritDoc IConfigFile.projectFolder } */
135+ public readonly projectFolder : string ;
136136
137137 /**
138138 * The parsed package.json file for the working package, or undefined if API Extractor was invoked without
@@ -189,7 +189,7 @@ export class ExtractorConfig {
189189 public readonly testMode : boolean ;
190190
191191 private constructor ( parameters : IExtractorConfigParameters ) {
192- this . rootFolder = parameters . rootFolder ;
192+ this . projectFolder = parameters . projectFolder ;
193193 this . packageJson = parameters . packageJson ;
194194 this . packageJsonFullPath = parameters . packageJsonFullPath ;
195195 this . mainEntryPointFile = parameters . mainEntryPointFile ;
@@ -218,7 +218,7 @@ export class ExtractorConfig {
218218 if ( ! path . isAbsolute ( absolutePath ) ) {
219219 throw new InternalError ( 'Expected absolute path: ' + absolutePath ) ;
220220 }
221- return path . relative ( this . rootFolder , absolutePath ) . replace ( / \\ / g, '/' ) ;
221+ return path . relative ( this . projectFolder , absolutePath ) . replace ( / \\ / g, '/' ) ;
222222 }
223223
224224 /**
@@ -355,12 +355,17 @@ export class ExtractorConfig {
355355 throw new Error ( 'The "compiler" section is missing' ) ;
356356 }
357357
358- let rootFolder : string ;
359- if ( configObject . compiler . rootFolder . trim ( ) === '<lookup>' ) {
358+ if ( ! configObject . projectFolder ) {
359+ // A merged configuration should have this
360+ throw new Error ( 'The "projectFolder" section is missing' ) ;
361+ }
362+
363+ let projectFolder : string ;
364+ if ( configObject . projectFolder . trim ( ) === '<lookup>' ) {
360365 if ( ! options . configObjectFullPath ) {
361366 throw new Error ( 'The "<lookup>" token cannot be expanded because configObjectFullPath was not specified' ) ;
362367 }
363- // "The default value for `rootFolder ` is the token `<lookup>`, which means the folder is determined
368+ // "The default value for `projectFolder ` is the token `<lookup>`, which means the folder is determined
364369 // by traversing parent folders, starting from the folder containing api-extractor.json, and stopping
365370 // at the first folder that contains a tsconfig.json file. If a tsconfig.json file cannot be found in
366371 // this way, then an error will be reported."
@@ -369,34 +374,30 @@ export class ExtractorConfig {
369374 for ( ; ; ) {
370375 const tsconfigPath : string = path . join ( currentFolder , 'tsconfig.json' ) ;
371376 if ( FileSystem . exists ( tsconfigPath ) ) {
372- rootFolder = currentFolder ;
377+ projectFolder = currentFolder ;
373378 break ;
374379 }
375380 const parentFolder : string = path . dirname ( currentFolder ) ;
376381 if ( parentFolder === '' || parentFolder === currentFolder ) {
377- throw new Error ( 'The rootFolder was set to "<lookup>", but a tsconfig.json file cannot be'
382+ throw new Error ( 'The projectFolder was set to "<lookup>", but a tsconfig.json file cannot be'
378383 + ' found in this folder or any parent folder.' ) ;
379384 }
380385 currentFolder = parentFolder ;
381386 }
382387 } else {
383- if ( ! configObject . compiler . rootFolder ) {
384- throw new Error ( 'The rootFolder must be specified' ) ;
385- }
386-
387- ExtractorConfig . _rejectAnyTokensInPath ( configObject . compiler . rootFolder , 'rootFolder' ) ;
388+ ExtractorConfig . _rejectAnyTokensInPath ( configObject . projectFolder , 'projectFolder' ) ;
388389
389- if ( ! FileSystem . exists ( configObject . compiler . rootFolder ) ) {
390- throw new Error ( 'The specified rootFolder does not exist: ' + configObject . compiler . rootFolder ) ;
390+ if ( ! FileSystem . exists ( configObject . projectFolder ) ) {
391+ throw new Error ( 'The specified projectFolder does not exist: ' + configObject . projectFolder ) ;
391392 }
392393
393- rootFolder = configObject . compiler . rootFolder ;
394+ projectFolder = configObject . projectFolder ;
394395 }
395396
396397 const tokenContext : IExtractorConfigTokenContext = {
397398 unscopedPackageName : 'unknown-package' ,
398399 packageName : 'unknown-package' ,
399- rootFolder
400+ projectFolder : projectFolder
400401 } ;
401402
402403 if ( packageJson ) {
@@ -464,11 +465,11 @@ export class ExtractorConfig {
464465
465466 if ( tsdocMetadataFilePath . trim ( ) === '<lookup>' ) {
466467 if ( ! packageJson ) {
467- throw new Error ( 'The "<lookup>" token cannot be used with compiler.rootFolder because'
468+ throw new Error ( 'The "<lookup>" token cannot be used with compiler.projectFolder because'
468469 + 'the "packageJson" option was not provided' ) ;
469470 }
470471 if ( ! packageJsonFullPath ) {
471- throw new Error ( 'The "<lookup>" token cannot be used with compiler.rootFolder because'
472+ throw new Error ( 'The "<lookup>" token cannot be used with compiler.projectFolder because'
472473 + 'the "packageJsonFullPath" option was not provided' ) ;
473474 }
474475 tsdocMetadataFilePath = PackageMetadataManager . resolveTsdocMetadataPath (
@@ -502,7 +503,7 @@ export class ExtractorConfig {
502503 }
503504
504505 return new ExtractorConfig ( {
505- rootFolder ,
506+ projectFolder : projectFolder ,
506507 packageJson,
507508 packageJsonFullPath,
508509 mainEntryPointFile,
@@ -533,7 +534,7 @@ export class ExtractorConfig {
533534
534535 value = ExtractorConfig . _expandStringWithTokens ( fieldName , value , tokenContext ) ;
535536 if ( value !== '' ) {
536- value = path . resolve ( tokenContext . rootFolder , value ) ;
537+ value = path . resolve ( tokenContext . projectFolder , value ) ;
537538 }
538539 return value ;
539540 }
@@ -560,7 +561,7 @@ export class ExtractorConfig {
560561 }
561562
562563 /**
563- * Given a path string that may have originally contained expandable tokens such as `<rootFolder >"`
564+ * Given a path string that may have originally contained expandable tokens such as `<projectFolder >"`
564565 * this reports an error if any token-looking substrings remain after expansion (e.g. `c:\blah\<invalid>\blah`).
565566 */
566567 private static _rejectAnyTokensInPath ( value : string , fieldName : string ) : void {
0 commit comments