@@ -94,6 +94,7 @@ interface IExtractorConfigParameters {
9494 packageJson : INodePackageJson | undefined ;
9595 packageJsonFullPath : string | undefined ;
9696 mainEntryPointFile : string ;
97+ tsconfigFilePath : string ;
9798 overrideTsconfig : { } | undefined ;
9899 skipLibCheck : boolean ;
99100 apiReportEnabled : boolean ;
@@ -150,6 +151,9 @@ export class ExtractorConfig {
150151 /** {@inheritDoc IConfigFile.mainEntryPointFile } */
151152 public readonly mainEntryPointFile : string ;
152153
154+ /** {@inheritDoc IConfigCompiler.tsconfigFilePath } */
155+ public readonly tsconfigFilePath : string ;
156+
153157 /** {@inheritDoc IConfigCompiler.overrideTsconfig } */
154158 public readonly overrideTsconfig : { } | undefined ;
155159
@@ -194,6 +198,7 @@ export class ExtractorConfig {
194198 this . packageJson = parameters . packageJson ;
195199 this . packageJsonFullPath = parameters . packageJsonFullPath ;
196200 this . mainEntryPointFile = parameters . mainEntryPointFile ;
201+ this . tsconfigFilePath = parameters . tsconfigFilePath ;
197202 this . overrideTsconfig = parameters . overrideTsconfig ;
198203 this . skipLibCheck = parameters . skipLibCheck ;
199204 this . apiReportEnabled = parameters . apiReportEnabled ;
@@ -342,6 +347,13 @@ export class ExtractorConfig {
342347 'mainEntryPointFile' , configFile . mainEntryPointFile , currentConfigFolderPath ) ;
343348 }
344349
350+ if ( configFile . compiler ) {
351+ if ( configFile . compiler . tsconfigFilePath ) {
352+ configFile . compiler . tsconfigFilePath = ExtractorConfig . _resolveConfigFileRelativePath (
353+ 'tsconfigFilePath' , configFile . compiler . tsconfigFilePath , currentConfigFolderPath ) ;
354+ }
355+ }
356+
345357 if ( configFile . apiReport ) {
346358 if ( configFile . apiReport . reportFolder ) {
347359 configFile . apiReport . reportFolder = ExtractorConfig . _resolveConfigFileRelativePath (
@@ -494,17 +506,29 @@ export class ExtractorConfig {
494506
495507 if ( ! configObject . mainEntryPointFile ) {
496508 // A merged configuration should have this
497- throw new Error ( 'mainEntryPointFile is missing' ) ;
509+ throw new Error ( 'The " mainEntryPointFile" setting is missing' ) ;
498510 }
499511 const mainEntryPointFile : string = ExtractorConfig . _resolvePathWithTokens ( 'mainEntryPointFile' ,
500512 configObject . mainEntryPointFile , tokenContext ) ;
501513
502514 if ( ! ExtractorConfig . hasDtsFileExtension ( mainEntryPointFile ) ) {
503- throw new Error ( 'The mainEntryPointFile is not a declaration file: ' + mainEntryPointFile ) ;
515+ throw new Error ( 'The " mainEntryPointFile" is not a declaration file: ' + mainEntryPointFile ) ;
504516 }
505517
506518 if ( ! FileSystem . exists ( mainEntryPointFile ) ) {
507- throw new Error ( 'The mainEntryPointFile does not exist: ' + mainEntryPointFile ) ;
519+ throw new Error ( 'The "mainEntryPointFile" does not exist: ' + mainEntryPointFile ) ;
520+ }
521+
522+ const tsconfigFilePath : string = ExtractorConfig . _resolvePathWithTokens ( 'tsconfigFilePath' ,
523+ configObject . compiler . tsconfigFilePath , tokenContext ) ;
524+
525+ if ( configObject . compiler . overrideTsconfig === undefined ) {
526+ if ( ! configObject . compiler . tsconfigFilePath ) {
527+ throw new Error ( 'Either the "tsconfigFilePath" or "overrideTsconfig" setting must be specified' ) ;
528+ }
529+ if ( ! FileSystem . exists ( configObject . compiler . tsconfigFilePath ) ) {
530+ throw new Error ( 'The "tsconfigFilePath" does not exist: ' + configObject . compiler . tsconfigFilePath ) ;
531+ }
508532 }
509533
510534 let apiReportEnabled : boolean = false ;
@@ -594,6 +618,7 @@ export class ExtractorConfig {
594618 packageJson,
595619 packageJsonFullPath,
596620 mainEntryPointFile,
621+ tsconfigFilePath,
597622 overrideTsconfig : configObject . compiler . overrideTsconfig ,
598623 skipLibCheck : ! ! configObject . compiler . skipLibCheck ,
599624 apiReportEnabled,
0 commit comments