@foxpage/foxpage-component-shared
Version:
foxpage component shared
20 lines (19 loc) • 1.36 kB
TypeScript
import { IPackageJson } from 'package-json-type';
export declare const loadFile: <T = any>(path?: string) => T | undefined;
export declare const findPath: (baseDir?: string, mayPaths?: string[]) => string | undefined;
export declare const findPackages: (root: string, packageRootDirNames?: string[], { exclude, include }?: {
exclude?: string[] | undefined;
include?: string[] | undefined;
}) => string[];
export declare const requireProjectModule: <T = any>(moduleName: string) => T;
export declare const isProjectRoot: (pathname: string) => boolean;
export declare const cwd: string;
export declare const cwdIsProjectRoot: boolean;
export declare const resolveRoot: (...paths: string[]) => string;
export declare const isRootContext: (context: string) => string | undefined;
export declare const existModule: (moduleName: string) => boolean;
export declare function readPackageInfo(dirPath: string): IPackageJson | undefined;
export declare function readPackageInfo<K extends keyof IPackageJson>(dirPath: string, key?: K): IPackageJson[K] | undefined;
export declare function updatePackageJson(dirPath: string, cb: (json: IPackageJson) => IPackageJson): Promise<void>;
export declare const toAbsolutePath: (pathname: string, base: string) => string;
export declare const resolveExtensions: (pathnameList: string[], extensions: string[]) => string[];