graphql-tools icon indicating copy to clipboard operation
graphql-tools copied to clipboard

Peer dependency warnings from @graphql-tools/graphql-tag-pluck on @babel/core

Open shawnmcknight opened this issue 2 years ago • 4 comments

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • [ ] 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches yours.

  • [ ] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

Describe the bug

@graphql-tools/graphql-tag-pluck has a dependency on @babel/plugin-syntax-import-assertions. That package has a peer dependency on @babel/core^7.0.0-0. As a result, pnpm is emitting peer dependency warnings due to @babel/core not being present:

└─┬ @graphql-codegen/cli 3.0.0
  └─┬ @graphql-tools/code-file-loader 7.3.21
    └─┬ @graphql-tools/graphql-tag-pluck 7.5.0
      └─┬ @babel/plugin-syntax-import-assertions 7.20.0
        └── ✕ missing peer @babel/core@^7.0.0-0
Peer dependencies that should be installed:
  @babel/core@^7.0.0-0

The dependency for @babel/plugin-syntax-import-assertions was added in #4863. Since that package has a peer dependency on @babel/core, that should be added as well so that consumers without @babel/core do not get peer dependency warnings or an alternative approach devised which makes the syntax transformation opt-in.

To Reproduce Steps to reproduce the behavior:

Add @graphql-tools/graphql-tag-pluck as a dependency without installing @babel/core. pnpm will emit a peer dependency warning. It's been a while since I've used npm or yarn, but I suspect they would exhibit similar warnings.

Expected behavior

No peer dependency warnings.

Environment:

  • OS: Windows
  • @graphql-tools/...: See dependency tree in description
  • NodeJS: 18.14.0

Additional context

shawnmcknight avatar Feb 16 '23 23:02 shawnmcknight

Yarn warning:

➤ YN0002: │ @graphql-tools/graphql-tag-pluck@npm:8.0.1 [cc2f2] doesn't provide @babel/core (p424e0), requested by @babel/plugin-syntax-import-assertions

Yarn workaround:

# .yarnrc.yml
packageExtensions:
  # awaiting fix: https://github.com/ardatan/graphql-tools/issues/5066
  '@graphql-tools/graphql-tag-pluck@*':
    dependencies:
      '@babel/core': '*'

lensbart avatar Jun 03 '23 12:06 lensbart

I don't use PNPM or newer versions of Yarn. PRs are welcome to fix it.

ardatan avatar Jun 03 '23 12:06 ardatan

https://next.babeljs.io/docs/v8-migration/#babelplugin-syntax-import-assertions

Please migrate to @babel/plugin-syntax-import-attributes (#15536). After you replace the plugin, you should search and replace the following patterns in your codebase:

- import value from "module" assert { type: "json" };
+ import value from "module" with { type: "json" };

Semigradsky avatar Jul 25 '23 11:07 Semigradsky

Closing this issue since peer dependency has bene added in the latest version.

ardatan avatar Jul 25 '23 11:07 ardatan