@typespec/compiler
Version:
TypeSpec compiler and standard library
38 lines • 1.53 kB
TypeScript
export interface EsmResolutionContext {
/** Original import specifier */
readonly specifier: string;
/** URL of the current package */
readonly packageUrl: string;
/**
* List of condition to match
* @example `["import", "require"]`
*/
readonly conditions: readonly string[];
/**
* Folders where modules exist that are banned from being used in exports.
* @example `["node_modules"]`
*/
readonly moduleDirs: readonly string[];
resolveId(id: string, baseDir: string | URL): Promise<string | undefined>;
/** Non standard option. Do not respect the default condition. */
readonly ignoreDefaultCondition?: boolean;
}
export declare class EsmResolveError extends Error {
}
export declare class InvalidConfigurationError extends EsmResolveError {
constructor(context: EsmResolutionContext, reason?: string);
}
export declare class InvalidModuleSpecifierError extends EsmResolveError {
constructor(context: EsmResolutionContext, isImports?: boolean, reason?: string);
}
export declare class InvalidPackageTargetError extends EsmResolveError {
constructor(context: EsmResolutionContext, reason?: string);
}
export declare class NoMatchingConditionsError extends InvalidPackageTargetError {
constructor(context: EsmResolutionContext);
}
export declare class PackageImportNotDefinedError extends EsmResolveError {
constructor(context: EsmResolutionContext);
}
export declare function isUrl(str: string): boolean;
//# sourceMappingURL=utils.d.ts.map