AOT TypeScript via SWC + LLVM — native builds with no external JavaScript engine

ข้อมูลทางเทคนิคและหมายเหตุการวัดผลใช้ฉบับภาษาอังกฤษเป็นหลักเพื่อป้องกันความคลาดเคลื่อนระหว่างคำแปล

คอมไพล์ TypeScript เป็นเนทีฟ
One Codebase, Many Targets.

Perry compiles TypeScript to native GUI and CLI apps for macOS, iOS, iPadOS, visionOS, tvOS, watchOS, Android, Wear OS, Windows, Linux, and Web/WebAssembly, with a separate HarmonyOS preview. Native binaries statically link the Perry runtime and GC; they do not require Node.js or an external JavaScript engine.

terminal

$ perry compile main.ts

กำลังคอมไพล์ main.ts...

✓ Example executable written: main (size varies by linked features)

$ ./main

Hello, World!

11 + preview
Documented targets + preview
35+
วิดเจ็ต UI เนทีฟ
~3.2 ms
Measured runtime-only macOS hello
Store workflows
perry publish

ทำไมต้อง Perry?

The current compiler, runtime, UI, and tooling surfaces — with limitations called out

No External JS Engine

Native builds run without Node.js, Bun, Deno, or an external JavaScript engine installed. The Perry runtime and garbage collector are statically linked into each target-specific binary.

คอมไพล์เร็ว

คอมไพล์ TypeScript เป็นโค้ดเนทีฟโดยตรง ใช้ SWC สำหรับการแยกวิเคราะห์และ LLVM สำหรับการสร้างโค้ดที่ปรับแต่ง ไม่มี JavaScript ตัวกลาง

Size Scales With Features

Hello world can be about 330 KB and Mango is published at about 7 MB. Applications that link the full standard library or optional V8 fallback can be much larger; size depends on target, imports, and build profile.

Cacheable Builds

Perry caches module objects and can pin a CPU baseline for portable output. Default host builds tune for the local CPU, and final binaries may contain platform UUIDs, timestamps, or signatures, so byte-for-byte cross-machine reproducibility is not promised.

Tracked Node.js APIs

Native implementations cover many familiar Node.js APIs across 53 tracked modules. Coverage is broad but not complete; use perry check and the published limitations for your project.

npm Package จริง

Many pure TypeScript and JavaScript packages compile natively. Packages that depend on unsupported dynamic or engine-specific semantics may need the optional embedded V8 fallback or may not work.

35+ Native UI Widgets

35+ native UI widgets map to platform toolkits including AppKit, UIKit, GTK4, Win32, Android SDK APIs, SwiftUI on watches, and a DOM/CSS bridge on Web/WASM. Availability varies by target.

Compile-Time Plugin System

Modules can compose at build time and statically linked dependencies can become direct native calls. Dynamic dispatch and runtime support remain where JavaScript semantics require them.

True Multi-Threading

Real OS threads with parallelMap, parallelFilter, and spawn. Mutable captures are rejected by default; SharedArrayBuffer and Atomics provide explicit shared-memory coordination, with documented typed-view caveats.

Compile-Time i18n

Automatic string extraction, CLDR plural rules for 30+ locales, and compile-time validation. Translations are baked into the binary; lookup cost depends on the generated catalog and call site.

เจาะลึกยิ่งขึ้น: Perry คอมไพล์ TypeScript เป็นไบนารีอย่างไร อะไรที่ทำให้มันเป็นคอมไพเลอร์ TypeScript เนทีฟ และเทียบกับทางเลือกแทน Electronได้อย่างไร

ดูสิ่งที่ผู้คนสร้าง

Public native applications compiled from TypeScript, with platforms and capabilities taken from their current project pages.

Mango

Mango

GUI MongoDB เนทีฟ — สร้างด้วย TypeScript ทั้งหมด

macOSLinuxWindows
Mango — document editor
Mango — query explorer
Hone

Hone

โค้ดเอดิเตอร์เนทีฟขับเคลื่อนด้วย AI — TypeScript สู่ไบนารีเนทีฟ

