resolve.imports
Version:
resolve "imports" in package.json
37 lines • 1.05 kB
TypeScript
export type ImportsFieldManifest = {
/**
* Path to the package. e.g. `/path/to/package/`
* Used for error handling only.
*/
path?: string;
/**
* The base path where the import is made from.
* Used for error handling only.
*/
base?: string;
/**
* Content of the package.json.
*/
content: {
imports?: Record<string, ImportMap>;
};
};
export type ImportMap = string | Array<ImportMap> | {
[key: string]: ImportMap;
};
export type ResolveOptions = {
/**
* Array of conditions to resolve.
*/
conditions?: string[];
};
/**
* Resolve an import specifier based on the `imports` field in `package.json`.
*
* @param manifest of package.json
* @param specifier import specifier
* @return resolved specifier or undefined if not found
* @see https://nodejs.org/api/packages.html#subpath-imports
*/
export declare function resolve(manifest: ImportsFieldManifest, specifier: string, options?: ResolveOptions): string | undefined;
//# sourceMappingURL=index.d.ts.map