scriptc 0.2.10 → 0.3.1
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/README.md +21 -14
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# scriptc
|
|
2
2
|
|
|
3
|
-
Compile
|
|
3
|
+
Compile TypeScript and JavaScript to native executables or WASI WebAssembly modules that run without Node.js installed.
|
|
4
4
|
|
|
5
5
|
```console
|
|
6
6
|
$ cat fib.ts
|
|
@@ -12,36 +12,43 @@ console.log(fib(30));
|
|
|
12
12
|
$ scriptc run fib.ts
|
|
13
13
|
832040
|
|
14
14
|
|
|
15
|
-
$ scriptc build fib.ts -o fib && ./fib
|
|
15
|
+
$ scriptc build fib.ts -o fib >/dev/null && ./fib
|
|
16
16
|
832040
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
scriptc compiles the same TypeScript you run on Node.js, type-checked by the TypeScript compiler. npm packages your program imports compile along with it. Code scriptc can't compile fails the build with an error code and, where available, a rewrite hint.
|
|
20
|
+
|
|
21
|
+
scriptc is experimental. See the [limitations](https://scriptc.dev/docs/limitations) and the [Node.js compatibility reference](https://scriptc.dev/compatibility).
|
|
22
|
+
|
|
19
23
|
## Install
|
|
20
24
|
|
|
21
25
|
```console
|
|
22
26
|
$ npm install -g scriptc
|
|
23
27
|
```
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
The native compiler includes its host runtime pack. Cross-compilation uses additional `@scriptc/runtime-<target>` packages installed in your project at the same version as `scriptc --version`. WASI builds use `@scriptc/runtime-wasm32-wasi`, for example. Run the compiler from that project or set `SCRIPTC_RUNTIME_PACK` to the pack directory. Linux GNU distributions require glibc 2.34 or newer.
|
|
29
|
+
npm installs the native compiler for your platform (macOS, Linux, or Windows). Node.js 24 or later is needed to install it and to run WASI modules with `scriptc run`; compiling and running executables doesn't need Node.js.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
Building executables needs a linker and the platform SDK or sysroot, such as the Xcode Command Line Tools on macOS. Set `SCRIPTC_LINKER` to choose the linker driver. `--emit=ir|llvm|asm|obj` needs no external tools. See the [quickstart](https://scriptc.dev/docs/quickstart) for details.
|
|
30
32
|
|
|
31
33
|
## Commands
|
|
32
34
|
|
|
33
|
-
- `scriptc build <file.ts
|
|
34
|
-
- `scriptc run <file.ts
|
|
35
|
-
- `scriptc coverage <file.ts
|
|
35
|
+
- `scriptc build <file.ts>`: compile to a native executable or another artifact selected with `--emit`.
|
|
36
|
+
- `scriptc run <file.ts>`: compile and run.
|
|
37
|
+
- `scriptc coverage <file.ts>`: report what compiles, and explain what doesn't.
|
|
38
|
+
- `scriptc build --lib --profile <profile.json>`: compile a static library, or a Wasm reactor on `wasm32-wasi`.
|
|
39
|
+
|
|
40
|
+
See the [CLI reference](https://scriptc.dev/docs/cli) for every option.
|
|
41
|
+
|
|
42
|
+
## Cross-compilation and WebAssembly
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
Set `SCRIPTC_TARGET` to build for another platform, for example `SCRIPTC_TARGET=aarch64-linux-gnu.2.36` or `SCRIPTC_TARGET=wasm32-wasi`. Install the matching `@scriptc/runtime-<target>` package in your project, at the same version as `scriptc --version`, or set `SCRIPTC_RUNTIME_PACK` to a runtime pack directory. See [platform support](https://scriptc.dev/docs/platforms) and [WebAssembly modules](https://scriptc.dev/docs/wasm).
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
## Native code
|
|
40
47
|
|
|
41
|
-
|
|
48
|
+
Call C functions by declaring their signatures in TypeScript and binding them to C symbols in a manifest passed with `--ffi <manifest.json>`. See the [Native FFI guide](https://scriptc.dev/docs/ffi).
|
|
42
49
|
|
|
43
|
-
|
|
50
|
+
## Build cache
|
|
44
51
|
|
|
45
|
-
|
|
52
|
+
Builds reuse a bounded persistent cache. Set `SCRIPTC_NO_CACHE=1` to bypass it or `SCRIPTC_CACHE_DIR` to choose its location.
|
|
46
53
|
|
|
47
54
|
Docs: [scriptc.dev](https://scriptc.dev)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scriptc",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Compile ordinary TypeScript and JavaScript to small, fast native executables
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Compile ordinary TypeScript and JavaScript to small, fast native executables and WebAssembly modules that run without Node.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://scriptc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"node": ">=24"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@scriptc/compiler": "0.
|
|
24
|
+
"@scriptc/compiler": "0.3.1"
|
|
25
25
|
},
|
|
26
26
|
"optionalDependencies": {
|
|
27
|
-
"@scriptc/cli-darwin-arm64": "0.
|
|
28
|
-
"@scriptc/cli-linux-arm64-gnu": "0.
|
|
29
|
-
"@scriptc/cli-
|
|
30
|
-
"@scriptc/cli-
|
|
31
|
-
"@scriptc/cli-linux-x64-gnu": "0.
|
|
32
|
-
"@scriptc/cli-
|
|
33
|
-
"@scriptc/cli-
|
|
27
|
+
"@scriptc/cli-darwin-arm64": "0.3.1",
|
|
28
|
+
"@scriptc/cli-linux-arm64-gnu": "0.3.1",
|
|
29
|
+
"@scriptc/cli-darwin-x64": "0.3.1",
|
|
30
|
+
"@scriptc/cli-linux-arm64-musl": "0.3.1",
|
|
31
|
+
"@scriptc/cli-linux-x64-gnu": "0.3.1",
|
|
32
|
+
"@scriptc/cli-linux-x64-musl": "0.3.1",
|
|
33
|
+
"@scriptc/cli-win32-x64-msvc": "0.3.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "node ../../node_modules/typescript/bin/tsc -p tsconfig.json",
|