This commit is contained in:
Rizky 2023-12-16 17:21:57 +07:00
parent 9e0c895c37
commit d274636ff9
4 changed files with 20 additions and 15 deletions

View File

@ -2,7 +2,6 @@ import hash_sum from "hash-sum";
import { fetchViaProxy } from "../../../nova/vi/load/proxy"; import { fetchViaProxy } from "../../../nova/vi/load/proxy";
export const dbClient = (name: string, dburl: string) => { export const dbClient = (name: string, dburl: string) => {
console.log(dburl);
return new Proxy( return new Proxy(
{}, {},
{ {

View File

@ -13,7 +13,7 @@ export const edInit = async (p: PG) => {
w.db = dbClient("prasi", `${cur.protocol}//${cur.host}`); w.db = dbClient("prasi", `${cur.protocol}//${cur.host}`);
await init(); await init();
jscript.init(p.render); jscript.init(p.render, { esbuild: false });
p.script.loaded = true; p.script.loaded = true;
p.render(); p.render();

View File

@ -52,17 +52,24 @@ export const fetchViaProxy = async (
body, body,
headers, headers,
}); });
return res.json(); const raw = await res.text();
try {
return JSON.parse(raw);
} catch (e) {
return raw;
}
} else { } else {
const res = await fetch(`/_proxy`, { console.log(url);
method: "POST", return null;
body: JSON.stringify({ // const res = await fetch(`/_proxy`, {
url, // method: "POST",
body, // body: JSON.stringify({
headers, // url,
}), // body,
headers: { "content-type": "application/json" }, // headers,
}); // }),
return res.json(); // headers: { "content-type": "application/json" },
// });
// return res.json();
} }
}; };

View File

@ -1,5 +1,4 @@
import type { Editor as MonacoEditor } from "@monaco-editor/react"; import type { Editor as MonacoEditor } from "@monaco-editor/react";
import type { BuildOptions } from "esbuild-wasm";
import type Prettier from "prettier/standalone"; import type Prettier from "prettier/standalone";
import type estree from "prettier/plugins/estree"; import type estree from "prettier/plugins/estree";
import type ts from "prettier/plugins/typescript"; import type ts from "prettier/plugins/typescript";
@ -60,7 +59,7 @@ export const jscript = {
if (enabled?.esbuild !== false) { if (enabled?.esbuild !== false) {
this.build = async (entry, src, files, verbose?: boolean) => { this.build = async (entry, src, files, verbose?: boolean) => {
const options: BuildOptions = { const options = {
entryPoints: [entry], entryPoints: [entry],
jsx: "transform", jsx: "transform",
bundle: true, bundle: true,