@ai- matrx/ 代码运行时间
将存储的 TSX —— 一个或多个文件—— 汇编到反应组件中, 对照一个文件导入 (a) 范围,如果范围无法提供,则有明显的、据报的备用设施.
import { compile, gate } from "@ai-matrx/code-runtime";
const files = {
"App.tsx": `import { Form } from "./Form"; export default () => <Form />;`,
"Form.tsx": `import { Button } from "@ai-matrx/design-system/controls";
export const Form = () => <Button>Save</Button>;`,
};
if (gate(files).some((f) => f.severity === "refuse")) throw new Error("refused");
const r = compile(files, "App.tsx", { entries: ["react", "@ai-matrx/design-system/controls"], shadowDangerousGlobals: true });
if (r.ok) render(<r.Component />); else show(r.error.message);
- 范围数字 :
listScopeEntries()是整个注册。 软件包拥有的条目在任何地方都可行 (Next.js, Vite) (英语). 主机拥有的(Markdown、kin-kit、复制按钮、Applet部件、重型) 图书馆)提供一次:provideScopeModules({ "@/components/MarkdownStream": () => mod })。 。 。 . Async 条目( 重写) 需要await prepareScope(spec)或者说compileAsync备案图书馆 a 机体进口总是进入其范围;等待prepareSource(code)编号 :prepareGraph(graph)(或民意调查)pendingEntriesFor(code)在同步编译之前,它被装入. - 沙盒分割: 父运行
@ai-matrx/code-runtime/transform(单位:千美元)transformFiles和 张贴 JSON 图; 帧运行@ai-matrx/code-runtime/execute(单位:千美元)executeGraph没有巴贝尔. - 门数字 :
@ai-matrx/code-runtime/gate是纯的(服务器,写路径)。 将船只列为@ai-matrx/code-runtime/gate-lists.json。 。 。 . - 类型: 注射
kindComponentCompiler()输入@ai-matrx/content-ir/react是因为createDbKindComponentCache({ compile })。 。 。 .
不是安全边界:危险-全球的阴影只是赤裸的识别器。 隔离是 沙盒的框架.