@pylair/cli 0.1.0-rc.16 → 0.1.0-rc.17

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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/build/bytecode.d.ts +29 -0
  3. package/dist/build/bytecode.d.ts.map +1 -0
  4. package/dist/build/bytecode.js +64 -0
  5. package/dist/build/bytecode.js.map +1 -0
  6. package/dist/build/download.d.ts +53 -0
  7. package/dist/build/download.d.ts.map +1 -0
  8. package/dist/build/download.js +284 -0
  9. package/dist/build/download.js.map +1 -0
  10. package/dist/build/notices.d.ts +10 -0
  11. package/dist/build/notices.d.ts.map +1 -0
  12. package/dist/build/notices.js +108 -0
  13. package/dist/build/notices.js.map +1 -0
  14. package/dist/build/pbs.d.ts +12 -0
  15. package/dist/build/pbs.d.ts.map +1 -0
  16. package/dist/build/pbs.js +36 -0
  17. package/dist/build/pbs.js.map +1 -0
  18. package/dist/build/python.d.ts +19 -0
  19. package/dist/build/python.d.ts.map +1 -0
  20. package/dist/build/python.js +109 -0
  21. package/dist/build/python.js.map +1 -0
  22. package/dist/build/sign.d.ts +4 -0
  23. package/dist/build/sign.d.ts.map +1 -0
  24. package/dist/build/sign.js +108 -0
  25. package/dist/build/sign.js.map +1 -0
  26. package/dist/build/source.d.ts +16 -0
  27. package/dist/build/source.d.ts.map +1 -0
  28. package/dist/build/source.js +85 -0
  29. package/dist/build/source.js.map +1 -0
  30. package/dist/build/util.d.ts +4 -0
  31. package/dist/build/util.d.ts.map +1 -0
  32. package/dist/build/util.js +12 -0
  33. package/dist/build/util.js.map +1 -0
  34. package/dist/build.d.ts +6 -77
  35. package/dist/build.d.ts.map +1 -1
  36. package/dist/build.js +34 -624
  37. package/dist/build.js.map +1 -1
  38. package/dist/cli.d.ts +5 -0
  39. package/dist/cli.d.ts.map +1 -1
  40. package/dist/cli.js +11 -4
  41. package/dist/cli.js.map +1 -1
  42. package/package.json +1 -1
