Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
20
my-app/node_modules/copy-webpack-plugin/LICENSE
generated
vendored
Executable file
20
my-app/node_modules/copy-webpack-plugin/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
Copyright JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1317
my-app/node_modules/copy-webpack-plugin/README.md
generated
vendored
Executable file
1317
my-app/node_modules/copy-webpack-plugin/README.md
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
931
my-app/node_modules/copy-webpack-plugin/dist/index.js
generated
vendored
Executable file
931
my-app/node_modules/copy-webpack-plugin/dist/index.js
generated
vendored
Executable file
|
@ -0,0 +1,931 @@
|
|||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
|
||||
const {
|
||||
validate
|
||||
} = require("schema-utils");
|
||||
|
||||
const serialize = require("serialize-javascript");
|
||||
|
||||
const normalizePath = require("normalize-path");
|
||||
|
||||
const globParent = require("glob-parent");
|
||||
|
||||
const fastGlob = require("fast-glob"); // @ts-ignore
|
||||
|
||||
|
||||
const {
|
||||
version
|
||||
} = require("../package.json");
|
||||
|
||||
const schema = require("./options.json");
|
||||
|
||||
const {
|
||||
readFile,
|
||||
stat,
|
||||
throttleAll
|
||||
} = require("./utils");
|
||||
|
||||
const template = /\[\\*([\w:]+)\\*\]/i;
|
||||
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
|
||||
|
||||
/** @typedef {import("webpack").Compiler} Compiler */
|
||||
|
||||
/** @typedef {import("webpack").Compilation} Compilation */
|
||||
|
||||
/** @typedef {import("webpack").WebpackError} WebpackError */
|
||||
|
||||
/** @typedef {import("webpack").Asset} Asset */
|
||||
|
||||
/** @typedef {import("globby").Options} GlobbyOptions */
|
||||
|
||||
/** @typedef {import("globby").GlobEntry} GlobEntry */
|
||||
|
||||
/** @typedef {ReturnType<Compilation["getLogger"]>} WebpackLogger */
|
||||
|
||||
/** @typedef {ReturnType<Compilation["getCache"]>} CacheFacade */
|
||||
|
||||
/** @typedef {ReturnType<ReturnType<Compilation["getCache"]>["getLazyHashedEtag"]>} Etag */
|
||||
|
||||
/** @typedef {ReturnType<Compilation["fileSystemInfo"]["mergeSnapshots"]>} Snapshot */
|
||||
|
||||
/**
|
||||
* @typedef {boolean} Force
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} CopiedResult
|
||||
* @property {string} sourceFilename
|
||||
* @property {string} absoluteFilename
|
||||
* @property {string} filename
|
||||
* @property {Asset["source"]} source
|
||||
* @property {Force | undefined} force
|
||||
* @property {Record<string, any>} info
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {string} StringPattern
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {boolean} NoErrorOnMissing
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {string} Context
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {string} From
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback ToFunction
|
||||
* @param {{ context: string, absoluteFilename?: string }} pathData
|
||||
* @return {string | Promise<string>}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {string | ToFunction} To
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {"dir" | "file" | "template"} ToType
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback TransformerFunction
|
||||
* @param {Buffer} input
|
||||
* @param {string} absoluteFilename
|
||||
* @returns {string | Buffer | Promise<string> | Promise<Buffer>}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {{ keys: { [key: string]: any } } | { keys: ((defaultCacheKeys: { [key: string]: any }, absoluteFilename: string) => Promise<{ [key: string]: any }>) }} TransformerCacheObject
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} TransformerObject
|
||||
* @property {TransformerFunction} transformer
|
||||
* @property {boolean | TransformerCacheObject} [cache]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {TransformerFunction | TransformerObject} Transform
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback Filter
|
||||
* @param {string} filepath
|
||||
* @returns {boolean | Promise<boolean>}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback TransformAllFunction
|
||||
* @param {{ data: Buffer, sourceFilename: string, absoluteFilename: string }[]} data
|
||||
* @returns {string | Buffer | Promise<string> | Promise<Buffer>}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef { Record<string, any> | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => Record<string, any>) } Info
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ObjectPattern
|
||||
* @property {From} from
|
||||
* @property {GlobbyOptions} [globOptions]
|
||||
* @property {Context} [context]
|
||||
* @property {To} [to]
|
||||
* @property {ToType} [toType]
|
||||
* @property {Info} [info]
|
||||
* @property {Filter} [filter]
|
||||
* @property {Transform} [transform]
|
||||
* @property {TransformAllFunction} [transformAll]
|
||||
* @property {Force} [force]
|
||||
* @property {number} [priority]
|
||||
* @property {NoErrorOnMissing} [noErrorOnMissing]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {StringPattern | ObjectPattern} Pattern
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} AdditionalOptions
|
||||
* @property {number} [concurrency]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} PluginOptions
|
||||
* @property {Pattern[]} patterns
|
||||
* @property {AdditionalOptions} [options]
|
||||
*/
|
||||
|
||||
class CopyPlugin {
|
||||
/**
|
||||
* @param {PluginOptions} [options]
|
||||
*/
|
||||
constructor(options = {
|
||||
patterns: []
|
||||
}) {
|
||||
validate(
|
||||
/** @type {Schema} */
|
||||
schema, options, {
|
||||
name: "Copy Plugin",
|
||||
baseDataPath: "options"
|
||||
});
|
||||
/**
|
||||
* @private
|
||||
* @type {Pattern[]}
|
||||
*/
|
||||
|
||||
this.patterns = options.patterns;
|
||||
/**
|
||||
* @private
|
||||
* @type {AdditionalOptions}
|
||||
*/
|
||||
|
||||
this.options = options.options || {};
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @param {Compilation} compilation
|
||||
* @param {number} startTime
|
||||
* @param {string} dependency
|
||||
* @returns {Promise<Snapshot | undefined>}
|
||||
*/
|
||||
|
||||
|
||||
static async createSnapshot(compilation, startTime, dependency) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return new Promise((resolve, reject) => {
|
||||
compilation.fileSystemInfo.createSnapshot(startTime, [dependency], // @ts-ignore
|
||||
// eslint-disable-next-line no-undefined
|
||||
undefined, // eslint-disable-next-line no-undefined
|
||||
undefined, null, (error, snapshot) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(
|
||||
/** @type {Snapshot} */
|
||||
snapshot);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @param {Compilation} compilation
|
||||
* @param {Snapshot} snapshot
|
||||
* @returns {Promise<boolean | undefined>}
|
||||
*/
|
||||
|
||||
|
||||
static async checkSnapshotValid(compilation, snapshot) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return new Promise((resolve, reject) => {
|
||||
compilation.fileSystemInfo.checkSnapshotValid(snapshot, (error, isValid) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(isValid);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @param {Compiler} compiler
|
||||
* @param {Compilation} compilation
|
||||
* @param {Buffer} source
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
static getContentHash(compiler, compilation, source) {
|
||||
const {
|
||||
outputOptions
|
||||
} = compilation;
|
||||
const {
|
||||
hashDigest,
|
||||
hashDigestLength,
|
||||
hashFunction,
|
||||
hashSalt
|
||||
} = outputOptions;
|
||||
const hash = compiler.webpack.util.createHash(
|
||||
/** @type {string} */
|
||||
hashFunction);
|
||||
|
||||
if (hashSalt) {
|
||||
hash.update(hashSalt);
|
||||
}
|
||||
|
||||
hash.update(source);
|
||||
const fullContentHash = hash.digest(hashDigest);
|
||||
return fullContentHash.toString().slice(0, hashDigestLength);
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @param {typeof import("globby").globby} globby
|
||||
* @param {Compiler} compiler
|
||||
* @param {Compilation} compilation
|
||||
* @param {WebpackLogger} logger
|
||||
* @param {CacheFacade} cache
|
||||
* @param {ObjectPattern & { context: string }} inputPattern
|
||||
* @param {number} index
|
||||
* @returns {Promise<Array<CopiedResult | undefined> | undefined>}
|
||||
*/
|
||||
|
||||
|
||||
static async runPattern(globby, compiler, compilation, logger, cache, inputPattern, index) {
|
||||
const {
|
||||
RawSource
|
||||
} = compiler.webpack.sources;
|
||||
const pattern = { ...inputPattern
|
||||
};
|
||||
const originalFrom = pattern.from;
|
||||
const normalizedOriginalFrom = path.normalize(originalFrom);
|
||||
logger.log(`starting to process a pattern from '${normalizedOriginalFrom}' using '${pattern.context}' context`);
|
||||
let absoluteFrom;
|
||||
|
||||
if (path.isAbsolute(normalizedOriginalFrom)) {
|
||||
absoluteFrom = normalizedOriginalFrom;
|
||||
} else {
|
||||
absoluteFrom = path.resolve(pattern.context, normalizedOriginalFrom);
|
||||
}
|
||||
|
||||
logger.debug(`getting stats for '${absoluteFrom}'...`);
|
||||
const {
|
||||
inputFileSystem
|
||||
} = compiler;
|
||||
let stats;
|
||||
|
||||
try {
|
||||
stats = await stat(inputFileSystem, absoluteFrom);
|
||||
} catch (error) {// Nothing
|
||||
}
|
||||
/**
|
||||
* @type {"file" | "dir" | "glob"}
|
||||
*/
|
||||
|
||||
|
||||
let fromType;
|
||||
|
||||
if (stats) {
|
||||
if (stats.isDirectory()) {
|
||||
fromType = "dir";
|
||||
logger.debug(`determined '${absoluteFrom}' is a directory`);
|
||||
} else if (stats.isFile()) {
|
||||
fromType = "file";
|
||||
logger.debug(`determined '${absoluteFrom}' is a file`);
|
||||
} else {
|
||||
// Fallback
|
||||
fromType = "glob";
|
||||
logger.debug(`determined '${absoluteFrom}' is unknown`);
|
||||
}
|
||||
} else {
|
||||
fromType = "glob";
|
||||
logger.debug(`determined '${absoluteFrom}' is a glob`);
|
||||
}
|
||||
/** @type {GlobbyOptions & { objectMode: true }} */
|
||||
|
||||
|
||||
const globOptions = { ...{
|
||||
followSymbolicLinks: true
|
||||
},
|
||||
...(pattern.globOptions || {}),
|
||||
...{
|
||||
cwd: pattern.context,
|
||||
objectMode: true
|
||||
}
|
||||
}; // @ts-ignore
|
||||
|
||||
globOptions.fs = inputFileSystem;
|
||||
let glob;
|
||||
|
||||
switch (fromType) {
|
||||
case "dir":
|
||||
compilation.contextDependencies.add(absoluteFrom);
|
||||
logger.debug(`added '${absoluteFrom}' as a context dependency`);
|
||||
pattern.context = absoluteFrom;
|
||||
glob = path.posix.join(fastGlob.escapePath(normalizePath(path.resolve(absoluteFrom))), "**/*");
|
||||
absoluteFrom = path.join(absoluteFrom, "**/*");
|
||||
|
||||
if (typeof globOptions.dot === "undefined") {
|
||||
globOptions.dot = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "file":
|
||||
compilation.fileDependencies.add(absoluteFrom);
|
||||
logger.debug(`added '${absoluteFrom}' as a file dependency`);
|
||||
pattern.context = path.dirname(absoluteFrom);
|
||||
glob = fastGlob.escapePath(normalizePath(path.resolve(absoluteFrom)));
|
||||
|
||||
if (typeof globOptions.dot === "undefined") {
|
||||
globOptions.dot = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "glob":
|
||||
default:
|
||||
{
|
||||
const contextDependencies = path.normalize(globParent(absoluteFrom));
|
||||
compilation.contextDependencies.add(contextDependencies);
|
||||
logger.debug(`added '${contextDependencies}' as a context dependency`);
|
||||
glob = path.isAbsolute(originalFrom) ? originalFrom : path.posix.join(fastGlob.escapePath(normalizePath(path.resolve(pattern.context))), originalFrom);
|
||||
}
|
||||
}
|
||||
|
||||
logger.log(`begin globbing '${glob}'...`);
|
||||
/**
|
||||
* @type {GlobEntry[]}
|
||||
*/
|
||||
|
||||
let globEntries;
|
||||
|
||||
try {
|
||||
globEntries = await globby(glob, globOptions);
|
||||
} catch (error) {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (globEntries.length === 0) {
|
||||
if (pattern.noErrorOnMissing) {
|
||||
logger.log(`finished to process a pattern from '${normalizedOriginalFrom}' using '${pattern.context}' context to '${pattern.to}'`);
|
||||
return;
|
||||
}
|
||||
|
||||
const missingError = new Error(`unable to locate '${glob}' glob`);
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
missingError);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @type {Array<CopiedResult | undefined>}
|
||||
*/
|
||||
|
||||
|
||||
let copiedResult;
|
||||
|
||||
try {
|
||||
copiedResult = await Promise.all(globEntries.map(
|
||||
/**
|
||||
* @param {GlobEntry} globEntry
|
||||
* @returns {Promise<CopiedResult | undefined>}
|
||||
*/
|
||||
async globEntry => {
|
||||
// Exclude directories
|
||||
if (!globEntry.dirent.isFile()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pattern.filter) {
|
||||
let isFiltered;
|
||||
|
||||
try {
|
||||
isFiltered = await pattern.filter(globEntry.path);
|
||||
} catch (error) {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isFiltered) {
|
||||
logger.log(`skip '${globEntry.path}', because it was filtered`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const from = globEntry.path;
|
||||
logger.debug(`found '${from}'`); // `globby`/`fast-glob` return the relative path when the path contains special characters on windows
|
||||
|
||||
const absoluteFilename = path.resolve(pattern.context, from);
|
||||
const to = typeof pattern.to === "function" ? await pattern.to({
|
||||
context: pattern.context,
|
||||
absoluteFilename
|
||||
}) : path.normalize(typeof pattern.to !== "undefined" ? pattern.to : "");
|
||||
const toType = pattern.toType ? pattern.toType : template.test(to) ? "template" : path.extname(to) === "" || to.slice(-1) === path.sep ? "dir" : "file";
|
||||
logger.log(`'to' option '${to}' determinated as '${toType}'`);
|
||||
const relativeFrom = path.relative(pattern.context, absoluteFilename);
|
||||
let filename = toType === "dir" ? path.join(to, relativeFrom) : to;
|
||||
|
||||
if (path.isAbsolute(filename)) {
|
||||
filename = path.relative(
|
||||
/** @type {string} */
|
||||
compiler.options.output.path, filename);
|
||||
}
|
||||
|
||||
logger.log(`determined that '${from}' should write to '${filename}'`);
|
||||
const sourceFilename = normalizePath(path.relative(compiler.context, absoluteFilename)); // If this came from a glob or dir, add it to the file dependencies
|
||||
|
||||
if (fromType === "dir" || fromType === "glob") {
|
||||
compilation.fileDependencies.add(absoluteFilename);
|
||||
logger.debug(`added '${absoluteFilename}' as a file dependency`);
|
||||
}
|
||||
|
||||
let cacheEntry;
|
||||
logger.debug(`getting cache for '${absoluteFilename}'...`);
|
||||
|
||||
try {
|
||||
cacheEntry = await cache.getPromise(`${sourceFilename}|${index}`, null);
|
||||
} catch (error) {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @type {Asset["source"] | undefined}
|
||||
*/
|
||||
|
||||
|
||||
let source;
|
||||
|
||||
if (cacheEntry) {
|
||||
logger.debug(`found cache for '${absoluteFilename}'...`);
|
||||
let isValidSnapshot;
|
||||
logger.debug(`checking snapshot on valid for '${absoluteFilename}'...`);
|
||||
|
||||
try {
|
||||
isValidSnapshot = await CopyPlugin.checkSnapshotValid(compilation, cacheEntry.snapshot);
|
||||
} catch (error) {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isValidSnapshot) {
|
||||
logger.debug(`snapshot for '${absoluteFilename}' is valid`);
|
||||
({
|
||||
source
|
||||
} = cacheEntry);
|
||||
} else {
|
||||
logger.debug(`snapshot for '${absoluteFilename}' is invalid`);
|
||||
}
|
||||
} else {
|
||||
logger.debug(`missed cache for '${absoluteFilename}'`);
|
||||
}
|
||||
|
||||
if (!source) {
|
||||
const startTime = Date.now();
|
||||
logger.debug(`reading '${absoluteFilename}'...`);
|
||||
let data;
|
||||
|
||||
try {
|
||||
data = await readFile(inputFileSystem, absoluteFilename);
|
||||
} catch (error) {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
logger.debug(`read '${absoluteFilename}'`);
|
||||
source = new RawSource(data);
|
||||
let snapshot;
|
||||
logger.debug(`creating snapshot for '${absoluteFilename}'...`);
|
||||
|
||||
try {
|
||||
snapshot = await CopyPlugin.createSnapshot(compilation, startTime, absoluteFilename);
|
||||
} catch (error) {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (snapshot) {
|
||||
logger.debug(`created snapshot for '${absoluteFilename}'`);
|
||||
logger.debug(`storing cache for '${absoluteFilename}'...`);
|
||||
|
||||
try {
|
||||
await cache.storePromise(`${sourceFilename}|${index}`, null, {
|
||||
source,
|
||||
snapshot
|
||||
});
|
||||
} catch (error) {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
logger.debug(`stored cache for '${absoluteFilename}'`);
|
||||
}
|
||||
}
|
||||
|
||||
if (pattern.transform) {
|
||||
/**
|
||||
* @type {TransformerObject}
|
||||
*/
|
||||
const transformObj = typeof pattern.transform === "function" ? {
|
||||
transformer: pattern.transform
|
||||
} : pattern.transform;
|
||||
|
||||
if (transformObj.transformer) {
|
||||
logger.log(`transforming content for '${absoluteFilename}'...`);
|
||||
const buffer = source.buffer();
|
||||
|
||||
if (transformObj.cache) {
|
||||
// TODO: remove in the next major release
|
||||
const hasher = compiler.webpack && compiler.webpack.util && compiler.webpack.util.createHash ? compiler.webpack.util.createHash("xxhash64") : // eslint-disable-next-line global-require
|
||||
require("crypto").createHash("md4");
|
||||
const defaultCacheKeys = {
|
||||
version,
|
||||
sourceFilename,
|
||||
transform: transformObj.transformer,
|
||||
contentHash: hasher.update(buffer).digest("hex"),
|
||||
index
|
||||
};
|
||||
const cacheKeys = `transform|${serialize(typeof transformObj.cache === "boolean" ? defaultCacheKeys : typeof transformObj.cache.keys === "function" ? await transformObj.cache.keys(defaultCacheKeys, absoluteFilename) : { ...defaultCacheKeys,
|
||||
...transformObj.cache.keys
|
||||
})}`;
|
||||
logger.debug(`getting transformation cache for '${absoluteFilename}'...`);
|
||||
const cacheItem = cache.getItemCache(cacheKeys, cache.getLazyHashedEtag(source));
|
||||
source = await cacheItem.getPromise();
|
||||
logger.debug(source ? `found transformation cache for '${absoluteFilename}'` : `no transformation cache for '${absoluteFilename}'`);
|
||||
|
||||
if (!source) {
|
||||
const transformed = await transformObj.transformer(buffer, absoluteFilename);
|
||||
source = new RawSource(transformed);
|
||||
logger.debug(`caching transformation for '${absoluteFilename}'...`);
|
||||
await cacheItem.storePromise(source);
|
||||
logger.debug(`cached transformation for '${absoluteFilename}'`);
|
||||
}
|
||||
} else {
|
||||
source = new RawSource(await transformObj.transformer(buffer, absoluteFilename));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let info = typeof pattern.info === "undefined" ? {} : typeof pattern.info === "function" ? pattern.info({
|
||||
absoluteFilename,
|
||||
sourceFilename,
|
||||
filename,
|
||||
toType
|
||||
}) || {} : pattern.info || {};
|
||||
|
||||
if (toType === "template") {
|
||||
logger.log(`interpolating template '${filename}' for '${sourceFilename}'...`);
|
||||
const contentHash = CopyPlugin.getContentHash(compiler, compilation, source.buffer());
|
||||
const ext = path.extname(sourceFilename);
|
||||
const base = path.basename(sourceFilename);
|
||||
const name = base.slice(0, base.length - ext.length);
|
||||
const data = {
|
||||
filename: normalizePath(path.relative(pattern.context, absoluteFilename)),
|
||||
contentHash,
|
||||
chunk: {
|
||||
name,
|
||||
id:
|
||||
/** @type {string} */
|
||||
sourceFilename,
|
||||
hash: contentHash
|
||||
}
|
||||
};
|
||||
const {
|
||||
path: interpolatedFilename,
|
||||
info: assetInfo
|
||||
} = compilation.getPathWithInfo(normalizePath(filename), data);
|
||||
info = { ...info,
|
||||
...assetInfo
|
||||
};
|
||||
filename = interpolatedFilename;
|
||||
logger.log(`interpolated template '${filename}' for '${sourceFilename}'`);
|
||||
} else {
|
||||
filename = normalizePath(filename);
|
||||
} // eslint-disable-next-line consistent-return
|
||||
|
||||
|
||||
return {
|
||||
sourceFilename,
|
||||
absoluteFilename,
|
||||
filename,
|
||||
source,
|
||||
info,
|
||||
force: pattern.force
|
||||
};
|
||||
}));
|
||||
} catch (error) {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (copiedResult.length === 0) {
|
||||
if (pattern.noErrorOnMissing) {
|
||||
logger.log(`finished to process a pattern from '${normalizedOriginalFrom}' using '${pattern.context}' context to '${pattern.to}'`);
|
||||
return;
|
||||
}
|
||||
|
||||
const missingError = new Error(`unable to locate '${glob}' glob after filtering paths`);
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
missingError);
|
||||
return;
|
||||
}
|
||||
|
||||
logger.log(`finished to process a pattern from '${normalizedOriginalFrom}' using '${pattern.context}' context`); // eslint-disable-next-line consistent-return
|
||||
|
||||
return copiedResult;
|
||||
}
|
||||
/**
|
||||
* @param {Compiler} compiler
|
||||
*/
|
||||
|
||||
|
||||
apply(compiler) {
|
||||
const pluginName = this.constructor.name;
|
||||
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
||||
const logger = compilation.getLogger("copy-webpack-plugin");
|
||||
const cache = compilation.getCache("CopyWebpackPlugin");
|
||||
/**
|
||||
* @type {typeof import("globby").globby}
|
||||
*/
|
||||
|
||||
let globby;
|
||||
compilation.hooks.processAssets.tapAsync({
|
||||
name: "copy-webpack-plugin",
|
||||
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
|
||||
}, async (unusedAssets, callback) => {
|
||||
if (typeof globby === "undefined") {
|
||||
try {
|
||||
// @ts-ignore
|
||||
({
|
||||
globby
|
||||
} = await import("globby"));
|
||||
} catch (error) {
|
||||
callback(
|
||||
/** @type {Error} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
logger.log("starting to add additional assets...");
|
||||
const copiedResultMap = new Map();
|
||||
/**
|
||||
* @type {(() => Promise<void>)[]}
|
||||
*/
|
||||
|
||||
const scheduledTasks = [];
|
||||
this.patterns.map(
|
||||
/**
|
||||
* @param {Pattern} item
|
||||
* @param {number} index
|
||||
* @return {number}
|
||||
*/
|
||||
(item, index) => scheduledTasks.push(async () => {
|
||||
/**
|
||||
* @type {ObjectPattern}
|
||||
*/
|
||||
const normalizedPattern = typeof item === "string" ? {
|
||||
from: item
|
||||
} : { ...item
|
||||
};
|
||||
const context = typeof normalizedPattern.context === "undefined" ? compiler.context : path.isAbsolute(normalizedPattern.context) ? normalizedPattern.context : path.join(compiler.context, normalizedPattern.context);
|
||||
normalizedPattern.context = context;
|
||||
/**
|
||||
* @type {Array<CopiedResult | undefined> | undefined}
|
||||
*/
|
||||
|
||||
let copiedResult;
|
||||
|
||||
try {
|
||||
copiedResult = await CopyPlugin.runPattern(globby, compiler, compilation, logger, cache,
|
||||
/** @type {ObjectPattern & { context: string }} */
|
||||
normalizedPattern, index);
|
||||
} catch (error) {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!copiedResult) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @type {Array<CopiedResult>}
|
||||
*/
|
||||
|
||||
|
||||
let filteredCopiedResult = copiedResult.filter(
|
||||
/**
|
||||
* @param {CopiedResult | undefined} result
|
||||
* @returns {result is CopiedResult}
|
||||
*/
|
||||
result => Boolean(result));
|
||||
|
||||
if (typeof normalizedPattern.transformAll !== "undefined") {
|
||||
if (typeof normalizedPattern.to === "undefined") {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
new Error(`Invalid "pattern.to" for the "pattern.from": "${normalizedPattern.from}" and "pattern.transformAll" function. The "to" option must be specified.`));
|
||||
return;
|
||||
}
|
||||
|
||||
filteredCopiedResult.sort((a, b) => a.absoluteFilename > b.absoluteFilename ? 1 : a.absoluteFilename < b.absoluteFilename ? -1 : 0);
|
||||
const mergedEtag = filteredCopiedResult.length === 1 ? cache.getLazyHashedEtag(filteredCopiedResult[0].source) : filteredCopiedResult.reduce(
|
||||
/**
|
||||
* @param {Etag} accumulator
|
||||
* @param {CopiedResult} asset
|
||||
* @param {number} i
|
||||
* @return {Etag}
|
||||
*/
|
||||
// @ts-ignore
|
||||
(accumulator, asset, i) => {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
accumulator = cache.mergeEtags(i === 1 ? cache.getLazyHashedEtag(
|
||||
/** @type {CopiedResult}*/
|
||||
accumulator.source) : accumulator, cache.getLazyHashedEtag(asset.source));
|
||||
return accumulator;
|
||||
});
|
||||
const cacheItem = cache.getItemCache(`transformAll|${serialize({
|
||||
version,
|
||||
from: normalizedPattern.from,
|
||||
to: normalizedPattern.to,
|
||||
transformAll: normalizedPattern.transformAll
|
||||
})}`, mergedEtag);
|
||||
let transformedAsset = await cacheItem.getPromise();
|
||||
|
||||
if (!transformedAsset) {
|
||||
transformedAsset = {
|
||||
filename: normalizedPattern.to
|
||||
};
|
||||
|
||||
try {
|
||||
transformedAsset.data = await normalizedPattern.transformAll(filteredCopiedResult.map(asset => {
|
||||
return {
|
||||
data: asset.source.buffer(),
|
||||
sourceFilename: asset.sourceFilename,
|
||||
absoluteFilename: asset.absoluteFilename
|
||||
};
|
||||
}));
|
||||
} catch (error) {
|
||||
compilation.errors.push(
|
||||
/** @type {WebpackError} */
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
const filename = typeof normalizedPattern.to === "function" ? await normalizedPattern.to({
|
||||
context
|
||||
}) : normalizedPattern.to;
|
||||
|
||||
if (template.test(filename)) {
|
||||
const contentHash = CopyPlugin.getContentHash(compiler, compilation, transformedAsset.data);
|
||||
const {
|
||||
path: interpolatedFilename,
|
||||
info: assetInfo
|
||||
} = compilation.getPathWithInfo(normalizePath(filename), {
|
||||
contentHash,
|
||||
chunk: {
|
||||
id: "unknown-copied-asset",
|
||||
hash: contentHash
|
||||
}
|
||||
});
|
||||
transformedAsset.filename = interpolatedFilename;
|
||||
transformedAsset.info = assetInfo;
|
||||
}
|
||||
|
||||
const {
|
||||
RawSource
|
||||
} = compiler.webpack.sources;
|
||||
transformedAsset.source = new RawSource(transformedAsset.data);
|
||||
transformedAsset.force = normalizedPattern.force;
|
||||
await cacheItem.storePromise(transformedAsset);
|
||||
}
|
||||
|
||||
filteredCopiedResult = [transformedAsset];
|
||||
}
|
||||
|
||||
const priority = normalizedPattern.priority || 0;
|
||||
|
||||
if (!copiedResultMap.has(priority)) {
|
||||
copiedResultMap.set(priority, []);
|
||||
}
|
||||
|
||||
copiedResultMap.get(priority).push(...filteredCopiedResult);
|
||||
}));
|
||||
await throttleAll(this.options.concurrency || 100, scheduledTasks);
|
||||
const copiedResult = [...copiedResultMap.entries()].sort((a, b) => a[0] - b[0]); // Avoid writing assets inside `p-limit`, because it creates concurrency.
|
||||
// It could potentially lead to an error - 'Multiple assets emit different content to the same filename'
|
||||
|
||||
copiedResult.reduce((acc, val) => acc.concat(val[1]), []).filter(Boolean).forEach(
|
||||
/**
|
||||
* @param {CopiedResult} result
|
||||
* @returns {void}
|
||||
*/
|
||||
result => {
|
||||
const {
|
||||
absoluteFilename,
|
||||
sourceFilename,
|
||||
filename,
|
||||
source,
|
||||
force
|
||||
} = result;
|
||||
const existingAsset = compilation.getAsset(filename);
|
||||
|
||||
if (existingAsset) {
|
||||
if (force) {
|
||||
const info = {
|
||||
copied: true,
|
||||
sourceFilename
|
||||
};
|
||||
logger.log(`force updating '${filename}' from '${absoluteFilename}' to compilation assets, because it already exists...`);
|
||||
compilation.updateAsset(filename, source, { ...info,
|
||||
...result.info
|
||||
});
|
||||
logger.log(`force updated '${filename}' from '${absoluteFilename}' to compilation assets, because it already exists`);
|
||||
return;
|
||||
}
|
||||
|
||||
logger.log(`skip adding '${filename}' from '${absoluteFilename}' to compilation assets, because it already exists`);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = {
|
||||
copied: true,
|
||||
sourceFilename
|
||||
};
|
||||
logger.log(`writing '${filename}' from '${absoluteFilename}' to compilation assets...`);
|
||||
compilation.emitAsset(filename, source, { ...info,
|
||||
...result.info
|
||||
});
|
||||
logger.log(`written '${filename}' from '${absoluteFilename}' to compilation assets`);
|
||||
});
|
||||
logger.log("finished to adding additional assets");
|
||||
callback();
|
||||
});
|
||||
|
||||
if (compilation.hooks.statsPrinter) {
|
||||
compilation.hooks.statsPrinter.tap(pluginName, stats => {
|
||||
stats.hooks.print.for("asset.info.copied").tap("copy-webpack-plugin", (copied, {
|
||||
green,
|
||||
formatFlag
|
||||
}) => copied ?
|
||||
/** @type {Function} */
|
||||
green(
|
||||
/** @type {Function} */
|
||||
formatFlag("copied")) : "");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = CopyPlugin;
|
161
my-app/node_modules/copy-webpack-plugin/dist/options.json
generated
vendored
Executable file
161
my-app/node_modules/copy-webpack-plugin/dist/options.json
generated
vendored
Executable file
|
@ -0,0 +1,161 @@
|
|||
{
|
||||
"definitions": {
|
||||
"ObjectPattern": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"from": {
|
||||
"type": "string",
|
||||
"description": "Glob or path from where we copy files.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#from",
|
||||
"minLength": 1
|
||||
},
|
||||
"to": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
],
|
||||
"description": "Output path.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#to"
|
||||
},
|
||||
"context": {
|
||||
"type": "string",
|
||||
"description": "A path that determines how to interpret the 'from' path.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#context"
|
||||
},
|
||||
"globOptions": {
|
||||
"type": "object",
|
||||
"description": "Allows to configute the glob pattern matching library used by the plugin.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#globoptions"
|
||||
},
|
||||
"filter": {
|
||||
"instanceof": "Function",
|
||||
"description": "Allows to filter copied assets.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#filter"
|
||||
},
|
||||
"transformAll": {
|
||||
"instanceof": "Function",
|
||||
"description": "Allows you to modify the contents of multiple files and save the result to one file.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#transformall"
|
||||
},
|
||||
"toType": {
|
||||
"enum": ["dir", "file", "template"],
|
||||
"description": "Determinate what is to option - directory, file or template.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#totype"
|
||||
},
|
||||
"force": {
|
||||
"type": "boolean",
|
||||
"description": "Overwrites files already in 'compilation.assets' (usually added by other plugins/loaders).",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#force"
|
||||
},
|
||||
"priority": {
|
||||
"type": "number",
|
||||
"description": "Allows to specify the priority of copying files with the same destination name.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#priority"
|
||||
},
|
||||
"info": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
],
|
||||
"description": "Allows to add assets info.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#info"
|
||||
},
|
||||
"transform": {
|
||||
"description": "Allows to modify the file contents.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#transform",
|
||||
"anyOf": [
|
||||
{
|
||||
"instanceof": "Function"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"transformer": {
|
||||
"instanceof": "Function",
|
||||
"description": "Allows to modify the file contents.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#transformer"
|
||||
},
|
||||
"cache": {
|
||||
"description": "Enables/disables and configure caching.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#cache",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"keys": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"noErrorOnMissing": {
|
||||
"type": "boolean",
|
||||
"description": "Doesn't generate an error on missing file(s).",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#noerroronmissing"
|
||||
}
|
||||
},
|
||||
"required": ["from"]
|
||||
},
|
||||
"StringPattern": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"patterns": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/StringPattern"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/ObjectPattern"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"concurrency": {
|
||||
"type": "number",
|
||||
"description": "Limits the number of simultaneous requests to fs.",
|
||||
"link": "https://github.com/webpack-contrib/copy-webpack-plugin#concurrency"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["patterns"]
|
||||
}
|
123
my-app/node_modules/copy-webpack-plugin/dist/utils.js
generated
vendored
Executable file
123
my-app/node_modules/copy-webpack-plugin/dist/utils.js
generated
vendored
Executable file
|
@ -0,0 +1,123 @@
|
|||
"use strict";
|
||||
|
||||
/** @typedef {import("webpack").Compilation["inputFileSystem"] } InputFileSystem */
|
||||
|
||||
/** @typedef {import("fs").Stats } Stats */
|
||||
|
||||
/**
|
||||
* @param {InputFileSystem} inputFileSystem
|
||||
* @param {string} path
|
||||
* @return {Promise<undefined | Stats>}
|
||||
*/
|
||||
function stat(inputFileSystem, path) {
|
||||
return new Promise((resolve, reject) => {
|
||||
inputFileSystem.stat(path,
|
||||
/**
|
||||
* @param {null | undefined | NodeJS.ErrnoException} err
|
||||
* @param {undefined | Stats} stats
|
||||
*/
|
||||
// @ts-ignore
|
||||
(err, stats) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(stats);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @param {InputFileSystem} inputFileSystem
|
||||
* @param {string} path
|
||||
* @return {Promise<string | Buffer>}
|
||||
*/
|
||||
|
||||
|
||||
function readFile(inputFileSystem, path) {
|
||||
return new Promise((resolve, reject) => {
|
||||
inputFileSystem.readFile(path,
|
||||
/**
|
||||
* @param {null | undefined | NodeJS.ErrnoException} err
|
||||
* @param {undefined | string | Buffer} data
|
||||
*/
|
||||
(err, data) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(
|
||||
/** @type {string | Buffer} */
|
||||
data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const notSettled = Symbol(`not-settled`);
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {() => Promise<T>} Task
|
||||
*/
|
||||
|
||||
/**
|
||||
* Run tasks with limited concurency.
|
||||
* @template T
|
||||
* @param {number} limit - Limit of tasks that run at once.
|
||||
* @param {Task<T>[]} tasks - List of tasks to run.
|
||||
* @returns {Promise<T[]>} A promise that fulfills to an array of the results
|
||||
*/
|
||||
|
||||
function throttleAll(limit, tasks) {
|
||||
if (!Number.isInteger(limit) || limit < 1) {
|
||||
throw new TypeError(`Expected \`limit\` to be a finite number > 0, got \`${limit}\` (${typeof limit})`);
|
||||
}
|
||||
|
||||
if (!Array.isArray(tasks) || !tasks.every(task => typeof task === `function`)) {
|
||||
throw new TypeError(`Expected \`tasks\` to be a list of functions returning a promise`);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const result = Array(tasks.length).fill(notSettled);
|
||||
const entries = tasks.entries();
|
||||
|
||||
const next = () => {
|
||||
const {
|
||||
done,
|
||||
value
|
||||
} = entries.next();
|
||||
|
||||
if (done) {
|
||||
const isLast = !result.includes(notSettled);
|
||||
|
||||
if (isLast) {
|
||||
resolve(
|
||||
/** @type{T[]} **/
|
||||
result);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const [index, task] = value;
|
||||
/**
|
||||
* @param {T} x
|
||||
*/
|
||||
|
||||
const onFulfilled = x => {
|
||||
result[index] = x;
|
||||
next();
|
||||
};
|
||||
|
||||
task().then(onFulfilled, reject);
|
||||
};
|
||||
|
||||
Array(limit).fill(0).forEach(next);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
stat,
|
||||
readFile,
|
||||
throttleAll
|
||||
};
|
15
my-app/node_modules/copy-webpack-plugin/node_modules/glob-parent/LICENSE
generated
vendored
Executable file
15
my-app/node_modules/copy-webpack-plugin/node_modules/glob-parent/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) 2015, 2019 Elan Shanker, 2021 Blaine Bublitz <blaine.bublitz@gmail.com>, Eric Schoffstall <yo@contra.io> and other contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
134
my-app/node_modules/copy-webpack-plugin/node_modules/glob-parent/README.md
generated
vendored
Executable file
134
my-app/node_modules/copy-webpack-plugin/node_modules/glob-parent/README.md
generated
vendored
Executable file
|
@ -0,0 +1,134 @@
|
|||
<p align="center">
|
||||
<a href="https://gulpjs.com">
|
||||
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# glob-parent
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]
|
||||
|
||||
Extract the non-magic parent path from a glob string.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var globParent = require('glob-parent');
|
||||
|
||||
globParent('path/to/*.js'); // 'path/to'
|
||||
globParent('/root/path/to/*.js'); // '/root/path/to'
|
||||
globParent('/*.js'); // '/'
|
||||
globParent('*.js'); // '.'
|
||||
globParent('**/*.js'); // '.'
|
||||
globParent('path/{to,from}'); // 'path'
|
||||
globParent('path/!(to|from)'); // 'path'
|
||||
globParent('path/?(to|from)'); // 'path'
|
||||
globParent('path/+(to|from)'); // 'path'
|
||||
globParent('path/*(to|from)'); // 'path'
|
||||
globParent('path/@(to|from)'); // 'path'
|
||||
globParent('path/**/*'); // 'path'
|
||||
|
||||
// if provided a non-glob path, returns the nearest dir
|
||||
globParent('path/foo/bar.js'); // 'path/foo'
|
||||
globParent('path/foo/'); // 'path/foo'
|
||||
globParent('path/foo'); // 'path' (see issue #3 for details)
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `globParent(maybeGlobString, [options])`
|
||||
|
||||
Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below.
|
||||
|
||||
#### options
|
||||
|
||||
```js
|
||||
{
|
||||
// Disables the automatic conversion of slashes for Windows
|
||||
flipBackslashes: true;
|
||||
}
|
||||
```
|
||||
|
||||
## Escaping
|
||||
|
||||
The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters:
|
||||
|
||||
- `?` (question mark) unless used as a path segment alone
|
||||
- `*` (asterisk)
|
||||
- `|` (pipe)
|
||||
- `(` (opening parenthesis)
|
||||
- `)` (closing parenthesis)
|
||||
- `{` (opening curly brace)
|
||||
- `}` (closing curly brace)
|
||||
- `[` (opening bracket)
|
||||
- `]` (closing bracket)
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
globParent('foo/[bar]/'); // 'foo'
|
||||
globParent('foo/\\[bar]/'); // 'foo/[bar]'
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
### Braces & Brackets
|
||||
|
||||
This library attempts a quick and imperfect method of determining which path
|
||||
parts have glob magic without fully parsing/lexing the pattern. There are some
|
||||
advanced use cases that can trip it up, such as nested braces where the outer
|
||||
pair is escaped and the inner one contains a path separator. If you find
|
||||
yourself in the unlikely circumstance of being affected by this or need to
|
||||
ensure higher-fidelity glob handling in your library, it is recommended that you
|
||||
pre-process your input with [expand-braces] and/or [expand-brackets].
|
||||
|
||||
### Windows
|
||||
|
||||
Backslashes are not valid path separators for globs. If a path with backslashes
|
||||
is provided anyway, for simple cases, glob-parent will replace the path
|
||||
separator for you and return the non-glob parent path (now with
|
||||
forward-slashes, which are still valid as Windows path separators).
|
||||
|
||||
This cannot be used in conjunction with escape characters.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('C:\\Program Files \\(x86\\)\\*.ext'); // 'C:/Program Files /(x86/)'
|
||||
|
||||
// GOOD
|
||||
globParent('C:/Program Files\\(x86\\)/*.ext'); // 'C:/Program Files (x86)'
|
||||
```
|
||||
|
||||
If you are using escape characters for a pattern without path parts (i.e.
|
||||
relative to `cwd`), prefix with `./` to avoid confusing glob-parent.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('foo \\[bar]'); // 'foo '
|
||||
globParent('foo \\[bar]*'); // 'foo '
|
||||
|
||||
// GOOD
|
||||
globParent('./foo \\[bar]'); // 'foo [bar]'
|
||||
globParent('./foo \\[bar]*'); // '.'
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/glob-parent
|
||||
[npm-image]: https://img.shields.io/npm/v/glob-parent.svg?style=flat-square
|
||||
|
||||
[ci-url]: https://github.com/gulpjs/glob-parent/actions?query=workflow:dev
|
||||
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/glob-parent/dev?style=flat-square
|
||||
|
||||
[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent
|
||||
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg?style=flat-square
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
[expand-braces]: https://github.com/jonschlinkert/expand-braces
|
||||
[expand-brackets]: https://github.com/jonschlinkert/expand-brackets
|
||||
<!-- prettier-ignore-end -->
|
75
my-app/node_modules/copy-webpack-plugin/node_modules/glob-parent/index.js
generated
vendored
Executable file
75
my-app/node_modules/copy-webpack-plugin/node_modules/glob-parent/index.js
generated
vendored
Executable file
|
@ -0,0 +1,75 @@
|
|||
'use strict';
|
||||
|
||||
var isGlob = require('is-glob');
|
||||
var pathPosixDirname = require('path').posix.dirname;
|
||||
var isWin32 = require('os').platform() === 'win32';
|
||||
|
||||
var slash = '/';
|
||||
var backslash = /\\/g;
|
||||
var escaped = /\\([!*?|[\](){}])/g;
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @param {Object} opts
|
||||
* @param {boolean} [opts.flipBackslashes=true]
|
||||
*/
|
||||
module.exports = function globParent(str, opts) {
|
||||
var options = Object.assign({ flipBackslashes: true }, opts);
|
||||
|
||||
// flip windows path separators
|
||||
if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
|
||||
str = str.replace(backslash, slash);
|
||||
}
|
||||
|
||||
// special case for strings ending in enclosure containing path separator
|
||||
if (isEnclosure(str)) {
|
||||
str += slash;
|
||||
}
|
||||
|
||||
// preserves full path in case of trailing path separator
|
||||
str += 'a';
|
||||
|
||||
// remove path parts that are globby
|
||||
do {
|
||||
str = pathPosixDirname(str);
|
||||
} while (isGlobby(str));
|
||||
|
||||
// remove escape chars and return result
|
||||
return str.replace(escaped, '$1');
|
||||
};
|
||||
|
||||
function isEnclosure(str) {
|
||||
var lastChar = str.slice(-1);
|
||||
|
||||
var enclosureStart;
|
||||
switch (lastChar) {
|
||||
case '}':
|
||||
enclosureStart = '{';
|
||||
break;
|
||||
case ']':
|
||||
enclosureStart = '[';
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
var foundIndex = str.indexOf(enclosureStart);
|
||||
if (foundIndex < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str.slice(foundIndex + 1, -1).includes(slash);
|
||||
}
|
||||
|
||||
function isGlobby(str) {
|
||||
if (/\([^()]+$/.test(str)) {
|
||||
return true;
|
||||
}
|
||||
if (str[0] === '{' || str[0] === '[') {
|
||||
return true;
|
||||
}
|
||||
if (/[^\\][{[]/.test(str)) {
|
||||
return true;
|
||||
}
|
||||
return isGlob(str);
|
||||
}
|
54
my-app/node_modules/copy-webpack-plugin/node_modules/glob-parent/package.json
generated
vendored
Executable file
54
my-app/node_modules/copy-webpack-plugin/node_modules/glob-parent/package.json
generated
vendored
Executable file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"name": "glob-parent",
|
||||
"version": "6.0.2",
|
||||
"description": "Extract the non-magic parent path from a glob string.",
|
||||
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
|
||||
"contributors": [
|
||||
"Elan Shanker (https://github.com/es128)",
|
||||
"Blaine Bublitz <blaine.bublitz@gmail.com>"
|
||||
],
|
||||
"repository": "gulpjs/glob-parent",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
},
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"test": "nyc mocha --async-only"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-config-gulp": "^5.0.0",
|
||||
"expect": "^26.0.1",
|
||||
"mocha": "^7.1.2",
|
||||
"nyc": "^15.0.1"
|
||||
},
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"singleQuote": true
|
||||
},
|
||||
"keywords": [
|
||||
"glob",
|
||||
"parent",
|
||||
"strip",
|
||||
"path",
|
||||
"dirname",
|
||||
"directory",
|
||||
"base",
|
||||
"wildcard"
|
||||
]
|
||||
}
|
93
my-app/node_modules/copy-webpack-plugin/package.json
generated
vendored
Executable file
93
my-app/node_modules/copy-webpack-plugin/package.json
generated
vendored
Executable file
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
"name": "copy-webpack-plugin",
|
||||
"version": "11.0.0",
|
||||
"description": "Copy files && directories with webpack",
|
||||
"license": "MIT",
|
||||
"repository": "webpack-contrib/copy-webpack-plugin",
|
||||
"author": "Len Boyette",
|
||||
"homepage": "https://github.com/webpack-contrib/copy-webpack-plugin",
|
||||
"bugs": "https://github.com/webpack-contrib/copy-webpack-plugin/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "types/index.d.ts",
|
||||
"engines": {
|
||||
"node": ">= 14.15.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run build -- -w",
|
||||
"clean": "del-cli dist types",
|
||||
"prebuild": "npm run clean",
|
||||
"build:types": "tsc --declaration --emitDeclarationOnly --outDir types --rootDir src && prettier \"types/**/*.ts\" --write",
|
||||
"build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files",
|
||||
"build": "npm-run-all -p \"build:**\"",
|
||||
"commitlint": "commitlint --from=master",
|
||||
"security": "npm audit --production",
|
||||
"lint:prettier": "prettier --list-different .",
|
||||
"lint:js": "eslint --cache .",
|
||||
"lint:types": "tsc --pretty --noEmit",
|
||||
"lint": "npm-run-all -l -p \"lint:**\"",
|
||||
"test:only": "cross-env NODE_ENV=test jest",
|
||||
"test:watch": "npm run test:only -- --watch",
|
||||
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run test:coverage",
|
||||
"prepare": "husky install && npm run build",
|
||||
"release": "standard-version"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"types"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"webpack": "^5.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"fast-glob": "^3.2.11",
|
||||
"glob-parent": "^6.0.1",
|
||||
"globby": "^13.1.1",
|
||||
"normalize-path": "^3.0.0",
|
||||
"schema-utils": "^4.0.0",
|
||||
"serialize-javascript": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.17.10",
|
||||
"@babel/core": "^7.17.10",
|
||||
"@babel/eslint-parser": "^7.16.5",
|
||||
"@babel/preset-env": "^7.17.12",
|
||||
"@commitlint/cli": "^17.0.0",
|
||||
"@commitlint/config-conventional": "^17.0.0",
|
||||
"@types/glob-parent": "^5.1.1",
|
||||
"@types/normalize-path": "^3.0.0",
|
||||
"@types/serialize-javascript": "^5.0.2",
|
||||
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
||||
"babel-jest": "^28.1.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"del": "^6.0.0",
|
||||
"del-cli": "^4.0.1",
|
||||
"eslint": "^8.15.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"husky": "^8.0.1",
|
||||
"is-gzip": "^2.0.0",
|
||||
"jest": "^28.1.0",
|
||||
"lint-staged": "^12.4.1",
|
||||
"memfs": "^3.4.1",
|
||||
"mkdirp": "^1.0.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.6.2",
|
||||
"standard-version": "^9.3.1",
|
||||
"typescript": "^4.6.4",
|
||||
"webpack": "^5.72.1"
|
||||
},
|
||||
"keywords": [
|
||||
"webpack",
|
||||
"plugin",
|
||||
"transfer",
|
||||
"move",
|
||||
"copy"
|
||||
]
|
||||
}
|
289
my-app/node_modules/copy-webpack-plugin/types/index.d.ts
generated
vendored
Executable file
289
my-app/node_modules/copy-webpack-plugin/types/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,289 @@
|
|||
export = CopyPlugin;
|
||||
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
|
||||
/** @typedef {import("webpack").Compiler} Compiler */
|
||||
/** @typedef {import("webpack").Compilation} Compilation */
|
||||
/** @typedef {import("webpack").WebpackError} WebpackError */
|
||||
/** @typedef {import("webpack").Asset} Asset */
|
||||
/** @typedef {import("globby").Options} GlobbyOptions */
|
||||
/** @typedef {import("globby").GlobEntry} GlobEntry */
|
||||
/** @typedef {ReturnType<Compilation["getLogger"]>} WebpackLogger */
|
||||
/** @typedef {ReturnType<Compilation["getCache"]>} CacheFacade */
|
||||
/** @typedef {ReturnType<ReturnType<Compilation["getCache"]>["getLazyHashedEtag"]>} Etag */
|
||||
/** @typedef {ReturnType<Compilation["fileSystemInfo"]["mergeSnapshots"]>} Snapshot */
|
||||
/**
|
||||
* @typedef {boolean} Force
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} CopiedResult
|
||||
* @property {string} sourceFilename
|
||||
* @property {string} absoluteFilename
|
||||
* @property {string} filename
|
||||
* @property {Asset["source"]} source
|
||||
* @property {Force | undefined} force
|
||||
* @property {Record<string, any>} info
|
||||
*/
|
||||
/**
|
||||
* @typedef {string} StringPattern
|
||||
*/
|
||||
/**
|
||||
* @typedef {boolean} NoErrorOnMissing
|
||||
*/
|
||||
/**
|
||||
* @typedef {string} Context
|
||||
*/
|
||||
/**
|
||||
* @typedef {string} From
|
||||
*/
|
||||
/**
|
||||
* @callback ToFunction
|
||||
* @param {{ context: string, absoluteFilename?: string }} pathData
|
||||
* @return {string | Promise<string>}
|
||||
*/
|
||||
/**
|
||||
* @typedef {string | ToFunction} To
|
||||
*/
|
||||
/**
|
||||
* @typedef {"dir" | "file" | "template"} ToType
|
||||
*/
|
||||
/**
|
||||
* @callback TransformerFunction
|
||||
* @param {Buffer} input
|
||||
* @param {string} absoluteFilename
|
||||
* @returns {string | Buffer | Promise<string> | Promise<Buffer>}
|
||||
*/
|
||||
/**
|
||||
* @typedef {{ keys: { [key: string]: any } } | { keys: ((defaultCacheKeys: { [key: string]: any }, absoluteFilename: string) => Promise<{ [key: string]: any }>) }} TransformerCacheObject
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} TransformerObject
|
||||
* @property {TransformerFunction} transformer
|
||||
* @property {boolean | TransformerCacheObject} [cache]
|
||||
*/
|
||||
/**
|
||||
* @typedef {TransformerFunction | TransformerObject} Transform
|
||||
*/
|
||||
/**
|
||||
* @callback Filter
|
||||
* @param {string} filepath
|
||||
* @returns {boolean | Promise<boolean>}
|
||||
*/
|
||||
/**
|
||||
* @callback TransformAllFunction
|
||||
* @param {{ data: Buffer, sourceFilename: string, absoluteFilename: string }[]} data
|
||||
* @returns {string | Buffer | Promise<string> | Promise<Buffer>}
|
||||
*/
|
||||
/**
|
||||
* @typedef { Record<string, any> | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => Record<string, any>) } Info
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} ObjectPattern
|
||||
* @property {From} from
|
||||
* @property {GlobbyOptions} [globOptions]
|
||||
* @property {Context} [context]
|
||||
* @property {To} [to]
|
||||
* @property {ToType} [toType]
|
||||
* @property {Info} [info]
|
||||
* @property {Filter} [filter]
|
||||
* @property {Transform} [transform]
|
||||
* @property {TransformAllFunction} [transformAll]
|
||||
* @property {Force} [force]
|
||||
* @property {number} [priority]
|
||||
* @property {NoErrorOnMissing} [noErrorOnMissing]
|
||||
*/
|
||||
/**
|
||||
* @typedef {StringPattern | ObjectPattern} Pattern
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} AdditionalOptions
|
||||
* @property {number} [concurrency]
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} PluginOptions
|
||||
* @property {Pattern[]} patterns
|
||||
* @property {AdditionalOptions} [options]
|
||||
*/
|
||||
declare class CopyPlugin {
|
||||
/**
|
||||
* @private
|
||||
* @param {Compilation} compilation
|
||||
* @param {number} startTime
|
||||
* @param {string} dependency
|
||||
* @returns {Promise<Snapshot | undefined>}
|
||||
*/
|
||||
private static createSnapshot;
|
||||
/**
|
||||
* @private
|
||||
* @param {Compilation} compilation
|
||||
* @param {Snapshot} snapshot
|
||||
* @returns {Promise<boolean | undefined>}
|
||||
*/
|
||||
private static checkSnapshotValid;
|
||||
/**
|
||||
* @private
|
||||
* @param {Compiler} compiler
|
||||
* @param {Compilation} compilation
|
||||
* @param {Buffer} source
|
||||
* @returns {string}
|
||||
*/
|
||||
private static getContentHash;
|
||||
/**
|
||||
* @private
|
||||
* @param {typeof import("globby").globby} globby
|
||||
* @param {Compiler} compiler
|
||||
* @param {Compilation} compilation
|
||||
* @param {WebpackLogger} logger
|
||||
* @param {CacheFacade} cache
|
||||
* @param {ObjectPattern & { context: string }} inputPattern
|
||||
* @param {number} index
|
||||
* @returns {Promise<Array<CopiedResult | undefined> | undefined>}
|
||||
*/
|
||||
private static runPattern;
|
||||
/**
|
||||
* @param {PluginOptions} [options]
|
||||
*/
|
||||
constructor(options?: PluginOptions | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {Pattern[]}
|
||||
*/
|
||||
private patterns;
|
||||
/**
|
||||
* @private
|
||||
* @type {AdditionalOptions}
|
||||
*/
|
||||
private options;
|
||||
/**
|
||||
* @param {Compiler} compiler
|
||||
*/
|
||||
apply(compiler: Compiler): void;
|
||||
}
|
||||
declare namespace CopyPlugin {
|
||||
export {
|
||||
Schema,
|
||||
Compiler,
|
||||
Compilation,
|
||||
WebpackError,
|
||||
Asset,
|
||||
GlobbyOptions,
|
||||
GlobEntry,
|
||||
WebpackLogger,
|
||||
CacheFacade,
|
||||
Etag,
|
||||
Snapshot,
|
||||
Force,
|
||||
CopiedResult,
|
||||
StringPattern,
|
||||
NoErrorOnMissing,
|
||||
Context,
|
||||
From,
|
||||
ToFunction,
|
||||
To,
|
||||
ToType,
|
||||
TransformerFunction,
|
||||
TransformerCacheObject,
|
||||
TransformerObject,
|
||||
Transform,
|
||||
Filter,
|
||||
TransformAllFunction,
|
||||
Info,
|
||||
ObjectPattern,
|
||||
Pattern,
|
||||
AdditionalOptions,
|
||||
PluginOptions,
|
||||
};
|
||||
}
|
||||
type Compiler = import("webpack").Compiler;
|
||||
type PluginOptions = {
|
||||
patterns: Pattern[];
|
||||
options?: AdditionalOptions | undefined;
|
||||
};
|
||||
type Schema = import("schema-utils/declarations/validate").Schema;
|
||||
type Compilation = import("webpack").Compilation;
|
||||
type WebpackError = import("webpack").WebpackError;
|
||||
type Asset = import("webpack").Asset;
|
||||
type GlobbyOptions = import("globby").Options;
|
||||
type GlobEntry = import("globby").GlobEntry;
|
||||
type WebpackLogger = ReturnType<Compilation["getLogger"]>;
|
||||
type CacheFacade = ReturnType<Compilation["getCache"]>;
|
||||
type Etag = ReturnType<
|
||||
ReturnType<Compilation["getCache"]>["getLazyHashedEtag"]
|
||||
>;
|
||||
type Snapshot = ReturnType<Compilation["fileSystemInfo"]["mergeSnapshots"]>;
|
||||
type Force = boolean;
|
||||
type CopiedResult = {
|
||||
sourceFilename: string;
|
||||
absoluteFilename: string;
|
||||
filename: string;
|
||||
source: Asset["source"];
|
||||
force: Force | undefined;
|
||||
info: Record<string, any>;
|
||||
};
|
||||
type StringPattern = string;
|
||||
type NoErrorOnMissing = boolean;
|
||||
type Context = string;
|
||||
type From = string;
|
||||
type ToFunction = (pathData: {
|
||||
context: string;
|
||||
absoluteFilename?: string;
|
||||
}) => string | Promise<string>;
|
||||
type To = string | ToFunction;
|
||||
type ToType = "dir" | "file" | "template";
|
||||
type TransformerFunction = (
|
||||
input: Buffer,
|
||||
absoluteFilename: string
|
||||
) => string | Buffer | Promise<string> | Promise<Buffer>;
|
||||
type TransformerCacheObject =
|
||||
| {
|
||||
keys: {
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
| {
|
||||
keys: (
|
||||
defaultCacheKeys: {
|
||||
[key: string]: any;
|
||||
},
|
||||
absoluteFilename: string
|
||||
) => Promise<{
|
||||
[key: string]: any;
|
||||
}>;
|
||||
};
|
||||
type TransformerObject = {
|
||||
transformer: TransformerFunction;
|
||||
cache?: boolean | TransformerCacheObject | undefined;
|
||||
};
|
||||
type Transform = TransformerFunction | TransformerObject;
|
||||
type Filter = (filepath: string) => boolean | Promise<boolean>;
|
||||
type TransformAllFunction = (
|
||||
data: {
|
||||
data: Buffer;
|
||||
sourceFilename: string;
|
||||
absoluteFilename: string;
|
||||
}[]
|
||||
) => string | Buffer | Promise<string> | Promise<Buffer>;
|
||||
type Info =
|
||||
| Record<string, any>
|
||||
| ((item: {
|
||||
absoluteFilename: string;
|
||||
sourceFilename: string;
|
||||
filename: string;
|
||||
toType: ToType;
|
||||
}) => Record<string, any>);
|
||||
type ObjectPattern = {
|
||||
from: From;
|
||||
globOptions?: import("globby").Options | undefined;
|
||||
context?: string | undefined;
|
||||
to?: To | undefined;
|
||||
toType?: ToType | undefined;
|
||||
info?: Info | undefined;
|
||||
filter?: Filter | undefined;
|
||||
transform?: Transform | undefined;
|
||||
transformAll?: TransformAllFunction | undefined;
|
||||
force?: boolean | undefined;
|
||||
priority?: number | undefined;
|
||||
noErrorOnMissing?: boolean | undefined;
|
||||
};
|
||||
type Pattern = StringPattern | ObjectPattern;
|
||||
type AdditionalOptions = {
|
||||
concurrency?: number | undefined;
|
||||
};
|
35
my-app/node_modules/copy-webpack-plugin/types/utils.d.ts
generated
vendored
Executable file
35
my-app/node_modules/copy-webpack-plugin/types/utils.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,35 @@
|
|||
export type InputFileSystem = import("webpack").Compilation["inputFileSystem"];
|
||||
export type Stats = import("fs").Stats;
|
||||
export type Task<T> = () => Promise<T>;
|
||||
/** @typedef {import("webpack").Compilation["inputFileSystem"] } InputFileSystem */
|
||||
/** @typedef {import("fs").Stats } Stats */
|
||||
/**
|
||||
* @param {InputFileSystem} inputFileSystem
|
||||
* @param {string} path
|
||||
* @return {Promise<undefined | Stats>}
|
||||
*/
|
||||
export function stat(
|
||||
inputFileSystem: InputFileSystem,
|
||||
path: string
|
||||
): Promise<undefined | Stats>;
|
||||
/**
|
||||
* @param {InputFileSystem} inputFileSystem
|
||||
* @param {string} path
|
||||
* @return {Promise<string | Buffer>}
|
||||
*/
|
||||
export function readFile(
|
||||
inputFileSystem: InputFileSystem,
|
||||
path: string
|
||||
): Promise<string | Buffer>;
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {() => Promise<T>} Task
|
||||
*/
|
||||
/**
|
||||
* Run tasks with limited concurency.
|
||||
* @template T
|
||||
* @param {number} limit - Limit of tasks that run at once.
|
||||
* @param {Task<T>[]} tasks - List of tasks to run.
|
||||
* @returns {Promise<T[]>} A promise that fulfills to an array of the results
|
||||
*/
|
||||
export function throttleAll<T>(limit: number, tasks: Task<T>[]): Promise<T[]>;
|
Loading…
Add table
Add a link
Reference in a new issue