graphql-tools
graphql-tools copied to clipboard
Dependency cleanup
🚨 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
Cleans up some dependencies without introducing breaking changes that much.
- replaces globby with tinyglobby (-21 dependencies)
- removes lodash.sortby dependency in favor of native sort
Related #6895
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?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
bun test
Test Environment:
- OS: macOS
@graphql-tools/...:- NodeJS: 22
Checklist:
- [x] I have followed the CONTRIBUTING doc and the style guidelines of this project
- [x] 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
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests and linter rules pass locally with my changes
- [x] Any dependent changes have been merged and published in downstream modules
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...
Summary by CodeRabbit
-
Chores
- Updated dependencies to enhance file matching and reduce the overall footprint.
-
Refactor
- Streamlined file loading and document sorting using native JavaScript methods for improved performance and reliability.
-
Tests
- Adjusted test cases to verify consistent behavior with the new file handling approach.
🦋 Changeset detected
Latest commit: d7c2fed2046adc60f7c62977b8c449c603429a5b
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 7 packages
| Name | Type |
|---|---|
| @graphql-tools/graphql-file-loader | Patch |
| @graphql-tools/code-file-loader | Patch |
| @graphql-tools/json-file-loader | Patch |
| @graphql-tools/load-files | Patch |
| @graphql-tools/documents | Patch |
| @graphql-tools/load | Patch |
| @graphql-tools/node-require | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
it only fails on windows, i wonder why
blocked by a performance regression in tinyglobby on windows
📝 Walkthrough
Summary by CodeRabbit
-
Chores
- Updated dependencies to improve file matching and reduce dependency footprint.
- Added automation for dependency updates and enhanced CI workflows.
-
Refactor
- Replaced file globbing library with a lighter alternative for faster file loading.
- Improved error handling with specific error types for missing type definitions.
- Enhanced abort signal integration and promise handling in GraphQL execution.
- Streamlined directive merging with better support for repeatable directives.
- Added support for federated schema links and schema extensions.
- Improved Vue file parsing with explicit TypeScript integration.
-
Tests
- Added tests for Vue 3 SFC GraphQL plucking and federation directive merging.
- Improved resource disposal and error assertion in existing test suites.
Walkthrough
The changes update several GraphQL tools packages by replacing the globby dependency with tinyglobby and removing unnecessary dependencies such as lodash.sortby, chalk, and unixify. Updates span package manifests, source code for file globbing functions, sorting mechanisms, and test scripts. Native JavaScript methods now handle sorting, and a new utility function (unixifyWithDriveLetter) has been added. The modifications adjust import statements, function signatures, and option types consistently across multiple packages and scripts.
Changes
| File(s) | Change Summary |
|---|---|
.changeset/nasty-peas-ring.md, package.json, packages/.../package.json |
Updated dependency management across GraphQL tools packages: removed globby, chalk, lodash.sortby, and unixify; added tinyglobby, @graphql-tools/utils, and updated devDependencies. |
packages/load-files/src/index.ts, packages/loaders/code-file/src/index.ts, packages/loaders/graphql-file/src/index.ts, packages/loaders/json-file/src/index.ts, packages/load/tests/loaders/documents/...spec.ts |
Replaced globby with tinyglobby in imports and function calls; updated function signatures (using GlobOptions instead of GlobbyOptions) and renamed parameters for clarity; replaced unixify with unixifyWithDriveLetter. |
packages/documents/src/sort-executable-nodes.ts |
Refactored sorting logic by replacing the use of lodash.sortby with native JavaScript array sorting using custom comparators and localeCompare. |
packages/utils/src/index.ts, packages/utils/src/unixifyWithDriveLetter.ts |
Added a new utility function unixifyWithDriveLetter to normalize paths with drive letters and updated module exports accordingly. |
scripts/build-api-docs.ts |
Modified the documentation build script by replacing chalk with styleText from node:util and updating file globbing to use tinyglobby (via globSync). |
Sequence Diagram(s)
sequenceDiagram
participant U as User
participant FL as FileLoader Function
participant TG as tinyglobby
participant UT as Utils (unixifyWithDriveLetter)
U ->> FL: Invoke file loading function
FL ->> TG: Call glob or globSync with file pattern
TG -->> FL: Return list of file paths
FL ->> UT: Normalize each path using unixifyWithDriveLetter
UT -->> FL: Return normalized path
FL -->> U: Return processed file list
Possibly related PRs
- ardatan/graphql-tools#7272: Related changes in
@graphql-tools/mockpackage improving internal logic and error handling. - ardatan/graphql-tools#7225: Related enhancements in
@graphql-tools/importadding support for schema extensions and federated schema links. - ardatan/graphql-tools#7249: Related improvements for handling repeatable federation directives during schema merging and import.
Suggested reviewers
- ardatan
Poem
I'm Bunny the coder, hopping with glee,
My code now leaps with tiny glob harmony.
Paths get their drive, normalized so neat,
Sorting like carrots—orderly and sweet.
In the fields of code, I twirl and bound,
A rabbit’s joy in every update found!
🐰💻
[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
packages/executor/src/execution/__tests__/abort-signal.test.ts
Oops! Something went wrong! :(
ESLint: 9.31.0
ESLint couldn't find an eslint.config.(js|mjs|cjs) file.
From ESLint v9.0.0, the default configuration file is now eslint.config.js. If you are using a .eslintrc.* file, please follow the migration guide to update your configuration file to the new format:
https://eslint.org/docs/latest/use/configure/migration-guide
If you still have problems after following the migration guide, please stop by https://eslint.org/chat/help to chat with the team.
packages/executor/src/execution/__tests__/error-handling.test.ts
Oops! Something went wrong! :(
ESLint: 9.31.0
ESLint couldn't find an eslint.config.(js|mjs|cjs) file.
From ESLint v9.0.0, the default configuration file is now eslint.config.js. If you are using a .eslintrc.* file, please follow the migration guide to update your configuration file to the new format:
https://eslint.org/docs/latest/use/configure/migration-guide
If you still have problems after following the migration guide, please stop by https://eslint.org/chat/help to chat with the team.
babel.config.js
Oops! Something went wrong! :(
ESLint: 9.31.0
ESLint couldn't find an eslint.config.(js|mjs|cjs) file.
From ESLint v9.0.0, the default configuration file is now eslint.config.js. If you are using a .eslintrc.* file, please follow the migration guide to update your configuration file to the new format:
https://eslint.org/docs/latest/use/configure/migration-guide
If you still have problems after following the migration guide, please stop by https://eslint.org/chat/help to chat with the team.
- 44 others
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🧪 Generate unit tests
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai auto-generate unit teststo generate unit tests for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@ardatan I think this PR is good to go
@talentlessguy would you be able to rebase this PR? I just loaded your branch in VS Code and confirmed it's not a breaking change
It's better to open a fresh new PR instead imo