{"name":"@react-native/dev-middleware","version":"0.75.0-nightly-20240615-2f8d4f0c2","description":"Dev server middleware for React Native","keywords":["react-native","tools"],"homepage":"https://github.com/facebook/react-native/tree/HEAD/packages/dev-middleware#readme","bugs":{"url":"https://github.com/facebook/react-native/issues"},"repository":{"type":"git","url":"git+https://github.com/facebook/react-native.git","directory":"packages/dev-middleware"},"license":"MIT","exports":{".":"./dist/index.js","./package.json":"./package.json"},"dependencies":{"@isaacs/ttlcache":"^1.4.1","@react-native/debugger-frontend":"0.75.0-nightly-20240615-2f8d4f0c2","chrome-launcher":"^0.15.2","chromium-edge-launcher":"^0.2.0","connect":"^3.6.5","debug":"^2.2.0","node-fetch":"^2.2.0","nullthrows":"^1.1.1","open":"^7.0.3","selfsigned":"^2.4.1","serve-static":"^1.13.1","ws":"^6.2.2"},"engines":{"node":">=18"},"devDependencies":{"data-uri-to-buffer":"^6.0.1","undici":"^5.27.2","wait-for-expect":"^3.0.2"},"_id":"@react-native/dev-middleware@0.75.0-nightly-20240615-2f8d4f0c2","readme":"# @react-native/dev-middleware\n\n![npm package](https://img.shields.io/npm/v/@react-native/dev-middleware?color=brightgreen&label=npm%20package)\n\nDev server middleware supporting core React Native development features. This package is preconfigured in all React Native projects.\n\n## Usage\n\nMiddleware can be attached to a dev server (e.g. [Metro](https://facebook.github.io/metro/docs/getting-started)) using the `createDevMiddleware` API.\n\n```js\nimport { createDevMiddleware } from '@react-native/dev-middleware';\n\nfunction myDevServerImpl(args) {\n  ...\n\n  const {middleware, websocketEndpoints} = createDevMiddleware({\n    projectRoot: metroConfig.projectRoot,\n    serverBaseUrl: `http://${args.host}:${args.port}`,\n    logger,\n  });\n\n  await Metro.runServer(metroConfig, {\n    host: args.host,\n    ...,\n    unstable_extraMiddleware: [\n      middleware,\n      // Optionally extend with additional HTTP middleware\n    ],\n    websocketEndpoints: {\n      ...websocketEndpoints,\n      // Optionally extend with additional WebSocket endpoints\n    },\n  });\n}\n```\n\n## Included middleware\n\n`@react-native/dev-middleware` is designed for integrators such as [`@expo/dev-server`](https://www.npmjs.com/package/@expo/dev-server) and [`@react-native/community-cli-plugin`](https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin). It provides a common default implementation for core React Native dev server responsibilities.\n\nWe intend to keep this to a narrow set of functionality, based around:\n\n- **Debugging** — The [Chrome DevTools protocol (CDP)](https://chromedevtools.github.io/devtools-protocol/) endpoints supported by React Native, including the Inspector Proxy, which facilitates connections with multiple devices.\n- **Dev actions** — Endpoints implementing core [Dev Menu](https://reactnative.dev/docs/debugging#accessing-the-dev-menu) actions, e.g. reloading the app, opening the debugger frontend.\n\n### HTTP endpoints\n\n<small>`DevMiddlewareAPI.middleware`</small>\n\nThese are exposed as a [`connect`](https://www.npmjs.com/package/connect) middleware handler, assignable to `Metro.runServer` or other compatible HTTP servers.\n\n#### GET `/json/list`, `/json` ([CDP](https://chromedevtools.github.io/devtools-protocol/#endpoints))\n\nReturns the list of available WebSocket targets for all connected React Native app sessions.\n\n#### GET `/json/version` ([CDP](https://chromedevtools.github.io/devtools-protocol/#endpoints))\n\nReturns version metadata used by Chrome DevTools.\n\n#### GET `/debugger-frontend`\n\nSubpaths of this endpoint are reserved to serve the JavaScript debugger frontend.\n\n#### POST `/open-debugger`\n\nOpen the JavaScript debugger for a given CDP target (direct Hermes debugging).\n\n<details>\n<summary>Example</summary>\n\n    curl -X POST 'http://localhost:8081/open-debugger?appId=com.meta.RNTester'\n</details>\n\n### WebSocket endpoints\n\n<small>`DevMiddlewareAPI.websocketEndpoints`</small>\n\n#### `/inspector/device`\n\nWebSocket handler for registering device connections.\n\n#### `/inspector/debug`\n\nWebSocket handler that proxies CDP messages to/from the corresponding device.\n\n## Contributing\n\nChanges to this package can be made locally and tested against the `rn-tester` app, per the [Contributing guide](https://reactnative.dev/contributing/overview#contributing-code). During development, this package is automatically run from source with no build step.\n","readmeFilename":"README.md","gitHead":"2f8d4f0c253853ec4f56cf01b41a1f73a393f804","_nodeVersion":"18.20.3","_npmVersion":"10.7.0","dist":{"integrity":"sha512-yuHN9Ii/ik4kCHPSTPHdafJXRpM7+QRu8VjIU6lMfM9tGkc+JAgR4KTXHu44qRNoQKf3ErUeeCSVdi9Z7ITqdQ==","shasum":"4d4a42c745137b1a5706ee5b52bb18c6eb517468","tarball":"http://registry-npm.ywwl.com/@react-native/dev-middleware/download/@react-native/dev-middleware-0.75.0-nightly-20240615-2f8d4f0c2.tgz","fileCount":53,"unpackedSize":113671,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC/dhIiiDtIUWA52NDbg0OU56o1LNf0nWxfu5/HjxrcYAIhAPs1D6IUGTkyUtjPnueZocLqqlQ7gih1NAzupij8cxHQ"}],"size":27987,"noattachment":false,"key":"/@react-native/dev-middleware/-/@react-native/dev-middleware-0.75.0-nightly-20240615-2f8d4f0c2.tgz"},"_npmUser":{"name":"react-native-bot","email":"opensource+react-native-bot@fb.com"},"directories":{},"maintainers":[{"name":"react-native-bot","email":"opensource+react-native-bot@fb.com"},{"name":"fb","email":"opensource+npm@fb.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dev-middleware_0.75.0-nightly-20240615-2f8d4f0c2_1718421413465_0.17546325340395152"},"_hasShrinkwrap":false,"publish_time":1718421413633,"_cnpm_publish_time":1718421413633,"dist-tags":{"0.74-stable":"0.74.89","0.75-stable":"0.75.5","0.76-stable":"0.76.9","0.77-stable":"0.77.3","0.78-stable":"0.78.3","0.79-stable":"0.79.7","0.80-stable":"0.80.3","0.81-stable":"0.81.6","0.83-stable":"0.83.10","0.86-stable":"0.86.3","false":"0.74.82","latest":"0.88.1","next":"0.89.0-rc.3","nightly":"0.90.0-nightly-20261127-7a2d1d257"}}