Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 25, 2024
1 parent 37e7b5a commit db9a9ae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
12 changes: 1 addition & 11 deletions examples/child-process/src/lib/vite/bridge-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ import { ESModulesEvaluator, ModuleRunner } from "vite/module-runner";
import type { BridgeClientOptions } from "./types";

export function createBridgeClient(options: BridgeClientOptions) {
async function rpc(method: string, ...args: any[]): Promise<any> {
const response = await fetch(options.bridgeUrl + "/rpc", {
method: "POST",
body: JSON.stringify({ method, args, key: options.key }),
});
assert(response.ok);
const result = await response.json();
return result;
}

let sseClient: Awaited<ReturnType<typeof createSSEClient>>;

const runner = new ModuleRunner(
Expand Down Expand Up @@ -55,7 +45,7 @@ export function createBridgeClient(options: BridgeClientOptions) {
}
}

return { runner, rpc, handler };
return { runner, handler };
}

async function createSSEClient(
Expand Down
1 change: 1 addition & 0 deletions examples/child-process/src/lib/vite/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ function createHMRChannelSSEHandler() {
return { channel, handler };
}

// wrapper to simplify listener management
function createListenerManager(): Pick<HotChannel, "on" | "off"> & {
handle: (
payload: HotPayload,
Expand Down
2 changes: 1 addition & 1 deletion examples/child-process/src/lib/vite/runtime/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Writable } from "node:stream";
import { webToNodeHandler } from "@hiogawa/utils-node";
import { createBridgeClient } from "../bridge-client.ts";

function main() {
async function main() {
// @ts-ignore
const options = JSON.parse(process.argv[2]);
const bridgeClient = createBridgeClient(options);
Expand Down

0 comments on commit db9a9ae

Please sign in to comment.