Skip to content

feat: support top-level await #1631

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

Merged
merged 3 commits into from
Feb 17, 2025

Conversation

aaronadamsCA
Copy link
Contributor

@aaronadamsCA aaronadamsCA commented Feb 4, 2025

🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.

Description

Adds support for top-level await in a GraphQL config file. Includes tests.

This is good as more libraries go async-only. For us, we needed to sign a JWT in an authorization header, and we preferred to use jose, which is async only.

Fixes #1628.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

I added new tests that run in async mode only. They're all passing, as are all existing tests.

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests and linter rules pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

I avoided any dependency changes, but when you do eventually upgrade cosmiconfig to latest, you could replace the direct usage of jiti with cosmiconfig-typescript-loader. Its latest version provides both async and sync loaders.

@aaronadamsCA aaronadamsCA marked this pull request as ready for review February 4, 2025 17:23
@ardatan ardatan merged commit 790cfc1 into graphql-hive:master Feb 17, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Top-level await support for ESM config files
2 participants