copy-webpack-plugin

  • Version 13.0.1
  • Published
  • 82.4 kB
  • 5 dependencies
  • MIT license

Install

npm i copy-webpack-plugin
yarn add copy-webpack-plugin
pnpm add copy-webpack-plugin

Overview

Copy files && directories with webpack

Index

Classes

class CopyPlugin

class CopyPlugin {}

    constructor

    constructor(options?: PluginOptions);
    • Parameter options

      options for the plugin

    method apply

    apply: (compiler: any) => void;
    • Parameter compiler

      the compiler

    Type Aliases

    type AdditionalOptions

    type AdditionalOptions = {
    /**
    * maximum number of concurrent operations, default is 100
    */
    concurrency?: number | undefined;
    };

      type Asset

      type Asset = import('webpack').Asset;

        type AssetInfo

        type AssetInfo = import('webpack').AssetInfo;

          type CacheFacade

          type CacheFacade = ReturnType<Compilation['getCache']>;

            type Compilation

            type Compilation = import('webpack').Compilation;

              type Compiler

              type Compiler = import('webpack').Compiler;

                type Context

                type Context = string;

                  type CopiedResult

                  type CopiedResult = {
                  /**
                  * relative path to the file from the context
                  */
                  sourceFilename: string;
                  /**
                  * absolute path to the file
                  */
                  absoluteFilename: string;
                  /**
                  * relative path to the file from the output path
                  */
                  filename: string;
                  /**
                  * source of the file
                  */
                  source: Asset['source'];
                  /**
                  * whether to force update the asset if it already exists
                  */
                  force: Force | undefined;
                  /**
                  * additional information about the asset
                  */
                  info: Record<string, unknown>;
                  };

                    type Etag

                    type Etag = ReturnType<ReturnType<Compilation['getCache']>['getLazyHashedEtag']>;

                      type Filter

                      type Filter = (filepath: string) => boolean | Promise<boolean>;

                        type Force

                        type Force = boolean;

                          type From

                          type From = string;

                            type GlobbyOptions

                            type GlobbyOptions = import('tinyglobby').GlobOptions;

                              type Info

                              type Info =
                              | Record<string, unknown>
                              | ((item: {
                              absoluteFilename: string;
                              sourceFilename: string;
                              filename: string;
                              toType: ToType;
                              }) => Record<string, unknown>);

                                type InputFileSystem

                                type InputFileSystem = import('webpack').InputFileSystem;

                                  type NoErrorOnMissing

                                  type NoErrorOnMissing = boolean;

                                    type ObjectPattern

                                    type ObjectPattern = {
                                    /**
                                    * source path or glob pattern to copy files from
                                    */
                                    from: From;
                                    /**
                                    * options for globbing
                                    */
                                    globOptions?: GlobbyOptions | undefined;
                                    /**
                                    * context for the source path or glob pattern
                                    */
                                    context?: Context | undefined;
                                    /**
                                    * destination path or function to determine the destination path
                                    */
                                    to?: To | undefined;
                                    /**
                                    * type of the destination path, can be "dir", "file" or "template"
                                    */
                                    toType?: ToType | undefined;
                                    /**
                                    * additional information about the asset
                                    */
                                    info?: Info | undefined;
                                    /**
                                    * function to filter files, if it returns false, the file will be skipped
                                    */
                                    filter?: Filter | undefined;
                                    /**
                                    * function to transform the file content, can be a function or an object with a transformer function and cache options
                                    */
                                    transform?: Transform | undefined;
                                    /**
                                    * function to transform all files, it receives an array of objects with data, sourceFilename and absoluteFilename properties
                                    */
                                    transformAll?: TransformAllFunction | undefined;
                                    /**
                                    * whether to force update the asset if it already exists
                                    */
                                    force?: Force | undefined;
                                    /**
                                    * priority of the pattern, patterns with higher priority will be processed first
                                    */
                                    priority?: number | undefined;
                                    /**
                                    * whether to skip errors when no files are found for the pattern
                                    */
                                    noErrorOnMissing?: NoErrorOnMissing | undefined;
                                    };

                                      type Pattern

                                      type Pattern = StringPattern | ObjectPattern;

                                        type PluginOptions

                                        type PluginOptions = {
                                        /**
                                        * array of patterns to copy files from
                                        */
                                        patterns: Pattern[];
                                        /**
                                        * additional options for the plugin
                                        */
                                        options?: AdditionalOptions | undefined;
                                        };

                                          type Schema

                                          type Schema = import('schema-utils/declarations/validate').Schema;

                                            type Snapshot

                                            type Snapshot = ReturnType<Compilation['fileSystemInfo']['mergeSnapshots']>;

                                              type StringPattern

                                              type StringPattern = string;

                                                type To

                                                type To = string | ToFunction;

                                                  type ToFunction

                                                  type ToFunction = (pathData: {
                                                  context: string;
                                                  absoluteFilename?: string;
                                                  }) => string | Promise<string>;

                                                    type ToType

                                                    type ToType = 'dir' | 'file' | 'template';

                                                      type Transform

                                                      type Transform = TransformerFunction | TransformerObject;

                                                        type TransformAllFunction

                                                        type TransformAllFunction = (
                                                        data: {
                                                        data: Buffer;
                                                        sourceFilename: string;
                                                        absoluteFilename: string;
                                                        }[]
                                                        ) => string | Buffer | Promise<string> | Promise<Buffer>;

                                                          type TransformerCacheObject

                                                          type TransformerCacheObject =
                                                          | {
                                                          keys: {
                                                          [key: string]: unknown;
                                                          };
                                                          }
                                                          | {
                                                          keys: (
                                                          defaultCacheKeys: {
                                                          [key: string]: unknown;
                                                          },
                                                          absoluteFilename: string
                                                          ) => Promise<{
                                                          [key: string]: unknown;
                                                          }>;
                                                          };

                                                            type TransformerFunction

                                                            type TransformerFunction = (
                                                            input: Buffer,
                                                            absoluteFilename: string
                                                            ) => string | Buffer | Promise<string> | Promise<Buffer>;

                                                              type TransformerObject

                                                              type TransformerObject = {
                                                              /**
                                                              * function to transform the file content
                                                              */
                                                              transformer: TransformerFunction;
                                                              /**
                                                              * whether to cache the transformed content or an object with keys for caching
                                                              */
                                                              cache?: (boolean | TransformerCacheObject) | undefined;
                                                              };

                                                                type WebpackLogger

                                                                type WebpackLogger = ReturnType<Compilation['getLogger']>;

                                                                  Package Files (1)

                                                                  Dependencies (5)

                                                                  Dev Dependencies (40)

                                                                  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/copy-webpack-plugin.

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