remote hosting fixes
This commit is contained in:
parent
f5b22582e7
commit
b50cae600a
@ -3,7 +3,7 @@
|
||||
{
|
||||
"checkJs": true,
|
||||
"lib": ["deno.window", "DOM"],
|
||||
"types": ["GALE@HOST/dist/core.d.ts"]
|
||||
"types": ["GALE@HOST/types.d.ts"]
|
||||
},
|
||||
"tasks":
|
||||
{
|
||||
|
6
dist/bundle_entry.js
vendored
6
dist/bundle_entry.js
vendored
File diff suppressed because one or more lines are too long
@ -3,9 +3,6 @@
|
||||
<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,7 +1,13 @@
|
||||
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);
|
||||
|
||||
const index = await Load("index.html");
|
||||
|
||||
export const HTML = index.replace(
|
||||
`</head>`,
|
||||
`
|
||||
<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>
|
||||
<script type="module" src="${Root+"dist/bundle_entry.js?hmr&map"}"></script>
|
||||
</head>`);
|
||||
|
||||
|
@ -29,5 +29,5 @@ fetch(root+"deno.json")
|
||||
path.startsWith("./")&&(imports[n]=root+path.substring(2))
|
||||
}
|
||||
args.has("map") && Script("importmap",JSON.stringify({imports}));
|
||||
Script("module").src=imports.entry;
|
||||
Script("module", "").src=imports["GALE@ENTRY"];
|
||||
});
|
@ -5,12 +5,7 @@ import {HTML} from "./assemble_files.ts";
|
||||
const port = parseInt(Deno.args[0] || "8000", 10);
|
||||
const sockets: WebSocket[] = [];
|
||||
|
||||
let html: string;
|
||||
try {
|
||||
html = Deno.readTextFileSync("./index.html");
|
||||
} catch (_) {
|
||||
html = HTML;
|
||||
}
|
||||
let html = HTML;
|
||||
|
||||
function extension(path: string): string {
|
||||
// Remove trailing slash if it exists
|
||||
|
@ -6,16 +6,20 @@ async function main()
|
||||
const denoJson = JSON.parse(await Deno.readTextFile("./deno.json"));
|
||||
|
||||
// Check if compilerOptions and types are defined
|
||||
if (denoJson.compilerOptions?.types) {
|
||||
if (denoJson.compilerOptions?.types)
|
||||
{
|
||||
const types:string[] = denoJson.compilerOptions.types;
|
||||
|
||||
// Iterate over each type file and cache it
|
||||
for (const typeFile of types) {
|
||||
let lookup:string = typeFile;
|
||||
if(!typeFile.startsWith("http"))
|
||||
{
|
||||
lookup = toFileUrl(resolve(Deno.cwd(), typeFile)).href;
|
||||
}
|
||||
for (const typeFile of types)
|
||||
{
|
||||
let lookup:string = typeFile;
|
||||
console.log(`found ambient type file`, lookup);
|
||||
|
||||
if(typeFile.startsWith("."))
|
||||
{
|
||||
lookup = toFileUrl(resolve(Deno.cwd(), typeFile)).href;
|
||||
}
|
||||
console.log(`Scan found types: ${lookup}`);
|
||||
await import(lookup); // This will cache the file
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user