typings: fix ModulesBinding types

PR-URL: https://github.com/nodejs/node/pull/55549
Refs: https://github.com/nodejs/node/pull/55412/files#r1817708918
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Antoine du Hamel 2024-11-02 16:36:49 +00:00 committed by GitHub
parent 7b01758ded
commit df4a0c996d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,7 +9,7 @@ export type PackageConfig = {
export type DeserializedPackageConfig = {
data: PackageConfig,
exists: boolean,
path: URL['pathname'],
path: string,
}
export type SerializedPackageConfig = [
PackageConfig['name'],
@ -22,9 +22,10 @@ export type SerializedPackageConfig = [
export interface ModulesBinding {
readPackageJSON(path: string): SerializedPackageConfig | undefined;
getNearestParentPackageJSON(path: string): SerializedPackageConfig | undefined
getNearestRawParentPackageJSON(origin: URL['pathname']): [ReturnType<JSON['stringify']>, DeserializedPackageConfig['path']] | undefined
getNearestParentPackageJSONType(path: string): PackageConfig['type']
getNearestParentPackageJSON(path: string): SerializedPackageConfig | undefined
getPackageScopeConfig(path: string): SerializedPackageConfig | undefined
getPackageJSONScripts(): string | undefined
enableCompileCache(path?: string): { status: number, message?: string, directory?: string }
getCompileCacheDir(): string | undefined
flushCompileCache(keepDeserializedCache?: boolean): void
}