From 3d9f5425b6bb5dae38277bc68c45cb86ae608642 Mon Sep 17 00:00:00 2001 From: Tommy Markley Date: Fri, 7 Jan 2022 13:00:28 -0600 Subject: [PATCH] Upgrades babel, storybook, and postcss (#1104) * Upgrades dependencies to resolve react-dev-utils, browserslist, and postcss CVEs. * We have to stay on v6.3.x `@storybook` dependencies because of https://github.com/storybookjs/storybook/issues/16837. 6.3.x still depends on older version of some of the `@babel` libraries. * The `autoprefixer` upgrade removes the browserslist warning during the build. * `css-loader`, `postcss-loader`, `postcss` upgrades were required to fix webpack errors. These upgrades contained a few breaking changes. * Minor version bumps to `react-router`, `react-router-dom`, and `styled-components` were done while troubleshooting bootstrap issues. Resolves #1055 Resolves #1094 Resolves #1095 Signed-off-by: Tommy Markley --- package.json | 24 +- .../package.json | 2 +- packages/osd-analytics/package.json | 2 +- packages/osd-babel-preset/package.json | 20 +- packages/osd-dev-utils/package.json | 2 +- packages/osd-i18n/package.json | 4 +- packages/osd-interpreter/package.json | 14 +- packages/osd-monaco/package.json | 4 +- packages/osd-opensearch/package.json | 2 +- packages/osd-optimizer/package.json | 16 +- .../basic_optimization.test.ts.snap | 2 +- .../basic_optimization.test.ts | 2 +- .../src/worker/webpack.config.ts | 4 +- .../src/integration_tests/build.test.ts | 4 - packages/osd-pm/package.json | 12 +- packages/osd-storybook/lib/default_config.ts | 2 +- packages/osd-storybook/package.json | 23 +- packages/osd-storybook/webpack.config.ts | 4 +- packages/osd-test/package.json | 2 +- .../doc_site/webpack.config.js | 4 +- packages/osd-ui-framework/package.json | 12 +- packages/osd-ui-shared-deps/package.json | 8 +- .../__snapshots__/html.test.js.snap | 4 +- yarn.lock | 5489 +++++++++-------- 24 files changed, 2947 insertions(+), 2715 deletions(-) diff --git a/package.json b/package.json index b51f1ac3906b..3a01d64f1ee7 100644 --- a/package.json +++ b/package.json @@ -196,7 +196,7 @@ "react-color": "^2.13.8", "react-dom": "^16.12.0", "react-input-range": "^1.3.0", - "react-router": "^5.2.0", + "react-router": "^5.2.1", "react-use": "^13.27.0", "redux-thunk": "^2.3.0", "regenerator-runtime": "^0.13.3", @@ -218,10 +218,10 @@ "yauzl": "^2.10.0" }, "devDependencies": { - "@babel/core": "^7.11.6", - "@babel/parser": "^7.11.2", - "@babel/register": "^7.10.5", - "@babel/types": "^7.11.0", + "@babel/core": "^7.16.5", + "@babel/parser": "^7.16.6", + "@babel/register": "^7.16.5", + "@babel/types": "^7.16.0", "@elastic/apm-rum": "^5.6.1", "@elastic/charts": "23.2.2", "@elastic/ems-client": "7.10.0", @@ -256,7 +256,7 @@ "@types/angular": "^1.6.56", "@types/angular-mocks": "^1.7.0", "@types/archiver": "^3.1.0", - "@types/babel__core": "^7.1.10", + "@types/babel__core": "^7.1.17", "@types/bluebird": "^3.1.1", "@types/boom": "^7.2.0", "@types/chance": "^1.0.0", @@ -315,8 +315,8 @@ "@types/react-grid-layout": "^0.16.7", "@types/react-redux": "^7.1.9", "@types/react-resize-detector": "^4.0.1", - "@types/react-router": "^5.1.7", - "@types/react-router-dom": "^5.1.5", + "@types/react-router": "^5.1.17", + "@types/react-router-dom": "^5.3.2", "@types/react-virtualized": "^9.18.7", "@types/recompose": "^0.30.6", "@types/request": "^2.48.2", @@ -324,7 +324,7 @@ "@types/semver": "^5.5.0", "@types/sinon": "^7.0.13", "@types/strip-ansi": "^5.2.1", - "@types/styled-components": "^5.1.0", + "@types/styled-components": "^5.1.19", "@types/supertest": "^2.0.5", "@types/supertest-as-promised": "^2.0.38", "@types/tapable": "^1.0.6", @@ -367,7 +367,7 @@ "enzyme-to-json": "^3.4.4", "eslint": "^6.8.0", "eslint-config-prettier": "^6.11.0", - "eslint-plugin-babel": "^5.3.0", + "eslint-plugin-babel": "^5.3.1", "eslint-plugin-ban": "^1.4.0", "eslint-plugin-cypress": "^2.8.1", "eslint-plugin-eslint-comments": "^3.2.0", @@ -430,7 +430,7 @@ "nyc": "^14.1.1", "pixelmatch": "^5.1.0", "pngjs": "^3.4.0", - "postcss": "^8.2.10", + "postcss": "^8.4.5", "prettier": "^2.1.1", "prop-types": "^15.7.2", "react": "^16.14.0", @@ -439,7 +439,7 @@ "react-monaco-editor": "~0.27.0", "react-redux": "^7.2.0", "react-resize-detector": "^4.2.0", - "react-router-dom": "^5.2.0", + "react-router-dom": "^5.3.0", "react-sizeme": "^2.3.6", "react-test-renderer": "^16.12.0", "reactcss": "1.2.3", diff --git a/packages/opensearch-eslint-config-opensearch-dashboards/package.json b/packages/opensearch-eslint-config-opensearch-dashboards/package.json index 415d2fb640d7..685c85b5df78 100644 --- a/packages/opensearch-eslint-config-opensearch-dashboards/package.json +++ b/packages/opensearch-eslint-config-opensearch-dashboards/package.json @@ -22,7 +22,7 @@ "@typescript-eslint/parser": "^3.10.0", "babel-eslint": "^10.0.3", "eslint": "^6.8.0", - "eslint-plugin-babel": "^5.3.0", + "eslint-plugin-babel": "^5.3.1", "eslint-plugin-ban": "^1.4.0", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-eslint-comments": "^3.2.0", diff --git a/packages/osd-analytics/package.json b/packages/osd-analytics/package.json index 63967fd9867f..d460ab335a2d 100644 --- a/packages/osd-analytics/package.json +++ b/packages/osd-analytics/package.json @@ -14,7 +14,7 @@ "osd:watch": "node scripts/build --source-maps --watch" }, "devDependencies": { - "@babel/cli": "^7.14.5", + "@babel/cli": "^7.16.0", "@osd/dev-utils": "1.0.0", "@osd/babel-preset": "1.0.0", "typescript": "4.0.2" diff --git a/packages/osd-babel-preset/package.json b/packages/osd-babel-preset/package.json index 85b13bf35bdf..67ef872075e9 100644 --- a/packages/osd-babel-preset/package.json +++ b/packages/osd-babel-preset/package.json @@ -7,18 +7,18 @@ "devOnly": true }, "dependencies": { - "@babel/plugin-proposal-class-properties": "^7.10.4", - "@babel/plugin-proposal-export-namespace-from": "^7.10.4", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4", - "@babel/plugin-proposal-optional-chaining": "^7.11.0", - "@babel/plugin-proposal-private-methods": "^7.10.4", - "@babel/preset-env": "^7.11.0", - "@babel/preset-react": "^7.10.4", - "@babel/preset-typescript": "^7.10.4", + "@babel/plugin-proposal-class-properties": "^7.16.5", + "@babel/plugin-proposal-export-namespace-from": "^7.16.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5", + "@babel/plugin-proposal-optional-chaining": "^7.16.5", + "@babel/plugin-proposal-private-methods": "^7.16.5", + "@babel/preset-env": "^7.16.5", + "@babel/preset-react": "^7.16.5", + "@babel/preset-typescript": "^7.16.5", "babel-plugin-add-module-exports": "^1.0.4", - "babel-plugin-styled-components": "^1.10.7", + "babel-plugin-styled-components": "^2.0.2", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", "react-is": "^16.8.0", - "styled-components": "^5.1.0" + "styled-components": "^5.3.3" } } diff --git a/packages/osd-dev-utils/package.json b/packages/osd-dev-utils/package.json index 579d584c4fa1..047c4441cb8c 100644 --- a/packages/osd-dev-utils/package.json +++ b/packages/osd-dev-utils/package.json @@ -13,7 +13,7 @@ "devOnly": true }, "dependencies": { - "@babel/core": "^7.11.6", + "@babel/core": "^7.16.5", "@osd/utils": "1.0.0", "axios": "^0.21.4", "chalk": "^4.1.0", diff --git a/packages/osd-i18n/package.json b/packages/osd-i18n/package.json index 9cec6dddb177..e3acaba58604 100644 --- a/packages/osd-i18n/package.json +++ b/packages/osd-i18n/package.json @@ -12,8 +12,8 @@ "osd:watch": "node scripts/build --watch --source-maps" }, "devDependencies": { - "@babel/cli": "^7.14.5", - "@babel/core": "^7.11.6", + "@babel/cli": "^7.16.0", + "@babel/core": "^7.16.5", "@osd/babel-preset": "1.0.0", "@osd/dev-utils": "1.0.0", "@types/intl-relativeformat": "^2.1.0", diff --git a/packages/osd-interpreter/package.json b/packages/osd-interpreter/package.json index 8a0db63db1bc..101685976108 100644 --- a/packages/osd-interpreter/package.json +++ b/packages/osd-interpreter/package.json @@ -9,21 +9,21 @@ "osd:watch": "node scripts/build --dev --watch" }, "dependencies": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.16.5", "@osd/i18n": "1.0.0", "lodash": "^4.17.21", "uuid": "3.3.2" }, "devDependencies": { - "@babel/cli": "^7.14.5", - "@babel/core": "^7.11.6", - "@babel/plugin-transform-modules-commonjs": "^7.10.4", - "@babel/plugin-transform-runtime": "^7.11.0", + "@babel/cli": "^7.16.0", + "@babel/core": "^7.16.5", + "@babel/plugin-transform-modules-commonjs": "^7.16.5", + "@babel/plugin-transform-runtime": "^7.16.5", "@osd/babel-preset": "1.0.0", "@osd/dev-utils": "1.0.0", - "babel-loader": "^8.0.6", + "babel-loader": "^8.2.3", "copy-webpack-plugin": "^6.0.2", - "css-loader": "^3.4.2", + "css-loader": "^5.2.7", "del": "^5.1.0", "getopts": "^2.2.5", "pegjs": "0.10.0", diff --git a/packages/osd-monaco/package.json b/packages/osd-monaco/package.json index efdc58849e76..bcf54f95df00 100644 --- a/packages/osd-monaco/package.json +++ b/packages/osd-monaco/package.json @@ -15,8 +15,8 @@ "devDependencies": { "@osd/babel-preset": "1.0.0", "@osd/dev-utils": "1.0.0", - "babel-loader": "^8.0.6", - "css-loader": "^3.4.2", + "babel-loader": "^8.2.3", + "css-loader": "^5.2.7", "del": "^5.1.0", "raw-loader": "^3.1.0", "supports-color": "^7.0.0", diff --git a/packages/osd-opensearch/package.json b/packages/osd-opensearch/package.json index ceb50fdcb88d..2c68dcfc805b 100644 --- a/packages/osd-opensearch/package.json +++ b/packages/osd-opensearch/package.json @@ -29,7 +29,7 @@ }, "devDependencies": { "@osd/babel-preset": "1.0.0", - "@babel/cli": "^7.14.5", + "@babel/cli": "^7.16.0", "del": "^5.1.0" } } diff --git a/packages/osd-optimizer/package.json b/packages/osd-optimizer/package.json index 9d95ae91275d..eed44712dac8 100644 --- a/packages/osd-optimizer/package.json +++ b/packages/osd-optimizer/package.json @@ -10,19 +10,19 @@ "osd:watch": "yarn build --watch" }, "dependencies": { - "@babel/cli": "^7.14.5", - "@babel/core": "^7.11.6", + "@babel/cli": "^7.16.0", + "@babel/core": "^7.16.5", "@osd/babel-preset": "1.0.0", "@osd/dev-utils": "1.0.0", "@osd/std": "1.0.0", "@osd/ui-shared-deps": "1.0.0", - "autoprefixer": "^9.7.4", - "babel-loader": "^8.0.6", + "autoprefixer": "^10.4.1", + "babel-loader": "^8.2.3", "clean-webpack-plugin": "^3.0.0", "compression-webpack-plugin": "^4.0.0", "cpy": "^8.0.0", "core-js": "^3.6.5", - "css-loader": "^3.4.2", + "css-loader": "^5.2.7", "dedent": "^0.7.0", "del": "^5.1.0", "execa": "^4.0.2", @@ -35,8 +35,8 @@ "node-sass": "^6.0.1", "normalize-path": "^3.0.0", "pirates": "^4.0.1", - "postcss": "^8.2.10", - "postcss-loader": "^3.0.0", + "postcss": "^8.4.5", + "postcss-loader": "^4.2.0", "raw-loader": "^3.1.0", "rxjs": "^6.5.5", "sass-loader": "^10.2.0", @@ -51,7 +51,7 @@ "webpack-merge": "^4.2.2" }, "devDependencies": { - "@types/babel__core": "^7.1.10", + "@types/babel__core": "^7.1.17", "@types/compression-webpack-plugin": "^2.0.2", "@types/loader-utils": "^1.1.3", "@types/source-map-support": "^0.5.3", diff --git a/packages/osd-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap b/packages/osd-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap index 06f75b8981d6..513566453acf 100644 --- a/packages/osd-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap +++ b/packages/osd-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap @@ -74,7 +74,7 @@ OptimizerConfig { } `; -exports[`prepares assets for distribution: bar bundle 1`] = `"(function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{enumerable:true,get:getter})}};__webpack_require__.r=function(exports){if(typeof Symbol!==\\"undefined\\"&&Symbol.toStringTag){Object.defineProperty(exports,Symbol.toStringTag,{value:\\"Module\\"})}Object.defineProperty(exports,\\"__esModule\\",{value:true})};__webpack_require__.t=function(value,mode){if(mode&1)value=__webpack_require__(value);if(mode&8)return value;if(mode&4&&typeof value===\\"object\\"&&value&&value.__esModule)return value;var ns=Object.create(null);__webpack_require__.r(ns);Object.defineProperty(ns,\\"default\\",{enumerable:true,value:value});if(mode&2&&typeof value!=\\"string\\")for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key]}.bind(null,key));return ns};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module[\\"default\\"]}:function getModuleExports(){return module};__webpack_require__.d(getter,\\"a\\",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p=\\"\\";return __webpack_require__(__webpack_require__.s=3)})([function(module,exports,__webpack_require__){\\"use strict\\";var isOldIE=function isOldIE(){var memo;return function memorize(){if(typeof memo===\\"undefined\\"){memo=Boolean(window&&document&&document.all&&!window.atob)}return memo}}();var getTarget=function getTarget(){var memo={};return function memorize(target){if(typeof memo[target]===\\"undefined\\"){var styleTarget=document.querySelector(target);if(window.HTMLIFrameElement&&styleTarget instanceof window.HTMLIFrameElement){try{styleTarget=styleTarget.contentDocument.head}catch(e){styleTarget=null}}memo[target]=styleTarget}return memo[target]}}();var stylesInDom=[];function getIndexByIdentifier(identifier){var result=-1;for(var i=0;i { bar.cache.refresh(); expect(bar.cache.getModuleCount()).toBe( // code + styles + style/css-loader runtimes + public path updater - 16 + 17 ); expect(bar.cache.getReferencedFiles()).toMatchInlineSnapshot(` diff --git a/packages/osd-optimizer/src/worker/webpack.config.ts b/packages/osd-optimizer/src/worker/webpack.config.ts index 031117b5cf6f..bb9c3f3c3a4a 100644 --- a/packages/osd-optimizer/src/worker/webpack.config.ts +++ b/packages/osd-optimizer/src/worker/webpack.config.ts @@ -160,8 +160,8 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker: loader: 'postcss-loader', options: { sourceMap: !worker.dist, - config: { - path: require.resolve('@osd/optimizer/postcss.config.js'), + postcssOptions: { + config: require.resolve('@osd/optimizer/postcss.config.js'), }, }, }, diff --git a/packages/osd-plugin-helpers/src/integration_tests/build.test.ts b/packages/osd-plugin-helpers/src/integration_tests/build.test.ts index fac2ec1b53e3..e2ac764ef33d 100644 --- a/packages/osd-plugin-helpers/src/integration_tests/build.test.ts +++ b/packages/osd-plugin-helpers/src/integration_tests/build.test.ts @@ -103,8 +103,6 @@ it('builds a generated plugin into a viable archive', async () => { info running @osd/optimizer │ info initialized, 0 bundles cached │ info starting worker [1 bundle] - │ warn worker stderr Browserslist: caniuse-lite is outdated. Please run: - │ warn worker stderr npx browserslist@latest --update-db │ succ 1 bundles compiled successfully after