@@ -323,6 +323,10 @@ export class ExtractorConfig {
323323 const filenameForErrors : string = options . configObjectFullPath || 'the configuration object' ;
324324 const configObject : Partial < IConfigFile > = options . configObject ;
325325
326+ if ( configObject . extends ) {
327+ throw new Error ( 'The IConfigFile.extends field must be expanded before calling ExtractorConfig.prepare()' ) ;
328+ }
329+
326330 if ( options . configObjectFullPath ) {
327331 if ( ! path . isAbsolute ( options . configObjectFullPath ) ) {
328332 throw new Error ( 'configObjectFullPath must be an absolute path' ) ;
@@ -357,7 +361,7 @@ export class ExtractorConfig {
357361
358362 if ( ! configObject . projectFolder ) {
359363 // A merged configuration should have this
360- throw new Error ( 'The "projectFolder" section is missing' ) ;
364+ throw new Error ( 'The "projectFolder" field is missing' ) ;
361365 }
362366
363367 let projectFolder : string ;
@@ -545,6 +549,19 @@ export class ExtractorConfig {
545549 if ( value !== '' ) {
546550 value = Text . replaceAll ( value , '<unscopedPackageName>' , tokenContext . unscopedPackageName ) ;
547551 value = Text . replaceAll ( value , '<packageName>' , tokenContext . packageName ) ;
552+
553+ const projectFolderToken : string = '<projectFolder>' ;
554+ if ( value . indexOf ( projectFolderToken ) === 0 ) {
555+ // Replace "<projectFolder>" at the start of a string
556+ value = path . join ( tokenContext . projectFolder , value . substr ( projectFolderToken . length ) ) ;
557+ }
558+
559+ if ( value . indexOf ( projectFolderToken ) >= 0 ) {
560+ // If after all replacements, "<projectFolder>" appears somewhere in the string, report an error
561+ throw new Error ( `The ${ fieldName } value incorrectly uses the "<projectFolder>" token.`
562+ + ` It must appear at the start of the string.` ) ;
563+ }
564+
548565 if ( value . indexOf ( '<lookup>' ) >= 0 ) {
549566 throw new Error ( `The ${ fieldName } value incorrectly uses the "<lookup>" token` ) ;
550567 }
0 commit comments