remove spoof convention

This commit is contained in:
Seth Trowbridge 2023-07-08 15:25:09 -04:00
parent 0ea5c3e562
commit d29414691c
4 changed files with 5 additions and 16 deletions

View File

@ -38,7 +38,7 @@ export default ()=>
return <CTXString.Provider value="intradestink"> return <CTXString.Provider value="intradestink">
<div class="my-4 font-sans"> <div class="my-4 font-sans">
<h1 class="font-black text-xl text-red-500">Title????</h1> <h1 class="font-black text-xl text-red-500">Title????</h1>
<h2 class="p-4">subtitle!!!!</h2> <h2>subtitle</h2>
<p> <p>
<button onClick={e=>Dispatch(1)}>{Store.name}|{Store.age}?</button> <button onClick={e=>Dispatch(1)}>{Store.name}|{Store.age}?</button>
</p> </p>

View File

@ -2,8 +2,7 @@
"compilerOptions": { "lib": ["deno.window", "dom"] }, "compilerOptions": { "lib": ["deno.window", "dom"] },
"imports": "imports":
{ {
"react":"https://esm.sh/preact@10.15.1/compat", "react":"https://esm.sh/preact@10.15.1/compat"
"@able/":"http://localhost:8000/"
}, },
"tasks": "tasks":
{ {

View File

@ -26,7 +26,7 @@ Configure({
}, },
async Serve(inReq, inURL, inExt, inMap, inConfig) async Serve(inReq, inURL, inExt, inMap, inConfig)
{ {
if(Transpile.Check(inExt) && !inURL.searchParams.get("reload") && !inURL.pathname.startsWith(inConfig.Spoof+"/")) if(Transpile.Check(inExt) && !inURL.searchParams.get("reload"))
{ {
const imp = await import(inConfig.Proxy+inURL.pathname); const imp = await import(inConfig.Proxy+inURL.pathname);
const members = []; const members = [];

View File

@ -49,15 +49,6 @@ const ImportMapReload =async()=>
} }
}); });
/*
const mapKey = (Configuration.Spoof.startsWith("/") ? Configuration.Spoof.substring(1) : Configuration.Spoof)+"/";
if(!json.imports[mapKey])
{
console.log(`"${mapKey}" specifier not defined in import map`);
}
json.imports[mapKey] = Configuration.Spoof+"/";
*/
if(!json.imports["react"]) if(!json.imports["react"])
{ {
console.log(`"react" specifier not defined in import map`); console.log(`"react" specifier not defined in import map`);
@ -69,14 +60,13 @@ const ImportMapReload =async()=>
type CustomHTTPHandler = (inReq:Request, inURL:URL, inExt:string|false, inMap:{imports:Record<string, string>}, inConfig:Configuration)=>void|false|Response|Promise<Response|void|false>; type CustomHTTPHandler = (inReq:Request, inURL:URL, inExt:string|false, inMap:{imports:Record<string, string>}, inConfig:Configuration)=>void|false|Response|Promise<Response|void|false>;
type CustomRemapper = (inImports:Record<string, string>, inConfig:Configuration)=>Record<string, string>; type CustomRemapper = (inImports:Record<string, string>, inConfig:Configuration)=>Record<string, string>;
type Configuration = {Proxy:string, Spoof:string, Allow:string, Reset:string, SWCOp:SWCW.Options, Serve:CustomHTTPHandler, Shell:CustomHTTPHandler, Remap:CustomRemapper}; type Configuration = {Proxy:string, Allow:string, Reset:string, SWCOp:SWCW.Options, Serve:CustomHTTPHandler, Shell:CustomHTTPHandler, Remap:CustomRemapper};
type ConfigurationArgs = {Proxy?:string, Spoof?:string, Allow?:string, Reset?:string, SWCOp?:SWCW.Options, Serve?:CustomHTTPHandler, Shell?:CustomHTTPHandler, Remap?:CustomRemapper}; type ConfigurationArgs = {Proxy?:string, Allow?:string, Reset?:string, SWCOp?:SWCW.Options, Serve?:CustomHTTPHandler, Shell?:CustomHTTPHandler, Remap?:CustomRemapper};
let Configuration:Configuration = let Configuration:Configuration =
{ {
Proxy: new URL(`file://${Deno.cwd().replaceAll("\\", "/")}`).toString(), Proxy: new URL(`file://${Deno.cwd().replaceAll("\\", "/")}`).toString(),
Allow: "*", Allow: "*",
Reset: "/clear-cache", Reset: "/clear-cache",
Spoof: "/@able",
async Serve(inReq, inURL, inExt, inMap, inConfig){}, async Serve(inReq, inURL, inExt, inMap, inConfig){},
Remap: (inImports, inConfig)=> Remap: (inImports, inConfig)=>
{ {