webpack-cli

  • Version 5.1.4
  • Published
  • 110 kB
  • 13 dependencies
  • MIT license

Install

npm i webpack-cli
yarn add webpack-cli
pnpm add webpack-cli

Overview

CLI for webpack & friends

Index

Interfaces

Type Aliases

Interfaces

interface Argv

interface Argv extends Record<string, any> {}

    property env

    env?: Env;

      interface BasicPackageJsonContent

      interface BasicPackageJsonContent {}

        property description

        description: string;

          property license

          license: string;

            property name

            name: string;

              property version

              version: string;

                interface CLIPluginOptions

                interface CLIPluginOptions {}
                • Plugins and util types

                property analyze

                analyze?: boolean;

                  property configPath

                  configPath?: string[];

                    property helpfulOutput

                    helpfulOutput: boolean;

                      property hot

                      hot?: boolean | 'only';

                        property isMultiCompiler

                        isMultiCompiler?: boolean;

                          property prefetch

                          prefetch?: string;

                            property progress

                            progress?: boolean | 'profile';

                              interface ImportLoaderError

                              interface ImportLoaderError extends Error {}

                                property code

                                code?: string;

                                  interface IWebpackCLI

                                  interface IWebpackCLI {}
                                  • Webpack CLI

                                  property builtInOptionsCache

                                  builtInOptionsCache: WebpackCLIBuiltInOption[] | undefined;

                                    property capitalizeFirstLetter

                                    capitalizeFirstLetter: StringFormatter;

                                      property colors

                                      colors: WebpackCLIColors;

                                        property isColorSupportChanged

                                        isColorSupportChanged: boolean | undefined;

                                          property logger

                                          logger: WebpackCLILogger;

                                            property program

                                            program: WebpackCLICommand;

                                              property toKebabCase

                                              toKebabCase: StringFormatter;

                                                property webpack

                                                webpack: typeof webpack;

                                                  method buildConfig

                                                  buildConfig: (
                                                  config: WebpackCLIConfig,
                                                  options: WebpackDevServerOptions
                                                  ) => Promise<WebpackCLIConfig>;

                                                    method checkPackageExists

                                                    checkPackageExists: (packageName: string) => boolean;

                                                      method createColors

                                                      createColors: (useColors?: boolean) => WebpackCLIColors;

                                                        method createCompiler

                                                        createCompiler: (
                                                        options: Partial<WebpackDevServerOptions>,
                                                        callback?: Callback<[Error | undefined, WebpackCLIStats | undefined]>
                                                        ) => Promise<WebpackCompiler>;

                                                          method doInstall

                                                          doInstall: (
                                                          packageName: string,
                                                          options?: PackageInstallOptions
                                                          ) => Promise<string>;

                                                            method getAvailablePackageManagers

                                                            getAvailablePackageManagers: () => PackageManager[];

                                                              method getBuiltInOptions

                                                              getBuiltInOptions: () => WebpackCLIBuiltInOption[];

                                                                method getDefaultPackageManager

                                                                getDefaultPackageManager: () => PackageManager | undefined;

                                                                  method getInfoOptions

                                                                  getInfoOptions: () => WebpackCLIBuiltInOption[];

                                                                    method getInfoOutput

                                                                    getInfoOutput: (options: {
                                                                    output: string;
                                                                    additionalPackage: string[];
                                                                    }) => Promise<string>;

                                                                      method getLogger

                                                                      getLogger: () => WebpackCLILogger;

                                                                        method isFunction

                                                                        isFunction: (value: unknown) => value is CallableFunction;

                                                                          method isMultipleCompiler

                                                                          isMultipleCompiler: (compiler: WebpackCompiler) => compiler is MultiCompiler;

                                                                            method isPromise

                                                                            isPromise: <T>(value: Promise<T>) => value is Promise<T>;

                                                                              method isValidationError

                                                                              isValidationError: (error: Error) => error is WebpackError;

                                                                                method loadConfig

                                                                                loadConfig: (
                                                                                options: Partial<WebpackDevServerOptions>
                                                                                ) => Promise<WebpackCLIConfig>;

                                                                                  method loadJSONFile

                                                                                  loadJSONFile: <T = unknown>(path: Path, handleError: boolean) => Promise<T>;

                                                                                    method loadWebpack

                                                                                    loadWebpack: (handleError?: boolean) => Promise<typeof webpack>;

                                                                                      method makeCommand

                                                                                      makeCommand: (
                                                                                      commandOptions: WebpackCLIOptions,
                                                                                      options: WebpackCLICommandOptions,
                                                                                      action: CommandAction
                                                                                      ) => Promise<WebpackCLICommand | undefined>;

                                                                                        method makeOption

                                                                                        makeOption: (
                                                                                        command: WebpackCLICommand,
                                                                                        option: WebpackCLIBuiltInOption
                                                                                        ) => void;

                                                                                          method needWatchStdin

                                                                                          needWatchStdin: (compiler: Compiler | MultiCompiler) => boolean;

                                                                                            method run

                                                                                            run: (
                                                                                            args: Parameters<WebpackCLICommand['parseOptions']>[0],
                                                                                            parseOptions?: ParseOptions
                                                                                            ) => Promise<void>;

                                                                                              method runWebpack

                                                                                              runWebpack: (
                                                                                              options: WebpackRunOptions,
                                                                                              isWatchCommand: boolean
                                                                                              ) => Promise<void>;

                                                                                                method tryRequireThenImport

                                                                                                tryRequireThenImport: <T = unknown>(
                                                                                                module: ModuleName,
                                                                                                handleError: boolean
                                                                                                ) => Promise<T>;

                                                                                                  interface JsonExt

                                                                                                  interface JsonExt {}

                                                                                                    property stringifyStream

                                                                                                    stringifyStream: typeof stringifyStream;

                                                                                                      interface PackageInstallOptions

                                                                                                      interface PackageInstallOptions {}

                                                                                                        property preMessage

                                                                                                        preMessage?: () => void;

                                                                                                          interface PromptOptions

                                                                                                          interface PromptOptions {}

                                                                                                            property defaultResponse

                                                                                                            defaultResponse: string;

                                                                                                              property message

                                                                                                              message: string;

                                                                                                                property stream

                                                                                                                stream: NodeJS.WritableStream;

                                                                                                                  interface Rechoir

                                                                                                                  interface Rechoir {}

                                                                                                                    property prepare

                                                                                                                    prepare: typeof prepare;

                                                                                                                      interface RechoirError

                                                                                                                      interface RechoirError extends Error {}

                                                                                                                        property error

                                                                                                                        error: Error;

                                                                                                                          property failures

                                                                                                                          failures: RechoirError[];

                                                                                                                            interface WebpackCLIBuiltInFlag

                                                                                                                            interface WebpackCLIBuiltInFlag {}

                                                                                                                              property alias

                                                                                                                              alias?: string;

                                                                                                                                property configs

                                                                                                                                configs?: Partial<FlagConfig>[];

                                                                                                                                  property defaultValue

                                                                                                                                  defaultValue?: string;

                                                                                                                                    property describe

                                                                                                                                    describe?: string;

                                                                                                                                      property description

                                                                                                                                      description: string;

                                                                                                                                        property helpLevel

                                                                                                                                        helpLevel: 'minimum' | 'verbose';

                                                                                                                                          property multiple

                                                                                                                                          multiple?: boolean;

                                                                                                                                            property name

                                                                                                                                            name: string;

                                                                                                                                              property negatedDescription

                                                                                                                                              negatedDescription?: string;

                                                                                                                                                property negative

                                                                                                                                                negative?: boolean;

                                                                                                                                                  property type

                                                                                                                                                  type?: (
                                                                                                                                                  value: string,
                                                                                                                                                  previous: Record<string, BasicPrimitive | object>
                                                                                                                                                  ) => Record<string, BasicPrimitive | object>;

                                                                                                                                                    property valueName

                                                                                                                                                    valueName?: string;

                                                                                                                                                      interface WebpackCLIBuiltInOption

                                                                                                                                                      interface WebpackCLIBuiltInOption extends WebpackCLIBuiltInFlag {}

                                                                                                                                                        property group

                                                                                                                                                        group?: 'core';

                                                                                                                                                          property hidden

                                                                                                                                                          hidden?: boolean;

                                                                                                                                                            interface WebpackCLIColors

                                                                                                                                                            interface WebpackCLIColors extends Colorette {}

                                                                                                                                                              property isColorSupported

                                                                                                                                                              isColorSupported: boolean;

                                                                                                                                                                interface WebpackCLICommand

                                                                                                                                                                interface WebpackCLICommand extends Command {}

                                                                                                                                                                  property forHelp

                                                                                                                                                                  forHelp: boolean | undefined;

                                                                                                                                                                    property pkg

                                                                                                                                                                    pkg: string | undefined;

                                                                                                                                                                      interface WebpackCLICommandOption

                                                                                                                                                                      interface WebpackCLICommandOption extends CommanderOption {}

                                                                                                                                                                        property helpLevel

                                                                                                                                                                        helpLevel?: 'minimum' | 'verbose';

                                                                                                                                                                          interface WebpackCLIConfig

                                                                                                                                                                          interface WebpackCLIConfig {}

                                                                                                                                                                            property options

                                                                                                                                                                            options: WebpackConfiguration | WebpackConfiguration[];

                                                                                                                                                                              property path

                                                                                                                                                                              path: WeakMap<object, string[]>;

                                                                                                                                                                                interface WebpackCLILogger

                                                                                                                                                                                interface WebpackCLILogger {}

                                                                                                                                                                                  property error

                                                                                                                                                                                  error: LogHandler;

                                                                                                                                                                                    property info

                                                                                                                                                                                    info: LogHandler;

                                                                                                                                                                                      property log

                                                                                                                                                                                      log: LogHandler;

                                                                                                                                                                                        property raw

                                                                                                                                                                                        raw: LogHandler;

                                                                                                                                                                                          property success

                                                                                                                                                                                          success: LogHandler;

                                                                                                                                                                                            property warn

                                                                                                                                                                                            warn: LogHandler;

                                                                                                                                                                                              interface WebpackCLIOptions

                                                                                                                                                                                              interface WebpackCLIOptions extends CommandOptions {}

                                                                                                                                                                                                property alias

                                                                                                                                                                                                alias: string | string[];

                                                                                                                                                                                                  property argsDescription

                                                                                                                                                                                                  argsDescription?: {
                                                                                                                                                                                                  [argName: string]: string;
                                                                                                                                                                                                  };

                                                                                                                                                                                                    property dependencies

                                                                                                                                                                                                    dependencies?: string[];

                                                                                                                                                                                                      property description

                                                                                                                                                                                                      description?: string;

                                                                                                                                                                                                        property name

                                                                                                                                                                                                        name: string;

                                                                                                                                                                                                          property pkg

                                                                                                                                                                                                          pkg?: string;

                                                                                                                                                                                                            property usage

                                                                                                                                                                                                            usage?: string;

                                                                                                                                                                                                              interface WebpackCLIStats

                                                                                                                                                                                                              interface WebpackCLIStats extends Stats {}

                                                                                                                                                                                                                property presetToOptions

                                                                                                                                                                                                                presetToOptions?: (item: string | boolean) => StatsOptions;

                                                                                                                                                                                                                  interface WebpackRunOptions

                                                                                                                                                                                                                  interface WebpackRunOptions extends WebpackOptionsNormalized {}

                                                                                                                                                                                                                    property argv

                                                                                                                                                                                                                    argv?: Argv;

                                                                                                                                                                                                                      property env

                                                                                                                                                                                                                      env: Env;

                                                                                                                                                                                                                        property failOnWarnings

                                                                                                                                                                                                                        failOnWarnings?: boolean;

                                                                                                                                                                                                                          property isWatchingLikeCommand

                                                                                                                                                                                                                          isWatchingLikeCommand?: boolean;

                                                                                                                                                                                                                            property json

                                                                                                                                                                                                                            json?: boolean;

                                                                                                                                                                                                                              property progress

                                                                                                                                                                                                                              progress?: boolean | 'profile';

                                                                                                                                                                                                                                Type Aliases

                                                                                                                                                                                                                                type BasicPrimitive

                                                                                                                                                                                                                                type BasicPrimitive = string | boolean | number;

                                                                                                                                                                                                                                  type CallableOption

                                                                                                                                                                                                                                  type CallableOption = (env: Env | undefined, argv: Argv) => WebpackConfiguration;

                                                                                                                                                                                                                                    type Callback

                                                                                                                                                                                                                                    type Callback<T extends unknown[]> = (...args: T) => void;

                                                                                                                                                                                                                                      type CommandAction

                                                                                                                                                                                                                                      type CommandAction = Parameters<WebpackCLICommand['action']>[0];

                                                                                                                                                                                                                                        type CommanderOption

                                                                                                                                                                                                                                        type CommanderOption = InstanceType<OptionConstructor>;

                                                                                                                                                                                                                                          type ConfigOptions

                                                                                                                                                                                                                                          type ConfigOptions = PotentialPromise<WebpackConfiguration | CallableOption>;

                                                                                                                                                                                                                                            type DynamicImport

                                                                                                                                                                                                                                            type DynamicImport<T> = (url: string) => Promise<{
                                                                                                                                                                                                                                            default: T;
                                                                                                                                                                                                                                            }>;

                                                                                                                                                                                                                                              type FileSystemCacheOptions

                                                                                                                                                                                                                                              type FileSystemCacheOptions = WebpackConfiguration & {
                                                                                                                                                                                                                                              cache: FileCacheOptions & {
                                                                                                                                                                                                                                              defaultConfig: string[];
                                                                                                                                                                                                                                              };
                                                                                                                                                                                                                                              };

                                                                                                                                                                                                                                                type FlagConfig

                                                                                                                                                                                                                                                type FlagConfig = {
                                                                                                                                                                                                                                                negatedDescription: string;
                                                                                                                                                                                                                                                type: FlagType;
                                                                                                                                                                                                                                                values: FlagType[];
                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                  type Instantiable

                                                                                                                                                                                                                                                  type Instantiable<
                                                                                                                                                                                                                                                  InstanceType = unknown,
                                                                                                                                                                                                                                                  ConstructorParameters extends unknown[] = unknown[]
                                                                                                                                                                                                                                                  > = {
                                                                                                                                                                                                                                                  new (...args: ConstructorParameters): InstanceType;
                                                                                                                                                                                                                                                  };

                                                                                                                                                                                                                                                    type ModuleName

                                                                                                                                                                                                                                                    type ModuleName = string;

                                                                                                                                                                                                                                                      type PackageManager

                                                                                                                                                                                                                                                      type PackageManager = 'pnpm' | 'yarn' | 'npm';
                                                                                                                                                                                                                                                      • Package management

                                                                                                                                                                                                                                                      type Path

                                                                                                                                                                                                                                                      type Path = string;

                                                                                                                                                                                                                                                        type PotentialPromise

                                                                                                                                                                                                                                                        type PotentialPromise<T> = T | Promise<T>;

                                                                                                                                                                                                                                                          type ProcessedArguments

                                                                                                                                                                                                                                                          type ProcessedArguments = Record<
                                                                                                                                                                                                                                                          string,
                                                                                                                                                                                                                                                          BasicPrimitive | RegExp | (BasicPrimitive | RegExp)[]
                                                                                                                                                                                                                                                          >;

                                                                                                                                                                                                                                                            type WebpackCLICommandOptions

                                                                                                                                                                                                                                                            type WebpackCLICommandOptions =
                                                                                                                                                                                                                                                            | WebpackCLIBuiltInOption[]
                                                                                                                                                                                                                                                            | (() => Promise<WebpackCLIBuiltInOption[]>);

                                                                                                                                                                                                                                                              type WebpackCLIExternalCommandInfo

                                                                                                                                                                                                                                                              type WebpackCLIExternalCommandInfo = Pick<
                                                                                                                                                                                                                                                              WebpackCLIOptions,
                                                                                                                                                                                                                                                              'name' | 'alias' | 'description'
                                                                                                                                                                                                                                                              > & {
                                                                                                                                                                                                                                                              pkg: string;
                                                                                                                                                                                                                                                              };

                                                                                                                                                                                                                                                                type WebpackCLIMainOption

                                                                                                                                                                                                                                                                type WebpackCLIMainOption = Pick<
                                                                                                                                                                                                                                                                WebpackCLIBuiltInOption,
                                                                                                                                                                                                                                                                'valueName' | 'description' | 'defaultValue' | 'multiple'
                                                                                                                                                                                                                                                                > & {
                                                                                                                                                                                                                                                                flags: string;
                                                                                                                                                                                                                                                                type: Set<BooleanConstructor | StringConstructor | NumberConstructor>;
                                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                                  type WebpackCompiler

                                                                                                                                                                                                                                                                  type WebpackCompiler = Compiler | MultiCompiler;

                                                                                                                                                                                                                                                                    type WebpackConfiguration

                                                                                                                                                                                                                                                                    type WebpackConfiguration = Configuration;
                                                                                                                                                                                                                                                                    • Webpack

                                                                                                                                                                                                                                                                    type WebpackDevServerOptions

                                                                                                                                                                                                                                                                    type WebpackDevServerOptions = DevServerConfig &
                                                                                                                                                                                                                                                                    WebpackConfiguration &
                                                                                                                                                                                                                                                                    ClientConfiguration &
                                                                                                                                                                                                                                                                    AssetEmittedInfo &
                                                                                                                                                                                                                                                                    WebpackOptionsNormalized &
                                                                                                                                                                                                                                                                    FileCacheOptions &
                                                                                                                                                                                                                                                                    Argv & {
                                                                                                                                                                                                                                                                    nodeEnv?: 'string';
                                                                                                                                                                                                                                                                    watchOptionsStdin?: boolean;
                                                                                                                                                                                                                                                                    progress?: boolean | 'profile' | undefined;
                                                                                                                                                                                                                                                                    analyze?: boolean;
                                                                                                                                                                                                                                                                    prefetch?: string;
                                                                                                                                                                                                                                                                    json?: boolean;
                                                                                                                                                                                                                                                                    entry: EntryOptions;
                                                                                                                                                                                                                                                                    merge?: boolean;
                                                                                                                                                                                                                                                                    config: string[];
                                                                                                                                                                                                                                                                    configName?: string[];
                                                                                                                                                                                                                                                                    disableInterpret?: boolean;
                                                                                                                                                                                                                                                                    extends?: string[];
                                                                                                                                                                                                                                                                    argv: Argv;
                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                    • Webpack dev server

                                                                                                                                                                                                                                                                    Package Files (2)

                                                                                                                                                                                                                                                                    Dependencies (13)

                                                                                                                                                                                                                                                                    Dev Dependencies (1)

                                                                                                                                                                                                                                                                    Peer Dependencies (1)

                                                                                                                                                                                                                                                                    Badge

                                                                                                                                                                                                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/webpack-cli.

                                                                                                                                                                                                                                                                    • Markdown
                                                                                                                                                                                                                                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/webpack-cli)
                                                                                                                                                                                                                                                                    • HTML
                                                                                                                                                                                                                                                                      <a href="https://www.jsdocs.io/package/webpack-cli"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>