Skip to content

v3.2.0

Choose a tag to compare

@58bits 58bits released this 04 Jun 03:44
· 44 commits to main since this release

Highlights

  • @byline/coreLazy-loader form for collection and upload hooks. A collection schema is isomorphic — Byline bundles it into the browser admin as well as the server — so a hook declared inline that statically imports server-only code (a storage SDK, sharp, an antivirus scanner, a Node built-in) drags that entire graph into the client bundle, failing silently in build (tree-shaken away) but crashing the dev server with Module "node:…" has been externalized for browser compatibility. This release adds a loader form for both server-only hook surfaces — collection lifecycle hooks and a field's upload.hooks — letting authors point at a sibling module via a dynamic import: hooks: () => import('./hooks.js'). Because the schema reaches the hooks only through import(), that module and its entire transitive graph are structurally absent from the client bundle, with no per-call-site SSR guards required. New exports: defineHooks (an identity factory mirroring defineCollection / defineBlock), the CollectionHooksLoader / UploadHooksLoader types, and the memoized resolveHooks / resolveUploadHooks resolvers (wired into every lifecycle, read, and upload-hook site; a loader's import() runs at most once per process). The change is additive and backward-compatible — the inline object form stays valid for hooks whose bodies only touch isomorphic code. See docs/COLLECTIONS.md → "Hooks must not statically import server-only code".

Chores

  • monorepo — documented the parallel upload.storage isomorphic-import hazard (pinning an IStorageProvider instance inline in a schema field) in docs/FILE-MEDIA-UPLOADS.md, and migrated the docs collection and media upload field to sibling hooks.ts files as worked references.

All other @byline/* packages bumped to 3.2.0 in lockstep with no behavioural changes this cycle.