Skip to content

Commit

Permalink
chore: no no magical proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Apr 14, 2024
1 parent c5ceae5 commit fb8de5d
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions packages/workerd/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,37 +203,6 @@ export async function createWorkerdDevEnvironment(
tinyassert(res.ok);
return (await res.json()) as any;
},

// not-so-magical proxy
// - proxy only shallow exports using above `eval`
// - all async call
async importProxy(entry: string): Promise<any> {
return new Proxy(
{},
{
get(_target, exportName, _receiver) {
return new Proxy(() => {}, {
get(_target, prop, _receiver) {
return api.eval(
entry,
(ctx) => ctx.exports[ctx.args[0]][ctx.args[1]],
exportName,
prop,
);
},
apply(_target, _thisArg, argArray) {
return api.eval(
entry,
(ctx) => ctx.exports[ctx.args[0]](...ctx.args[1]),
exportName,
argArray,
);
},
});
},
},
);
},
};

// workaround for tsup dts?
Expand Down

0 comments on commit fb8de5d

Please sign in to comment.