mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-15 23:31:05 +00:00
* refactor(integrations): split TypeScript host plugins * feat(integrations): refresh host compatibility and status UI * fix(openclaw): secure status diagnostics
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
import { mkdir, readFile, unlink, writeFile } from "node:fs/promises";
|
|
import { dirname, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
import { build } from "esbuild";
|
|
|
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
const output = resolve(root, "dist/client.js");
|
|
const temporary = resolve(root, "dist/client.bundle.cjs");
|
|
|
|
await mkdir(dirname(output), { recursive: true });
|
|
await build({
|
|
entryPoints: [resolve(root, "src/client/index.tsx")],
|
|
outfile: temporary,
|
|
bundle: true,
|
|
format: "cjs",
|
|
platform: "browser",
|
|
target: "es2022",
|
|
jsx: "automatic",
|
|
external: [
|
|
"react",
|
|
"react/jsx-runtime",
|
|
"@deepseek-ai/dsh-client-ui-primitives",
|
|
],
|
|
sourcemap: false,
|
|
logLevel: "info",
|
|
});
|
|
const body = await readFile(temporary, "utf8");
|
|
const wrapped = `window.__ModuleLoader__.load({\n id: "@agentscope-ai/reme-dsh-plugin",\n factory: (require) => {\n var module = { exports: {} };\n var exports = module.exports;\n${body
|
|
.split("\n")
|
|
.map((line) => ` ${line}`)
|
|
.join("\n")}\n return module.exports;\n }\n});\n`;
|
|
await writeFile(output, wrapped);
|
|
await unlink(temporary);
|