Compare commits

..

No commits in common. "5efb25541be2317bcdf9ded767652749a00fa166" and "5f9f03459cf8e4be70a4921f02416ae617c92775" have entirely different histories.

3 changed files with 8 additions and 20 deletions

View File

@ -3,9 +3,7 @@
"deno.window", "DOM"
]},
"imports": {
"react-original": "https://esm.sh/react@18.2.0",
"react": "https://esm.sh/react@18.2.0",
"@eno/app": "./dummy-app.tsx"
"react-original": "https://esm.sh/react@18.2.0"
},
"tasks":
{

View File

@ -1,3 +0,0 @@
import React from "react";
export default ()=> <div>dummy app</div>

View File

@ -61,6 +61,7 @@ const TranspileURL:Transpiler =async(inPath, inKey, inCheck)=>
const LibPath = "lib";
type ImportMap = {imports?:Record<string, string>, importMap?:string};
let ImportString = ``;
let ImportObject:ImportMap = {};
try
{
@ -74,6 +75,7 @@ try
try
{
ImportObject = JSON.parse(confImports);
ImportString = confImports;
}
catch(e)
{
@ -88,31 +90,22 @@ try
else if(confDenoParsed.imports)
{
ImportObject = {imports:confDenoParsed.imports};
ImportString = JSON.stringify(ImportObject);
}
if(ImportObject.imports)
{
const importReact = ImportObject.imports["react"];
const importReact = ImportObject.imports?.["react"];
if(importReact)
{
ImportObject.imports["react-original"] = importReact;
ImportObject.imports["react"] = `./${LibPath}/react.tsx`;
ImportString = JSON.stringify(ImportObject);
}
else
{
console.log(`"imports" configuration does not alias "react"`);
}
const importApp = ImportObject.imports["@eno/app"];
if(importApp)
{
}
else
{
console.log(`"imports" configuration does not alias an entry-point component with "@eno/app"`);
}
}
else
{
@ -129,7 +122,7 @@ const Index = `
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="importmap">${JSON.stringify(ImportObject)}</script>
<script type="importmap">${ImportString}</script>
<script async src="https://ga.jspm.io/npm:es-module-shims@1.5.1/dist/es-module-shims.js" crossorigin="anonymous"></script>
</head>
<body>
@ -148,7 +141,7 @@ const Index = `
TW.observe(TW.twind(Configure, TW.cssom(ShadowCSS)), ShadowDiv);
import App from "@eno/app";
import App from "./app.tsx";
import {render, createElement as H} from "react";
render(H(()=>H(App)), ShadowDiv);