From 12d7a38ba0f1b1e4e301fce81e22f4b93036d211 Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Tue, 28 Jul 2026 20:23:12 +0530 Subject: refactor(util): strip comment noise Removes file-header banners and comments that restate the code. Keeps one-line notes at the optional-sharp dynamic import, the sharp .default probe, the `never` contravariance trick, the sanctioned renderCall cast, and safeJs's interpolation rule. Co-Authored-By: Claude Opus 5 (1M context) --- src/util/sharp-shim.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/util/sharp-shim.ts') diff --git a/src/util/sharp-shim.ts b/src/util/sharp-shim.ts index 36dd536..d7adb5f 100644 --- a/src/util/sharp-shim.ts +++ b/src/util/sharp-shim.ts @@ -1,10 +1,4 @@ -// Typed minimal shim for the optional `sharp` dependency. Sharp is a heavy -// native module not installed in every workspace; we import dynamically and -// distinguish "missing" (no install) from "error" (installed but threw). -// -// We declare only the surface we use. The dynamic import returns `unknown` -// at the boundary; the cast inside loadSharp() is the documented escape -// hatch — every other consumer sees the typed SharpFactory. +// `sharp` is an optional dependency not installed in every workspace, so the import must stay dynamic and unresolvable to tsc. export type SharpInstance = { metadata(): Promise<{ width?: number; height?: number }>; @@ -38,8 +32,7 @@ export const loadSharp = async (): Promise => { return { kind: "error", message: msg }; } if (mod === null || mod === undefined) return { kind: "missing" }; - // The CommonJS sharp module's default export IS the factory. ESM-wrapped - // sharp puts it on .default. Probe both. + // The CommonJS sharp module's default export IS the factory; ESM-wrapped sharp puts it on .default. const m = mod as { default?: unknown }; const candidate: unknown = typeof m.default === "function" ? m.default : mod; if (typeof candidate !== "function") { -- cgit v1.2.3