77 writeAssembly ,
88} from '@jsii/spec' ;
99import * as crypto from 'crypto' ;
10- import * as fs from 'fs-extra' ;
10+ import { promises as fsPromises } from 'fs' ;
11+ import * as fs from 'fs' ;
1112import * as path from 'path' ;
1213
1314import { findDependencyDirectory , isBuiltinModule } from '../find-utils' ;
@@ -78,7 +79,7 @@ export function loadAssemblies(
7879 const pjLocation = path . join ( directory , 'package.json' ) ;
7980
8081 const assembly = loadAssemblyFromFile ( location , validateAssemblies ) ;
81- const packageJson = fs . pathExistsSync ( pjLocation ) ? fs . readJSONSync ( pjLocation , { encoding : 'utf-8' } ) : undefined ;
82+ const packageJson = fs . existsSync ( pjLocation ) ? JSON . parse ( fs . readFileSync ( pjLocation , 'utf-8' ) ) : undefined ;
8283
8384 return { assembly, directory, packageJson } ;
8485 }
@@ -297,7 +298,7 @@ export function findTypeLookupAssembly(startingDirectory: string): TypeLookupAss
297298
298299function loadLookupAssembly ( directory : string ) : TypeLookupAssembly | undefined {
299300 try {
300- const packageJson = fs . readJSONSync ( path . join ( directory , 'package.json' ) , { encoding : 'utf-8' } ) ;
301+ const packageJson = JSON . parse ( fs . readFileSync ( path . join ( directory , 'package.json' ) , 'utf-8' ) ) ;
301302 const assembly : spec . Assembly = loadAssemblyFromPath ( directory ) ;
302303 const symbolIdMap = mkDict ( [
303304 ...Object . values ( assembly . types ?? { } ) . map ( ( type ) => [ type . symbolId ?? '' , type . fqn ] as const ) ,
@@ -367,7 +368,7 @@ async function withDependencies(asm: LoadedAssembly, snippet: TypeScriptSnippet)
367368
368369 compilationDependencies [ asm . assembly . name ] = {
369370 type : 'concrete' ,
370- resolvedDirectory : await fs . realpath ( asm . directory ) ,
371+ resolvedDirectory : await fsPromises . realpath ( asm . directory ) ,
371372 } ;
372373
373374 Object . assign (
@@ -387,7 +388,7 @@ async function withDependencies(asm: LoadedAssembly, snippet: TypeScriptSnippet)
387388 name ,
388389 {
389390 type : 'concrete' ,
390- resolvedDirectory : await fs . realpath ( await findDependencyDirectory ( name , asm . directory ) ) ,
391+ resolvedDirectory : await fsPromises . realpath ( await findDependencyDirectory ( name , asm . directory ) ) ,
391392 } ,
392393 ] as const ,
393394 ) ,
0 commit comments