@gluons/vue-pack-copy-plugin
Version:
A vue-pack plugin to copy files or directories to build directory.
93 lines (92 loc) • 2.21 kB
TypeScript
import { Plugin } from '@gluons/vue-pack';
import { IOptions } from 'minimatch';
/**
* Minimatch Glob.
*
* @export
* @interface MinimatchGlob
* @extends {IOptions}
*/
export interface MinimatchGlob extends IOptions {
/**
* Glob pattern
*
* @type {string}
* @memberof MinimatchGlob
*/
glob: string;
}
/**
* Pattern for `copy-webpack-plugin`.
*
* @export
* @interface Pattern
*/
export interface Pattern {
/**
* Globs of files/directories to copy from
*
* @type {(string | MinimatchGlob)}
* @memberof Pattern
*/
from: string | MinimatchGlob;
/**
* Output path of copied files/directories
*
* @type {string}
* @memberof Pattern
*/
to?: string;
/**
* Type of `to` option
*
* @type {('dir' | 'file' | 'template')}
* @memberof Pattern
*/
toType?: 'dir' | 'file' | 'template';
/**
* Pattern for extracting elements to be used in `to` templates
*
* @type {RegExp}
* @memberof Pattern
*/
test?: RegExp;
/**
* Overwrite files if already exist
*
* @type {boolean}
* @default false
* @memberof Pattern
*/
force?: boolean;
/**
* Globs to ignore for this pattern
*
* @type {(string | MinimatchGlob)[]}
* @default []
* @memberof Pattern
*/
ignore?: (string | MinimatchGlob)[];
/**
* Function that modify file content before copying
*
* @type {(content: string, path: string) => string | Promise<string>}
* @memberof Pattern
*/
transform?: (content: string, path: string) => string | Promise<string>;
/**
* A path that determine how to interpret the `from` path
*
* @type {string}
* @memberof Pattern
*/
context?: string;
}
/**
* A `vue-pack` plugin to copy files or directories to build directory via `copy-webpack-plugin`.
*
* @export
* @param {(string | Pattern)[]} patterns `copy-webpack-plugin`'s patterns
* @returns {Plugin}
*/
export default function CopyPlugin(patterns: (string | Pattern)[]): Plugin;