diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 96980efe815..87b1056f8ca 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -86,7 +86,7 @@ jobs: run: npm ci --ignore-scripts - name: Prepare environment for tests - run: npm run build + run: npm run build -- --sourceMap true - name: Run tests and generate coverage run: npm run test:coverage -- --ci @@ -127,7 +127,7 @@ jobs: run: npm ci - name: Prepare environment for tests - run: npm run build + run: npm run build -- --sourceMap true - name: Run smoketests run: npm run test:smoketests diff --git a/.nycrc b/.nycrc index 36cd87040de..8e3c08972b8 100644 --- a/.nycrc +++ b/.nycrc @@ -1,6 +1,10 @@ { - "include": ["packages/**"], - "reporter": ["html", "json", "cobertura"], - "source-map": true, + "all": true, + "extension": [".ts", ".js"], + "include": ["packages/*/src/**/*.ts", "packages/*/lib/**/*.js"], + "require": ["source-map-support/register"], + "reporter": ["text", "html", "lcov"], + "sourceMap": true, + "clean": false, "exclude-after-remap": false } diff --git a/jest.config.js b/jest.config.js index 58e378bdddb..cd07680982f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,11 +1,16 @@ module.exports = { testEnvironment: "node", - collectCoverage: true, - coverageDirectory: ".nyc_output", + collectCoverageFrom: ["packages/*/src/**/*.ts"], + coverageDirectory: ".jest_coverage", coverageReporters: ["json"], - coveragePathIgnorePatterns: ["/test/"], transform: { - "^.+\\.(ts)?$": "ts-jest", + "^.+\\.tsx?$": [ + "ts-jest", + { + useESM: true, + tsconfig: "tsconfig.json", + }, + ], }, testRegex: ["/test/.*\\.(test.js|test.cjs|test.mjs|test.ts|test.cts|test.mts)$"], moduleFileExtensions: ["ts", "cts", "mts", "js", "cjs", "mjs", "json"], diff --git a/package-lock.json b/package-lock.json index bef5ff3fb86..06b53a565dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,12 +15,14 @@ "@babel/register": "^7.15.8", "@changesets/cli": "^2.30.0", "@changesets/get-github-info": "^0.8.0", + "@istanbuljs/esm-loader-hook": "^0.3.0", "@types/jest": "^30.0.0", "@types/node": "^22.5.5", "@types/rechoir": "^0.6.1", "coffeescript": "^2.7.0", "colorette": "^2.0.16", "concat-stream": "^2.0.0", + "cross-env": "^10.1.0", "cspell": "^9.4.0", "css-loader": "^7.1.2", "del-cli": "^7.0.0", @@ -88,6 +90,7 @@ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", @@ -573,6 +576,22 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-decorators": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.28.6.tgz", + "integrity": "sha512-71EYI0ONURHJBL4rSFXnITXqXrrY8q4P0q006DPfN+Rk+ASM+++IBXem/ruokgBZR8YNEWZ8R6B+rCb8VcUTqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-import-assertions": { "version": "7.28.6", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.28.6.tgz", @@ -1579,6 +1598,26 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-transform-typescript": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.28.6.tgz", + "integrity": "sha512-0YWL2RFxOqEm9Efk5PvreamxPME8OyY0wM5wh5lHjF+VtVhdneCWGzZeSqzOfiobVqQaNCd2z0tQvnI9DaPWPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.27.3", + "@babel/helper-create-class-features-plugin": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", + "@babel/plugin-syntax-typescript": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-transform-unicode-escapes": { "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.27.1.tgz", @@ -1746,6 +1785,26 @@ "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" } }, + "node_modules/@babel/preset-typescript": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.28.5.tgz", + "integrity": "sha512-+bQy5WOI2V6LJZpPVxY+yp66XdZ2yifu0Mc1aP5CQKgjn4QM5IN2i5fAZ4xKop47pr8rpVhiAeu+nDQa12C8+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-validator-option": "^7.27.1", + "@babel/plugin-syntax-jsx": "^7.27.1", + "@babel/plugin-transform-modules-commonjs": "^7.27.1", + "@babel/plugin-transform-typescript": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/register": { "version": "7.28.6", "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.28.6.tgz", @@ -2374,6 +2433,7 @@ "integrity": "sha512-Tdfx4eH2uS+gv9V9NCr3Rz+c7RSS6ntXp3Blliud18ibRUlRxO9dTaOjG4iv4x0nAmMeedP1ORkEpeXSkh2QiQ==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=20" } @@ -2455,7 +2515,8 @@ "resolved": "https://registry.npmjs.org/@cspell/dict-css/-/dict-css-4.0.19.tgz", "integrity": "sha512-VYHtPnZt/Zd/ATbW3rtexWpBnHUohUrQOHff/2JBhsVgxOrksAxJnLAO43Q1ayLJBJUUwNVo+RU0sx0aaysZfg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@cspell/dict-dart": { "version": "2.3.2", @@ -2595,14 +2656,16 @@ "resolved": "https://registry.npmjs.org/@cspell/dict-html/-/dict-html-4.0.14.tgz", "integrity": "sha512-2bf7n+kS92g+cMKV0wr9o/Oq9n8JzU7CcrB96gIh2GHgnF+0xDOqO2W/1KeFAqOfqosoOVE48t+4dnEMkkoJ2Q==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@cspell/dict-html-symbol-entities": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@cspell/dict-html-symbol-entities/-/dict-html-symbol-entities-4.0.5.tgz", "integrity": "sha512-429alTD4cE0FIwpMucvSN35Ld87HCyuM8mF731KU5Rm4Je2SG6hmVx7nkBsLyrmH3sQukTcr1GaiZsiEg8svPA==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@cspell/dict-java": { "version": "5.0.12", @@ -2800,7 +2863,8 @@ "resolved": "https://registry.npmjs.org/@cspell/dict-typescript/-/dict-typescript-3.2.3.tgz", "integrity": "sha512-zXh1wYsNljQZfWWdSPYwQhpwiuW0KPW1dSd8idjMRvSD0aSvWWHoWlrMsmZeRl4qM4QCEAjua8+cjflm41cQBg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@cspell/dict-vue": { "version": "3.0.5", @@ -2938,6 +3002,13 @@ "tslib": "^2.4.0" } }, + "node_modules/@epic-web/invariant": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz", + "integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==", + "dev": true, + "license": "MIT" + }, "node_modules/@es-joy/jsdoccomment": { "version": "0.84.0", "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.84.0.tgz", @@ -3257,6 +3328,59 @@ "node": ">=12" } }, + "node_modules/@istanbuljs/esm-loader-hook": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/esm-loader-hook/-/esm-loader-hook-0.3.0.tgz", + "integrity": "sha512-lEnYroBUYfNQuJDYrPvre8TSwPZnyIQv9qUT3gACvhr3igZr+BbrdyIcz4+2RnEXZzi12GqkUW600+QQPpIbVg==", + "dev": true, + "license": "ISC", + "dependencies": { + "@babel/core": "^7.8.7", + "@babel/plugin-syntax-decorators": "^7.25.9", + "@babel/preset-typescript": "^7.26.0", + "@istanbuljs/load-nyc-config": "^1.1.0", + "@istanbuljs/schema": "^0.1.3", + "babel-plugin-istanbul": "^6.0.0", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=16.12.0" + } + }, + "node_modules/@istanbuljs/esm-loader-hook/node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/esm-loader-hook/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -5399,6 +5523,7 @@ "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", "license": "MIT", + "peer": true, "dependencies": { "@types/estree": "*", "@types/json-schema": "*" @@ -5563,6 +5688,7 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.11.tgz", "integrity": "sha512-BH7YwL6rA93ReqeQS1c4bsPpcfOmJasG+Fkr6Y59q83f9M1WcBRHR2vM+P9eOisYRcN3ujQoiZY8uk5W+1WL8w==", "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~6.21.0" } @@ -5713,6 +5839,7 @@ "integrity": "sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.56.1", @@ -5752,6 +5879,7 @@ "integrity": "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", @@ -6502,6 +6630,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -6573,6 +6702,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -7363,6 +7493,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -8273,6 +8404,24 @@ "dev": true, "license": "MIT" }, + "node_modules/cross-env": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.1.0.tgz", + "integrity": "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@epic-web/invariant": "^1.0.0", + "cross-spawn": "^7.0.6" + }, + "bin": { + "cross-env": "dist/bin/cross-env.js", + "cross-env-shell": "dist/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -9345,6 +9494,7 @@ "integrity": "sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -9434,6 +9584,7 @@ "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", "dev": true, "license": "MIT", + "peer": true, "bin": { "eslint-config-prettier": "bin/cli.js" }, @@ -10739,6 +10890,7 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, @@ -12694,6 +12846,7 @@ "integrity": "sha512-F26gjC0yWN8uAA5m5Ss8ZQf5nDHWGlN/xWZIh8S5SRbsEKBovwZhxGd6LJlbZYxBgCYOtreSUyb8hpXyGC5O4A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@jest/core": "30.2.0", "@jest/types": "30.2.0", @@ -17195,6 +17348,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -17317,6 +17471,7 @@ "integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -18210,6 +18365,7 @@ "integrity": "sha512-fDz1zJpd5GycprAbu4Q2PV/RprsRtKC/0z82z0JLgdytmcq0+ujJbJ/09bPGDxCLkKY3Np5cRAOcWiVkLXJURg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.0.2", @@ -19876,6 +20032,7 @@ "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -19954,7 +20111,8 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD" + "license": "0BSD", + "peer": true }, "node_modules/tsyringe": { "version": "4.10.0", @@ -20126,6 +20284,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -20523,6 +20682,7 @@ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.105.4.tgz", "integrity": "sha512-jTywjboN9aHxFlToqb0K0Zs9SbBoW4zRUlGzI2tYNxVYcEi/IPpn+Xi4ye5jTLvX2YeLuic/IvxNot+Q1jMoOw==", "license": "MIT", + "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -20572,6 +20732,7 @@ "integrity": "sha512-Etrauj1wYO/xjiz/Vfd6bW1lG9fEhrJpNmu10tv0X9kv+gyY3qiE09uYepqg1Xd0PxOvllRXwWYWjtQYoO/glQ==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "@discoveryjs/json-ext": "0.5.7", "acorn": "^8.0.4", @@ -20669,6 +20830,7 @@ "integrity": "sha512-9Gyu2F7+bg4Vv+pjbovuYDhHX+mqdqITykfzdM9UyKqKHlsE5aAjRhR+oOEfXW5vBeu8tarzlJFIZva4ZjAdrQ==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "@types/bonjour": "^3.5.13", "@types/connect-history-api-fallback": "^1.5.4", @@ -21417,6 +21579,7 @@ "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", "dev": true, "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index c252ecb0093..d2ec07feb18 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "test": "npm run test:base", "test:base": "node --experimental-vm-modules ./node_modules/jest-cli/bin/jest", "test:smoketests": "nyc node smoketests", - "test:coverage": "nyc --no-clean npm run test:base -- --coverage", + "test:coverage": "cross-env NODE_OPTIONS='--import data:text/javascript;base64,aW1wb3J0IHsgcmVnaXN0ZXIgfSBmcm9tICJub2RlOm1vZHVsZSI7IGltcG9ydCB7IHBhdGhUb0ZpbGVVUkwgfSBmcm9tICJub2RlOnVybCI7IHJlZ2lzdGVyKCJAaXN0YW5idWxqcy9lc20tbG9hZGVyLWhvb2siLCBwYXRoVG9GaWxlVVJMKCIuLyIpKTs=' nyc npm run test:base", "update:docs": "node ./scripts/update-docs", "version": "node ./node_modules/.bin/changeset version && node ./scripts/sync-changelogs.js", "release": "npm run build && node ./node_modules/.bin/changeset publish", @@ -52,12 +52,14 @@ "@babel/register": "^7.15.8", "@changesets/cli": "^2.30.0", "@changesets/get-github-info": "^0.8.0", + "@istanbuljs/esm-loader-hook": "^0.3.0", "@types/jest": "^30.0.0", "@types/node": "^22.5.5", "@types/rechoir": "^0.6.1", "coffeescript": "^2.7.0", "colorette": "^2.0.16", "concat-stream": "^2.0.0", + "cross-env": "^10.1.0", "cspell": "^9.4.0", "css-loader": "^7.1.2", "del-cli": "^7.0.0", diff --git a/packages/webpack-cli/src/plugins/cli-plugin.ts b/packages/webpack-cli/src/plugins/cli-plugin.ts index fe5a06bae67..1518adab151 100644 --- a/packages/webpack-cli/src/plugins/cli-plugin.ts +++ b/packages/webpack-cli/src/plugins/cli-plugin.ts @@ -129,20 +129,17 @@ export default class CLIPlugin { this.logger.log(`Changed time is ${date} (timestamp is ${changeTime})`); }); - ((compiler as Partial).webpack ? compiler.hooks.afterDone : compiler.hooks.done).tap( - pluginName, - () => { - const name = getCompilationName(); - - logCompilation(`Compiler${name} finished`); - - process.nextTick(() => { - if (compiler.watchMode) { - this.logger.log(`Compiler${name} is watching files for updates...`); - } - }); - }, - ); + compiler.hooks.afterDone.tap(pluginName, () => { + const name = getCompilationName(); + + logCompilation(`Compiler${name} finished`); + + process.nextTick(() => { + if (compiler.watchMode) { + this.logger.log(`Compiler${name} is watching files for updates...`); + } + }); + }); } apply(compiler: Compiler) { diff --git a/packages/webpack-cli/tsconfig.json b/packages/webpack-cli/tsconfig.json index ad551d47a30..279b3e923cc 100644 --- a/packages/webpack-cli/tsconfig.json +++ b/packages/webpack-cli/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "./lib", - "rootDir": "./src", - "typeRoots": ["./src/types.ts"] + "rootDir": "./src" }, "include": ["./src"] } diff --git a/test/api/CLI.test.js b/test/api/CLI.test.js index 2dd11521a72..5faf7b09caf 100644 --- a/test/api/CLI.test.js +++ b/test/api/CLI.test.js @@ -1,4 +1,4 @@ -const CLI = require("../../packages/webpack-cli/lib/webpack-cli").default; +const CLI = require("../../packages/webpack-cli/src/webpack-cli").default; describe("CLI API", () => { let cli; diff --git a/test/api/capitalizeFirstLetter.test.js b/test/api/capitalizeFirstLetter.test.js index 01d11b77b4c..723721a76b7 100755 --- a/test/api/capitalizeFirstLetter.test.js +++ b/test/api/capitalizeFirstLetter.test.js @@ -1,4 +1,4 @@ -const CLI = require("../../packages/webpack-cli/lib/webpack-cli").default; +const CLI = require("../../packages/webpack-cli/src/webpack-cli").default; describe("capitalizeFirstLetter", () => { it("should capitalize first letter", () => { diff --git a/test/api/get-default-package-manager.test.js b/test/api/get-default-package-manager.test.js index 349a6f1cd66..e27e795c15d 100644 --- a/test/api/get-default-package-manager.test.js +++ b/test/api/get-default-package-manager.test.js @@ -1,6 +1,6 @@ const fs = require("node:fs"); const path = require("node:path"); -const CLI = require("../../packages/webpack-cli/lib/webpack-cli").default; +const CLI = require("../../packages/webpack-cli/src/webpack-cli").default; const syncMock = jest.fn(() => ({ stdout: "1.0.0", diff --git a/test/api/install-package.test.js b/test/api/install-package.test.js index 51907d6555d..302b418bf58 100644 --- a/test/api/install-package.test.js +++ b/test/api/install-package.test.js @@ -1,7 +1,7 @@ "use strict"; const { stripVTControlCharacters } = require("node:util"); -const CLI = require("../../packages/webpack-cli/lib/webpack-cli").default; +const CLI = require("../../packages/webpack-cli/src/webpack-cli").default; const readlineQuestionMock = jest.fn(); diff --git a/tsconfig.json b/tsconfig.json index 2d2dca5aff7..4f653d28c54 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "exclude": ["node_modules", "lib", "__tests__"], + "exclude": ["node_modules", "lib"], "files": [], "compilerOptions": { "lib": ["es2023"], @@ -19,6 +19,7 @@ "paths": { "@webpack-cli/*": ["packages/*/src"] }, + "isolatedModules": true, "composite": true, "declaration": true },