Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn dependency upgrades #32933

Merged
merged 2 commits into from
Oct 4, 2023
Merged

Yarn dependency upgrades #32933

merged 2 commits into from
Oct 4, 2023

Conversation

jentfoo
Copy link
Contributor

@jentfoo jentfoo commented Oct 3, 2023

This PR includes a variety of seemingly safe dependency updates. This was tested locally but not deeply.

Backport labels added because this PR addresses CVE's (none of which should be exploitable):

There are some additional issues that should be addressed through an upgrade of storybook. However that appeared to be a larger and riskier change, so we should do that in another PR.

Copy link
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine as it only updates dev tooling and not libraries used in the web UI.

I would suggest two small adjustments though:

  • break the electron changes into a separate PR so we can verify (and potentially roll back) independently of the rest of this
  • verify with a tag build that notarization still works (I think we notarize tag builds)

@jentfoo
Copy link
Contributor Author

jentfoo commented Oct 3, 2023

break the electron changes into a separate PR so we can verify (and potentially roll back) independently of the rest of this

There is a problem with conflicts in the yarn.lock. Unfortunately blowing away the yarn.lock and recreating is not safe like it is with the go.sum. For that reason I think we should just keep it broken apart by commit, rather than have multiple backports which can't be individually reverted anyways.

What do you think?

verify with a tag build that notarization still works

How do I verify this?

Thank you!

@zmb3
Copy link
Collaborator

zmb3 commented Oct 3, 2023

I would still prefer to keep them separate - this PR makes changes to the web UI and Teleport Connect. When you say it was tested locally, did that include Teleport Connect or was it only the web UI?

@gzdunek is very good at keeping our Electron version patched and up to date. If we need a hand resolving a conflict, I'm sure he can help us figure it out (and also verify that notarization and the rest of the app still works post-update).

We don't typically combine Electron updates with other changes (see #31802 or #30679 for example)

@jentfoo jentfoo force-pushed the jent/yarn_upgrades branch from bb6ba87 to 57dc977 Compare October 3, 2023 22:31
@jentfoo
Copy link
Contributor Author

jentfoo commented Oct 3, 2023

Ok, Electron has been removed and will get a another PR cycle after this one is merged and backported

@zmb3
Copy link
Collaborator

zmb3 commented Oct 3, 2023

I do see this message when doing a local build:

warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"

@jentfoo
Copy link
Contributor Author

jentfoo commented Oct 3, 2023

This is because of specific hard dependencies on trim 0.0.1. I don't see a better path forward than override the version to a patched 0.0.3. The project has been deprecated for some time but it remains as a transitive dependency.

Comment on lines 17 to 25
"@babel/core": "^7.23.0",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/plugin-transform-object-rest-spread": "^7.22.15",
"@babel/plugin-transform-optional-chaining": "^7.23.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-classes": "^7.16.0",
"@babel/preset-env": "^7.16.4",
"@babel/preset-react": "^7.16.0",
"@babel/preset-typescript": "^7.22.15",
"@babel/plugin-transform-classes": "^7.22.15",
"@babel/preset-env": "^7.22.20",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Babel changes break at least yarn build-term and yarn storybook unfortunately.

I think this is all because of how buggy dependency hoisting is in Yarn v1 when using workspaces. Yarn ends up mixing and matching Babel deps between what we have defined here and what Storybook defines.

yarn build-term

Output of yarn workspace @gravitational/teleterm build-main
$ yarn workspace @gravitational/teleterm build-main
yarn workspace v1.22.19
yarn run v1.22.19
$ webpack build --config webpack.main.config.js --progress --mode=production
10% building 0/4 entries 4/4 dependencies 0/4 modulesBrowserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
assets by status 7.36 MiB [cached] 4 assets
orphan modules 460 KiB [orphan] 103 modules
runtime modules 3.4 KiB 15 modules
modules by path ../../../node_modules/ 2.53 MiB
  javascript modules 2.51 MiB 332 modules
  json modules 13.7 KiB 6 modules
modules by path ../../../gen/proto/js/ 816 KiB
  ../../../gen/proto/js/teleport/lib/teleterm/v1/service_pb.js 404 KiB [built] [code generated]
  ../../../gen/proto/js/teleport/lib/teleterm/v1/access_request_pb.js 53.7 KiB [built] [code generated]
  + 12 modules
