misc fixes (still broken import)

This commit is contained in:
Seth Trowbridge 2025-08-04 17:06:40 -04:00
parent 836c4bcea8
commit f5b22582e7
10 changed files with 28 additions and 23 deletions

View File

@ -3,16 +3,17 @@
{
"checkJs": true,
"lib": ["deno.window", "DOM"],
"types": ["./dist/core.d.ts"]
"types": ["GALE@HOST/dist/core.d.ts"]
},
"tasks":
{
"work": "deno run -Ar ./scripts/dev_server.ts",
"scan": "deno run -Ar ./scripts/refresh_types.ts",
"html": "deno run -Ar ./scripts/scaffold.ts --html"
"work": "deno run -Ar GALE@HOST/scripts/dev_server.ts",
"scan": "deno run -Ar GALE@HOST/scripts/refresh_types.ts",
"html": "deno run -Ar GALE@HOST/scripts/scaffold.ts --html"
},
"imports":
{
"entry":"./app.js"
"GALE@HOST/":"./",
"GALE@ENTRY":"./app.js"
}
}

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
var g=0,c={};function d(){for(let e in c)sessionStorage.setItem(e,c[e]);c={},g=0}function f(e,t){c[e]=t,g||(g=setTimeout(d,500)),console.log("SAVE",e,t)}function m(e){let t=sessionStorage.getItem(e);return console.log("LOAD",e,t),t}var S,u=0;function v(e){u=0,S=e}function h(){return S?S+"_"+u+++"_":""}var I=globalThis.van.state;globalThis.van.state=(e,t="")=>{let n=typeof e,o=l=>l,a=l=>l?.toString()||null;switch(n){case"boolean":o=l=>l==="true";break;case"number":o=parseFloat;break;case"object":o=JSON.parse,a=JSON.stringify;break}let r="HMR_"+h()+t,s=m(r),i=I(s?o(s):e);return van.derive(()=>f(r,a(i.val))),i};var w=globalThis.vanX.reactive;globalThis.vanX.reactive=(e,t)=>{v(t);let n=w(e);return v(),n};new WebSocket("ws://"+window.location.host+"/ws").addEventListener("message",e=>e.data==="reload"&&window.location.reload());vanX.Store=(e,t)=>{let n=JSON.stringify(e),o=localStorage.getItem(t+"check");localStorage.setItem(t+"check",n);let a;if(n==o){let s=localStorage.getItem(t);try{a=JSON.parse(s)||e}catch{a=e}}else a=e;let r=vanX.reactive(a);return van.derive(()=>localStorage.setItem(t,JSON.stringify(vanX.compact(r)))),r};

1
dist/hmr-WDOBNTDQ.js vendored Normal file
View File

@ -0,0 +1 @@
var g=0,c={};function d(){for(let e in c)sessionStorage.setItem(e,c[e]);c={},g=0}function f(e,t){c[e]=t,g||(g=setTimeout(d,500)),console.log("SAVE",e,t)}function h(e){let t=sessionStorage.getItem(e);return console.log("LOAD",e,t),t}var S,u=0;function v(e){u=0,S=e}function m(){return S?S+"_"+u+++"_":""}var I=globalThis.van.state;globalThis.van.state=(e,t="")=>{let n=typeof e,o=r=>r,a=r=>r?.toString()||null;switch(n){case"boolean":o=r=>r==="true";break;case"number":o=parseFloat;break;case"object":o=JSON.parse,a=JSON.stringify;break}let l="HMR_"+m()+t,s=h(l),i=I(s?o(s):e);return van.derive(()=>f(l,a(i.val))),i};var T=globalThis.vanX.reactive;globalThis.vanX={...globalThis.VanX,reactive:(e,t)=>{v(t);let n=T(e);return v(),n}};new WebSocket("ws://"+window.location.host+"/ws").addEventListener("message",e=>e.data==="reload"&&window.location.reload());vanX.Store=(e,t)=>{let n=JSON.stringify(e),o=localStorage.getItem(t+"check");localStorage.setItem(t+"check",n);let a;if(n==o){let s=localStorage.getItem(t);try{a=JSON.parse(s)||e}catch{a=e}}else a=e;let l=vanX.reactive(a);return van.derive(()=>localStorage.setItem(t,JSON.stringify(vanX.compact(l)))),l};

