From 3feb8d3b6b6202e881de7a76463a235679a638d0 Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Sun, 30 Apr 2023 16:24:43 -0400 Subject: [PATCH] remove app path inference --- example/deno.jsonc | 10 ++-------- example/deno.map.json | 10 ++++++++++ server.tsx | 12 +++--------- 3 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 example/deno.map.json diff --git a/example/deno.jsonc b/example/deno.jsonc index 521187d..a2987a8 100644 --- a/example/deno.jsonc +++ b/example/deno.jsonc @@ -1,13 +1,7 @@ { "compilerOptions": {"lib": ["deno.window", "dom"]}, - "imports": - { - "react": "https://esm.sh/stable/preact@10.13.2/compat", - "preact": "https://esm.sh/stable/preact@10.13.2/", - "@deep/": "./deep/", - "@eno/iso": "http://localhost:4507/lib/iso.tsx" - }, + "importMap": "./deno.map.json", "tasks": { - "dev": "deno run -A --unstable --reload=http://localhost:4507/ --no-lock app.tsx" + "dev": "deno run -A --unstable --reload=http://localhost:4507/ --no-lock app.tsx --dev" } } \ No newline at end of file diff --git a/example/deno.map.json b/example/deno.map.json new file mode 100644 index 0000000..78c923b --- /dev/null +++ b/example/deno.map.json @@ -0,0 +1,10 @@ +{ + "imports": + { + "react": "https://esm.sh/stable/preact@10.13.2/compat", + "preact": "https://esm.sh/stable/preact@10.13.2/", + "@deep/": "./deep/", + "@eno/iso": "http://localhost:4507/lib/iso.tsx", + "@eno/app": "./app.tsx" + } +} \ No newline at end of file diff --git a/server.tsx b/server.tsx index b78c30b..6b78f23 100644 --- a/server.tsx +++ b/server.tsx @@ -256,19 +256,13 @@ export function Boot(inApp:React.FunctionComponent, inCSS?:object) if(Booted){return;} Booted = true; - const pathInit = Deno.mainModule; - const pathProj = toFileUrl(Deno.cwd()); - //@ts-ignore TwindInst = Twind.install({...Iso.CSS, ...inCSS||{}}); - const App = inApp; - Path.AppDir = pathInit.split(pathProj.toString())[1]; - - Server(App, Path.AppDir, TwindInst); + Server(inApp, TwindInst); } -async function Server(App:React.FunctionComponent, AppPath:string, TwindInst:Twind.Twind) +async function Server(App:React.FunctionComponent, TwindInst:Twind.Twind) { const {Transpileable, TranspileURL, SocketsHandler} = Transpiler(DevMode); const {Imports, Error} = await Configure(DevMode, Path.LibDir); @@ -386,7 +380,7 @@ async function Server(App:React.FunctionComponent, AppPath:string, TwindInst:Twi import {Fetch} from "@eno/iso"; Fetch.Seed(${JSON.stringify(seed)}); - import "${AppPath}"; + import "@eno/app"; `;