โค้ดเดียว ทุกแพลตฟอร์ม
ประสิทธิภาพระดับเนทีฟ
Perry คอมไพล์ TypeScript เป็นแอป GUI และ CLI เนทีฟบน macOS, iPadOS, iOS, Android, Linux, Windows, watchOS, tvOS, WebAssembly และเว็บ ไม่ต้องมี runtime ไม่ต้องมี Electron เป็นไบนารีเนทีฟล้วน ๆ
$ perry compile main.ts
กำลังคอมไพล์ main.ts...
✓ คอมไพล์ไฟล์สำเร็จ: main (2.3 MB)
$ ./main
Hello, World!
ทำไมต้อง Perry?
ทุกอย่างที่คุณต้องการเพื่อคอมไพล์ TypeScript เป็นแอปพลิเคชันเนทีฟ
ไม่ต้องมี Runtime
สร้างไฟล์ปฏิบัติการเนทีฟแบบ standalone ไม่ต้องมี Node.js, ไม่ต้องมี V8, ไม่มี dependency ที่รันไทม์ เป็นไบนารีตัวเดียวที่รันได้ทุกที่
คอมไพล์เร็ว
คอมไพล์ TypeScript เป็นโค้ดเนทีฟโดยตรง ใช้ SWC สำหรับการแยกวิเคราะห์และ Cranelift สำหรับการสร้างโค้ด ไม่มี JavaScript ตัวกลาง
ไบนารีขนาดเล็ก
ไบนารีเอาต์พุตโดยทั่วไปมีขนาด 2-5 MB พร้อม V8 runtime เสริมสำหรับแพ็กเกจ npm JS จะอยู่ที่ 15-20 MB ส่งน้อยลง ติดตั้งเร็วขึ้น
Type-Safe
ใช้ระบบ type ของ TypeScript เพื่อการเพิ่มประสิทธิภาพ type ช่วยให้สร้างโค้ดได้ดีขึ้นผ่าน monomorphization
Standard Library ที่ครอบคลุม
มีการ implement เนทีฟในตัวของ fs, path, crypto, os, Buffer, child_process และอื่น ๆ ใช้ API ของ Node.js ที่คุ้นเคย
V8 Runtime เสริม
ต้องใช้แพ็กเกจ npm ที่เป็น JavaScript ล้วน? เปิดใช้งาน flag V8 runtime เพื่อความเข้ากันได้กับระบบ npm อย่างเต็มรูปแบบ
วิดเจ็ต UI เนทีฟ 25+ ตัว
ปุ่ม, ช่องข้อความ, พื้นที่ข้อความ, ตาราง, canvas, scroll view, QR code, ช่องป้อนข้อมูลที่ปลอดภัย, หน้าจอเปิดแอป และอื่น ๆ — ทั้งหมดคอมไพล์เป็นวิดเจ็ตแพลตฟอร์มจริงผ่าน AppKit, GTK4, Win32, UIKit และ JNI
ระบบปลั๊กอินแบบ Compile-Time
โมดูลประกอบกันในเวลา build — ไม่มี overhead ของปลั๊กอินที่รันไทม์ ไม่มีขอบเขต IPC dependency ของคุณจะกลายเป็นการเรียกฟังก์ชันเนทีฟโดยตรงในไบนารีสุดท้าย
Multi-Threading ที่แท้จริง
เธรด OS จริงพร้อม parallelMap, parallelFilter และ spawn ความปลอดภัยระดับ compile-time ปฏิเสธการจับค่าที่เปลี่ยนแปลงได้ — ไม่มี SharedArrayBuffer, ไม่มี worker, มีแค่เธรด
i18n แบบ Compile-Time
แยกสตริงอัตโนมัติ, กฎพหูพจน์ CLDR สำหรับ 30+ locale, การตรวจสอบแบบ compile-time การแปลถูกฝังในไบนารีโดยแทบไม่ต้อง lookup ที่รันไทม์
เนทีฟบนทุกแพลตฟอร์ม
Perry คอมไพล์ TypeScript ของคุณเป็นเฟรมเวิร์ก UI เนทีฟ, WebAssembly และ JavaScript — ไม่ใช่ web view, ไม่ใช่ Electron วิดเจ็ตเนทีฟจริงบนทุกแพลตฟอร์ม รวมถึงเว็บ
macOS
AppKit
iOS
UIKit
iPadOS
UIKit
Android
Views
Linux
GTK4
Windows
Win32
watchOS
SwiftUI
tvOS
SwiftUI
WASM
WebAssembly
Web
JavaScript
เฟรมเวิร์กเดียวที่ตรงตามทุกข้อกำหนด
TypeScript คอมไพล์เป็นโค้ดเนทีฟ วิดเจ็ตแพลตฟอร์มจริง ไม่มี overhead ที่รันไทม์
| เฟรมเวิร์ก | ภาษา | โค้ดเนทีฟ | วิดเจ็ตเนทีฟ | Overhead ที่รันไทม์ |
|---|---|---|---|---|
Perry★AOT compiled to native binary | TypeScript | None | ||
React NativeJIT / interpreted at runtime | JS / TypeScript | Hermes / V8 + Bridge | ||
FlutterAOT compiled, custom renderer | Dart | Dart VM + Skia engine | ||
KMP + ComposeJVM on Android, native on iOS | Kotlin | บางส่วน | Kotlin runtime + Skia | |
Swift for AndroidNative binary, no shared UI | Swift | ไม่มี UI ที่ใช้ร่วมกัน | Swift runtime on Android | |
.NET MAUIPartial AOT via Mono | C# | บางส่วน | .NET / Mono runtime | |
NativeScriptJS runtime, native widget access | JS / TypeScript | V8 / JavaScriptCore | ||
IonicWeb app in native wrapper | JS / TypeScript | WebView + Capacitor |
เขียน TypeScript ส่งมอบแบบเนทีฟ
ใช้ syntax และ API ของ TypeScript ที่คุ้นเคย Perry จัดการส่วนที่เหลือ
// hello.tsconst greeting = "Hello, World!";console.log(greeting); // Compiles to ~2MB native executable// No runtime needed!การเปรียบเทียบประสิทธิภาพ
การคอมไพล์เนทีฟให้ประสิทธิภาพที่ไม่มีใครเทียบได้
| ตัวชี้วัด | Perry | Node.js | Bun |
|---|---|---|---|
| ขนาดไบนารี | 2-5 MB | ~80 MB | ~90 MB |
| เวลาเริ่มต้น | ~1 ms | ~30 ms | ~10 ms |
| Dependencies ที่รันไทม์ | ไม่มี | Node.js | Bun |
| Overhead หน่วยความจำ | น้อยมาก | V8 + GC | JSC + GC |
ผลเบนช์มาร์ก: เร็วกว่า 2.2 เท่า
Perry vs Node.js v24 บน macOS ARM64 (ยิ่งต่ำยิ่งดี)
เริ่มต้น
ติดตั้ง Perry และเริ่มคอมไพล์ TypeScript เป็นไฟล์ปฏิบัติการเนทีฟ
1การติดตั้ง
$ brew tap PerryTS/perry$ brew install perryต้องมี Homebrew รองรับ macOS arm64 และ x86_64
2การใช้งาน
perry build main.tsคอมไพล์ main.ts เป็นไฟล์ปฏิบัติการเนทีฟ
perry build main.ts -o myappระบุชื่อไฟล์ปฏิบัติการเอาต์พุต
perry build main.ts --enable-js-runtimeเปิดใช้ V8 สำหรับความเข้ากันได้กับแพ็กเกจ npm ที่เป็น JavaScript
perry check ./srcตรวจสอบโค้ด TypeScript สำหรับการคอมไพล์เนทีฟ
การรองรับฟีเจอร์
ครอบคลุม API ของ TypeScript และ Node.js อย่างครบถ้วน
Core Language
- Numbers64-bit floating point (f64)
- StringsUTF-8, all common methods
- Booleanstrue/false, logical operators
- ArraysTyped and mixed-type arrays
- ObjectsObject literals and field access
- BigInt256-bit integer support
- EnumsNumeric and string enums
Functions
- Function DeclarationNamed functions
- Arrow Functions() => {} syntax
- Default ParametersParameters with defaults
- Rest Parameters...args syntax
- ClosuresIncluding mutable captures
- Higher-Order FunctionsFunctions as arguments/returns
- Async/AwaitAsync function support
Classes
- Class DeclarationBasic class syntax
- ConstructorsWith parameters
- Private Fields (#)ES2022 #privateField syntax
- Static Methods/FieldsClass-level members
- Getters/Settersget/set accessors
- Inheritanceextends keyword
- Super Callssuper() constructor calls
Type System
- Type AnnotationsExplicit type declarations
- Type InferenceAutomatic type detection
- GenericsMonomorphization (like Rust)
- InterfacesInterface declarations
- Union Typesstring | number support
- Type Guardstypeof operator
- Type Aliasestype X = ... declarations
Standard Library
- fsreadFileSync, writeFileSync, existsSync, etc.
- pathjoin, dirname, basename, extname, resolve
- cryptorandomBytes, randomUUID, sha256, md5
- osplatform, arch, hostname, memory info
- Bufferfrom, alloc, toString, slice, copy
- child_processexecSync, spawnSync
- JSON/Math/DateFull implementations
แพ็กเกจ npm เนทีฟ 30+ ตัว
แพ็กเกจ npm ยอดนิยมที่ implement ใหม่ในเนทีฟ Rust ไม่ต้อง npm install ไม่ต้อง node_modules แค่โค้ดเนทีฟที่เร็ว
ฐานข้อมูล
ความปลอดภัย
HTTP
การประมวลผลข้อมูล
วันที่และเวลา
ยูทิลิตี้
จากโค้ดสู่ App Store
Perry ไม่แค่คอมไพล์แอปของคุณ — แต่ส่งมอบถึงมือผู้ใช้
บิลด์และลงนาม
บิลด์ข้ามแพลตฟอร์มด้วยคำสั่งเดียว การลงนามโค้ดสำหรับ macOS, iOS, Android และ Windows จัดการให้คุณ ไม่ต้องต่อสู้กับ provisioning profile ของ Xcode หรือ keystore ของ Android
แจกจ่าย
ส่งไปยัง App Store, Play Store หรือให้ดาวน์โหลดโดยตรง Perry Publish จัดการการแพ็กเกจ, การรับรอง และการส่ง
ตรวจสอบ
ขับเคลื่อนโดย Geisterhand ทดสอบ UI อัตโนมัติบนทั้ง 6 แพลตฟอร์ม รู้ว่าแอปของคุณทำงานได้ทุกที่ก่อนที่ผู้ใช้จะบอกคุณว่ามันใช้ไม่ได้
ฟรีสำหรับโปรเจกต์โอเพนซอร์ส แพลนสำหรับทีม → /publish
มันทำงานอย่างไร
จากซอร์สโค้ด TypeScript เป็นไฟล์ปฏิบัติการเนทีฟในไม่กี่วินาที
lift
อยากรู้ว่าคอมไพเลอร์ทำงานภายในอย่างไร? โครงสร้างภายในคอมไพเลอร์