9
dist/index.html vendored
View File

@ -1,9 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- css reset --><style>*{margin:0;padding:0;box-sizing:border-box;}html, body{height:100%;width:100%;font-family:Arial, sans-serif;line-height:1.6;}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}img, video{max-width:100%;height:auto;}a{text-decoration:none;color:inherit;}ul, ol{list-style:none;}button, input, textarea{font-family:inherit;font-size:inherit;line-height:inherit;border:none;background:none;padding:0;margin:0;outline:none;}table{border-collapse:collapse;width:100%;}</style>
</head>
<body></body>
</html>

11
index.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- css reset -->
<style>*{margin:0;padding:0;box-sizing:border-box;}html, body{height:100%;width:100%;font-family:Arial, sans-serif;line-height:1.6;}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}img, video{max-width:100%;height:auto;}a{text-decoration:none;color:inherit;}ul, ol{list-style:none;}button, input, textarea{font-family:inherit;font-size:inherit;line-height:inherit;border:none;background:none;padding:0;margin:0;outline:none;}table{border-collapse:collapse;width:100%;}</style>
</head>
<body></body>
</html>

View File

@ -1,5 +1,7 @@
const index = await fetch(import.meta.resolve("../dist/index.html")).then(r=>r.text());
export const HTML = index.replace(`</head>`, `<script type="module" src="/dist/bundle_entry.js?map&hmr"></script></head>`);
export const Root = import.meta.resolve("../");
const bundle = await fetch(Root + "dist/core.js").then(r=>r.text());
const index = await fetch(Root + "index.html").then(r=>r.text());
export const HTML = index.replace(`</head>`, `<script type="module" src="/dist/bundle_entry.js?map&hmr"></script></head>`);
export const Load =async(file:string)=> await fetch(Root + file).then(resp=>resp.text());
export const Save =async(text:string, name:string)=> await Deno.writeTextFile(name, text);

View File

@ -4,7 +4,6 @@ import {HTML} from "./assemble_files.ts";
// Parse the port from the command-line arguments, defaulting to 8000
const port = parseInt(Deno.args[0] || "8000", 10);
const sockets: WebSocket[] = [];
//const devinc = await fetch(import.meta.resolve("../src/dev.js")).then(r=>r.text());
let html: string;
try {
@ -12,7 +11,6 @@ try {
} catch (_) {
html = HTML;
}
//html = html.replace("</head>", `<script>${devinc}</script></head>`);
function extension(path: string): string {
// Remove trailing slash if it exists

View File

@ -9,6 +9,8 @@ if(args.html)
else
{
const config = await Load("deno.json");
Save(config.replaceAll("./scripts/", Root+"scripts/").replaceAll("./dist/", Root+"dist/"), "deno.json");
const json = JSON.parse(config);
json.imports["GALE@HOST/"] = Root;
Save(JSON.stringify(json, null, "\t"), "deno.json");
Save(await Load("app.js"), "app.js");
}

View File

@ -78,13 +78,13 @@ globalThis.van.state =(value, key="")=>
//bind VanX
const originalReactive = globalThis.vanX.reactive;
globalThis.vanX.reactive =(obj, id)=>
globalThis.vanX = {...globalThis.VanX, reactive:(obj, id)=>
{
StartID(id);
const state = originalReactive(obj);
StartID();
return state;
}
}};
// added in devmode to index.html
new WebSocket('ws://'+window.location.host+'/ws').addEventListener('message',e=>e.data==='reload'&&window.location.reload());