@pylair/cli 0.1.0-rc.2 → 0.1.0-rc.21
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 +3 -2
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +7 -0
- package/dist/bin.js.map +1 -0
- package/dist/build/bytecode.d.ts +29 -0
- package/dist/build/bytecode.d.ts.map +1 -0
- package/dist/build/bytecode.js +64 -0
- package/dist/build/bytecode.js.map +1 -0
- package/dist/build/download.d.ts +53 -0
- package/dist/build/download.d.ts.map +1 -0
- package/dist/build/download.js +326 -0
- package/dist/build/download.js.map +1 -0
- package/dist/build/notices.d.ts +10 -0
- package/dist/build/notices.d.ts.map +1 -0
- package/dist/build/notices.js +108 -0
- package/dist/build/notices.js.map +1 -0
- package/dist/build/pbs.d.ts +12 -0
- package/dist/build/pbs.d.ts.map +1 -0
- package/dist/build/pbs.js +36 -0
- package/dist/build/pbs.js.map +1 -0
- package/dist/build/python.d.ts +19 -0
- package/dist/build/python.d.ts.map +1 -0
- package/dist/build/python.js +109 -0
- package/dist/build/python.js.map +1 -0
- package/dist/build/sign.d.ts +4 -0
- package/dist/build/sign.d.ts.map +1 -0
- package/dist/build/sign.js +108 -0
- package/dist/build/sign.js.map +1 -0
- package/dist/build/source.d.ts +19 -0
- package/dist/build/source.d.ts.map +1 -0
- package/dist/build/source.js +90 -0
- package/dist/build/source.js.map +1 -0
- package/dist/build/util.d.ts +4 -0
- package/dist/build/util.d.ts.map +1 -0
- package/dist/build/util.js +12 -0
- package/dist/build/util.js.map +1 -0
- package/dist/build.d.ts +11 -8
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +138 -243
- package/dist/build.js.map +1 -1
- package/dist/capabilities.d.ts +51 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +232 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/cli.d.ts +29 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +152 -21
- package/dist/cli.js.map +1 -1
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +10 -1
- package/dist/codegen.js.map +1 -1
- package/dist/config.d.ts +22 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +40 -21
- package/dist/config.js.map +1 -1
- package/dist/dev.d.ts +4 -0
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +74 -7
- package/dist/dev.js.map +1 -1
- package/dist/doctor.d.ts +6 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +101 -7
- package/dist/doctor.js.map +1 -1
- package/dist/prune.d.ts.map +1 -1
- package/dist/prune.js +1 -0
- package/dist/prune.js.map +1 -1
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +15 -0
- package/dist/version.js.map +1 -0
- package/dist/wrap.d.ts +57 -0
- package/dist/wrap.d.ts.map +1 -0
- package/dist/wrap.js +218 -0
- package/dist/wrap.js.map +1 -0
- package/dist/wrapbuild.d.ts +33 -0
- package/dist/wrapbuild.d.ts.map +1 -0
- package/dist/wrapbuild.js +83 -0
- package/dist/wrapbuild.js.map +1 -0
- package/dist/wrapconfig.d.ts +52 -0
- package/dist/wrapconfig.d.ts.map +1 -0
- package/dist/wrapconfig.js +117 -0
- package/dist/wrapconfig.js.map +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/** THIRD-PARTY-NOTICES for the bundle: the licenses of everything it
|
|
2
|
+
* embeds (pylair, the interpreter, every installed wheel). */
|
|
3
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
/** Shipped bundles must carry the licenses of what they embed. Collects:
|
|
6
|
+
* pylair's own dual license, the interpreter's license tree (PSF license
|
|
7
|
+
* requires LICENSE text with redistributed CPython), and each wheel's
|
|
8
|
+
* dist-info license files. Runs before prune so nothing collected is
|
|
9
|
+
* deleted afterwards. Returns the notice dir.
|
|
10
|
+
*/
|
|
11
|
+
export function stageNotices(resources, pylairDir) {
|
|
12
|
+
const out = join(resources, "THIRD-PARTY-NOTICES");
|
|
13
|
+
rmSync(out, { recursive: true, force: true });
|
|
14
|
+
mkdirSync(out, { recursive: true });
|
|
15
|
+
const index = [];
|
|
16
|
+
const copyInto = (subdir, src, dest) => {
|
|
17
|
+
mkdirSync(join(out, subdir), { recursive: true });
|
|
18
|
+
cpSync(src, join(out, subdir, dest));
|
|
19
|
+
};
|
|
20
|
+
const LICENSEISH = /^(licen[cs]e|copying|notice|authors|copyright)/i;
|
|
21
|
+
for (const f of ["LICENSE-MIT", "LICENSE-APACHE"]) {
|
|
22
|
+
const src = join(pylairDir, f);
|
|
23
|
+
if (existsSync(src))
|
|
24
|
+
copyInto("pylair", src, f);
|
|
25
|
+
}
|
|
26
|
+
index.push("pylair/ — pylair itself (MIT OR Apache-2.0)");
|
|
27
|
+
// The interpreter: python-build-standalone ships a licenses/ dir holding
|
|
28
|
+
// CPython's license plus every statically-linked dep (OpenSSL, libffi…).
|
|
29
|
+
const pyRoot = join(resources, "python");
|
|
30
|
+
let found = 0;
|
|
31
|
+
const walkPy = (dir) => {
|
|
32
|
+
for (const e of readdirSync(dir, { withFileTypes: true })) {
|
|
33
|
+
const p = join(dir, e.name);
|
|
34
|
+
if (e.isDirectory()) {
|
|
35
|
+
if (e.name.toLowerCase() === "licenses") {
|
|
36
|
+
cpSync(p, join(out, "python", "licenses"), { recursive: true });
|
|
37
|
+
found++;
|
|
38
|
+
}
|
|
39
|
+
else
|
|
40
|
+
walkPy(p);
|
|
41
|
+
}
|
|
42
|
+
else if (LICENSEISH.test(e.name)) {
|
|
43
|
+
copyInto("python", p, e.name);
|
|
44
|
+
found++;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
if (existsSync(pyRoot))
|
|
49
|
+
walkPy(pyRoot);
|
|
50
|
+
if (!found) {
|
|
51
|
+
mkdirSync(join(out, "python"), { recursive: true });
|
|
52
|
+
writeFileSync(join(out, "python", "NOTICE.txt"), "This app bundles CPython (PSF-2.0 license) via python-build-standalone.\n" +
|
|
53
|
+
"License texts were not located in the interpreter tree at build time;\n" +
|
|
54
|
+
"they ship upstream in the python/licenses directory of each\n" +
|
|
55
|
+
"python-build-standalone release.\n");
|
|
56
|
+
console.warn("warning: no license files found under resources/python — wrote placeholder NOTICE");
|
|
57
|
+
}
|
|
58
|
+
index.push("python/ — bundled CPython interpreter (PSF-2.0) and its vendored deps");
|
|
59
|
+
// Wheels: every installed dist-info/egg-info carries license files or
|
|
60
|
+
// license metadata. Copy whichever exists.
|
|
61
|
+
const sp = join(resources, "site-packages");
|
|
62
|
+
let wheels = 0;
|
|
63
|
+
if (existsSync(sp)) {
|
|
64
|
+
for (const e of readdirSync(sp, { withFileTypes: true })) {
|
|
65
|
+
if (!e.isDirectory())
|
|
66
|
+
continue;
|
|
67
|
+
const m = /^(.*?)-[\d.]+.*\.(dist-info|egg-info)$/.exec(e.name);
|
|
68
|
+
if (!m)
|
|
69
|
+
continue;
|
|
70
|
+
const pkg = m[1].replace(/[^\w.-]/g, "_");
|
|
71
|
+
const d = join(sp, e.name);
|
|
72
|
+
let kept = false;
|
|
73
|
+
for (const f of readdirSync(d, { withFileTypes: true })) {
|
|
74
|
+
if (f.isDirectory() && f.name.toLowerCase() === "licenses") {
|
|
75
|
+
cpSync(join(d, f.name), join(out, pkg, "licenses"), { recursive: true });
|
|
76
|
+
kept = true;
|
|
77
|
+
}
|
|
78
|
+
else if (f.isFile() && LICENSEISH.test(f.name)) {
|
|
79
|
+
copyInto(pkg, join(d, f.name), f.name);
|
|
80
|
+
kept = true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const meta = join(d, "METADATA");
|
|
84
|
+
if (existsSync(meta)) {
|
|
85
|
+
const lines = readFileSync(meta, "utf-8")
|
|
86
|
+
.split("\n")
|
|
87
|
+
.filter((l) => /^(License|Classifier: License)/i.test(l));
|
|
88
|
+
// Copyleft is legal to ship but app authors deserve to know they
|
|
89
|
+
// bundled it — warn, never block.
|
|
90
|
+
if (/\b(a?lgpl|gpl)[ -]?v?\d/i.test(lines.join(" ")))
|
|
91
|
+
console.warn(`warning: bundled wheel ${e.name} declares a copyleft license`);
|
|
92
|
+
if (lines.length) {
|
|
93
|
+
mkdirSync(join(out, pkg), { recursive: true });
|
|
94
|
+
writeFileSync(join(out, pkg, "METADATA-LICENSE.txt"), lines.join("\n") + "\n");
|
|
95
|
+
kept = true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (kept) {
|
|
99
|
+
wheels++;
|
|
100
|
+
index.push(`${pkg}/ — from ${e.name}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
writeFileSync(join(out, "INDEX.txt"), index.join("\n") + "\n");
|
|
105
|
+
console.log(`third-party notices: pylair, python interpreter, ${wheels} wheel(s)`);
|
|
106
|
+
return out;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=notices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notices.js","sourceRoot":"","sources":["../../src/build/notices.ts"],"names":[],"mappings":"AAAA;8DAC8D;AAE9D,OAAO,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,SAAiB,EAAE,SAAiB;IAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IACnD,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,SAAS,CAAC,GAAG,EAAE,EAAE,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iC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC5D,iEAAiE;gBACjE,kCAAkC;gBAClC,IAAI,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;oBAClD,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,IAAI,8BAA8B,CAAC,CAAC;gBAC/E,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;oBACjB,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC/C,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,sBAAsB,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;oBAC/E,IAAI,GAAG,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YACD,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM,EAAE,CAAC;gBACT,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC;IACD,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,oDAAoD,MAAM,WAAW,CAAC,CAAC;IACnF,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
export declare const PBS_TAG = "20261110";
|
|
4
|
+
export declare const PBS_VERSIONS: Record<string, string>;
|
|
5
|
+
/** Expected SHA256 per asset, committed in-repo — a hash fetched from the
|
|
6
|
+
* same release as the tarball catches corruption but not a tampered
|
|
7
|
+
* release. Bump together with PBS_TAG/PBS_VERSIONS; verify each value
|
|
8
|
+
* against upstream SHA256SUMS before committing.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PBS_SHA256: Record<string, string>;
|
|
11
|
+
export declare function hostTriple(): string;
|
|
12
|
+
//# sourceMappingURL=pbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pbs.d.ts","sourceRoot":"","sources":["../../src/build/pbs.ts"],"names":[],"mappings":"AAAA;qEACqE;AAIrE,eAAO,MAAM,OAAO,aAAa,CAAC;AAClC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAA4C,CAAC;AAS7F;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAW7C,CAAC;AAEF,wBAAgB,UAAU,IAAI,MAAM,CAInC"}
|
|
@@ -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 = "20261110";
|
|
5
|
+
export const PBS_VERSIONS = { "3.12": "3.12.16", "3.13": "3.13.18" };
|
|
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.16-aarch64-apple-darwin": "2f11b8aa3726bdbd87dd9eb76568412faddf4f47e26913fa45d6a2e424972acd",
|
|
20
|
+
"3.12.16-aarch64-unknown-linux-gnu": "b6a41defec4975d94b4ff1950236e7383e5c02ba40ea48c9ec33c66087a35aab",
|
|
21
|
+
"3.12.16-x86_64-apple-darwin": "b78a4c479f1964ec484880bee567568266f68da102269fb93a05fe8716b45f91",
|
|
22
|
+
"3.12.16-x86_64-pc-windows-msvc": "355ee61b8207b91574491b1c6dc9b0ebb4408fc56bfafe498f3ef439314b52dc",
|
|
23
|
+
"3.12.16-x86_64-unknown-linux-gnu": "6a9e62dad033790aef722dbd370e0ce76ce17b73627ba3ae679f537049350b39",
|
|
24
|
+
"3.13.18-aarch64-apple-darwin": "7a2384641584ab9984221fcb0fc9265df465922af71be71410529e2a9c3f0540",
|
|
25
|
+
"3.13.18-aarch64-unknown-linux-gnu": "55c00325f7c1fddf325dfc621aabdfbbac4dc54adda224af88ec411dc12db239",
|
|
26
|
+
"3.13.18-x86_64-apple-darwin": "d27d59a722db9f69926eb6d9564071247221f45a04da920ea7f3001c97e32f9b",
|
|
27
|
+
"3.13.18-x86_64-pc-windows-msvc": "2e0fed09d48989f64c9305da9ff2d37a41c0d13ab2aa6283405b2b620dfbf805",
|
|
28
|
+
"3.13.18-x86_64-unknown-linux-gnu": "f2d2199eb25880e07863b391cf7124e7ffa1338b0d65600dfcec117c4223a7fb",
|
|
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,SAAS,EAAE,CAAC;AAC7F,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,8BAA8B,EAAE,kEAAkE;IAClG,mCAAmC,EAAE,kEAAkE;IACvG,6BAA6B,EAAE,kEAAkE;IACjG,gCAAgC,EAAE,kEAAkE;IACpG,kCAAkC,EAAE,kEAAkE;CACvG,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":[],"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AC,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 @@
|
|
|
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;IAC5B,IA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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,19 @@
|
|
|
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,
|
|
16
|
+
/** Top-level names to leave out entirely (a root source dir holding the
|
|
17
|
+
* project's own `src-tauri`, `node_modules`...). Not reported as skipped. */
|
|
18
|
+
exclude?: string[]): string[];
|
|
19
|
+
//# 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;AAC1C;6EAC6E;AAC7E,OAAO,GAAE,MAAM,EAAO,GACrB,MAAM,EAAE,CAyBV"}
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
/** Top-level names to leave out entirely (a root source dir holding the
|
|
60
|
+
* project's own `src-tauri`, `node_modules`...). Not reported as skipped. */
|
|
61
|
+
exclude = []) {
|
|
62
|
+
const pats = include.map((g) => g.replace(/\\/g, "/").replace(/^\.\//, ""));
|
|
63
|
+
const skipped = [];
|
|
64
|
+
cpSync(srcDir, dest, {
|
|
65
|
+
recursive: true,
|
|
66
|
+
filter: (src) => {
|
|
67
|
+
const rel = relative(srcDir, src).replace(/\\/g, "/");
|
|
68
|
+
if (!rel)
|
|
69
|
+
return true; // the root itself
|
|
70
|
+
if (exclude.includes(rel.split("/")[0]))
|
|
71
|
+
return false;
|
|
72
|
+
if (pats.some((g) => matchGlob(g, rel)))
|
|
73
|
+
return true;
|
|
74
|
+
if (!secretish(rel))
|
|
75
|
+
return true;
|
|
76
|
+
if (pats.some((g) => couldMatchUnder(g, rel)))
|
|
77
|
+
return true; // descend only
|
|
78
|
+
skipped.push(rel);
|
|
79
|
+
return false;
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
if (skipped.length) {
|
|
83
|
+
warn(`warning: skipped ${skipped.length} secret-looking path(s) under ${srcDir}: ` +
|
|
84
|
+
skipped.slice(0, 10).join(", ") +
|
|
85
|
+
(skipped.length > 10 ? ", …" : ""));
|
|
86
|
+
warn(` to ship one deliberately, list it in [tool.pylair] include = ["path/under/source"]`);
|
|
87
|
+
}
|
|
88
|
+
return skipped;
|
|
89
|
+
}
|
|
90
|
+
//# 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,SAAS;IACT,aAAa;IACb,mBAAmB;IACnB,uBAAuB;CACxB,CAAC;AAEF;;8BAE8B;AAC9B,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,IAAI,GAAG,GAAG,CAAC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;YAC3E,OAAO,CAAC,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 @@
|
|
|
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,20 +3,23 @@
|
|
|
3
3
|
* interpreter (native wheels only — no cross-compile) → stage app
|
|
4
4
|
* source → prune → tauri build → unsigned warning.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
export declare function stageNotices(resources: string, pylairDir: string): 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";
|
|
14
12
|
export interface BuildOptions {
|
|
15
13
|
appDir: string;
|
|
16
14
|
/** Extra tauri-cli args (e.g. --bundles). */
|
|
17
15
|
tauriArgs?: string[];
|
|
18
16
|
/** Skip the interpreter fetch (reuse staged resources/python). */
|
|
19
17
|
skipFetch?: boolean;
|
|
18
|
+
/** Stage and verify everything (interpreter, locked env, source, prune,
|
|
19
|
+
* bytecode, the import check) but stop before `tauri build`: no installer,
|
|
20
|
+
* no signing. What CI and `pylair build --stage-only` use to prove a
|
|
21
|
+
* project builds without paying for a native bundle. */
|
|
22
|
+
stageOnly?: boolean;
|
|
20
23
|
}
|
|
21
24
|
export declare function build(opts: BuildOptions): Promise<void>;
|
|
22
25
|
//# sourceMappingURL=build.d.ts.map
|