@jspm/generator
Version:
Package Import Map Generation Tool
70 lines (69 loc) • 3.6 kB
TypeScript
import { ExactPackage, PackageConfig, PackageTarget, ExportsTarget, ExactModule } from "../install/package.js";
import { Log } from "../common/log.js";
import { Install } from "../generator.js";
import { Provider } from "../providers/index.js";
import { Installer, PackageProvider } 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 {
log: Log;
pcfgPromises: Record<string, Promise<void>>;
analysisPromises: Record<string, Promise<void>>;
pcfgs: Record<string, PackageConfig | null>;
fetchOpts: any;
preserveSymlinks: any;
providers: Record<string, Provider>;
traceEntries: Record<string, TraceEntry | null>;
traceEntryPromises: Record<string, Promise<void>>;
env: string[];
cjsEnv: string[];
traceCjs: boolean;
traceTs: boolean;
traceSystem: boolean;
context: Record<string, any>;
installer: Installer;
constructor({ env, log, fetchOpts, preserveSymlinks, traceCjs, traceTs, traceSystem, }: {
env: string[];
log: Log;
fetchOpts?: any;
preserveSymlinks?: boolean;
traceCjs?: boolean;
traceTs?: boolean;
traceSystem: boolean;
});
addCustomProvider(name: string, provider: Provider): void;
providerNameForUrl(url: string): string | null;
providerForUrl(url: string): Provider | null;
parseUrlPkg(url: string): Promise<ExactModule | null>;
pkgToUrl(pkg: ExactPackage, { provider, layer }: PackageProvider): Promise<`${string}/`>;
resolveBuiltin(specifier: string): string | Install | undefined;
getPackageBase(url: string): Promise<`${string}/`>;
getPackageConfig(pkgUrl: string): Promise<PackageConfig | null>;
getDepList(pkgUrl: string, dev?: boolean): Promise<string[]>;
checkPjson(url: string): Promise<string | false>;
exists(resolvedUrl: string): Promise<boolean>;
resolveLatestTarget(target: PackageTarget, { provider, layer }: PackageProvider, parentUrl: string): Promise<ExactPackage>;
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}` | ".">;