diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index cae9d895..00000000 --- a/.eslintignore +++ /dev/null @@ -1,8 +0,0 @@ -/coverage -/dist -/node_modules -/test/fixtures -/test/cases/*/expected -/test/js -/test/manual/dist -/types/**/* diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 08daa9d3..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - root: true, - parser: "@babel/eslint-parser", - extends: ["@webpack-contrib/eslint-config-webpack", "prettier"], -}; diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 69c8b134..5e851d05 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -102,12 +102,13 @@ jobs: - name: Install dependencies (old Node.js version) run: | rm package-lock.json - npm install --ignore-engines - if: matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x' + npm install --ignore-engines --ignore-scripts + npm install -D typescript@4 + if: matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x' || matrix.node-version == '18.x' - name: Install dependencies run: npm ci - if: matrix.node-version == '18.x' || matrix.node-version == '20.x' || matrix.node-version == '22.x' || matrix.node-version == '24.x' + if: matrix.node-version == '20.x' || matrix.node-version == '22.x' || matrix.node-version == '24.x' - name: Install webpack ${{ matrix.webpack-version }} if: matrix.webpack-version != 'latest' @@ -157,12 +158,13 @@ jobs: - name: Install dependencies (old Node.js version) run: | rm package-lock.json - npm install --ignore-engines - if: matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x' + npm install --ignore-engines --ignore-scripts + npm install -D typescript@4 + if: matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x' || matrix.node-version == '18.x' - name: Install dependencies run: npm ci - if: matrix.node-version == '18.x' || matrix.node-version == '20.x' || matrix.node-version == '22.x' || matrix.node-version == '24.x' + if: matrix.node-version == '20.x' || matrix.node-version == '22.x' || matrix.node-version == '24.x' - name: Run tests for webpack version latest with experimentalUseImportModule run: npm run test:coverage -- --ci diff --git a/README.md b/README.md index 2b9ce36a..4e952dff 100644 --- a/README.md +++ b/README.md @@ -201,8 +201,8 @@ Allows to override default behavior and insert styles at any position. ```js new MiniCssExtractPlugin({ - insert: function (linkTag) { - var reference = document.querySelector("#some-element"); + insert(linkTag) { + const reference = document.querySelector("#some-element"); if (reference) { reference.parentNode.insertBefore(linkTag, reference); } @@ -217,7 +217,7 @@ A new `` tag will be inserted before the element with the ID `some-element Type: ```ts -type attributes = Record}; +type attributes = Record; ``` Default: `{}` @@ -483,9 +483,8 @@ module.exports = { { loader: MiniCssExtractPlugin.loader, options: { - publicPath: (resourcePath, context) => { - return path.relative(path.dirname(resourcePath), context) + "/"; - }, + publicPath: (resourcePath, context) => + `${path.relative(path.dirname(resourcePath), context)}/`, }, }, "css-loader", @@ -620,6 +619,7 @@ For `development` mode (including `webpack-dev-server`) you can use [style-loade ```js const MiniCssExtractPlugin = require("mini-css-extract-plugin"); + const devMode = process.env.NODE_ENV !== "production"; module.exports = { @@ -638,7 +638,7 @@ module.exports = { }, ], }, - plugins: [].concat(devMode ? [] : [new MiniCssExtractPlugin()]), + plugins: [devMode ? [] : [new MiniCssExtractPlugin()]].flat(), }; ``` @@ -702,7 +702,7 @@ module.exports = { **index.js** ```js -import { fooBaz, bar } from "./styles.css"; +import { bar, fooBaz } from "./styles.css"; console.log(fooBaz, bar); ``` @@ -767,12 +767,11 @@ module.exports = { { loader: MiniCssExtractPlugin.loader, options: { - publicPath: (resourcePath, context) => { + publicPath: (resourcePath, context) => // publicPath is the relative path of the resource to the context // e.g. for ./css/admin/main.css the publicPath will be ../../ // while for ./css/main.css the publicPath will be ../ - return path.relative(path.dirname(resourcePath), context) + "/"; - }, + `${path.relative(path.dirname(resourcePath), context)}/`, }, }, "css-loader", @@ -797,8 +796,9 @@ You should not use `HotModuleReplacementPlugin` plugin if you are using a `webpa **webpack.config.js** ```js -const webpack = require("webpack"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const webpack = require("webpack"); + const devMode = process.env.NODE_ENV !== "production"; const plugins = [ @@ -848,8 +848,8 @@ You should not use `HotModuleReplacementPlugin` plugin if you are using a `webpa **webpack.config.js** ```js -const webpack = require("webpack"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const webpack = require("webpack"); const plugins = [ new MiniCssExtractPlugin({ @@ -890,8 +890,8 @@ To minify the output, use a plugin like [css-minimizer-webpack-plugin](https://g **webpack.config.js** ```js -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { plugins: [ @@ -992,17 +992,13 @@ module.exports = { fooStyles: { type: "css/mini-extract", name: "styles_foo", - chunks: (chunk) => { - return chunk.name === "foo"; - }, + chunks: (chunk) => chunk.name === "foo", enforce: true, }, barStyles: { type: "css/mini-extract", name: "styles_bar", - chunks: (chunk) => { - return chunk.name === "bar"; - }, + chunks: (chunk) => chunk.name === "bar", enforce: true, }, }, @@ -1129,7 +1125,7 @@ module.exports = { { loader: "sass-loader", options: { - additionalData: `@use 'dark-theme/vars' as vars;`, + additionalData: "@use 'dark-theme/vars' as vars;", }, }, ], @@ -1141,7 +1137,7 @@ module.exports = { { loader: "sass-loader", options: { - additionalData: `@use 'light-theme/vars' as vars;`, + additionalData: "@use 'light-theme/vars' as vars;", }, }, ], @@ -1163,7 +1159,7 @@ module.exports = { **src/index.js** -```js +``` import "./style.scss"; let theme = "light"; @@ -1172,7 +1168,6 @@ const themes = {}; themes[theme] = document.querySelector("#theme"); async function loadTheme(newTheme) { - // eslint-disable-next-line no-console console.log(`CHANGE THEME - ${newTheme}`); const themeElement = document.querySelector("#theme"); @@ -1182,7 +1177,6 @@ async function loadTheme(newTheme) { } if (themes[newTheme]) { - // eslint-disable-next-line no-console console.log(`THEME ALREADY LOADED - ${newTheme}`); document.head.appendChild(themes[newTheme]); @@ -1191,13 +1185,11 @@ async function loadTheme(newTheme) { } if (newTheme === "dark") { - // eslint-disable-next-line no-console console.log(`LOADING THEME - ${newTheme}`); import(/* webpackChunkName: "dark" */ "./style.scss?dark").then(() => { themes[newTheme] = document.querySelector("#theme"); - // eslint-disable-next-line no-console console.log(`LOADED - ${newTheme}`); }); } @@ -1275,7 +1267,7 @@ MiniCssExtractPlugin.getCompilationHooks(compilation).beforeTagInsert.tap( Template.asString([ source, `${varNames.tag}.setAttribute("href", "https://github.com/webpack-contrib/mini-css-extract-plugin");`, - ]) + ]), ); ``` diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..927a18d1 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,14 @@ +import { defineConfig, globalIgnores } from "eslint/config"; +import configs from "eslint-config-webpack/configs.js"; + +export default defineConfig([ + globalIgnores([ + "test/**/cases/**/*", + "test/manual/**/*", + "!test/cases/webpack.config.js", + "test/js/**/*", + ]), + { + extends: [configs["recommended-dirty"]], + }, +]); diff --git a/jest.config.js b/jest.config.js index d22290e4..21b1b65d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,5 @@ module.exports = { + prettierPath: require.resolve("prettier-2"), transformIgnorePatterns: ["/node_modules/", "/dist/"], watchPathIgnorePatterns: ["/test/js"], setupFilesAfterEnv: ["/setupTest.js"], diff --git a/package-lock.json b/package-lock.json index 22c14e9c..7d59d390 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,13 +15,13 @@ "devDependencies": { "@babel/cli": "^7.24.1", "@babel/core": "^7.24.4", - "@babel/eslint-parser": "^7.24.1", "@babel/preset-env": "^7.24.4", "@commitlint/cli": "^17.5.1", "@commitlint/config-conventional": "^17.4.4", + "@eslint/js": "^9.32.0", + "@eslint/markdown": "^7.0.0", + "@stylistic/eslint-plugin": "^5.2.2", "@types/node": "^18.15.11", - "@webpack-contrib/eslint-config-webpack": "^3.0.0", - "babel-jest": "^28.1.3", "bootstrap": "^4.6.2", "cross-env": "^7.0.3", "cspell": "^6.31.1", @@ -29,10 +29,17 @@ "del": "^6.0.0", "del-cli": "^4.0.0", "es-check": "^7.1.0", - "eslint": "^8.37.0", - "eslint-config-prettier": "^8.8.0", - "eslint-plugin-import": "^2.27.5", + "eslint": "^9.32.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": "^52.0.0", + "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": "^7.0.0", "jest": "^28.1.3", "jest-environment-jsdom": "^28.1.3", @@ -40,11 +47,13 @@ "lint-staged": "^13.2.1", "memfs": "^3.4.13", "npm-run-all": "^4.1.5", - "prettier": "^2.8.7", + "prettier": "^3.6.0", + "prettier-2": "npm:prettier@^2", "sass": "^1.74.1", "sass-loader": "^12.6.0", "standard-version": "^9.3.0", - "typescript": "^4.9.5", + "typescript": "^5.8.0", + "typescript-eslint": "^8.38.0", "webpack": "^5.91.0", "webpack-cli": "^4.9.2", "webpack-dev-server": "^4.13.2" @@ -150,23 +159,6 @@ "url": "https://opencollective.com/babel" } }, - "node_modules/@babel/eslint-parser": { - "version": "7.28.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", - "eslint-visitor-keys": "^2.1.0", - "semver": "^6.3.1" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || >=14.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.11.0", - "eslint": "^7.5.0 || ^8.0.0 || ^9.0.0" - } - }, "node_modules/@babel/generator": { "version": "7.28.0", "dev": true, @@ -2301,6 +2293,23 @@ "node": ">=10.0.0" } }, + "node_modules/@es-joy/jsdoccomment": { + "version": "0.52.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.52.0.tgz", + "integrity": "sha512-BXuN7BII+8AyNtn57euU2Yxo9yA/KUDNzrpXyi3pfqKmBhhysR6ZWOebFh3vyPoqA3/j1SOvGgucElMGwlXing==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.8", + "@typescript-eslint/types": "^8.34.1", + "comment-parser": "1.4.1", + "esquery": "^1.6.0", + "jsdoc-type-pratt-parser": "~4.1.0" + }, + "engines": { + "node": ">=20.11.0" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.7.0", "dev": true, @@ -2337,15 +2346,55 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, + "node_modules/@eslint/config-array": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz", + "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.6", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.3.0.tgz", + "integrity": "sha512-ViuymvFmcJi04qdZeDc2whTHryouGcDlaxPqarTD0ZE10ISpxGUVZGZDx4w01upyIynL3iu6IXH2bS1NhclQMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.1.tgz", + "integrity": "sha512-bkOp+iumZCCbt1K1CmWf0R9pM5yKpDv+ZXtvSyQpudrI9kuFLp+bM2WOPXImuD/ceQuaa8f5pj93Y7zyECIGNA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@eslint/eslintrc": { - "version": "2.1.4", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", + "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", "dev": true, "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", + "espree": "^10.0.1", + "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -2353,7 +2402,7 @@ "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -2361,6 +2410,8 @@ }, "node_modules/@eslint/eslintrc/node_modules/ajv": { "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", "dependencies": { @@ -2376,11 +2427,28 @@ }, "node_modules/@eslint/eslintrc/node_modules/argparse": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, "license": "Python-2.0" }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@eslint/eslintrc/node_modules/js-yaml": { "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "license": "MIT", "dependencies": { @@ -2392,28 +2460,107 @@ }, "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true, "license": "MIT" }, "node_modules/@eslint/js": { - "version": "8.57.1", + "version": "9.32.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.32.0.tgz", + "integrity": "sha512-BBpRFZK3eX6uMLKz8WxFOBIFFcGFJ/g8XuwjTHCqHROSIsopI+ddn/d5Cfh36+7+e5edVS8dbSHnBNhrLEX0zg==", "dev": true, "license": "MIT", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.13.0", + "node_modules/@eslint/markdown": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@eslint/markdown/-/markdown-7.1.0.tgz", + "integrity": "sha512-Y+X1B1j+/zupKDVJfkKc8uYMjQkGzfnd8lt7vK3y8x9Br6H5dBuhAfFrQ6ff7HAMm/1BwgecyEiRFkYCWPRxmA==", + "dev": true, + "license": "MIT", + "workspaces": [ + "examples/*" + ], + "dependencies": { + "@eslint/core": "^0.15.1", + "@eslint/plugin-kit": "^0.3.4", + "github-slugger": "^2.0.0", + "mdast-util-from-markdown": "^2.0.2", + "mdast-util-frontmatter": "^2.0.1", + "mdast-util-gfm": "^3.1.0", + "micromark-extension-frontmatter": "^2.0.0", + "micromark-extension-gfm": "^3.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.4.tgz", + "integrity": "sha512-Ul5l+lHEcw3L5+k8POx6r74mxEYKG5kOb6Xpy2gCRW6zweT6TEhAf8vhxGgjhqrd/VO/Dirhsb+1hNpD1ue9hw==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@humanwhocodes/object-schema": "^2.0.3", - "debug": "^4.3.1", - "minimatch": "^3.0.5" + "@eslint/core": "^0.15.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" }, "engines": { - "node": ">=10.10.0" + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, "node_modules/@humanwhocodes/module-importer": { @@ -2428,10 +2575,19 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.3", + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", "dev": true, - "license": "BSD-3-Clause" + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } }, "node_modules/@hutson/parse-repository-url": { "version": "3.0.2", @@ -2873,14 +3029,6 @@ "license": "MIT", "optional": true }, - "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { - "version": "5.1.1-v1", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-scope": "5.1.1" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "dev": true, @@ -2967,6 +3115,19 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/@pkgr/core": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.2.9.tgz", + "integrity": "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/pkgr" + } + }, "node_modules/@rtsao/scc": { "version": "1.1.0", "dev": true, @@ -2993,6 +3154,63 @@ "@sinonjs/commons": "^1.7.0" } }, + "node_modules/@stylistic/eslint-plugin": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-5.2.2.tgz", + "integrity": "sha512-bE2DUjruqXlHYP3Q2Gpqiuj2bHq7/88FnuaS0FjeGGLCy+X6a07bGVuwtiOYnPSLHR6jmx5Bwdv+j7l8H+G97A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/types": "^8.37.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "estraverse": "^5.3.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": ">=9.0.0" + } + }, + "node_modules/@stylistic/eslint-plugin/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@stylistic/eslint-plugin/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/@stylistic/eslint-plugin/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@tootallnate/once": { "version": "2.0.0", "dev": true, @@ -3092,6 +3310,16 @@ "@types/node": "*" } }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, "node_modules/@types/eslint": { "version": "9.6.1", "dev": true, @@ -3209,6 +3437,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/mime": { "version": "1.3.5", "dev": true, @@ -3219,6 +3457,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "18.19.121", "dev": true, @@ -3315,6 +3560,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/ws": { "version": "8.18.1", "dev": true, @@ -3336,79 +3588,358 @@ "dev": true, "license": "MIT" }, - "node_modules/@ungap/structured-clone": { - "version": "1.3.0", - "dev": true, - "license": "ISC" - }, - "node_modules/@webassemblyjs/ast": { - "version": "1.14.1", + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.38.0.tgz", + "integrity": "sha512-CPoznzpuAnIOl4nhj4tRr4gIPj5AfKgkiJmGQDaq+fQnRJTYlcBjbX3wbciGmpoPf8DREufuPRe1tNMZnGdanA==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/helper-numbers": "1.13.2", - "@webassemblyjs/helper-wasm-bytecode": "1.13.2" + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.38.0", + "@typescript-eslint/type-utils": "8.38.0", + "@typescript-eslint/utils": "8.38.0", + "@typescript-eslint/visitor-keys": "8.38.0", + "graphemer": "^1.4.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.38.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" } }, - "node_modules/@webassemblyjs/floating-point-hex-parser": { - "version": "1.13.2", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-api-error": { - "version": "1.13.2", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-buffer": { - "version": "1.14.1", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">= 4" + } }, - "node_modules/@webassemblyjs/helper-numbers": { - "version": "1.13.2", + "node_modules/@typescript-eslint/parser": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.38.0.tgz", + "integrity": "sha512-Zhy8HCvBUEfBECzIl1PKqF4p11+d0aUJS1GeUiuqK9WmOug8YCmC4h4bjyBvMyAMI9sbRczmrYL5lKg/YMbrcQ==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/floating-point-hex-parser": "1.13.2", - "@webassemblyjs/helper-api-error": "1.13.2", - "@xtuc/long": "4.2.2" + "@typescript-eslint/scope-manager": "8.38.0", + "@typescript-eslint/types": "8.38.0", + "@typescript-eslint/typescript-estree": "8.38.0", + "@typescript-eslint/visitor-keys": "8.38.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" } }, - "node_modules/@webassemblyjs/helper-wasm-bytecode": { - "version": "1.13.2", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-wasm-section": { - "version": "1.14.1", + "node_modules/@typescript-eslint/project-service": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.38.0.tgz", + "integrity": "sha512-dbK7Jvqcb8c9QfH01YB6pORpqX1mn5gDZc9n63Ak/+jD67oWXn3Gs0M6vddAN+eDXBCS5EmNWzbSxsn9SzFWWg==", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.14.1", - "@webassemblyjs/helper-buffer": "1.14.1", - "@webassemblyjs/helper-wasm-bytecode": "1.13.2", - "@webassemblyjs/wasm-gen": "1.14.1" + "@typescript-eslint/tsconfig-utils": "^8.38.0", + "@typescript-eslint/types": "^8.38.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" } }, - "node_modules/@webassemblyjs/ieee754": { - "version": "1.13.2", + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.38.0.tgz", + "integrity": "sha512-WJw3AVlFFcdT9Ri1xs/lg8LwDqgekWXWhH3iAF+1ZM+QPd7oxQ6jvtW/JPwzAScxitILUIFs0/AnQ/UWHzbATQ==", "dev": true, "license": "MIT", "dependencies": { - "@xtuc/ieee754": "^1.2.0" + "@typescript-eslint/types": "8.38.0", + "@typescript-eslint/visitor-keys": "8.38.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@webassemblyjs/leb128": { - "version": "1.13.2", + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.38.0.tgz", + "integrity": "sha512-Lum9RtSE3EroKk/bYns+sPOodqb2Fv50XOl/gMviMKNvanETUuUcC9ObRbzrJ4VSd2JalPqgSAavwrPiPvnAiQ==", "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@xtuc/long": "4.2.2" + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" } }, - "node_modules/@webassemblyjs/utf8": { - "version": "1.13.2", + "node_modules/@typescript-eslint/type-utils": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.38.0.tgz", + "integrity": "sha512-c7jAvGEZVf0ao2z+nnz8BUaHZD09Agbh+DY7qvBQqLiz8uJzRgVPj5YvOh8I8uEiH8oIUGIfHzMwUcGVco/SJg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.38.0", + "@typescript-eslint/typescript-estree": "8.38.0", + "@typescript-eslint/utils": "8.38.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.38.0.tgz", + "integrity": "sha512-wzkUfX3plUqij4YwWaJyqhiPE5UCRVlFpKn1oCRn2O1bJ592XxWJj8ROQ3JD5MYXLORW84063z3tZTb/cs4Tyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.38.0.tgz", + "integrity": "sha512-fooELKcAKzxux6fA6pxOflpNS0jc+nOQEEOipXFNjSlBS6fqrJOVY/whSn70SScHrcJ2LDsxWrneFoWYSVfqhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.38.0", + "@typescript-eslint/tsconfig-utils": "8.38.0", + "@typescript-eslint/types": "8.38.0", + "@typescript-eslint/visitor-keys": "8.38.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.38.0.tgz", + "integrity": "sha512-hHcMA86Hgt+ijJlrD8fX0j1j8w4C92zue/8LOPAFioIno+W0+L7KqE8QZKCcPGc/92Vs9x36w/4MPTJhqXdyvg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.38.0", + "@typescript-eslint/types": "8.38.0", + "@typescript-eslint/typescript-estree": "8.38.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.38.0.tgz", + "integrity": "sha512-pWrTcoFNWuwHlA9CvlfSsGWs14JxfN1TH25zM5L7o0pRLhsoZkDnTsXfQRJBEWJoV5DL0jf+Z+sxiud+K0mq1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.38.0", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/helper-numbers": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.13.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.13.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.14.1", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.13.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.13.2", + "@webassemblyjs/helper-api-error": "1.13.2", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.13.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.13.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.13.2", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.13.2", "dev": true, "license": "MIT" }, @@ -3505,17 +4036,6 @@ } } }, - "node_modules/@webpack-contrib/eslint-config-webpack": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6.9.0 || >= 8.9.0" - }, - "peerDependencies": { - "eslint": ">= 5.0.0" - } - }, "node_modules/@xtuc/ieee754": { "version": "1.2.0", "dev": true, @@ -3584,6 +4104,8 @@ }, "node_modules/acorn-jsx": { "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "license": "MIT", "peerDependencies": { @@ -3735,6 +4257,16 @@ "node": ">= 8" } }, + "node_modules/are-docs-informative": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz", + "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/arg": { "version": "4.1.3", "dev": true, @@ -4216,6 +4748,19 @@ "dev": true, "license": "MIT" }, + "node_modules/builtin-modules": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-5.0.0.tgz", + "integrity": "sha512-bkXY9WsVpY7CvMhKSR6pZilZu9Ln5WDrKVBUXf2S443etkmEO4V58heTecXcUIsNsi4Rx8JUO4NfX1IcQl4deg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bytes": { "version": "3.1.2", "dev": true, @@ -4319,6 +4864,17 @@ ], "license": "CC-BY-4.0" }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/chalk": { "version": "4.1.2", "dev": true, @@ -4334,6 +4890,13 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/change-case": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.4.4.tgz", + "integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==", + "dev": true, + "license": "MIT" + }, "node_modules/char-regex": { "version": "1.0.2", "dev": true, @@ -4342,6 +4905,17 @@ "node": ">=10" } }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/chokidar": { "version": "3.6.0", "dev": true, @@ -4392,6 +4966,29 @@ "dev": true, "license": "MIT" }, + "node_modules/clean-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clean-regexp/-/clean-regexp-1.0.0.tgz", + "integrity": "sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/clean-regexp/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/clean-stack": { "version": "2.2.0", "dev": true, @@ -4621,6 +5218,16 @@ "node": ">= 6" } }, + "node_modules/comment-parser": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", + "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/compare-func": { "version": "2.0.0", "dev": true, @@ -5671,6 +6278,20 @@ "dev": true, "license": "MIT" }, + "node_modules/decode-named-character-reference": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz", + "integrity": "sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/dedent": { "version": "0.7.0", "dev": true, @@ -5974,6 +6595,16 @@ "node": ">= 0.8" } }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/destroy": { "version": "1.2.0", "dev": true, @@ -6016,6 +6647,20 @@ "dev": true, "license": "MIT" }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/diff": { "version": "4.0.2", "dev": true, @@ -6054,19 +6699,8 @@ "node": ">=6" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/domexception": { - "version": "4.0.0", + "node_modules/domexception": { + "version": "4.0.0", "dev": true, "license": "MIT", "dependencies": { @@ -6484,70 +7118,191 @@ } }, "node_modules/eslint": { - "version": "8.57.1", + "version": "9.32.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.32.0.tgz", + "integrity": "sha512-LSehfdpgMeWcTZkWZVIJl+tkZ2nuSkyyB9C27MZqFWXuph7DvaowgcTvKqxvpLW1JZIk8PN7hFY3Rj9LQ7m7lg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.1", - "@humanwhocodes/config-array": "^0.13.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.0", + "@eslint/config-helpers": "^0.3.0", + "@eslint/core": "^0.15.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.32.0", + "@eslint/plugin-kit": "^0.3.4", + "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.6", "debug": "^4.3.2", - "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", + "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-compat-utils": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/eslint-compat-utils/-/eslint-compat-utils-0.5.1.tgz", + "integrity": "sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, + "node_modules/eslint-compat-utils/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/eslint-config-prettier": { - "version": "8.10.2", + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", "dev": true, "license": "MIT", "bin": { "eslint-config-prettier": "bin/cli.js" }, + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, "peerDependencies": { "eslint": ">=7.0.0" } }, + "node_modules/eslint-config-webpack": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/eslint-config-webpack/-/eslint-config-webpack-4.5.1.tgz", + "integrity": "sha512-Qiq0PSjx7P1ncI9PCTvfW8c76OqkXAFr91TQGa+u1FAMHXMur3in8hwL7fXYPi2oF8ytI1Zuoc2TmDzX0ZO4tA==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-indent": "^7.0.1", + "jsonc-eslint-parser": "^2.4.0", + "semver": "^7.7.2", + "sort-package-json": "^3.4.0" + }, + "engines": { + "node": ">= 20.9.0" + }, + "peerDependencies": { + "@eslint/js": ">= 9.28.0", + "@eslint/markdown": ">= 7.1.0", + "@stylistic/eslint-plugin": ">= 4.4.1", + "eslint": ">= 9.28.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-import": ">= 2.31.0", + "eslint-plugin-jest": ">= 28.12.0", + "eslint-plugin-jsdoc": ">= 50.7.1", + "eslint-plugin-n": ">= 17.19.0", + "eslint-plugin-prettier": ">= 5.5.3", + "eslint-plugin-react": ">= 7.37.5", + "eslint-plugin-unicorn": ">= 60.0.0", + "globals": ">= 16.2.0", + "prettier": ">= 3.5.3", + "typescript": ">= 5.0.0", + "typescript-eslint": ">= 8.34.0" + }, + "peerDependenciesMeta": { + "@eslint/markdown": { + "optional": true + }, + "eslint-plugin-jest": { + "optional": true + }, + "eslint-plugin-jsdoc": { + "optional": true + }, + "eslint-plugin-n": { + "optional": true + }, + "eslint-plugin-react": { + "optional": true + }, + "typescript": { + "optional": true + }, + "typescript-eslint": { + "optional": true + } + } + }, + "node_modules/eslint-config-webpack/node_modules/detect-indent": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-7.0.1.tgz", + "integrity": "sha512-Mc7QhQ8s+cLrnUfU/Ji94vG/r8M26m8f++vyres4ZoojaRDpZ1eSIh/EpzLNwlWuvzSZ3UbDFspjFvTDXe6e/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.20" + } + }, + "node_modules/eslint-config-webpack/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "dev": true, @@ -6590,6 +7345,28 @@ "ms": "^2.1.1" } }, + "node_modules/eslint-plugin-es-x": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.8.0.tgz", + "integrity": "sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==", + "dev": true, + "funding": [ + "https://github.com/sponsors/ota-meshi", + "https://opencollective.com/eslint" + ], + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.1.2", + "@eslint-community/regexpp": "^4.11.0", + "eslint-compat-utils": "^0.5.1" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": ">=8" + } + }, "node_modules/eslint-plugin-import": { "version": "2.32.0", "dev": true, @@ -6641,150 +7418,429 @@ "node": ">=0.10.0" } }, - "node_modules/eslint-scope": { - "version": "5.1.1", + "node_modules/eslint-plugin-jest": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-29.0.1.tgz", + "integrity": "sha512-EE44T0OSMCeXhDrrdsbKAhprobKkPtJTbQz5yEktysNpHeDZTAL1SfDTNKmcFfJkY6yrQLtTKZALrD3j/Gpmiw==", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "@typescript-eslint/utils": "^8.0.0" }, "engines": { - "node": ">=8.0.0" + "node": "^20.12.0 || ^22.0.0 || >=24.0.0" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": "^8.0.0", + "eslint": "^8.57.0 || ^9.0.0", + "jest": "*" + }, + "peerDependenciesMeta": { + "@typescript-eslint/eslint-plugin": { + "optional": true + }, + "jest": { + "optional": true + } } }, - "node_modules/eslint-visitor-keys": { - "version": "2.1.0", + "node_modules/eslint-plugin-jsdoc": { + "version": "52.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-52.0.2.tgz", + "integrity": "sha512-fYrnc7OpRifxxKjH78Y9/D/EouQDYD3G++bpR1Y+A+fy+CMzKZAdGIiHTIxCd2U10hb2y1NxN5TJt9aupq1vmw==", "dev": true, - "license": "Apache-2.0", + "license": "BSD-3-Clause", + "dependencies": { + "@es-joy/jsdoccomment": "~0.52.0", + "are-docs-informative": "^0.0.2", + "comment-parser": "1.4.1", + "debug": "^4.4.1", + "escape-string-regexp": "^4.0.0", + "espree": "^10.4.0", + "esquery": "^1.6.0", + "parse-imports-exports": "^0.2.4", + "semver": "^7.7.2", + "spdx-expression-parse": "^4.0.0" + }, "engines": { - "node": ">=10" + "node": ">=20.11.0" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" } }, - "node_modules/eslint/node_modules/ajv": { - "version": "6.12.6", + "node_modules/eslint-plugin-jsdoc/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "license": "ISC", + "bin": { + "semver": "bin/semver.js" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "engines": { + "node": ">=10" } }, - "node_modules/eslint/node_modules/argparse": { - "version": "2.0.1", + "node_modules/eslint-plugin-jsdoc/node_modules/spdx-expression-parse": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz", + "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==", "dev": true, - "license": "Python-2.0" + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.2.2", + "node_modules/eslint-plugin-n": { + "version": "17.21.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-17.21.3.tgz", + "integrity": "sha512-MtxYjDZhMQgsWRm/4xYLL0i2EhusWT7itDxlJ80l1NND2AL2Vi5Mvneqv/ikG9+zpran0VsVRXTEHrpLmUZRNw==", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" + "@eslint-community/eslint-utils": "^4.5.0", + "enhanced-resolve": "^5.17.1", + "eslint-plugin-es-x": "^7.8.0", + "get-tsconfig": "^4.8.1", + "globals": "^15.11.0", + "globrex": "^0.1.2", + "ignore": "^5.3.2", + "semver": "^7.6.3", + "ts-declaration-location": "^1.0.6" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": ">=8.23.0" } }, - "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "3.4.3", + "node_modules/eslint-plugin-n/node_modules/globals": { + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", "dev": true, - "license": "Apache-2.0", + "license": "MIT", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=18" }, "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/estraverse": { - "version": "5.3.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/glob-parent": { - "version": "6.0.2", + "node_modules/eslint-plugin-n/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", "dev": true, "license": "ISC", - "dependencies": { - "is-glob": "^4.0.3" + "bin": { + "semver": "bin/semver.js" }, "engines": { - "node": ">=10.13.0" + "node": ">=10" } }, - "node_modules/eslint/node_modules/js-yaml": { - "version": "4.1.0", + "node_modules/eslint-plugin-prettier": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.3.tgz", + "integrity": "sha512-NAdMYww51ehKfDyDhv59/eIItUVzU0Io9H2E8nHNGKEeeqlnci+1gCvrHib6EmZdf6GxF+LCV5K7UC65Ezvw7w==", "dev": true, "license": "MIT", "dependencies": { - "argparse": "^2.0.1" + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.11.7" }, - "bin": { - "js-yaml": "bin/js-yaml.js" + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } } }, - "node_modules/eslint/node_modules/json-schema-traverse": { - "version": "0.4.1", - "dev": true, - "license": "MIT" - }, - "node_modules/espree": { - "version": "9.6.1", + "node_modules/eslint-plugin-unicorn": { + "version": "60.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-60.0.0.tgz", + "integrity": "sha512-QUzTefvP8stfSXsqKQ+vBQSEsXIlAiCduS/V1Em+FKgL9c21U/IIm20/e3MFy1jyCf14tHAhqC1sX8OTy6VUCg==", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "@babel/helper-validator-identifier": "^7.27.1", + "@eslint-community/eslint-utils": "^4.7.0", + "@eslint/plugin-kit": "^0.3.3", + "change-case": "^5.4.4", + "ci-info": "^4.3.0", + "clean-regexp": "^1.0.0", + "core-js-compat": "^3.44.0", + "esquery": "^1.6.0", + "find-up-simple": "^1.0.1", + "globals": "^16.3.0", + "indent-string": "^5.0.0", + "is-builtin-module": "^5.0.0", + "jsesc": "^3.1.0", + "pluralize": "^8.0.0", + "regexp-tree": "^0.1.27", + "regjsparser": "^0.12.0", + "semver": "^7.7.2", + "strip-indent": "^4.0.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^20.10.0 || >=21.0.0" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" + }, + "peerDependencies": { + "eslint": ">=9.29.0" } }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "3.4.3", + "node_modules/eslint-plugin-unicorn/node_modules/ci-info": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.0.tgz", + "integrity": "sha512-l+2bNRMiQgcfILUi33labAZYIWlH1kWDp+ecNo5iisRKrbm0xcRyCww71/YU0Fkw0mAFpz9bJayXPjey6vkmaQ==", "dev": true, - "license": "Apache-2.0", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=8" + } + }, + "node_modules/eslint-plugin-unicorn/node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esprima": { - "version": "4.0.1", + "node_modules/eslint-plugin-unicorn/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", "dev": true, - "license": "BSD-2-Clause", + "license": "ISC", "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" + "semver": "bin/semver.js" }, "engines": { - "node": ">=4" + "node": ">=10" } }, - "node_modules/esquery": { - "version": "1.6.0", + "node_modules/eslint-plugin-unicorn/node_modules/strip-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-4.0.0.tgz", + "integrity": "sha512-mnVSV2l+Zv6BLpSD/8V87CW/y9EmmbYzGCIavsnsI6/nwn26DwffM/yztm30Z/I2DY9wdS3vXVCMnHDgZaVNoA==", "dev": true, - "license": "BSD-3-Clause", + "license": "MIT", + "dependencies": { + "min-indent": "^1.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint/node_modules/ajv": { + "version": "6.12.6", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint/node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/eslint/node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/json-schema-traverse": { + "version": "0.4.1", + "dev": true, + "license": "MIT" + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "dev": true, + "license": "BSD-3-Clause", "dependencies": { "estraverse": "^5.1.0" }, @@ -6962,6 +8018,13 @@ "version": "3.1.3", "license": "MIT" }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/fast-equals": { "version": "4.0.3", "dev": true, @@ -7022,6 +8085,20 @@ "reusify": "^1.0.4" } }, + "node_modules/fault": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fault/-/fault-2.0.1.tgz", + "integrity": "sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "format": "^0.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/faye-websocket": { "version": "0.11.4", "dev": true, @@ -7199,6 +8276,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-up-simple": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.1.tgz", + "integrity": "sha512-afd4O7zpqHeRyg4PfDQsXmlDe2PfdHtJt6Akt8jOWaApLOZk5JXs6VMR29lz03pRe9mpykrRCYIYxaJYcfpncQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/flat": { "version": "5.0.2", "dev": true, @@ -7278,6 +8368,15 @@ "node": ">= 6" } }, + "node_modules/format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", + "dev": true, + "engines": { + "node": ">=0.4.x" + } + }, "node_modules/forwarded": { "version": "0.2.0", "dev": true, @@ -7589,6 +8688,29 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.1.tgz", + "integrity": "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/git-hooks-list": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/git-hooks-list/-/git-hooks-list-4.1.1.tgz", + "integrity": "sha512-cmP497iLq54AZnv4YRAEMnEyQ1eIn4tGKbmswqwmFV4GBnAqE8NLtWxxdXa++AalfgL5EBH4IxTPyquEuGY/jA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/fisker/git-hooks-list?sponsor=1" + } + }, "node_modules/git-raw-commits": { "version": "2.0.11", "dev": true, @@ -7650,6 +8772,13 @@ "ini": "^1.3.2" } }, + "node_modules/github-slugger": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz", + "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==", + "dev": true, + "license": "ISC" + }, "node_modules/glob": { "version": "7.2.3", "dev": true, @@ -7697,14 +8826,13 @@ } }, "node_modules/globals": { - "version": "13.24.0", + "version": "16.3.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.3.0.tgz", + "integrity": "sha512-bqWEnJ1Nt3neqx2q5SFfGS8r/ahumIakg3HcwtNlrVlwXIeNumWn/c7Pn/wKzGhf6SaW6H6uWXLqC30STCMchQ==", "dev": true, "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -7752,6 +8880,13 @@ "node": ">=8" } }, + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dev": true, + "license": "MIT" + }, "node_modules/gopd": { "version": "1.2.0", "dev": true, @@ -7770,6 +8905,8 @@ }, "node_modules/graphemer": { "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true, "license": "MIT" }, @@ -8358,6 +9495,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-builtin-module": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-5.0.0.tgz", + "integrity": "sha512-f4RqJKBUe5rQkJ2eJEJBXSticB3hGbN9j0yxxMQFqIW89Jp9WYFtzfTcRlstDKVUTRzSOTLKRfO9vIztenwtxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "builtin-modules": "^5.0.0" + }, + "engines": { + "node": ">=18.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-callable": { "version": "1.2.7", "dev": true, @@ -9478,6 +10631,16 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsdoc-type-pratt-parser": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.1.0.tgz", + "integrity": "sha512-Hicd6JK5Njt2QB6XYFS7ok9e37O8AYk3jTcppG4YVQnYjOemymvTcmc7OWsmq/Qqj5TdRFO5/x/tIPmBeRtGHg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/jsdom": { "version": "19.0.0", "dev": true, @@ -9574,32 +10737,95 @@ "node": ">=6" } }, - "node_modules/jsonfile": { - "version": "6.1.0", + "node_modules/jsonc-eslint-parser": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonc-eslint-parser/-/jsonc-eslint-parser-2.4.0.tgz", + "integrity": "sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==", "dev": true, "license": "MIT", "dependencies": { - "universalify": "^2.0.0" + "acorn": "^8.5.0", + "eslint-visitor-keys": "^3.0.0", + "espree": "^9.0.0", + "semver": "^7.3.5" }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" } }, - "node_modules/jsonparse": { - "version": "1.3.1", + "node_modules/jsonc-eslint-parser/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, - "engines": [ - "node >= 0.2.0" - ], - "license": "MIT" + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } }, - "node_modules/JSONStream": { - "version": "1.3.5", + "node_modules/jsonc-eslint-parser/node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, - "license": "(MIT OR Apache-2.0)", + "license": "BSD-2-Clause", "dependencies": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/jsonc-eslint-parser/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "dev": true, + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT" + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "dev": true, + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" }, "bin": { "JSONStream": "bin.js" @@ -10117,6 +11343,17 @@ "node": ">= 12.0.0" } }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/lru-cache": { "version": "5.1.1", "dev": true, @@ -10169,6 +11406,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/markdown-table": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", + "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/math-intrinsics": { "version": "1.1.0", "dev": true, @@ -10177,6 +11425,251 @@ "node": ">= 0.4" } }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz", + "integrity": "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", + "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-frontmatter": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-frontmatter/-/mdast-util-frontmatter-2.0.1.tgz", + "integrity": "sha512-LRqI9+wdgC25P0URIJY9vwocIzCcksduHQ9OF2joxQoyTNVduwLAFUzjoopuRJbJAReaKrNQKAZKL3uCMugWJA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "escape-string-regexp": "^5.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-extension-frontmatter": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-frontmatter/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mdast-util-gfm": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", + "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", + "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", + "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", + "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", + "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/media-typer": { "version": "0.3.0", "dev": true, @@ -10259,13 +11752,621 @@ "node": ">= 8" } }, - "node_modules/methods": { - "version": "1.1.2", + "node_modules/methods": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-frontmatter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-frontmatter/-/micromark-extension-frontmatter-2.0.0.tgz", + "integrity": "sha512-C4AkuM3dA58cgZha7zVnuVxBhDsbttIMiytjgsM2XbHAB2faRVaHRle40558FBN+DJcrLNCoqG5mlrpdU4cRtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "fault": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", + "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", + "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", + "dev": true, + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", + "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", + "dev": true, + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz", + "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", + "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", + "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" }, "node_modules/micromatch": { "version": "4.0.8", @@ -10958,6 +13059,16 @@ "node": ">=8" } }, + "node_modules/parse-imports-exports": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/parse-imports-exports/-/parse-imports-exports-0.2.4.tgz", + "integrity": "sha512-4s6vd6dx1AotCx/RCI2m7t7GCh5bDRUtGNvRfHSP2wbBQdMi67pPe7mtzmgwcaQ8VKK/6IB7Glfyu3qdZJPybQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parse-statements": "1.0.11" + } + }, "node_modules/parse-json": { "version": "5.2.0", "dev": true, @@ -10975,6 +13086,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse-statements": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/parse-statements/-/parse-statements-1.0.11.tgz", + "integrity": "sha512-HlsyYdMBnbPQ9Jr/VgJ1YF4scnldvJpJxCVx6KgqPL4dxppsWrJHCIIxQXMJrqGnsRkNPATbeMJ8Yxu7JMsYcA==", + "dev": true, + "license": "MIT" + }, "node_modules/parse5": { "version": "6.0.1", "dev": true, @@ -11132,6 +13250,16 @@ "node": ">=8" } }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/popper.js": { "version": "1.16.1", "dev": true, @@ -11258,7 +13386,26 @@ } }, "node_modules/prettier": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", + "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-2": { + "name": "prettier", "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, "license": "MIT", "bin": { @@ -11271,6 +13418,19 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/pretty-format": { "version": "28.1.3", "dev": true, @@ -11700,6 +13860,16 @@ "node": ">=4" } }, + "node_modules/regexp-tree": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.27.tgz", + "integrity": "sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==", + "dev": true, + "license": "MIT", + "bin": { + "regexp-tree": "bin/regexp-tree" + } + }, "node_modules/regexp.prototype.flags": { "version": "1.5.4", "dev": true, @@ -11839,6 +14009,16 @@ "node": ">=8" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/resolve.exports": { "version": "1.1.1", "dev": true, @@ -12496,6 +14676,84 @@ "websocket-driver": "^0.7.4" } }, + "node_modules/sort-object-keys": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sort-object-keys/-/sort-object-keys-1.1.3.tgz", + "integrity": "sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/sort-package-json": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/sort-package-json/-/sort-package-json-3.4.0.tgz", + "integrity": "sha512-97oFRRMM2/Js4oEA9LJhjyMlde+2ewpZQf53pgue27UkbEXfHJnDzHlUxQ/DWUkzqmp7DFwJp8D+wi/TYeQhpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-indent": "^7.0.1", + "detect-newline": "^4.0.1", + "git-hooks-list": "^4.0.0", + "is-plain-obj": "^4.1.0", + "semver": "^7.7.1", + "sort-object-keys": "^1.1.3", + "tinyglobby": "^0.2.12" + }, + "bin": { + "sort-package-json": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/sort-package-json/node_modules/detect-indent": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-7.0.1.tgz", + "integrity": "sha512-Mc7QhQ8s+cLrnUfU/Ji94vG/r8M26m8f++vyres4ZoojaRDpZ1eSIh/EpzLNwlWuvzSZ3UbDFspjFvTDXe6e/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.20" + } + }, + "node_modules/sort-package-json/node_modules/detect-newline": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-4.0.1.tgz", + "integrity": "sha512-qE3Veg1YXzGHQhlA6jzebZN2qVf6NX+A7m7qlhCGG30dJixrAQhYOsJjsnBjJkCSmuOPpCk30145fr8FV0bzog==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/sort-package-json/node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/sort-package-json/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/source-map": { "version": "0.6.1", "dev": true, @@ -13094,6 +15352,22 @@ "dev": true, "license": "MIT" }, + "node_modules/synckit": { + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.11.11.tgz", + "integrity": "sha512-MeQTA1r0litLUf0Rp/iisCaL8761lKAZHaimlbGK4j0HysC4PLfqygQj9srcs0m2RdtDYnF8UuYyKpbjHYp7Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pkgr/core": "^0.2.9" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/synckit" + } + }, "node_modules/tapable": { "version": "2.2.2", "license": "MIT", @@ -13244,11 +15518,6 @@ "dev": true, "license": "MIT" }, - "node_modules/text-table": { - "version": "0.2.0", - "dev": true, - "license": "MIT" - }, "node_modules/through": { "version": "2.3.8", "dev": true, @@ -13267,6 +15536,51 @@ "dev": true, "license": "MIT" }, + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/tmpl": { "version": "1.0.5", "dev": true, @@ -13340,6 +15654,55 @@ "node": ">= 14.0.0" } }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/ts-declaration-location": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/ts-declaration-location/-/ts-declaration-location-1.0.7.tgz", + "integrity": "sha512-EDyGAwH1gO0Ausm9gV6T2nUvBgXT5kGoCMJPllOaooZ+4VvJiKBdZE7wK18N1deEowhcUptS+5GXZK8U/fvpwA==", + "dev": true, + "funding": [ + { + "type": "ko-fi", + "url": "https://ko-fi.com/rebeccastevens" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/ts-declaration-location" + } + ], + "license": "BSD-3-Clause", + "dependencies": { + "picomatch": "^4.0.2" + }, + "peerDependencies": { + "typescript": ">=4.0.0" + } + }, + "node_modules/ts-declaration-location/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/ts-node": { "version": "10.9.2", "dev": true, @@ -13442,17 +15805,6 @@ "node": ">=4" } }, - "node_modules/type-fest": { - "version": "0.20.2", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/type-is": { "version": "1.6.18", "dev": true, @@ -13549,7 +15901,9 @@ } }, "node_modules/typescript": { - "version": "4.9.5", + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -13557,7 +15911,31 @@ "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.38.0.tgz", + "integrity": "sha512-FsZlrYK6bPDGoLeZRuvx2v6qrM03I0U0SnfCLPs/XCCPCFD80xU9Pg09H/K+XFa68uJuZo7l/Xhs+eDRg2l3hg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.38.0", + "@typescript-eslint/parser": "8.38.0", + "@typescript-eslint/typescript-estree": "8.38.0", + "@typescript-eslint/utils": "8.38.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" } }, "node_modules/uglify-js": { @@ -13641,6 +16019,65 @@ "node": ">=8" } }, + "node_modules/unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/universalify": { "version": "2.0.1", "dev": true, @@ -14474,6 +16911,17 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } } } } diff --git a/package.json b/package.json index b25b5a91..39c23f4e 100644 --- a/package.json +++ b/package.json @@ -2,20 +2,27 @@ "name": "mini-css-extract-plugin", "version": "2.9.3", "description": "extracts CSS into separate files", - "license": "MIT", - "repository": "webpack-contrib/mini-css-extract-plugin", - "author": "Tobias Koppers @sokra", + "keywords": [ + "webpack", + "css", + "extract", + "hmr" + ], "homepage": "https://github.com/webpack-contrib/mini-css-extract-plugin", "bugs": "https://github.com/webpack-contrib/mini-css-extract-plugin/issues", + "repository": "webpack-contrib/mini-css-extract-plugin", "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, + "license": "MIT", + "author": "Tobias Koppers @sokra", "main": "dist/index.js", "types": "types/index.d.ts", - "engines": { - "node": ">= 12.13.0" - }, + "files": [ + "dist", + "types" + ], "scripts": { "start": "npm run build -- -w", "prebuild": "npm run clean", @@ -25,14 +32,14 @@ "clean": "del-cli dist", "commitlint": "commitlint --from=master", "lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different", - "lint:js": "eslint --cache .", + "lint:code": "eslint --cache .", "lint:spelling": "cspell \"**/*.*\"", "lint:types": "tsc --pretty --noEmit", "lint:es-check": "es-check es5 dist/hmr/hotModuleReplacement.js", "lint": "npm-run-all -l -p \"lint:**\"", - "fix:js": "npm run lint:js -- --fix", + "fix:code": "npm run lint:code -- --fix", "fix:prettier": "npm run lint:prettier -- --write", - "fix": "npm-run-all -l fix:js fix:prettier", + "fix": "npm-run-all -l fix:code fix:prettier", "prepare": "husky install && npm run build", "release": "standard-version", "security": "npm audit --production", @@ -44,13 +51,6 @@ "pretest": "npm run lint", "test": "cross-env NODE_ENV=test npm run test:coverage" }, - "files": [ - "dist", - "types" - ], - "peerDependencies": { - "webpack": "^5.0.0" - }, "dependencies": { "schema-utils": "^4.0.0", "tapable": "^2.2.1" @@ -58,13 +58,13 @@ "devDependencies": { "@babel/cli": "^7.24.1", "@babel/core": "^7.24.4", - "@babel/eslint-parser": "^7.24.1", "@babel/preset-env": "^7.24.4", "@commitlint/cli": "^17.5.1", "@commitlint/config-conventional": "^17.4.4", + "@eslint/js": "^9.32.0", + "@eslint/markdown": "^7.0.0", + "@stylistic/eslint-plugin": "^5.2.2", "@types/node": "^18.15.11", - "@webpack-contrib/eslint-config-webpack": "^3.0.0", - "babel-jest": "^28.1.3", "bootstrap": "^4.6.2", "cross-env": "^7.0.3", "cspell": "^6.31.1", @@ -72,10 +72,17 @@ "del": "^6.0.0", "del-cli": "^4.0.0", "es-check": "^7.1.0", - "eslint": "^8.37.0", - "eslint-config-prettier": "^8.8.0", - "eslint-plugin-import": "^2.27.5", + "eslint": "^9.32.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": "^52.0.0", + "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": "^7.0.0", "jest": "^28.1.3", "jest-environment-jsdom": "^28.1.3", @@ -83,19 +90,21 @@ "lint-staged": "^13.2.1", "memfs": "^3.4.13", "npm-run-all": "^4.1.5", - "prettier": "^2.8.7", + "prettier": "^3.6.0", + "prettier-2": "npm:prettier@^2", "sass": "^1.74.1", "sass-loader": "^12.6.0", "standard-version": "^9.3.0", - "typescript": "^4.9.5", + "typescript": "^5.8.0", + "typescript-eslint": "^8.38.0", "webpack": "^5.91.0", "webpack-cli": "^4.9.2", "webpack-dev-server": "^4.13.2" }, - "keywords": [ - "webpack", - "css", - "extract", - "hmr" - ] + "peerDependencies": { + "webpack": "^5.0.0" + }, + "engines": { + "node": ">= 12.13.0" + } } diff --git a/setupTest.js b/setupTest.js index 5573471a..dfedd5cc 100644 --- a/setupTest.js +++ b/setupTest.js @@ -1 +1,3 @@ +/* global jest */ + jest.setTimeout(25000); diff --git a/src/hmr/hotModuleReplacement.js b/src/hmr/hotModuleReplacement.js index 58cc2d79..26075537 100644 --- a/src/hmr/hotModuleReplacement.js +++ b/src/hmr/hotModuleReplacement.js @@ -1,10 +1,11 @@ -/* eslint-env browser */ +/* global document */ /* eslint-disable no-console, func-names */ +// eslint-disable-next-line jsdoc/no-restricted-syntax /** @typedef {any} TODO */ const normalizeUrl = require("./normalize-url"); @@ -15,36 +16,40 @@ const noDocument = typeof document === "undefined"; const { forEach } = Array.prototype; +// eslint-disable-next-line jsdoc/no-restricted-syntax /** - * @param {function} fn - * @param {number} time - * @returns {(function(): void)|*} + * @param {Function} fn any function + * @param {number} time time + * @returns {() => void} wrapped function */ function debounce(fn, time) { let timeout = 0; return function () { - // @ts-ignore + // @ts-expect-error const self = this; // eslint-disable-next-line prefer-rest-params const args = arguments; - + // eslint-disable-next-line func-style const functionCall = function functionCall() { return fn.apply(self, args); }; clearTimeout(timeout); - // @ts-ignore + // @ts-expect-error timeout = setTimeout(functionCall, time); }; } +/** + * @returns {void} + */ function noop() {} /** - * @param {TODO} moduleId - * @returns {TODO} + * @param {string | number} moduleId a module id + * @returns {TODO} current script url */ function getCurrentScriptUrl(moduleId) { let src = srcByModuleId[moduleId]; @@ -65,8 +70,8 @@ function getCurrentScriptUrl(moduleId) { } /** - * @param {string} fileMap - * @returns {null | string[]} + * @param {string} fileMap file map + * @returns {null | string[]} normalized files */ return function (fileMap) { if (!src) { @@ -88,15 +93,30 @@ function getCurrentScriptUrl(moduleId) { const reg = new RegExp(`${filename}\\.js$`, "g"); return normalizeUrl( - src.replace(reg, `${mapRule.replace(/{fileName}/g, filename)}.css`) + src.replace(reg, `${mapRule.replace(/{fileName}/g, filename)}.css`), ); }); }; } /** - * @param {TODO} el - * @param {string} [url] + * @param {string} url URL + * @returns {boolean} true when URL can be request, otherwise false + */ +function isUrlRequest(url) { + // An URL is not an request if + + // It is not http or https + if (!/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url)) { + return false; + } + + return true; +} + +/** + * @param {TODO} el html link element + * @param {string=} url a URL */ function updateCss(el, url) { if (!url) { @@ -118,11 +138,11 @@ function updateCss(el, url) { return; } + // eslint-disable-next-line unicorn/prefer-includes if (!url || !(url.indexOf(".css") > -1)) { return; } - // eslint-disable-next-line no-param-reassign el.visited = true; const newEl = el.cloneNode(); @@ -157,34 +177,34 @@ function updateCss(el, url) { } /** - * @param {string} href - * @param {TODO} src - * @returns {TODO} + * @param {string} href href + * @param {TODO} src src + * @returns {undefined | string} a reload url */ function getReloadUrl(href, src) { let ret; - // eslint-disable-next-line no-param-reassign href = normalizeUrl(href); src.some( /** - * @param {string} url + * @param {string} url url */ // eslint-disable-next-line array-callback-return (url) => { + // eslint-disable-next-line unicorn/prefer-includes if (href.indexOf(src) > -1) { ret = url; } - } + }, ); return ret; } /** - * @param {string} [src] - * @returns {boolean} + * @param {string=} src source + * @returns {boolean} true when loaded, otherwise false */ function reloadStyle(src) { if (!src) { @@ -201,7 +221,7 @@ function reloadStyle(src) { const url = getReloadUrl(el.href, src); - if (!isUrlRequest(url)) { + if (url && !isUrlRequest(url)) { return; } @@ -219,6 +239,9 @@ function reloadStyle(src) { return loaded; } +/** + * @returns {void} + */ function reloadAll() { const elements = document.querySelectorAll("link"); @@ -232,24 +255,9 @@ function reloadAll() { } /** - * @param {string} url - * @returns {boolean} - */ -function isUrlRequest(url) { - // An URL is not an request if - - // It is not http or https - if (!/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url)) { - return false; - } - - return true; -} - -/** - * @param {TODO} moduleId - * @param {TODO} options - * @returns {TODO} + * @param {number | string} moduleId a module id + * @param {TODO} options options + * @returns {TODO} wrapper function */ module.exports = function (moduleId, options) { if (noDocument) { @@ -260,6 +268,9 @@ module.exports = function (moduleId, options) { const getScriptSrc = getCurrentScriptUrl(moduleId); + /** + * @returns {void} + */ function update() { const src = getScriptSrc(options.filename); const reloaded = reloadStyle(src); diff --git a/src/hmr/normalize-url.js b/src/hmr/normalize-url.js index 0ccd73b2..ed634452 100644 --- a/src/hmr/normalize-url.js +++ b/src/hmr/normalize-url.js @@ -1,12 +1,10 @@ -/* eslint-disable */ - /** - * @param {string[]} pathComponents - * @returns {string} + * @param {string[]} pathComponents path components + * @returns {string} normalized url */ -function normalizeUrl(pathComponents) { +function normalizeUrlInner(pathComponents) { return pathComponents - .reduce(function (accumulator, item) { + .reduce((accumulator, item) => { switch (item) { case "..": accumulator.pop(); @@ -23,24 +21,27 @@ function normalizeUrl(pathComponents) { } /** - * @param {string} urlString - * @returns {string} + * @param {string} urlString url string + * @returns {string} normalized url string */ -module.exports = function (urlString) { +module.exports = function normalizeUrl(urlString) { urlString = urlString.trim(); if (/^data:/i.test(urlString)) { return urlString; } - var protocol = - urlString.indexOf("//") !== -1 ? urlString.split("//")[0] + "//" : ""; - var components = urlString.replace(new RegExp(protocol, "i"), "").split("/"); - var host = components[0].toLowerCase().replace(/\.$/, ""); + const protocol = + // eslint-disable-next-line unicorn/prefer-includes + urlString.indexOf("//") !== -1 ? `${urlString.split("//")[0]}//` : ""; + const components = urlString + .replace(new RegExp(protocol, "i"), "") + .split("/"); + const host = components[0].toLowerCase().replace(/\.$/, ""); components[0] = ""; - var path = normalizeUrl(components); + const path = normalizeUrlInner(components); return protocol + host + path; }; diff --git a/src/index.js b/src/index.js index e56ff713..19329234 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,3 @@ -/* eslint-disable class-methods-use-this */ - const path = require("path"); const { validate } = require("schema-utils"); @@ -7,15 +5,15 @@ const { SyncWaterfallHook } = require("tapable"); const schema = require("./plugin-options.json"); const { - trueFn, - MODULE_TYPE, - AUTO_PUBLIC_PATH, ABSOLUTE_PUBLIC_PATH, + AUTO_PUBLIC_PATH, + BASE_URI, + MODULE_TYPE, SINGLE_DOT_PATH_SEGMENT, compareModulesByIdentifier, - getUndoPath, - BASE_URI, compileBooleanMatcher, + getUndoPath, + trueFn, } = require("./utils"); /** @typedef {import("schema-utils/declarations/validate").Schema} Schema */ @@ -33,45 +31,46 @@ const { /** @typedef {import("./loader.js").Dependency} LoaderDependency */ /** - * @typedef {Object} LoaderOptions - * @property {string | ((resourcePath: string, rootContext: string) => string)} [publicPath] - * @property {boolean} [emit] - * @property {boolean} [esModule] - * @property {string} [layer] - * @property {boolean} [defaultExport] + * @typedef {object} LoaderOptions + * @property {string | ((resourcePath: string, rootContext: string) => string)=} publicPath public path + * @property {boolean=} emit true when need to emit, otherwise false + * @property {boolean=} esModule need to generate ES module syntax + * @property {string=} layer a layer + * @property {boolean=} defaultExport true when need to use default export, otherwise false */ /** - * @typedef {Object} PluginOptions - * @property {Required['output']['filename']} [filename] - * @property {Required['output']['chunkFilename']} [chunkFilename] - * @property {boolean} [ignoreOrder] - * @property {string | ((linkTag: HTMLLinkElement) => void)} [insert] - * @property {Record} [attributes] - * @property {string | false | 'text/css'} [linkType] - * @property {boolean} [runtime] - * @property {boolean} [experimentalUseImportModule] + * @typedef {object} PluginOptions + * @property {Required['output']['filename']=} filename filename + * @property {Required['output']['chunkFilename']=} chunkFilename chunk filename + * @property {boolean=} ignoreOrder true when need to ignore order, otherwise false + * @property {string | ((linkTag: HTMLLinkElement) => void)=} insert link insert place or a custom insert function + * @property {Record=} attributes link attributes + * @property {string | false | 'text/css'=} linkType value of a link type attribute + * @property {boolean=} runtime true when need to generate runtime code, otherwise false + * @property {boolean=} experimentalUseImportModule true when need to use `experimentalUseImportModule` API, otherwise false */ /** - * @typedef {Object} NormalizedPluginOptions - * @property {Required['output']['filename']} filename - * @property {Required['output']['chunkFilename']} [chunkFilename] - * @property {boolean} ignoreOrder - * @property {string | ((linkTag: HTMLLinkElement) => void)} [insert] - * @property {Record} [attributes] - * @property {string | false | 'text/css'} [linkType] - * @property {boolean} runtime - * @property {boolean} [experimentalUseImportModule] + * @typedef {object} NormalizedPluginOptions + * @property {Required['output']['filename']} filename filename + * @property {Required['output']['chunkFilename']=} chunkFilename chunk filename + * @property {boolean} ignoreOrder true when need to ignore order, otherwise false + * @property {string | ((linkTag: HTMLLinkElement) => void)=} insert a link insert place or a custom insert function + * @property {Record=} attributes link attributes + * @property {string | false | 'text/css'=} linkType value of a link type attribute + * @property {boolean} runtime true when need to generate runtime code, otherwise false + * @property {boolean=} experimentalUseImportModule true when need to use `experimentalUseImportModule` API, otherwise false */ /** - * @typedef {Object} RuntimeOptions - * @property {string | ((linkTag: HTMLLinkElement) => void) | undefined} insert - * @property {string | false | 'text/css'} linkType - * @property {Record | undefined} attributes + * @typedef {object} RuntimeOptions + * @property {string | ((linkTag: HTMLLinkElement) => void)=} insert a link insert place or a custom insert function + * @property {string | false | 'text/css'} linkType value of a link type attribute + * @property {Record=} attributes link attributes */ +// eslint-disable-next-line jsdoc/no-restricted-syntax /** @typedef {any} TODO */ const pluginName = "mini-css-extract-plugin"; @@ -96,23 +95,24 @@ const CODE_GENERATION_RESULT = { /** @typedef {Dependency & CssModuleDependency} CssDependency */ /** @typedef {Omit} CssDependencyOptions */ /** @typedef {{ new(loaderDependency: CssDependencyOptions, context: string | null, identifierIndex: number): CssDependency }} CssDependencyConstructor */ + /** - * @typedef {Object} VarNames - * @property {string} tag - * @property {string} chunkId - * @property {string} href - * @property {string} resolve - * @property {string} reject + * @typedef {object} VarNames + * @property {string} tag tag + * @property {string} chunkId chunk id + * @property {string} href href + * @property {string} resolve resolve + * @property {string} reject reject */ + /** - * @typedef {Object} MiniCssExtractPluginCompilationHooks - * @property {import("tapable").SyncWaterfallHook<[string, VarNames], string>} beforeTagInsert - * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload - * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch + * @typedef {object} MiniCssExtractPluginCompilationHooks + * @property {import("tapable").SyncWaterfallHook<[string, VarNames], string>} beforeTagInsert before tag insert hook + * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload link preload hook + * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch link prefetch hook */ /** - * * @type {WeakMap} */ const cssModuleCache = new WeakMap(); @@ -130,8 +130,8 @@ const compilationHooksMap = new WeakMap(); class MiniCssExtractPlugin { /** - * @param {Compiler["webpack"]} webpack - * @returns {CssModuleConstructor} + * @param {Compiler["webpack"]} webpack webpack + * @returns {CssModuleConstructor} CSS module constructor */ static getCssModule(webpack) { /** @@ -143,7 +143,7 @@ class MiniCssExtractPlugin { class CssModule extends webpack.Module { /** - * @param {CssModuleDependency} dependency + * @param {CssModuleDependency} dependency css module dependency */ constructor({ context, @@ -157,7 +157,6 @@ class MiniCssExtractPlugin { assets, assetsInfo, }) { - // @ts-ignore super(MODULE_TYPE, /** @type {string | undefined} */ (context)); this.id = ""; @@ -187,8 +186,8 @@ class MiniCssExtractPlugin { } /** - * @param {Parameters[0]} requestShortener - * @returns {ReturnType} + * @param {Parameters[0]} requestShortener request shortener + * @returns {ReturnType} readable identifier */ readableIdentifier(requestShortener) { return `css ${requestShortener.shorten(this._identifier)}${ @@ -198,12 +197,10 @@ class MiniCssExtractPlugin { }${this.media ? ` (media ${this.media})` : ""}`; } - // eslint-disable-next-line class-methods-use-this getSourceTypes() { return TYPES; } - // eslint-disable-next-line class-methods-use-this codeGeneration() { return CODE_GENERATION_RESULT; } @@ -215,14 +212,14 @@ class MiniCssExtractPlugin { const idx = resource.indexOf("?"); if (idx >= 0) { - return resource.substring(0, idx); + return resource.slice(0, Math.max(0, idx)); } return resource; } /** - * @param {Module} module + * @param {Module} module a module */ updateCacheModule(module) { if ( @@ -232,8 +229,8 @@ class MiniCssExtractPlugin { this.media !== /** @type {CssModule} */ (module).media || (this.sourceMap ? !this.sourceMap.equals( - /** @type {Uint8Array} **/ - (/** @type {CssModule} */ (module).sourceMap) + /** @type {Uint8Array} * */ + (/** @type {CssModule} */ (module).sourceMap), ) : false) || this.assets !== /** @type {CssModule} */ (module).assets || @@ -251,27 +248,24 @@ class MiniCssExtractPlugin { } } - // eslint-disable-next-line class-methods-use-this needRebuild() { return this._needBuild; } - // eslint-disable-next-line class-methods-use-this /** * @param {Parameters[0]} context context info * @param {Parameters[1]} callback callback function, returns true, if the module needs a rebuild */ needBuild(context, callback) { - // eslint-disable-next-line no-undefined callback(undefined, this._needBuild); } /** - * @param {Parameters[0]} options - * @param {Parameters[1]} compilation - * @param {Parameters[2]} resolver - * @param {Parameters[3]} fileSystem - * @param {Parameters[4]} callback + * @param {Parameters[0]} options options + * @param {Parameters[1]} compilation compilation + * @param {Parameters[2]} resolver resolver + * @param {Parameters[3]} fileSystem file system + * @param {Parameters[4]} callback callback */ build(options, compilation, resolver, fileSystem, callback) { this.buildInfo = { @@ -283,7 +277,7 @@ class MiniCssExtractPlugin { ( this._computeHash( /** @type {string} */ - (compilation.outputOptions.hashFunction) + (compilation.outputOptions.hashFunction), ) ), }; @@ -295,8 +289,8 @@ class MiniCssExtractPlugin { /** * @private - * @param {string} hashFunction - * @returns {string | Buffer} + * @param {string} hashFunction hash function + * @returns {string | Buffer} hash digest */ _computeHash(hashFunction) { const hash = webpack.util.createHash(hashFunction); @@ -315,8 +309,8 @@ class MiniCssExtractPlugin { } /** - * @param {Parameters[0]} hash - * @param {Parameters[1]} context + * @param {Parameters[0]} hash hash + * @param {Parameters[1]} context context */ updateHash(hash, context) { super.updateHash(hash, context); @@ -325,12 +319,12 @@ class MiniCssExtractPlugin { /** @type {string} */ ( /** @type {NonNullable} */ (this.buildInfo).hash - ) + ), ); } /** - * @param {Parameters[0]} context + * @param {Parameters[0]} context serializer context */ serialize(context) { const { write } = context; @@ -352,7 +346,7 @@ class MiniCssExtractPlugin { } /** - * @param {Parameters[0]} context + * @param {Parameters[0]} context deserializer context */ deserialize(context) { this._needBuild = context.read(); @@ -366,7 +360,6 @@ class MiniCssExtractPlugin { webpack.util.serialization.register( CssModule, path.resolve(__dirname, "CssModule"), - // @ts-ignore null, { serialize(instance, context) { @@ -402,15 +395,15 @@ class MiniCssExtractPlugin { return dep; }, - } + }, ); return CssModule; } /** - * @param {Compiler["webpack"]} webpack - * @returns {CssDependencyConstructor} + * @param {Compiler["webpack"]} webpack webpack + * @returns {CssDependencyConstructor} CSS dependency constructor */ static getCssDependency(webpack) { /** @@ -424,14 +417,14 @@ class MiniCssExtractPlugin { class CssDependency extends webpack.Dependency { /** - * @param {CssDependencyOptions} loaderDependency - * @param {string | null} context - * @param {number} identifierIndex + * @param {CssDependencyOptions} loaderDependency loader dependency + * @param {string | null} context context + * @param {number} identifierIndex identifier index */ constructor( { identifier, content, layer, supports, media, sourceMap }, context, - identifierIndex + identifierIndex, ) { super(); @@ -444,30 +437,29 @@ class MiniCssExtractPlugin { this.sourceMap = sourceMap; this.context = context; /** @type {{ [key: string]: Source } | undefined}} */ - // eslint-disable-next-line no-undefined + this.assets = undefined; /** @type {Map | undefined} */ - // eslint-disable-next-line no-undefined + this.assetsInfo = undefined; } /** - * @returns {ReturnType} + * @returns {ReturnType} a resource identifier */ getResourceIdentifier() { return `css-module-${this.identifier}-${this.identifierIndex}`; } /** - * @returns {ReturnType} + * @returns {ReturnType} side effect state */ - // eslint-disable-next-line class-methods-use-this getModuleEvaluationSideEffectsState() { return webpack.ModuleGraphConnection.TRANSITIVE_ONLY; } /** - * @param {Parameters[0]} context + * @param {Parameters[0]} context serializer context */ serialize(context) { const { write } = context; @@ -487,19 +479,19 @@ class MiniCssExtractPlugin { } /** - * @param {Parameters[0]} context + * @param {Parameters[0]} context deserializer context */ deserialize(context) { super.deserialize(context); } } + // @ts-expect-error cssDependencyCache.set(webpack, CssDependency); webpack.util.serialization.register( CssDependency, path.resolve(__dirname, "CssDependency"), - // @ts-ignore null, { serialize(instance, context) { @@ -517,7 +509,7 @@ class MiniCssExtractPlugin { sourceMap: read(), }, read(), - read() + read(), ); const assets = read(); @@ -530,9 +522,10 @@ class MiniCssExtractPlugin { return dep; }, - } + }, ); + // @ts-expect-error return CssDependency; } @@ -548,7 +541,7 @@ class MiniCssExtractPlugin { hooks = { beforeTagInsert: new SyncWaterfallHook( ["source", "varNames"], - "string" + "string", ), linkPreload: new SyncWaterfallHook(["source", "chunk"]), linkPrefetch: new SyncWaterfallHook(["source", "chunk"]), @@ -560,7 +553,7 @@ class MiniCssExtractPlugin { } /** - * @param {PluginOptions} [options] + * @param {PluginOptions=} options options */ constructor(options = {}) { validate(/** @type {Schema} */ (schema), options, { @@ -570,7 +563,6 @@ class MiniCssExtractPlugin { /** * @private * @type {WeakMap>} - * @private */ this._sortedModulesCache = new WeakMap(); @@ -578,17 +570,15 @@ class MiniCssExtractPlugin { * @private * @type {NormalizedPluginOptions} */ - this.options = Object.assign( - { - filename: DEFAULT_FILENAME, - ignoreOrder: false, - // TODO remove in the next major release - // eslint-disable-next-line no-undefined - experimentalUseImportModule: undefined, - runtime: true, - }, - options - ); + this.options = { + filename: DEFAULT_FILENAME, + ignoreOrder: false, + // TODO remove in the next major release + + experimentalUseImportModule: undefined, + runtime: true, + ...options, + }; /** * @private @@ -635,22 +625,22 @@ class MiniCssExtractPlugin { } /** - * @param {Compiler} compiler + * @param {Compiler} compiler compiler */ apply(compiler) { const { webpack } = compiler; - if (this.options.experimentalUseImportModule) { - if ( - typeof ( - /** @type {Compiler["options"]["experiments"] & { executeModule?: boolean }} */ - (compiler.options.experiments).executeModule - ) === "undefined" - ) { + if ( + this.options.experimentalUseImportModule && + typeof ( /** @type {Compiler["options"]["experiments"] & { executeModule?: boolean }} */ - // eslint-disable-next-line no-param-reassign - (compiler.options.experiments).executeModule = true; - } + (compiler.options.experiments).executeModule + ) === "undefined" + ) { + /** @type {Compiler["options"]["experiments"] & { executeModule?: boolean }} */ + + // @ts-expect-error + compiler.options.experiments.executeModule = true; } // TODO bug in webpack, remove it after it will be fixed @@ -660,19 +650,18 @@ class MiniCssExtractPlugin { webpack.util.serialization.registerLoader( /^mini-css-extract-plugin\//, - trueFn + trueFn, ); } const { splitChunks } = compiler.options.optimization; - if (splitChunks) { - if ( - /** @type {string[]} */ (splitChunks.defaultSizeTypes).includes("...") - ) { - /** @type {string[]} */ - (splitChunks.defaultSizeTypes).push(MODULE_TYPE); - } + if ( + splitChunks && + /** @type {string[]} */ (splitChunks.defaultSizeTypes).includes("...") + ) { + /** @type {string[]} */ + (splitChunks.defaultSizeTypes).push(MODULE_TYPE); } const CssModule = MiniCssExtractPlugin.getCssModule(webpack); @@ -687,16 +676,15 @@ class MiniCssExtractPlugin { normalModuleHook.tap( pluginName, /** - * @param {object} loaderContext + * @param {object} loaderContext loader context */ (loaderContext) => { /** @type {object & { [pluginSymbol]: { experimentalUseImportModule: boolean | undefined } }} */ - // eslint-disable-next-line no-param-reassign (loaderContext)[pluginSymbol] = { experimentalUseImportModule: this.options.experimentalUseImportModule, }; - } + }, ); }); @@ -706,37 +694,35 @@ class MiniCssExtractPlugin { * @param {{ dependencies: Dependency[] }} dependencies * @param {(arg0?: Error, arg1?: TODO) => void} callback */ - // eslint-disable-next-line class-methods-use-this + create({ dependencies: [dependency] }, callback) { callback( - // eslint-disable-next-line no-undefined undefined, - new CssModule(/** @type {CssDependency} */ (dependency)) + new CssModule(/** @type {CssDependency} */ (dependency)), ); } } compilation.dependencyFactories.set( CssDependency, - new CssModuleFactory() + new CssModuleFactory(), ); class CssDependencyTemplate { - // eslint-disable-next-line class-methods-use-this apply() {} } compilation.dependencyTemplates.set( CssDependency, - new CssDependencyTemplate() + new CssDependencyTemplate(), ); compilation.hooks.renderManifest.tap( pluginName, /** - * @param {ReturnType} result - * @param {Parameters[0]} chunk - * @returns {TODO} + * @param {ReturnType} result result + * @param {Parameters[0]} chunk chunk + * @returns {TODO} a rendered manifest */ (result, { chunk }) => { const { chunkGraph } = compilation; @@ -748,15 +734,13 @@ class MiniCssExtractPlugin { return; } - /** @type {CssModule[]} */ - const renderedModules = Array.from( + const renderedModules = /** @type {CssModule[]} */ - (this.getChunkModules(chunk, chunkGraph)) - ).filter( - (module) => - // @ts-ignore - module.type === MODULE_TYPE - ); + ( + [...this.getChunkModules(chunk, chunkGraph)].filter( + (module) => module.type === MODULE_TYPE, + ) + ); const filenameTemplate = /** @type {string} */ @@ -779,7 +763,7 @@ class MiniCssExtractPlugin { { contentHashType: MODULE_TYPE, chunk, - } + }, ), filenameTemplate, pathOptions: { @@ -790,7 +774,7 @@ class MiniCssExtractPlugin { hash: chunk.contentHash[MODULE_TYPE], }); } - } + }, ); compilation.hooks.contentHash.tap(pluginName, (chunk) => { @@ -800,7 +784,7 @@ class MiniCssExtractPlugin { chunk, /** @type {CssModule[]} */ (chunkGraph.getChunkModulesIterableBySourceType(chunk, MODULE_TYPE)), - compilation.runtimeTemplate.requestShortener + compilation.runtimeTemplate.requestShortener, ); if (modules) { @@ -812,10 +796,12 @@ class MiniCssExtractPlugin { hash.update(chunkGraph.getModuleHash(m, chunk.runtime)); } - // eslint-disable-next-line no-param-reassign chunk.contentHash[MODULE_TYPE] = /** @type {string} */ - (hash.digest(hashDigest)).substring(0, hashDigestLength); + (hash.digest(hashDigest)).slice( + 0, + Math.max(0, /** @type {number} */ (hashDigestLength)), + ); } }); @@ -831,7 +817,7 @@ class MiniCssExtractPlugin { * @param {Compilation} compilation * @returns {Record} */ - // eslint-disable-next-line no-shadow + const getCssChunkObject = (mainChunk, compilation) => { /** @type {Record} */ const obj = {}; @@ -840,11 +826,10 @@ class MiniCssExtractPlugin { for (const chunk of mainChunk.getAllAsyncChunks()) { const modules = chunkGraph.getOrderedChunkModulesIterable( chunk, - compareModulesByIdentifier + compareModulesByIdentifier, ); for (const module of modules) { - // @ts-ignore if (module.type === MODULE_TYPE) { obj[/** @type {string} */ (chunk.id)] = 1; @@ -864,16 +849,18 @@ class MiniCssExtractPlugin { function chunkHasCss(chunk, chunkGraph) { // this function replace: // const chunkHasCss = require("webpack/lib/css/CssModulesPlugin").chunkHasCss; - return !!chunkGraph.getChunkModulesIterableBySourceType( - chunk, - "css/mini-extract" + return Boolean( + chunkGraph.getChunkModulesIterableBySourceType( + chunk, + "css/mini-extract", + ), ); } class CssLoadingRuntimeModule extends RuntimeModule { /** - * @param {Set} runtimeRequirements - * @param {RuntimeOptions} runtimeOptions + * @param {Set} runtimeRequirements runtime Requirements + * @param {RuntimeOptions} runtimeOptions runtime options */ constructor(runtimeRequirements, runtimeOptions) { super("css loading", 10); @@ -890,13 +877,13 @@ class MiniCssExtractPlugin { } = /** @type {Compilation} */ (this.compilation); const chunkMap = getCssChunkObject( /** @type {Chunk} */ (chunk), - /** @type {Compilation} */ (this.compilation) + /** @type {Compilation} */ (this.compilation), ); const withLoading = runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) && Object.keys(chunkMap).length > 0; const withHmr = runtimeRequirements.has( - RuntimeGlobals.hmrDownloadUpdateHandlers + RuntimeGlobals.hmrDownloadUpdateHandlers, ); if (!withLoading && !withHmr) { @@ -908,10 +895,10 @@ class MiniCssExtractPlugin { ).getChunkConditionMap(/** @type {Chunk} */ (chunk), chunkHasCss); const hasCssMatcher = compileBooleanMatcher(conditionMap); const withPrefetch = runtimeRequirements.has( - RuntimeGlobals.prefetchChunkHandlers + RuntimeGlobals.prefetchChunkHandlers, ); const withPreload = runtimeRequirements.has( - RuntimeGlobals.preloadChunkHandlers + RuntimeGlobals.preloadChunkHandlers, ); const { linkPreload, linkPrefetch } = MiniCssExtractPlugin.getCompilationHooks(compilation); @@ -929,21 +916,21 @@ class MiniCssExtractPlugin { const [key, value] = entry; return `linkTag.setAttribute(${JSON.stringify( - key + key, )}, ${JSON.stringify(value)});`; - } - ) + }, + ), ) : "", 'linkTag.rel = "stylesheet";', this.runtimeOptions.linkType ? `linkTag.type = ${JSON.stringify( - this.runtimeOptions.linkType + this.runtimeOptions.linkType, )};` : "", `if (${RuntimeGlobals.scriptNonce}) {`, Template.indent( - `linkTag.nonce = ${RuntimeGlobals.scriptNonce};` + `linkTag.nonce = ${RuntimeGlobals.scriptNonce};`, ), "}", `var onLinkComplete = ${runtimeTemplate.basicFunction("event", [ @@ -970,17 +957,17 @@ class MiniCssExtractPlugin { "linkTag.href = fullhref;", crossOriginLoading ? Template.asString([ - `if (linkTag.href.indexOf(window.location.origin + '/') !== 0) {`, + "if (linkTag.href.indexOf(window.location.origin + '/') !== 0) {", Template.indent( `linkTag.crossOrigin = ${JSON.stringify( - crossOriginLoading - )};` + crossOriginLoading, + )};`, ), "}", ]) : "", MiniCssExtractPlugin.getCompilationHooks( - compilation + compilation, ).beforeTagInsert.call("", { tag: "linkTag", chunkId: "chunkId", @@ -993,7 +980,7 @@ class MiniCssExtractPlugin { ? `(${this.runtimeOptions.insert.toString()})(linkTag)` : Template.asString([ `var target = document.querySelector("${this.runtimeOptions.insert}");`, - `target.parentNode.insertBefore(linkTag, target.nextSibling);`, + "target.parentNode.insertBefore(linkTag, target.nextSibling);", ]) : Template.asString([ "if (oldTag) {", @@ -1005,7 +992,7 @@ class MiniCssExtractPlugin { "}", ]), "return linkTag;", - ] + ], )};`, `var findStylesheet = ${runtimeTemplate.basicFunction( "href, fullhref", @@ -1026,7 +1013,7 @@ class MiniCssExtractPlugin { "if(dataHref === href || dataHref === fullhref) return tag;", ]), "}", - ] + ], )};`, `var loadStylesheet = ${runtimeTemplate.basicFunction( "chunkId", @@ -1037,8 +1024,8 @@ class MiniCssExtractPlugin { `var fullhref = ${RuntimeGlobals.publicPath} + href;`, "if(findStylesheet(href, fullhref)) return resolve();", "createStylesheet(chunkId, fullhref, null, resolve, reject);", - ] - )});` + ], + )});`, )}`, withLoading ? Template.asString([ @@ -1048,7 +1035,7 @@ class MiniCssExtractPlugin { /** @type {string[]} */ (/** @type {Chunk} */ (chunk).ids) .map((id) => `${JSON.stringify(id)}: 0`) - .join(",\n") + .join(",\n"), ), "};", "", @@ -1063,14 +1050,14 @@ class MiniCssExtractPlugin { Template.indent([ `promises.push(installedCssChunks[chunkId] = loadStylesheet(chunkId).then(${runtimeTemplate.basicFunction( "", - "installedCssChunks[chunkId] = 0;" + "installedCssChunks[chunkId] = 0;", )}, ${runtimeTemplate.basicFunction("e", [ "delete installedCssChunks[chunkId];", "throw e;", ])}));`, ]), "}", - ] + ], )};`, ]) : "// no chunk loading", @@ -1094,7 +1081,7 @@ class MiniCssExtractPlugin { 'for(var i = 0; i < newTags.length; i++) newTags[i].rel = "stylesheet";', "newTags.length = 0;", ])} };`, - ] + ], )}`, `${ RuntimeGlobals.hmrDownloadUpdateHandlers @@ -1118,15 +1105,15 @@ class MiniCssExtractPlugin { 'tag.as = "style";', 'tag.rel = "preload";', "resolve();", - ] + ], )}, reject);`, "oldTags.push(oldTag);", "newTags.push(tag);", - ] + ], )}));`, - ] + ], )});`, - ] + ], )}`, ]) : "// no hmr", @@ -1147,19 +1134,19 @@ class MiniCssExtractPlugin { "var link = document.createElement('link');", crossOriginLoading ? `link.crossOrigin = ${JSON.stringify( - crossOriginLoading + crossOriginLoading, )};` : "", `if (${RuntimeGlobals.scriptNonce}) {`, Template.indent( - `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` + `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});`, ), "}", 'link.rel = "prefetch";', 'link.as = "style";', `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.require}.miniCssF(chunkId);`, ]), - /** @type {Chunk} */ (chunk) + /** @type {Chunk} */ (chunk), ), "document.head.appendChild(link);", ]), @@ -1184,7 +1171,7 @@ class MiniCssExtractPlugin { "link.charset = 'utf-8';", `if (${RuntimeGlobals.scriptNonce}) {`, Template.indent( - `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});` + `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});`, ), "}", 'link.rel = "preload";', @@ -1197,14 +1184,14 @@ class MiniCssExtractPlugin { "if (link.href.indexOf(window.location.origin + '/') !== 0) {", Template.indent( `link.crossOrigin = ${JSON.stringify( - crossOriginLoading - )};` + crossOriginLoading, + )};`, ), "}", ]) : "", ]), - /** @type {Chunk} */ (chunk) + /** @type {Chunk} */ (chunk), ), "document.head.appendChild(link);", ]), @@ -1218,8 +1205,8 @@ class MiniCssExtractPlugin { const enabledChunks = new WeakSet(); /** - * @param {Chunk} chunk - * @param {Set} set + * @param {Chunk} chunk chunk + * @param {Set} set set with runtime requirement */ const handler = (chunk, set) => { if (enabledChunks.has(chunk)) { @@ -1244,8 +1231,8 @@ class MiniCssExtractPlugin { "mini-css", `${RuntimeGlobals.require}.miniCssF`, /** - * @param {Chunk} referencedChunk - * @returns {TODO} + * @param {Chunk} referencedChunk a referenced chunk + * @returns {TODO} a template value */ (referencedChunk) => { if (!referencedChunk.contentHash[MODULE_TYPE]) { @@ -1256,13 +1243,13 @@ class MiniCssExtractPlugin { ? this.options.filename : this.options.chunkFilename; }, - set.has(RuntimeGlobals.hmrDownloadUpdateHandlers) - ) + set.has(RuntimeGlobals.hmrDownloadUpdateHandlers), + ), ); compilation.addRuntimeModule( chunk, - new CssLoadingRuntimeModule(set, this.runtimeOptions) + new CssLoadingRuntimeModule(set, this.runtimeOptions), ); }; @@ -1283,26 +1270,26 @@ class MiniCssExtractPlugin { /** * @private - * @param {Chunk} chunk - * @param {ChunkGraph} chunkGraph - * @returns {Iterable} + * @param {Chunk} chunk chunk + * @param {ChunkGraph} chunkGraph chunk graph + * @returns {Iterable} modules */ getChunkModules(chunk, chunkGraph) { return typeof chunkGraph !== "undefined" ? chunkGraph.getOrderedChunkModulesIterable( chunk, - compareModulesByIdentifier + compareModulesByIdentifier, ) : chunk.modulesIterable; } /** * @private - * @param {Compilation} compilation - * @param {Chunk} chunk - * @param {CssModule[]} modules - * @param {Compilation["requestShortener"]} requestShortener - * @returns {Set} + * @param {Compilation} compilation compilation + * @param {Chunk} chunk chunk + * @param {CssModule[]} modules modules + * @param {Compilation["requestShortener"]} requestShortener request shortener + * @returns {Set} css modules */ sortModules(compilation, chunk, modules, requestShortener) { let usedModules = this._sortedModulesCache.get(chunk); @@ -1320,11 +1307,11 @@ class MiniCssExtractPlugin { m, /** @type {Set} */ (new Set()), - ]) + ]), ); /** @type {Map>>} */ const moduleDependenciesReasons = new Map( - modulesList.map((m) => [m, new Map()]) + modulesList.map((m) => [m, new Map()]), ); // Get ordered list of modules per chunk group // This loop also gathers dependencies from the ordered lists @@ -1334,17 +1321,14 @@ class MiniCssExtractPlugin { chunk.groupsIterable, (chunkGroup) => { const sortedModules = modulesList - .map((module) => { - return { - module, - index: chunkGroup.getModulePostOrderIndex(module), - }; - }) - // eslint-disable-next-line no-undefined + .map((module) => ({ + module, + index: chunkGroup.getModulePostOrderIndex(module), + })) .filter((item) => item.index !== undefined) .sort( (a, b) => - /** @type {number} */ (b.index) - /** @type {number} */ (a.index) + /** @type {number} */ (b.index) - /** @type {number} */ (a.index), ) .map((item) => item.module); @@ -1371,15 +1355,15 @@ class MiniCssExtractPlugin { } return sortedModules; - } + }, ); // set with already included modules in correct order usedModules = new Set(); /** - * @param {CssModule} m - * @returns {boolean} + * @param {CssModule} m a css module + * @returns {boolean} true when module unused, otherwise false */ const unusedModulesFilter = (m) => !(/** @type {Set} */ (usedModules).has(m)); @@ -1399,12 +1383,11 @@ class MiniCssExtractPlugin { // skip empty lists if (list.length !== 0) { const module = list[list.length - 1]; - const deps = moduleDependencies.get(module); - // determine dependencies that are not yet included - const failedDeps = Array.from( + const deps = /** @type {Set} */ - (deps) - ).filter(unusedModulesFilter); + (moduleDependencies.get(module)); + // determine dependencies that are not yet included + const failedDeps = [...deps].filter(unusedModulesFilter); // store best match for fallback behavior if (!bestMatchDeps || bestMatchDeps.length > failedDeps.length) { @@ -1429,7 +1412,7 @@ class MiniCssExtractPlugin { if (!this.options.ignoreOrder) { const reasons = moduleDependenciesReasons.get( - /** @type {CssModule} */ (fallbackModule) + /** @type {CssModule} */ (fallbackModule), ); compilation.warnings.push( @@ -1450,7 +1433,7 @@ class MiniCssExtractPlugin { const goodReasons = goodReasonsMap && goodReasonsMap.get( - /** @type {CssModule} */ (fallbackModule) + /** @type {CssModule} */ (fallbackModule), ); const failedChunkGroups = Array.from( /** @type {Set} */ @@ -1458,7 +1441,7 @@ class MiniCssExtractPlugin { /** @type {Map>} */ (reasons).get(m) ), - (cg) => cg.name + (cg) => cg.name, ).join(", "); const goodChunkGroups = goodReasons && @@ -1472,9 +1455,9 @@ class MiniCssExtractPlugin { .filter(Boolean) .join("\n"); }), - ].join("\n") + ].join("\n"), ) - ) + ), ); } @@ -1489,14 +1472,14 @@ class MiniCssExtractPlugin { /** * @private - * @param {Compiler} compiler - * @param {Compilation} compilation - * @param {Chunk} chunk - * @param {CssModule[]} modules - * @param {Compiler["requestShortener"]} requestShortener - * @param {string} filenameTemplate - * @param {Parameters['output']['filename'], string | undefined>>[0]} pathData - * @returns {Source} + * @param {Compiler} compiler compiler + * @param {Compilation} compilation compilation + * @param {Chunk} chunk chunk + * @param {CssModule[]} modules modules + * @param {Compiler["requestShortener"]} requestShortener request shortener + * @param {string} filenameTemplate filename template + * @param {Parameters['output']['filename'], string | undefined>>[0]} pathData path data + * @returns {Source} source */ renderContentAsset( compiler, @@ -1505,13 +1488,13 @@ class MiniCssExtractPlugin { modules, requestShortener, filenameTemplate, - pathData + pathData, ) { const usedModules = this.sortModules( compilation, chunk, modules, - requestShortener + requestShortener, ); const { ConcatSource, SourceMapSource, RawSource } = @@ -1523,7 +1506,7 @@ class MiniCssExtractPlugin { let content = module.content.toString(); const readableIdentifier = module.readableIdentifier(requestShortener); - const startsWithAtRuleImport = /^@import url/.test(content); + const startsWithAtRuleImport = content.startsWith("@import url"); let header; @@ -1590,13 +1573,13 @@ class MiniCssExtractPlugin { if (needLayer) { source.add( - `@layer${module.layer.length > 0 ? ` ${module.layer}` : ""} {\n` + `@layer${module.layer.length > 0 ? ` ${module.layer}` : ""} {\n`, ); } const { path: filename } = compilation.getPathWithInfo( filenameTemplate, - pathData + pathData, ); const undoPath = getUndoPath(filename, compiler.outputPath, false); @@ -1605,7 +1588,7 @@ class MiniCssExtractPlugin { content = content.replace(new RegExp(ABSOLUTE_PUBLIC_PATH, "g"), ""); content = content.replace( new RegExp(SINGLE_DOT_PATH_SEGMENT, "g"), - "." + ".", ); content = content.replace(new RegExp(AUTO_PUBLIC_PATH, "g"), undoPath); @@ -1614,7 +1597,7 @@ class MiniCssExtractPlugin { (entryOptions && entryOptions.baseUri) || undoPath; content = content.replace( new RegExp(BASE_URI, "g"), - baseUriReplacement + baseUriReplacement, ); if (module.sourceMap) { @@ -1622,8 +1605,8 @@ class MiniCssExtractPlugin { new SourceMapSource( content, readableIdentifier, - module.sourceMap.toString() - ) + module.sourceMap.toString(), + ), ); } else { source.add(new RawSource(content)); diff --git a/src/loader.js b/src/loader.js index e4217f5c..579f0062 100644 --- a/src/loader.js +++ b/src/loader.js @@ -1,16 +1,16 @@ const path = require("path"); +const schema = require("./loader-options.json"); const { - findModuleById, - evalModuleCode, - AUTO_PUBLIC_PATH, ABSOLUTE_PUBLIC_PATH, + AUTO_PUBLIC_PATH, BASE_URI, SINGLE_DOT_PATH_SEGMENT, - stringifyRequest, + evalModuleCode, + findModuleById, stringifyLocal, + stringifyRequest, } = require("./utils"); -const schema = require("./loader-options.json"); const MiniCssExtractPlugin = require("./index"); @@ -23,36 +23,39 @@ const MiniCssExtractPlugin = require("./index"); /** @typedef {import("webpack").AssetInfo} AssetInfo */ /** @typedef {import("webpack").NormalModule} NormalModule */ /** @typedef {import("./index.js").LoaderOptions} LoaderOptions */ -/** @typedef {{ [key: string]: string | function }} Locals */ +// eslint-disable-next-line jsdoc/no-restricted-syntax +/** @typedef {{[key: string]: string | Function }} Locals */ + +// eslint-disable-next-line jsdoc/no-restricted-syntax /** @typedef {any} TODO */ /** - * @typedef {Object} Dependency - * @property {string} identifier - * @property {string | null} context - * @property {Buffer} content - * @property {string} media - * @property {string} [supports] - * @property {string} [layer] - * @property {Buffer} [sourceMap] + * @typedef {object} Dependency + * @property {string} identifier identifier + * @property {string | null} context context + * @property {Buffer=} content content + * @property {string=} media media + * @property {string=} supports supports + * @property {string=} layer layer + * @property {Buffer=} sourceMap source map */ /** - * @param {string} content - * @param {{ loaderContext: import("webpack").LoaderContext, options: LoaderOptions, locals: Locals | undefined }} context - * @returns {string} + * @param {string} code code + * @param {{ loaderContext: import("webpack").LoaderContext, options: LoaderOptions, locals: Locals | undefined }} context context + * @returns {string} code and HMR code */ -function hotLoader(content, context) { +function hotLoader(code, context) { const localsJsonString = JSON.stringify(JSON.stringify(context.locals)); - return `${content} + return `${code} if(module.hot) { (function() { var localsJsonString = ${localsJsonString}; // ${Date.now()} var cssReload = require(${stringifyRequest( context.loaderContext, - path.join(__dirname, "hmr/hotModuleReplacement.js") + path.join(__dirname, "hmr/hotModuleReplacement.js"), )})(module.id, ${JSON.stringify(context.options)}); // only invalidate when locals change if ( @@ -75,7 +78,7 @@ function hotLoader(content, context) { /** * @this {import("webpack").LoaderContext} - * @param {string} request + * @param {string} request request */ function pitch(request) { if ( @@ -91,14 +94,13 @@ function pitch(request) { ) { this.emitWarning( new Error( - 'You can\'t use `experiments.css` (`experiments.futureDefaults` enable built-in CSS support by default) and `mini-css-extract-plugin` together, please set `experiments.css` to `false` or set `{ type: "javascript/auto" }` for rules with `mini-css-extract-plugin` in your webpack config (now `mini-css-extract-plugin` does nothing).' - ) + 'You can\'t use `experiments.css` (`experiments.futureDefaults` enable built-in CSS support by default) and `mini-css-extract-plugin` together, please set `experiments.css` to `false` or set `{ type: "javascript/auto" }` for rules with `mini-css-extract-plugin` in your webpack config (now `mini-css-extract-plugin` does nothing).', + ), ); return; } - // @ts-ignore const options = this.getOptions(/** @type {Schema} */ (schema)); const emit = typeof options.emit !== "undefined" ? options.emit : true; const callback = this.async(); @@ -109,8 +111,8 @@ function pitch(request) { if (!optionsFromPlugin) { callback( new Error( - "You forgot to add 'mini-css-extract-plugin' plugin (i.e. `{ plugins: [new MiniCssExtractPlugin()] }`), please read https://github.com/webpack-contrib/mini-css-extract-plugin#getting-started" - ) + "You forgot to add 'mini-css-extract-plugin' plugin (i.e. `{ plugins: [new MiniCssExtractPlugin()] }`), please read https://github.com/webpack-contrib/mini-css-extract-plugin#getting-started", + ), ); return; @@ -119,10 +121,10 @@ function pitch(request) { const { webpack } = /** @type {Compiler} */ (this._compiler); /** - * @param {TODO} originalExports - * @param {Compilation} [compilation] - * @param {{ [name: string]: Source }} [assets] - * @param {Map} [assetsInfo] + * @param {TODO} originalExports original exports + * @param {Compilation=} compilation compilation + * @param {{ [name: string]: Source }=} assets assets + * @param {Map=} assetsInfo assets info * @returns {void} */ const handleExports = (originalExports, compilation, assets, assetsInfo) => { @@ -134,14 +136,15 @@ function pitch(request) { typeof options.esModule !== "undefined" ? options.esModule : true; /** - * @param {Dependency[] | [null, object][]} dependencies + * @param {Dependency[] | [null, object][]} dependencies dependencies */ const addDependencies = (dependencies) => { + // eslint-disable-next-line no-eq-null, eqeqeq if (!Array.isArray(dependencies) && dependencies != null) { throw new Error( `Exported value was not extracted as an array: ${JSON.stringify( - dependencies - )}` + dependencies, + )}`, ); } @@ -150,13 +153,12 @@ function pitch(request) { for (const dependency of dependencies) { if (!(/** @type {Dependency} */ (dependency).identifier) || !emit) { - // eslint-disable-next-line no-continue continue; } const count = identifierCountMap.get( - /** @type {Dependency} */ (dependency).identifier + /** @type {Dependency} */ (dependency).identifier, ) || 0; const CssDependency = MiniCssExtractPlugin.getCssDependency(webpack); @@ -167,13 +169,13 @@ function pitch(request) { (dependency), /** @type {Dependency} */ (dependency).context, - count - )) + count, + )), ); identifierCountMap.set( /** @type {Dependency} */ (dependency).identifier, - count + 1 + count + 1, ); } @@ -184,18 +186,16 @@ function pitch(request) { }; try { - // eslint-disable-next-line no-underscore-dangle const exports = originalExports.__esModule ? originalExports.default : originalExports; namedExport = - // eslint-disable-next-line no-underscore-dangle originalExports.__esModule && (!originalExports.default || !("locals" in originalExports.default)); if (namedExport) { - Object.keys(originalExports).forEach((key) => { + for (const key of Object.keys(originalExports)) { if (key !== "default") { if (!locals) { locals = {}; @@ -203,12 +203,12 @@ function pitch(request) { /** @type {Locals} */ (locals)[key] = originalExports[key]; } - }); + } } else { locals = exports && exports.locals; } - /** @type {Dependency[] | [null, object][]} */ + /** @type {Dependency[] | [null, TODO][]} */ let dependencies; if (!Array.isArray(exports)) { @@ -240,16 +240,15 @@ function pitch(request) { layer, sourceMap: sourceMap ? Buffer.from(JSON.stringify(sourceMap)) - : // eslint-disable-next-line no-undefined - undefined, + : undefined, }; - } + }, ); } addDependencies(dependencies); - } catch (e) { - callback(/** @type {Error} */ (e)); + } catch (err) { + callback(/** @type {Error} */ (err)); return; } @@ -262,8 +261,8 @@ function pitch(request) { if (locals) { if (namedExport) { - const identifiers = Array.from( - (function* generateIdentifiers() { + const identifiers = [ + ...(function* generateIdentifiers() { let identifierId = 0; for (const key of Object.keys(locals)) { @@ -271,15 +270,15 @@ function pitch(request) { yield [`_${identifierId.toString(16)}`, key]; } - })() - ); + })(), + ]; const localsString = identifiers .map( ([id, key]) => `\nvar ${id} = ${stringifyLocal( - /** @type {Locals} */ (locals)[key] - )};` + /** @type {Locals} */ (locals)[key], + )};`, ) .join(""); const exportsString = `export { ${identifiers @@ -320,7 +319,6 @@ function pitch(request) { (this._compilation).outputOptions; if (typeof options.publicPath === "string") { - // eslint-disable-next-line prefer-destructuring publicPath = options.publicPath; } else if (typeof options.publicPath === "function") { publicPath = options.publicPath(this.resourcePath, this.rootContext); @@ -338,8 +336,8 @@ function pitch(request) { if (!this.importModule) { callback( new Error( - "You are using 'experimentalUseImportModule' but 'this.importModule' is not available in loader context. You need to have at least webpack 5.33.2." - ) + "You are using 'experimentalUseImportModule' but 'this.importModule' is not available in loader context. You need to have at least webpack 5.33.2.", + ), ); return; } @@ -348,14 +346,14 @@ function pitch(request) { if (typeof publicPath === "string") { const isAbsolutePublicPath = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test( - publicPath + publicPath, ); publicPathForExtract = isAbsolutePublicPath ? publicPath : `${ABSOLUTE_PUBLIC_PATH}${publicPath.replace( /\./g, - SINGLE_DOT_PATH_SEGMENT + SINGLE_DOT_PATH_SEGMENT, )}`; } else { publicPathForExtract = publicPath; @@ -369,8 +367,8 @@ function pitch(request) { baseUri: `${BASE_URI}/`, }, /** - * @param {Error | null | undefined} error - * @param {object} exports + * @param {Error | null | undefined} error error + * @param {object} exports exports */ (error, exports) => { if (error) { @@ -380,7 +378,7 @@ function pitch(request) { } handleExports(exports); - } + }, ); return; } @@ -400,7 +398,7 @@ function pitch(request) { /** @type {Compilation} */ (this._compilation).createChildCompiler( `${MiniCssExtractPlugin.pluginName} ${request}`, - outputOptions + outputOptions, ); // The templates are compiled and executed by NodeJS - similar to server side rendering @@ -418,8 +416,7 @@ function pitch(request) { const { NodeTemplatePlugin } = webpack.node; const { NodeTargetPlugin } = webpack.node; - // @ts-ignore - new NodeTemplatePlugin(outputOptions).apply(childCompiler); + new NodeTemplatePlugin().apply(childCompiler); new NodeTargetPlugin().apply(childCompiler); const { EntryOptionPlugin } = webpack; @@ -447,7 +444,7 @@ function pitch(request) { childCompiler.hooks.thisCompilation.tap( `${MiniCssExtractPlugin.pluginName} loader`, /** - * @param {Compilation} compilation + * @param {Compilation} compilation compilation */ (compilation) => { const normalModuleHook = @@ -457,19 +454,16 @@ function pitch(request) { `${MiniCssExtractPlugin.pluginName} loader`, (loaderContext, module) => { if (module.request === request) { - // eslint-disable-next-line no-param-reassign - module.loaders = loaders.map((loader) => { - return { - type: null, - loader: loader.path, - options: loader.options, - ident: loader.ident, - }; - }); + module.loaders = loaders.map((loader) => ({ + type: null, + loader: loader.path, + options: loader.options, + ident: loader.ident, + })); } - } + }, ); - } + }, ); /** @type {string | Buffer} */ @@ -478,7 +472,7 @@ function pitch(request) { childCompiler.hooks.compilation.tap( MiniCssExtractPlugin.pluginName, /** - * @param {Compilation} compilation + * @param {Compilation} compilation compilation */ (compilation) => { compilation.hooks.processAssets.tap( @@ -489,25 +483,27 @@ function pitch(request) { compilation.assets[childFilename].source(); // Remove all chunk assets - compilation.chunks.forEach((chunk) => { - chunk.files.forEach((file) => { + for (const chunk of compilation.chunks) { + for (const file of chunk.files) { compilation.deleteAsset(file); - }); - }); - } + } + } + }, ); - } + }, ); - childCompiler.runAsChild((error, entries, compilation) => { + childCompiler.runAsChild((error, entries, compilation_) => { if (error) { callback(error); return; } - if (/** @type {Compilation} */ (compilation).errors.length > 0) { - callback(/** @type {Compilation} */ (compilation).errors[0]); + const compilation = /** @type {Compilation} */ (compilation_); + + if (compilation.errors.length > 0) { + callback(compilation.errors[0]); return; } @@ -517,20 +513,18 @@ function pitch(request) { /** @type {Map} */ const assetsInfo = new Map(); - for (const asset of /** @type {Compilation} */ (compilation).getAssets()) { + for (const asset of compilation.getAssets()) { assets[asset.name] = asset.source; assetsInfo.set(asset.name, asset.info); } - /** @type {Compilation} */ - (compilation).fileDependencies.forEach((dep) => { + for (const dep of compilation.fileDependencies) { this.addDependency(dep); - }, this); + } - /** @type {Compilation} */ - (compilation).contextDependencies.forEach((dep) => { + for (const dep of compilation.contextDependencies) { this.addContextDependency(dep); - }, this); + } if (!source) { callback(new Error("Didn't get a result from child compiler")); @@ -541,8 +535,8 @@ function pitch(request) { let originalExports; try { originalExports = evalModuleCode(this, source, request); - } catch (e) { - callback(/** @type {Error} */ (e)); + } catch (err) { + callback(/** @type {Error} */ (err)); return; } @@ -553,9 +547,9 @@ function pitch(request) { /** * @this {import("webpack").LoaderContext} - * @param {string} content + * @param {string} content content + * @returns {string | undefined} the original content */ -// eslint-disable-next-line consistent-return function loader(content) { if ( this._compiler && @@ -573,5 +567,5 @@ function loader(content) { } module.exports = loader; -module.exports.pitch = pitch; module.exports.hotLoader = hotLoader; +module.exports.pitch = pitch; diff --git a/src/utils.js b/src/utils.js index fc1c238f..e82249b9 100644 --- a/src/utils.js +++ b/src/utils.js @@ -3,19 +3,21 @@ const path = require("path"); /** @typedef {import("webpack").Compilation} Compilation */ /** @typedef {import("webpack").Module} Module */ + +// eslint-disable-next-line jsdoc/no-restricted-syntax /** @typedef {import("webpack").LoaderContext} LoaderContext */ /** - * @returns {boolean} + * @returns {boolean} always returns true */ function trueFn() { return true; } /** - * @param {Compilation} compilation - * @param {string | number} id - * @returns {null | Module} + * @param {Compilation} compilation compilation + * @param {string | number} id module id + * @returns {null | Module} the found module */ function findModuleById(compilation, id) { const { modules, chunkGraph } = compilation; @@ -34,29 +36,29 @@ function findModuleById(compilation, id) { return null; } +// eslint-disable-next-line jsdoc/no-restricted-syntax /** - * @param {LoaderContext} loaderContext - * @param {string | Buffer} code - * @param {string} filename - * @returns {object} + * @param {LoaderContext} loaderContext loader context + * @param {string | Buffer} code code + * @param {string} filename filename + * @returns {Record} exports of a module */ function evalModuleCode(loaderContext, code, filename) { - // @ts-ignore + // @ts-expect-error const module = new NativeModule(filename, loaderContext); - - // @ts-ignore - module.paths = NativeModule._nodeModulePaths(loaderContext.context); // eslint-disable-line no-underscore-dangle + // @ts-expect-error + module.paths = NativeModule._nodeModulePaths(loaderContext.context); module.filename = filename; - // @ts-ignore - module._compile(code, filename); // eslint-disable-line no-underscore-dangle + // @ts-expect-error + module._compile(code, filename); return module.exports; } /** - * @param {string} a - * @param {string} b - * @returns {0 | 1 | -1} + * @param {string} a a + * @param {string} b b + * @returns {0 | 1 | -1} result of comparing */ function compareIds(a, b) { if (typeof a !== typeof b) { @@ -75,9 +77,9 @@ function compareIds(a, b) { } /** - * @param {Module} a - * @param {Module} b - * @returns {0 | 1 | -1} + * @param {Module} a a + * @param {Module} b b + * @returns {0 | 1 | -1} result of comparing */ function compareModulesByIdentifier(a, b) { return compareIds(a.identifier(), b.identifier()); @@ -91,8 +93,8 @@ const SINGLE_DOT_PATH_SEGMENT = "__mini_css_extract_plugin_single_dot_path_segment__"; /** - * @param {string} str - * @returns {boolean} + * @param {string} str path + * @returns {boolean} true when path is absolute, otherwise false */ function isAbsolutePath(str) { return path.posix.isAbsolute(str) || path.win32.isAbsolute(str); @@ -101,8 +103,8 @@ function isAbsolutePath(str) { const RELATIVE_PATH_REGEXP = /^\.\.?[/\\]/; /** - * @param {string} str - * @returns {boolean} + * @param {string} str string + * @returns {boolean} true when path is relative, otherwise false */ function isRelativePath(str) { return RELATIVE_PATH_REGEXP.test(str); @@ -110,9 +112,9 @@ function isRelativePath(str) { // TODO simplify for the next major release /** - * @param {LoaderContext} loaderContext - * @param {string} request - * @returns {string} + * @param {LoaderContext} loaderContext the loader context + * @param {string} request a request + * @returns {string} a stringified request */ function stringifyRequest(loaderContext, request) { if ( @@ -122,8 +124,8 @@ function stringifyRequest(loaderContext, request) { return JSON.stringify( loaderContext.utils.contextify( loaderContext.context || loaderContext.rootContext, - request - ) + request, + ), ); } @@ -156,27 +158,25 @@ function stringifyRequest(loaderContext, request) { return singlePath.replace(/\\/g, "/") + query; }) - .join("!") + .join("!"), ); } /** - * @param {string} filename - * @param {string} outputPath - * @param {boolean} enforceRelative - * @returns {string} + * @param {string} filename filename + * @param {string} outputPath output path + * @param {boolean} enforceRelative true when need to enforce relative path, otherwise false + * @returns {string} undo path */ function getUndoPath(filename, outputPath, enforceRelative) { let depth = -1; let append = ""; - // eslint-disable-next-line no-param-reassign outputPath = outputPath.replace(/[\\/]$/, ""); for (const part of filename.split(/[/\\]+/)) { if (part === "..") { if (depth > -1) { - // eslint-disable-next-line no-plusplus depth--; } else { const i = outputPath.lastIndexOf("/"); @@ -189,11 +189,9 @@ function getUndoPath(filename, outputPath, enforceRelative) { append = `${outputPath.slice(pos + 1)}/${append}`; - // eslint-disable-next-line no-param-reassign outputPath = outputPath.slice(0, pos); } } else if (part !== ".") { - // eslint-disable-next-line no-plusplus depth++; } } @@ -201,14 +199,14 @@ function getUndoPath(filename, outputPath, enforceRelative) { return depth > 0 ? `${"../".repeat(depth)}${append}` : enforceRelative - ? `./${append}` - : append; + ? `./${append}` + : append; } +// eslint-disable-next-line jsdoc/no-restricted-syntax /** - * - * @param {string | function} value - * @returns {string} + * @param {string | Function} value local + * @returns {string} stringified local */ function stringifyLocal(value) { return typeof value === "function" ? value.toString() : JSON.stringify(value); @@ -219,6 +217,7 @@ function stringifyLocal(value) { * @returns {string} string */ const toSimpleString = (str) => { + // eslint-disable-next-line no-implicit-coercion if (`${+str}` === str) { return str; } @@ -236,13 +235,13 @@ const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); * @returns {string} common prefix */ const getCommonPrefix = (items) => { - let prefix = items[0]; + let [prefix] = items; for (let i = 1; i < items.length; i++) { const item = items[i]; - for (let p = 0; p < prefix.length; p++) { - if (item[p] !== prefix[p]) { - prefix = prefix.slice(0, p); + for (let prefixIndex = 0; prefixIndex < prefix.length; prefixIndex++) { + if (item[prefixIndex] !== prefix[prefixIndex]) { + prefix = prefix.slice(0, prefixIndex); break; } } @@ -256,13 +255,17 @@ const getCommonPrefix = (items) => { * @returns {string} common suffix */ const getCommonSuffix = (items) => { - let suffix = items[0]; + let [suffix] = items; for (let i = 1; i < items.length; i++) { const item = items[i]; - for (let p = item.length - 1, s = suffix.length - 1; s >= 0; p--, s--) { - if (item[p] !== suffix[s]) { - suffix = suffix.slice(s + 1); + for ( + let itemIndex = item.length - 1, suffixIndex = suffix.length - 1; + suffixIndex >= 0; + itemIndex--, suffixIndex-- + ) { + if (item[itemIndex] !== suffix[suffixIndex]) { + suffix = suffix.slice(suffixIndex + 1); break; } } @@ -326,7 +329,6 @@ const itemsToRegexp = (itemsArr) => { for (const item of itemsArr) { if (item.length === 1) { - // eslint-disable-next-line no-plusplus countOfSingleCharItems++; } } @@ -353,12 +355,14 @@ const itemsToRegexp = (itemsArr) => { if (finishedItems.length === 0 && items.size === 2) { const prefix = getCommonPrefix(itemsArr); const suffix = getCommonSuffix( - itemsArr.map((item) => item.slice(prefix.length)) + itemsArr.map((item) => item.slice(prefix.length)), ); if (prefix.length > 0 || suffix.length > 0) { return `${quoteMeta(prefix)}${itemsToRegexp( - itemsArr.map((i) => i.slice(prefix.length, -suffix.length || undefined)) + itemsArr.map((i) => + i.slice(prefix.length, -suffix.length || undefined), + ), )}${quoteMeta(suffix)}`; } } @@ -371,7 +375,7 @@ const itemsToRegexp = (itemsArr) => { const b = it.next().value; if (a.length > 0 && b.length > 0 && a.slice(-1) === b.slice(-1)) { return `${itemsToRegexp([a.slice(0, -1), b.slice(0, -1)])}${quoteMeta( - a.slice(-1) + a.slice(-1), )}`; } } @@ -384,14 +388,14 @@ const itemsToRegexp = (itemsArr) => { if (list.length >= 3) return true; if (list.length <= 1) return false; return list[0][1] === list[1][1]; - } + }, ); for (const prefixedItems of prefixed) { const prefix = getCommonPrefix(prefixedItems); finishedItems.push( `${quoteMeta(prefix)}${itemsToRegexp( - prefixedItems.map((i) => i.slice(prefix.length)) - )}` + prefixedItems.map((i) => i.slice(prefix.length)), + )}`, ); } @@ -403,20 +407,20 @@ const itemsToRegexp = (itemsArr) => { if (list.length >= 3) return true; if (list.length <= 1) return false; return list[0].slice(-2) === list[1].slice(-2); - } + }, ); for (const suffixedItems of suffixed) { const suffix = getCommonSuffix(suffixedItems); finishedItems.push( `${itemsToRegexp( - suffixedItems.map((i) => i.slice(0, -suffix.length)) - )}${quoteMeta(suffix)}` + suffixedItems.map((i) => i.slice(0, -suffix.length)), + )}${quoteMeta(suffix)}`, ); } // TODO further optimize regexp, i. e. // use ranges: (1|2|3|4|a) => [1-4a] - const conditional = finishedItems.concat(Array.from(items, quoteMeta)); + const conditional = [...finishedItems, ...Array.from(items, quoteMeta)]; if (conditional.length === 1) return conditional[0]; return `(${conditional.join("|")})`; }; @@ -424,7 +428,7 @@ const itemsToRegexp = (itemsArr) => { /** * @param {string[]} positiveItems positive items * @param {string[]} negativeItems negative items - * @returns {function(string): string} a template function to determine the value at runtime + * @returns {(val: string) => string} a template function to determine the value at runtime */ const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => { if (positiveItems.length === 0) { @@ -455,8 +459,8 @@ const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => { // TODO simplify in the next major release and use it from webpack /** - * @param {Record} map value map - * @returns {boolean|(function(string): string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime + * @param {Record} map value map + * @returns {boolean | ((value: string) => string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime */ const compileBooleanMatcher = (map) => { const positiveItems = Object.keys(map).filter((i) => map[i]); @@ -474,17 +478,17 @@ const compileBooleanMatcher = (map) => { }; module.exports = { - trueFn, - findModuleById, - evalModuleCode, - compareModulesByIdentifier, - MODULE_TYPE, - AUTO_PUBLIC_PATH, ABSOLUTE_PUBLIC_PATH, + AUTO_PUBLIC_PATH, BASE_URI, + MODULE_TYPE, SINGLE_DOT_PATH_SEGMENT, - stringifyRequest, - stringifyLocal, - getUndoPath, + compareModulesByIdentifier, compileBooleanMatcher, + evalModuleCode, + findModuleById, + getUndoPath, + stringifyLocal, + stringifyRequest, + trueFn, }; diff --git a/test/HMR.test.js b/test/HMR.test.js index 1c781d9b..e9bf89f2 100644 --- a/test/HMR.test.js +++ b/test/HMR.test.js @@ -1,8 +1,8 @@ /** - @jest-environment jsdom + * @jest-environment jsdom */ +/* global document */ /* eslint-env browser */ -/* eslint-disable no-console */ import hotModuleReplacement from "../src/hmr/hotModuleReplacement"; import { hotLoader } from "../src/loader"; @@ -48,7 +48,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -71,7 +71,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -89,7 +89,7 @@ describe("HMR", () => { setTimeout(() => { const links2 = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links2[0].visited).toBe(true); @@ -116,7 +116,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -141,7 +141,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -167,7 +167,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -194,7 +194,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -221,7 +221,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -248,7 +248,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -275,7 +275,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -301,7 +301,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -324,7 +324,7 @@ describe("HMR", () => { expect(console.log.mock.calls[0][0]).toMatchSnapshot(); const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); expect(links[0].visited).toBe(true); @@ -343,7 +343,7 @@ describe("HMR", () => { link.innerHTML = ''; document.head.appendChild(link); - document.head.removeChild = jest.fn(); + jest.spyOn(document.head, "removeChild").mockImplementation(); const update = hotModuleReplacement("./dist/main.css", {}); @@ -351,7 +351,7 @@ describe("HMR", () => { setTimeout(() => { const links = Array.prototype.slice.call( - document.querySelectorAll("link") + document.querySelectorAll("link"), ); links[1].dispatchEvent(getLoadEvent()); diff --git a/test/TestCache.test.js b/test/TestCache.test.js index d749b7e5..5cf619e1 100644 --- a/test/TestCache.test.js +++ b/test/TestCache.test.js @@ -4,8 +4,8 @@ import path from "path"; -import webpack from "webpack"; import del from "del"; +import webpack from "webpack"; describe("TestCache", () => { afterEach(() => { @@ -15,11 +15,11 @@ describe("TestCache", () => { it("should work without cache", async () => { const casesDirectory = path.resolve(__dirname, "cases"); const directoryForCase = path.resolve(casesDirectory, "asset-modules"); - // eslint-disable-next-line import/no-dynamic-require, global-require - const webpackConfig = require(path.resolve( - directoryForCase, - "webpack.config.js" - )); + + const webpackConfig = require( + path.resolve(directoryForCase, "webpack.config.js"), + ); + const outputPath = path.resolve(__dirname, "js/cache-false"); await del([outputPath]); @@ -51,7 +51,7 @@ describe("TestCache", () => { "static/react.svg", ] `); - expect(Array.from(stats.compilation.emittedAssets).sort()) + expect([...stats.compilation.emittedAssets].sort()) .toMatchInlineSnapshot(` Array [ "main.css", @@ -106,11 +106,11 @@ describe("TestCache", () => { it('should work with the "memory" cache', async () => { const casesDirectory = path.resolve(__dirname, "cases"); const directoryForCase = path.resolve(casesDirectory, "asset-modules"); - // eslint-disable-next-line import/no-dynamic-require, global-require - const webpackConfig = require(path.resolve( - directoryForCase, - "webpack.config.js" - )); + + const webpackConfig = require( + path.resolve(directoryForCase, "webpack.config.js"), + ); + const outputPath = path.resolve(__dirname, "js/cache-memory"); await del([outputPath]); @@ -144,7 +144,7 @@ describe("TestCache", () => { "static/react.svg", ] `); - expect(Array.from(stats.compilation.emittedAssets).sort()) + expect([...stats.compilation.emittedAssets].sort()) .toMatchInlineSnapshot(` Array [ "main.css", @@ -201,15 +201,15 @@ describe("TestCache", () => { it('should work with the "filesystem" cache', async () => { const casesDirectory = path.resolve(__dirname, "cases"); const directoryForCase = path.resolve(casesDirectory, "simple"); - // eslint-disable-next-line import/no-dynamic-require, global-require - const webpackConfig = require(path.resolve( - directoryForCase, - "webpack.config.js" - )); + + const webpackConfig = require( + path.resolve(directoryForCase, "webpack.config.js"), + ); + const outputPath = path.resolve(__dirname, "js/cache-filesystem"); const fileSystemCacheDirectory = path.resolve( __dirname, - "./js/.cache/type-filesystem" + "./js/.cache/type-filesystem", ); await del([outputPath, fileSystemCacheDirectory]); @@ -245,7 +245,7 @@ describe("TestCache", () => { "main.js", ] `); - expect(Array.from(stats.compilation.emittedAssets).sort()) + expect([...stats.compilation.emittedAssets].sort()) .toMatchInlineSnapshot(` Array [ "main.css", @@ -303,15 +303,15 @@ describe("TestCache", () => { it('should work with the "filesystem" cache #2', async () => { const casesDirectory = path.resolve(__dirname, "cases"); const directoryForCase = path.resolve(casesDirectory, "at-import-layer"); - // eslint-disable-next-line import/no-dynamic-require, global-require - const webpackConfig = require(path.resolve( - directoryForCase, - "webpack.config.js" - )); + + const webpackConfig = require( + path.resolve(directoryForCase, "webpack.config.js"), + ); + const outputPath = path.resolve(__dirname, "js/cache-filesystem-1"); const fileSystemCacheDirectory = path.resolve( __dirname, - "./js/.cache/type-filesystem-1" + "./js/.cache/type-filesystem-1", ); await del([outputPath, fileSystemCacheDirectory]); @@ -347,7 +347,7 @@ describe("TestCache", () => { "main.js", ] `); - expect(Array.from(stats.compilation.emittedAssets).sort()) + expect([...stats.compilation.emittedAssets].sort()) .toMatchInlineSnapshot(` Array [ "main.css", @@ -405,18 +405,18 @@ describe("TestCache", () => { it('should work with the "filesystem" cache and asset modules', async () => { const casesDirectory = path.resolve(__dirname, "cases"); const directoryForCase = path.resolve(casesDirectory, "asset-modules"); - // eslint-disable-next-line import/no-dynamic-require, global-require - const webpackConfig = require(path.resolve( - directoryForCase, - "webpack.config.js" - )); + + const webpackConfig = require( + path.resolve(directoryForCase, "webpack.config.js"), + ); + const outputPath = path.resolve( __dirname, - "js/cache-filesystem-asset-modules" + "js/cache-filesystem-asset-modules", ); const fileSystemCacheDirectory = path.resolve( __dirname, - "./js/.cache/type-filesystem-asset-modules" + "./js/.cache/type-filesystem-asset-modules", ); await del([outputPath, fileSystemCacheDirectory]); @@ -453,7 +453,7 @@ describe("TestCache", () => { "static/react.svg", ] `); - expect(Array.from(stats.compilation.emittedAssets).sort()) + expect([...stats.compilation.emittedAssets].sort()) .toMatchInlineSnapshot(` Array [ "main.css", @@ -513,18 +513,18 @@ describe("TestCache", () => { it('should work with the "filesystem" cache and file-loader', async () => { const casesDirectory = path.resolve(__dirname, "cases"); const directoryForCase = path.resolve(casesDirectory, "file-loader"); - // eslint-disable-next-line import/no-dynamic-require, global-require - const webpackConfig = require(path.resolve( - directoryForCase, - "webpack.config.js" - )); + + const webpackConfig = require( + path.resolve(directoryForCase, "webpack.config.js"), + ); + const outputPath = path.resolve( __dirname, - "js/cache-filesystem-file-loader" + "js/cache-filesystem-file-loader", ); const fileSystemCacheDirectory = path.resolve( __dirname, - "./js/.cache/type-filesystem-file-loader" + "./js/.cache/type-filesystem-file-loader", ); await del([outputPath, fileSystemCacheDirectory]); @@ -561,7 +561,7 @@ describe("TestCache", () => { "static/react.svg", ] `); - expect(Array.from(stats.compilation.emittedAssets).sort()) + expect([...stats.compilation.emittedAssets].sort()) .toMatchInlineSnapshot(` Array [ "main.css", diff --git a/test/TestCases.test.js b/test/TestCases.test.js index ed4a7c9b..1c52ccbb 100644 --- a/test/TestCases.test.js +++ b/test/TestCases.test.js @@ -16,7 +16,7 @@ function clearDirectory(dirPath) { try { files = fs.readdirSync(dirPath); - } catch (e) { + } catch { return; } if (files.length > 0) { @@ -33,7 +33,7 @@ function clearDirectory(dirPath) { try { fs.rmdirSync(dirPath); - } catch (_err) { + } catch { // Nothing } } @@ -49,24 +49,22 @@ function compareDirectory(actual, expected) { if (stats.isDirectory()) { compareDirectory( path.resolve(actual, file), - path.resolve(expected, file) + path.resolve(expected, file), ); } else if (stats.isFile()) { const content = fs.readFileSync(path.resolve(expected, file), "utf8"); let actualContent; - if (/^MISSING/.test(content)) { + if (content.startsWith("MISSING")) { expect(fs.existsSync(path.resolve(actual, file))).toBe(false); } else { try { actualContent = fs.readFileSync(path.resolve(actual, file), "utf8"); } catch (error) { - // eslint-disable-next-line no-console console.log(error); const dir = fs.readdirSync(actual); - // eslint-disable-next-line no-console console.log({ [actual]: dir }); } @@ -83,9 +81,10 @@ describe("TestCases", () => { const testDirectory = path.join(casesDirectory, test); const filterPath = path.join(testDirectory, "test.filter.js"); - // eslint-disable-next-line global-require, import/no-dynamic-require if (fs.existsSync(filterPath) && !require(filterPath)()) { + // eslint-disable-next-line jest/no-disabled-tests describe.skip(test, () => { + // eslint-disable-next-line jest/expect-expect it("filtered", () => {}); }); @@ -99,7 +98,6 @@ describe("TestCases", () => { for (const directory of tests) { if (!/^(\.|_)/.test(directory)) { - // eslint-disable-next-line no-loop-func it(`${directory} should compile to the expected result`, (done) => { if (directory === "serializingBigStrings") { clearDirectory(path.resolve(__dirname, "../node_modules/.cache")); @@ -107,14 +105,14 @@ describe("TestCases", () => { const directoryForCase = path.resolve(casesDirectory, directory); const outputDirectoryForCase = path.resolve(outputDirectory, directory); - // eslint-disable-next-line import/no-dynamic-require, global-require - const webpackConfig = require(path.resolve( - directoryForCase, - "webpack.config.js" - )); + + const webpackConfig = require( + path.resolve(directoryForCase, "webpack.config.js"), + ); + const { context } = webpackConfig; - for (const config of [].concat(webpackConfig)) { + for (const config of [webpackConfig].flat()) { Object.assign( config, { @@ -123,12 +121,10 @@ describe("TestCases", () => { }, config, { - output: Object.assign( - { - path: outputDirectoryForCase, - }, - config.output - ), + output: { + path: outputDirectoryForCase, + ...config.output, + }, plugins: config.plugins && config.plugins.map((p) => { @@ -145,7 +141,7 @@ describe("TestCases", () => { return p; }), }, - context ? { context } : {} + context ? { context } : {}, ); } @@ -161,12 +157,12 @@ describe("TestCases", () => { if (fs.existsSync(errorsPath)) { const { errors } = stats.compilation; - // eslint-disable-next-line global-require, import/no-dynamic-require + const errorFilters = require(errorsPath); + const filteredErrors = errors.filter( - // eslint-disable-next-line no-shadow (error) => - !errorFilters.some((errorFilter) => errorFilter.test(error)) + !errorFilters.some((errorFilter) => errorFilter.test(error)), ); if (filteredErrors.length > 0) { @@ -192,8 +188,8 @@ describe("TestCases", () => { context: path.resolve(__dirname, ".."), errorDetails: true, warnings: true, - }) - ) + }), + ), ); return; @@ -204,10 +200,10 @@ describe("TestCases", () => { expectedDirectory, `webpack-${webpack.version[0]}${ yn(process.env.OLD_API) ? "" : "-importModule" - }` + }`, ); - if (/^hmr/.test(directory)) { + if (directory.startsWith("hmr")) { let res = fs .readFileSync(path.resolve(outputDirectoryForCase, "main.js")) .toString(); @@ -218,26 +214,26 @@ describe("TestCases", () => { res = res.replace(dateRegexp, ""); const matchAll = res.match( - /__webpack_require__\.h = \(\) => \(("[\d\w].*")\)/i + /__webpack_require__\.h = \(\) => \(("[\d\w].*")\)/i, ); - const replacer = new Array(matchAll[1].length); + const replacer = Array.from({ length: matchAll[1].length }); res = res.replace( /__webpack_require__\.h = \(\) => \(("[\d\w].*")\)/i, - `__webpack_require__.h = () => ("${replacer.fill("x").join("")}")` + `__webpack_require__.h = () => ("${replacer.fill("x").join("")}")`, ); fs.writeFileSync( path.resolve(outputDirectoryForCase, "main.js"), - res + res, ); } if (fs.existsSync(expectedDirectoryByVersion)) { compareDirectory( outputDirectoryForCase, - expectedDirectoryByVersion + expectedDirectoryByVersion, ); } else if (fs.existsSync(expectedDirectory)) { compareDirectory(outputDirectoryForCase, expectedDirectory); @@ -250,17 +246,17 @@ describe("TestCases", () => { all: false, warnings: true, }); - // eslint-disable-next-line global-require, import/no-dynamic-require + const expectedWarnings = require(warningsFile); expect( actualWarnings .trim() - .replace(/\*\scss\s(.*)?!/g, "* css /path/to/loader.js!") + .replace(/\*\scss\s(.*)?!/g, "* css /path/to/loader.js!"), ).toBe( expectedWarnings .trim() - .replace(/\*\scss\s(.*)?!/g, "* css /path/to/loader.js!") + .replace(/\*\scss\s(.*)?!/g, "* css /path/to/loader.js!"), ); } diff --git a/test/TestMemoryFS.test.js b/test/TestMemoryFS.test.js index 87da96f2..3ca33756 100644 --- a/test/TestMemoryFS.test.js +++ b/test/TestMemoryFS.test.js @@ -1,6 +1,6 @@ import path from "path"; -import { createFsFromVolume, Volume } from "memfs"; +import { Volume, createFsFromVolume } from "memfs"; import webpack from "webpack"; const assetsNames = (assets) => assets.map((asset) => asset.name); @@ -10,13 +10,13 @@ describe("TestMemoryFS", () => { const casesDirectory = path.resolve(__dirname, "cases"); const directoryForCase = path.resolve( casesDirectory, - "publicpath-default-auto" + "publicpath-default-auto", ); - // eslint-disable-next-line import/no-dynamic-require, global-require - const webpackConfig = require(path.resolve( - directoryForCase, - "webpack.config.js" - )); + + const webpackConfig = require( + path.resolve(directoryForCase, "webpack.config.js"), + ); + const compiler = webpack({ ...webpackConfig, mode: "development", @@ -41,7 +41,7 @@ describe("TestMemoryFS", () => { } expect(assetsNames(stats1.compilation.getAssets())).toEqual( - assetsNames(stats2.compilation.getAssets()) + assetsNames(stats2.compilation.getAssets()), ); done(); diff --git a/test/api.test.js b/test/api.test.js index 1f00bdbc..e71fddaf 100644 --- a/test/api.test.js +++ b/test/api.test.js @@ -5,13 +5,13 @@ import MiniCssExtractPlugin from "../src"; describe("API", () => { it("should return the same CssModule when same webpack instance provided", () => { expect(MiniCssExtractPlugin.getCssModule(webpack)).toEqual( - MiniCssExtractPlugin.getCssModule(webpack) + MiniCssExtractPlugin.getCssModule(webpack), ); }); it("should return the same CssDependency when same webpack instance provided", () => { expect(MiniCssExtractPlugin.getCssDependency(webpack)).toEqual( - MiniCssExtractPlugin.getCssDependency(webpack) + MiniCssExtractPlugin.getCssDependency(webpack), ); }); }); diff --git a/test/attributes-option.test.js b/test/attributes-option.test.js index 17a3e123..8085035a 100644 --- a/test/attributes-option.test.js +++ b/test/attributes-option.test.js @@ -12,7 +12,7 @@ import { } from "./helpers/index"; describe("attributes option", () => { - it(`should work without attributes option`, async () => { + it("should work without attributes option", async () => { const compiler = getCompiler( "attributes.js", {}, @@ -27,7 +27,7 @@ describe("attributes option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); @@ -40,7 +40,7 @@ describe("attributes option", () => { expect(getErrors(stats)).toMatchSnapshot("errors"); }); - it(`should work with attributes option`, async () => { + it("should work with attributes option", async () => { const compiler = getCompiler( "attributes.js", {}, @@ -59,7 +59,7 @@ describe("attributes option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); diff --git a/test/cases/auxiliary-assets/fonts.css b/test/cases/auxiliary-assets/fonts.css index 959441f9..22b75b91 100644 --- a/test/cases/auxiliary-assets/fonts.css +++ b/test/cases/auxiliary-assets/fonts.css @@ -3,7 +3,9 @@ font-style: normal; font-weight: 300; font-display: swap; - src: local("Roboto Light"), local("Roboto-Light"), + src: + local("Roboto Light"), + local("Roboto-Light"), url("fonts/roboto-v18-latin-300.woff2") format("woff2"), url("fonts/roboto-v18-latin-300.woff") format("woff"), url("fonts/roboto-v18-latin-300.ttf") format("truetype"); diff --git a/test/cases/custom-loader-with-functional-exports/app/mockLoader.js b/test/cases/custom-loader-with-functional-exports/app/mockLoader.js index e2fc6775..0d70c763 100644 --- a/test/cases/custom-loader-with-functional-exports/app/mockLoader.js +++ b/test/cases/custom-loader-with-functional-exports/app/mockLoader.js @@ -9,6 +9,6 @@ export default function loader() { ]; export var cnA = () => "class-name-a"; -export var cnB = () => "class-name-b";` +export var cnB = () => "class-name-b";`, ); } diff --git a/test/cases/custom-loader-with-new-url-and-public-path-1/app/mockLoader.js b/test/cases/custom-loader-with-new-url-and-public-path-1/app/mockLoader.js index 7c6d5e1d..3131ef8d 100644 --- a/test/cases/custom-loader-with-new-url-and-public-path-1/app/mockLoader.js +++ b/test/cases/custom-loader-with-new-url-and-public-path-1/app/mockLoader.js @@ -7,6 +7,6 @@ export default function loader() { [module.id, ".foo {background: url(" + new URL("./img.png", import.meta.url) + ")}", ""], [module.id, ".bar {background: url(" + new URL("../outer-img.png", import.meta.url) + ")}", ""], [module.id, ".baz {background: url(" + new URL("./nested/nested-img.png", import.meta.url) + ")}", ""] - ]` + ]`, ); } diff --git a/test/cases/custom-loader-with-new-url-and-public-path-auto/app/mockLoader.js b/test/cases/custom-loader-with-new-url-and-public-path-auto/app/mockLoader.js index 7c6d5e1d..3131ef8d 100644 --- a/test/cases/custom-loader-with-new-url-and-public-path-auto/app/mockLoader.js +++ b/test/cases/custom-loader-with-new-url-and-public-path-auto/app/mockLoader.js @@ -7,6 +7,6 @@ export default function loader() { [module.id, ".foo {background: url(" + new URL("./img.png", import.meta.url) + ")}", ""], [module.id, ".bar {background: url(" + new URL("../outer-img.png", import.meta.url) + ")}", ""], [module.id, ".baz {background: url(" + new URL("./nested/nested-img.png", import.meta.url) + ")}", ""] - ]` + ]`, ); } diff --git a/test/cases/custom-loader-with-new-url-and-public-path-default-auto/app/mockLoader.js b/test/cases/custom-loader-with-new-url-and-public-path-default-auto/app/mockLoader.js index 7c6d5e1d..3131ef8d 100644 --- a/test/cases/custom-loader-with-new-url-and-public-path-default-auto/app/mockLoader.js +++ b/test/cases/custom-loader-with-new-url-and-public-path-default-auto/app/mockLoader.js @@ -7,6 +7,6 @@ export default function loader() { [module.id, ".foo {background: url(" + new URL("./img.png", import.meta.url) + ")}", ""], [module.id, ".bar {background: url(" + new URL("../outer-img.png", import.meta.url) + ")}", ""], [module.id, ".baz {background: url(" + new URL("./nested/nested-img.png", import.meta.url) + ")}", ""] - ]` + ]`, ); } diff --git a/test/cases/custom-loader-with-new-url-and-public-path/app/mockLoader.js b/test/cases/custom-loader-with-new-url-and-public-path/app/mockLoader.js index 7c6d5e1d..3131ef8d 100644 --- a/test/cases/custom-loader-with-new-url-and-public-path/app/mockLoader.js +++ b/test/cases/custom-loader-with-new-url-and-public-path/app/mockLoader.js @@ -7,6 +7,6 @@ export default function loader() { [module.id, ".foo {background: url(" + new URL("./img.png", import.meta.url) + ")}", ""], [module.id, ".bar {background: url(" + new URL("../outer-img.png", import.meta.url) + ")}", ""], [module.id, ".baz {background: url(" + new URL("./nested/nested-img.png", import.meta.url) + ")}", ""] - ]` + ]`, ); } diff --git a/test/cases/hmr-locals/expected/main.js b/test/cases/hmr-locals/expected/main.js index 57eaa19f..380fd841 100644 --- a/test/cases/hmr-locals/expected/main.js +++ b/test/cases/hmr-locals/expected/main.js @@ -7,13 +7,14 @@ \************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* eslint-env browser */ +/* global document */ /* eslint-disable no-console, func-names */ +// eslint-disable-next-line jsdoc/no-restricted-syntax /** @typedef {any} TODO */ const normalizeUrl = __webpack_require__(/*! ./normalize-url */ "../../../src/hmr/normalize-url.js"); @@ -24,36 +25,40 @@ const noDocument = typeof document === "undefined"; const { forEach } = Array.prototype; +// eslint-disable-next-line jsdoc/no-restricted-syntax /** - * @param {function} fn - * @param {number} time - * @returns {(function(): void)|*} + * @param {Function} fn any function + * @param {number} time time + * @returns {() => void} wrapped function */ function debounce(fn, time) { let timeout = 0; return function () { - // @ts-ignore + // @ts-expect-error const self = this; // eslint-disable-next-line prefer-rest-params const args = arguments; - + // eslint-disable-next-line func-style const functionCall = function functionCall() { return fn.apply(self, args); }; clearTimeout(timeout); - // @ts-ignore + // @ts-expect-error timeout = setTimeout(functionCall, time); }; } +/** + * @returns {void} + */ function noop() {} /** - * @param {TODO} moduleId - * @returns {TODO} + * @param {string | number} moduleId a module id + * @returns {TODO} current script url */ function getCurrentScriptUrl(moduleId) { let src = srcByModuleId[moduleId]; @@ -74,8 +79,8 @@ function getCurrentScriptUrl(moduleId) { } /** - * @param {string} fileMap - * @returns {null | string[]} + * @param {string} fileMap file map + * @returns {null | string[]} normalized files */ return function (fileMap) { if (!src) { @@ -97,15 +102,30 @@ function getCurrentScriptUrl(moduleId) { const reg = new RegExp(`${filename}\\.js$`, "g"); return normalizeUrl( - src.replace(reg, `${mapRule.replace(/{fileName}/g, filename)}.css`) + src.replace(reg, `${mapRule.replace(/{fileName}/g, filename)}.css`), ); }); }; } /** - * @param {TODO} el - * @param {string} [url] + * @param {string} url URL + * @returns {boolean} true when URL can be request, otherwise false + */ +function isUrlRequest(url) { + // An URL is not an request if + + // It is not http or https + if (!/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url)) { + return false; + } + + return true; +} + +/** + * @param {TODO} el html link element + * @param {string=} url a URL */ function updateCss(el, url) { if (!url) { @@ -127,11 +147,11 @@ function updateCss(el, url) { return; } + // eslint-disable-next-line unicorn/prefer-includes if (!url || !(url.indexOf(".css") > -1)) { return; } - // eslint-disable-next-line no-param-reassign el.visited = true; const newEl = el.cloneNode(); @@ -166,34 +186,34 @@ function updateCss(el, url) { } /** - * @param {string} href - * @param {TODO} src - * @returns {TODO} + * @param {string} href href + * @param {TODO} src src + * @returns {undefined | string} a reload url */ function getReloadUrl(href, src) { let ret; - // eslint-disable-next-line no-param-reassign href = normalizeUrl(href); src.some( /** - * @param {string} url + * @param {string} url url */ // eslint-disable-next-line array-callback-return (url) => { + // eslint-disable-next-line unicorn/prefer-includes if (href.indexOf(src) > -1) { ret = url; } - } + }, ); return ret; } /** - * @param {string} [src] - * @returns {boolean} + * @param {string=} src source + * @returns {boolean} true when loaded, otherwise false */ function reloadStyle(src) { if (!src) { @@ -210,7 +230,7 @@ function reloadStyle(src) { const url = getReloadUrl(el.href, src); - if (!isUrlRequest(url)) { + if (url && !isUrlRequest(url)) { return; } @@ -228,6 +248,9 @@ function reloadStyle(src) { return loaded; } +/** + * @returns {void} + */ function reloadAll() { const elements = document.querySelectorAll("link"); @@ -241,24 +264,9 @@ function reloadAll() { } /** - * @param {string} url - * @returns {boolean} - */ -function isUrlRequest(url) { - // An URL is not an request if - - // It is not http or https - if (!/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url)) { - return false; - } - - return true; -} - -/** - * @param {TODO} moduleId - * @param {TODO} options - * @returns {TODO} + * @param {number | string} moduleId a module id + * @param {TODO} options options + * @returns {TODO} wrapper function */ module.exports = function (moduleId, options) { if (noDocument) { @@ -269,6 +277,9 @@ module.exports = function (moduleId, options) { const getScriptSrc = getCurrentScriptUrl(moduleId); + /** + * @returns {void} + */ function update() { const src = getScriptSrc(options.filename); const reloaded = reloadStyle(src); @@ -302,15 +313,13 @@ module.exports = function (moduleId, options) { \*****************************************/ /***/ ((module) => { -/* eslint-disable */ - /** - * @param {string[]} pathComponents - * @returns {string} + * @param {string[]} pathComponents path components + * @returns {string} normalized url */ -function normalizeUrl(pathComponents) { +function normalizeUrlInner(pathComponents) { return pathComponents - .reduce(function (accumulator, item) { + .reduce((accumulator, item) => { switch (item) { case "..": accumulator.pop(); @@ -327,24 +336,27 @@ function normalizeUrl(pathComponents) { } /** - * @param {string} urlString - * @returns {string} + * @param {string} urlString url string + * @returns {string} normalized url string */ -module.exports = function (urlString) { +module.exports = function normalizeUrl(urlString) { urlString = urlString.trim(); if (/^data:/i.test(urlString)) { return urlString; } - var protocol = - urlString.indexOf("//") !== -1 ? urlString.split("//")[0] + "//" : ""; - var components = urlString.replace(new RegExp(protocol, "i"), "").split("/"); - var host = components[0].toLowerCase().replace(/\.$/, ""); + const protocol = + // eslint-disable-next-line unicorn/prefer-includes + urlString.indexOf("//") !== -1 ? `${urlString.split("//")[0]}//` : ""; + const components = urlString + .replace(new RegExp(protocol, "i"), "") + .split("/"); + const host = components[0].toLowerCase().replace(/\.$/, ""); components[0] = ""; - var path = normalizeUrl(components); + const path = normalizeUrlInner(components); return protocol + host + path; }; diff --git a/test/cases/hmr/expected/main.js b/test/cases/hmr/expected/main.js index 2f0148e0..d44d58dc 100644 --- a/test/cases/hmr/expected/main.js +++ b/test/cases/hmr/expected/main.js @@ -7,13 +7,14 @@ \************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* eslint-env browser */ +/* global document */ /* eslint-disable no-console, func-names */ +// eslint-disable-next-line jsdoc/no-restricted-syntax /** @typedef {any} TODO */ const normalizeUrl = __webpack_require__(/*! ./normalize-url */ "../../../src/hmr/normalize-url.js"); @@ -24,36 +25,40 @@ const noDocument = typeof document === "undefined"; const { forEach } = Array.prototype; +// eslint-disable-next-line jsdoc/no-restricted-syntax /** - * @param {function} fn - * @param {number} time - * @returns {(function(): void)|*} + * @param {Function} fn any function + * @param {number} time time + * @returns {() => void} wrapped function */ function debounce(fn, time) { let timeout = 0; return function () { - // @ts-ignore + // @ts-expect-error const self = this; // eslint-disable-next-line prefer-rest-params const args = arguments; - + // eslint-disable-next-line func-style const functionCall = function functionCall() { return fn.apply(self, args); }; clearTimeout(timeout); - // @ts-ignore + // @ts-expect-error timeout = setTimeout(functionCall, time); }; } +/** + * @returns {void} + */ function noop() {} /** - * @param {TODO} moduleId - * @returns {TODO} + * @param {string | number} moduleId a module id + * @returns {TODO} current script url */ function getCurrentScriptUrl(moduleId) { let src = srcByModuleId[moduleId]; @@ -74,8 +79,8 @@ function getCurrentScriptUrl(moduleId) { } /** - * @param {string} fileMap - * @returns {null | string[]} + * @param {string} fileMap file map + * @returns {null | string[]} normalized files */ return function (fileMap) { if (!src) { @@ -97,15 +102,30 @@ function getCurrentScriptUrl(moduleId) { const reg = new RegExp(`${filename}\\.js$`, "g"); return normalizeUrl( - src.replace(reg, `${mapRule.replace(/{fileName}/g, filename)}.css`) + src.replace(reg, `${mapRule.replace(/{fileName}/g, filename)}.css`), ); }); }; } /** - * @param {TODO} el - * @param {string} [url] + * @param {string} url URL + * @returns {boolean} true when URL can be request, otherwise false + */ +function isUrlRequest(url) { + // An URL is not an request if + + // It is not http or https + if (!/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url)) { + return false; + } + + return true; +} + +/** + * @param {TODO} el html link element + * @param {string=} url a URL */ function updateCss(el, url) { if (!url) { @@ -127,11 +147,11 @@ function updateCss(el, url) { return; } + // eslint-disable-next-line unicorn/prefer-includes if (!url || !(url.indexOf(".css") > -1)) { return; } - // eslint-disable-next-line no-param-reassign el.visited = true; const newEl = el.cloneNode(); @@ -166,34 +186,34 @@ function updateCss(el, url) { } /** - * @param {string} href - * @param {TODO} src - * @returns {TODO} + * @param {string} href href + * @param {TODO} src src + * @returns {undefined | string} a reload url */ function getReloadUrl(href, src) { let ret; - // eslint-disable-next-line no-param-reassign href = normalizeUrl(href); src.some( /** - * @param {string} url + * @param {string} url url */ // eslint-disable-next-line array-callback-return (url) => { + // eslint-disable-next-line unicorn/prefer-includes if (href.indexOf(src) > -1) { ret = url; } - } + }, ); return ret; } /** - * @param {string} [src] - * @returns {boolean} + * @param {string=} src source + * @returns {boolean} true when loaded, otherwise false */ function reloadStyle(src) { if (!src) { @@ -210,7 +230,7 @@ function reloadStyle(src) { const url = getReloadUrl(el.href, src); - if (!isUrlRequest(url)) { + if (url && !isUrlRequest(url)) { return; } @@ -228,6 +248,9 @@ function reloadStyle(src) { return loaded; } +/** + * @returns {void} + */ function reloadAll() { const elements = document.querySelectorAll("link"); @@ -241,24 +264,9 @@ function reloadAll() { } /** - * @param {string} url - * @returns {boolean} - */ -function isUrlRequest(url) { - // An URL is not an request if - - // It is not http or https - if (!/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url)) { - return false; - } - - return true; -} - -/** - * @param {TODO} moduleId - * @param {TODO} options - * @returns {TODO} + * @param {number | string} moduleId a module id + * @param {TODO} options options + * @returns {TODO} wrapper function */ module.exports = function (moduleId, options) { if (noDocument) { @@ -269,6 +277,9 @@ module.exports = function (moduleId, options) { const getScriptSrc = getCurrentScriptUrl(moduleId); + /** + * @returns {void} + */ function update() { const src = getScriptSrc(options.filename); const reloaded = reloadStyle(src); @@ -302,15 +313,13 @@ module.exports = function (moduleId, options) { \*****************************************/ /***/ ((module) => { -/* eslint-disable */ - /** - * @param {string[]} pathComponents - * @returns {string} + * @param {string[]} pathComponents path components + * @returns {string} normalized url */ -function normalizeUrl(pathComponents) { +function normalizeUrlInner(pathComponents) { return pathComponents - .reduce(function (accumulator, item) { + .reduce((accumulator, item) => { switch (item) { case "..": accumulator.pop(); @@ -327,24 +336,27 @@ function normalizeUrl(pathComponents) { } /** - * @param {string} urlString - * @returns {string} + * @param {string} urlString url string + * @returns {string} normalized url string */ -module.exports = function (urlString) { +module.exports = function normalizeUrl(urlString) { urlString = urlString.trim(); if (/^data:/i.test(urlString)) { return urlString; } - var protocol = - urlString.indexOf("//") !== -1 ? urlString.split("//")[0] + "//" : ""; - var components = urlString.replace(new RegExp(protocol, "i"), "").split("/"); - var host = components[0].toLowerCase().replace(/\.$/, ""); + const protocol = + // eslint-disable-next-line unicorn/prefer-includes + urlString.indexOf("//") !== -1 ? `${urlString.split("//")[0]}//` : ""; + const components = urlString + .replace(new RegExp(protocol, "i"), "") + .split("/"); + const host = components[0].toLowerCase().replace(/\.$/, ""); components[0] = ""; - var path = normalizeUrl(components); + const path = normalizeUrlInner(components); return protocol + host + path; }; diff --git a/test/emit-option.test.js b/test/emit-option.test.js index 18c5c9c4..bd4eef10 100644 --- a/test/emit-option.test.js +++ b/test/emit-option.test.js @@ -2,8 +2,8 @@ import fs from "fs"; import path from "path"; -import webpack from "webpack"; import del from "del"; +import webpack from "webpack"; import MiniCssExtractPlugin from "../src"; @@ -16,7 +16,7 @@ import { } from "./helpers/index"; describe("emit option", () => { - it(`should work without emit option`, async () => { + it("should work without emit option", async () => { const compiler = getCompiler( "style-url.js", {}, @@ -32,18 +32,18 @@ describe("emit option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot( - "assets" + "assets", ); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); }); - it(`should work when emit option is "true"`, async () => { + it('should work when emit option is "true"', async () => { const compiler = getCompiler( "style-url.js", { @@ -60,18 +60,18 @@ describe("emit option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot( - "assets" + "assets", ); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); }); - it(`should work when emit option is "false"`, async () => { + it('should work when emit option is "false"', async () => { const compiler = getCompiler( "style-url.js", { @@ -87,18 +87,18 @@ describe("emit option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot( - "assets" + "assets", ); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); }); - it(`should work with locals when emit option is "false"`, async () => { + it('should work with locals when emit option is "false"', async () => { const compiler = getCompiler( "locals.js", {}, @@ -133,7 +133,7 @@ describe("emit option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); @@ -144,7 +144,7 @@ describe("emit option", () => { expect(getErrors(stats)).toMatchSnapshot("errors"); }); - it(`should work with locals and invalidate cache when emit option is "false"`, async () => { + it('should work with locals and invalidate cache when emit option is "false"', async () => { const modifyAsset = path.resolve(__dirname, "fixtures", "locals/index.css"); const modifyAssetContent = fs.readFileSync(modifyAsset); @@ -163,7 +163,7 @@ describe("emit option", () => { fs.writeFileSync(this.options.file, newContent); callback(); - } + }, ); } } @@ -224,11 +224,11 @@ describe("emit option", () => { compiler1.close(() => { expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot( - `assets` + "assets", + ); + expect([...stats.compilation.emittedAssets].sort()).toMatchSnapshot( + "emittedAssets", ); - expect( - Array.from(stats.compilation.emittedAssets).sort() - ).toMatchSnapshot(`emittedAssets`); runInJsDom("main.js", compiler1, stats, (dom) => { expect(dom.serialize()).toMatchSnapshot("DOM"); }); @@ -252,11 +252,11 @@ describe("emit option", () => { compiler2.close(() => { expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot( - `assets` + "assets", + ); + expect([...stats.compilation.emittedAssets].sort()).toMatchSnapshot( + "emittedAssets", ); - expect( - Array.from(stats.compilation.emittedAssets).sort() - ).toMatchSnapshot(`emittedAssets`); runInJsDom("main.js", compiler2, stats, (dom) => { expect(dom.serialize()).toMatchSnapshot("DOM"); }); @@ -326,11 +326,11 @@ describe("emit option", () => { } expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot( - `assets` + "assets", + ); + expect([...stats.compilation.emittedAssets].sort()).toMatchSnapshot( + "emittedAssets", ); - expect( - Array.from(stats.compilation.emittedAssets).sort() - ).toMatchSnapshot(`emittedAssets`); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); @@ -348,11 +348,11 @@ describe("emit option", () => { compiler.close(() => { expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot( - `assets` + "assets", + ); + expect([...stats.compilation.emittedAssets].sort()).toMatchSnapshot( + "emittedAssets", ); - expect( - Array.from(stats.compilation.emittedAssets).sort() - ).toMatchSnapshot(`emittedAssets`); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); @@ -372,10 +372,10 @@ describe("emit option", () => { compiler.hooks.emit.tapAsync( "AssetsModifyPlugin", (compilation, callback) => { - fs.writeFileSync(this.options.file, `.a{color: red;}`); + fs.writeFileSync(this.options.file, ".a{color: red;}"); callback(); - } + }, ); } } @@ -440,11 +440,11 @@ describe("emit option", () => { compiler1.close(() => { expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot( - `assets` + "assets", + ); + expect([...stats.compilation.emittedAssets].sort()).toMatchSnapshot( + "emittedAssets", ); - expect( - Array.from(stats.compilation.emittedAssets).sort() - ).toMatchSnapshot(`emittedAssets`); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); @@ -465,11 +465,11 @@ describe("emit option", () => { compiler2.close(() => { expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot( - `assets` + "assets", + ); + expect([...stats.compilation.emittedAssets].sort()).toMatchSnapshot( + "emittedAssets", ); - expect( - Array.from(stats.compilation.emittedAssets).sort() - ).toMatchSnapshot(`emittedAssets`); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); diff --git a/test/enforce-esm.test.js b/test/enforce-esm.test.js index ca6fe74d..eed34dbc 100644 --- a/test/enforce-esm.test.js +++ b/test/enforce-esm.test.js @@ -1,69 +1,71 @@ -import { getCompiler, source, compile } from "./helpers"; +import { compile, getCompiler, source } from "./helpers"; -it("should enforce esm for empty module without options.esModule", async () => { - expect.assertions(3); +describe("ES modules", () => { + it("should enforce esm for empty module without options.esModule", async () => { + expect.assertions(3); - const compiler = getCompiler( - "./esm.js", - {}, - { - mode: "production", - optimization: { minimize: false }, - } - ); - const stats = await compile(compiler); - expect(stats.hasErrors()).toBe(false); - const { modules } = stats.toJson({ all: false, modules: true }); - expect( - modules.filter((m) => m.moduleType !== "runtime" && !m.orphan).length - ).toBe(2); - expect(source("./simple.css", stats)).toMatchInlineSnapshot(` + const compiler = getCompiler( + "./esm.js", + {}, + { + mode: "production", + optimization: { minimize: false }, + }, + ); + const stats = await compile(compiler); + expect(stats.hasErrors()).toBe(false); + const { modules } = stats.toJson({ all: false, modules: true }); + expect( + modules.filter((m) => m.moduleType !== "runtime" && !m.orphan), + ).toHaveLength(2); + expect(source("./simple.css", stats)).toMatchInlineSnapshot(` "// extracted by mini-css-extract-plugin export {};" `); -}); + }); -it("should enforce esm for empty module with options.esModule", async () => { - expect.assertions(3); + it("should enforce esm for empty module with options.esModule", async () => { + expect.assertions(3); - const compiler = getCompiler( - "./esm.js", - { esModule: true }, - { - mode: "production", - optimization: { minimize: false }, - } - ); - const stats = await compile(compiler); - expect(stats.hasErrors()).toBe(false); - const { modules } = stats.toJson({ all: false, modules: true }); - expect( - modules.filter((m) => m.moduleType !== "runtime" && !m.orphan).length - ).toBe(2); - expect(source("./simple.css", stats)).toMatchInlineSnapshot(` + const compiler = getCompiler( + "./esm.js", + { esModule: true }, + { + mode: "production", + optimization: { minimize: false }, + }, + ); + const stats = await compile(compiler); + expect(stats.hasErrors()).toBe(false); + const { modules } = stats.toJson({ all: false, modules: true }); + expect( + modules.filter((m) => m.moduleType !== "runtime" && !m.orphan), + ).toHaveLength(2); + expect(source("./simple.css", stats)).toMatchInlineSnapshot(` "// extracted by mini-css-extract-plugin export {};" `); -}); + }); -it('should keep empty module when options.esModule is equal "false"', async () => { - expect.assertions(3); + it('should keep empty module when options.esModule is equal "false"', async () => { + expect.assertions(3); - const compiler = getCompiler( - "./esm.js", - { esModule: false }, - { - mode: "production", - optimization: { minimize: false }, - } - ); - const stats = await compile(compiler); - expect(stats.hasErrors()).toBe(false); - const { modules } = stats.toJson({ all: false, modules: true }); - expect( - modules.filter((m) => m.moduleType !== "runtime" && !m.orphan).length - ).toBe(2); - expect(source("./simple.css", stats)).toMatchInlineSnapshot( - `"// extracted by mini-css-extract-plugin"` - ); + const compiler = getCompiler( + "./esm.js", + { esModule: false }, + { + mode: "production", + optimization: { minimize: false }, + }, + ); + const stats = await compile(compiler); + expect(stats.hasErrors()).toBe(false); + const { modules } = stats.toJson({ all: false, modules: true }); + expect( + modules.filter((m) => m.moduleType !== "runtime" && !m.orphan), + ).toHaveLength(2); + expect(source("./simple.css", stats)).toMatchInlineSnapshot( + '"// extracted by mini-css-extract-plugin"', + ); + }); }); diff --git a/test/helpers/getCompiler.js b/test/helpers/getCompiler.js index 7f94a459..505dc441 100644 --- a/test/helpers/getCompiler.js +++ b/test/helpers/getCompiler.js @@ -1,7 +1,7 @@ import path from "path"; +import { Volume, createFsFromVolume } from "memfs"; import webpack from "webpack"; -import { createFsFromVolume, Volume } from "memfs"; import MiniCssExtractPlugin from "../../src"; @@ -32,13 +32,14 @@ export default (fixture, loaderOptions = {}, config = {}) => { }, ], }, - ].concat({ - test: /\.svg$/, - type: "asset/resource", - generator: { - filename: "[name][ext]", + { + test: /\.svg$/, + type: "asset/resource", + generator: { + filename: "[name][ext]", + }, }, - }), + ], }, plugins: [ new MiniCssExtractPlugin({ @@ -53,11 +54,9 @@ export default (fixture, loaderOptions = {}, config = {}) => { const compiler = webpack(fullConfig); - if (!outputFileSystem) { - compiler.outputFileSystem = createFsFromVolume(new Volume()); - } else { - compiler.outputFileSystem = outputFileSystem; - } + compiler.outputFileSystem = !outputFileSystem + ? createFsFromVolume(new Volume()) + : outputFileSystem; return compiler; }; diff --git a/test/helpers/index.js b/test/helpers/index.js index 264da9e1..0ab5682f 100644 --- a/test/helpers/index.js +++ b/test/helpers/index.js @@ -1,17 +1,7 @@ -import compile from "./compile"; -import getCompiler from "./getCompiler"; -import source from "./source"; -import readAsset from "./readAsset"; -import runInJsDom from "./runInJsDom"; -import getErrors from "./getErrors"; -import getWarnings from "./getWarnings"; - -export { - source, - compile, - getCompiler, - readAsset, - runInJsDom, - getErrors, - getWarnings, -}; +export { default as compile } from "./compile"; +export { default as getCompiler } from "./getCompiler"; +export { default as runInJsDom } from "./runInJsDom"; +export { default as getWarnings } from "./getWarnings"; +export { default as getErrors } from "./getErrors"; +export { default as source } from "./source"; +export { default as readAsset } from "./readAsset"; diff --git a/test/helpers/normalizeErrors.js b/test/helpers/normalizeErrors.js index 72baa177..e2269227 100644 --- a/test/helpers/normalizeErrors.js +++ b/test/helpers/normalizeErrors.js @@ -1,11 +1,14 @@ +/** + * @param {string} str string + * @returns {string} string without cwd + */ function removeCWD(str) { const isWin = process.platform === "win32"; let cwd = process.cwd(); if (isWin) { - // eslint-disable-next-line no-param-reassign str = str.replace(/\\/g, "/"); - // eslint-disable-next-line no-param-reassign + cwd = cwd.replace(/\\/g, "/"); } @@ -14,5 +17,5 @@ function removeCWD(str) { export default (errors) => errors.map((error) => - removeCWD(error.toString().split("\n").slice(0, 2).join("\n")) + removeCWD(error.toString().split("\n").slice(0, 2).join("\n")), ); diff --git a/test/helpers/runInJsDom.js b/test/helpers/runInJsDom.js index 1775e42a..387b19f4 100644 --- a/test/helpers/runInJsDom.js +++ b/test/helpers/runInJsDom.js @@ -2,15 +2,20 @@ import jsdom from "jsdom"; import { readAsset } from "./index"; +/** + * @param {string} assetName asset name + * @param {Compiler} compiler compiler + * @param {Stats} stats stats + * @param {(dom: JSDOM, code: string) => void} testFn test function + */ function runInJsDom(assetName, compiler, stats, testFn) { const bundle = readAsset(assetName, compiler, stats); const virtualConsole = new jsdom.VirtualConsole(); virtualConsole.sendTo(console); - try { - const dom = new jsdom.JSDOM( - ` + const dom = new jsdom.JSDOM( + ` style-loader test @@ -23,22 +28,19 @@ function runInJsDom(assetName, compiler, stats, testFn) { `, - { - resources: "usable", - runScripts: "dangerously", - virtualConsole, - } - ); - - dom.window.eval(bundle); - - testFn(dom, bundle); - - // free memory associated with the window - dom.window.close(); - } catch (e) { - throw e; - } + { + resources: "usable", + runScripts: "dangerously", + virtualConsole, + }, + ); + + dom.window.eval(bundle); + + testFn(dom, bundle); + + // free memory associated with the window + dom.window.close(); } export default runInJsDom; diff --git a/test/helpers/source.js b/test/helpers/source.js index 4a10b472..54c5fddc 100644 --- a/test/helpers/source.js +++ b/test/helpers/source.js @@ -1,3 +1,8 @@ +/** + * @param {string} name name + * @param {Stats} stats stats + * @returns {undefined | string | Buffer} source + */ export default function getSource(name, stats) { const { modules } = stats.toJson({ source: true }); @@ -15,6 +20,5 @@ export default function getSource(name, stats) { } } - // eslint-disable-next-line no-undefined return undefined; } diff --git a/test/helpers/yn.js b/test/helpers/yn.js index 9834ac74..38e6c26e 100644 --- a/test/helpers/yn.js +++ b/test/helpers/yn.js @@ -1,3 +1,8 @@ +/** + * @param {string} value value + * @param {boolean} defaultValue default value + * @returns {boolean} yes or no + */ function yn(value, defaultValue = false) { if (/^(?:y|yes|true|1|on)$/i.test(value)) { return true; diff --git a/test/hooks.test.js b/test/hooks.test.js index 373c21cf..61c7be6e 100644 --- a/test/hooks.test.js +++ b/test/hooks.test.js @@ -5,10 +5,10 @@ import { Template } from "webpack"; import MiniCssExtractPlugin from "../src"; -import { runInJsDom, compile, getCompiler } from "./helpers/index"; +import { compile, getCompiler, runInJsDom } from "./helpers/index"; describe("hooks", () => { - it(`beforeTagInsert`, async () => { + it("beforeTagInsert", async () => { const webpackCompiler = getCompiler( "insert.js", {}, @@ -25,49 +25,47 @@ describe("hooks", () => { }), { /** - * - * @param {import('webpack').Compiler} compiler + * @param {import('webpack').Compiler} compiler compiler */ apply: (compiler) => { compiler.hooks.compilation.tap("sri", (compilation) => { MiniCssExtractPlugin.getCompilationHooks( - compilation + compilation, ).beforeTagInsert.tap("sri", (source, varNames) => Template.asString([ source, `${varNames.tag}.setAttribute("integrity", "sriHashes[${varNames.chunkId}]");`, - ]) + ]), ); }); }, }, { /** - * - * @param {import('webpack').Compiler} compiler + * @param {import('webpack').Compiler} compiler compiler */ apply: (compiler) => { compiler.hooks.compilation.tap("href", (compilation) => { MiniCssExtractPlugin.getCompilationHooks( - compilation + compilation, ).beforeTagInsert.tap("changeHref", (source, varNames) => Template.asString([ source, `${varNames.tag}.setAttribute("href", "https://github.com/webpack-contrib/mini-css-extract-plugin");`, - ]) + ]), ); }); }, }, ], - } + }, ); const stats = await compile(webpackCompiler); runInJsDom("main.bundle.js", webpackCompiler, stats, (dom) => { const [tag] = dom.window.document.head.getElementsByTagName("link"); expect(tag.getAttribute("integrity")).toBe("sriHashes[chunkId]"); expect(tag.getAttribute("href")).toBe( - "https://github.com/webpack-contrib/mini-css-extract-plugin" + "https://github.com/webpack-contrib/mini-css-extract-plugin", ); }); }); diff --git a/test/ignoreOrder-option.test.js b/test/ignoreOrder-option.test.js index 912f19b7..eff9585c 100644 --- a/test/ignoreOrder-option.test.js +++ b/test/ignoreOrder-option.test.js @@ -6,11 +6,11 @@ describe("IgnoreOrder", () => { it("should emit warnings", (done) => { const casesDirectory = path.resolve(__dirname, "cases"); const directoryForCase = path.resolve(casesDirectory, "ignoreOrderFalse"); - // eslint-disable-next-line import/no-dynamic-require, global-require - const webpackConfig = require(path.resolve( - directoryForCase, - "webpack.config.js" - )); + + const webpackConfig = require( + path.resolve(directoryForCase, "webpack.config.js"), + ); + const compiler = webpack({ ...webpackConfig, mode: "development", @@ -26,11 +26,11 @@ describe("IgnoreOrder", () => { it("should not emit warnings", (done) => { const casesDirectory = path.resolve(__dirname, "cases"); const directoryForCase = path.resolve(casesDirectory, "ignoreOrder"); - // eslint-disable-next-line import/no-dynamic-require, global-require - const webpackConfig = require(path.resolve( - directoryForCase, - "webpack.config.js" - )); + + const webpackConfig = require( + path.resolve(directoryForCase, "webpack.config.js"), + ); + const compiler = webpack({ ...webpackConfig, mode: "development", diff --git a/test/insert-option.test.js b/test/insert-option.test.js index 34000ca8..76ec7dae 100644 --- a/test/insert-option.test.js +++ b/test/insert-option.test.js @@ -1,4 +1,4 @@ -/* eslint-env browser */ +/* global document */ import path from "path"; import MiniCssExtractPlugin from "../src"; @@ -12,7 +12,7 @@ import { } from "./helpers/index"; describe("insert option", () => { - it(`should work without insert option`, async () => { + it("should work without insert option", async () => { const compiler = getCompiler( "insert.js", {}, @@ -28,7 +28,7 @@ describe("insert option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); @@ -40,7 +40,7 @@ describe("insert option", () => { expect(getErrors(stats)).toMatchSnapshot("errors"); }); - it(`should work when insert option is string`, async () => { + it("should work when insert option is string", async () => { const compiler = getCompiler( "insert.js", {}, @@ -57,7 +57,7 @@ describe("insert option", () => { insert: "#existing-style", }), ], - } + }, ); const stats = await compile(compiler); @@ -69,7 +69,7 @@ describe("insert option", () => { expect(getErrors(stats)).toMatchSnapshot("errors"); }); - it(`should work when insert option is function`, async () => { + it("should work when insert option is function", async () => { const compiler = getCompiler( "insert.js", {}, @@ -92,7 +92,7 @@ describe("insert option", () => { }, }), ], - } + }, ); const stats = await compile(compiler); diff --git a/test/linkTag-option.test.js b/test/linkTag-option.test.js index 9c3cfaad..e863d66b 100644 --- a/test/linkTag-option.test.js +++ b/test/linkTag-option.test.js @@ -12,7 +12,7 @@ import { } from "./helpers/index"; describe("linkType option", () => { - it(`should work without linkType option`, async () => { + it("should work without linkType option", async () => { const compiler = getCompiler( "attributes.js", {}, @@ -27,7 +27,7 @@ describe("linkType option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); @@ -39,7 +39,7 @@ describe("linkType option", () => { expect(getErrors(stats)).toMatchSnapshot("errors"); }); - it(`should work when linkType option is "false"`, async () => { + it('should work when linkType option is "false"', async () => { const compiler = getCompiler( "attributes.js", {}, @@ -55,7 +55,7 @@ describe("linkType option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); @@ -67,7 +67,7 @@ describe("linkType option", () => { expect(getErrors(stats)).toMatchSnapshot("errors"); }); - it(`should work when linkType option is "text/css"`, async () => { + it('should work when linkType option is "text/css"', async () => { const compiler = getCompiler( "attributes.js", {}, @@ -83,7 +83,7 @@ describe("linkType option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); diff --git a/test/manual/src/index.js b/test/manual/src/index.js index 76f0dc49..03a68dc2 100644 --- a/test/manual/src/index.js +++ b/test/manual/src/index.js @@ -67,14 +67,16 @@ makeButton(".lazy-module-button", () => .querySelector(".lazy-css-module") // eslint-disable-next-line no-underscore-dangle .classList.add(module.__esModule ? module.default.style : module.style); - }) + }), ); -makeButton(".preloaded-button1", () => - import(/* webpackChunkName: "preloaded1" */ "./preloaded1") +makeButton( + ".preloaded-button1", + () => import(/* webpackChunkName: "preloaded1" */ "./preloaded1"), ); -makeButton(".preloaded-button2", () => - import(/* webpackChunkName: "preloaded2" */ "./preloaded2") +makeButton( + ".preloaded-button2", + () => import(/* webpackChunkName: "preloaded2" */ "./preloaded2"), ); makeButton(".lazy-failure-button", () => import("./lazy-failure"), false); @@ -85,7 +87,7 @@ makeButton(".crossorigin", () => { const promise = import("./crossorigin").then(() => { const lastTwoElements = Array.from(document.head.children).slice(-2); const hasCrossorigin = lastTwoElements.every( - (element) => element.crossOrigin === "anonymous" + (element) => element.crossOrigin === "anonymous", ); if (!hasCrossorigin) { throw new Error('Chunks miss crossorigin="anonymous" attribute.'); @@ -106,12 +108,12 @@ worker.addEventListener("message", (event) => { makeButton( ".prefetch-button", () => import(/* webpackPrefetch: true */ "./prefetch.css"), - false + false, ); makeButton( ".preload-button", // eslint-disable-next-line import/extensions () => import("./preload.js"), - false + false, ); diff --git a/test/manual/src/preloaded1.js b/test/manual/src/preloaded1.js index a398bcc9..58f14943 100644 --- a/test/manual/src/preloaded1.js +++ b/test/manual/src/preloaded1.js @@ -1,4 +1,4 @@ -/* eslint-env browser */ +/* global alert */ /* eslint-disable no-alert */ import "./preloaded1.css"; diff --git a/test/manual/webpack.config.js b/test/manual/webpack.config.js index d4da523c..3e4c4d81 100644 --- a/test/manual/webpack.config.js +++ b/test/manual/webpack.config.js @@ -1,5 +1,5 @@ -const yn = require("../helpers/yn"); const Self = require("../../"); +const yn = require("../helpers/yn"); const ENABLE_HMR = typeof process.env.ENABLE_HMR !== "undefined" diff --git a/test/nonce.test.js b/test/nonce.test.js index b6a7993c..70e5e976 100644 --- a/test/nonce.test.js +++ b/test/nonce.test.js @@ -12,7 +12,7 @@ import { } from "./helpers/index"; describe("nonce", () => { - it(`should work when __webpack_nonce__ is not defined`, async () => { + it("should work when __webpack_nonce__ is not defined", async () => { const compiler = getCompiler( "no-nonce.js", {}, @@ -28,7 +28,7 @@ describe("nonce", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); @@ -40,7 +40,7 @@ describe("nonce", () => { expect(getErrors(stats)).toMatchSnapshot("errors"); }); - it(`should work when __webpack_nonce__ is defined`, async () => { + it("should work when __webpack_nonce__ is defined", async () => { const compiler = getCompiler( "nonce.js", {}, @@ -56,7 +56,7 @@ describe("nonce", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); diff --git a/test/normalize-url.test.js b/test/normalize-url.test.js index ae5ba6d0..d7b8612b 100644 --- a/test/normalize-url.test.js +++ b/test/normalize-url.test.js @@ -3,7 +3,7 @@ import normalizeUrl from "../src/hmr/normalize-url"; import dataUrls from "./fixtures/json/data-urls.json"; describe("normalize-url", () => { - dataUrls.main.forEach((entry) => { + for (const entry of dataUrls.main) { const [url, expected] = entry; it(`should work with "${url}" url`, async () => { @@ -11,5 +11,5 @@ describe("normalize-url", () => { expect(result).toBe(expected); }); - }); + } }); diff --git a/test/runtime-option.test.js b/test/runtime-option.test.js index 2f638ae6..d18bab15 100644 --- a/test/runtime-option.test.js +++ b/test/runtime-option.test.js @@ -27,7 +27,7 @@ describe("noRuntime option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); @@ -57,7 +57,7 @@ describe("noRuntime option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); @@ -65,7 +65,7 @@ describe("noRuntime option", () => { expect(dom.serialize()).toMatchSnapshot("DOM"); expect(bundle).not.toContain("webpack/runtime/css loading"); expect(bundle).not.toContain( - "webpack/runtime/get mini-css chunk filename" + "webpack/runtime/get mini-css chunk filename", ); }); @@ -89,7 +89,7 @@ describe("noRuntime option", () => { filename: "[name].css", }), ], - } + }, ); const stats = await compile(compiler); diff --git a/test/stringifyLocal.test.js b/test/stringifyLocal.test.js index fc2743ff..faca6fa5 100644 --- a/test/stringifyLocal.test.js +++ b/test/stringifyLocal.test.js @@ -1,25 +1,26 @@ import { stringifyLocal } from "../src/utils"; describe("stringifyLocal", () => { - it(`primitive`, async () => { + it("primitive", async () => { const testObj = "classA"; expect(stringifyLocal(testObj)).toBe('"classA"'); }); - it(`arrow function`, async () => { + it("arrow function", async () => { const testFn = () => "classA"; expect(stringifyLocal(testFn)).toBe('() => "classA"'); }); - it(`function`, async () => { + it("function", async () => { + // eslint-disable-next-line func-style const testFn = function testFn() { return "classA"; }; expect(stringifyLocal(testFn)).toBe( - 'function testFn() {\n return "classA";\n }' + 'function testFn() {\n return "classA";\n }', ); }); }); diff --git a/test/validate-loader-options.test.js b/test/validate-loader-options.test.js index e3c371dc..24e5b2ce 100644 --- a/test/validate-loader-options.test.js +++ b/test/validate-loader-options.test.js @@ -1,4 +1,4 @@ -import { getCompiler, compile } from "./helpers"; +import { compile, getCompiler } from "./helpers"; describe("validate options", () => { const tests = { diff --git a/test/validate-plugin-options.test.js b/test/validate-plugin-options.test.js index ff95fbfc..e4451ec3 100644 --- a/test/validate-plugin-options.test.js +++ b/test/validate-plugin-options.test.js @@ -55,12 +55,12 @@ describe("validate options", () => { try { // eslint-disable-next-line no-new new MiniCssExtractPlugin({ [key]: value }); - } catch (errorFromPlugin) { - if (errorFromPlugin.name !== "ValidationError") { - throw errorFromPlugin; + } catch (err) { + if (err.name !== "ValidationError") { + throw err; } - error = errorFromPlugin; + error = err; } finally { if (type === "success") { expect(error).toBeUndefined(); diff --git a/types/hmr/hotModuleReplacement.d.ts b/types/hmr/hotModuleReplacement.d.ts index 8d2cb64d..8f72d9f8 100644 --- a/types/hmr/hotModuleReplacement.d.ts +++ b/types/hmr/hotModuleReplacement.d.ts @@ -1,3 +1,6 @@ -declare function _exports(moduleId: TODO, options: TODO): TODO; +declare namespace _exports { + export { TODO }; +} +declare function _exports(moduleId: number | string, options: TODO): TODO; export = _exports; -export type TODO = any; +type TODO = any; diff --git a/types/hooks.d.ts b/types/hooks.d.ts index e88af2fa..dba8db44 100644 --- a/types/hooks.d.ts +++ b/types/hooks.d.ts @@ -1,5 +1,5 @@ export function getCompilationHooks( - compilation: Compilation + compilation: Compilation, ): MiniCssExtractPluginCompilationHooks; export type Compilation = import("webpack").Compilation; export type VarNames = { diff --git a/types/index.d.ts b/types/index.d.ts index c8b9a5c6..bf2a3d83 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,16 +1,16 @@ export = MiniCssExtractPlugin; declare class MiniCssExtractPlugin { /** - * @param {Compiler["webpack"]} webpack - * @returns {CssModuleConstructor} + * @param {Compiler["webpack"]} webpack webpack + * @returns {CssModuleConstructor} CSS module constructor */ static getCssModule(webpack: Compiler["webpack"]): CssModuleConstructor; /** - * @param {Compiler["webpack"]} webpack - * @returns {CssDependencyConstructor} + * @param {Compiler["webpack"]} webpack webpack + * @returns {CssDependencyConstructor} CSS dependency constructor */ static getCssDependency( - webpack: Compiler["webpack"] + webpack: Compiler["webpack"], ): CssDependencyConstructor; /** * Returns all hooks for the given compilation @@ -18,16 +18,15 @@ declare class MiniCssExtractPlugin { * @returns {MiniCssExtractPluginCompilationHooks} hooks */ static getCompilationHooks( - compilation: Compilation + compilation: Compilation, ): MiniCssExtractPluginCompilationHooks; /** - * @param {PluginOptions} [options] + * @param {PluginOptions=} options options */ constructor(options?: PluginOptions | undefined); /** * @private * @type {WeakMap>} - * @private */ private _sortedModulesCache; /** @@ -41,35 +40,35 @@ declare class MiniCssExtractPlugin { */ private runtimeOptions; /** - * @param {Compiler} compiler + * @param {Compiler} compiler compiler */ apply(compiler: Compiler): void; /** * @private - * @param {Chunk} chunk - * @param {ChunkGraph} chunkGraph - * @returns {Iterable} + * @param {Chunk} chunk chunk + * @param {ChunkGraph} chunkGraph chunk graph + * @returns {Iterable} modules */ private getChunkModules; /** * @private - * @param {Compilation} compilation - * @param {Chunk} chunk - * @param {CssModule[]} modules - * @param {Compilation["requestShortener"]} requestShortener - * @returns {Set} + * @param {Compilation} compilation compilation + * @param {Chunk} chunk chunk + * @param {CssModule[]} modules modules + * @param {Compilation["requestShortener"]} requestShortener request shortener + * @returns {Set} css modules */ private sortModules; /** * @private - * @param {Compiler} compiler - * @param {Compilation} compilation - * @param {Chunk} chunk - * @param {CssModule[]} modules - * @param {Compiler["requestShortener"]} requestShortener - * @param {string} filenameTemplate - * @param {Parameters['output']['filename'], string | undefined>>[0]} pathData - * @returns {Source} + * @param {Compiler} compiler compiler + * @param {Compilation} compilation compilation + * @param {Chunk} chunk chunk + * @param {CssModule[]} modules modules + * @param {Compiler["requestShortener"]} requestShortener request shortener + * @param {string} filenameTemplate filename template + * @param {Parameters['output']['filename'], string | undefined>>[0]} pathData path data + * @returns {Source} source */ private renderContentAsset; } @@ -106,32 +105,6 @@ declare namespace MiniCssExtractPlugin { MiniCssExtractPluginCompilationHooks, }; } -type Compiler = import("webpack").Compiler; -type CssModuleConstructor = new (dependency: CssModuleDependency) => CssModule; -type CssDependencyConstructor = new ( - loaderDependency: CssDependencyOptions, - context: string | null, - identifierIndex: number -) => CssDependency; -type Compilation = import("webpack").Compilation; -type MiniCssExtractPluginCompilationHooks = { - beforeTagInsert: import("tapable").SyncWaterfallHook< - [string, VarNames], - string - >; - linkPreload: SyncWaterfallHook<[string, Chunk]>; - linkPrefetch: SyncWaterfallHook<[string, Chunk]>; -}; -type PluginOptions = { - filename?: Required["output"]["filename"]; - chunkFilename?: Required["output"]["chunkFilename"]; - ignoreOrder?: boolean | undefined; - insert?: string | ((linkTag: HTMLLinkElement) => void) | undefined; - attributes?: Record | undefined; - linkType?: string | false | undefined; - runtime?: boolean | undefined; - experimentalUseImportModule?: boolean | undefined; -}; /** @typedef {import("schema-utils/declarations/validate").Schema} Schema */ /** @typedef {import("webpack").Compiler} Compiler */ /** @typedef {import("webpack").Compilation} Compilation */ @@ -146,46 +119,48 @@ type PluginOptions = { /** @typedef {import("webpack").AssetInfo} AssetInfo */ /** @typedef {import("./loader.js").Dependency} LoaderDependency */ /** - * @typedef {Object} LoaderOptions - * @property {string | ((resourcePath: string, rootContext: string) => string)} [publicPath] - * @property {boolean} [emit] - * @property {boolean} [esModule] - * @property {string} [layer] - * @property {boolean} [defaultExport] + * @typedef {object} LoaderOptions + * @property {string | ((resourcePath: string, rootContext: string) => string)=} publicPath public path + * @property {boolean=} emit true when need to emit, otherwise false + * @property {boolean=} esModule need to generate ES module syntax + * @property {string=} layer a layer + * @property {boolean=} defaultExport true when need to use default export, otherwise false */ /** - * @typedef {Object} PluginOptions - * @property {Required['output']['filename']} [filename] - * @property {Required['output']['chunkFilename']} [chunkFilename] - * @property {boolean} [ignoreOrder] - * @property {string | ((linkTag: HTMLLinkElement) => void)} [insert] - * @property {Record} [attributes] - * @property {string | false | 'text/css'} [linkType] - * @property {boolean} [runtime] - * @property {boolean} [experimentalUseImportModule] + * @typedef {object} PluginOptions + * @property {Required['output']['filename']=} filename filename + * @property {Required['output']['chunkFilename']=} chunkFilename chunk filename + * @property {boolean=} ignoreOrder true when need to ignore order, otherwise false + * @property {string | ((linkTag: HTMLLinkElement) => void)=} insert link insert place or a custom insert function + * @property {Record=} attributes link attributes + * @property {string | false | 'text/css'=} linkType value of a link type attribute + * @property {boolean=} runtime true when need to generate runtime code, otherwise false + * @property {boolean=} experimentalUseImportModule true when need to use `experimentalUseImportModule` API, otherwise false */ /** - * @typedef {Object} NormalizedPluginOptions - * @property {Required['output']['filename']} filename - * @property {Required['output']['chunkFilename']} [chunkFilename] - * @property {boolean} ignoreOrder - * @property {string | ((linkTag: HTMLLinkElement) => void)} [insert] - * @property {Record} [attributes] - * @property {string | false | 'text/css'} [linkType] - * @property {boolean} runtime - * @property {boolean} [experimentalUseImportModule] + * @typedef {object} NormalizedPluginOptions + * @property {Required['output']['filename']} filename filename + * @property {Required['output']['chunkFilename']=} chunkFilename chunk filename + * @property {boolean} ignoreOrder true when need to ignore order, otherwise false + * @property {string | ((linkTag: HTMLLinkElement) => void)=} insert a link insert place or a custom insert function + * @property {Record=} attributes link attributes + * @property {string | false | 'text/css'=} linkType value of a link type attribute + * @property {boolean} runtime true when need to generate runtime code, otherwise false + * @property {boolean=} experimentalUseImportModule true when need to use `experimentalUseImportModule` API, otherwise false */ /** - * @typedef {Object} RuntimeOptions - * @property {string | ((linkTag: HTMLLinkElement) => void) | undefined} insert - * @property {string | false | 'text/css'} linkType - * @property {Record | undefined} attributes + * @typedef {object} RuntimeOptions + * @property {string | ((linkTag: HTMLLinkElement) => void)=} insert a link insert place or a custom insert function + * @property {string | false | 'text/css'} linkType value of a link type attribute + * @property {Record=} attributes link attributes */ /** @typedef {any} TODO */ declare const pluginName: "mini-css-extract-plugin"; declare const pluginSymbol: unique symbol; declare var loader: string; type Schema = import("schema-utils/declarations/validate").Schema; +type Compiler = import("webpack").Compiler; +type Compilation = import("webpack").Compilation; type ChunkGraph = import("webpack").ChunkGraph; type Chunk = import("webpack").Chunk; type ChunkGroup = Parameters[0]; @@ -197,67 +172,190 @@ type WebpackError = import("webpack").WebpackError; type AssetInfo = import("webpack").AssetInfo; type LoaderDependency = import("./loader.js").Dependency; type LoaderOptions = { + /** + * public path + */ publicPath?: - | string - | ((resourcePath: string, rootContext: string) => string) + | (string | ((resourcePath: string, rootContext: string) => string)) | undefined; + /** + * true when need to emit, otherwise false + */ emit?: boolean | undefined; + /** + * need to generate ES module syntax + */ esModule?: boolean | undefined; + /** + * a layer + */ layer?: string | undefined; + /** + * true when need to use default export, otherwise false + */ defaultExport?: boolean | undefined; }; +type PluginOptions = { + /** + * filename + */ + filename?: Required["output"]["filename"] | undefined; + /** + * chunk filename + */ + chunkFilename?: + | Required["output"]["chunkFilename"] + | undefined; + /** + * true when need to ignore order, otherwise false + */ + ignoreOrder?: boolean | undefined; + /** + * link insert place or a custom insert function + */ + insert?: (string | ((linkTag: HTMLLinkElement) => void)) | undefined; + /** + * link attributes + */ + attributes?: Record | undefined; + /** + * value of a link type attribute + */ + linkType?: (string | false | "text/css") | undefined; + /** + * true when need to generate runtime code, otherwise false + */ + runtime?: boolean | undefined; + /** + * true when need to use `experimentalUseImportModule` API, otherwise false + */ + experimentalUseImportModule?: boolean | undefined; +}; type NormalizedPluginOptions = { + /** + * filename + */ filename: Required["output"]["filename"]; - chunkFilename?: Required["output"]["chunkFilename"]; + /** + * chunk filename + */ + chunkFilename?: + | Required["output"]["chunkFilename"] + | undefined; + /** + * true when need to ignore order, otherwise false + */ ignoreOrder: boolean; - insert?: string | ((linkTag: HTMLLinkElement) => void) | undefined; + /** + * a link insert place or a custom insert function + */ + insert?: (string | ((linkTag: HTMLLinkElement) => void)) | undefined; + /** + * link attributes + */ attributes?: Record | undefined; - linkType?: string | false | undefined; + /** + * value of a link type attribute + */ + linkType?: (string | false | "text/css") | undefined; + /** + * true when need to generate runtime code, otherwise false + */ runtime: boolean; + /** + * true when need to use `experimentalUseImportModule` API, otherwise false + */ experimentalUseImportModule?: boolean | undefined; }; type RuntimeOptions = { - insert: string | ((linkTag: HTMLLinkElement) => void) | undefined; + /** + * a link insert place or a custom insert function + */ + insert?: (string | ((linkTag: HTMLLinkElement) => void)) | undefined; + /** + * value of a link type attribute + */ linkType: string | false | "text/css"; - attributes: Record | undefined; + /** + * link attributes + */ + attributes?: Record | undefined; }; type TODO = any; -type CssModule = import("webpack").Module & { +type CssModule = Module & { content: Buffer; - media?: string | undefined; - sourceMap?: Buffer | undefined; - supports?: string | undefined; - layer?: string | undefined; - assets?: - | { - [key: string]: any; - } - | undefined; - assetsInfo?: Map | undefined; + media?: string; + sourceMap?: Buffer; + supports?: string; + layer?: string; + assets?: { + [key: string]: TODO; + }; + assetsInfo?: Map; }; type CssModuleDependency = { context: string | null; identifier: string; identifierIndex: number; content: Buffer; - sourceMap?: Buffer | undefined; - media?: string | undefined; - supports?: string | undefined; + sourceMap?: Buffer; + media?: string; + supports?: string; layer?: TODO; - assetsInfo?: Map | undefined; - assets?: - | { - [key: string]: any; - } - | undefined; + assetsInfo?: Map; + assets?: { + [key: string]: TODO; + }; +}; +type CssModuleConstructor = { + new (dependency: CssModuleDependency): CssModule; }; type CssDependency = Dependency & CssModuleDependency; type CssDependencyOptions = Omit; +type CssDependencyConstructor = { + new ( + loaderDependency: CssDependencyOptions, + context: string | null, + identifierIndex: number, + ): CssDependency; +}; type VarNames = { + /** + * tag + */ tag: string; + /** + * chunk id + */ chunkId: string; + /** + * href + */ href: string; + /** + * resolve + */ resolve: string; + /** + * reject + */ reject: string; }; +type MiniCssExtractPluginCompilationHooks = { + /** + * before tag insert hook + */ + beforeTagInsert: import("tapable").SyncWaterfallHook< + [string, VarNames], + string + >; + /** + * link preload hook + */ + linkPreload: SyncWaterfallHook<[string, Chunk]>; + /** + * link prefetch hook + */ + linkPrefetch: SyncWaterfallHook<[string, Chunk]>; +}; import { SyncWaterfallHook } from "tapable"; diff --git a/types/loader.d.ts b/types/loader.d.ts index 64ba61f4..f111cbfc 100644 --- a/types/loader.d.ts +++ b/types/loader.d.ts @@ -1,16 +1,17 @@ export = loader; /** * @this {import("webpack").LoaderContext} - * @param {string} content + * @param {string} content content + * @returns {string | undefined} the original content */ declare function loader( this: import("webpack").LoaderContext, - content: string + content: string, ): string | undefined; declare namespace loader { export { - pitch, hotLoader, + pitch, Schema, Compiler, Compilation, @@ -26,14 +27,6 @@ declare namespace loader { }; } import MiniCssExtractPlugin = require("./index"); -/** - * @this {import("webpack").LoaderContext} - * @param {string} request - */ -declare function pitch( - this: import("webpack").LoaderContext, - request: string -): void; /** @typedef {import("schema-utils/declarations/validate").Schema} Schema */ /** @typedef {import("webpack").Compiler} Compiler */ /** @typedef {import("webpack").Compilation} Compilation */ @@ -43,31 +36,39 @@ declare function pitch( /** @typedef {import("webpack").AssetInfo} AssetInfo */ /** @typedef {import("webpack").NormalModule} NormalModule */ /** @typedef {import("./index.js").LoaderOptions} LoaderOptions */ -/** @typedef {{ [key: string]: string | function }} Locals */ +/** @typedef {{[key: string]: string | Function }} Locals */ /** @typedef {any} TODO */ /** - * @typedef {Object} Dependency - * @property {string} identifier - * @property {string | null} context - * @property {Buffer} content - * @property {string} media - * @property {string} [supports] - * @property {string} [layer] - * @property {Buffer} [sourceMap] + * @typedef {object} Dependency + * @property {string} identifier identifier + * @property {string | null} context context + * @property {Buffer=} content content + * @property {string=} media media + * @property {string=} supports supports + * @property {string=} layer layer + * @property {Buffer=} sourceMap source map */ /** - * @param {string} content - * @param {{ loaderContext: import("webpack").LoaderContext, options: LoaderOptions, locals: Locals | undefined }} context - * @returns {string} + * @param {string} code code + * @param {{ loaderContext: import("webpack").LoaderContext, options: LoaderOptions, locals: Locals | undefined }} context context + * @returns {string} code and HMR code */ declare function hotLoader( - content: string, + code: string, context: { loaderContext: import("webpack").LoaderContext; options: LoaderOptions; locals: Locals | undefined; - } + }, ): string; +/** + * @this {import("webpack").LoaderContext} + * @param {string} request request + */ +declare function pitch( + this: import("webpack").LoaderContext, + request: string, +): void; type Schema = import("schema-utils/declarations/validate").Schema; type Compiler = import("webpack").Compiler; type Compilation = import("webpack").Compilation; @@ -82,11 +83,32 @@ type Locals = { }; type TODO = any; type Dependency = { + /** + * identifier + */ identifier: string; + /** + * context + */ context: string | null; - content: Buffer; - media: string; + /** + * content + */ + content?: Buffer | undefined; + /** + * media + */ + media?: string | undefined; + /** + * supports + */ supports?: string | undefined; + /** + * layer + */ layer?: string | undefined; + /** + * source map + */ sourceMap?: Buffer | undefined; }; diff --git a/types/utils.d.ts b/types/utils.d.ts index 363a2e07..b13c3a66 100644 --- a/types/utils.d.ts +++ b/types/utils.d.ts @@ -1,74 +1,73 @@ export type Compilation = import("webpack").Compilation; export type Module = import("webpack").Module; export type LoaderContext = import("webpack").LoaderContext; -/** @typedef {import("webpack").Compilation} Compilation */ -/** @typedef {import("webpack").Module} Module */ -/** @typedef {import("webpack").LoaderContext} LoaderContext */ +export const ABSOLUTE_PUBLIC_PATH: "webpack:///mini-css-extract-plugin/"; +export const AUTO_PUBLIC_PATH: "__mini_css_extract_plugin_public_path_auto__"; +export const BASE_URI: "webpack://"; +export const MODULE_TYPE: "css/mini-extract"; +export const SINGLE_DOT_PATH_SEGMENT: "__mini_css_extract_plugin_single_dot_path_segment__"; /** - * @returns {boolean} + * @param {Module} a a + * @param {Module} b b + * @returns {0 | 1 | -1} result of comparing */ -export function trueFn(): boolean; +export function compareModulesByIdentifier(a: Module, b: Module): 0 | 1 | -1; /** - * @param {Compilation} compilation - * @param {string | number} id - * @returns {null | Module} + * @param {Record} map value map + * @returns {boolean | ((value: string) => string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime */ -export function findModuleById( - compilation: Compilation, - id: string | number -): null | Module; +export function compileBooleanMatcher( + map: Record, +): boolean | ((value: string) => string); /** - * @param {LoaderContext} loaderContext - * @param {string | Buffer} code - * @param {string} filename - * @returns {object} + * @param {LoaderContext} loaderContext loader context + * @param {string | Buffer} code code + * @param {string} filename filename + * @returns {Record} exports of a module */ export function evalModuleCode( loaderContext: LoaderContext, code: string | Buffer, - filename: string -): object; + filename: string, +): Record; /** - * @param {Module} a - * @param {Module} b - * @returns {0 | 1 | -1} + * @param {Compilation} compilation compilation + * @param {string | number} id module id + * @returns {null | Module} the found module */ -export function compareModulesByIdentifier(a: Module, b: Module): 0 | 1 | -1; -export const MODULE_TYPE: "css/mini-extract"; -export const AUTO_PUBLIC_PATH: "__mini_css_extract_plugin_public_path_auto__"; -export const ABSOLUTE_PUBLIC_PATH: "webpack:///mini-css-extract-plugin/"; -export const BASE_URI: "webpack://"; -export const SINGLE_DOT_PATH_SEGMENT: "__mini_css_extract_plugin_single_dot_path_segment__"; +export function findModuleById( + compilation: Compilation, + id: string | number, +): null | Module; /** - * @param {LoaderContext} loaderContext - * @param {string} request - * @returns {string} + * @param {string} filename filename + * @param {string} outputPath output path + * @param {boolean} enforceRelative true when need to enforce relative path, otherwise false + * @returns {string} undo path */ -export function stringifyRequest( - loaderContext: LoaderContext, - request: string +export function getUndoPath( + filename: string, + outputPath: string, + enforceRelative: boolean, ): string; /** - * - * @param {string | function} value - * @returns {string} + * @param {string | Function} value local + * @returns {string} stringified local */ export function stringifyLocal(value: string | Function): string; /** - * @param {string} filename - * @param {string} outputPath - * @param {boolean} enforceRelative - * @returns {string} + * @param {LoaderContext} loaderContext the loader context + * @param {string} request a request + * @returns {string} a stringified request */ -export function getUndoPath( - filename: string, - outputPath: string, - enforceRelative: boolean +export function stringifyRequest( + loaderContext: LoaderContext, + request: string, ): string; +/** @typedef {import("webpack").Compilation} Compilation */ +/** @typedef {import("webpack").Module} Module */ +/** @typedef {import("webpack").LoaderContext} LoaderContext */ /** - * @param {Record} map value map - * @returns {boolean|(function(string): string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime + * @returns {boolean} always returns true */ -export function compileBooleanMatcher( - map: Record -): boolean | ((arg0: string) => string); +export function trueFn(): boolean;