macOSiOSWeb
Hone — native AI code editor

Native across documented targets

Eleven documented targets share Perry’s compiler and UI model. Web and WASM are aliases; visionOS, watchOS, and Wear OS have narrower core support, and HarmonyOS is a separate preview.

ma

macOS

AppKit

Broad support
iO

iOS

UIKit

Broad support
iP

iPadOS

UIKit

Broad support
vi

visionOS

UIKit (2D)

Core support
tv

tvOS

UIKit

Broad support
wa

watchOS

SwiftUI

Core support
An

Android

Android SDK

Broad support
We

Wear OS

Android SDK

Core support
Wi

Windows

Win32

Broad support
Li

Linux

GTK4

Broad support
We

Web / WASM

DOM/CSS bridge

Broad support

--target web and --target wasm are aliases

Ha

HarmonyOS

ArkUI

Preview

Separate preview; not included in the 11 documented targets

11 documented targets; HarmonyOS is listed separately as a preview. See the platform status guide

จากโค้ดสู่ App Store

The perry publish command supports build, signing, packaging, verification, and submission workflows. Availability and prerequisites vary by platform and hosted-service configuration.

perry compileคอมไพล์และลงนาม
perry publishแพ็กเกจและส่ง
สโตร์และดาวน์โหลดApp Store, Play Store, ดาวน์โหลดตรง
perry verifyVerify supported targets

Build & Sign

Create platform artifacts and use configured signing credentials. Apple, Android, and Windows workflows require their platform SDKs, accounts, and certificates.

Distribute

Prepare store submissions or direct-download artifacts for supported targets. Store acceptance and processing remain controlled by each store.

Verify

Run available launch and UI checks through Perry and Geisterhand. Test depth and target coverage depend on the selected environment.

Local compilation is free and MIT licensed. Check hosted-service availability → /publish

เปรียบเทียบเฟรมเวิร์ก

Perry’s native compilation model

Ahead-of-time machine code and real platform widgets, with an explicitly linked runtime and documented compatibility tradeoffs.

Designed for

  • Ahead-of-time machine code through LLVM
  • Real platform widgets where each target supports them
  • No external Node.js installation or JavaScript engine by default

Tradeoffs to evaluate

  • The Perry runtime and GC are statically linked; overhead is not “none”
  • Perry implements a practical TypeScript and Node.js subset; some packages need the optional V8 fallback
  • Platform capabilities and maturity differ across desktop, mobile, wearable, TV, and Web/WASM targets

Competitor-specific pages are dated and link to upstream documentation. View sourced comparisons

เขียน TypeScript ส่งมอบแบบเนทีฟ

Use familiar TypeScript syntax and validate each API or package against Perry’s current compatibility surface.

hello.ts
// hello.ts
const greeting = "Hello, World!";
console.log(greeting);
 
// Output size varies with target and linked features
// No external JavaScript runtime installation needed!
$ perry compile hello.ts
ไบนารีเนทีฟ

Published measurements

Current public results include wins, mixed results, and losses. Treat microbenchmarks as workload-specific measurements, not a universal speed claim.

ตัวชี้วัดPerryNode.jsBun
ขนาดไบนารี~330 KB hello world; ~7 MB MangoApplication plus an installed Node.js runtimeStandalone executable embeds the Bun runtime
เวลาเริ่มต้น~3.2 ms*Engine boot and warmup; workload-dependentEngine boot and warmup; workload-dependent
Dependencies ที่รันไทม์Statically linked Perry runtime + GCExternal Node.js runtimeEmbedded Bun / JavaScriptCore runtime
Overhead หน่วยความจำWorkload-dependentWorkload-dependentWorkload-dependent

* Measured runtime-only macOS hello world on an Apple M-series host (5.0 → 3.2 ms after removing unused dynamic-library links). Application startup varies.

Full public suite: wins and losses

Perry 0.5.1355 · Node.js 22.23.1 · Bun 1.3.14 · Apple M1, 8 GB · 2026-08-08

Lower wall-clock median is better. Five complete process samples; correctness checks passed. Benchmark names and descriptions remain English technical identifiers.

