plunking (note Deno.mainModule)

This commit is contained in:
Seth Trowbridge 2023-04-30 07:31:04 -04:00
parent d3f08a67a0
commit b18df9ff89
6 changed files with 47 additions and 1 deletions

13
circ/a.tsx Normal file
View File

@ -0,0 +1,13 @@
import { doSomething } from './b.tsx';
export function doSomethingElse() {
if(Deno.env.get("a") && Deno.env.get("b")){return;}
Deno.env.set("a", "called");
console.log("a action");
doSomething();
}
import.meta.main

10
circ/b.tsx Normal file
View File

@ -0,0 +1,10 @@
import { doSomethingElse } from './a.tsx';
export function doSomething() {
console.log("b main?", Deno.mainModule);
Deno.env.set("b", "called");
console.log("b action");
doSomethingElse();
}

3
circ/start.tsx Normal file
View File

@ -0,0 +1,3 @@
import { doSomethingElse } from "./a.tsx";
doSomethingElse();

View File

@ -2,15 +2,25 @@ import TWPreTail from "https://esm.sh/v115/@twind/preset-tailwind@1.1.4/es2022/p
import TWPreAuto from "https://esm.sh/v115/@twind/preset-autoprefix@1.0.7/es2022/preset-autoprefix.mjs"; import TWPreAuto from "https://esm.sh/v115/@twind/preset-autoprefix@1.0.7/es2022/preset-autoprefix.mjs";
import React from "react"; import React from "react";
import {INIT} from "../server.tsx";
function wrapper()
{
INIT();
}
wrapper();
export const CSS = { export const CSS = {
presets: [TWPreTail(), TWPreAuto()], presets: [TWPreTail(), TWPreAuto()],
hash:false hash:false
}; };
/*
if(!window.innerWidth) if(!window.innerWidth)
{ {
import(import.meta.resolve("../../server.tsx")).then(()=>{console.log("...imported!");}); import(import.meta.resolve("../../server.tsx")).then(()=>{console.log("...imported!");});
} }
*/
type MetasInputs = { [Property in MetaKeys]?: string }; type MetasInputs = { [Property in MetaKeys]?: string };
type MetasModeArgs = {concatListed?:boolean; dropUnlisted?:boolean}; type MetasModeArgs = {concatListed?:boolean; dropUnlisted?:boolean};

0
lib/mid.tsx Normal file
View File

View File

@ -10,6 +10,8 @@ import * as Iso from "@eno/iso";
Deno.env.set("initialized", "true"); Deno.env.set("initialized", "true");
export const INIT =()=> console.log("init!");
/** /**
* Setup a transpiler. * Setup a transpiler.
* @param inDevMode When true, starts a file-watcher * @param inDevMode When true, starts a file-watcher
@ -282,6 +284,14 @@ Deno.args.forEach(arg=>
} }
}); });
let Booted = false;
export function Boot(inApp:React.JSX.Element, inCSS?:object)
{
if(Booted){return;}
Booted = true;
}
let DevMode = Flags.dev ? true : false; let DevMode = Flags.dev ? true : false;
let hosted = import.meta.resolve("./"); let hosted = import.meta.resolve("./");
const Path = { const Path = {