Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remote module runner proxy #22

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
wip: more brainstorm
hi-ogawa committed Apr 14, 2024
commit 80a0c5587157b687c72eb7a8d02ef4b4ee854ebe
22 changes: 19 additions & 3 deletions packages/remote-runner/src/client.ts
Original file line number Diff line number Diff line change
@@ -10,9 +10,13 @@
// function

// const client = new ProxyClient({ post });
// const proxy = client.getRootProxy();
// (await (await proxy.runner).import)
// const mod = await proxy.runner.import("/src/entry");
// const runnerProxy = client.getRootProxy();
// const mod = await (await runnerProxy.import)("/src/entry");
// const res = await (await mod.default)(req);

// [with sync getter]
// const runnerProxy = client.getRootProxy();
// const mod = await runnerProxy.import("/src/entry");
// const res = await mod.default(req);

// const server = new ProxyServer({ on, root: { runner } });
@@ -58,3 +62,15 @@ export class ProxyClient {
});
}
}

// puppeteer/playwright style "handle" + "eval" system?
// https://playwright.dev/docs/evaluating

// const runner = createRemoteRunner();
// const modHandle = await runner.import("/some-entry.ts");
// const result = await runner.eval((mod) => mod.default("hello"), [modHandle]);

// const result = await runner.import("/some-entry.ts", (mod, args) => mod.default(...args), ["hello"]);

// const result = await remoteRunner.$eval("/some-module.ts", (mod, args) => ..., ["hello"]);
// const moduleHandle = remoteRunner.