modules by path ./src/ 756 KiB
  cacheable modules 75.1 KiB 5 modules
  ./src/main.ts + 72 modules 367 KiB [not cacheable] [built] [code generated]
  ./src/preload.ts + 55 modules 208 KiB [not cacheable] [built] [code generated]
  ./src/sharedProcess/sharedProcess.ts + 25 modules 106 KiB [not cacheable] [built] [code generated]
+ 18 modules

ERROR in ./src/logger.ts
Module build failed (from ../../../node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/web/packages/teleterm/src/logger.ts: You gave us a visitor for the node type ClassAccessorProperty but it's not a valid type
    at verify (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:114:13)
    at Object.explode (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:36:3)
    at traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/index.js:61:12)
    at NodePath.traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/index.js:143:24)
    at ReplaceSupers.replace (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-replace-supers/lib/index.js:208:23)
    at buildFieldsInitNodes (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js:736:10)
    at PluginPass.Class (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/index.js:185:50)
    at newFn (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:40:17)
 @ ./src/preload.ts 20:0-37 31:0-11 32:19-25

ERROR in ./src/sharedProcess/ptyHost/ptyProcess.ts
Module build failed (from ../../../node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/web/packages/teleterm/src/sharedProcess/ptyHost/ptyProcess.ts: You gave us a visitor for the node type ClassAccessorProperty but it's not a valid type
    at verify (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:114:13)
    at Object.explode (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:36:3)
    at traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/index.js:61:12)
    at NodePath.traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/index.js:143:24)
    at injectInitialization (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/misc.js:65:17)
    at PluginPass.Class (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/index.js:189:42)
    at newFn (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:100:31)
 @ ./src/sharedProcess/ptyHost/ptyHostService.ts 18:0-42 32:31-41
 @ ./src/sharedProcess/sharedProcess.ts 21:0-64 58:36-56

webpack 5.76.2 compiled with 2 errors in 12372 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /opt/homebrew/Cellar/node@18/18.17.1/bin/node
Arguments: /opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js build-main
Directory: /Users/rav/src/teleport/web/packages/teleterm
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.

yarn build-term (or more specifically yarn workspace @gravitational/teleterm build-main) can be fixed by copying "babel-loader": "^8.2.5" from here to dev deps in root package.json, so that babel-loader gets hoisted properly.

yarn storybook

Output of yarn storybook
$ yarn storybook
yarn run v1.22.19
$ start-storybook -p 9002 -c web/.storybook -s web/.storybook/public
info @storybook/react v6.5.16
info
(node:94583) DeprecationWarning: --static-dir CLI flag is deprecated, see:

https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated---static-dir-cli-flag
(Use `node --trace-deprecation ...` to show where the warning was created)
info => Loading presets
info => Serving static files from ./web/.storybook/public at /

attention => Storybook now collects completely anonymous telemetry regarding usage.
This information is used to shape Storybook's roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://storybook.js.org/telemetry

info => Loading custom babel config
info => Using implicit CSS loaders
info => Using React fast refresh
info => Using default Webpack5 setup
<i> [webpack-dev-middleware] wait until bundle finished
10% building 0/1 entries 0/0 dependencies 0/0 modules
info => Ignoring cached manager due to change in manager config
<i> [webpack-dev-middleware] wait until bundle finished
10% building 0/8 entries 8/20 dependencies 0/6 modulesBrowserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
<i> [webpack-dev-middleware] wait until bundle finished: /__webpack_hmr
<i> [webpack-dev-middleware] wait until bundle finished: /__webpack_hmr
30% building 3/8 entries 3769/3800 dependencies 119/1289 modulesassets by chunk 5.45 MiB (id hint: vendors)
  assets by status 5.23 MiB [big]
    asset vendors-node_modules_storybook_addon-toolbars_manager_js-node_modules_storybook_core-client_d-3df024.manager.bundle.js 3.8 MiB [emitted] [big] (id hint: vendors)
    asset vendors-node_modules_storybook_components_dist_esm_formatter-0d5cb0eb_js.manager.bundle.js 881 KiB [emitted] [big] (id hint: vendors)
    asset vendors-node_modules_storybook_components_dist_esm_OverlayScrollbars-1355f44c_js.manager.bundle.js 295 KiB [emitted] [big] (id hint: vendors)
    asset vendors-node_modules_storybook_components_dist_esm_syntaxhighlighter-b07b042a_js.manager.bundle.js 286 KiB [emitted] [big] (id hint: vendors)
  asset vendors-node_modules_storybook_components_dist_esm_WithTooltip-167e9982_js.manager.bundle.js 126 KiB [emitted] (id hint: vendors)
  asset vendors-node_modules_storybook_components_dist_esm_Color-f953d088_js.manager.bundle.js 82.8 KiB [emitted] (id hint: vendors)
  asset vendors-node_modules_storybook_components_dist_esm_GlobalScrollAreaStyles-8793ce4a_js.manager.bundle.js 15.5 KiB [emitted] (id hint: vendors)
