From d987b083a5240f0a5119c0143342d8a5ae9ace73 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sat, 3 Jun 2023 07:50:21 -0400 Subject: [PATCH] chore: clean up --- config/data/paragonUtils.js | 7 +++- config/webpack.common.config.js | 7 ++++ config/webpack.prod.config.js | 5 +++ example/package-lock.json | 70 +++++++++++++++++++++------------ example/package.json | 2 +- package-lock.json | 69 ++++++++++++++++++++++++++++++++ package.json | 1 + 7 files changed, 133 insertions(+), 28 deletions(-) diff --git a/config/data/paragonUtils.js b/config/data/paragonUtils.js index 70f77c94c..bef32c02e 100644 --- a/config/data/paragonUtils.js +++ b/config/data/paragonUtils.js @@ -134,7 +134,12 @@ function getParagonCacheGroups(paragonThemeCss) { /** * @param {ParagonThemeCss} paragonThemeCss The Paragon theme CSS metadata. - * @returns {Object.} The entry points for the Paragon theme CSS. + * @returns {Object.} The entry points for the Paragon theme CSS. Example: ``` + * { + * "paragon.theme.core": "/path/to/node_modules/@edx/paragon/dist/core.min.css", + * "paragon.theme.variants.light": "/path/to/node_modules/@edx/paragon/dist/light.min.css" + * } + * ``` */ function getParagonEntryPoints(paragonThemeCss) { const entryPoints = {}; diff --git a/config/webpack.common.config.js b/config/webpack.common.config.js index 7137b839e..88110ee81 100644 --- a/config/webpack.common.config.js +++ b/config/webpack.common.config.js @@ -13,6 +13,13 @@ const paragonThemeCss = getParagonThemeCss(process.cwd()); module.exports = { entry: { app: path.resolve(process.cwd(), './src/index'), + /** + * The entry points for the Paragon theme CSS. Example: ``` + * { + * "paragon.theme.core": "/path/to/node_modules/@edx/paragon/dist/core.min.css", + * "paragon.theme.variants.light": "/path/to/node_modules/@edx/paragon/dist/light.min.css" + * } + */ ...getParagonEntryPoints(paragonThemeCss), }, output: { diff --git a/config/webpack.prod.config.js b/config/webpack.prod.config.js index bee29699b..82bebe31e 100644 --- a/config/webpack.prod.config.js +++ b/config/webpack.prod.config.js @@ -16,6 +16,7 @@ const path = require('path'); const PostCssAutoprefixerPlugin = require('autoprefixer'); const PostCssRTLCSS = require('postcss-rtlcss'); const PostCssCustomMediaCSS = require('postcss-custom-media'); +const CompressionPlugin = require('compression-webpack-plugin'); // Reduce CSS file size by ~70% const purgecss = require('@fullhuman/postcss-purgecss'); @@ -210,6 +211,10 @@ module.exports = merge(commonConfig, { path: path.resolve(process.cwd(), '.env'), systemvars: true, }), + new CompressionPlugin({ + algorithm: 'gzip', + test: /.js$|.css$/, + }), new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: false, diff --git a/example/package-lock.json b/example/package-lock.json index 2165a197a..0b3fb1c23 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@edx/paragon": "21.0.0-alpha.30", + "@edx/paragon": "^21.0.0-alpha.31", "react": "16.14.0", "react-dom": "16.14.0" }, @@ -46,16 +46,22 @@ } }, "node_modules/@csstools/css-parser-algorithms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.1.1.tgz", - "integrity": "sha512-viRnRh02AgO4mwIQb2xQNJju0i+Fh9roNgmbR5xEuG7J3TGgxjnE95HnBLgsFJOJOksvcfxOUCgODcft6Y07cA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.2.0.tgz", + "integrity": "sha512-9BoQ/jSrPq4vv3b9jjLW+PNNv56KlDH5JMx5yASSNrCtvq70FCNZUjXRvbCeR9hYj9ZyhURtqpU/RFIgg6kiOw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], "engines": { "node": "^14 || ^16 || >=18" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/csstools" - }, "peerDependencies": { "@csstools/css-tokenizer": "^2.1.1" } @@ -73,16 +79,22 @@ } }, "node_modules/@csstools/media-query-list-parser": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@csstools/media-query-list-parser/-/media-query-list-parser-2.0.4.tgz", - "integrity": "sha512-GyYot6jHgcSDZZ+tLSnrzkR7aJhF2ZW6d+CXH66mjy5WpAQhZD4HDke2OQ36SivGRWlZJpAz7TzbW6OKlEpxAA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@csstools/media-query-list-parser/-/media-query-list-parser-2.1.0.tgz", + "integrity": "sha512-MXkR+TeaS2q9IkpyO6jVCdtA/bfpABJxIrfkLswThFN8EZZgI2RfAHhm6sDNDuYV25d5+b8Lj1fpTccIcSLPsQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], "engines": { "node": "^14 || ^16 || >=18" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/csstools" - }, "peerDependencies": { "@csstools/css-parser-algorithms": "^2.1.1", "@csstools/css-tokenizer": "^2.1.1" @@ -95,9 +107,9 @@ "dev": true }, "node_modules/@edx/paragon": { - "version": "21.0.0-alpha.30", - "resolved": "https://registry.npmjs.org/@edx/paragon/-/paragon-21.0.0-alpha.30.tgz", - "integrity": "sha512-95MoV+av6pX97hwmrfgPmc1vSit43CtbA5kbNRY7Vt+Lj38JCzMYFGcG/PdHmSCpFsKG+34rUtB+G4+dbLQH1w==", + "version": "21.0.0-alpha.31", + "resolved": "https://registry.npmjs.org/@edx/paragon/-/paragon-21.0.0-alpha.31.tgz", + "integrity": "sha512-6iEwaLvyEn8+pMNO8Vuh9/xkaGK+i32q1bVoy0OeuKLwCVb6dJRwIMhOFQSQdSQ5KhAUBpIvPQD8Cm1PxyvYcw==", "dependencies": { "@popperjs/core": "^2.11.4", "bootstrap": "^4.6.2", @@ -1184,22 +1196,28 @@ } }, "node_modules/postcss-custom-media": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/postcss-custom-media/-/postcss-custom-media-9.1.3.tgz", - "integrity": "sha512-W1C4Fu6KAZ7sKYQCuGMr8gyaE4BtjTQGPLVS4m0WCaWM6l7PgVbvmDeb4ClBc5R/7kdwESYf0hdxGtEPhi9CLA==", + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/postcss-custom-media/-/postcss-custom-media-9.1.4.tgz", + "integrity": "sha512-4A7WEG3iIyKwfpxL5bkuSlHoHHGRTHl0212Z3uvpwJPyVfZJlkZAQNNgVC+oogrJgksDnfKyuuMbG6HafZPW8Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], "dependencies": { "@csstools/cascade-layer-name-parser": "^1.0.2", "@csstools/css-parser-algorithms": "^2.1.1", "@csstools/css-tokenizer": "^2.1.1", - "@csstools/media-query-list-parser": "^2.0.4" + "@csstools/media-query-list-parser": "^2.1.0" }, "engines": { "node": "^14 || ^16 || >=18" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/csstools" - }, "peerDependencies": { "postcss": "^8.4" } diff --git a/example/package.json b/example/package.json index 0f615aeec..18f0757a0 100644 --- a/example/package.json +++ b/example/package.json @@ -15,7 +15,7 @@ "author": "", "license": "ISC", "dependencies": { - "@edx/paragon": "21.0.0-alpha.30", + "@edx/paragon": "^21.0.0-alpha.31", "react": "16.14.0", "react-dom": "16.14.0" }, diff --git a/package-lock.json b/package-lock.json index 4fd0acd2e..4fd031898 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,7 @@ "babel-plugin-transform-imports": "2.0.0", "babel-polyfill": "6.26.0", "clean-webpack-plugin": "4.0.0", + "compression-webpack-plugin": "^10.0.0", "css-loader": "5.2.7", "cssnano": "6.0.1", "dotenv": "8.6.0", @@ -5452,6 +5453,74 @@ "node": ">= 0.8.0" } }, + "node_modules/compression-webpack-plugin": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/compression-webpack-plugin/-/compression-webpack-plugin-10.0.0.tgz", + "integrity": "sha512-wLXLIBwpul/ALcm7Aj+69X0pYT3BYt6DdPn3qrgBIh9YejV9Bju9ShhlAsjujLyWMo6SAweFIWaUoFmXZNuNrg==", + "dependencies": { + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "engines": { + "node": ">= 14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/compression-webpack-plugin/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/compression-webpack-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/compression-webpack-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/compression-webpack-plugin/node_modules/schema-utils": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", + "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, "node_modules/compression/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", diff --git a/package.json b/package.json index dee108508..3969370a9 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "babel-plugin-transform-imports": "2.0.0", "babel-polyfill": "6.26.0", "clean-webpack-plugin": "4.0.0", + "compression-webpack-plugin": "^10.0.0", "css-loader": "5.2.7", "cssnano": "6.0.1", "dotenv": "8.6.0",