360 Secure SkillHub
360 安全技能中心

Perryts

Perry TypeScript-to-native 编译器使用参考:编译/运行/开发命令、跨平台目标、perry.toml 配置、标准库(HTTP、数据库、加密、工具)、多线程、原生 UI 组件、系统 API、主屏 Widgets、国际化、插件与自动更新及 CLI 说明;内容为 9 份 Markdown 参考文档,未附脚本或二进制。

分类:开发
zhenyangze
zhenyangze
热度 9.83
最近更新 2026-07-08 02:55:24

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add zhenyangze/perryts-skill
兼容性
通用兼容
联网要求
联网要求未确认
数据出网
数据出网未确认
Metadata
name
perryts
description
Perry TypeScript-to-native compiler skill. Use when working with the Perry compiler, Perry projects, or TypeScript code that compiles to native executables. Covers: compile/run/dev commands, cross-compilation targets (macOS/iOS/Android/HarmonyOS/Windows/Linux/Web), perry.toml configuration, Standard Library (npm packages compiled natively), Multi-Threading (parallelMap/spawn), Native UI widgets (VStack/HStack/State), System APIs, Widgets (home screen), Internationalization, Auto-Update, Plugins, and CLI reference. Triggers on: "perry compile", "perry run", perry.toml, perry/ui, perry/system, perry/thread, perry/i18n, perry/media, perry/updater, perry/tui, native UI, cross-compilation, HarmonyOS target, ArkUI codegen.

Perry TypeScript-to-Native Compiler

Perry compiles TypeScript directly to native executables via HIR → LLVM codegen. No VM, no runtime interpreter.

Quick Start

perry init my-app && cd my-app
perry run src/main.ts                     # Compile + run
perry compile src/main.ts -o app          # Build native binary
perry dev src/main.ts                     # Watch mode

Cross-Compilation

perry compile src/main.ts --target ios-simulator -o app
perry compile src/main.ts --target android -o app.apk
perry compile src/main.ts --target harmonyos
perry compile src/main.ts --target web -o dist/

Key Imports

import { VStack, HStack, Text, Button, state } from "perry/ui"
import { parallelMap, spawn } from "perry/thread"
import { openURL, isDarkMode, keychainSave } from "perry/system"
import { i18n } from "perry/i18n"
import { createPlayer, play, setNowPlaying } from "perry/media"
import { Box, Text, render } from "perry/tui"
import { checkForUpdate, installUpdate } from "perry/updater"

Reference Documentation

Load these as needed for detailed API docs, configuration, and examples:

  • CLI & Configuration — All 11 CLI commands, compilation targets, global flags, perry.toml sections, environment variables, CI/CD integration
  • Standard Library — HTTP (fastify/fetch/axios/ws), Database (sqlite/mysql2/pg/mongodb/redis), Crypto (bcrypt/argon2/jwt/ethers), File System, Utilities (lodash/dayjs/uuid/commander), Media (sharp/cheerio/zlib/cron), binary size table
  • Multi-Threading — parallelMap, parallelFilter, spawn, capture rules, safety model, architecture
  • Native UI — Layout widgets, 14+ widget types, inline StyleProps, State & reactivity, events, Canvas, Menus & Dialogs, multi-window, Table, Animation, Geisterhand testing API, platform support matrix
  • Platforms — All 10 targets (macOS/iOS/visionOS/tvOS/watchOS/Android/HarmonyOS/Windows/Linux/Web), per-platform build commands and architecture
  • Internationalization — i18n.t(), CLDR plural rules, format wrappers (Currency/Percent/ShortDate), perry.toml [i18n] config, compile-time validation
  • System APIs — openURL, isDarkMode, preferences, keychain, notifications (local + push), audio capture, media playback, clipboard, environment variables
  • Widgets (Home Screen) — Widget() declaration, entryFields, family-specific rendering, timeline provider, platform notes
  • Plugins & Auto-Update — PluginApi, hook modes (filter/action/waterfall), FFI, plugin discovery, manifest schema v2, Ed25519 signing

Common Patterns

Native App

import { App, VStack, Text, Button, state } from "perry/ui"

const count = state(0)

App({
  body: VStack([
    count.text(),
    Button("+", () => count.set(count.get() + 1))
  ])
})

HTTP Server

import Fastify from "fastify"

const server = Fastify()
server.get("/", async () => ({ hello: "perry" }))
server.listen({ port: 3000 })

Parallel Processing

import { parallelMap } from "perry/thread"

const results = parallelMap([1, 2, 3, 4], (n) => n * 2)
// [2, 4, 6, 8]