Open dario-piotrowicz opened 1 year ago
@pi0 Should we work towards deprecating the service worker syntax? The only issue that I can think of would be that people using environments variables from global would need to switch to useRuntimeConfig once https://github.com/unjs/nitro/pull/1318 is merged.
The Cloudflare pages adaptor has been lately improved (https://github.com/unjs/nitro/pull/1004) to surface the
env
,context
andcf
object: https://github.com/unjs/nitro/blob/1dcf5c463ffca8776e6c2dc796f16844ff2fcc8f/src/runtime/entries/cloudflare-pages.ts#L40-L47The same hasn't been applied to the worker adator: https://github.com/unjs/nitro/blob/1dcf5c463ffca8776e6c2dc796f16844ff2fcc8f/src/runtime/entries/cloudflare.ts#L34-L37
So if a user decides to use the worker adaptor they will not have access to the same information as the pages one. (as you can see only the
cf
object is passed along)So the same sort of information should be surfaced in the worker adaptor as well.
PS: to correctly pass the environment the adaptor should switch from the service worker syntax to the module one.