Repository navigation
chore(deps): fastify-plugin 6, lazy-load cloud SDKs, 100% coverage - #6
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… loads Importing the AWS, Azure and GCS SDKs at module scope cost ~360ms and ~31MB of heap on every boot, though a deployment only ever uses one backend. Loading each via its Configure* entry point drops package require to ~5ms and leaves the other two SDKs untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tsconfig sets sourceMap:false, so istanbul reported emitted-JS line numbers rather than TypeScript ones — parameter properties expand on compile, so the report blamed imports and comments and understated real coverage as ~95%. Overriding sourceMap for the jest transform only makes it accurate; the published build is unchanged. Covers every provider and branch across four new specs: 38 -> 121 tests. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
saby1101
force-pushed
the
chore/fastify-plugin-6
branch
from
August 14, 2026 09:59
4611a10 to
7339d95
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No version bump here — this is the upgrade/fix content only. Versioning and release are handled separately.
Unblocks the wms
fastify-plugindeduplication: wms currently resolves both 5.1.0 and 6.0.0, and this package was one of the six holding v5.fastify-plugin^5 → ^6 is safe to take: v6 is a pure file rename of v5 (plugin.js→index.js,types/plugin.d.ts→types/index.d.ts) withmain/typesupdated to match. Runtime code andlib/are byte-identical, and there is noexportsmap, so the bareimport fp from "fastify-plugin"resolves the same way.Cloud SDKs now load lazily. All three were imported at module scope, costing ~360ms and ~31MB of heap on every boot even though a deployment only ever uses one backend. Each is now
require()d by itsConfigure*entry point. Verified against the builtdist/:require()of the package drops 360ms → 5.4ms with zero SDK files loaded, and registering each provider pulls exactly one SDK family —localgcs@google-cloud(25 files)s3/minio@aws-sdk(14 files)azureBlob@azure(240 files)Public API and behaviour unchanged. Note this is a runtime saving — install size is untouched, since all three SDKs remain hard dependencies.
Coverage is now 100% on statements, branches, functions and lines across
file-store.ts,utils.tsandindex.ts(38 → 121 tests). Getting there required fixing the measurement:tsconfig.jsonsetssourceMap: false, so istanbul was reporting emitted-JS line numbers — TS parameter properties expand on compile, so the report blamed imports and comments and understated true coverage as ~95%. The override is scoped to the jest transform;tsconfig.build.jsonand the publisheddist/are unchanged (no.mapfiles emitted).Also: dropped
testcontainers, which nothing imported — removes 37MB, 61 packages and thessh2/cpu-featuresnative gyp builds from dev installs. CI moves off Node 20 (EOL April 2026) to 24,npm-run-all→npm-run-all2,@types/node26, andengines: >=22is declared for the first time.Writing the exhaustive branch tests surfaced pre-existing bugs, none introduced here and none fixed here — filed as #7, #8 and #9, with fixes following in their own PR.
Held back deliberately:
@google-cloud/storage7→8 is a runtime major that deserves its own change; TypeScript 6→7 is not possible whilets-jest(peer<7) and@typescript-eslint(peer<6.1.0) embed the TS compiler in-process — TS 7 ships nolib/typescript.jsat all, only a native binary behind a JSON-RPC bridge.