asset runtime~main.manager.bundle.js 13.6 KiB [emitted] (name: runtime~main)
asset index.html 4.77 KiB [emitted]
asset node_modules_unfetch_dist_unfetch_js.manager.bundle.js 1.28 KiB [emitted]
asset main.manager.bundle.js 897 bytes [emitted] (name: main)
Entrypoint main [big] 3.82 MiB = runtime~main.manager.bundle.js 13.6 KiB vendors-node_modules_storybook_addon-toolbars_manager_js-node_modules_storybook_core-client_d-3df024.manager.bundle.js 3.8 MiB main.manager.bundle.js 897 bytes
orphan modules 688 KiB [orphan] 43 modules
runtime modules 8.38 KiB 14 modules
modules by path ./node_modules/ 4.85 MiB 789 modules
./util.inspect (ignored) 15 bytes [built] [code generated]
manager (webpack 5.76.2) compiled successfully in 10915 ms
<i> [webpack-dev-middleware] wait until bundle finished: /__webpack_hmr
<i> [webpack-dev-middleware] wait until bundle finished: /__webpack_hmr
<i> [webpack-dev-middleware] wait until bundle finished: /__webpack_hmr
99% done plugins webpack-hot-middlewarewebpack built preview 0d35331021471dc24d5c in 31571ms
WARN Force closed manager build
ModuleBuildError: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/e/web/teleport/src/AuthConnectors/AddMenu/AddMenu.tsx: You gave us a visitor for the node type ClassAccessorProperty but it's not a valid type
    at verify (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:114:13)
    at Object.explode (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:36:3)
    at traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/index.js:61:12)
    at NodePath.traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/index.js:143:24)
    at replaceThisContext (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js:672:10)
    at buildFieldsInitNodes (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js:737:24)
    at PluginPass.Class (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/index.js:185:50)
    at newFn (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:100:31)
    at TraversalContext.visitQueue (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:103:16)
    at TraversalContext.visitMultiple (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:72:17)
    at TraversalContext.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:129:19)
    at traverse.node (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/index.js:82:17)
    at NodePath.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:108:18)
    at processResult (/Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:760:19)
    at /Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:862:5
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /Users/rav/src/teleport/node_modules/babel-loader/lib/index.js:59:103
ModuleBuildError: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/web/packages/shared/components/MenuAction/MenuActionIcon.tsx: You gave us a visitor for the node type ClassAccessorProperty but it's not a valid type
    at verify (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:114:13)
    at Object.explode (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:36:3)
    at traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/index.js:61:12)
    at NodePath.traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/index.js:143:24)
    at ReplaceSupers.replace (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-replace-supers/lib/index.js:208:23)
    at buildFieldsInitNodes (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js:736:10)
    at PluginPass.Class (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/index.js:185:50)
    at newFn (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:100:31)
    at TraversalContext.visitQueue (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:103:16)
    at TraversalContext.visitSingle (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:77:19)
    at TraversalContext.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:131:19)
    at traverse.node (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/index.js:82:17)
    at NodePath.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:108:18)
    at processResult (/Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:760:19)
    at /Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:862:5
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /Users/rav/src/teleport/node_modules/babel-loader/lib/index.js:59:103
ModuleBuildError: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/web/packages/teleterm/src/logger.ts: You gave us a visitor for the node type ClassAccessorProperty but it's not a valid type
    at verify (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:114:13)
    at Object.explode (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:36:3)
    at traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/index.js:61:12)
    at NodePath.traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/index.js:143:24)
    at memberExpressionToFunctions (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-member-expression-to-functions/lib/index.js:385:8)
    at ReplaceSupers.replace (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-replace-supers/lib/index.js:213:52)
    at buildFieldsInitNodes (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js:736:10)
    at PluginPass.Class (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/index.js:185:50)
    at newFn (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:100:31)
    at TraversalContext.visitQueue (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:103:16)
    at TraversalContext.visitSingle (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:77:19)
    at TraversalContext.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:131:19)
    at traverse.node (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/index.js:82:17)
    at processResult (/Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:760:19)
    at /Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:862:5
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /Users/rav/src/teleport/node_modules/babel-loader/lib/index.js:59:103
ModuleBuildError: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/web/packages/design/src/Menu/Menu.story.js: You gave us a visitor for the node type ClassAccessorProperty but it's not a valid type
    at verify (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:114:13)
    at Object.explode (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:36:3)
    at traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/index.js:61:12)
    at NodePath.traverse (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/index.js:143:24)
    at injectInitialization (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/misc.js:65:17)
    at PluginPass.Class (/Users/rav/src/teleport/node_modules/@babel/plugin-transform-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/index.js:189:42)
    at newFn (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:100:31)
    at TraversalContext.visitQueue (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:103:16)
    at TraversalContext.visitMultiple (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:72:17)
    at TraversalContext.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:129:19)
    at traverse.node (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/index.js:82:17)
    at NodePath.visit (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/path/context.js:108:18)
    at TraversalContext.visitQueue (/Users/rav/src/teleport/node_modules/@babel/traverse/lib/context.js:103:16)
    at processResult (/Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:760:19)
    at /Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:862:5
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /Users/rav/src/teleport/node_modules/babel-loader/lib/index.js:59:103
ModuleBuildError: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/node_modules/node-fetch/browser.js: 'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled).
    at enableFeature (/Users/rav/src/teleport/node_modules/@storybook/core-common/node_modules/@babel/plugin-proposal-private-property-in-object/node_modules/@babel/helper-create-class-features-plugin/lib/features.js:44:13)
    at PluginPass.pre (/Users/rav/src/teleport/node_modules/@storybook/core-common/node_modules/@babel/plugin-proposal-private-property-in-object/lib/index.js:76:58)
    at transformFile (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transformation/index.js:94:27)
    at transformFile.next (<anonymous>)
    at run (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transformation/index.js:33:12)
    at run.next (<anonymous>)
    at Function.transform (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transform.js:25:41)
    at transform.next (<anonymous>)
    at step (/Users/rav/src/teleport/node_modules/gensync/index.js:261:32)
    at /Users/rav/src/teleport/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/Users/rav/src/teleport/node_modules/gensync/index.js:223:11)
    at processResult (/Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:760:19)
    at /Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:862:5
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /Users/rav/src/teleport/node_modules/babel-loader/lib/index.js:59:103
ModuleBuildError: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/node_modules/react-router-dom/esm/react-router-dom.js: 'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled).
    at enableFeature (/Users/rav/src/teleport/node_modules/@storybook/core-common/node_modules/@babel/plugin-proposal-private-property-in-object/node_modules/@babel/helper-create-class-features-plugin/lib/features.js:44:13)
    at PluginPass.pre (/Users/rav/src/teleport/node_modules/@storybook/core-common/node_modules/@babel/plugin-proposal-private-property-in-object/lib/index.js:76:58)
    at transformFile (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transformation/index.js:94:27)
    at transformFile.next (<anonymous>)
    at run (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transformation/index.js:33:12)
    at run.next (<anonymous>)
    at Function.transform (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transform.js:25:41)
    at transform.next (<anonymous>)
    at step (/Users/rav/src/teleport/node_modules/gensync/index.js:261:32)
    at /Users/rav/src/teleport/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/Users/rav/src/teleport/node_modules/gensync/index.js:223:11)
    at processResult (/Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:760:19)
    at /Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:862:5
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /Users/rav/src/teleport/node_modules/babel-loader/lib/index.js:59:103
ModuleBuildError: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/node_modules/react-router/esm/react-router.js: 'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled).
    at enableFeature (/Users/rav/src/teleport/node_modules/@storybook/core-common/node_modules/@babel/plugin-proposal-private-property-in-object/node_modules/@babel/helper-create-class-features-plugin/lib/features.js:44:13)
    at PluginPass.pre (/Users/rav/src/teleport/node_modules/@storybook/core-common/node_modules/@babel/plugin-proposal-private-property-in-object/lib/index.js:76:58)
    at transformFile (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transformation/index.js:94:27)
    at transformFile.next (<anonymous>)
    at run (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transformation/index.js:33:12)
    at run.next (<anonymous>)
    at Function.transform (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transform.js:25:41)
    at transform.next (<anonymous>)
    at step (/Users/rav/src/teleport/node_modules/gensync/index.js:261:32)
    at /Users/rav/src/teleport/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/Users/rav/src/teleport/node_modules/gensync/index.js:223:11)
    at processResult (/Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:760:19)
    at /Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:862:5
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /Users/rav/src/teleport/node_modules/babel-loader/lib/index.js:59:103
ModuleBuildError: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/node_modules/slash/index.js: 'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled).
    at enableFeature (/Users/rav/src/teleport/node_modules/@storybook/core-common/node_modules/@babel/plugin-proposal-private-property-in-object/node_modules/@babel/helper-create-class-features-plugin/lib/features.js:44:13)
    at PluginPass.pre (/Users/rav/src/teleport/node_modules/@storybook/core-common/node_modules/@babel/plugin-proposal-private-property-in-object/lib/index.js:76:58)
    at transformFile (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transformation/index.js:94:27)
    at transformFile.next (<anonymous>)
    at run (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transformation/index.js:33:12)
    at run.next (<anonymous>)
    at Function.transform (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transform.js:25:41)
    at transform.next (<anonymous>)
    at step (/Users/rav/src/teleport/node_modules/gensync/index.js:261:32)
    at /Users/rav/src/teleport/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/Users/rav/src/teleport/node_modules/gensync/index.js:223:11)
    at processResult (/Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:760:19)
    at /Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:862:5
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /Users/rav/src/teleport/node_modules/babel-loader/lib/index.js:59:103
ModuleBuildError: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/rav/src/teleport/node_modules/strip-ansi/index.js: 'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled).
    at enableFeature (/Users/rav/src/teleport/node_modules/@storybook/core-common/node_modules/@babel/plugin-proposal-private-property-in-object/node_modules/@babel/helper-create-class-features-plugin/lib/features.js:44:13)
    at PluginPass.pre (/Users/rav/src/teleport/node_modules/@storybook/core-common/node_modules/@babel/plugin-proposal-private-property-in-object/lib/index.js:76:58)
    at transformFile (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transformation/index.js:94:27)
    at transformFile.next (<anonymous>)
    at run (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transformation/index.js:33:12)
    at run.next (<anonymous>)
    at Function.transform (/Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/transform.js:25:41)
    at transform.next (<anonymous>)
    at step (/Users/rav/src/teleport/node_modules/gensync/index.js:261:32)
    at /Users/rav/src/teleport/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/Users/rav/src/teleport/node_modules/gensync/index.js:223:11)
    at /Users/rav/src/teleport/node_modules/gensync/index.js:189:28
    at /Users/rav/src/teleport/node_modules/babel-loader/node_modules/@babel/core/lib/gensync-utils/async.js:74:7
    at /Users/rav/src/teleport/node_modules/gensync/index.js:113:33
    at step (/Users/rav/src/teleport/node_modules/gensync/index.js:287:14)
    at /Users/rav/src/teleport/node_modules/gensync/index.js:273:13
    at processResult (/Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:760:19)
    at /Users/rav/src/teleport/node_modules/webpack/lib/NormalModule.js:862:5
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/rav/src/teleport/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /Users/rav/src/teleport/node_modules/babel-loader/lib/index.js:59:103

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

