Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,446 changes: 2,933 additions & 2,513 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 9 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
"commitlint": "commitlint --from=main",
"security": "npm audit --production",
"lint:prettier": "prettier --cache --list-different .",
"lint:js": "eslint --cache .",
"lint:code": "eslint --cache .",
"lint:spelling": "cspell --cache --no-must-find-files --quiet \"**/*.*\"",
"lint:types": "tsc --pretty --noEmit",
"lint": "npm-run-all -l -p \"lint:**\"",
"fix:js": "npm run lint:js -- --fix",
"fix:prettier": "npm run lint:prettier -- --write",
"fix": "npm-run-all -l fix:js fix:prettier",
"fix:code": "npm run lint:code -- --fix",
"fmt": "npm run lint:prettier -- --write",
"fix": "npm run fix:code && npm run fmt",
"test:only": "cross-env NODE_ENV=test node --experimental-vm-modules node_modules/jest/bin/jest.js",
"test:watch": "npm run test:only -- --watch",
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
Expand All @@ -59,43 +59,31 @@
"devDependencies": {
"@babel/cli": "^7.24.6",
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@babel/preset-env": "^7.25.3",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@eslint/js": "^9.32.0",
"@eslint/markdown": "^7.0.0",
"@stylistic/eslint-plugin": "^5.2.2",
"@commitlint/cli": "^20.3.1",
"@commitlint/config-conventional": "^20.3.1",
"@types/glob-parent": "^5.1.3",
"@types/node": "^22.13.5",
"@types/normalize-path": "^3.0.2",
"@types/picomatch": "^4.0.2",
"@types/serialize-javascript": "^5.0.4",
"babel-jest": "^30.0.0",
"cross-env": "^7.0.3",
"cspell": "^8.15.6",
"del": "^6.1.1",
"cspell": "^9.6.2",
"del-cli": "^6.0.0",
"eslint": "^9.31.0",
"eslint-config-prettier": "^10.1.8",
"eslint-config-webpack": "^4.4.2",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jest": "^29.0.1",
"eslint-plugin-jsdoc": "^51.4.1",
"eslint-plugin-n": "^17.21.0",
"eslint-plugin-prettier": "^5.5.3",
"eslint-plugin-unicorn": "^60.0.0",
"file-loader": "^6.2.0",
"globals": "^16.3.0",
"husky": "^9.1.4",
"is-gzip": "^2.0.0",
"jest": "^30.0.0",
"lint-staged": "^15.2.8",
"lint-staged": "^16.2.7",
"memfs": "^4.11.1",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"standard-version": "^9.3.1",
"typescript": "^5.4.5",
"typescript-eslint": "^8.37.0",
"webpack": "^5.91.0"
},
"peerDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const getTinyGlobby = memoize(() => require("tinyglobby"));
*/

/**
* @typedef { Record<string, unknown> | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => Record<string, unknown>) } Info
* @typedef {Record<string, unknown> | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => Record<string, unknown>)} Info
*/

/**
Expand Down Expand Up @@ -311,7 +311,7 @@ class CopyPlugin {
* @param {number} concurrency /maximum number of concurrent operations
* @param {ObjectPattern & { context: string }} pattern the pattern to process
* @param {number} index the index of the pattern in the patterns array
* @returns {Promise<Array<CopiedResult | undefined> | undefined>} processes the pattern and returns an array of copied results
* @returns {Promise<(CopiedResult | undefined)[] | undefined>} processes the pattern and returns an array of copied results
*/
static async glob(
globby,
Expand Down Expand Up @@ -461,7 +461,7 @@ class CopyPlugin {
);

/**
* @type {Array<CopiedResult | undefined>}
* @type {(CopiedResult | undefined)[]}
*/
let copiedResult;

Expand Down Expand Up @@ -870,7 +870,7 @@ class CopyPlugin {
pattern.context = context;

/**
* @type {Array<CopiedResult | undefined> | undefined}
* @type {(CopiedResult | undefined)[] | undefined}
*/
let copiedResult;

Expand All @@ -897,7 +897,7 @@ class CopyPlugin {
}

/**
* @type {Array<CopiedResult>}
* @type {CopiedResult[]}
*/
let filteredCopiedResult = copiedResult.filter(
/**
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @typedef {import("webpack").Compilation["inputFileSystem"] } InputFileSystem */
/** @typedef {import("fs").Stats } Stats */
/** @typedef {import("webpack").Compilation["inputFileSystem"]} InputFileSystem */
/** @typedef {import("fs").Stats} Stats */

/**
* @param {InputFileSystem} inputFileSystem the input file system to use for reading the file stats.
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/validate-options.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`validate options should throw an error on the "options" option with "{"concurrency":true}" value 1`] = `
"Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
Expand Down
6 changes: 3 additions & 3 deletions test/helpers/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ignore = [
];

/**
* @param {{ patterns?: Array<unknown>, compiler?: unknown, preCopy?: unknown, breakContenthash?: unknown, withChildCompilation?: unknown, expectedErrors?: Array<Error>, expectedWarnings?: Array<Error> }} opts Options for running the test
* @param {{ patterns?: unknown[], compiler?: unknown, preCopy?: unknown, breakContenthash?: unknown, withChildCompilation?: unknown, expectedErrors?: Error[], expectedWarnings?: Error[] }} opts Options for running the test
* @returns {Promise<{ compilation: unknown, compiler: unknown, stats: unknown }>} Resolves with compilation, compiler, and stats
*/
function run(opts) {
Expand Down Expand Up @@ -96,7 +96,7 @@ function run(opts) {
}

/**
* @param {{ expectedAssetKeys?: Array<string>, expectedAssetContent?: { [key: string]: unknown }, skipAssetsTesting?: boolean }} opts Options for running the test
* @param {{ expectedAssetKeys?: string[], expectedAssetContent?: { [key: string]: unknown }, skipAssetsTesting?: boolean }} opts Options for running the test
* @returns {Promise<void>} Resolves when the test is complete
*/
function runEmit(opts) {
Expand Down Expand Up @@ -163,7 +163,7 @@ const delay = (ms) =>
});

/**
* @param {{ patterns?: Array<unknown>, options?: unknown, newFileLoc1?: string, newFileLoc2?: string, expectedAssetKeys?: Array<string> }} opts Options for running the test
* @param {{ patterns?: unknown[], options?: unknown, newFileLoc1?: string, newFileLoc2?: string, expectedAssetKeys?: string[] }} opts Options for running the test
* @returns {Promise<void>} Resolves when the test is complete
*/
function runChange(opts) {
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ declare class CopyPlugin {
* @param {number} concurrency /maximum number of concurrent operations
* @param {ObjectPattern & { context: string }} pattern the pattern to process
* @param {number} index the index of the pattern in the patterns array
* @returns {Promise<Array<CopiedResult | undefined> | undefined>} processes the pattern and returns an array of copied results
* @returns {Promise<(CopiedResult | undefined)[] | undefined>} processes the pattern and returns an array of copied results
*/
private static glob;
/**
Expand Down
4 changes: 2 additions & 2 deletions types/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export function readFile(
inputFileSystem: InputFileSystem,
path: string,
): Promise<string | Buffer>;
/** @typedef {import("webpack").Compilation["inputFileSystem"] } InputFileSystem */
/** @typedef {import("fs").Stats } Stats */
/** @typedef {import("webpack").Compilation["inputFileSystem"]} InputFileSystem */
/** @typedef {import("fs").Stats} Stats */
/**
* @param {InputFileSystem} inputFileSystem the input file system to use for reading the file stats.
* @param {string} path the path to the file or directory to get stats for.
Expand Down