Skip to content

feat(unenv-preset): add native node:tty module support#12023

Merged
petebacondarwin merged 3 commits intomainfrom
devin/1768991072-native-node-tty
Feb 13, 2026
Merged

feat(unenv-preset): add native node:tty module support#12023
petebacondarwin merged 3 commits intomainfrom
devin/1768991072-native-node-tty

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin commented Jan 21, 2026

Devin PR requested by @petebacondarwin

Adds support for the native node:tty module from workerd when the enable_nodejs_tty_module and experimental compatibility flags are enabled. This follows the same pattern as other experimental modules (inspector, sqlite, dgram, stream_wrap, repl).

The native code appears in workerd as of https://github.com/cloudflare/workerd/blob/main/src/node/tty.ts. It is currently experimental with no default enable date.

Implementation Comparison

Export workerd unenv Breaking change?
isatty returns false returns false No (same)
ReadStream creates stub object creates stub object No (same)
WriteStream creates stub object creates stub object No (same)

Implementation Notes

  • The test validates throw behavior only when native module is enabled via compatibility flags

Human Review Checklist

  • Verify the getTtyOverrides() function follows the same pattern as other experimental modules (requires experimental flag)
  • Confirm the compatibility flag names match workerd's compatibility-date.capnp (enable_nodejs_tty_module / disable_nodejs_tty_module)
  • Review the test coverage for both unenv stub and native workerd implementations

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: internal experimental feature, follows existing patterns

Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 21, 2026

🦋 Changeset detected

Latest commit: 8929085

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

@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 21, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 8929085

@petebacondarwin petebacondarwin force-pushed the devin/1768991072-native-node-tty branch from a6ede63 to be6cbec Compare January 21, 2026 13:58
@petebacondarwin petebacondarwin force-pushed the devin/1768991072-native-node-tty branch from be6cbec to 34c9f65 Compare February 11, 2026 11:47
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Feb 11, 2026

Claude finished @petebacondarwin's task —— View job


Changeset Review

Reviewing changeset files for this PR...

Todo List:

  • Read changeset guidelines
  • Review .changeset/native-node-tty.md
  • Check images for cute animals
  • Validate changeset against criteria
  • Post findings

All changesets look good

The changeset .changeset/native-node-tty.md passes validation:

  1. Version Type: Minor is appropriate for adding a new experimental feature
  2. Changelog Quality: Clear description with explicit note about experimental nature and required flags
  3. Markdown Headers: No h1/h2/h3 headers present
  4. Analytics: Not applicable - no analytics changes
  5. Experimental features: Properly notes this is experimental and lists the required compatibility flags (nodejs_compat, experimental, and enable_nodejs_tty_module)

The changeset correctly describes adding support for the native node:tty module and clearly explains the opt-in requirements for users.


@petebacondarwin petebacondarwin force-pushed the devin/1768991072-native-node-tty branch from 34c9f65 to 56c9dc1 Compare February 12, 2026 15:13
@petebacondarwin
Copy link
Copy Markdown
Contributor Author

Blocked on cloudflare/workerd#6064

@petebacondarwin petebacondarwin added blocked Blocked on other work unenv labels Feb 12, 2026
@petebacondarwin petebacondarwin force-pushed the devin/1768991072-native-node-tty branch from 2163339 to b231f63 Compare February 12, 2026 17:03
@vicb
Copy link
Copy Markdown
Contributor

vicb commented Feb 13, 2026

Pete, could you please bump the workerd peer dependency on the preset to at least

image

I think you add another recent update to workerd needed for unenv, maybe this should also be done in another PR if not merged yet?

@petebacondarwin petebacondarwin force-pushed the devin/1768991072-native-node-tty branch from b231f63 to 471c2bf Compare February 13, 2026 10:41
@petebacondarwin petebacondarwin marked this pull request as ready for review February 13, 2026 10:41
@petebacondarwin petebacondarwin requested a review from a team as a code owner February 13, 2026 10:41
@petebacondarwin petebacondarwin removed the blocked Blocked on other work label Feb 13, 2026
@petebacondarwin
Copy link
Copy Markdown
Contributor Author

petebacondarwin commented Feb 13, 2026

The workerd fix has landed cloudflare/workerd#6064 and this PR is now unblocked and the minimum peer dependency has been bumped. See v1.20260213.0
I think we may need to wait for the fix to get into production before actually merging this.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment thread packages/wrangler/e2e/unenv-preset/worker/index.ts
Copy link
Copy Markdown
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.

LGTM, thanks Pete!

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Feb 13, 2026
@petebacondarwin petebacondarwin merged commit 7f18183 into main Feb 13, 2026
41 checks passed
@petebacondarwin petebacondarwin deleted the devin/1768991072-native-node-tty branch February 13, 2026 14:25
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Feb 13, 2026
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.

3 participants