misc fixes (still broken import)
This commit is contained in:
parent
836c4bcea8
commit
f5b22582e7
11
deno.json
11
deno.json
@ -3,16 +3,17 @@
|
|||||||
{
|
{
|
||||||
"checkJs": true,
|
"checkJs": true,
|
||||||
"lib": ["deno.window", "DOM"],
|
"lib": ["deno.window", "DOM"],
|
||||||
"types": ["./dist/core.d.ts"]
|
"types": ["GALE@HOST/dist/core.d.ts"]
|
||||||
},
|
},
|
||||||
"tasks":
|
"tasks":
|
||||||
{
|
{
|
||||||
"work": "deno run -Ar ./scripts/dev_server.ts",
|
"work": "deno run -Ar GALE@HOST/scripts/dev_server.ts",
|
||||||
"scan": "deno run -Ar ./scripts/refresh_types.ts",
|
"scan": "deno run -Ar GALE@HOST/scripts/refresh_types.ts",
|
||||||
"html": "deno run -Ar ./scripts/scaffold.ts --html"
|
"html": "deno run -Ar GALE@HOST/scripts/scaffold.ts --html"
|
||||||
},
|
},
|
||||||
"imports":
|
"imports":
|
||||||
{
|
{
|
||||||
"entry":"./app.js"
|
"GALE@HOST/":"./",
|
||||||
|
"GALE@ENTRY":"./app.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
2
dist/bundle_entry.js
vendored
2
dist/bundle_entry.js
vendored
File diff suppressed because one or more lines are too long
1
dist/hmr-NY37ZYM7.js
vendored
1
dist/hmr-NY37ZYM7.js
vendored
@ -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
1
dist/hmr-WDOBNTDQ.js
vendored
Normal 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
9
dist/index.html
vendored
@ -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
11
index.html
Normal 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>
|
@ -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("../");
|
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 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);
|
export const Save =async(text:string, name:string)=> await Deno.writeTextFile(name, text);
|
@ -4,7 +4,6 @@ import {HTML} from "./assemble_files.ts";
|
|||||||
// Parse the port from the command-line arguments, defaulting to 8000
|
// Parse the port from the command-line arguments, defaulting to 8000
|
||||||
const port = parseInt(Deno.args[0] || "8000", 10);
|
const port = parseInt(Deno.args[0] || "8000", 10);
|
||||||
const sockets: WebSocket[] = [];
|
const sockets: WebSocket[] = [];
|
||||||
//const devinc = await fetch(import.meta.resolve("../src/dev.js")).then(r=>r.text());
|
|
||||||
|
|
||||||
let html: string;
|
let html: string;
|
||||||
try {
|
try {
|
||||||
@ -12,7 +11,6 @@ try {
|
|||||||
} catch (_) {
|
} catch (_) {
|
||||||
html = HTML;
|
html = HTML;
|
||||||
}
|
}
|
||||||
//html = html.replace("</head>", `<script>${devinc}</script></head>`);
|
|
||||||
|
|
||||||
function extension(path: string): string {
|
function extension(path: string): string {
|
||||||
// Remove trailing slash if it exists
|
// Remove trailing slash if it exists
|
||||||
|
@ -9,6 +9,8 @@ if(args.html)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const config = await Load("deno.json");
|
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");
|
Save(await Load("app.js"), "app.js");
|
||||||
}
|
}
|
||||||
|
@ -78,13 +78,13 @@ globalThis.van.state =(value, key="")=>
|
|||||||
|
|
||||||
//bind VanX
|
//bind VanX
|
||||||
const originalReactive = globalThis.vanX.reactive;
|
const originalReactive = globalThis.vanX.reactive;
|
||||||
globalThis.vanX.reactive =(obj, id)=>
|
globalThis.vanX = {...globalThis.VanX, reactive:(obj, id)=>
|
||||||
{
|
{
|
||||||
StartID(id);
|
StartID(id);
|
||||||
const state = originalReactive(obj);
|
const state = originalReactive(obj);
|
||||||
StartID();
|
StartID();
|
||||||
return state;
|
return state;
|
||||||
}
|
}};
|
||||||
|
|
||||||
// added in devmode to index.html
|
// added in devmode to index.html
|
||||||
new WebSocket('ws://'+window.location.host+'/ws').addEventListener('message',e=>e.data==='reload'&&window.location.reload());
|
new WebSocket('ws://'+window.location.host+'/ws').addEventListener('message',e=>e.data==='reload'&&window.location.reload());
|
||||||
|
Loading…
Reference in New Issue
Block a user