unjs / unenv

🕊️ Convert javaScript code to be runtime agnostic
MIT License
340 stars 18 forks source link

fix: add missing `node:process` named exports #268

Closed pi0 closed 2 weeks ago

pi0 commented 2 weeks ago

Add missing named exports of node:process

pi0 commented 2 weeks ago

Merging to iterate faster. @IgorMinar @jculvey please comment if have any feedbacks.

IgorMinar commented 2 weeks ago

@pi0 I'm not too keen on this change. I was hoping that we could keep polyfills exportless and side-effecty and use proper modules to power inject which requires default export.

The only reason why you needed to make this change is because in some installations the nightly version got hoisted incorrectly and overshadowed the 1.x version. This resulted in a version skew between the built-time and run-time parts of unenv (built-time was on 1.x which pointed at run-time paths that got resolved @ nightly version causing the problem).

I'd rather think about how to fix the version skew problem than try to align the runtime@head to be compatible with every past version of unenv released.

pi0 commented 2 weeks ago

@IgorMinar Fix in this PR is not related to hoisted dep at all in this PR. Main entry was not having all ESM named exports (while $cloudflare variant had that's why you probably haven't catched it in your tests but test:node script did)

(regression of #260 solved with #262, that's the one we caught with nightly)