lbundle
Version:
Small zero-configuration bundler build on top of Rollup.js and SWC for NPM libraries
25 lines (24 loc) • 1.13 kB
TypeScript
import type { PackageJSON } from 'resolve';
interface Package extends PackageJSON {
}
type PackageFilterFn = (pkg: Package, pkgfile: string) => Package;
export interface ResolveOpts {
/** name of the caller for error message (default to `Resolver`) */
caller?: string;
/** directories to begin resolving from (defaults to `[__dirname]`) */
basedirs?: string[];
/** array of file extensions to search in order (defaults to `[".mjs", ".js", ".cjs", ".json"]`) */
extensions?: string | ReadonlyArray<string>;
/** don't resolve `basedirs` to real path before resolving. (defaults to `true`) */
preserveSymlinks?: boolean;
/** transform the parsed `package.json` contents before looking at the "main" field */
packageFilter?: PackageFilterFn;
}
interface PackageFilterBuilderOpts {
fields?: string[];
conditions?: string[];
}
type PackageFilterBuilderFn = (path?: string, opts?: PackageFilterBuilderOpts) => PackageFilterFn;
export declare const packageFilterBuilder: PackageFilterBuilderFn;
export declare function resolveSync(ids: string[], userOpts: ResolveOpts): string;
export {};