{"name":"react-devtools-core","version":"7.0.1","license":"MIT","_id":"react-devtools-core@7.0.1","maintainers":[{"name":"sebmarkbage","email":"sebastian@calyptus.eu"},{"name":"gaearon","email":"dan.abramov@gmail.com"},{"name":"acdlite","email":"npm@andrewclark.io"},{"name":"brianvaughn","email":"briandavidvaughn@gmail.com"},{"name":"ryancat","email":"xryanchen@gmail.com"},{"name":"jstejada","email":"juans.tejada@gmail.com"},{"name":"xiaobu","email":"yaotianyu0512@gmail.com"},{"name":"mondaychen","email":"monday.chen@gmail.com"},{"name":"sophiebits","email":"npm@sophiebits.com"},{"name":"lunaruan","email":"lunaris.ruan@gmail.com"},{"name":"hoxyq","email":"rdlesyutin@gmail.com"}],"homepage":"https://github.com/facebook/react#readme","bugs":{"url":"https://github.com/facebook/react/issues"},"dist":{"shasum":"9bc83ac5317b34d0445f765eb17279d62a23f6ee","tarball":"http://registry-npm.ywwl.com/react-devtools-core/download/react-devtools-core-7.0.1.tgz","fileCount":14,"integrity":"sha512-C3yNvRHaizlpiASzy7b9vbnBGLrhvdhl1CbdU6EnZgxPNbai60szdLtl+VL76UNOt5bOoVTOz5rNWZxgGt+Gsw==","signatures":[{"sig":"MEUCIQDsLvQSTVEI+PNsKmLqXyVjFrMg9tmcGj0UVM+hwAn9wAIgW7o98tjJxSqhThQ8/+ACqUvMsQLmZeOi3061q/acyuQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15877053,"size":3752748,"noattachment":false,"key":"/react-devtools-core/-/react-devtools-core-7.0.1.tgz"},"main":"./dist/backend.js","gitHead":"3cde211b0cb1c707114c27d7fd23683d02086e31","scripts":{"build":"yarn build:backend && yarn build:standalone","prepublish":"yarn run build","build:backend":"cross-env NODE_ENV=production webpack --config webpack.backend.js","start:backend":"cross-env NODE_ENV=development webpack --config webpack.backend.js --watch","build:backend:fb":"cross-env NODE_ENV=production FEATURE_FLAG_TARGET=core/backend-fb webpack --config webpack.backend.js","build:standalone":"cross-env NODE_ENV=production webpack --config webpack.standalone.js","start:standalone":"cross-env NODE_ENV=development webpack --config webpack.standalone.js --watch","build:standalone:fb":"cross-env NODE_ENV=production FEATURE_FLAG_TARGET=core/standalone-fb webpack --config webpack.standalone.js"},"_npmUser":{"name":"hoxyq","email":"rdlesyutin@gmail.com"},"repository":{"url":"git+https://github.com/facebook/react.git","type":"git","directory":"packages/react-devtools-core"},"_npmVersion":"10.9.3","description":"Use react-devtools outside of the browser","directories":{},"_nodeVersion":"22.20.0","dependencies":{"ws":"^7","shell-quote":"^1.6.1"},"_hasShrinkwrap":false,"devDependencies":{"process":"0.11.10","webpack":"^5.82.1","cross-env":"^3.1.4","webpack-cli":"^5.1.1","workerize-loader":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/react-devtools-core_7.0.1_1760983578269_0.0774617672490685","host":"s3://npm-registry-packages-npm-production"},"readme":"# `react-devtools-core`\n\nThis package provides low-level APIs to support renderers like [React Native](https://github.com/facebook/react-native). If you're looking for the standalone React DevTools UI, **we suggest using [`react-devtools`](https://github.com/facebook/react/tree/main/packages/react-devtools) instead of using this package directly**.\n\nThis package provides two entrypoints: labeled \"backend\" and \"standalone\" (frontend). Both APIs are described below.\n\n# Backend API\n\nBackend APIs are embedded in _development_ builds of renderers like [React Native](https://github.com/facebook/react-native) in order to connect to the React DevTools UI.\n\n### Example\n\nIf you are building a non-browser-based React renderer, you can use the backend API like so:\n\n```js\nif (process.env.NODE_ENV !== 'production') {\n  const { initialize, connectToDevTools } = require(\"react-devtools-core\");\n\n  initialize(settings);\n  // Must be called before packages like react or react-native are imported\n  connectToDevTools({...config});\n}\n```\n\n> **NOTE** that this API (`connectToDevTools`) must be (1) run in the same context as React and (2) must be called before React packages are imported (e.g. `react`, `react-dom`, `react-native`).\n\n### `initialize` arguments\n| Argument                  | Description |\n|---------------------------|-------------|\n| `settings`                | Optional. If not specified, or received as null, then default settings are used. Can be plain object or a Promise that resolves with the [plain settings object](#Settings). If Promise rejects, the console will not be patched and some console features from React DevTools will not work. |\n| `shouldStartProfilingNow` | Optional. Whether to start profiling immediately after installing the hook. Defaults to `false`. |\n| `profilingSettings`       | Optional. Profiling settings used when `shouldStartProfilingNow` is `true`. Defaults to `{ recordChangeDescriptions: false }`. |\n| `componentFilters`        | Optional. Array or Promise that resolves to an array of component filters to apply before DevTools connects. Defaults to the built-in host component filter. See [Component filters](#component-filters) for the full spec. |\n\n#### `Settings`\n| Spec                                                                                                                                                                           | Default value                                                                                                                                                        |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| <pre>{<br>  appendComponentStack: boolean,<br>  breakOnConsoleErrors: boolean,<br>  showInlineWarningsAndErrors: boolean,<br>  hideConsoleLogsInStrictMode: boolean,<br>  disableSecondConsoleLogDimmingInStrictMode: boolean<br>}</pre> | <pre>{<br>  appendComponentStack: true,<br>  breakOnConsoleErrors: false,<br>  showInlineWarningsAndErrors: true,<br>  hideConsoleLogsInStrictMode: false,<br>  disableSecondConsoleLogDimmingInStrictMode: false<br>}</pre> |\n\n#### Component filters\nEach filter object must include `type` and `isEnabled`. Some filters also require `value` or `isValid`.\n\n| Type | Required fields | Description |\n|------|-----------------|-------------|\n| `ComponentFilterElementType` (`1`) | `type`, `isEnabled`, `value: ElementType` | Hides elements of the given element type. DevTools defaults to hiding host components. |\n| `ComponentFilterDisplayName` (`2`) | `type`, `isEnabled`, `isValid`, `value: string` | Hides components whose display name matches the provided RegExp string. |\n| `ComponentFilterLocation` (`3`) | `type`, `isEnabled`, `isValid`, `value: string` | Hides components whose source location matches the provided RegExp string. |\n| `ComponentFilterHOC` (`4`) | `type`, `isEnabled`, `isValid` | Hides higher-order components. |\n| `ComponentFilterEnvironmentName` (`5`) | `type`, `isEnabled`, `isValid`, `value: string` | Hides components whose environment name matches the provided string. |\n| `ComponentFilterActivitySlice` (`6`) | `type`, `isEnabled`, `isValid`, `activityID`, `rendererID` | Filters activity slices; usually managed by DevTools rather than user code. |\n\n### `connectToDevTools` options\n| Prop                   | Default       | Description                                                                                                               |\n|------------------------|---------------|---------------------------------------------------------------------------------------------------------------------------|\n| `host`                 | `\"localhost\"` | Socket connection to frontend should use this host.                                                                       |\n| `isAppActive`          |               | (Optional) function that returns true/false, telling DevTools when it's ready to connect to React.                        |\n| `path`                 | `\"\"`          | Path appended to the WebSocket URI (e.g. `\"/__react_devtools__/\"`). Useful when proxying through a reverse proxy on a subpath. A leading `/` is added automatically if missing. |\n| `port`                 | `8097`        | Socket connection to frontend should use this port.                                                                       |\n| `resolveRNStyle`       |               | (Optional) function that accepts a key (number) and returns a style (object); used by React Native.                       |\n| `retryConnectionDelay` | `200`         | Delay (ms) to wait between retrying a failed Websocket connection                                                         |\n| `useHttps`             | `false`       | Socket connection to frontend should use secure protocol (wss).                                                           |\n| `websocket`            |               | Custom `WebSocket` connection to frontend; overrides `host` and `port` settings.                                          |\n| `onSettingsUpdated`    |               | A callback that will be called when the user updates the settings in the UI. You can use it for persisting user settings. |                                                                                         |\n\n\n### `connectWithCustomMessagingProtocol` options\n| Prop                | Description                                                                                                                                                    |\n|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `onSubscribe`       | Function, which receives listener (function, with a single argument) as an argument. Called when backend subscribes to messages from the other end (frontend). |\n| `onUnsubscribe`     | Function, which receives listener (function) as an argument. Called when backend unsubscribes to messages from the other end (frontend).                       |\n| `onMessage`         | Function, which receives 2 arguments: event (string) and payload (any). Called when backend emits a message, which should be sent to the frontend.             |\n| `onSettingsUpdated` | A callback that will be called when the user updates the settings in the UI. You can use it for persisting user settings.                                      |\n\nUnlike `connectToDevTools`, `connectWithCustomMessagingProtocol` returns a callback, which can be used for unsubscribing the backend from the global DevTools hook.\n\n# Frontend API\n\nFrontend APIs can be used to render the DevTools UI into a DOM node. One example of this is [`react-devtools`](https://github.com/facebook/react/tree/main/packages/react-devtools) which wraps DevTools in an Electron app.\n\n### Example\n```js\nimport DevtoolsUI from \"react-devtools-core/standalone\";\n\n// See the full list of API methods in documentation below.\nconst { setContentDOMNode, startServer } = DevtoolsUI;\n\n// Render DevTools UI into a DOM element.\nsetContentDOMNode(document.getElementById(\"container\"));\n\n// Start socket server used to communicate between backend and frontend.\nstartServer(\n  // Port defaults to 8097\n  1234,\n\n  // Host defaults to \"localhost\"\n  \"example.devserver.com\",\n\n  // Optional config for secure socket (WSS).\n  {\n    key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),\n    cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')\n  }\n);\n```\n\n### Exported methods\nThe `default` export is an object defining the methods described below.\n\nThese methods support chaining for convenience. For example:\n```js\nconst DevtoolsUI = require(\"react-devtools-core/standalone\");\nDevtoolsUI.setContentDOMNode(element).startServer();\n```\n\n#### `connectToSocket(socket: WebSocket)`\n> This is an advanced config function that is typically not used.\n\nCustom `WebSocket` connection to use for communication between DevTools frontend and backend. Calling this method automatically initializes the DevTools UI (similar to calling `startServer()`).\n\n#### `openProfiler()`\nAutomatically select the \"Profiler\" tab in the DevTools UI.\n\n#### `setContentDOMNode(element: HTMLElement)`\nSet the DOM element DevTools UI should be rendered into on initialization.\n\n#### `setDisconnectedCallback(callback: Function)`\n_Optional_ callback to be notified when DevTools `WebSocket` closes (or errors).\n\n#### `setProjectRoots(roots: Array<string>)`\n_Optional_ set of root directories for source files. These roots can be used to open an inspected component's source code using an IDE.\n\n#### `setStatusListener(callback: Function)`\n_Optional_ callback to be notified of socket server events (e.g. initialized, errored, connected).\n\nThis callback receives two parameters:\n```js\nfunction onStatus(\n  message: string,\n  status: 'server-connected' | 'devtools-connected' | 'error'\n): void {\n  // ...\n}\n```\n\n#### `startServer(port?, host?, httpsOptions?, loggerOptions?, path?, clientOptions?)`\nStart a socket server (used to communicate between backend and frontend) and renders the DevTools UI.\n\nThis method accepts the following parameters:\n| Name | Default | Description |\n|---|---|---|\n| `port` | `8097` | Port the local server listens on. |\n| `host` | `\"localhost\"` | Host the local server binds to. |\n| `httpsOptions` | | _Optional_ object defining `key` and `cert` strings. |\n| `loggerOptions` | | _Optional_ object defining a `surface` string (to be included with DevTools logging events). |\n| `path` | | _Optional_ path to append to the WebSocket URI served to connecting clients (e.g. `\"/__react_devtools__/\"`). Also set via the `REACT_DEVTOOLS_PATH` env var in the Electron app. |\n| `clientOptions` | | _Optional_ object with client-facing overrides (see below). |\n\n##### `clientOptions`\n\nWhen connecting through a reverse proxy, the client may need to connect to a different host, port, or protocol than the local server. Use `clientOptions` to override what appears in the `connectToDevTools()` script served to clients. Any field not set falls back to the corresponding server value.\n\n| Field | Default | Description |\n|---|---|---|\n| `host` | server `host` | Host the client connects to. |\n| `port` | server `port` | Port the client connects to. |\n| `useHttps` | server `useHttps` | Whether the client should use `wss://`. |\n\nThese can also be set via environment variables in the Electron app:\n\n| Env Var | Description |\n|---|---|\n| `REACT_DEVTOOLS_CLIENT_HOST` | Overrides the host in the served client script. |\n| `REACT_DEVTOOLS_CLIENT_PORT` | Overrides the port in the served client script. |\n| `REACT_DEVTOOLS_CLIENT_USE_HTTPS` | Set to `\"true\"` to make the served client script use `wss://`. |\n\n##### Reverse proxy example\n\nRun DevTools locally on the default port, but tell clients to connect through a remote proxy:\n```sh\nREACT_DEVTOOLS_CLIENT_HOST=remote.example.com \\\nREACT_DEVTOOLS_CLIENT_PORT=443 \\\nREACT_DEVTOOLS_CLIENT_USE_HTTPS=true \\\nREACT_DEVTOOLS_PATH=/__react_devtools__/ \\\nreact-devtools\n```\nThe server listens on `localhost:8097`. The served script tells clients:\n```js\nconnectToDevTools({host: 'remote.example.com', port: 443, useHttps: true, path: '/__react_devtools__/'})\n```\n\n# Development\n\nWatch for changes made to the backend entry point and rebuild:\n```sh\nyarn start:backend\n```\n\nWatch for changes made to the standalone UI entry point and rebuild:\n```sh\nyarn start:standalone\n```\n\nRun the standalone UI using `yarn start` in the [`react-devtools`](https://github.com/facebook/react/tree/main/packages/react-devtools).\n","publish_time":1760983578580,"_cnpm_publish_time":1760983578580,"dist-tags":{"alpha":"3.5.0-alpha.0","latest":"8.0.0","next":"4.0.6","old":"4.10.4"}}