info => Loading presets
99% done plugins webpack-hot-middlewarewebpack built preview 9e811a35adbcf87adbc9 in 969ms

I have no idea how to fix yarn storybook though. Storybook seems to keep using a custom babelrc, even though it should be using our version. In any case, either the custom config or our own config seems to be incompatible with the Babel deps that Storybook is using.

Interesting that in the output of yarn storybook, it says "Loading custom babel config", but babel-loader still seems to have problems with plugins that we don't enable ourselves.

Pinging @gzdunek who was also fighting with the hoisting problems.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just writing the same comment. As Rafał said, this happens because Yarn v1 incorrectly hoists dependencies, for example:

The @babel/plugin-transform-class-properties package is on the 7.22.5 version:

grzegorz@mbp teleport % yarn why @babel/plugin-transform-class-properties
yarn why v1.22.19
[1/4] 🤔  Why do we have the module "@babel/plugin-transform-class-properties"...?
[2/4] 🚚  Initialising dependency graph...
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@babel/[email protected]"
info Reasons this module exists
   - "_project_#@gravitational#build" depends on it
   - Hoisted from "_project_#@gravitational#build#@babel#plugin-transform-class-properties"
   - Hoisted from "_project_#@gravitational#build#@babel#preset-env#@babel#plugin-transform-class-properties"

