remove app path inference

This commit is contained in:
Seth Trowbridge 2023-04-30 16:24:43 -04:00
parent 35592bb183
commit 3feb8d3b6b
3 changed files with 15 additions and 17 deletions

View File

@ -1,13 +1,7 @@
{ {
"compilerOptions": {"lib": ["deno.window", "dom"]}, "compilerOptions": {"lib": ["deno.window", "dom"]},
"imports": "importMap": "./deno.map.json",
{
"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"
},
"tasks": { "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"
} }
} }

10
example/deno.map.json Normal file
View File

@ -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"
}
}

View File

@ -256,19 +256,13 @@ export function Boot(inApp:React.FunctionComponent, inCSS?:object)
if(Booted){return;} if(Booted){return;}
Booted = true; Booted = true;
const pathInit = Deno.mainModule;
const pathProj = toFileUrl(Deno.cwd());
//@ts-ignore //@ts-ignore
TwindInst = Twind.install({...Iso.CSS, ...inCSS||{}}); TwindInst = Twind.install({...Iso.CSS, ...inCSS||{}});
const App = inApp; Server(inApp, TwindInst);
Path.AppDir = pathInit.split(pathProj.toString())[1];
Server(App, Path.AppDir, 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 {Transpileable, TranspileURL, SocketsHandler} = Transpiler(DevMode);
const {Imports, Error} = await Configure(DevMode, Path.LibDir); 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"; import {Fetch} from "@eno/iso";
Fetch.Seed(${JSON.stringify(seed)}); Fetch.Seed(${JSON.stringify(seed)});
import "${AppPath}"; import "@eno/app";
</script> </script>
</body> </body>
</html>`; </html>`;