@@ -3,7 +3,7 @@ import * as fsx from 'fs-extra';
33import * as path from 'path' ;
44import ApiPackage from './definitions/ApiPackage' ;
55import DocItemLoader from './DocItemLoader' ;
6- import PackageJsonHelpers from './PackageJsonHelpers ' ;
6+ import PackageJsonLookup from './PackageJsonLookup ' ;
77
88export type ApiErrorHandler = ( message : string , fileName : string , lineNumber : number ) => void ;
99
@@ -50,14 +50,16 @@ export interface IExtractorAnalyzeOptions {
5050 * abstract syntax tree.
5151 */
5252export default class Extractor {
53- public errorHandler : ApiErrorHandler ;
53+ public readonly errorHandler : ApiErrorHandler ;
5454 public typeChecker : ts . TypeChecker ;
5555 public package : ApiPackage ;
5656 /**
5757 * One DocItemLoader is needed per analyzer to look up external API members
5858 * as needed.
5959 */
60- public docItemLoader : DocItemLoader ;
60+ public readonly docItemLoader : DocItemLoader ;
61+
62+ public readonly packageJsonLookup : PackageJsonLookup ;
6163
6264 private _compilerOptions : ts . CompilerOptions ;
6365
@@ -75,6 +77,7 @@ export default class Extractor {
7577 constructor ( options : IExtractorOptions ) {
7678 this . _compilerOptions = options . compilerOptions ;
7779 this . docItemLoader = new DocItemLoader ( options . compilerOptions . rootDir ) ;
80+ this . packageJsonLookup = new PackageJsonLookup ( ) ;
7881 this . errorHandler = options . errorHandler || Extractor . defaultErrorHandler ;
7982 }
8083
@@ -110,7 +113,7 @@ export default class Extractor {
110113 // Assign _packageFolder by probing upwards from entryPointFile until we find a package.json
111114 const currentPath : string = path . resolve ( options . entryPointFile ) ;
112115 // This is guaranteed to succeed since we do check prior to this point
113- this . _packageFolder = PackageJsonHelpers . tryFindPackagePathUpwards ( currentPath ) ;
116+ this . _packageFolder = this . packageJsonLookup . tryFindPackagePathUpwards ( currentPath ) ;
114117
115118 this . package = new ApiPackage ( this , rootFile ) ; // construct members
116119 this . package . completeInitialization ( ) ; // creates ApiDocumentation
0 commit comments