cloudflare / next-on-pages

CLI to build and develop Next.js apps for Cloudflare Pages
https://www.npmjs.com/package/@cloudflare/next-on-pages
MIT License
1.24k stars 118 forks source link

Finalize `next-dev`'s `DevBindingsOptions` API (and remove `__experimental__` prefix) #527

Closed dario-piotrowicz closed 8 months ago

dario-piotrowicz commented 10 months ago

In https://github.com/cloudflare/next-on-pages/pull/486 we've added the next-dev submodule for adding local bindings to next dev.

The submodule exports the setupDevBindings function which accepts a DevBindingsOptions object for the various options.

Most of the options there follow Miniflare's API with the exception of textBindings (which in Miniflare is just bindings), adding a new term there could be worse/more confusing then just sticking with the (potentially confusing) bindings term (see https://github.com/cloudflare/next-on-pages/pull/486#discussion_r1368980906).

So before our next release we need to decide how the DevBindingsOptions object needs to look like, the alternatives are:

dario-piotrowicz commented 10 months ago

I had to make a release so that we could get this hot-fix in: https://github.com/cloudflare/next-on-pages/pull/534

So I did release the next-dev submodule but I marked it as experimental: https://github.com/cloudflare/next-on-pages/pull/537

So now what needs to be done is to revert https://github.com/cloudflare/next-on-pages/pull/537 when we finalize the next-dev submodule's API

dario-piotrowicz commented 10 months ago

I think we should follow Wrangler's new API here

dario-piotrowicz commented 10 months ago

TODO after changing the API:

dario-piotrowicz commented 10 months ago

Note: the new Wrangler API accepts Uint8Array types for vars but Miniflare does not yet (but it's going to)

dario-piotrowicz commented 9 months ago

I've added the blocked by external label as this requires wrangler to be properly updated to surface the Bindings type (and potentially the getBindingsProxy utility) before we can proceed with this