import type { PackageJson } from '@ms-cloudpack/config-types'; /** Provides context about how a parent package imports/depends on another package. */ export interface PackageImporterContext { /** Actual name of the package that requested this package. */ parentName: string; /** Actual version of the package that requested this package. */ parentVersion: string; /** Name under which this package is imported by the parent. */ importedName: string; /** Version spec the parent requested for this package. */ versionRequirement: string; } /** Transform applied to a `package.json` file after it's read. */ export type PackageDefinitionTransform = (params: { definition: PackageJson; packagePath: string; packages: PackageDefinitionsCache; importerContext?: PackageImporterContext; }) => PackageJson | undefined | Promise; export interface GetPackageDefinitionOptions { /** If true, the package definition will be re-read from disk. */ refresh?: boolean; /** If true, transforms will not be applied. */ disableTransforms?: boolean; /** Info about the package that is importing this package, if known. */ importerContext?: PackageImporterContext; } /** * Utility class for reading and caching package definition (`package.json`) objects, * and optionally applying transforms. */ export interface PackageDefinitionsCache { /** Get a package definition (either from cache or disk) and apply transforms. */ get(packagePath: string, options?: GetPackageDefinitionOptions): Promise; /** Register a new transform. */ registerTransform(factory: (config?: unknown) => PackageDefinitionTransform): void; /** * Resets the cache. If a `newConfig` value is provided, the transform factories will be called with the new value * to give them an opportunity to reflect changes to the config. It is `unknown` because the config type is * application-specific. */ reset(options?: { newConfig?: unknown; }): void; /** * Remove one package from the cache. * @deprecated Not used. */ resetPackage(packagePath: string): void; } //# sourceMappingURL=PackageDefinitionsCache.d.ts.map