From bd109e7ac01e0b399cf85c0f24000eb3a9e8b9d8 Mon Sep 17 00:00:00 2001 From: Laffery <49607541+Laffery@users.noreply.github.com> Date: Thu, 23 Jan 2025 08:11:56 +0800 Subject: [PATCH] chore: bump less to 4.2.2 (#8992) - bump postcss to 8.5.1 - bump less-plugin-clean-css to 1.6.0 --- package-lock.json | 238 ++++++++++++++++++++------------ package.json | 6 +- scripts/build/compile-styles.ts | 25 ++-- 3 files changed, 164 insertions(+), 105 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6532951b570..d910bb5d80e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -84,8 +84,8 @@ "karma-junit-reporter": "^2.0.1", "karma-spec-reporter": "^0.0.36", "karma-viewport": "^1.0.7", - "less": "^4.1.0", - "less-plugin-clean-css": "^1.5.1", + "less": "^4.2.2", + "less-plugin-clean-css": "^1.6.0", "less-plugin-npm-import": "^2.1.0", "less-vars-to-js": "^1.3.0", "lint-staged": "^15.0.0", @@ -95,7 +95,7 @@ "monaco-editor": "^0.33.0", "ng-packagr": "^19.1.0", "parse5": "^7.2.1", - "postcss": "^8.2.4", + "postcss": "^8.5.1", "prettier": "~3.1.0", "prismjs": "^1.29.0", "process": "^0.11.10", @@ -293,6 +293,124 @@ "node": ">=10" } }, + "node_modules/@angular-devkit/build-angular/node_modules/less": { + "version": "4.2.1", + "resolved": "https://registry.npmmirror.com/less/-/less-4.2.1.tgz", + "integrity": "sha512-CasaJidTIhWmjcqv0Uj5vccMI7pJgfD9lMkKtlnTHAdJdYK/7l8pM9tumLyJ0zhbD4KJLo/YvTj+xznQd5NBhg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "copy-anything": "^2.0.1", + "parse-node-version": "^1.0.1", + "tslib": "^2.3.0" + }, + "bin": { + "lessc": "bin/lessc" + }, + "engines": { + "node": ">=6" + }, + "optionalDependencies": { + "errno": "^0.1.1", + "graceful-fs": "^4.1.2", + "image-size": "~0.5.0", + "make-dir": "^2.1.0", + "mime": "^1.4.1", + "needle": "^3.1.0", + "source-map": "~0.6.0" + } + }, + "node_modules/@angular-devkit/build-angular/node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@angular-devkit/build-angular/node_modules/make-dir/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmmirror.com/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "optional": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/@angular-devkit/build-angular/node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "license": "MIT", + "optional": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@angular-devkit/build-angular/node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/@angular-devkit/build-angular/node_modules/postcss": { + "version": "8.4.49", + "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.49.tgz", + "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/@angular-devkit/build-angular/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@angular-devkit/build-webpack": { "version": "0.1901.1", "resolved": "https://registry.npmmirror.com/@angular-devkit/build-webpack/-/build-webpack-0.1901.1.tgz", @@ -7487,15 +7605,6 @@ "ajv": "^8.8.2" } }, - "node_modules/amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", - "dev": true, - "engines": { - "node": ">=0.4.2" - } - }, "node_modules/ansi-colors": { "version": "4.1.3", "resolved": "https://registry.npmmirror.com/ansi-colors/-/ansi-colors-4.1.3.tgz", @@ -14448,12 +14557,6 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "node_modules/graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha512-8tLu60LgxF6XpdbK8OW3FA+IfTNBn1ZHGHKF4KQbEeSkajYw5PlYJcKluntgegDPTg8UkHjpet1T82vk6TQ68w==", - "dev": true - }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -15382,6 +15485,20 @@ "node": "*" } }, + "node_modules/image-size": { + "version": "0.5.5", + "resolved": "https://registry.npmmirror.com/image-size/-/image-size-0.5.5.tgz", + "integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==", + "dev": true, + "license": "MIT", + "optional": true, + "bin": { + "image-size": "bin/image-size.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/immutable": { "version": "5.0.3", "resolved": "https://registry.npmmirror.com/immutable/-/immutable-5.0.3.tgz", @@ -17056,9 +17173,9 @@ } }, "node_modules/less": { - "version": "4.2.1", - "resolved": "https://registry.npmmirror.com/less/-/less-4.2.1.tgz", - "integrity": "sha512-CasaJidTIhWmjcqv0Uj5vccMI7pJgfD9lMkKtlnTHAdJdYK/7l8pM9tumLyJ0zhbD4KJLo/YvTj+xznQd5NBhg==", + "version": "4.2.2", + "resolved": "https://registry.npmmirror.com/less/-/less-4.2.2.tgz", + "integrity": "sha512-tkuLHQlvWUTeQ3doAqnHbNn8T6WX1KA8yvbKG9x4VtKtIjHsVKQZCH11zRgAfbDAXC2UNIg/K9BYAAcEzUIrNg==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -17109,55 +17226,16 @@ } }, "node_modules/less-plugin-clean-css": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/less-plugin-clean-css/-/less-plugin-clean-css-1.5.1.tgz", - "integrity": "sha512-Pc68AFHAEJO3aAoRvnUTW5iAiAv6y+TQsWLTTwVNqjiDno6xCvxz1AtfQl7Y0MZSpHPalFajM1EU4RB5UVINpw==", - "dev": true, - "dependencies": { - "clean-css": "^3.0.1" - }, - "engines": { - "node": ">=0.4.2" - } - }, - "node_modules/less-plugin-clean-css/node_modules/clean-css": { - "version": "3.4.28", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-3.4.28.tgz", - "integrity": "sha512-aTWyttSdI2mYi07kWqHi24NUU9YlELFKGOAgFzZjDN1064DMAOy2FBuoyGmkKRlXkbpXd0EVHmiVkbKhKoirTw==", - "dev": true, - "dependencies": { - "commander": "2.8.x", - "source-map": "0.4.x" - }, - "bin": { - "cleancss": "bin/cleancss" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/less-plugin-clean-css/node_modules/commander": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", - "integrity": "sha512-+pJLBFVk+9ZZdlAOB5WuIElVPPth47hILFkmGym57aq8kwxsowvByvB0DHs1vQAhyMZzdcpTtF0VDKGkSDR4ZQ==", - "dev": true, - "dependencies": { - "graceful-readlink": ">= 1.0.0" - }, - "engines": { - "node": ">= 0.6.x" - } - }, - "node_modules/less-plugin-clean-css/node_modules/source-map": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", - "integrity": "sha512-Y8nIfcb1s/7DcobUz1yOO1GSp7gyL+D9zLHDehT7iRESqGSxjJ448Sg7rvfgsRJCnKLdSl11uGf0s9X80cH0/A==", + "version": "1.6.0", + "resolved": "https://registry.npmmirror.com/less-plugin-clean-css/-/less-plugin-clean-css-1.6.0.tgz", + "integrity": "sha512-jwXX6WlXT57OVCXa5oBJBaJq1b4s1BOKeEEoAL2UTeEitogQWfTcBbLT/vow9pl0N0MXV8Mb4KyhTGG0YbEKyQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "amdefine": ">=0.0.4" + "clean-css": "5.3.3" }, "engines": { - "node": ">=0.8.0" + "node": ">=0.10" } }, "node_modules/less-plugin-npm-import": { @@ -17200,19 +17278,6 @@ "node": ">=0.10.0" } }, - "node_modules/less/node_modules/image-size": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", - "integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==", - "dev": true, - "optional": true, - "bin": { - "image-size": "bin/image-size.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/less/node_modules/make-dir": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", @@ -19133,9 +19198,9 @@ "optional": true }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, "funding": [ { @@ -19143,6 +19208,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -20906,9 +20972,9 @@ } }, "node_modules/postcss": { - "version": "8.4.49", - "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.49.tgz", - "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "version": "8.5.1", + "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.1.tgz", + "integrity": "sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==", "dev": true, "funding": [ { @@ -20926,7 +20992,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.7", + "nanoid": "^3.3.8", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, diff --git a/package.json b/package.json index d2fd5178268..4f033528dac 100644 --- a/package.json +++ b/package.json @@ -103,8 +103,8 @@ "karma-junit-reporter": "^2.0.1", "karma-spec-reporter": "^0.0.36", "karma-viewport": "^1.0.7", - "less": "^4.1.0", - "less-plugin-clean-css": "^1.5.1", + "less": "^4.2.2", + "less-plugin-clean-css": "^1.6.0", "less-plugin-npm-import": "^2.1.0", "less-vars-to-js": "^1.3.0", "lint-staged": "^15.0.0", @@ -114,7 +114,7 @@ "monaco-editor": "^0.33.0", "ng-packagr": "^19.1.0", "parse5": "^7.2.1", - "postcss": "^8.2.4", + "postcss": "^8.5.1", "prettier": "~3.1.0", "prismjs": "^1.29.0", "process": "^0.11.10", diff --git a/scripts/build/compile-styles.ts b/scripts/build/compile-styles.ts index 2d883b6a92e..69625e52386 100644 --- a/scripts/build/compile-styles.ts +++ b/scripts/build/compile-styles.ts @@ -10,8 +10,8 @@ import * as path from 'path'; import { buildConfig } from '../build-config'; -const lessPluginCleanCSS = require('less-plugin-clean-css'); -const npmImportPlugin = require('less-plugin-npm-import'); +const LessPluginCleanCSS = require('less-plugin-clean-css'); +const NpmImportPlugin = require('less-plugin-npm-import'); async function compileLess( content: string, @@ -20,29 +20,22 @@ async function compileLess( sub?: boolean, rootPath?: string ): Promise { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const plugins: any[] = []; + const plugins: Less.Plugin[] = []; const lessOptions: Less.Options = { plugins }; if (min) { - plugins.push(new lessPluginCleanCSS({ advanced: true })); + plugins.push(new LessPluginCleanCSS({ advanced: true })); } if (sub) { lessOptions.paths = [path.dirname(rootPath as string)]; lessOptions.filename = rootPath; - plugins.push( - new npmImportPlugin({ - prefix: '~' - }) - ); + plugins.push(new NpmImportPlugin({ prefix: '~' })); } return less .render(content, lessOptions) - .then(({ css }) => { - return fs.writeFile(savePath, css); - }) + .then(({ css }) => fs.writeFile(savePath, css)) .catch(err => Promise.reject(err)); } @@ -51,14 +44,14 @@ const targetPath = buildConfig.publishDir; export async function compile(): Promise { const componentFolders = fs.readdirSync(targetPath); - const promiseList = []; + const promiseList: Array> = []; for (const dir of componentFolders) { if (await fs.pathExists(`${sourcePath}/${dir}/style/index.less`)) { // Copy style files for each component. await fs.copy(`${sourcePath}/${dir}/style`, `${targetPath}/${dir}/style`); - // Compile less files to CSS and delete the `entry.less` file. + // Compile `.less` files to CSS and delete the `entry.less` file. const buildFilePath = `${sourcePath}/${dir}/style/entry.less`; const componentLess = await fs.readFile(buildFilePath, { encoding: 'utf8' }); if (await fs.pathExists(buildFilePath)) { @@ -88,7 +81,7 @@ export async function compile(): Promise { } } - // Copy concentrated less files. + // Copy concentrated `.less` files. await fs.copy(path.resolve(sourcePath, 'style'), path.resolve(targetPath, 'style')); await fs.writeFile(`${targetPath}/components.less`, await fs.readFile(`${sourcePath}/components.less`)); await fs.writeFile(`${targetPath}/ng-zorro-antd.less`, await fs.readFile(`${sourcePath}/ng-zorro-antd.less`));