mirror of
https://github.com/nodejs/node.git
synced 2024-11-28 22:46:31 +01:00
951af83033
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: https://github.com/nodejs/node/pull/52583 Refs: https://github.com/nodejs/node/issues/52575 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
27 lines
909 B
TypeScript
27 lines
909 B
TypeScript
export type PackageType = 'commonjs' | 'module' | 'none'
|
|
export type PackageConfig = {
|
|
pjsonPath: string
|
|
exists: boolean
|
|
name?: string
|
|
main?: any
|
|
type: PackageType
|
|
exports?: string | string[] | Record<string, unknown>
|
|
imports?: string | string[] | Record<string, unknown>
|
|
}
|
|
export type SerializedPackageConfig = [
|
|
PackageConfig['name'],
|
|
PackageConfig['main'],
|
|
PackageConfig['type'],
|
|
string | undefined, // exports
|
|
string | undefined, // imports
|
|
string | undefined, // raw json available for experimental policy
|
|
]
|
|
|
|
export interface ModulesBinding {
|
|
readPackageJSON(path: string): SerializedPackageConfig | undefined;
|
|
getNearestParentPackageJSON(path: string): PackageConfig | undefined
|
|
getNearestParentPackageJSONType(path: string): PackageConfig['type']
|
|
getPackageScopeConfig(path: string): SerializedPackageConfig | undefined
|
|
getPackageJSONScripts(): string | undefined
|
|
}
|