跳到正文

正在自动登录…

← 返回项目列表

earendil-works/djs

脚本引擎模型脚本执行

djs 是一个用 Rust 编写的 JavaScript 和 TypeScript 引擎,专为 wasm32 设计,用于替代 QuickJS 在 pi 的 codemode 中执行模型编写的脚本。它支持任意点挂起、数据传递高效、无 AST 编译器,并具有确定性。适用于需要嵌入式脚本引擎的开发者,特别是与 pi 集成或需要高性能、可挂起的场景。

AI 中文解读 · 根据仓库描述与 README 生成 · 2026/11/6 09:16:41 · 查看原文

值得看Rust库与框架
累计 Stars
300
当前热度
1~7 天 · 小火
仓库创建时间
打开 GitHub ↗项目网站 ↗

选用指南

AI 根据 README 整理 · 2026/11/6 09:16:41

使用方式

可通过命令行运行脚本,也可作为 JavaScript 包导入使用 Sandbox API。

查看 README 依据
Requirements: stable Rust (edition 2024) with the `wasm32-unknown-unknown` target and the `rust-src` component (the wasm module builds core and alloc from source), node 22.6 or newer for the JS host package (it runs TypeScript directly), and, for the oracle-based tests, dquickts' `qjs` at `~/Development/dquickts/qjs` (or `$DJS_QJS`). ```sh cargo build # the workspace cargo run -p djs-cli -- run file.js # run a Script (prints console output) cargo run -p djs-cli -- run --body file.js # run a codemode async function body
@earendil-works/djs`; js/README.md, docs/host.md): ```ts import { Sandbox } from "@earendil-works/djs"; import { loadModule as loadDumpModule } from "@earendil-works/djs/dump"; const sb = await Sandbox.create({ asyncFunctions: { search: (q) => mySearch(q as string) }, memoryLimit: 64 << 20, frozenBuiltins: true, // dumps need them (D2836) dumpModule: await loadDumpModule(), // only to persist runs }); const result = await sb.runAsync("const hits = await search(q); return hits.length;", { q: "djs" });
部署要求

需要 stable Rust (edition 2024) 和 wasm32-unknown-unknown 目标,以及 node 22.6 或更高版本。

查看 README 依据
Requirements: stable Rust (edition 2024) with the `wasm32-unknown-unknown` target and the `rust-src` component (the wasm module builds core and alloc from source), node 22.6 or newer for the JS host package (it runs TypeScript directly), and, for the oracle-based tests, dquickts' `qjs` at `~/Development/dquickts/qjs` (or `$DJS_QJS`). ```sh cargo build # the workspace cargo run -p djs-cli -- run file.js # run a Script (prints console output) cargo run -p djs-cli -- run --body file.js # run a codemode async function body
已知限制

设计上跳过 Intl、Temporal、SharedArrayBuffer/Atomics、Annex B、sloppy mode、direct eval 和 modules。

查看 README 依据
- pi's codemode test suite on djs: 221 of 226 tests pass in the default mode, in the next mode and with a dump at every idle point (measured at 7167411f0f, 2026-11-05). <!-- /gen --> Skipped by design: Intl, Temporal, SharedArrayBuffer/Atomics, Annex B, sloppy mode, direct eval, modules. Most known failures follow from djs being always strict (TESTING.md "Known differences"); pi's failures from that, or from tests that expect the quickjs-wasi fingerprint. **Speed in wasm** (node, V8's wasm tier). djs-wasm vs quickjs-wasi (pi's engine), from `scripts/perf/wmeasure.py`:

README

正在加载 README…

收录信息

仓库创建时间
2026/11/1 19:56:35
首次达标收录
2026/11/6 09:11:32
统计更新时间
2026/11/6 09:46:00

按创建时长与累计 Stars 判断等级。首次达标收录后,即使未达当前门槛仍保留;累计 Stars 和仓库状态会定期更新。确认只有 README 及辅助文件的仓库会停止公开。

模型评估

值得看加权总分 4.2 / 5

新颖度
4.0
实用价值
3.8
成熟度
4.8
实质含量
4.3

由 Jev 模型根据仓库描述与 README 评估,2026/11/6 09:11:32 生成。评分仅供参考,不是代码、安全或许可证审查;热度等级另按创建时长与累计 Stars 计算。

仓库信息

最近推送
2026/11/6 09:10:46
许可证标识
Apache-2.0
Fork 数
6
当前状态
未归档

收录记录

按创建时长与累计 Stars 首次收录:小火
首次发现项目