@perryts/perry 0.0.1-bootstrap → 0.5.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +45 -5
- package/bin/perry.js +89 -0
- package/package.json +39 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Perry Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,9 +1,49 @@
|
|
|
1
1
|
# @perryts/perry
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Native TypeScript compiler. Compiles TypeScript source code directly to native executables via LLVM — no VM, no JIT warmup, no Node at runtime.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
[Trusted Publishers / OIDC](https://docs.npmjs.com/trusted-publishers).
|
|
7
|
-
For the real entry point, install [`@perryts/perry`](https://www.npmjs.com/package/@perryts/perry).
|
|
5
|
+
## Install
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @perryts/perry
|
|
9
|
+
# or one-shot
|
|
10
|
+
npx @perryts/perry compile hello.ts -o hello && ./hello
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Installing picks the right prebuilt binary for your platform automatically — `@perryts/perry` declares per-platform packages as `optionalDependencies` and npm (≥8.12) selects the matching one based on `os` / `cpu` / `libc`.
|
|
14
|
+
|
|
15
|
+
## Supported platforms
|
|
16
|
+
|
|
17
|
+
| Platform | Package |
|
|
18
|
+
|---|---|
|
|
19
|
+
| macOS arm64 (Apple Silicon) | `@perryts/perry-darwin-arm64` |
|
|
20
|
+
| macOS x64 (Intel) | `@perryts/perry-darwin-x64` |
|
|
21
|
+
| Linux x64 (glibc) | `@perryts/perry-linux-x64` |
|
|
22
|
+
| Linux arm64 (glibc) | `@perryts/perry-linux-arm64` |
|
|
23
|
+
| Linux x64 (musl / Alpine) | `@perryts/perry-linux-x64-musl` |
|
|
24
|
+
| Linux arm64 (musl / Alpine) | `@perryts/perry-linux-arm64-musl` |
|
|
25
|
+
| Windows x64 | `@perryts/perry-win32-x64` |
|
|
26
|
+
|
|
27
|
+
## Host requirements
|
|
28
|
+
|
|
29
|
+
Perry produces native binaries by linking its runtime and stdlib (shipped as static archives in the platform package) into your code. That link step uses your system C toolchain, so you need:
|
|
30
|
+
|
|
31
|
+
- **macOS** — Xcode Command Line Tools (`xcode-select --install`)
|
|
32
|
+
- **Linux** — `gcc` or `clang` (e.g. `apt install build-essential` on Debian/Ubuntu, `apk add build-base` on Alpine)
|
|
33
|
+
- **Windows** — MSVC / Visual Studio Build Tools with the C++ workload
|
|
34
|
+
|
|
35
|
+
Node.js 16 or later is required for the wrapper itself.
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
perry compile file.ts -o out # compile to native binary
|
|
41
|
+
perry --version # print version
|
|
42
|
+
perry --help # full CLI reference
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Links
|
|
46
|
+
|
|
47
|
+
- Repository: https://github.com/PerryTS/perry
|
|
48
|
+
- Issues: https://github.com/PerryTS/perry/issues
|
|
49
|
+
- Changelog: https://github.com/PerryTS/perry/blob/main/CHANGELOG.md
|
package/bin/perry.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Wrapper that resolves the platform-specific @perryts/perry-* binary and
|
|
3
|
+
// execs it with stdio inherited + argv passed through. Keeps the installed
|
|
4
|
+
// @perryts/perry package tiny (this script) while the native bits live in
|
|
5
|
+
// optional-dependency packages that npm picks by os/cpu/libc.
|
|
6
|
+
|
|
7
|
+
const { spawn } = require("child_process");
|
|
8
|
+
|
|
9
|
+
const PLATFORM_PACKAGES = {
|
|
10
|
+
"darwin-arm64": "@perryts/perry-darwin-arm64",
|
|
11
|
+
"darwin-x64": "@perryts/perry-darwin-x64",
|
|
12
|
+
"linux-arm64": "@perryts/perry-linux-arm64",
|
|
13
|
+
"linux-arm64-musl": "@perryts/perry-linux-arm64-musl",
|
|
14
|
+
"linux-x64": "@perryts/perry-linux-x64",
|
|
15
|
+
"linux-x64-musl": "@perryts/perry-linux-x64-musl",
|
|
16
|
+
"win32-x64": "@perryts/perry-win32-x64",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function isMusl() {
|
|
20
|
+
if (process.platform !== "linux") return false;
|
|
21
|
+
try {
|
|
22
|
+
const header = process.report && process.report.getReport().header;
|
|
23
|
+
if (header && "glibcVersionRuntime" in header) {
|
|
24
|
+
return !header.glibcVersionRuntime;
|
|
25
|
+
}
|
|
26
|
+
} catch (_) {}
|
|
27
|
+
try {
|
|
28
|
+
const release = require("fs").readFileSync("/etc/os-release", "utf8");
|
|
29
|
+
return /\bID=alpine\b|\bmusl\b/i.test(release);
|
|
30
|
+
} catch (_) {}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function detectKey() {
|
|
35
|
+
let key = `${process.platform}-${process.arch}`;
|
|
36
|
+
if (process.platform === "linux" && isMusl()) key += "-musl";
|
|
37
|
+
return key;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const key = detectKey();
|
|
41
|
+
const pkg = PLATFORM_PACKAGES[key];
|
|
42
|
+
if (!pkg) {
|
|
43
|
+
console.error(
|
|
44
|
+
`[perry] No prebuilt binary for ${key}.\n` +
|
|
45
|
+
`Supported: ${Object.keys(PLATFORM_PACKAGES).join(", ")}\n` +
|
|
46
|
+
`File an issue: https://github.com/PerryTS/perry/issues`
|
|
47
|
+
);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const binName = process.platform === "win32" ? "perry.exe" : "perry";
|
|
52
|
+
let binPath;
|
|
53
|
+
try {
|
|
54
|
+
binPath = require.resolve(`${pkg}/bin/${binName}`);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.error(
|
|
57
|
+
`[perry] The ${pkg} package is not installed.\n` +
|
|
58
|
+
`This usually means npm skipped the optional dependency for ${key}.\n` +
|
|
59
|
+
`Try: npm install --force ${pkg}\n` +
|
|
60
|
+
`Or reinstall @perryts/perry with a matching npm (\u22658.12) so os/cpu/libc selectors apply.\n` +
|
|
61
|
+
`Underlying error: ${err.message}`
|
|
62
|
+
);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const child = spawn(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
67
|
+
|
|
68
|
+
// Forward termination signals so Ctrl-C / supervisor kills propagate to perry.
|
|
69
|
+
for (const sig of ["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT"]) {
|
|
70
|
+
process.on(sig, () => {
|
|
71
|
+
try {
|
|
72
|
+
child.kill(sig);
|
|
73
|
+
} catch (_) {}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
child.on("close", (code, signal) => {
|
|
78
|
+
if (signal) {
|
|
79
|
+
// Re-raise so the parent shell sees the signal exit, not a plain 1.
|
|
80
|
+
process.kill(process.pid, signal);
|
|
81
|
+
} else {
|
|
82
|
+
process.exit(code == null ? 0 : code);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
child.on("error", (err) => {
|
|
87
|
+
console.error(`[perry] Failed to spawn ${binPath}: ${err.message}`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
package/package.json
CHANGED
|
@@ -1,13 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perryts/perry",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.107",
|
|
4
|
+
"description": "Native TypeScript compiler. Compiles TypeScript source directly to native executables via LLVM.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"perry": "bin/perry.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"@perryts/perry-darwin-arm64": "0.5.107",
|
|
15
|
+
"@perryts/perry-darwin-x64": "0.5.107",
|
|
16
|
+
"@perryts/perry-linux-x64": "0.5.107",
|
|
17
|
+
"@perryts/perry-linux-arm64": "0.5.107",
|
|
18
|
+
"@perryts/perry-linux-x64-musl": "0.5.107",
|
|
19
|
+
"@perryts/perry-linux-arm64-musl": "0.5.107",
|
|
20
|
+
"@perryts/perry-win32-x64": "0.5.107"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"typescript",
|
|
24
|
+
"compiler",
|
|
25
|
+
"native",
|
|
26
|
+
"llvm",
|
|
27
|
+
"aot",
|
|
28
|
+
"perry"
|
|
29
|
+
],
|
|
30
|
+
"author": "Perry Contributors",
|
|
5
31
|
"license": "MIT",
|
|
6
32
|
"repository": {
|
|
7
33
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/PerryTS/perry.git"
|
|
34
|
+
"url": "git+https://github.com/PerryTS/perry.git",
|
|
35
|
+
"directory": "npm/perry"
|
|
9
36
|
},
|
|
10
37
|
"homepage": "https://github.com/PerryTS/perry#readme",
|
|
11
|
-
"bugs": {
|
|
12
|
-
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/PerryTS/perry/issues"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=16"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
13
47
|
}
|