@zuke-build/cli 2.10.0 → 2.12.0
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 +41 -10
- package/mod.d.ts +1 -0
- package/mod.js +10 -14
- package/package.json +1 -1
- package/src/binary_launcher.d.ts +2 -2
- package/src/binary_launcher.js +2 -2
- package/src/deno_isolated.js +3 -2
- package/src/deno_path.d.ts +49 -7
- package/src/deno_path.js +65 -24
- package/src/dispatch.d.ts +46 -63
- package/src/dispatch.js +83 -167
- package/src/node_path.d.ts +43 -0
- package/src/node_path.js +53 -0
- package/src/npm_path.d.ts +17 -4
- package/src/npm_path.js +14 -52
- package/src/project.js +5 -4
- package/src/runtime_install.d.ts +101 -0
- package/src/runtime_install.js +218 -0
- package/src/uv_path.d.ts +49 -0
- package/src/uv_path.js +83 -0
- package/src/uv_pin.d.ts +36 -0
- package/src/uv_pin.js +36 -0
- package/src/version.js +1 -1
package/src/uv_path.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Copyright (c) 2026 the Zuke contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
/**
|
|
4
|
+
* Finding the uv a Python build's worker runs with.
|
|
5
|
+
*
|
|
6
|
+
* `zuke setup --sdk python` writes `"sdk": { "command": ["uv", "run",
|
|
7
|
+
* "build.py"] }`, and uv then provides the Python interpreter and the `zuke`
|
|
8
|
+
* SDK itself. So uv is the one tool such a build needs on the machine. The
|
|
9
|
+
* engine asks {@link WorkerTasks.resolveProgram} for the program before it starts the
|
|
10
|
+
* worker: `uv` is the one on `PATH`, else the pinned uv `zuke` installs into
|
|
11
|
+
* `ZUKE_UV_HOME` (`~/.zuke/uv`), else that uv installed on the spot
|
|
12
|
+
* (`runtime_install.ts`). Any other program is left as `zuke.json` names it.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import { FileTasks, ProcessTasks } from "@zuke/core";
|
|
17
|
+
import { defaultDenoHost } from "./deno_path.js";
|
|
18
|
+
import { defaultRuntimeSetup, provisionUv, uvBinary, uvHome, } from "./runtime_install.js";
|
|
19
|
+
import { UV_PIN } from "./uv_pin.js";
|
|
20
|
+
/** Where to read about installing uv, named when none is found. */
|
|
21
|
+
export const UV_INSTALL_DOCS = "https://docs.astral.sh/uv/getting-started/installation/";
|
|
22
|
+
/** The program name a worker command starts with when uv runs it. */
|
|
23
|
+
const UV = "uv";
|
|
24
|
+
/** Thrown when a build's worker runs uv and none was found or installed. */
|
|
25
|
+
export class UvNotFoundError extends Error {
|
|
26
|
+
/** The error's name, as reported by `String(error)` and stack traces. */
|
|
27
|
+
name = "UvNotFoundError";
|
|
28
|
+
/** The executables that were looked for and not found, in the order tried. */
|
|
29
|
+
tried;
|
|
30
|
+
/**
|
|
31
|
+
* Build the failure from the candidates that were tried, in order.
|
|
32
|
+
*
|
|
33
|
+
* @param tried The executables that were looked for and not found.
|
|
34
|
+
*/
|
|
35
|
+
constructor(tried) {
|
|
36
|
+
super(`zuke: this build's sdk.command runs uv, and none was found — tried ` +
|
|
37
|
+
`${tried.join(", ")}. Install uv (${UV_INSTALL_DOCS}), or run zuke ` +
|
|
38
|
+
`again and let it install uv ${UV_PIN.version}.`);
|
|
39
|
+
this.tried = tried;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Whether `program` runs from `PATH`: it is spawned with `--version`, which
|
|
44
|
+
* leaves `PATHEXT` and the search itself to the OS, as the Node and Deno
|
|
45
|
+
* lookups do. A program that cannot start (missing, not executable) or fails
|
|
46
|
+
* `--version` cannot run the worker either, so it does not count.
|
|
47
|
+
*/
|
|
48
|
+
async function startsFromPath(program) {
|
|
49
|
+
try {
|
|
50
|
+
const child = ProcessTasks.spawn(program, (s) => s.args("--version").stdin("null").stdout("null").stderr("null"));
|
|
51
|
+
return (await child.status).code === 0;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** The real {@link WorkerProgramHost}. */
|
|
58
|
+
export const defaultWorkerProgramHost = {
|
|
59
|
+
host: defaultDenoHost,
|
|
60
|
+
onPath: startsFromPath,
|
|
61
|
+
exists: (path) => FileTasks.exists(path),
|
|
62
|
+
setup: defaultRuntimeSetup,
|
|
63
|
+
};
|
|
64
|
+
/** What starts a hosted build's worker: finding (or installing) its program. */
|
|
65
|
+
export const WorkerTasks = {
|
|
66
|
+
resolveProgram: (program) => resolveWorkerProgram(program, defaultWorkerProgramHost),
|
|
67
|
+
};
|
|
68
|
+
/** {@link WorkerTasks.resolveProgram} against `machine`, the seam tests drive. */
|
|
69
|
+
export async function resolveWorkerProgram(program, machine) {
|
|
70
|
+
if (program !== UV)
|
|
71
|
+
return program;
|
|
72
|
+
if (await machine.onPath(UV))
|
|
73
|
+
return UV;
|
|
74
|
+
const home = uvHome(machine.host);
|
|
75
|
+
const tried = [UV];
|
|
76
|
+
if (home !== undefined) {
|
|
77
|
+
const pinned = uvBinary(home, machine.host);
|
|
78
|
+
if (await machine.exists(pinned))
|
|
79
|
+
return pinned;
|
|
80
|
+
tried.push(pinned);
|
|
81
|
+
}
|
|
82
|
+
return await provisionUv(machine.setup, machine.host)(new UvNotFoundError(tried));
|
|
83
|
+
}
|
package/src/uv_pin.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The uv release `zuke` installs for a Python build whose `sdk.command` runs
|
|
3
|
+
* `uv`, and where each platform's copy comes from. The one place the pin
|
|
4
|
+
* lives, as `node_pin.ts` and `deno_pin.ts` are for Node and Deno.
|
|
5
|
+
*
|
|
6
|
+
* Astral publishes the uv binary to PyPI as one wheel per platform, so the
|
|
7
|
+
* pin is each wheel's exact URL on PyPI's file host and its SHA-256,
|
|
8
|
+
* both from `https://pypi.org/pypi/uv/<version>/json`. Bump the version, the
|
|
9
|
+
* URLs and the checksums together.
|
|
10
|
+
*
|
|
11
|
+
* On Linux the pin is a wheel whose `uv` is statically linked, so the one
|
|
12
|
+
* binary runs on glibc and musl (Alpine) alike: the `musllinux` wheel for
|
|
13
|
+
* x86_64, and for aarch64 the one wheel uv publishes, tagged both ways. The
|
|
14
|
+
* `manylinux` x86_64 wheel's binary needs glibc's loader. Check with `file`
|
|
15
|
+
* when bumping: it must say `static`.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
/** A platform uv publishes a wheel for, as `zuke` names hosts: `os-arch`. */
|
|
20
|
+
export type UvPlatform = "linux-x86_64" | "linux-aarch64" | "macos-x86_64" | "macos-aarch64" | "windows-x86_64" | "windows-aarch64";
|
|
21
|
+
/** One platform's wheel: where it is, and what it must hash to. */
|
|
22
|
+
export interface UvWheel {
|
|
23
|
+
/** The wheel's download URL on PyPI's file host. */
|
|
24
|
+
readonly url: string;
|
|
25
|
+
/** Lowercase hex SHA-256 of the wheel. */
|
|
26
|
+
readonly sha256: string;
|
|
27
|
+
}
|
|
28
|
+
/** The pinned uv release and each platform's wheel. */
|
|
29
|
+
export interface UvPin {
|
|
30
|
+
/** The release version, e.g. `"0.13.10"`. */
|
|
31
|
+
readonly version: string;
|
|
32
|
+
/** The wheel for each supported platform. */
|
|
33
|
+
readonly wheels: Readonly<Record<UvPlatform, UvWheel>>;
|
|
34
|
+
}
|
|
35
|
+
/** The uv release `zuke` installs (published 2026-11-24), with its verified wheels. */
|
|
36
|
+
export declare const UV_PIN: UvPin;
|
package/src/uv_pin.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright (c) 2026 the Zuke contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
/** Where a wheel's files start: the PyPI file host. */
|
|
4
|
+
const FILES = "https://files.pythonhosted.org/packages";
|
|
5
|
+
/* cspell:disable */
|
|
6
|
+
/** The uv release `zuke` installs (published 2026-11-24), with its verified wheels. */
|
|
7
|
+
export const UV_PIN = {
|
|
8
|
+
version: "0.13.10",
|
|
9
|
+
wheels: {
|
|
10
|
+
"linux-x86_64": {
|
|
11
|
+
url: `${FILES}/84/23/e5cef4e193cc203afaa4e034a6537cc1d63c3a4fdceb17986da0704aabb7/uv-0.13.10-py3-none-musllinux_1_1_x86_64.whl`,
|
|
12
|
+
sha256: "ee403b6bbcfda1bc7db269be5c40c1624df27b3b838d3f8a416648e00e2de5d4",
|
|
13
|
+
},
|
|
14
|
+
"linux-aarch64": {
|
|
15
|
+
url: `${FILES}/97/4b/12a9e73be39829da3ece358385c3c019ecdea91a5fc704381d584ad9a387/uv-0.13.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl`,
|
|
16
|
+
sha256: "e89dd26ea831dde70639ba0a798fa04a4c7c0226fd2b241da86218bfa370e495",
|
|
17
|
+
},
|
|
18
|
+
"macos-x86_64": {
|
|
19
|
+
url: `${FILES}/77/0d/178749e47a7ea76ad7c4a0c736b11615f2b4a1af94a9983c987b724e20c1/uv-0.13.10-py3-none-macosx_10_12_x86_64.whl`,
|
|
20
|
+
sha256: "19a76fd50a6a2bba38ee088d8336566856569be08196865f98132a08806581fc",
|
|
21
|
+
},
|
|
22
|
+
"macos-aarch64": {
|
|
23
|
+
url: `${FILES}/5b/d6/78204b698ed27b425b9660105af4b388a379b0435ea2e77e783feca3f180/uv-0.13.10-py3-none-macosx_11_0_arm64.whl`,
|
|
24
|
+
sha256: "2a9ff188b442419c7aadebc445fcc1f287b25f99af50fa6d563b90cc0047b7cf",
|
|
25
|
+
},
|
|
26
|
+
"windows-x86_64": {
|
|
27
|
+
url: `${FILES}/cf/e4/d0704c116ada58e8450890e2defaaf2f07e8d264cf94669210e0823fbcb2/uv-0.13.10-py3-none-win_amd64.whl`,
|
|
28
|
+
sha256: "d87b9cf8165f2b3cc596e856b5bf794da9cfad6d1b110ca9d87eed42a15b3684",
|
|
29
|
+
},
|
|
30
|
+
"windows-aarch64": {
|
|
31
|
+
url: `${FILES}/8c/d7/59a108985cfc5f1cb0afea1108ff5a0bc4994b405af0825fb3085f068de8/uv-0.13.10-py3-none-win_arm64.whl`,
|
|
32
|
+
sha256: "8b0a15613aae9a3e1c134bb5ee706583af0addced7eb1add992f8b1b3e3a92a0",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
/* cspell:enable */
|
package/src/version.js
CHANGED