Skip to content

feat(unenv-preset): add support for native node:inspector module#11733

Merged
petebacondarwin merged 2 commits intomainfrom
devin/1766388436-inspector-native-module
Dec 22, 2025
Merged

feat(unenv-preset): add support for native node:inspector module#11733
petebacondarwin merged 2 commits intomainfrom
devin/1766388436-inspector-native-module

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin commented Dec 22, 2025

Similar to #10621 (native vm module support), this PR adds support for the native node:inspector module when the enable_nodejs_inspector_module compatibility flag is enabled.

Since inspector is marked as $experimental in workerd with no $impliedByAfterDate, this feature requires both the enable_nodejs_inspector_module and experimental compatibility flags to be set.

Implementation Comparison

Implementations are at:

The three inspector implementations differ as follows:

Node.js (full implementation): Complete inspector support with native bindings, functional Session class for connecting to the V8 inspector, and Network APIs for broadcasting protocol events.

workerd (non-functional stub): Exports the expected API surface (Session, close, open, url, waitForDebugger, console, Network). Basic functions like close(), open(), url(), and waitForDebugger() are no-ops. The Session constructor and methods throw ERR_METHOD_NOT_IMPLEMENTED. Network methods also throw.

unenv (polyfill stub): Similar pattern to workerd - basic functions are no-ops, while Session and Network methods throw via notImplemented().

Since both workerd and unenv throw for Session and Network methods, there is no breaking change concern when switching to the native module.

Updates since last revision

  • Added explicit check for experimental compatibility flag in getInspectorOverrides() to ensure the native module is only enabled when both enable_nodejs_inspector_module AND experimental flags are present (consistent with other experimental modules like wasi and dgram)

Human Review Checklist

  • Verify flag names match workerd's compatibility-date.capnp
  • Verify pattern matches other experimental modules (wasi)
  • Tests include experimental flag as required
  • Confirm tests only validate API surface (not actual inspector functionality, since workerd's inspector is a stub)
  • Verify enabledByFlag checks for both module flag AND experimental flag

Devin PR requested by pbacondarwin@cloudflare.com (@petebacondarwin)
Link to Devin run: https://app.devin.ai/sessions/b61a9f009eec4b03850a418e63f16687


  • Tests
    • Tests included/updated
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: inspector is already documented as partially supported in the Workers docs

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
@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. Add '(aside)' to your comment to have me ignore it.
  • 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

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Dec 22, 2025

🦋 Changeset detected

Latest commit: 95e184b

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

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Dec 22, 2025

Claude finished @petebacondarwin's task —— View job


Changeset Review

✅ All changesets look good

The changeset .changeset/native-inspector-module.md passes all validation criteria:

  • Version Type: ✅ Correctly uses minor for a new feature (native node:inspector module support)
  • Changelog Quality: ✅ Includes clear description with usage examples showing how to enable and use the feature
  • Markdown Headers: ✅ No h1/h2/h3 headers present (uses code blocks only)
  • Format: ✅ Follows the recommended format with imperative title and explanatory body
  • Experimental Feature Callout: ✅ Explicitly mentions this is experimental and requires specific flags

The changeset appropriately documents that this is an experimental feature requiring both enable_nodejs_inspector_module and experimental compatibility flags, with clear configuration and usage examples.


@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Dec 22, 2025

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 95e184b

@petebacondarwin petebacondarwin marked this pull request as ready for review December 22, 2025 08:11
@petebacondarwin petebacondarwin requested a review from a team as a code owner December 22, 2025 08:11
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Dec 22, 2025
@petebacondarwin petebacondarwin merged commit 62fd118 into main Dec 22, 2025
36 checks passed
@petebacondarwin petebacondarwin deleted the devin/1766388436-inspector-native-module branch December 22, 2025 13:40
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants