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 still require() these packages via Node's require(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-validator with lightweight request validation/coercion in validate.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 compress option to createApp (default true). The compression() middleware corrupts responses through the node:http bridge on Workers, which compress at the edge anyway — pass createApp({ compress: false }) there.
    • Declare @neaps/tide-database as a direct dependency so it's externalized from the build instead of bundled. Shrinks the published dist from ~30 MB to ~20 KB and avoids the station database being bundled twice by downstream bundlers.
  • Add s-maxage to the Cache-Control header so CDNs and edge caches (e.g. Vercel, Cloudflare) cache responses, not just browsers. Uses the same TTL as max-age (NEAPS_API_MAX_AGE, default 3600). (#292)