add outer/inner debugging
This commit is contained in:
parent
bef45f9107
commit
9d31b9a08c
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
@ -5,13 +5,18 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Host Process",
|
||||
"request": "launch",
|
||||
"name": "Debug Serve Mode",
|
||||
"type": "node",
|
||||
"cwd": "${workspaceFolder}/example",
|
||||
"runtimeExecutable": "deno",
|
||||
"runtimeArgs": ["task", "debug"],
|
||||
"attachSimplePort": 9229
|
||||
},
|
||||
{
|
||||
"name": "Subprocess",
|
||||
"request": "attach",
|
||||
"type": "node",
|
||||
"port": 9230
|
||||
}
|
||||
]
|
||||
}
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
||||
{
|
||||
"deno.enable": true
|
||||
}
|
@ -167,9 +167,9 @@ export async function Check()
|
||||
const importMap = imports.json.imports as Record<string, string>;
|
||||
const bake =async(obj:ConfigCheck)=> await Deno.writeTextFile(Deno.cwd()+"/"+obj.path, JSON.stringify(obj.json, null, "\t"));
|
||||
|
||||
importMap["react"] = `https://esm.sh/preact@10.18.1/compat`;
|
||||
importMap["react/"] = `https://esm.sh/preact@10.18.1/compat/`;
|
||||
importMap["@preact/signals"] = `https://esm.sh/@preact/signals@1.2.1`;
|
||||
importMap["react"] = `https://esm.sh/preact@10.18.2/compat`;
|
||||
importMap["react/"] = `https://esm.sh/preact@10.20.2/compat/`;
|
||||
importMap["@preact/signals"] = `https://esm.sh/@preact/signals@1.2.3`;
|
||||
importMap["@twind/core"] = `https://esm.sh/@twind/core@1.1.3`;
|
||||
importMap[">able/"] = `${RootHost}`;
|
||||
if(!importMap[">able/app.tsx"])
|
||||
|
2
cli.tsx
2
cli.tsx
@ -87,7 +87,7 @@ if(arg._.length)
|
||||
}
|
||||
case "debug" :
|
||||
{
|
||||
await SubProcess(["run", `-A`, `--no-lock`, `--config=${config.path}`, `--inspect-brk`, RootHost+"run.tsx", "--dev", ...Deno.args]);
|
||||
await SubProcess(["run", `-A`, `--no-lock`, `--config=${config.path}`, `--inspect-wait=127.0.0.1:9230`, RootHost+"run.tsx", "--dev", ...Deno.args]);
|
||||
break;
|
||||
}
|
||||
case "serve" :
|
||||
|
18
deno.jsonc
18
deno.jsonc
@ -6,24 +6,24 @@
|
||||
"@preact/signals": "https://esm.sh/@preact/signals@1.2.1",
|
||||
"signals-original": "https://esm.sh/@preact/signals@1.2.1",
|
||||
"@twind/core": "https://esm.sh/@twind/core@1.1.3",
|
||||
">able/": "http://localhost:4507/",
|
||||
">able/": "./",
|
||||
">able/app.tsx": "./app.tsx"
|
||||
},
|
||||
"tasks": {
|
||||
"check": "deno run -A --no-lock http://localhost:4507/cli.tsx check",
|
||||
"local": "deno run -A --no-lock http://localhost:4507/cli.tsx local",
|
||||
"debug": "deno run -A --no-lock http://localhost:4507/cli.tsx debug",
|
||||
"serve": "deno run -A --no-lock http://localhost:4507/cli.tsx serve",
|
||||
"cloud": "deno run -A --no-lock http://localhost:4507/cli.tsx cloud",
|
||||
"baker": "deno run -A --no-lock http://localhost:4507/cli.tsx baker",
|
||||
"install": "deno install -A -r -f -n able http://localhost:4507/cli.tsx"
|
||||
"check": "deno run -A --no-lock ./cli.tsx check",
|
||||
"local": "deno run -A --no-lock ./cli.tsx local",
|
||||
"debug": "deno run -A --no-lock --inspect-wait=127.0.0.1:9229 ./cli.tsx debug",
|
||||
"serve": "deno run -A --no-lock ./cli.tsx serve",
|
||||
"cloud": "deno run -A --no-lock ./cli.tsx cloud",
|
||||
"baker": "deno run -A --no-lock ./cli.tsx baker",
|
||||
"install": "deno install -A -r -f -n able ./cli.tsx"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "react",
|
||||
"lib": [
|
||||
"deno.window",
|
||||
"dom",
|
||||
"dom",
|
||||
"dom.asynciterable"
|
||||
]
|
||||
}
|
||||
|
20
deno__.json
20
deno__.json
@ -1,20 +0,0 @@
|
||||
{
|
||||
"compilerOptions": { "lib": ["deno.window", "dom"],
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "react"
|
||||
},
|
||||
"imports":
|
||||
{
|
||||
"react":"https://esm.sh/preact@10.15.1/compat",
|
||||
"react/":"https://esm.sh/preact@10.15.1/compat/",
|
||||
"react-original":"https://esm.sh/preact@10.15.1/compat",
|
||||
|
||||
},
|
||||
"tasks":
|
||||
{
|
||||
"local": "deno run -A --reload=http://localhost:4507 --no-lock ./run-local.tsx --port=1234",
|
||||
"serve": "deno run -A --reload=http://localhost:4507 --no-lock ./run-serve.tsx --port=1234",
|
||||
"cloud": "deno run -A --reload=http://localhost:4507 --no-lock ./run-deploy.tsx",
|
||||
"debug": "deno run -A --reload=http://localhost:4507 --no-lock --inspect-wait ./run-serve.tsx --port=1234",
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import * as MIME from "https://deno.land/std@0.180.0/media_types/mod.ts";
|
||||
import * as SWCW from "https://esm.sh/@swc/wasm-web@1.3.62";
|
||||
import * as SWCW from "https://esm.sh/@swc/wasm-web@1.4.17";
|
||||
import { HuntConfig } from "./checker.tsx";
|
||||
import CustomServe from ">able/api.tsx";
|
||||
|
||||
@ -9,6 +9,12 @@ type DenoConfig = {imports:Record<string, string>};
|
||||
const ImportMap:DenoConfig = {imports:{}};
|
||||
let ImportMapProxies:Record<string, string> = {};
|
||||
|
||||
// (re)scan the project directory looking for the config
|
||||
// process the found import map:
|
||||
// - make a copy of the import map
|
||||
// - change root relative imports that deno needs (starts with "./") to "/" for use in the browser
|
||||
// - change
|
||||
|
||||
const ImportMapReload =async()=>
|
||||
{
|
||||
const [, {json, path}] = await HuntConfig();
|
||||
@ -39,7 +45,6 @@ const ImportMapReload =async()=>
|
||||
});
|
||||
|
||||
ImportMap.imports = Configuration.Remap(imports, Configuration);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -162,6 +167,7 @@ export const Configure =(config:ConfigurationArgs)=>
|
||||
}
|
||||
|
||||
|
||||
|
||||
let running = false;
|
||||
export default async()=>
|
||||
{
|
||||
@ -184,30 +190,34 @@ export default async()=>
|
||||
const ext = Extension(url.pathname);
|
||||
const headers = {"content-type":"application/json", "Access-Control-Allow-Origin": Configuration.Allow, "charset":"UTF-8"};
|
||||
let proxy = Root + url.pathname;
|
||||
|
||||
|
||||
// dont serve hidden files (end file or folder names with "__" to hide)
|
||||
if(url.pathname.includes("__/") || url.pathname.lastIndexOf("__.") > -1)
|
||||
{
|
||||
return new Response(`{"error":"unmatched route", "path":"${url.pathname}"}`, {status:404, headers});
|
||||
}
|
||||
|
||||
|
||||
// proxy imports
|
||||
if(url.pathname.startsWith(encodeURI("/>")))
|
||||
{
|
||||
console.log(ImportMapProxies);
|
||||
console.log("checking for", url.pathname)
|
||||
let bestMatch="";
|
||||
for(let key in ImportMapProxies)
|
||||
for(const key in ImportMapProxies)
|
||||
{
|
||||
if(url.pathname.startsWith(key) && key.length > bestMatch.length)
|
||||
const match = url.pathname.startsWith(key) && key.length > bestMatch.length;
|
||||
console.log(`key:${key} match:${match}`);
|
||||
if(match)
|
||||
{
|
||||
bestMatch = key;
|
||||
}
|
||||
}
|
||||
if(bestMatch.length)
|
||||
{
|
||||
const match = ImportMapProxies[bestMatch];
|
||||
const value = ImportMapProxies[bestMatch];
|
||||
const path = url.pathname.substring(bestMatch.length);
|
||||
proxy = path ? match + path : Root + match;
|
||||
|
||||
}
|
||||
proxy = path ? value + path : Root + value;
|
||||
}
|
||||
}
|
||||
|
||||
// allow for custom handlers
|
||||
|
Loading…
Reference in New Issue
Block a user