scriptc 0.1.7 → 0.2.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 +8 -21
- package/bin/scriptc.exe +2 -0
- package/package.json +15 -6
- package/scripts/install-native.mjs +96 -0
- package/scripts/prepare-native.mjs +18 -0
- package/dist/bootstrap.d.ts +0 -2
- package/dist/bootstrap.js +0 -182
- package/dist/bootstrap.js.map +0 -1
- package/dist/legacy-c-warning.d.ts +0 -7
- package/dist/legacy-c-warning.js +0 -11
- package/dist/legacy-c-warning.js.map +0 -1
- package/dist/legacy-c-warning.test.d.ts +0 -1
- package/dist/legacy-c-warning.test.js +0 -19
- package/dist/legacy-c-warning.test.js.map +0 -1
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -391
- package/dist/main.js.map +0 -1
- package/dist/output-options.d.ts +0 -27
- package/dist/output-options.js +0 -73
- package/dist/output-options.js.map +0 -1
- package/dist/paths.d.ts +0 -19
- package/dist/paths.js +0 -77
- package/dist/paths.js.map +0 -1
- package/dist/usage.d.ts +0 -78
- package/dist/usage.js +0 -97
- package/dist/usage.js.map +0 -1
- package/dist/wasi-runner.d.ts +0 -2
- package/dist/wasi-runner.js +0 -28
- package/dist/wasi-runner.js.map +0 -1
- package/scripts/runtime-pack-host.d.mts +0 -5
- package/scripts/runtime-pack-host.mjs +0 -12
- package/scripts/warm-cache.mjs +0 -30
package/README.md
CHANGED
|
@@ -22,9 +22,11 @@ $ scriptc build fib.ts -o fib && ./fib
|
|
|
22
22
|
$ npm install -g scriptc
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
The installed compiler runs natively on supported macOS, Linux, and Windows hosts. Compilation, compile-time evaluation, and native execution do not require Node. `--emit=ir|llvm|asm|obj` uses the bundled TypeScript checker and LLVM helper without an external compiler, archiver, linker, or SDK. Executable builds additionally need a platform linker driver and SDK/sysroot; precompiled runtime packs supply the C runtime. Set `SCRIPTC_LINKER` to choose that driver. Runtime development with `--sanitize` additionally needs a C compiler. Node.js 24 or newer is needed for npm installation and `scriptc run` of WASI modules.
|
|
26
26
|
|
|
27
|
-
|
|
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.
|
|
28
|
+
|
|
29
|
+
Builds use a bounded persistent cache. Unchanged source can reuse the validated frontend result and LLVM program objects. Library identity getters occupy a separate LLVM module, so an identity change can reuse the large program object. Runtime objects come from the installed pack. Executable cache entries verify their native dependencies; FFI builds relink against current external inputs. Set `SCRIPTC_NO_CACHE=1` to bypass the cache or `SCRIPTC_CACHE_DIR` to select its location. An existing POSIX override must already be private.
|
|
28
30
|
|
|
29
31
|
## Commands
|
|
30
32
|
|
|
@@ -32,28 +34,13 @@ Builds use a bounded persistent cache by default. Exact unchanged library builds
|
|
|
32
34
|
- `scriptc run <file.ts>` — compile and run
|
|
33
35
|
- `scriptc coverage <file.ts>` — what compiles statically, and why the rest doesn't
|
|
34
36
|
|
|
35
|
-
`scriptc build app.ts --emit=ir|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
emission uses the matching helper on supported macOS, Linux, and Windows hosts
|
|
39
|
-
(and produces WASI artifacts when that target is selected).
|
|
40
|
-
Objects retain undefined `scr_*` runtime references plus the
|
|
41
|
-
`scr_runtime_abi_v1` compatibility marker; they are not library archives.
|
|
42
|
-
External consumption is experimental and requires the exact matching runtime.
|
|
43
|
-
`scriptc build app.ts --print=native-link-info -o app.o` prints the versioned
|
|
44
|
-
JSON target/runtime/link recipe without performing a link.
|
|
45
|
-
`--emit=asm|obj --sanitize` is rejected until ASan pipeline parity is
|
|
46
|
-
available.
|
|
47
|
-
|
|
48
|
-
For embedder-hosted modules that are not installed npm packages, coverage can
|
|
49
|
-
map an exact bare specifier to a local declaration with repeatable
|
|
50
|
-
`--external-types <specifier=file.d.ts>` options. This is analysis-only: the
|
|
51
|
-
types unblock application measurement, while runtime module uses remain
|
|
52
|
-
reported as blockers.
|
|
37
|
+
`scriptc build app.ts --emit=ir|llvm|asm|obj` selects serialized typed IR, textual LLVM IR, target assembly, or a relocatable program object as the one primary artifact. `--emit=exe` is the default. Assembly/object emission uses the matching helper on supported macOS, Linux, and Windows hosts (and produces WASI artifacts when that target is selected). Objects retain undefined `scr_*` runtime references plus the `scr_runtime_abi_v6` compatibility marker; they are not library archives. External consumption is experimental and requires the exact matching runtime. `scriptc build app.ts --print=native-link-info -o app.o` prints the versioned JSON target/runtime/link recipe without performing a link. `--emit=asm|obj --sanitize` is rejected until ASan pipeline parity is available.
|
|
38
|
+
|
|
39
|
+
For embedder-hosted modules that are not installed npm packages, coverage can map an exact bare specifier to a local declaration with repeatable `--external-types <specifier=file.d.ts>` options. This is analysis-only: the types unblock application measurement, while runtime module uses remain reported as blockers.
|
|
53
40
|
|
|
54
41
|
No annotations, no dialect, no special stdlib: the same TypeScript you run on Node, type-checked by the real TypeScript compiler. Programs outside the static tier can opt into `--dynamic`, which embeds a small JavaScript engine (~620KB) for the parts that can't be static; everything else fails the build with a specific error code and usually a rewrite hint.
|
|
55
42
|
|
|
56
|
-
WebAssembly is available as a production LLVM target: `
|
|
43
|
+
WebAssembly is available as a production LLVM target: `SCRIPTC_TARGET=wasm32-wasi scriptc build app.ts`. It emits a WASI Preview 1 `.wasm` module, and `scriptc run` supplies a WASI host. The complete executable language tier—including async, generators, timers, and `--dynamic`—is supported. APIs needing capabilities WASI P1 does not expose (network sockets/fetch, child processes, OS signals, and filesystem watching), sanitizer builds, and native FFI are rejected with `SC3002`. With `--lib --profile`, the target produces a callable Wasm reactor with named host imports and per-instance memory. See [WebAssembly Modules](https://scriptc.dev/wasm) for the embedding contract.
|
|
57
44
|
|
|
58
45
|
Native code can be called through an explicit, link-time C ABI manifest: declare the function signature in TypeScript, bind it to a C symbol, and build with `--ffi <manifest.json>`. See the [Native FFI guide](https://scriptc.dev/ffi).
|
|
59
46
|
|
package/bin/scriptc.exe
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scriptc",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Compile ordinary TypeScript and JavaScript to small, fast native executables — no Node, no V8, no JavaScript engine in the binary",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://scriptc.dev",
|
|
@@ -11,20 +11,29 @@
|
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
13
|
"bin": {
|
|
14
|
-
"scriptc": "
|
|
14
|
+
"scriptc": "bin/scriptc.exe"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"
|
|
17
|
+
"bin",
|
|
18
18
|
"scripts"
|
|
19
19
|
],
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=24"
|
|
22
22
|
},
|
|
23
|
-
"
|
|
24
|
-
"@scriptc/compiler": "0.1
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@scriptc/compiler": "0.2.1"
|
|
25
|
+
},
|
|
26
|
+
"optionalDependencies": {
|
|
27
|
+
"@scriptc/cli-darwin-x64": "0.2.1",
|
|
28
|
+
"@scriptc/cli-linux-x64-gnu": "0.2.1",
|
|
29
|
+
"@scriptc/cli-linux-arm64-musl": "0.2.1",
|
|
30
|
+
"@scriptc/cli-darwin-arm64": "0.2.1",
|
|
31
|
+
"@scriptc/cli-linux-arm64-gnu": "0.2.1",
|
|
32
|
+
"@scriptc/cli-linux-x64-musl": "0.2.1",
|
|
33
|
+
"@scriptc/cli-win32-x64-msvc": "0.2.1"
|
|
25
34
|
},
|
|
26
35
|
"scripts": {
|
|
27
36
|
"build": "node ../../node_modules/typescript/bin/tsc -p tsconfig.json",
|
|
28
|
-
"postinstall": "node scripts/
|
|
37
|
+
"postinstall": "node scripts/install-native.mjs"
|
|
29
38
|
}
|
|
30
39
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { constants, copyFileSync, chmodSync, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
export function nativeCliPackage(platform, architecture, libc) {
|
|
7
|
+
const host = `${platform}-${architecture}`;
|
|
8
|
+
if (host === "darwin-arm64" || host === "darwin-x64") return `@scriptc/cli-${host}`;
|
|
9
|
+
if (host === "win32-x64") return "@scriptc/cli-win32-x64-msvc";
|
|
10
|
+
if (host === "linux-x64" || host === "linux-arm64") {
|
|
11
|
+
if (libc !== "glibc" && libc !== "musl") throw new Error("could not identify the Linux C library");
|
|
12
|
+
return `@scriptc/cli-${host}-${libc === "musl" ? "musl" : "gnu"}`;
|
|
13
|
+
}
|
|
14
|
+
throw new Error(`scriptc has no native command for ${host}`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function hostLibc() {
|
|
18
|
+
if (process.platform !== "linux") return null;
|
|
19
|
+
const report = process.report.getReport();
|
|
20
|
+
if (report.header.glibcVersionRuntime) return "glibc";
|
|
21
|
+
if (report.sharedObjects.some((path) => /(?:^|\/)ld-musl-|libc\.musl-/.test(path))) return "musl";
|
|
22
|
+
// A statically linked Node has no loaded libc in its process report.
|
|
23
|
+
// Only select musl when its loader is present for this architecture.
|
|
24
|
+
const arch = process.arch === "arm64" ? "aarch64" : "x86_64";
|
|
25
|
+
return existsSync(`/lib/ld-musl-${arch}.so.1`) ? "musl" : null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function relocateToolchain(manifest, sourceDirectory, destinationDirectory) {
|
|
29
|
+
const relocated = { ...manifest };
|
|
30
|
+
const pathFrom = (value) => relative(destinationDirectory, resolve(sourceDirectory, value));
|
|
31
|
+
for (const name of ["ts7", "llvm_package", "runtime_pack", "runtime_sources", "declarations", "comptime", "wasi_node_runner"]) {
|
|
32
|
+
if (typeof relocated[name] === "string") relocated[name] = pathFrom(relocated[name]);
|
|
33
|
+
}
|
|
34
|
+
for (const name of ["linker", "dsymutil", "archiver", "relocatable_linker"]) {
|
|
35
|
+
const value = relocated[name];
|
|
36
|
+
if (typeof value === "string" && !isAbsolute(value) && /[/\\]/.test(value)) relocated[name] = pathFrom(value);
|
|
37
|
+
}
|
|
38
|
+
if (relocated.runtime_packs) relocated.runtime_packs = relocated.runtime_packs.map((pack) => ({ ...pack, path: pathFrom(pack.path) }));
|
|
39
|
+
return relocated;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function installNativeCli(directory, packageName = nativeCliPackage(process.platform, process.arch, hostLibc())) {
|
|
43
|
+
directory = realpathSync(directory);
|
|
44
|
+
const require = createRequire(join(directory, "package.json"));
|
|
45
|
+
const packageManifest = JSON.parse(readFileSync(join(directory, "package.json"), "utf8"));
|
|
46
|
+
const version = packageManifest.version;
|
|
47
|
+
let platformManifest;
|
|
48
|
+
try { platformManifest = require.resolve(`${packageName}/package.json`); }
|
|
49
|
+
catch { throw new Error(`scriptc requires ${packageName}@${version}; reinstall with optional dependencies enabled`); }
|
|
50
|
+
const identity = JSON.parse(readFileSync(platformManifest, "utf8"));
|
|
51
|
+
if (identity.name !== packageName || identity.version !== version) throw new Error(`scriptc requires ${packageName}@${version}, found ${identity.version}`);
|
|
52
|
+
const sourceDirectory = join(dirname(platformManifest), "dist", "bin");
|
|
53
|
+
const source = join(sourceDirectory, process.platform === "win32" ? "scriptc.exe" : "scriptc");
|
|
54
|
+
const original = JSON.parse(readFileSync(source + ".json", "utf8"));
|
|
55
|
+
if (original.schema !== "scriptc.native-toolchain.v1" || original.compiler_version !== version) throw new Error("native compiler toolchain version does not match this installation");
|
|
56
|
+
const bin = join(directory, "bin");
|
|
57
|
+
mkdirSync(bin, { recursive: true });
|
|
58
|
+
const manifest = relocateToolchain(original, sourceDirectory, bin);
|
|
59
|
+
// npm normalizes modes for payloads outside package bin entries. These
|
|
60
|
+
// tools are launched directly by the compiler after installation.
|
|
61
|
+
if (process.platform !== "win32") {
|
|
62
|
+
for (const path of [manifest.ts7, manifest.comptime, join(manifest.llvm_package, "bin/scriptc-llvm-codegen")]) {
|
|
63
|
+
chmodSync(resolve(bin, path), 0o755);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// The common filename lets npm's Windows shim invoke a native executable.
|
|
67
|
+
// POSIX bin links also execute this file directly, without a JS launcher.
|
|
68
|
+
const destination = join(bin, "scriptc.exe");
|
|
69
|
+
const staged = destination + `.install-${process.pid}`;
|
|
70
|
+
try {
|
|
71
|
+
copyFileSync(source, staged, constants.COPYFILE_FICLONE);
|
|
72
|
+
chmodSync(staged, 0o755);
|
|
73
|
+
writeFileSync(staged + ".json", JSON.stringify(manifest, null, 2) + "\n");
|
|
74
|
+
renameSync(staged + ".json", destination + ".json");
|
|
75
|
+
renameSync(staged, destination);
|
|
76
|
+
} finally {
|
|
77
|
+
rmSync(staged, { force: true });
|
|
78
|
+
rmSync(staged + ".json", { force: true });
|
|
79
|
+
}
|
|
80
|
+
return destination;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
84
|
+
try {
|
|
85
|
+
const directory = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
86
|
+
const manifest = JSON.parse(readFileSync(join(directory, "package.json"), "utf8"));
|
|
87
|
+
// A source checkout builds the native distribution separately. pnpm pack
|
|
88
|
+
// replaces workspace ranges with release versions before publication.
|
|
89
|
+
const workspace = Object.values(manifest.optionalDependencies ?? {}).some((value) => String(value).startsWith("workspace:"));
|
|
90
|
+
if (!workspace) installNativeCli(directory);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
process.stderr.write(`scriptc: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
94
|
+
process.exitCode = 1;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
export function prepareNativeCommand(directory) {
|
|
6
|
+
const bin = join(directory, "bin");
|
|
7
|
+
mkdirSync(bin, { recursive: true });
|
|
8
|
+
// npm creates bin links before postinstall. The payload must exist in the
|
|
9
|
+
// tarball, and no shebang may pin the Windows shim to an interpreter.
|
|
10
|
+
// Installation replaces this placeholder with the platform executable.
|
|
11
|
+
writeFileSync(join(bin, "scriptc.exe"),
|
|
12
|
+
"echo 'scriptc: native installation is incomplete; enable install scripts and reinstall scriptc' >&2\nexit 1\n", { mode: 0o755 });
|
|
13
|
+
rmSync(join(bin, "scriptc.exe.json"), { force: true });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
17
|
+
prepareNativeCommand(resolve(dirname(fileURLToPath(import.meta.url)), ".."));
|
|
18
|
+
}
|
package/dist/bootstrap.d.ts
DELETED
package/dist/bootstrap.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { spawn } from "node:child_process";
|
|
3
|
-
import { readFile, rm } from "node:fs/promises";
|
|
4
|
-
import { enableCompileCache } from "node:module";
|
|
5
|
-
import { basename, dirname, join, resolve } from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { parseArgs } from "node:util";
|
|
8
|
-
import { LEGACY_C_EXECUTABLE_WARNING, shouldWarnLegacyCExecutable } from "./legacy-c-warning.js";
|
|
9
|
-
import { CLI_OPTIONS, USAGE } from "./usage.js";
|
|
10
|
-
// Node 24 can persist V8's compiled module bytecode. scriptc's CLI imports
|
|
11
|
-
// the compiler and its lowering/backend graph before handling any command, so
|
|
12
|
-
// enabling this in the tiny bootstrap avoids reparsing that graph on every
|
|
13
|
-
// edit/build invocation.
|
|
14
|
-
try {
|
|
15
|
-
enableCompileCache();
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
// Bytecode caching is an optimization boundary. A read-only temp directory
|
|
19
|
-
// must never prevent the compiler from running.
|
|
20
|
-
}
|
|
21
|
-
function packageVersion() {
|
|
22
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
23
|
-
try {
|
|
24
|
-
return JSON.parse(requireText(join(here, "..", "package.json"))).version ?? "unknown";
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return "unknown";
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function requireText(path) {
|
|
31
|
-
// This tiny synchronous read keeps --version free of the compiler graph and
|
|
32
|
-
// preserves the package manifest as the one release-version authority.
|
|
33
|
-
const { readFileSync } = process.getBuiltinModule("node:fs");
|
|
34
|
-
return readFileSync(path, "utf8");
|
|
35
|
-
}
|
|
36
|
-
async function tryFastPath() {
|
|
37
|
-
let parsed;
|
|
38
|
-
try {
|
|
39
|
-
parsed = parseArgs({ options: CLI_OPTIONS, allowPositionals: true, allowNegative: true });
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return null; // main owns exact user-error wording
|
|
43
|
-
}
|
|
44
|
-
const { values, positionals } = parsed;
|
|
45
|
-
if (values.version) {
|
|
46
|
-
process.stdout.write(`${packageVersion()}\n`);
|
|
47
|
-
return 0;
|
|
48
|
-
}
|
|
49
|
-
if (values.help || positionals.length === 0) {
|
|
50
|
-
process.stdout.write(USAGE);
|
|
51
|
-
return values.help ? 0 : 1;
|
|
52
|
-
}
|
|
53
|
-
const [command, inputArg] = positionals;
|
|
54
|
-
if ((command !== "build" && command !== "run") || inputArg === undefined ||
|
|
55
|
-
(values.emit !== undefined && values.emit !== "exe") ||
|
|
56
|
-
values.print !== undefined ||
|
|
57
|
-
values["emit-ir"] ||
|
|
58
|
-
values.lib || values["from-c"] || values["provenance-sources"] ||
|
|
59
|
-
(values["external-types"] ?? []).length > 0)
|
|
60
|
-
return null;
|
|
61
|
-
const backend = values.backend;
|
|
62
|
-
if (backend !== undefined && backend !== "c" && backend !== "llvm")
|
|
63
|
-
return null;
|
|
64
|
-
const optimization = values.optimization;
|
|
65
|
-
if (optimization !== undefined && optimization !== "release" && optimization !== "dev")
|
|
66
|
-
return null;
|
|
67
|
-
const npmRaw = (values["npm-static"] ?? [])
|
|
68
|
-
.flatMap((value) => value.split(","))
|
|
69
|
-
.map((value) => value.trim())
|
|
70
|
-
.filter((value) => value !== "");
|
|
71
|
-
let npmStatic = null;
|
|
72
|
-
if (npmRaw.includes("auto")) {
|
|
73
|
-
if (npmRaw.length !== 1)
|
|
74
|
-
return null;
|
|
75
|
-
npmStatic = "auto";
|
|
76
|
-
}
|
|
77
|
-
else if (npmRaw.length > 0) {
|
|
78
|
-
npmStatic = npmRaw;
|
|
79
|
-
}
|
|
80
|
-
let startup;
|
|
81
|
-
let buildPlatform;
|
|
82
|
-
try {
|
|
83
|
-
startup = await import("@scriptc/compiler/startup-cache");
|
|
84
|
-
buildPlatform = startup.configuredTargetPlatform();
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
if (command === "run" && buildPlatform === "wasi")
|
|
90
|
-
return null;
|
|
91
|
-
const input = resolve(inputArg);
|
|
92
|
-
const outDir = values.out ? dirname(resolve(values.out)) : join(dirname(input), ".scriptc");
|
|
93
|
-
const stem = basename(input).replace(/\.(ts|mts|cts|js|mjs|cjs|c|ll)$/, "");
|
|
94
|
-
const defaultName = buildPlatform === "win32"
|
|
95
|
-
? `${stem}.exe`
|
|
96
|
-
: buildPlatform === "wasi"
|
|
97
|
-
? `${stem}.wasm`
|
|
98
|
-
: stem;
|
|
99
|
-
const outPath = values.out ? resolve(values.out) : join(outDir, defaultName);
|
|
100
|
-
const ffiPath = values.ffi === undefined ? null : resolve(values.ffi);
|
|
101
|
-
const ffiBytes = ffiPath === null ? null : await readFile(ffiPath).catch(() => null);
|
|
102
|
-
if (ffiPath !== null && ffiBytes === null)
|
|
103
|
-
return null;
|
|
104
|
-
const root = await startup.prepareBuildCacheRoot(startup.resolveBuildCacheRoot());
|
|
105
|
-
// This must exactly mirror the ordinary LLVM executable's route in the
|
|
106
|
-
// full compiler. Otherwise a valid helper/runtime-pack cache entry has a
|
|
107
|
-
// different target/compiler identity and bootstrap must unnecessarily load
|
|
108
|
-
// the whole compiler graph to rediscover it.
|
|
109
|
-
const helperRuntimePackTarget = backend !== "c" && !values.sanitize
|
|
110
|
-
? startup.precompiledRuntimePackTarget()
|
|
111
|
-
: null;
|
|
112
|
-
const helperObjectRoute = helperRuntimePackTarget !== null;
|
|
113
|
-
let nativeEnvironment;
|
|
114
|
-
try {
|
|
115
|
-
nativeEnvironment = helperObjectRoute
|
|
116
|
-
? await startup.executableLinkerEnvironmentFingerprint(process.env, helperRuntimePackTarget.defaultLinker)
|
|
117
|
-
: await startup.executableNativeEnvironmentFingerprint();
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
nativeEnvironment = null;
|
|
121
|
-
}
|
|
122
|
-
if (nativeEnvironment === null)
|
|
123
|
-
return null;
|
|
124
|
-
const hit = await startup.readRoutedExecutableCache(root, {
|
|
125
|
-
entryPath: input,
|
|
126
|
-
outDir,
|
|
127
|
-
outPath,
|
|
128
|
-
emitIr: values["emit-ir"],
|
|
129
|
-
sanitize: values.sanitize,
|
|
130
|
-
dynamic: values.dynamic,
|
|
131
|
-
backend: backend ?? "auto",
|
|
132
|
-
...(optimization === "dev" ? { optimization: "dev" } : {}),
|
|
133
|
-
...(values.strip ? { strip: true } : {}),
|
|
134
|
-
npmStatic,
|
|
135
|
-
ffiProfile: ffiPath === null ? null : { path: ffiPath, bytes: ffiBytes },
|
|
136
|
-
target: `${process.env["SCRIPTC_TARGET"] ?? "native"}:${buildPlatform}:${process.arch}:${helperObjectRoute ? "runtime-pack" : "driver-tu"}`,
|
|
137
|
-
compiler: [helperObjectRoute
|
|
138
|
-
? startup.resolvePlatformLinker(process.env, helperRuntimePackTarget.defaultLinker)
|
|
139
|
-
: (process.env["SCRIPTC_CC"] ?? "clang")],
|
|
140
|
-
nativeEnvironment,
|
|
141
|
-
nodeVersion: process.version,
|
|
142
|
-
});
|
|
143
|
-
if (hit === null)
|
|
144
|
-
return null;
|
|
145
|
-
if (shouldWarnLegacyCExecutable({
|
|
146
|
-
executable: true,
|
|
147
|
-
fromC: false,
|
|
148
|
-
backend,
|
|
149
|
-
sanitize: values.sanitize,
|
|
150
|
-
})) {
|
|
151
|
-
process.stderr.write(LEGACY_C_EXECUTABLE_WARNING);
|
|
152
|
-
}
|
|
153
|
-
if (hit.native.llvmRefusal !== undefined) {
|
|
154
|
-
process.stderr.write(`scriptc: backend c (llvm refused: ${hit.native.llvmRefusal})\n`);
|
|
155
|
-
}
|
|
156
|
-
if (!values["keep-c"])
|
|
157
|
-
await rm(hit.cPath, { force: true });
|
|
158
|
-
if (command === "build") {
|
|
159
|
-
process.stdout.write(`${outPath}\n`);
|
|
160
|
-
return 0;
|
|
161
|
-
}
|
|
162
|
-
return new Promise((resolveExit) => {
|
|
163
|
-
const child = spawn(outPath, [], { stdio: "inherit" });
|
|
164
|
-
child.on("exit", (code, signal) => {
|
|
165
|
-
if (signal) {
|
|
166
|
-
process.stderr.write(`scriptc: program killed by ${signal}\n`);
|
|
167
|
-
resolveExit(1);
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
resolveExit(code ?? 0);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
const fastExit = await tryFastPath();
|
|
176
|
-
if (fastExit === null) {
|
|
177
|
-
await import("./main.js");
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
process.exitCode = fastExit;
|
|
181
|
-
}
|
|
182
|
-
//# sourceMappingURL=bootstrap.js.map
|
package/dist/bootstrap.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEhD,2EAA2E;AAC3E,8EAA8E;AAC9E,2EAA2E;AAC3E,yBAAyB;AACzB,IAAI,CAAC;IACH,kBAAkB,EAAE,CAAC;AACvB,CAAC;AAAC,MAAM,CAAC;IACP,2EAA2E;IAC3E,gDAAgD;AAClD,CAAC;AAED,SAAS,cAAc;IACrB,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,IAAI,CAAC;QACH,OAAQ,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAA0B,CAAC,OAAO,IAAI,SAAS,CAAC;IAClH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,4EAA4E;IAC5E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AO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACrC,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,IAAI,OAAO,CAAS,CAAC,WAAW,EAAE,EAAE;QACzC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACvD,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YAChC,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,MAAM,IAAI,CAAC,CAAC;gBAC/D,WAAW,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC;iBAAM,CAAC;gBACN,WAAW,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,QAAQ,GAAG,MAAM,WAAW,EAAE,CAAC;AACrC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;IACtB,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;AAC5B,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC9B,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const LEGACY_C_EXECUTABLE_WARNING: string;
|
|
2
|
-
export declare function shouldWarnLegacyCExecutable(options: {
|
|
3
|
-
executable: boolean;
|
|
4
|
-
fromC: boolean;
|
|
5
|
-
backend: "c" | "llvm" | undefined;
|
|
6
|
-
sanitize: boolean;
|
|
7
|
-
}, env?: NodeJS.ProcessEnv, runtimePackHost?: boolean): boolean;
|
package/dist/legacy-c-warning.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { hostSupportsRuntimePack } from "../scripts/runtime-pack-host.mjs";
|
|
2
|
-
export const LEGACY_C_EXECUTABLE_WARNING = "scriptc: warning: SCRIPTC_CC selects the deprecated legacy C executable path on macOS arm64; " +
|
|
3
|
-
"unset it to use the bundled LLVM helper/runtime pack, or use SCRIPTC_LINKER to select the platform linker driver\n";
|
|
4
|
-
export function shouldWarnLegacyCExecutable(options, env = process.env, runtimePackHost = hostSupportsRuntimePack()) {
|
|
5
|
-
return options.executable && !options.fromC &&
|
|
6
|
-
options.backend !== "c" && !options.sanitize &&
|
|
7
|
-
(env["SCRIPTC_TARGET"] ?? "") === "" &&
|
|
8
|
-
runtimePackHost &&
|
|
9
|
-
env["SCRIPTC_CC"] !== undefined && env["SCRIPTC_CC"] !== "";
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=legacy-c-warning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-c-warning.js","sourceRoot":"","sources":["../src/legacy-c-warning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,CAAC,MAAM,2BAA2B,GACtC,+FAA+F;IAC/F,oHAAoH,CAAC;AAEvH,MAAM,UAAU,2BAA2B,CAAC,OAK3C,EAAE,MAAyB,OAAO,CAAC,GAAG,EAAE,eAAe,GAAG,uBAAuB,EAAE;IAClF,OAAO,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,KAAK;QACzC,OAAO,CAAC,OAAO,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ;QAC5C,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE;QACpC,eAAe;QACf,GAAG,CAAC,YAAY,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import { shouldWarnLegacyCExecutable } from "./legacy-c-warning.js";
|
|
3
|
-
const executable = {
|
|
4
|
-
executable: true,
|
|
5
|
-
fromC: false,
|
|
6
|
-
backend: undefined,
|
|
7
|
-
sanitize: false,
|
|
8
|
-
};
|
|
9
|
-
test("warns only for generated legacy C executables on runtime-pack hosts", () => {
|
|
10
|
-
expect(shouldWarnLegacyCExecutable(executable, { SCRIPTC_CC: "clang" }, true)).toBe(true);
|
|
11
|
-
expect(shouldWarnLegacyCExecutable({ ...executable, fromC: true }, { SCRIPTC_CC: "clang" }, true)).toBe(false);
|
|
12
|
-
expect(shouldWarnLegacyCExecutable({ ...executable, backend: "c" }, { SCRIPTC_CC: "clang" }, true)).toBe(false);
|
|
13
|
-
expect(shouldWarnLegacyCExecutable({ ...executable, sanitize: true }, { SCRIPTC_CC: "clang" }, true)).toBe(false);
|
|
14
|
-
expect(shouldWarnLegacyCExecutable({ ...executable, executable: false }, { SCRIPTC_CC: "clang" }, true)).toBe(false);
|
|
15
|
-
expect(shouldWarnLegacyCExecutable(executable, { SCRIPTC_CC: "clang", SCRIPTC_TARGET: "wasm32-wasi" }, true)).toBe(false);
|
|
16
|
-
expect(shouldWarnLegacyCExecutable(executable, { SCRIPTC_CC: "" }, true)).toBe(false);
|
|
17
|
-
expect(shouldWarnLegacyCExecutable(executable, { SCRIPTC_CC: "clang" }, false)).toBe(false);
|
|
18
|
-
});
|
|
19
|
-
//# sourceMappingURL=legacy-c-warning.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-c-warning.test.js","sourceRoot":"","sources":["../src/legacy-c-warning.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEpE,MAAM,UAAU,GAAG;IACjB,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,S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