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

Get Started with Perry

From zero to a running native executable in three steps. Native output does not need Node.js or an external JavaScript engine on the target machine; Perry's runtime and GC are linked into it.

เริ่มต้น

ติดตั้ง 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 สำหรับการคอมไพล์เนทีฟ

Your first binary, step by step

Once Perry is installed, compiling TypeScript to a native executable is a single command. Write a file:

hello.ts
const name = process.argv[2] ?? "World";
console.log(`Hello, ${name}!`);

Compile it and run the result — the output is a self-contained machine-code binary, not a bundled script:

terminal

$ perry compile hello.ts

✓ Compiled executable: hello

$ ./hello Perry

Hello, Perry!

The published runtime-only hello-world measurement is about 3.2 ms on the documented Apple M-series test host. Real startup depends on the target, linked features, I/O, and hardware. Read more about how Perry compiles TypeScript to a binary or what happens inside the TypeScript native compiler.

Where to go next