///
export declare type TypeOptions = 'web' | 'lib';
export declare type ModeOptions = 'test' | 'development' | 'production';
export declare type LoggerLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
export declare type LoggerEvent = 'debug' | 'info' | 'warn' | 'error';
export declare enum WebEnvOptions {
STAGING = "staging",
PRT = "prt",
ONLINE = "online"
}
export declare enum ProjectType {
NPM = "npm",
RN = "rn",
WEB = "web"
}
export interface LoggerOptions {
/** (optional) change name at beginning of line */
name?: string;
/** (optional) do some additional work after logging a message, if log level is enabled */
task?: () => void;
}
export declare type AnyFunction = (...args: any[]) => any;
export interface PackageJson {
name?: string;
version?: string;
source?: string;
jest?: object;
dependencies?: {
[packageName: string]: string;
};
devDependencies?: {
[packageName: string]: string;
};
engines?: {
node?: string;
};
repository?: {
type?: string;
url?: string;
};
}
/** preview options used in preview lifecycle */
export interface PreviewOptions {
/** (optional) Port of the previewServer */
port?: number;
/** (optional) Using https when running the previewServer */
secure?: boolean;
/** (optional) Hostname of the previewServer */
hostname?: string;
/** (optional) Auto open browsers */
open?: boolean;
/** (optional) Enable cors for previewServer */
hot?: boolean;
/** (optional) AllowedHosts strategy, 'auto' | 'all' | [string] */
allowedHosts?: string | string[];
/** (optional) Headers for previewServer */
headers?: Record;
/** (optional) Define proxies in the form of a two-dimensional array, with read priority after routes */
proxy?: Record;
credentials?: {
cert: Buffer;
key: Buffer;
} | undefined;
}
/** build options used in build lifecycle */
export interface BuildOptions {
/** (optional) Build output path */
output?: Record | AnyFunction;
/** (optional) Package name */
name?: string;
/** (optional) Path to entry file */
input?: string[] | object;
/** (optional) Target format */
format?: string;
/** (optional) Extract css to single file, default is false */
extractCss?: boolean;
/** (optional) Is minifying? */
minify?: boolean;
/** (optional) Generate sourcemap */
sourcemap?: boolean;
/** (optional) Webpack extensions array */
extensions?: string[];
/** (optional) Extra webpack html filename used in html plugin */
extraHtmlFilename?: string;
}
export declare interface KwaiConfig {
/** (optional) Application type, values are web or lib */
type?: TypeOptions;
/** (optional) Log level, default is 'info' */
logLevel?: LoggerLevel;
/** (optional) browserslist config for babel */
browserslist?: string[];
/** (optional) Represent the real run environment */
env?: WebEnvOptions;
/** (optional) Represent the real run environment */
mode?: ModeOptions;
/** (optional) Mount local directories to custom URLs in your built application. */
/** (optional) Configure import aliases for directories and packages. */
alias?: Record;
/** (optional) Files that will not be resolved, support glob pattern. */
externals?: Record;
/** (optional) Kinds of plugins. */
plugins?: {
/** (optional) Enable Babel plugins and their options for pre and build. */
babel?: (string | [string, unknown])[];
/** (optional) Enable Webpack plugins and their options for pre and build. */
webpack?: (string | [string, unknown])[];
};
/** (optional) Kinds of loaders. */
loaders?: {
less?: Record;
sass?: Record;
css?: Record;
style?: Record;
postcss?: Record;
url?: Record;
};
previewOptions?: PreviewOptions;
buildOptions?: BuildOptions;
}