unjs / unenv

🕊️ Convert javaScript code to be runtime agnostic
MIT License
464 stars 22 forks source link

[perf_hook][cloudflare] The implementation is updating globalThis.performance #318

Open vicb opened 1 month ago

vicb commented 1 month ago

perf_hooks/$cloudflare.ts patches globalThis.performance, see:

https://github.com/unjs/unenv/blob/a58d5160ad0bb7e949c9fd016996afa695c34f78/src/runtime/node/perf_hooks/%24cloudflare.ts#L37-L43

@IgorMinar I think you told me that we should not patch existing globals here. Is this a special case?

Note that performance is in the inject

https://github.com/unjs/unenv/blob/a58d5160ad0bb7e949c9fd016996afa695c34f78/src/presets/cloudflare.ts#L72