@@ -0,0 +1,36 @@
1
+ /** python-build-standalone: the pinned release, the supported versions and
2
+ * host triples, and the SHA-256 of every asset committed in-repo. */
3
+ import { arch, platform } from "node:os";
4
+ export const PBS_TAG = "20251120";
5
+ export const PBS_VERSIONS = { "3.12": "3.12.12", "3.13": "3.13.9" };
6
+ const HOST_TRIPLES = {
7
+ "darwin:arm64": "aarch64-apple-darwin",
8
+ "darwin:x64": "x86_64-apple-darwin",
9
+ "win32:x64": "x86_64-pc-windows-msvc",
10
+ "linux:x64": "x86_64-unknown-linux-gnu",
11
+ "linux:arm64": "aarch64-unknown-linux-gnu",
12
+ };
13
+ /** Expected SHA256 per asset, committed in-repo — a hash fetched from the
14
+ * same release as the tarball catches corruption but not a tampered
15
+ * release. Bump together with PBS_TAG/PBS_VERSIONS; verify each value
16
+ * against upstream SHA256SUMS before committing.
17
+ */
18
+ export const PBS_SHA256 = {
19
+ "3.12.12-aarch64-apple-darwin": "9955ac87eff0d561e64920dc46fd8625912d2c2be4a53c66ad80125d6d9fbdb7",
20
+ "3.12.12-aarch64-unknown-linux-gnu": "4c4594cb38ddf6769f11f86818a4c6617652f4994e5a962eb4f8cf0ec977a1be",
21
+ "3.12.12-x86_64-apple-darwin": "1b4d8eec597ff69a3b67946f30622a6c25c6612e6d15aa431b864ebff66ac8a1",
22
+ "3.12.12-x86_64-pc-windows-msvc": "70ecfaf0bfc58298db11d6389be92c29ec4ef8cd93ebb6a7e54b41d9fc056b10",
23
+ "3.12.12-x86_64-unknown-linux-gnu": "8d2cd1393c1aec9d701cebeccb83d1519951f71d3ecb42d5e70c70af4db9be34",
24
+ "3.13.9-aarch64-apple-darwin": "29d38bd5fbe267b37cecac990015c662796edcf51c2f5e321d59ec06a1850816",
25
+ "3.13.9-aarch64-unknown-linux-gnu": "fdc5d80488b64fcef3b99f297618f68e5374c13d89e888a66abeff4967afd308",
26
+ "3.13.9-x86_64-apple-darwin": "9da51afb00480a8ccd4909bd302c80d9c104d633c5e865cf37dd5e587185e125",
27
+ "3.13.9-x86_64-pc-windows-msvc": "f4c22b31ddbf8d7824cbcba2d8707621c2c8fab1fb6d2c1810c2bb0304d8e9a8",
28
+ "3.13.9-x86_64-unknown-linux-gnu": "1bc9a94ab2425fb6ae58e45f69cab61647759b57895649701390822d976fa923",
29
+ };
30
+ export function hostTriple() {
31
+ const t = HOST_TRIPLES[`${platform()}:${arch()}`];
32
+ if (!t)
33
+ throw new Error(`no standalone CPython build for ${platform()}/${arch()}`);
34
+ return t;
35
+ }
36
+ //# sourceMappingURL=pbs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pbs.js","sourceRoot":"","sources":["../../src/build/pbs.ts"],"names":[],"mappings":"AAAA;qEACqE;AAErE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,MAAM,CAAC,MAAM,YAAY,GAA2B,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC5F,MAAM,YAAY,GAA2B;IAC3C,cAAc,EAAE,sBAAsB;IACtC,YAAY,EAAE,qBAAqB;IACnC,WAAW,EAAE,wBAAwB;IACrC,WAAW,EAAE,0BAA0B;IACvC,aAAa,EAAE,2BAA2B;CAC3C,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAA2B;IAChD,8BAA8B,EAAE,kEAAkE;IAClG,mCAAmC,EAAE,kEAAkE;IACvG,6BAA6B,EAAE,kEAAkE;IACjG,gCAAgC,EAAE,kEAAkE;IACpG,kCAAkC,EAAE,kEAAkE;IACtG,6BAA6B,EAAE,kEAAkE;IACjG,kCAAkC,EAAE,kEAAkE;IACtG,4BAA4B,EAAE,kEAAkE;IAChG,+BAA+B,EAAE,kEAAkE;IACnG,iCAAiC,EAAE,kEAAkE;CACtG,CAAC;AAEF,MAAM,UAAU,UAAU;IACxB,MAAM,CAAC,GAAG,YAAY,CAAC,GAAG,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;IAClD,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;IACnF,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,19 @@
1
+ /** The bundled interpreter and its packages: fetch and unpack CPython,
2
+ * export the lock with uv, and install site-packages through the bundled
3
+ * interpreter (native wheels only). */
4
+ export declare function fetchPython(resources: string, cacheDir: string, versionClass: string): Promise<string>;
5
+ /** uv export args: the lock's production set only. --no-emit-project
6
+ * drops the scaffold's own project entry — its source is staged by
7
+ * stageSource(), not installed as a package. */
8
+ export declare function uvExportArgs(exported: string): string[];
9
+ /** True when a requirements file carries any `--hash` entries.
10
+ * `\s` before `--hash` excludes a trailing comment mention. */
11
+ export declare function requirementsHaveHashes(reqsText: string): boolean;
12
+ /** `uv pip install` args. `--require-hashes` is passed ONLY for the
13
+ * requirements.txt fallback: an exported lock legitimately mixes hashed
14
+ * registry deps with hash-less `file://` path deps, which the flag
15
+ * would reject — and individual `--hash` entries are verified without
16
+ * it anyway. */
17
+ export declare function uvPipInstallArgs(python: string, target: string, reqsFile: string, requireHashes: boolean): string[];
18
+ export declare function stageEnv(resources: string, python: string, appDir: string, reqs: string, cacheDir: string): void;
19
+ //# sourceMappingURL=python.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/build/python.ts"],"names":[],"mappings":"AAAA;;uCAEuC;AAUvC,wBAAsB,WAAW,CAC/B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAED;;gDAEgD;AAChD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAWvD;AAED;+DAC+D;AAC/D,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;gBAIgB;AAChB,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,OAAO,GACrB,MAAM,EAAE,CAaV;AAED,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QA+BzG"}
@@ -0,0 +1,109 @@
1
+ /** The bundled interpreter and its packages: fetch and unpack CPython,
2
+ * export the lock with uv, and install site-packages through the bundled
3
+ * interpreter (native wheels only). */
4
+ import { execFileSync } from "node:child_process";
5
+ import { existsSync, mkdirSync, readFileSync, rmSync } from "node:fs";
6
+ import { join } from "node:path";
7
+ import { x as untar } from "tar";
8
+ import { ensureTarball } from "./download.js";
9
+ import { PBS_SHA256, PBS_TAG, PBS_VERSIONS, hostTriple } from "./pbs.js";
10
+ import { isWin } from "./util.js";
11
+ export async function fetchPython(resources, cacheDir, versionClass) {
12
+ const ver = PBS_VERSIONS[versionClass];
13
+ if (!ver)
14
+ throw new Error(`python-version "${versionClass}" not available — supported: ${Object.keys(PBS_VERSIONS).join(", ")}`);
15
+ const triple = hostTriple();
16
+ const asset = `cpython-${ver}+${PBS_TAG}-${triple}-install_only_stripped.tar.gz`;
17
+ const base = `https://github.com/astral-sh/python-build-standalone/releases/download/${PBS_TAG}`;
18
+ mkdirSync(resources, { recursive: true });
19
+ mkdirSync(cacheDir, { recursive: true });
20
+ const tarball = join(cacheDir, asset);
21
+ // The interpreter ships to end users — verify against hashes committed
22
+ // in-repo (see PBS_SHA256), not a checksum file from the same release.
23
+ const want = PBS_SHA256[`${ver}-${triple}`];
24
+ if (!want)
25
+ throw new Error(`no committed SHA256 for ${ver}/${triple}`);
26
+ await ensureTarball(`${base}/${asset}`, tarball, want);
27
+ const dest = join(resources, "python");
28
+ rmSync(dest, { recursive: true, force: true });
29
+ mkdirSync(dest, { recursive: true });
30
+ // Extract in-process — same lesson as the tomllib probe: whichever
31
+ // `tar` PATH resolves to can differ (System32 bsdtar vs Git Bash GNU
32
+ // tar, which dies on drive-letter paths). The `tar` package handles
33
+ // pax long names (>100 chars) and the bin/python3 -> python3.12
34
+ // symlinks the POSIX builds carry.
35
+ await untar({ file: tarball, cwd: dest, strip: 1 });
36
+ const py = join(dest, isWin ? "python.exe" : "bin/python3");
37
+ if (!existsSync(py))
38
+ throw new Error(`expected interpreter at ${py}`);
39
+ return py;
40
+ }
41
+ /** uv export args: the lock's production set only. --no-emit-project
42
+ * drops the scaffold's own project entry — its source is staged by
43
+ * stageSource(), not installed as a package. */
44
+ export function uvExportArgs(exported) {
45
+ return [
46
+ "export",
47
+ "--frozen",
48
+ "--format",
49
+ "requirements-txt",
50
+ "--no-dev",
51
+ "--no-emit-project",
52
+ "-o",
53
+ exported,
54
+ ];
55
+ }
56
+ /** True when a requirements file carries any `--hash` entries.
57
+ * `\s` before `--hash` excludes a trailing comment mention. */
58
+ export function requirementsHaveHashes(reqsText) {
59
+ return /\s--hash=/.test(reqsText);
60
+ }
61
+ /** `uv pip install` args. `--require-hashes` is passed ONLY for the
62
+ * requirements.txt fallback: an exported lock legitimately mixes hashed
63
+ * registry deps with hash-less `file://` path deps, which the flag
64
+ * would reject — and individual `--hash` entries are verified without
65
+ * it anyway. */
66
+ export function uvPipInstallArgs(python, target, reqsFile, requireHashes) {
67
+ const args = [
68
+ "pip",
69
+ "install",
70
+ "--python",
71
+ python,
72
+ "--target",
73
+ target,
74
+ "-r",
75
+ reqsFile,
76
+ ];
77
+ if (requireHashes)
78
+ args.push("--require-hashes");
79
+ return args;
80
+ }
81
+ export function stageEnv(resources, python, appDir, reqs, cacheDir) {
82
+ const target = join(resources, "site-packages");
83
+ rmSync(target, { recursive: true, force: true });
84
+ // dev uses `uv sync` (uv.lock) — build must install the SAME locked set,
85
+ // hashed, or dev/prod parity is a fiction. requirements.txt is the
86
+ // fallback for projects that don't lock.
87
+ const lock = join(appDir, "uv.lock");
88
+ let reqsFile = reqs;
89
+ let requireHashes = false;
90
+ if (existsSync(lock)) {
91
+ const exported = join(cacheDir, "requirements.exported.txt");
92
+ execFileSync("uv", uvExportArgs(exported), {
93
+ cwd: appDir,
94
+ stdio: "inherit",
95
+ });
96
+ reqsFile = exported;
97
+ }
98
+ else if (!existsSync(reqs)) {
99
+ console.log(`no uv.lock and no ${reqs} — bundling stdlib only`);
100
+ return;
101
+ }
102
+ else {
103
+ console.warn("warning: no uv.lock — building from requirements.txt; " +
104
+ "the bundled env may drift from `pylair dev`'s env");
105
+ requireHashes = requirementsHaveHashes(readFileSync(reqs, "utf-8"));
106
+ }
107
+ execFileSync("uv", uvPipInstallArgs(python, target, reqsFile, requireHashes), { cwd: appDir, stdio: "inherit" });
108
+ }
109
+ //# sourceMappingURL=python.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.js","sourceRoot":"","sources":["../../src/build/python.ts"],"names":[],"mappings":"AAAA;;uCAEuC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,SAAiB,EACjB,QAAgB,EAChB,YAAoB;IAEpB,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY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,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACrC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAC;QAC7D,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,EAAE;YACzC,GAAG,EAAE,MAAM;YACX,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QACH,QAAQ,GAAG,QAAQ,CAAC;IACtB,CAAC;SAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,yBAAyB,CAAC,CAAC;QAChE,OAAO;IACT,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,IAAI,CACV,wDAAwD;YACtD,mDAAmD,CACtD,CAAC;QACF,aAAa,GAAG,sBAAsB,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;IACD,YAAY,CACV,IAAI,EACJ,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,EACzD,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAClC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** macOS ad-hoc signing of the built .app, verified with codesign. Runs
2
+ * only on macOS hosts; see build() for when it is used. */
3
+ export declare function adHocSign(tauriDir: string, productName: string): void;
4
+ //# sourceMappingURL=sign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/build/sign.ts"],"names":[],"mappings":"AAAA;2DAC2D;AAkD3D,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAiErE"}
@@ -0,0 +1,108 @@
1
+ /** macOS ad-hoc signing of the built .app, verified with codesign. Runs
2
+ * only on macOS hosts; see build() for when it is used. */
3
+ import { spawnSync } from "node:child_process";
4
+ import { closeSync, existsSync, mkdtempSync, openSync, readdirSync, readSync, rmSync, } from "node:fs";
5
+ import { tmpdir } from "node:os";
6
+ import { join } from "node:path";
7
+ import { run } from "./util.js";
8
+ // ── macOS ad-hoc signing ──────────────────────────────────────────────
9
+ // Mach-O magic numbers, read as the first BE u32 — includes the
10
+ // byte-swapped forms and both fat headers.
11
+ const MACHO_MAGIC = new Set([
12
+ 0xfeedface, 0xfeedfacf, 0xcefaedfe, 0xcffaedfe,
13
+ 0xcafebabe, 0xbebafeca, 0xcafebabf, 0xbfbafeca,
14
+ ]);
15
+ function isMachO(p) {
16
+ const fd = openSync(p, "r");
17
+ try {
18
+ const b = Buffer.alloc(4);
19
+ return readSync(fd, b, 0, 4, 0) === 4 && MACHO_MAGIC.has(b.readUInt32BE(0));
20
+ }
21
+ finally {
22
+ closeSync(fd);
23
+ }
24
+ }
25
+ /** Re-sign a built .app ad-hoc and REQUIRE it to verify. With no signing
26
+ * identity Tauri ships only the linker's ad-hoc stub on the main binary —
27
+ * a signature that doesn't cover the bundle is the worst state for
28
+ * Gatekeeper ("is damaged"), worse than none at all. Signs every Mach-O
29
+ * nested-first rather than `codesign --deep`, which is documented to miss
30
+ * binaries in layouts it doesn't model — a vendored CPython tree is
31
+ * exactly that. Verify with --deep --strict; if it fails, the build
32
+ * fails — a broken signature must not ship silently.
33
+ */
34
+ function codesignVerify(path) {
35
+ const v = spawnSync("codesign", ["--verify", "--deep", "--strict", path], {
36
+ encoding: "utf-8",
37
+ });
38
+ return v.status === 0 ? null : (v.stderr ?? "").trim();
39
+ }
40
+ export function adHocSign(tauriDir, productName) {
41
+ const bundleDir = join(tauriDir, "target", "release", "bundle", "macos");
42
+ if (!existsSync(bundleDir))
43
+ return; // --bundles skipped app — nothing to sign
44
+ const app = readdirSync(bundleDir).find((n) => n.endsWith(".app"));
45
+ if (!app)
46
+ return;
47
+ const appPath = join(bundleDir, app);
48
+ const machos = [];
49
+ const walk = (dir) => {
50
+ for (const e of readdirSync(dir, { withFileTypes: true })) {
51
+ const p = join(dir, e.name);
52
+ // Dirent types describe the link, not the target — symlinked files
53
+ // and dirs are skipped; the real binary is signed in place.
54
+ if (e.isDirectory())
55
+ walk(p);
56
+ else if (e.isFile() && isMachO(p))
57
+ machos.push(p);
58
+ }
59
+ };
60
+ walk(appPath);
61
+ // Deepest first — a parent's signature seals its children, so children
62
+ // must be final when the parent is written.
63
+ machos.sort((a, b) => b.split("/").length - a.split("/").length);
64
+ for (const p of machos)
65
+ run("codesign", ["--force", "--sign", "-", p], appPath);
66
+ run("codesign", ["--force", "--sign", "-", appPath], bundleDir);
67
+ const err = codesignVerify(appPath);
68
+ if (err)
69
+ throw new Error(`ad-hoc signing produced an invalid bundle:\n${err}`);
70
+ console.log(`ad-hoc signed ${app} — ${machos.length} nested binaries, codesign --verify clean`);
71
+ // A dmg built in the same `tauri build` already captured the
72
+ // PRE-signing .app — signing after bundling can't reach inside a
73
+ // compressed image. Repackage each dmg from the signed app and verify
74
+ // the shipped artifact itself, not just the staged copy. The rebuilt
75
+ // image is plain (app + /Applications link) — Tauri's cosmetic layout
76
+ // returns once real signing is configured and repackaging stops.
77
+ const dmgDir = join(tauriDir, "target", "release", "bundle", "dmg");
78
+ if (!existsSync(dmgDir))
79
+ return;
80
+ for (const dmg of readdirSync(dmgDir).filter((n) => n.endsWith(".dmg"))) {
81
+ const dmgPath = join(dmgDir, dmg);
82
+ const staging = mkdtempSync(join(tmpdir(), "pylair-dmg-"));
83
+ try {
84
+ run("ditto", [appPath, join(staging, app)], tauriDir);
85
+ run("ln", ["-s", "/Applications", join(staging, "Applications")], tauriDir);
86
+ run("hdiutil", ["create", "-volname", productName, "-srcfolder", staging, "-ov", "-format", "UDZO", dmgPath], tauriDir);
87
+ }
88
+ finally {
89
+ rmSync(staging, { recursive: true, force: true });
90
+ }
91
+ // Verify the app INSIDE the shipped dmg — mount read-only at a fixed
92
+ // point, verify, always detach, then judge.
93
+ const mount = mkdtempSync(join(tmpdir(), "pylair-mnt-"));
94
+ run("hdiutil", ["attach", "-nobrowse", "-readonly", "-mountpoint", mount, dmgPath], tauriDir);
95
+ let inDmg = null;
96
+ try {
97
+ inDmg = codesignVerify(join(mount, app));
98
+ }
99
+ finally {
100
+ spawnSync("hdiutil", ["detach", mount, "-quiet"], { stdio: "inherit" });
101
+ rmSync(mount, { recursive: true, force: true });
102
+ }
103
+ if (inDmg)
104
+ throw new Error(`${dmg} contains an invalidly-signed app:\n${inDmg}`);
105
+ console.log(`repackaged ${dmg} with the signed app — verified inside the image`);
106
+ }
107
+ }
108
+ //# sourceMappingURL=sign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/build/sign.ts"],"names":[],"mappings":"AAAA;2DAC2D;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,SAAS,EACT,UAAU,EACV,WAAW,EACX,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,MAAM,GACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhC,yEAAyE;AACzE,gEAAgE;AAChE,2CAA2C;AAC3C,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/C,CAAC,CAAC;AAEH,SAAS,OAAO,CAAC,CAAS;IACxB,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;I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S,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC9F,IAAI,KAAK,GAAkB,IAAI,CAAC;QAChC,IAAI,CAAC;YACH,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QAC3C,CAAC;gBAAS,CAAC;YACT,SAAS,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YACxE,MAAM,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,uCAAuC,KAAK,EAAE,CAAC,CAAC;QACjF,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,kDAAkD,CAAC,CAAC;IACnF,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ /** Staging the app source into the bundle, minus anything that looks
2
+ * like a secret unless `[tool.pylair] include` names it. */
3
+ /**
4
+ * Copy the app source tree into the bundle, minus anything that looks
5
+ * like a secret. A path is skipped when any segment starts with "." or
6
+ * its basename matches SECRET_PATTERNS, UNLESS an `include` glob
7
+ * (relative to srcDir, same shape as `prune` entries) names it — an
8
+ * include wins even inside a denied directory, which stays walkable so
9
+ * the descent can reach it. Skips are reported, not fatal: `warn` gets
10
+ * the count, the first 10 names, and how to opt a path back in; nothing
11
+ * is printed when nothing was skipped.
12
+ *
13
+ * Returns the `/`-separated relative paths that were refused.
14
+ */
15
+ export declare function stageSource(srcDir: string, dest: string, include?: string[], warn?: (msg: string) => void): string[];
16
+ //# sourceMappingURL=source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/build/source.ts"],"names":[],"mappings":"AAAA;4DAC4D;AA2C5D;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAM,EAAO,EACtB,IAAI,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAmB,GACzC,MAAM,EAAE,CAwBV"}
@@ -0,0 +1,85 @@
1
+ /** Staging the app source into the bundle, minus anything that looks
2
+ * like a secret unless `[tool.pylair] include` names it. */
3
+ import { cpSync } from "node:fs";
4
+ import { relative } from "node:path";
5
+ import { matchGlob } from "../glob.js";
6
+ /** Basename globs for files that look like secrets or credentials —
7
+ * staged source must never carry them into an installer. */
8
+ const SECRET_PATTERNS = [
9
+ "*.pem",
10
+ "*.key",
11
+ "*.p12",
12
+ "*.pfx",
13
+ "id_rsa*",
14
+ "id_ed25519*",
15
+ "credentials*.json",
16
+ "service-account*.json",
17
+ ];
18
+ /** True when a `/`-separated relative path looks like it holds secrets:
19
+ * any dot-segment (.env, .git, .venv, .DS_Store) or a basename matching
20
+ * the credential patterns. */
21
+ function secretish(rel) {
22
+ const segs = rel.split("/");
23
+ if (segs.some((s) => s.startsWith(".")))
24
+ return true;
25
+ return SECRET_PATTERNS.some((g) => matchGlob(g, segs[segs.length - 1]));
26
+ }
27
+ /** Could `pattern` match something beneath `dir`? Refusing a denied dir
28
+ * would otherwise hide an included descendant from cpSync's walk. */
29
+ function couldMatchUnder(pattern, dir) {
30
+ const d = dir.split("/");
31
+ const p = pattern.split("/");
32
+ for (let i = 0; i < d.length; i++) {
33
+ if (i >= p.length)
34
+ return false; // pattern ends above the dir
35
+ if (p[i] === "**")
36
+ return true; // ** crosses any depth
37
+ if (/[*?]/.test(p[i])) {
38
+ if (!matchGlob(p[i], d[i]))
39
+ return false;
40
+ }
41
+ else if (p[i] !== d[i])
42
+ return false;
43
+ }
44
+ return true;
45
+ }
46
+ /**
47
+ * Copy the app source tree into the bundle, minus anything that looks
48
+ * like a secret. A path is skipped when any segment starts with "." or
49
+ * its basename matches SECRET_PATTERNS, UNLESS an `include` glob
50
+ * (relative to srcDir, same shape as `prune` entries) names it — an
51
+ * include wins even inside a denied directory, which stays walkable so
52
+ * the descent can reach it. Skips are reported, not fatal: `warn` gets
53
+ * the count, the first 10 names, and how to opt a path back in; nothing
54
+ * is printed when nothing was skipped.
55
+ *
56
+ * Returns the `/`-separated relative paths that were refused.
57
+ */
58
+ export function stageSource(srcDir, dest, include = [], warn = console.warn) {
59
+ const pats = include.map((g) => g.replace(/\\/g, "/").replace(/^\.\//, ""));
60
+ const skipped = [];
61
+ cpSync(srcDir, dest, {
62
+ recursive: true,
63
+ filter: (src) => {
64
+ const rel = relative(srcDir, src).replace(/\\/g, "/");
65
+ if (!rel)
66
+ return true; // the root itself
67
+ if (pats.some((g) => matchGlob(g, rel)))
68
+ return true;
69
+ if (!secretish(rel))
70
+ return true;
71
+ if (pats.some((g) => couldMatchUnder(g, rel)))
72
+ return true; // descend only
73
+ skipped.push(rel);
74
+ return false;
75
+ },
76
+ });
77
+ if (skipped.length) {
78
+ warn(`warning: skipped ${skipped.length} secret-looking path(s) under ${srcDir}: ` +
79
+ skipped.slice(0, 10).join(", ") +
80
+ (skipped.length > 10 ? ", …" : ""));
81
+ warn(` to ship one deliberately, list it in [tool.pylair] include = ["path/under/source"]`);
82
+ }
83
+ return skipped;
84
+ }
85
+ //# sourceMappingURL=source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/build/source.ts"],"names":[],"mappings":"AAAA;4DAC4D;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;4DAC4D;AAC5D,MAAM,eAAe,GAAG;IACtB,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP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C,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAC/B,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CACrC,CAAC;QACF,IAAI,CAAC,sFAAsF,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Small helpers shared by build.ts and the build/ modules. */
2
+ export declare const isWin: boolean;
3
+ export declare function run(cmd: string, args: string[], cwd: string): void;
4
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/build/util.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAK/D,eAAO,MAAM,KAAK,SAAyB,CAAC;AAE5C,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,QAI3D"}
@@ -0,0 +1,12 @@
1
+ /** Small helpers shared by build.ts and the build/ modules. */
2
+ import { spawnSync } from "node:child_process";
3
+ import { platform } from "node:os";
4
+ export const isWin = platform() === "win32";
5
+ export function run(cmd, args, cwd) {
6
+ const r = spawnSync(cmd, args, { cwd, stdio: "inherit" });
7
+ if (r.error)
8
+ throw new Error(`${cmd} ${args.join(" ")} failed to start: ${r.error.message}`);
9
+ if (r.status !== 0)
10
+ throw new Error(`${cmd} ${args.join(" ")} exited ${r.status}`);
11
+ }
12
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/build/util.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,EAAE,KAAK,OAAO,CAAC;AAE5C,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,IAAc,EAAE,GAAW;IAC1D,MAAM,CAAC,GAAG,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1D,IAAI,CAAC,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7F,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AACrF,CAAC"}
package/dist/build.d.ts CHANGED
@@ -3,83 +3,12 @@
3
3
  * interpreter (native wheels only — no cross-compile) → stage app
4
4
  * source → prune → tauri build → unsigned warning.
5
5
  */
6
- import { get } from "node:https";
7
- export declare function hostTriple(): string;
8
- /** Download `url` to `to`, following up to `maxRedirects` redirects and
9
- * failing after `timeoutMs` with no bytes. The body lands in `to.part`
10
- * and is renamed into place only once it is complete — a dropped
11
- * connection must never leave a partial file at the cache path (the
12
- * SHA check would then refuse every later build until it is deleted by
13
- * hand). `get` is injectable so tests need no network. */
14
- export declare function download(url: string, to: string, opts?: {
15
- get?: typeof get;
16
- timeoutMs?: number;
17
- maxRedirects?: number;
18
- }): Promise<void>;
19
- /** Cache + integrity for a downloaded asset: a cached file that fails
20
- * its SHA is deleted and re-downloaded ONCE — a second mismatch still
21
- * refuses, naming the cache so it is fixable by hand. `dl` injectable
22
- * for tests. */
23
- export declare function ensureTarball(url: string, tarball: string, want: string, dl?: (u: string, to: string) => Promise<void>): Promise<void>;
24
- /** uv export args: the lock's production set only. --no-emit-project
25
- * drops the scaffold's own project entry — its source is staged by
26
- * stageSource(), not installed as a package. */
27
- export declare function uvExportArgs(exported: string): string[];
28
- /** True when a requirements file carries any `--hash` entries.
29
- * `\s` before `--hash` excludes a trailing comment mention. */
30
- export declare function requirementsHaveHashes(reqsText: string): boolean;
31
- /** `uv pip install` args. `--require-hashes` is passed ONLY for the
32
- * requirements.txt fallback: an exported lock legitimately mixes hashed
33
- * registry deps with hash-less `file://` path deps, which the flag
34
- * would reject — and individual `--hash` entries are verified without
35
- * it anyway. */
36
- export declare function uvPipInstallArgs(python: string, target: string, reqsFile: string, requireHashes: boolean): string[];
37
- /** pyc invalidation mode shipped in installers — see docs/build.md.
38
- * checked-hash: installers rewrite mtimes, so timestamp pycs silently
39
- * invalidate; hash-based headers survive repackaging. checked (not
40
- * unchecked) re-validates the source hash per import — ~10ms slower on
41
- * a numpy-sized tree but a post-install source edit recompiles instead
42
- * of running stale bytecode. Measured (Windows, numpy tree):
43
- * ~665ms no-pyc / ~267ms checked / ~256ms unchecked per cold import.
44
- */
45
- export declare const PYC_INVALIDATION_MODE: "checked-hash";
46
- /** Precompile the staged .py tree with the BUNDLED interpreter — same
47
- * CPython and magic number as the runtime that will load the pycs.
48
- * An installed app (possibly read-only) must not compile its Python on
49
- * every launch. Runs post-prune so denied dirs stay uncompiled, and
50
- * relative args + cwd keep co_filename bundle-relative: identical pycs
51
- * regardless of build path, tracebacks show `site-packages/…`.
52
- * `-s`/`-d` would also work; relative args are the smallest version of
53
- * the same thing.
54
- *
55
- * Exit 1 from compileall means "some files failed to compile" — a
56
- * dependency may ship a py2-only file or invalid fixture that nothing
57
- * imports. That warns (paths returned) instead of failing the build;
58
- * the files are left uncompiled and will compile — or fail to import —
59
- * as normal at runtime. Real failures still throw: the interpreter
60
- * not starting, a signal, or any other exit code. Returns the failed
61
- * paths (empty on full success). */
62
- export declare function compileBytecode(resources: string, python: string, dirs: string[]): string[];
63
- /** Shipped bundles must carry the licenses of what they embed. Collects:
64
- * pylair's own dual license, the interpreter's license tree (PSF license
65
- * requires LICENSE text with redistributed CPython), and each wheel's
66
- * dist-info license files. Runs before prune so nothing collected is
67
- * deleted afterwards. Returns the notice dir.
68
- */
69
- export declare function stageNotices(resources: string, pylairDir: string): string;
70
- /**
71
- * Copy the app source tree into the bundle, minus anything that looks
72
- * like a secret. A path is skipped when any segment starts with "." or
73
- * its basename matches SECRET_PATTERNS, UNLESS an `include` glob
74
- * (relative to srcDir, same shape as `prune` entries) names it — an
75
- * include wins even inside a denied directory, which stays walkable so
76
- * the descent can reach it. Skips are reported, not fatal: `warn` gets
77
- * the count, the first 10 names, and how to opt a path back in; nothing
78
- * is printed when nothing was skipped.
79
- *
80
- * Returns the `/`-separated relative paths that were refused.
81
- */
82
- export declare function stageSource(srcDir: string, dest: string, include?: string[], warn?: (msg: string) => void): string[];
6
+ export { compileBytecode, PYC_INVALIDATION_MODE } from "./build/bytecode.js";
7
+ export { DownloadError, backoffMs, download, downloadTimeoutMs, downloadWithRetry, ensureTarball, } from "./build/download.js";
8
+ export { stageNotices } from "./build/notices.js";
9
+ export { hostTriple } from "./build/pbs.js";
10
+ export { stageSource } from "./build/source.js";
11
+ export { requirementsHaveHashes, uvExportArgs, uvPipInstallArgs } from "./build/python.js";
83
12
  export interface BuildOptions {
84
13
  appDir: string;
85
14
  /** Extra tauri-cli args (e.g. --bundles). */
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AA6CjC,wBAAgB,UAAU,IAAI,MAAM,CAInC;AAKD;;;;;0DAK0D;AAC1D,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,C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