automatically add "react/"

This commit is contained in:
Seth Trowbridge 2023-07-17 09:26:41 -04:00
parent 3fed5dfdba
commit c3e5319d47
4 changed files with 25 additions and 22 deletions

View File

@ -7,7 +7,7 @@
{
"react":"https://esm.sh/preact@10.15.1/compat",
"react-original":"https://esm.sh/preact@10.15.1/compat",
"@able/": "./"
"able/": "http://localhost:1234/"
},
"tasks":
{

View File

@ -1,3 +1,5 @@
import { Router, Switch, Case } from "able/iso-elements.tsx";
import React from "react";
const CTXString = React.createContext("lol");
@ -35,18 +37,20 @@ export default ()=>
{
const [Store, Dispatch] = React.useReducer(reducer, {name:"seth", age:24} as Store, builder)
return <CTXString.Provider value="intradestink">
<div class="my-4 font-sans">
<h1 class="font-black text-xl text-red-500">Title</h1>
<h2 class="font-black text-blue-500">subtitle</h2>
<p>
<button onClick={e=>Dispatch(1)}>{Store.name}|{Store.age}?</button>
</p>
</div>
<Outer>
<Inner/>
</Outer>
<Outer>
<Inner/>
</Outer>
<Router.Provider>
<div class="my-4 font-sans">
<h1 class="font-black text-xl text-red-500">Title</h1>
<h2 class="font-black text-blue-500 p-4">subtitle</h2>
<p>
<button onClick={e=>Dispatch(1)}>{Store.name}|{Store.age}?</button>
</p>
</div>
<Outer>
<Inner/>
</Outer>
<Outer>
<Inner/>
</Outer>
</Router.Provider>
</CTXString.Provider>;
}

View File

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

View File

@ -53,6 +53,10 @@ const ImportMapReload =async()=>
{
console.log(`"react" specifier not defined in import map`);
}
else if(!json.imports["react/"])
{
json.imports["react/"] = json.imports["react"]+"/";
}
ImportMap.imports = Configuration.Remap(json.imports, Configuration);
console.log(ImportMap.imports);
@ -70,12 +74,6 @@ let Configuration:Configuration =
async Serve(inReq, inURL, inExt, inMap, inConfig){},
Remap: (inImports, inConfig)=>
{
const reactURL = inImports["react"];
const setting = Configuration.SWCOp?.jsc?.transform?.react;
if(setting && reactURL)
{
setting.importSource = reactURL;
}
return inImports;
},
Shell(inReq, inURL, inExt, inMap, inConfig)