From 3ad6263c6123aeae38564c7a6fcd9d6072b1d2e7 Mon Sep 17 00:00:00 2001 From: Nikola Hristov Date: Sat, 30 Sep 2023 13:17:33 +0300 Subject: [PATCH] squash! --- Source/Function/Worker.ts | 7 ++++--- Target/Function/Worker.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Function/Worker.ts b/Source/Function/Worker.ts index efb86233..1d9bb7bb 100644 --- a/Source/Function/Worker.ts +++ b/Source/Function/Worker.ts @@ -7,10 +7,11 @@ export default >{ const url = new URL(request.url); if (url.pathname.startsWith("/functions/")) { - // const File = await import(url.pathname); - // console.log(process.cwd()); + const File = await import(url.pathname); - // console.log((await import("fs")).readFile(url.pathname)); + console.log(process.cwd()); + + console.log(await (await import("fs/promises")).readFile(File)); return new Response(url.pathname, { headers: { "Content-Type": "text/html" }, diff --git a/Target/Function/Worker.js b/Target/Function/Worker.js index bbef1452..aa1d1af6 100644 --- a/Target/Function/Worker.js +++ b/Target/Function/Worker.js @@ -1 +1 @@ -var r={fetch:async(e,t)=>{const n=new URL(e.url);return n.pathname.startsWith("/functions/")?new Response(n.pathname,{headers:{"Content-Type":"text/html"}}):t.ASSETS.fetch(e)}};export{r as default}; +var o={fetch:async(t,n)=>{const e=new URL(t.url);if(e.pathname.startsWith("/functions/")){const a=await import(e.pathname);return console.log(process.cwd()),console.log((await import("fs")).readFile(e.pathname)),new Response(e.pathname,{headers:{"Content-Type":"text/html"}})}return n.ASSETS.fetch(t)}};export{o as default};