ESM-only packages, lower memory use, and edge runtime support
Neaps 0.8.0
Release Tides & Currents
Drop the CommonJS builds; all neaps packages are now ESM-only. The CJS entries can't survive their dependencies going ESM-only, since they load them with
require(). CommonJS consumers on Node 20.19+ / 22.12+ can stillrequire()these packages via Node'srequire(esm)support. (#301)Update @neaps/tide-database to 0.9. Station prediction data now lives in an off-heap pack file read per station instead of being parsed into the JS heap at import, dropping baseline heap usage from ~118 MB to ~36 MB. (#303)
Make the API runnable on edge runtimes (e.g. Cloudflare Workers). (#293)
- Replace the runtime
express-openapi-validatorwith lightweight request validation/coercion invalidate.ts. The validator relies on Ajv codegen (new Function), which edge runtimes disallow. It's now a dev dependency mounted in the test suite, so requests and responses are still validated against the OpenAPI spec — keeping the runtime validators in alignment with it. - Add a
compressoption tocreateApp(defaulttrue). Thecompression()middleware corrupts responses through thenode:httpbridge on Workers, which compress at the edge anyway — passcreateApp({ compress: false })there. - Declare
@neaps/tide-databaseas a direct dependency so it's externalized from the build instead of bundled. Shrinks the publisheddistfrom ~30 MB to ~20 KB and avoids the station database being bundled twice by downstream bundlers.
- Replace the runtime
Add
s-maxageto theCache-Controlheader so CDNs and edge caches (e.g. Vercel, Cloudflare) cache responses, not just browsers. Uses the same TTL asmax-age(NEAPS_API_MAX_AGE, default 3600). (#292)