Class for spawning new compiler workers for each requested platform and forwarding requests to respective platform-specific DevServer.
The overall architecture is:
Each worker is lazy, meaning it will be spawned upon receiving first request from which
platform
can be inferred. This would usually be a request
for bundle eg: index.bundle?platform=ios&...
.
↳ DevServerProxy
• new DevServerProxy(config
, cliOptions
)
Constructs new DevServerProxy
.
Name | Type | Description |
---|---|---|
config |
DevServerProxyConfig |
Configuration options. |
cliOptions |
CliOptions |
CLI options (usually provided by start command based on arguments from React Native CLI.) |
packages/repack/src/server/DevServerProxy.ts:100
• Protected
config: BaseDevServerConfig
Configuration options.
packages/repack/src/server/BaseDevServer.ts:35
• fastify: FastifyDevServer
Fastify instance.
packages/repack/src/server/BaseDevServer.ts:38
• reporter: Reporter
Reporter instance.
packages/repack/src/server/DevServerProxy.ts:88
• workers: Record
<string
, undefined
| Promise
<CompilerWorker
>> = {}
Platform to worker mappings.
packages/repack/src/server/DevServerProxy.ts:83
• wsClientServer: WebSocketDevClientServer
Server instance for React Native clients.
packages/repack/src/server/BaseDevServer.ts:48
• wsDashboardServer: WebSocketDashboardServer
packages/repack/src/server/DevServerProxy.ts:84
• wsDebuggerServer: WebSocketDebuggerServer
Debugger server instance.
BaseDevServer.wsDebuggerServer
packages/repack/src/server/BaseDevServer.ts:42
• wsEventsServer: WebSocketEventsServer
Events server instance.
packages/repack/src/server/BaseDevServer.ts:46
• wsMessageServer: WebSocketMessageServer
Message server instance.
packages/repack/src/server/BaseDevServer.ts:44
• wsRouter: WebSocketRouter
WebSocket router instance.
packages/repack/src/server/BaseDevServer.ts:40
▸ forwardRequest(platform
, request
, reply
, multipartRes?
): Promise
<void
>
Forward request to a DevServer running inside compiler worker for the platform
.
Name | Type | Description |
---|---|---|
platform |
string |
Application platform. |
request |
DevServerRequest |
Request instance to forward. |
reply |
DevServerReply |
Reply instance to send received data through. |
multipartRes? |
MultipartResponse |
- |
Promise
<void
>
packages/repack/src/server/DevServerProxy.ts:217
▸ run(): Promise
<void
>
Runs the proxy.
Promise
<void
>
packages/repack/src/server/DevServerProxy.ts:406
▸ runWorker(platform
): Promise
<void
>
Spawn new compiler worker for given platform
.
If the worker is already running, a warning is emitted and the method stops it's execution.
The port on which DevServer inside worker will be running is random, so no assumptions
should be taken regarding the port number.
Name | Type | Description |
---|---|---|
platform |
string |
Application platform for which to spawn new worker. |
Promise
<void
>
packages/repack/src/server/DevServerProxy.ts:115
▸ setup(): Promise
<void
>
Sets up routes.
Promise
<void
>