From a9139c6cd33d08f794eb019ecb4d69cf9ad01985 Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Wed, 21 Jun 2023 17:32:10 -0400 Subject: [PATCH] flatten --- _lib_/boot-browser.tsx => boot-browser.tsx | 0 _lib_/boot-server.tsx => boot-server.tsx | 4 ++-- deno.json | 2 +- example/deno.json | 2 +- _lib_/hmr-listen.tsx => hmr-listen.tsx | 0 _lib_/hmr-react.tsx => hmr-react.tsx | 0 local.tsx => run-local.tsx | 2 +- serve.tsx => run-serve.tsx | 9 ++++++--- 8 files changed, 11 insertions(+), 8 deletions(-) rename _lib_/boot-browser.tsx => boot-browser.tsx (100%) rename _lib_/boot-server.tsx => boot-server.tsx (75%) rename _lib_/hmr-listen.tsx => hmr-listen.tsx (100%) rename _lib_/hmr-react.tsx => hmr-react.tsx (100%) rename local.tsx => run-local.tsx (96%) rename serve.tsx => run-serve.tsx (95%) diff --git a/_lib_/boot-browser.tsx b/boot-browser.tsx similarity index 100% rename from _lib_/boot-browser.tsx rename to boot-browser.tsx diff --git a/_lib_/boot-server.tsx b/boot-server.tsx similarity index 75% rename from _lib_/boot-server.tsx rename to boot-server.tsx index c510a00..459f706 100644 --- a/_lib_/boot-server.tsx +++ b/boot-server.tsx @@ -1,4 +1,4 @@ -import "../serve.tsx"; +import "./run-serve.tsx"; Deno.args.forEach(arg=> { @@ -11,5 +11,5 @@ Deno.args.forEach(arg=> if(Deno.env.get("dev")) { - await import("../local.tsx"); + await import("./run-local.tsx"); } \ No newline at end of file diff --git a/deno.json b/deno.json index b3f0c20..1379bdc 100644 --- a/deno.json +++ b/deno.json @@ -7,7 +7,7 @@ { "react":"https://esm.sh/preact@10.15.1/compat", "react-original":"https://esm.sh/preact@10.15.1/compat", - "@able/": "./_lib_/" + "@able/": "./" }, "tasks": { diff --git a/example/deno.json b/example/deno.json index 9ef9dc0..314726a 100644 --- a/example/deno.json +++ b/example/deno.json @@ -3,7 +3,7 @@ "imports": { "react":"https://esm.sh/preact@10.15.1/compat", - "@able/":"http://localhost:4507/_lib_/" + "@able/":"http://localhost:4507/" }, "tasks": { diff --git a/_lib_/hmr-listen.tsx b/hmr-listen.tsx similarity index 100% rename from _lib_/hmr-listen.tsx rename to hmr-listen.tsx diff --git a/_lib_/hmr-react.tsx b/hmr-react.tsx similarity index 100% rename from _lib_/hmr-react.tsx rename to hmr-react.tsx diff --git a/local.tsx b/run-local.tsx similarity index 96% rename from local.tsx rename to run-local.tsx index e9c7dcd..42183d2 100644 --- a/local.tsx +++ b/run-local.tsx @@ -1,4 +1,4 @@ -import {Configure, Transpile, Extension} from "./serve.tsx"; +import {Configure, Transpile, Extension} from "./run-serve.tsx"; const SocketsLive:Set = new Set(); const SocketsSend =(inData:string)=>{ console.log(inData); for (const socket of SocketsLive){ socket.send(inData); } } diff --git a/serve.tsx b/run-serve.tsx similarity index 95% rename from serve.tsx rename to run-serve.tsx index 3f3dde2..b978583 100644 --- a/serve.tsx +++ b/run-serve.tsx @@ -194,14 +194,17 @@ HTTP.serve(async(req: Request)=> let path; if(url.pathname.startsWith("/_lib_/")) { - if(url.pathname.startsWith("/_lib_/boot")) + const clipRoot = import.meta.url.substring(0, import.meta.url.lastIndexOf("/")); + const clipPath = url.pathname.substring(url.pathname.indexOf("/", 1)); + if(clipPath.startsWith("/boot-")) { - path = import.meta.url+"/../_lib_/boot-browser.tsx"; + path = clipRoot+"/boot-browser.tsx"; } else { - path = import.meta.url+"/.."+url.pathname; + path = clipRoot + clipPath; } + console.log("transpiling", path); code = await Transpile.Fetch(path, url.pathname, true); } else