feat(unenv-preset): add support for native node:inspector module#11733
feat(unenv-preset): add support for native node:inspector module#11733petebacondarwin merged 2 commits intomainfrom
Conversation
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🦋 Changeset detectedLatest 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 finished @petebacondarwin's task —— View job Changeset Review✅ All changesets look good The changeset
The changeset appropriately documents that this is an experimental feature requiring both |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
Similar to #10621 (native vm module support), this PR adds support for the native
node:inspectormodule when theenable_nodejs_inspector_modulecompatibility flag is enabled.Since inspector is marked as
$experimentalin workerd with no$impliedByAfterDate, this feature requires both theenable_nodejs_inspector_moduleandexperimentalcompatibility 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
Sessionclass for connecting to the V8 inspector, andNetworkAPIs for broadcasting protocol events.workerd (non-functional stub): Exports the expected API surface (
Session,close,open,url,waitForDebugger,console,Network). Basic functions likeclose(),open(),url(), andwaitForDebugger()are no-ops. TheSessionconstructor and methods throwERR_METHOD_NOT_IMPLEMENTED.Networkmethods also throw.unenv (polyfill stub): Similar pattern to workerd - basic functions are no-ops, while
SessionandNetworkmethods throw vianotImplemented().Since both workerd and unenv throw for
SessionandNetworkmethods, there is no breaking change concern when switching to the native module.Updates since last revision
experimentalcompatibility flag ingetInspectorOverrides()to ensure the native module is only enabled when bothenable_nodejs_inspector_moduleANDexperimentalflags are present (consistent with other experimental modules like wasi and dgram)Human Review Checklist
experimentalflag as requiredenabledByFlagchecks for both module flag ANDexperimentalflagDevin PR requested by pbacondarwin@cloudflare.com (@petebacondarwin)
Link to Devin run: https://app.devin.ai/sessions/b61a9f009eec4b03850a418e63f16687