{"id":50519299,"url":"https://github.com/restsend/pipa","last_synced_at":"2026-06-03T02:31:22.763Z","repository":{"id":359051753,"uuid":"1244296072","full_name":"restsend/pipa","owner":"restsend","description":"A fast, minimal ES2023 JavaScript runtime built in Rust.","archived":false,"fork":false,"pushed_at":"2026-05-20T07:01:04.000Z","size":413,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-20T09:57:46.381Z","etag":null,"topics":["javascript","rust-library","script-engine"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/restsend.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-20T06:20:50.000Z","updated_at":"2026-05-20T09:51:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/restsend/pipa","commit_stats":null,"previous_names":["restsend/pipa"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/restsend/pipa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restsend%2Fpipa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restsend%2Fpipa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restsend%2Fpipa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restsend%2Fpipa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/restsend","download_url":"https://codeload.github.com/restsend/pipa/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restsend%2Fpipa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33845770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","rust-library","script-engine"],"created_at":"2026-06-03T02:31:21.389Z","updated_at":"2026-06-03T02:31:22.756Z","avatar_url":"https://github.com/restsend.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pipa (枇杷) - A fast, minimal ES2023 JavaScript runtime built in Rust.\n\n## Features\n\n- **ES2023 compliant** — implements the ECMAScript 2023 specification\n- **Async/await built-in** — first-class async/await support without transpilation\n- **Bytecode support** — compile JavaScript to `.jsc` bytecode files for fast loading and execution, with configurable optimization levels (`-O0` through `-O3`)\n- **Fast** — outperforms QuickJS in benchmarks\n- **Small** — ~5.2 MB binary (with `repl` feature)\n- **Zero-dependency** built-in implementations for:\n  - Regex/JSON/Base64/BigInt\n  - Unicode\n  - `fetch` (HTTP client), `rusttls` required \n  - WebSocket\n  - Server-Sent Events (SSE)\n\nNo external C libraries or system dependencies for the above — everything is implemented from scratch in Rust.\n\n## Benchmarks (2026-05-31)\n\nV8 benchmark suite comparison (higher is better):\n\n| Benchmark              |   qjs |   node |   boa |  pipa | vs qjs |\n|------------------------|-------|--------|-------|-------|--------|\n| Richards               |   980 |  46846 |   133 |   895 |  -8.7% |\n| DeltaBlue              |   951 |  94979 |   140 |   923 |  -2.9% |\n| Crypto                 |  1059 |  60072 |   125 |   993 |  -6.2% |\n| RayTrace               |  1462 |  79697 |   315 |   965 | -34.1% |\n| EarleyBoyer            |  2107 |  95129 |   281 |  1307 | -38.0% |\n| RegExp                 |   330 |  12703 |  41.6 |  1016 | +207.9% |\n| Splay                  |  2405 |  48609 |   536 |  2904 | +20.7% |\n| NavierStokes           |  1793 |  56392 |   288 |  1825 |  +1.8% |\n| **SCORE (total)**      | **1201** | **53836** | **184** | **1240** | **+3.2%** |\n\nRanking: **#1 node** (53836) · **#2 pipa** (1240) · **#3 qjs** (1201) · **#4 boa** (184)\n\n## test262 Compatibility (2026-05-31)\n\nTested against [tc39/test262](https://github.com/tc39/test262) (excluding `intl402`).\n\n| Category | Tests | Pass Rate | Notes |\n|----------|-------|-----------|-------|\n| **Core Builtins** | | | |\n| Math | 324 | **100%** (324/324) | |\n| Boolean | 50 | **100%** (50/50) | |\n| parseFloat | 96 | **100%** (96/96) | |\n| parseInt | 104 | **100%** (104/104) | |\n| Number | 339 | **100%** (339/339) | |\n| Object.is | 21 | **100%** (21/21) | |\n| Object.defineProperty | 1131 | **98.8%** (1118/1131) | |\n| Object.create | 320 | **99.4%** (318/320) | |\n| Object.getPrototypeOf | 39 | **100%** (39/39) | |\n| Date | 594 | **93.6%** (556/594) | |\n| global | 29 | **96.6%** (28/29) | |\n| Infinity | 6 | **100%** (6/6) | |\n| eval | 10 | **80.0%** (8/10) | |\n| URI encode/decode | 118 | **77.9%** (92/118) | |\n| Function | 507 | **85.2%** (432/507) | |\n| **Other Builtins** | | | |\n| Symbol | 98 | **73.5%** (72/98) | |\n| JSON | 165 | **50.9%** (84/165) | |\n| Error | 92 | **44.6%** (41/92) | |\n| RegExp | 1878 | **42.3%** (794/1878) | |\n| String | 301 | **17.0%** (51/301) | |\n| Reflect | 153 | **20.9%** (32/153) | |\n| Map | 203 | **21.2%** (43/203) | |\n| Set | 382 | **18.3%** (70/382) | |\n| BigInt | 77 | **23.4%** (18/77) | |\n| Promise | 676 | **5.5%** (37/676) | Limited async support |\n| Proxy | 311 | **0%** (0/311) | Not yet implemented |\n\n## Usage\n\n```bash\ncargo install pipa-js\n# Run a script\npipa script.js\n\n# Run precompiled bytecode\npipa script.jsc\n\n# Compile JavaScript to bytecode\npipa -compile input.js output.jsc\n\n# Disassemble bytecode (debugging)\npipa -diss script.jsc\n\n# Specify optimization level (default: -O2)\npipa -O3 script.js\n\n# Start REPL (requires the repl feature)\npipa\n```\n\n## Embedding in Rust\n\nUse pipa-js as a library to embed JavaScript in your Rust project:\n\n```toml\n[dependencies]\npipa-js = \"0.1.2\"\n```\n\n### Evaluate JavaScript\n\n```rust\nuse pipa::{JSRuntime, eval};\n\nlet mut rt = JSRuntime::new();\nlet mut ctx = rt.new_context();\n\nlet val = eval(\u0026mut ctx, \"1 + 2\").unwrap();\nassert_eq!(val.get_int(), 3);\n```\n\n### Read strings \u0026 values from JavaScript\n\n```rust\nuse pipa::{JSRuntime, eval};\n\nlet mut rt = JSRuntime::new();\nlet mut ctx = rt.new_context();\n\neval(\u0026mut ctx, r#\"\n    function greet(name) {\n        return \"Hello, \" + name + \"!\";\n    }\n\"#).unwrap();\n\nlet val = eval(\u0026mut ctx, r#\"greet(\"world\")\"#).unwrap();\nassert!(val.is_string());\nlet s = ctx.get_atom_str(val.get_atom());\nassert_eq!(s, \"Hello, world!\");\n```\n\n### Call custom Rust functions from JavaScript\n\n```rust\nuse pipa::{JSRuntime, eval, JSValue};\n\nfn js_print(ctx: \u0026mut pipa::JSContext, args: \u0026[JSValue]) -\u003e JSValue {\n    for arg in args {\n        if arg.is_string() {\n            print!(\"{}\", ctx.get_atom_str(arg.get_atom()));\n        } else if arg.is_int() {\n            print!(\"{}\", arg.get_int());\n        }\n    }\n    println!();\n    JSValue::undefined()\n}\n\nlet mut rt = JSRuntime::new();\nlet mut ctx = rt.new_context();\n\nctx.register_global_builtin(\"print\", 1, js_print);\neval(\u0026mut ctx, r#\"print(\"hello from Rust!\")\"#).unwrap();\n```\n\n### Async/await with event loop\n\n```rust\nuse pipa::{JSRuntime, eval, eval_async};\n\nlet mut rt = JSRuntime::new();\nlet mut ctx = rt.new_context();\n\neval_async(\u0026mut ctx, r#\"\n    var result = null;\n    (async () =\u003e {\n        result = await fetch(\"https://httpbin.org/json\");\n    })();\n\"#).unwrap();\n\nlet val = eval(\u0026mut ctx, \"JSON.stringify(result)\").unwrap();\nprintln!(\"{}\", ctx.get_atom_str(val.get_atom()));\n```\n\n\u003e Requires the `fetch` feature (enabled by default). `eval_async` is `eval` + `run_event_loop` in one call.\n\n### Bytecode compilation\n\n```rust\nuse pipa::{JSRuntime, eval, compile_to_register_bytecode};\n\nlet mut rt = JSRuntime::new();\nlet mut ctx = rt.new_context();\n\n// Compile JavaScript to register-based bytecode\nlet (code, constants) = compile_to_register_bytecode(\n    \u0026mut ctx,\n    \"function fib(n) { return n \u003c 2 ? n : fib(n-1) + fib(n-2); } fib(20)\",\n).unwrap();\n\n// code: Vec\u003cu8\u003e, constants: Vec\u003cJSValue\u003e\nassert!(!code.is_empty());\n```\n\n## Build\n\n```bash\n# Default build (includes REPL, fetch, and process support)\ncargo build --release\n\n# Minimal build (no REPL, no fetch, no process)\ncargo build --release --no-default-features\n```\n\n\u003e If using pipa as a library dependency and you don't need REPL/fetch/process features, add it with `default-features = false`:\n\u003e ```toml\n\u003e [dependencies]\n\u003e pipa-js = { version = \"0.1.1\", default-features = false }\n\u003e ```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frestsend%2Fpipa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frestsend%2Fpipa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frestsend%2Fpipa/lists"}