@jspm/generator
Version:
Package Import Map Generation Tool
62 lines (61 loc) • 3.16 kB
TypeScript
import { PackageConfig, ExportsTarget } from '../install/package.js';
import { Install } from '../generator.js';
import { ProviderManager } from '../providers/index.js';
import { Installer } from '../install/installer.js';
export declare function setPathFns(_realpath: any, _pathToFileURL: any): void;
export declare function isBuiltinScheme(specifier: string): specifier is `${string}:${string}`;
export declare function isMappableScheme(specifier: string): specifier is `${string}:${string}`;
export interface TraceEntry {
deps: string[];
dynamicDeps: string[];
hasStaticParent: boolean;
size: number;
integrity: string;
wasCjs: boolean;
usesCjs: boolean;
cjsLazyDeps: string[];
format: 'esm' | 'commonjs' | 'system' | 'json' | 'css' | 'typescript' | 'wasm';
parseError: Error;
}
export declare class Resolver {
pcfgPromises: Record<string, Promise<PackageConfig | null>>;
analysisPromises: Record<string, Promise<void>>;
pcfgs: Record<string, PackageConfig | null>;
fetchOpts: any;
preserveSymlinks: any;
pm: ProviderManager;
traceEntries: Record<string, TraceEntry | null>;
traceEntryPromises: Record<string, Promise<void>>;
env: string[];
cjsEnv: string[];
traceCjs: boolean;
traceTs: boolean;
traceSystem: boolean;
installer: Installer;
constructor({ env, fetchOpts, providerManager, packageConfigs, preserveSymlinks, traceCjs, traceTs, traceSystem }: {
env: string[];
fetchOpts?: any;
preserveSymlinks?: boolean;
packageConfigs?: Record<`${string}/`, PackageConfig>;
traceCjs?: boolean;
traceTs?: boolean;
traceSystem: boolean;
providerManager: ProviderManager;
});
resolveBuiltin(specifier: string): string | Install | undefined;
getPackageBase(url: string): Promise<`${string}/`>;
getPackageConfig(pkgUrl: string): PackageConfig | null | Promise<PackageConfig | null>;
getDepList(pkgUrl: string, dev?: boolean): Promise<string[]>;
checkPjson(url: string): boolean | Promise<boolean>;
exists(resolvedUrl: string): Promise<boolean>;
wasCommonJS(url: string): Promise<boolean>;
realPath(url: string): Promise<string>;
finalizeResolve(url: string, parentIsCjs: boolean, exportsResolution: boolean, pkgUrl: `${string}/`): Promise<string>;
getExportResolution(pkgUrl: `${string}/`, subpath: '.' | `./${string}`, originalSpecifier: string): Promise<'.' | `./${string}` | null>;
resolveEmpty(cjsEnv: boolean, originalSpecifier: string, parentUrl: string): Promise<string>;
resolveExport(pkgUrl: `${string}/`, subpath: `.${string}`, cjsEnv: boolean, parentIsCjs: boolean, originalSpecifier: string, parentUrl?: string): Promise<string>;
getAnalysis(resolvedUrl: string): TraceEntry | null | undefined;
analyze(resolvedUrl: string): Promise<TraceEntry | null>;
resolvePackageTarget(target: ExportsTarget, packageUrl: string, cjsEnv: boolean, subpath: string, isImport: boolean): string | null;
}
export declare function enumeratePackageTargets(target: ExportsTarget, targets?: Set<"." | `./${string}`>): Set<`./${string}` | '.'>;