But babel/core is still on 7.16.x

grzegorz@mbp teleport % yarn why @babel/core
yarn why v1.22.19
[1/4] 🤔  Why do we have the module "@babel/core"...?
[2/4] 🚚  Initialising dependency graph...
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@babel/[email protected]"
info Has been hoisted to "@babel/core"
info Reasons this module exists
   - "workspace-aggregator-ee0d2ae5-7d0b-4486-a0f4-5a7ec47e157b" depends on it
   - Hoisted from "_project_#@gravitational#build#@storybook#builder-webpack5#@babel#core"
   - Hoisted from "_project_#@gravitational#build#@storybook#manager-webpack5#@babel#core"
   - Hoisted from "_project_#@gravitational#build#@storybook#builder-webpack5#@storybook#core-common#@babel#core"
   - Hoisted from "_project_#@gravitational#build#@storybook#react#@storybook#docs-tools#@babel#core"
   - Hoisted from "_project_#@gravitational#build#@storybook#react#babel-plugin-react-docgen#react-docgen#@babel#core"
   - Hoisted from "_project_#@gravitational#build#@storybook#react#@storybook#core#@storybook#core-server#@storybook#builder-webpack4#@babel#core"
   - Hoisted from "_project_#@gravitational#build#@storybook#react#@storybook#core#@storybook#core-server#@storybook#csf-tools#@babel#core"
   - Hoisted from "_project_#@gravitational#build#@storybook#react#@storybook#core#@storybook#core-server#@storybook#manager-webpack4#@babel#core"
   - Hoisted from "_project_#@gravitational#build#jest#@jest#core#@jest#reporters#istanbul-lib-instrument#@babel#core"
   - Hoisted from "_project_#@gravitational#build#jest#@jest#core#@jest#transform#babel-plugin-istanbul#istanbul-lib-instrument#@babel#core"

   ...

