UNPKG

@hairy/lnv

Version:

Loading environment variables in Next.js and other frameworks can be quite cumbersome, and using dotenv or vault at runtime is also inconvenient. That's why my created this tool

37 lines (35 loc) 1.6 kB
/** * Before is CJS: use 'resolve' * ESM: use 'mlly' * * @param module The name of the package to resolve * @param ensure Whether to ensure the package is installed */ declare function resolveImport(module: string, ensure?: true): Promise<string>; declare function resolveImport(module: string, ensure?: boolean): Promise<string | undefined>; /** * Before is CJS: use 'resolve' * ESM: use 'mlly' * * @param module The name of the package to resolve * @param ensure Whether to ensure the package is installed */ declare function resolveImportSync(module: string, ensure?: true): string; declare function resolveImportSync(module: string, ensure?: false): string | undefined; /** * Resolve the binary path for a package * @param module The name of the package to resolve * @param bin The name of the binary to resolve * @param ensure Whether to ensure the package is installed */ declare function resolveImportBin(module: string, bin?: string, ensure?: true): Promise<string>; declare function resolveImportBin(module: string, bin?: string, ensure?: boolean): Promise<string | undefined>; /** * Resolve the binary path for a package * @param module The name of the package to resolve * @param bin The name of the binary to resolve * @param ensure Whether to ensure the package is installed */ declare function resolveImportBinSync(module: string, bin?: string, ensure?: true): string; declare function resolveImportBinSync(module: string, bin?: string, ensure?: false): string | undefined; export { resolveImport, resolveImportBin, resolveImportBinSync, resolveImportSync };