BenchmarkPerryNode.jsBunResult
factorial
Modular accumulation
94 ms95 ms95 msWin vs both
method calls
Class method dispatch
9 ms10 ms8 msMixed
closure
Closure creation and invocation
47 ms49 ms49 msWin vs both
binary trees
Tree allocation and traversal
4 ms6 ms6 msWin vs both
string concat
String append loop
2 ms4 ms1 msMixed
prime sieve
Sieve of Eratosthenes
28 ms6 ms5 msLoss vs both
mandelbrot
Complex-number iteration
22 ms24 ms28 msWin vs both
matrix multiply
Matrix multiplication
85 ms33 ms33 msLoss vs both
JSON roundtrip
Parse and stringify ~1 MB JSON
184 ms380 ms220 msWin vs both

เริ่มต้น

ติดตั้ง Perry และเริ่มคอมไพล์ TypeScript เป็นไฟล์ปฏิบัติการเนทีฟ

1การติดตั้ง

terminal
$ npm install -g @perryts/perry

Recommended cross-platform install. Native targets still require the relevant platform SDK and linker; run perry doctor after installation.

2การใช้งาน

Verify the toolchain
perry doctor

Checks the compiler, linker, SDK, and target setup

คอมไพล์ไฟล์
perry compile main.ts

คอมไพล์ main.ts เป็นไฟล์ปฏิบัติการเนทีฟ

เอาต์พุตกำหนดเอง
perry compile main.ts -o myapp

ระบุชื่อไฟล์ปฏิบัติการเอาต์พุต

พร้อม V8 runtime
perry compile main.ts --enable-js-runtime

เปิดใช้ V8 สำหรับความเข้ากันได้กับแพ็กเกจ npm ที่เป็น JavaScript

ตรวจสอบความเข้ากันได้
perry check ./src

ตรวจสอบโค้ด TypeScript สำหรับการคอมไพล์เนทีฟ

การรองรับฟีเจอร์

Tested surfaces and known partial areas — not a blanket claim of complete TypeScript or Node.js compatibility

ภาษาหลัก

  • Numbers (f64 + selected unboxed representations)
  • Strings (UTF-8)
  • Booleans
  • Arrays
  • Objects
  • BigInt (fixed 1024-bit)
  • Proxy
  • eval / runtime-generated code

ฟังก์ชัน

  • Function declarations
  • Arrow functions
  • Default parameters
  • Rest parameters
  • Closures
  • Higher-order functions
  • Async / await
  • Runtime-computed dynamic import

