Skip to content

Conversation

@petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Sep 10, 2025

This changes the unenv-preset so that it only applies the unenv polyfills for console when the native implementation is not turned on (via compat flag or compat date).

The native code was merged into workerd at https://github.com/cloudflare/workerd/releases/tag/v1.20250911.0
The tests would fail if the production edgeworker doesn't include the correct native code.

All the members of the console module are the same between the polyfill and native except for the following:

  • _stderr - in workerd it is process.stderr, in unenv it is new Writable()
  • _stdout - in workerd it is process.stdout, in unenv it is new Writable()
  • _stdoutErrorHandler - in workerd it throws an error, in unenv it is a noop
  • _stderrErrorHandler - in workerd it throws an error, in unenv it is a noop

I think the first two are not breaking changes. In fact it provides a more full implementation natively than unenv.
The second two are breaking changes from unenv.


  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: covered by workerd docs
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: unenv-preset is not backported

@petebacondarwin petebacondarwin requested a review from a team September 10, 2025 19:35
@petebacondarwin petebacondarwin requested a review from a team as a code owner September 10, 2025 19:35
@changeset-bot
Copy link

changeset-bot bot commented Sep 10, 2025

🦋 Changeset detected

Latest commit: 424e3bd

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 10, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@10606

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@10606

miniflare

npm i https://pkg.pr.new/miniflare@10606

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@10606

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@10606

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@10606

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@10606

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@10606

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@10606

wrangler

npm i https://pkg.pr.new/wrangler@10606

commit: 424e3bd

@petebacondarwin petebacondarwin force-pushed the pbd/workerd-console-implementation branch 3 times, most recently from b4ff485 to 8d6dc07 Compare September 10, 2025 20:26
@petebacondarwin petebacondarwin added the blocked Blocked on other work label Sep 11, 2025
@petebacondarwin petebacondarwin marked this pull request as draft September 11, 2025 11:30
@petebacondarwin petebacondarwin force-pushed the pbd/workerd-console-implementation branch from 8d6dc07 to d3e026c Compare September 30, 2025 12:48
@petebacondarwin petebacondarwin marked this pull request as ready for review September 30, 2025 12:52
@petebacondarwin petebacondarwin force-pushed the pbd/workerd-console-implementation branch 3 times, most recently from 8827f0c to 5b5443b Compare October 6, 2025 11:10
@petebacondarwin petebacondarwin force-pushed the pbd/workerd-console-implementation branch 4 times, most recently from a3cbb67 to 34785fa Compare October 6, 2025 16:24
vicb
vicb previously requested changes Oct 6, 2025
Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check all the APIs available in unenv and make sure they have a similar behavior in the native implementation.

I stopped after seeing that _stdoutErrorHandler and _stdoutErrorHandler do not.

Could you please note all the differences in the PR description and then we can decide if we want to integrate that breaking change or not.

@github-project-automation github-project-automation bot moved this from Untriaged to In Review in workers-sdk Oct 6, 2025
@petebacondarwin petebacondarwin requested a review from vicb October 6, 2025 18:57
@petebacondarwin
Copy link
Contributor Author

We should check all the APIs available in unenv and make sure they have a similar behavior in the native implementation.

I stopped after seeing that _stdoutErrorHandler and _stdoutErrorHandler do not.

Could you please note all the differences in the PR description and then we can decide if we want to integrate that breaking change or not.

Noted, PTAL

@petebacondarwin petebacondarwin force-pushed the pbd/workerd-console-implementation branch from 34785fa to f3c59b8 Compare November 28, 2025 15:58
@petebacondarwin petebacondarwin marked this pull request as draft November 28, 2025 23:20
@petebacondarwin petebacondarwin force-pushed the pbd/workerd-console-implementation branch from f3c59b8 to 52cb85f Compare November 28, 2025 23:20
@petebacondarwin
Copy link
Contributor Author

Blocked on cloudflare/workerd#5610

@petebacondarwin
Copy link
Contributor Author

cloudflare/workerd#5610 has landed so this should become unblocked when that is released tomorrow.

@vicb vicb marked this pull request as ready for review December 2, 2025 18:14
@github-project-automation github-project-automation bot moved this from In Review to Approved in workers-sdk Dec 2, 2025
@vicb vicb removed the blocked Blocked on other work label Dec 2, 2025
@vicb vicb force-pushed the pbd/workerd-console-implementation branch from 9bad080 to 22d71b3 Compare December 3, 2025 13:19
@vicb
Copy link
Contributor

vicb commented Dec 3, 2025

rebased + bump workerd to 1202 where the console implementation has been merged

@petebacondarwin petebacondarwin merged commit 819e287 into main Dec 3, 2025
29 checks passed
@petebacondarwin petebacondarwin deleted the pbd/workerd-console-implementation branch December 3, 2025 21:10
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants