UNPKG

@growing-web/web-builder-kit

Version:

@growing-web/web-builder-kit for Growing Web Guidelines.

93 lines (78 loc) 3.88 kB
import { Logger, FrameworkType, WebBuilder, PluginOptions, Symlink, ManifestServerProxy } from '@growing-web/web-builder-types'; import { LogLevel } from 'consola'; import { PackageJson } from 'pkg-types'; import * as unctx from 'unctx'; export { default as colors } from 'picocolors'; export { default as fs } from 'fs-extra'; import * as pathe from 'pathe'; export { pathe as path }; export { defu as merge } from 'defu'; export { default as semver } from 'semver'; export { default as minimatch } from 'minimatch'; export { get, isFunction, isObject, isString, isUndefined, union } from 'lodash-es'; import { UnpluginInstance } from 'unplugin'; import { ProxyOptions } from 'vite'; export { default as clear } from 'clear'; declare function createLogger(logLevel?: LogLevel, { allowClearScreen }?: { allowClearScreen?: boolean; }): Logger; declare function readPackageJSON(cwd?: string): Promise<PackageJson>; declare function getDeps(cwd?: string): Promise<{ keys: string[]; deps: { [x: string]: string; }; }>; /** * Analyze project framework type */ declare function loadFrameworkTypeAndVersion(cwd?: string): Promise<{ framework: FrameworkType; version: number | string; }>; declare const webBuilderCtx: unctx.UseContext<WebBuilder>; declare const useWebBuilder: () => WebBuilder; declare type NpmClientType = 'npm' | 'pnpm' | 'yarn'; interface NpmInstallOptions { monorepoRoot?: boolean; dev?: boolean; packageName: string; global?: boolean; client?: NpmClientType; } declare function getNpmLatestVersion(name: string): Promise<string>; declare function getNpmPackageManager(rootDir?: string): "npm" | "pnpm" | "yarn" | null; declare function createNpmInstallMessage({ dev, monorepoRoot, packageName, global, client, }: NpmInstallOptions): string; /** * web builder version update check notification */ declare function npmUpdateNotify({ name, version, }: { name: string; version: string; }): void; declare function canUseNpmPackageManager(packageManager: 'npm' | 'pnpm' | 'yarn'): boolean; declare function checkNodeEngines(engines: { node: string; }): Promise<void>; declare function isLerna(root: string): boolean; declare function isYarnWorkspace(root: string): boolean; declare function isPnpmWorkspace(root: string): boolean; declare function isMonorepo(root: string): boolean; declare function findMonorepoRoot(root: string): Promise<string | null>; declare function findWorkspacePackages(root: string): Promise<string[]>; declare function jsoncParse(data: string): any; declare function JSONReader(filename: string, silent?: boolean): Record<string, any>; declare function arraify<T>(target: T | T[]): T[]; declare function tryResolvePaths(paths: string[]): string | undefined; declare function findup<T>(rootDir: string, fn: (dir: string) => T | undefined): T | null; declare function lookupFile(dir: string, formats: string[], pathOnly?: boolean): string | undefined; declare function createPlugins<UserOptions = any>(fn: (options: any) => PluginOptions): UnpluginInstance<UserOptions>; declare function createSymlink(src: string, dest: string, type: Symlink): Promise<void>; /** * resolve field parsing * @param proxyList * @returns */ declare function resolveProxy(proxyList?: ManifestServerProxy[]): Record<string, ProxyOptions>; declare function persistencePort(port: number): Promise<void>; export { JSONReader, NpmClientType, arraify, canUseNpmPackageManager, checkNodeEngines, createLogger, createNpmInstallMessage, createPlugins, createSymlink, findMonorepoRoot, findWorkspacePackages, findup, getDeps, getNpmLatestVersion, getNpmPackageManager, isLerna, isMonorepo, isPnpmWorkspace, isYarnWorkspace, jsoncParse, loadFrameworkTypeAndVersion, lookupFile, npmUpdateNotify, persistencePort, readPackageJSON, resolveProxy, tryResolvePaths, useWebBuilder, webBuilderCtx };