คลาส

  • Classes and constructors
  • Private fields (#)
  • Static methods / fields
  • Getters / setters
  • Inheritance and super
  • Decorators and reflection
  • Dynamic prototype manipulation
  • Weak references / finalizers

ระบบ Type

  • Type annotations
  • Local type inference
  • Generics / specialization
  • Interfaces
  • Union types and guards
  • Runtime type validation

Standard Library

  • fs / path / os
  • crypto
  • Buffer and streams
  • http / http2 / net / tls
  • child_process / worker_threads
  • WebAssembly global
  • ~97% Node suite · 53 modules
Tested in the current implementationPartial

“Partial” means the API or syntax exists with documented gaps. Exact behavior changes as parity work lands. Read the current limitations

~50 Native Packages and Node APIs

Many popular packages and Node APIs have native implementations. Coverage is package- and feature-specific; perry check and the compatibility documentation are the source of truth.

ฐานข้อมูล

mysql2pgmongodbbetter-sqlite3ioredis

ความปลอดภัย

bcryptargon2jsonwebtokencrypto

HTTP

httphttpsaxiosnode-fetchwsnodemailer

การประมวลผลข้อมูล

cheeriosharpzliblodash

วันที่และเวลา

dayjsmomentdate-fnsnode-cron

ยูทิลิตี้

uuidnanoidslugifyvalidatordotenvrate-limiter-flexible
Import the package normally. Perry selects a native implementation when one is available, otherwise compilation may use another supported path or report a limitation.

มันทำงานอย่างไร

From TypeScript source through SWC, Perry HIR, LLVM, and the linked runtime

TypeScriptไฟล์ .ts
SWC
Parserแยกวิเคราะห์เร็ว
HIR
แปลงMonomorphization
LLVM
สร้างโค้ดโค้ดเครื่อง
ไฟล์ปฏิบัติการFrom ~330 KB; varies by features

อยากรู้ว่าคอมไพเลอร์ทำงานภายในอย่างไร? โครงสร้างภายในคอมไพเลอร์

เจาะลึก: TypeScript บน LLVM — monomorphization, NaN-boxing และเหตุผลที่ Perry ทิ้ง Cranelift

โปรเจกต์ข้างเคียง Perry · Pre-1.0

ที่พักและที่รันสำหรับโค้ด Perry

Coop เปลี่ยนไดเรกทอรี TypeScript ที่เข้ากับ Perry ให้เป็นไลบรารีแอปแบบเนทีฟและให้บริการผ่าน HTTP โดยมีรันไทม์และไลบรารีมาตรฐานของ Perry เพียงชุดเดียวต่อเครื่อง

  • ผู้ให้บริการรันไทม์ร่วมกัน
  • หนึ่งเวิร์กเกอร์ต่อการดีพลอย
  • ดีพลอย ตรวจสอบ และย้อนกลับ

คำถามที่พบบ่อย

ทุกอย่างที่คนถามก่อนคอมไพล์ไบนารีตัวแรกของพวกเขา

Perry ต้องมี Node.js หรือรันไทม์หรือไม่?

Native Perry binaries run without Node.js, Bun, Deno, or an external JavaScript engine installed. They do include the Perry runtime and garbage collector, statically linked. Packages that need engine semantics can use the optional embedded V8 fallback.

ไบนารีที่คอมไพล์แล้วมีขนาดใหญ่แค่ไหน?

Size depends on the target, imports, and build profile. The published examples range from about 330 KB for hello world to about 7 MB for Mango; full-standard-library or optional-V8 builds can be much larger. Treat any size as a measured example, not a universal output size.

ใช้แพ็กเกจ npm ได้หรือไม่?

Many pure TypeScript/JavaScript packages compile natively, and roughly 50 package/API implementations are tracked. Compatibility is not universal: packages using native addons, unsupported dynamic behavior, or engine-specific semantics may need the optional V8 fallback or may not work. Run perry check and consult the limitations.

Perry รองรับแพลตฟอร์มใดบ้าง?

Perry documents 11 targets: macOS, iOS, iPadOS, visionOS, tvOS, watchOS, Android, Wear OS, Windows, Linux, and Web/WASM. Web and WASM are aliases; HarmonyOS is a separate preview. Platform maturity and API coverage differ, so consult the platform guide.

Perry ฟรีและเป็นโอเพนซอร์สหรือไม่?

The compiler and runtime repository is MIT licensed, and local compilation requires no account. Hosted Perry Publish and commercial support are separate services; availability, limits, and pricing are confirmed in the service or in writing.

Perry ต่างจาก Bun หรือ Deno compile อย่างไร?

Bun and Deno standalone executables bundle their runtimes; Perry native builds compile through LLVM and do not embed a JavaScript engine by default, although they statically link the Perry runtime and GC. Exact size and startup comparisons are version-, platform-, and workload-specific. See the dated Perry vs Bun and Perry vs Deno pages.

Perry ต่างจาก Electron หรือ Tauri อย่างไร?

Electron ships Chromium and Node.js; Tauri uses a system webview with native-side application code. Perry instead maps its UI model to platform widgets where supported. Bundle size and platform capability vary, so use the dated Perry vs Electron and Perry vs Tauri comparisons rather than a universal size claim.

Perry มีความสมบูรณ์แค่ไหน?

Perry is pre-1.0 and changes quickly. Real projects use it today, but language, package, and platform parity are still active work. Review the showcase, current limitations, and changelog before committing a production workload.

มีคำถามเพิ่มเติมไหม? อ่านคู่มือเริ่มต้นใช้งาน หรือถามได้ที่ GitHub Discussions