From 33b1249edceec5e098ccc33d1e9a438ae3cbc57f Mon Sep 17 00:00:00 2001 From: Nikan Radan Date: Tue, 14 Jan 2025 17:44:50 -0800 Subject: [PATCH] RTLCSS Source Maps --- package-lock.json | 74 ++++++++++++++++++----- packages/scripts/config/webpack.config.js | 7 ++- packages/scripts/package.json | 2 +- 3 files changed, 66 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 76f405cc734f0..ec02d258ed107 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41950,20 +41950,6 @@ "node": ">=12.0.0" } }, - "node_modules/rtlcss-webpack-plugin": { - "name": "@smushytaco/rtlcss-webpack-plugin", - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@smushytaco/rtlcss-webpack-plugin/-/rtlcss-webpack-plugin-1.0.9.tgz", - "integrity": "sha512-Ha5abhCHROvBYsWWQ1ltOny3E5vJ8IXWk7MFxN4Qhs1wECIhjw3KtNuGjUX/IDZiLH9Pu5QZJS8csFSSQL6BoQ==", - "license": "MIT", - "dependencies": { - "rtlcss": "^4.3.0" - }, - "engines": { - "node": ">=18.12.0", - "npm": ">=8.19.2" - } - }, "node_modules/rtlcss/node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -53083,7 +53069,7 @@ "react-refresh": "^0.14.0", "read-pkg-up": "^7.0.1", "resolve-bin": "^0.4.0", - "rtlcss-webpack-plugin": "npm:@smushytaco/rtlcss-webpack-plugin@^1.0.9", + "rtlcss-webpack-plugin": "npm:@smushytaco/rtlcss-webpack-plugin@^2.0.0", "sass": "^1.54.0", "sass-loader": "^16.0.3", "schema-utils": "^4.2.0", @@ -53149,6 +53135,55 @@ "integrity": "sha512-fQMYwvPsQt8hxRnCGyg1r2JVi6yL8Um0DIIawiKiMK9yhAAkcRNj5UsBWoaFvFzPpcWbgw9L6wzj+UMYA702Mw==", "license": "BSD" }, + "packages/scripts/node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "packages/scripts/node_modules/postcss": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.1.tgz", + "integrity": "sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==", + "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.8", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "packages/scripts/node_modules/rtlcss-webpack-plugin": { + "name": "@smushytaco/rtlcss-webpack-plugin", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smushytaco/rtlcss-webpack-plugin/-/rtlcss-webpack-plugin-2.0.0.tgz", + "integrity": "sha512-Y8mrcKFFVtqYs5WPRTJBtnz0KIJ5VW1oJFXKHl6ieIAqV18uKZ56YD5fj7hY4ZZns1DJVGId8nDS851iEKOtFQ==", + "license": "MIT", + "dependencies": { + "postcss": "^8.5.1", + "rtlcss": "^4.3.0" + }, + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" + } + }, "packages/scripts/node_modules/schema-utils": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", @@ -53168,6 +53203,15 @@ "url": "https://opencollective.com/webpack" } }, + "packages/scripts/node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "packages/server-side-render": { "name": "@wordpress/server-side-render", "version": "5.15.1", diff --git a/packages/scripts/config/webpack.config.js b/packages/scripts/config/webpack.config.js index 002a89bc3d9df..dae131f5c262d 100644 --- a/packages/scripts/config/webpack.config.js +++ b/packages/scripts/config/webpack.config.js @@ -397,7 +397,12 @@ const scriptConfig = { filename: '[name].css', } ), // RtlCssPlugin to generate RTL CSS files. - new RtlCssPlugin( '[name]-rtl.css' ), + new RtlCssPlugin( { + fileNameMap: { + '.css': '[name]-rtl.css', + }, + sourceMap: ! isProduction, + } ), // React Fast Refresh. hasReactFastRefresh && new ReactRefreshWebpackPlugin(), // WP_NO_EXTERNALS global variable controls whether scripts' assets get diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 9954ed8469d3d..9ef1a7a36e58e 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -81,7 +81,7 @@ "react-refresh": "^0.14.0", "read-pkg-up": "^7.0.1", "resolve-bin": "^0.4.0", - "rtlcss-webpack-plugin": "npm:@smushytaco/rtlcss-webpack-plugin@^1.0.9", + "rtlcss-webpack-plugin": "npm:@smushytaco/rtlcss-webpack-plugin@^2.0.0", "sass": "^1.54.0", "sass-loader": "^16.0.3", "schema-utils": "^4.2.0",