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";
export const dbClient = (name: string, dburl: string) => {
console.log(dburl);
return new Proxy(
{},
{

View File

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

View File

@ -52,17 +52,24 @@ export const fetchViaProxy = async (
body,
headers,
});
return res.json();
const raw = await res.text();
try {
return JSON.parse(raw);
} catch (e) {
return raw;
}
} else {
const res = await fetch(`/_proxy`, {
method: "POST",
body: JSON.stringify({
url,
body,
headers,
}),
headers: { "content-type": "application/json" },
});
return res.json();
console.log(url);
return null;
// const res = await fetch(`/_proxy`, {
// method: "POST",
// body: JSON.stringify({
// url,
// body,
// headers,
// }),
// 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 { BuildOptions } from "esbuild-wasm";
import type Prettier from "prettier/standalone";
import type estree from "prettier/plugins/estree";
import type ts from "prettier/plugins/typescript";
@ -60,7 +59,7 @@ export const jscript = {
if (enabled?.esbuild !== false) {
this.build = async (entry, src, files, verbose?: boolean) => {
const options: BuildOptions = {
const options = {
entryPoints: [entry],
jsx: "transform",
bundle: true,