Skip to content

chore(deps): fastify-plugin 6, lazy-load cloud SDKs, 100% coverage - #6

Merged
saby1101 merged 3 commits into
mainfrom
chore/fastify-plugin-6
Aug 14, 2026
Merged

saby1101 merged 3 commits into
mainfrom
chore/fastify-plugin-6

Conversation

@saby1101

@saby1101 saby1101 commented Aug 14, 2026 •

Copy link
Copy Markdown
Member

No version bump here — this is the upgrade/fix content only. Versioning and release are handled separately.

Unblocks the wms fastify-plugin deduplication: 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) with main/types updated to match. Runtime code and lib/ are byte-identical, and there is no exports map, so the bare import 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 its Configure* entry point. Verified against the built dist/: require() of the package drops 360ms → 5.4ms with zero SDK files loaded, and registering each provider pulls exactly one SDK family —

register loads heap
local none (0 files) 10.3 MB
gcs @google-cloud (25 files) 20.0 MB
s3 / minio @aws-sdk (14 files) 17.1 MB
azureBlob @azure (240 files) 24.5 MB

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.ts and index.ts (38 → 121 tests). Getting there required fixing the measurement: tsconfig.json sets sourceMap: 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.json and the published dist/ are unchanged (no .map files emitted).

Also: dropped testcontainers, which nothing imported — removes 37MB, 61 packages and the ssh2/cpu-features native gyp builds from dev installs. CI moves off Node 20 (EOL April 2026) to 24, npm-run-all → npm-run-all2, @types/node 26, and engines: >=22 is 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/storage 7→8 is a runtime major that deserves its own change; TypeScript 6→7 is not possible while ts-jest (peer <7) and @typescript-eslint (peer <6.1.0) embed the TS compiler in-process — TS 7 ships no lib/typescript.js at all, only a native binary behind a JSON-RPC bridge.

saby1101 and others added 3 commits August 14, 2026 09:30
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
saby1101 force-pushed the chore/fastify-plugin-6 branch from 4611a10 to 7339d95 Compare August 14, 2026 09:59
@saby1101 saby1101 changed the title 2.16.0 chore(deps): fastify-plugin 6, lazy-load cloud SDKs, 100% coverage Aug 14, 2026
@saby1101
saby1101 merged commit 93c1405 into main Aug 14, 2026
1 check passed
@saby1101
saby1101 deleted the chore/fastify-plugin-6 branch August 14, 2026 10:19
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.

1 participant