Skip to Content
GraphQL Tools
Changelogsoptimize

@graphql-tools/optimize

3.0.0

Major Changes

  • #8515  1d70c62 Thanks @ardatan ! - Drop GraphQL v14/v15 support and require Node.js >= 22.18.

    • graphql peer range is now ^16.0.0 || ^17.0.0.
    • engines.node is now >=22.18.0 (Node fs.glob + Babel 8).
    • Dev tooling and @graphql-tools/graphql-tag-pluck move to Babel 8 (@babel/core / parser / traverse / types).
    • The standalone cross-inspect package is discontinued. Use inspect from @graphql-tools/utils instead (Node util.inspect via process.getBuiltinModule, with a small JSON.stringify / String fallback).

    Removed @graphql-tools/utils exports

    RemovedUse instead
    getArgumentValuesimport { getArgumentValues } from 'graphql'
    coerceInputs / graphqlJSCompatgraphql@16+ APIs (getArgumentValues, etc.)
    createDeferred / createDeferredPromiseconst { promise, resolve, reject } = Promise.withResolvers()
    createGraphQLErrornew GraphQLError(message, options) from graphql
    mapMaybePromisehandleMaybePromise from @whatwg-node/promise-helpers
    isPromise / fakePromise / mapAsyncIterator / MaybePromise@whatwg-node/promise-helpers
    registerAbortSignalListener / getAbortPromiseAbortSignal APIs (throwIfAborted, addEventListener('abort', …, { once: true }), AbortSignal.any, …)
    withCancel / getAsyncIterableWithCancel / getAsyncIteratorWithCancelHandle cancellation on the async iterator’s return() (or your transport abort path)
    debugTimerStart / debugTimerEndYour own timing / console.time if needed
    PromiseWithResolvers (type)Built-in PromiseWithResolvers<T> / return type of Promise.withResolvers()

    inspect and the WeakMap memoize1…memoize2of5 helpers remain on @graphql-tools/utils (inspect is no longer re-exported from cross-inspect).

    File matching (globby → fs.glob)

    Loaders and @graphql-tools/load-files now use Node’s fs.glob through:

    import { matchFiles, matchFilesSync } from '@graphql-tools/load-files';

    Directory symlinks are followed for recursive (**) patterns:

    • On Node.js ≥26.1 (and ≥24.16 where backported), fs.glob followSymlinks is used.
    • On older engines, symlink directories are discovered only under each pattern’s literal prefix (not the whole cwd) and patterns are re-rooted.
    • Non-recursive / literal patterns skip the symlink walk entirely.

    @graphql-tools/executor hot-path caches (collectSubfields, argument coercion, @stream detection) use memoize2 / memoize3 from utils. collectSubFields in utils stays unmemoized so the executor can own a single memoize3 layer.

    Errors and other cleanup

    • Prefer new GraphQLError(message, options) from graphql. Experimental schema coordinate support remains on locatedError / relocatedError / getSchemaCoordinate.
    • Removed GraphQL versions older than 16 compatibility branches (error construction, validation rule name suffixes, URL.canParse fallback).
    • Promise helpers should be imported from @whatwg-node/promise-helpers (handleMaybePromise, isPromise, fakePromise, mapAsyncIterator, MaybePromise) rather than re-exported from utils.

Patch Changes

2.0.1

Patch Changes

  • #8366  57e316d Thanks @ardatan ! - Remove descriptions from operation, variable, fragment, schema definition, and schema extension nodes in removeDescriptions.

2.0.0

Major Changes

1.4.0

Minor Changes

1.3.1

Patch Changes

1.3.0

Minor Changes

  • d76a299c: Support TypeScript module resolution.

1.2.1

Patch Changes

  • 041c5ba1: Use caret range for the tslib dependency

1.2.0

Minor Changes

  • 6d4abf29: feat(optimize): Remove empty nodes from SDL definitions

1.1.1

Patch Changes

  • 4bfb3428: enhance: use ^ for tslib dependency

1.1.0

Minor Changes

  • c5b0719c: feat: GraphQL v16 support

1.0.1

Patch Changes

  • fb14cd28: Fix missing Directive AST when clearing empty nodes

1.0.0

Major Changes

  • bd1ba4bd: NEW PACKAGE: A set of small utilities for optimizing DocumentNode objects