I'm going to take look at what do we need to switch to Yarn v2/v3, I'm quite tired of this issue :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was updating babel and eslint to try and prepare for the storybook update since there are some mutually shared dependencies with CVE's.

Considering the above I have removed the babel change from this PR, and instead we can tackle it with the storybook update.

@jentfoo jentfoo force-pushed the jent/yarn_upgrades branch from 57dc977 to 3331609 Compare October 4, 2023 14:27
@gzdunek
Copy link
Contributor

gzdunek commented Oct 4, 2023

As of the electron update, here is our update checklist https://gravitational.slab.com/posts/electron-update-checklist-mob1nxy5
Probably you don't have all the environments to test this, so I can do the update.

@jentfoo jentfoo added this pull request to the merge queue Oct 4, 2023
Merged via the queue into master with commit 8a736d7 Oct 4, 2023
30 checks passed
@jentfoo jentfoo deleted the jent/yarn_upgrades branch October 4, 2023 17:38
@public-teleport-github-review-bot

@jentfoo See the table below for backport results.

Branch Result
branch/v12 Failed
branch/v13 Failed
branch/v14 Create PR

@jentfoo
Copy link
Contributor Author

jentfoo commented Oct 4, 2023

@gzdunek If you can help with the electron update that would be a huge help! Although we should not be exposed, we want to make sure we are updated on some of the recent highly visible CVE's: CVE-2023-4863, CVE-2023-5129 and CVE-2023-5217

Let me know if I can help further

@gzdunek
Copy link
Contributor

gzdunek commented Oct 10, 2023

@jentfoo now I realized that this PR wasn't fully backported to v13 (trim was taken from it, but not the eslint updates). What was the reason for it?

@jentfoo
Copy link
Contributor Author

jentfoo commented Oct 10, 2023

@gzdunek I had similar make full-ent build failures with v12, so felt that the eslint updates may have been too risky to backport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants