@graphql-tools/import
8.0.9 · 10 Nov 2026MIT13.6M / weekRepositoryHomepagenpmAtom feed
7.2.4 is the newest release of 7.x.
In short
2 faster1 internal
Release note
The section about @graphql-tools/import of a note shared by several packages.
@graphql-tools/import@7.1.19
Patch Changes
#8259
85f1de0
Thanks @lemonmade! - perf(import): remove redundant work inaddDefinition's dependency traversaladdDefinitionrecurses across the whole dependency graph while assembling each definition's
imported dependencies. Two things were repeated on every call:visitedFiles.get(filePath)— invariant for the duration of theprocessImportcall, so it's
now looked up once and hoisted out of the recursion.the per-field dependency-name derivation (
visitFieldDefinitionNode/visitInputValueDefinitionNodeinto a freshMap) — a pure function of the field node and the
file's static dependency map, so it's now memoized by field identity instead of recomputed every
time the owning definition is added to a set.
Pure performance change; output is unchanged (the existing import tests pass and a real-world
~12k-line schema produces byte-identical results). Building on theprintmemoization, this took
the same codegen pass from ~17s to ~13s. The remaining cost is the O(n²) shape of the closure
traversal itself (each definition's transitive set is still rebuilt independently); reducing that
is left for a follow-up as it's a more invasive change.#8258
6bacf57
Thanks @lemonmade! - perf(import): memoizeprintper node when
assembling imported definitionsprocessImportde-duplicates the collected definitions by printing each one to SDL and comparing
the strings. A single definition node appears in many of the dependency sets (any
widely-referenced type is pulled in by every definition that depends on it), soprintwas called
roughly O(n²) times for n unique nodes. For large, densely-connected schemas this print/visit work
dominates import time.Memoizing
printby node identity makes each unique node print at most once.printis a pure
function of its node, so the output is identical; this is a pure performance change. On a
~12k-line schema imported across three projects, this reduced a downstream codegen pass from ~133s
to ~17s.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.