Skip to content

Dev & production bundles ​

The package ships two bundle flavors from one source, selected automatically through the development / production export conditions.

What each flavor does ​

developmentproduction (default)
Operation creators validate ranges/enums✅ throw TypeError / RangeError❌ stripped
Builder misuse guards (ops on a group root)✅ throwsilently no-op
videoPath / nthUrl input checks✅ throw❌ stripped
Structural errors (parseCdnUrl, parseGroupId)✅ throw✅ throw
validate module✅ fully functional✅ fully functional
Minifiednoyes

The contract is to catch mistakes in development; production is garbage in, garbage out. quality('ultra') throws on your machine and in CI; in a production build it serializes to -/quality/ultra/ and the CDN responds with an error instead.

Structural errors stay in both flavors because callers rely on them for control flow. A try/catch around parseCdnUrl behaves identically everywhere.

What each function does when it fails ​

Four failure modes exist, and which one you get is a property of the function, not of the bundle. This is the whole map:

Failure modeFunctionsIn production
Always throws — structural, you cannot proceedparseCdnUrl and the per-kind parsers, parseGroupId, serializeCdnUrl's addressing guard, cdn.base(''), cdn.file/group/gif2video before a base is boundthrows
Dev-only throw, then no-op — misuse the facade catches for youbuilder and chain guards: operations on a group root, a filename on a proxyreturns the receiver unchanged
Dev-only throw, then garbage in / garbage out — value checksevery operation creator (quality('ultra'), out-of-range sizes, bad enums), videoPath/nthUrl input checksserializes the bad value as given
Never throws, returns findingsvalidateOperations and the rest of the validate entryidentical to development

Two functions sit outside the table because their behaviour depends on the runtime rather than the bundle: prefixedCdnBaseAsync needs WebCrypto, so it fails on a plain http:// origin, where browsers hide crypto.subtle; under Node it uses node:crypto. prefixedCdnBase works everywhere.

The string level (tinyParse/tinyBuild) throws nowhere, in either flavor, by design — it does no validation at all.

Who picks which bundle ​

  • Vite, webpack and friends resolve the development condition in dev servers and production in production builds, with no configuration needed.
  • Node uses the production bundle by default; opt into the checks with node --conditions=development.
  • Unknown or legacy resolvers fall back to production, the safe minimal default.

Validating at runtime anyway ​

Stripped checks protect your code from your mistakes. If operation chains come from users or stored data, validate them explicitly. validateOperations works identically in both flavors and returns diagnostics instead of throwing.