Skip to content

Commit

Permalink
fix(vscode): ensure clientPort is forwarded properly
Browse files Browse the repository at this point in the history
  • Loading branch information
fwouts committed Dec 2, 2023
1 parent c991cb4 commit 1329475
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion loader/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const validLogLevels = new Set<unknown>(["debug", "info", "error", "silent"]);

export type ServerWorker = {
port: number;
clientPort?: number;
request: <Request extends WorkerRequest>(
request: Request
) => Promise<WorkerResponseType<Request>>;
Expand Down Expand Up @@ -260,6 +261,7 @@ export async function load({
rootDir,
frameworkPluginName,
port: worker.port,
clientPort: worker.clientPort,
});
},
};
Expand All @@ -275,7 +277,7 @@ export async function load({
fsReader.listeners.add(nodeModulesChangeListener);
const workerDelegatingWorkspace: Workspace = {
...workspace,
startServer: async ({ port, onStop } = {}) => {
startServer: async ({ port, clientPort, onStop } = {}) => {
const worker = await ensureWorkerRunning({
logger,
logLevel,
Expand All @@ -284,6 +286,7 @@ export async function load({
rootDir,
frameworkPluginName,
port,
clientPort,
});
if (onStop) {
worker.onStop.push(onStop);
Expand Down Expand Up @@ -321,6 +324,7 @@ export async function load({
rootDir: string;
frameworkPluginName: string;
port?: number;
clientPort?: number;
}): ResolvablePromise<ServerWorker> {
const {
logger,
Expand All @@ -330,6 +334,7 @@ export async function load({
rootDir,
frameworkPluginName,
port,
clientPort,
} = options;
const existingWorker = serverWorkers[rootDir];
if (existingWorker) {
Expand Down Expand Up @@ -392,6 +397,7 @@ export async function load({
inMemorySnapshot: memoryReader.snapshot(),
frameworkPluginName,
port,
clientPort,
onServerStartModuleName,
},
});
Expand Down Expand Up @@ -465,6 +471,7 @@ export async function load({
workerReadyPromise.then(
({ port }): ServerWorker => ({
port,
clientPort,
request,
kill: killWorker,
waitUntilExited: workerExitedPromise,
Expand Down

0 comments on commit 1329475

Please sign in to comment.