@pylair/cli 0.1.0-rc.3 → 0.1.0-rc.30

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 (104) hide show
  1. package/README.md +3 -2
  2. package/dist/bin.d.ts +3 -0
  3. package/dist/bin.d.ts.map +1 -0
  4. package/dist/bin.js +7 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/build/artifacts.d.ts +14 -0
  7. package/dist/build/artifacts.d.ts.map +1 -0
  8. package/dist/build/artifacts.js +61 -0
  9. package/dist/build/artifacts.js.map +1 -0
  10. package/dist/build/bytecode.d.ts +29 -0
  11. package/dist/build/bytecode.d.ts.map +1 -0
  12. package/dist/build/bytecode.js +65 -0
  13. package/dist/build/bytecode.js.map +1 -0
  14. package/dist/build/download.d.ts +53 -0
  15. package/dist/build/download.d.ts.map +1 -0
  16. package/dist/build/download.js +327 -0
  17. package/dist/build/download.js.map +1 -0
  18. package/dist/build/notices.d.ts +10 -0
  19. package/dist/build/notices.d.ts.map +1 -0
  20. package/dist/build/notices.js +109 -0
  21. package/dist/build/notices.js.map +1 -0
  22. package/dist/build/pbs.d.ts +12 -0
  23. package/dist/build/pbs.d.ts.map +1 -0
  24. package/dist/build/pbs.js +36 -0
  25. package/dist/build/pbs.js.map +1 -0
  26. package/dist/build/python.d.ts +24 -0
  27. package/dist/build/python.d.ts.map +1 -0
  28. package/dist/build/python.js +106 -0
  29. package/dist/build/python.js.map +1 -0
  30. package/dist/build/sign.d.ts +18 -0
  31. package/dist/build/sign.d.ts.map +1 -0
  32. package/dist/build/sign.js +182 -0
  33. package/dist/build/sign.js.map +1 -0
  34. package/dist/build/source.d.ts +19 -0
  35. package/dist/build/source.d.ts.map +1 -0
  36. package/dist/build/source.js +91 -0
  37. package/dist/build/source.js.map +1 -0
  38. package/dist/build/util.d.ts +20 -0
  39. package/dist/build/util.d.ts.map +1 -0
  40. package/dist/build/util.js +62 -0
  41. package/dist/build/util.js.map +1 -0
  42. package/dist/build.d.ts +22 -12
  43. package/dist/build.d.ts.map +1 -1
  44. package/dist/build.js +218 -270
  45. package/dist/build.js.map +1 -1
  46. package/dist/capabilities.d.ts +51 -0
  47. package/dist/capabilities.d.ts.map +1 -0
  48. package/dist/capabilities.js +232 -0
  49. package/dist/capabilities.js.map +1 -0
  50. package/dist/cli.d.ts +37 -1
  51. package/dist/cli.d.ts.map +1 -1
  52. package/dist/cli.js +188 -39
  53. package/dist/cli.js.map +1 -1
  54. package/dist/codegen.d.ts.map +1 -1
  55. package/dist/codegen.js +10 -1
  56. package/dist/codegen.js.map +1 -1
  57. package/dist/config.d.ts +19 -1
  58. package/dist/config.d.ts.map +1 -1
  59. package/dist/config.js +30 -12
  60. package/dist/config.js.map +1 -1
  61. package/dist/dev.d.ts +7 -3
  62. package/dist/dev.d.ts.map +1 -1
  63. package/dist/dev.js +120 -16
  64. package/dist/dev.js.map +1 -1
  65. package/dist/doctor.d.ts +34 -1
  66. package/dist/doctor.d.ts.map +1 -1
  67. package/dist/doctor.js +268 -19
  68. package/dist/doctor.js.map +1 -1
  69. package/dist/prune.d.ts.map +1 -1
  70. package/dist/prune.js +1 -0
  71. package/dist/prune.js.map +1 -1
  72. package/dist/ui/caps.d.ts +45 -0
  73. package/dist/ui/caps.d.ts.map +1 -0
  74. package/dist/ui/caps.js +81 -0
  75. package/dist/ui/caps.js.map +1 -0
  76. package/dist/ui/index.d.ts +106 -0
  77. package/dist/ui/index.d.ts.map +1 -0
  78. package/dist/ui/index.js +264 -0
  79. package/dist/ui/index.js.map +1 -0
  80. package/dist/ui/prompts.d.ts +39 -0
  81. package/dist/ui/prompts.d.ts.map +1 -0
  82. package/dist/ui/prompts.js +209 -0
  83. package/dist/ui/prompts.js.map +1 -0
  84. package/dist/ui/style.d.ts +27 -0
  85. package/dist/ui/style.d.ts.map +1 -0
  86. package/dist/ui/style.js +71 -0
  87. package/dist/ui/style.js.map +1 -0
  88. package/dist/version.d.ts +5 -0
  89. package/dist/version.d.ts.map +1 -0
  90. package/dist/version.js +15 -0
  91. package/dist/version.js.map +1 -0
  92. package/dist/wrap.d.ts +69 -0
  93. package/dist/wrap.d.ts.map +1 -0
  94. package/dist/wrap.js +292 -0
  95. package/dist/wrap.js.map +1 -0
  96. package/dist/wrapbuild.d.ts +33 -0
  97. package/dist/wrapbuild.d.ts.map +1 -0
  98. package/dist/wrapbuild.js +83 -0
  99. package/dist/wrapbuild.js.map +1 -0
  100. package/dist/wrapconfig.d.ts +52 -0
  101. package/dist/wrapconfig.d.ts.map +1 -0
  102. package/dist/wrapconfig.js +117 -0
  103. package/dist/wrapconfig.js.map +1 -0
  104. package/package.json +4 -3
package/dist/build.js CHANGED
@@ -1,291 +1,239 @@
1
- /** `pylair build` — the M0 recipe, generalized:
2
- * fetch standalone CPython → stage site-packages via the bundled
3
- * interpreter (native wheels only — no cross-compile) → stage app
4
- * source → prune → tauri build → unsigned warning.
1
+ /** `pylair build`, the M0 recipe, generalized:
2
+ * fetch standalone CPython, stage site-packages via the bundled
3
+ * interpreter (native wheels only, no cross-compile), stage app
4
+ * source, prune, tauri build, unsigned warning.
5
+ *
6
+ * Output goes through ui/ (one step line per stage with its time; the tauri
7
+ * build folded into one progress line on a live terminal; plain, stable text
8
+ * everywhere else).
5
9
  */
6
- import { createHash } from "node:crypto";
7
- import { execFileSync, spawnSync } from "node:child_process";
8
- import { cpSync, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
9
- import { get } from "node:https";
10
+ /*
11
+ * Where each step lives. build() below calls into them; this file also
12
+ * re-exports the helpers other modules and the tests import from here.
13
+ *
14
+ * build/pbs.ts python-build-standalone release, versions, host
15
+ * triples, committed SHA-256 table, hostTriple()
16
+ * build/download.ts the interpreter download: retry, resume, progress,
17
+ * timeout, cache and SHA-256 check (ensureTarball)
18
+ * build/python.ts fetchPython (unpack CPython), uv export and
19
+ * `uv pip install` into site-packages (stageEnv)
20
+ * build/source.ts stageSource: copy the app source, refuse secrets
21
+ * build/notices.ts stageNotices: THIRD-PARTY-NOTICES for the bundle
22
+ * build/bytecode.ts compileBytecode: checked-hash pycs for the bundle
23
+ * build/sign.ts macOS ad-hoc signing of the built .app (adHocSign)
24
+ * build/artifacts.ts the installers a build produced, for the summary
25
+ * build/util.ts isWin, run() and runTool(), shared by build() and the modules
26
+ * ./prune.ts pruning the staged tree (DEFAULT_PRUNE, prune)
27
+ * ./config.ts [tool.pylair] and tauri.conf.json loading
28
+ */
29
+ import { spawnSync } from "node:child_process";
30
+ import { existsSync, rmSync } from "node:fs";
10
31
  import { arch, platform, tmpdir } from "node:os";
11
32
  import { join } from "node:path";
12
33
  import { fileURLToPath } from "node:url";
13
- import { importRoot, loadConfig, loadTauriConfig, tauriCliEntry } from "./config.js";
34
+ import { importRoot, loadConfig, loadTauriConfig, tauriCliEntry, windowsSigningConfigured, } from "./config.js";
35
+ import { assertCapabilities, checkPatterns, formatFinding, loadCapabilities } from "./capabilities.js";
36
+ import { loadManifest } from "./manifest.js";
14
37
  import { DEFAULT_PRUNE, prune } from "./prune.js";
15
- const PBS_TAG = "20251120";
16
- const PBS_VERSIONS = { "3.12": "3.12.12", "3.13": "3.13.9" };
17
- const HOST_TRIPLES = {
18
- "darwin:arm64": "aarch64-apple-darwin",
19
- "darwin:x64": "x86_64-apple-darwin",
20
- "win32:x64": "x86_64-pc-windows-msvc",
21
- "linux:x64": "x86_64-unknown-linux-gnu",
22
- "linux:arm64": "aarch64-unknown-linux-gnu",
23
- };
24
- const isWin = platform() === "win32";
25
- /** Expected SHA256 per asset, committed in-repo — a hash fetched from the
26
- * same release as the tarball catches corruption but not a tampered
27
- * release. Bump together with PBS_TAG/PBS_VERSIONS; verify each value
28
- * against upstream SHA256SUMS before committing.
29
- */
30
- const PBS_SHA256 = {
31
- "3.12.12-aarch64-apple-darwin": "9955ac87eff0d561e64920dc46fd8625912d2c2be4a53c66ad80125d6d9fbdb7",
32
- "3.12.12-aarch64-unknown-linux-gnu": "4c4594cb38ddf6769f11f86818a4c6617652f4994e5a962eb4f8cf0ec977a1be",
33
- "3.12.12-x86_64-apple-darwin": "1b4d8eec597ff69a3b67946f30622a6c25c6612e6d15aa431b864ebff66ac8a1",
34
- "3.12.12-x86_64-pc-windows-msvc": "70ecfaf0bfc58298db11d6389be92c29ec4ef8cd93ebb6a7e54b41d9fc056b10",
35
- "3.12.12-x86_64-unknown-linux-gnu": "8d2cd1393c1aec9d701cebeccb83d1519951f71d3ecb42d5e70c70af4db9be34",
36
- "3.13.9-aarch64-apple-darwin": "29d38bd5fbe267b37cecac990015c662796edcf51c2f5e321d59ec06a1850816",
37
- "3.13.9-aarch64-unknown-linux-gnu": "fdc5d80488b64fcef3b99f297618f68e5374c13d89e888a66abeff4967afd308",
38
- "3.13.9-x86_64-apple-darwin": "9da51afb00480a8ccd4909bd302c80d9c104d633c5e865cf37dd5e587185e125",
39
- "3.13.9-x86_64-pc-windows-msvc": "f4c22b31ddbf8d7824cbcba2d8707621c2c8fab1fb6d2c1810c2bb0304d8e9a8",
40
- "3.13.9-x86_64-unknown-linux-gnu": "1bc9a94ab2425fb6ae58e45f69cab61647759b57895649701390822d976fa923",
41
- };
42
- export function hostTriple() {
43
- const t = HOST_TRIPLES[`${platform()}:${arch()}`];
44
- if (!t)
45
- throw new Error(`no standalone CPython build for ${platform()}/${arch()}`);
46
- return t;
47
- }
48
- function download(url, to) {
49
- return new Promise((res, rej) => {
50
- const follow = (u) => get(u, (r) => {
51
- if (r.statusCode >= 300 && r.statusCode < 400 && r.headers.location)
52
- return follow(r.headers.location);
53
- if (r.statusCode !== 200)
54
- return rej(new Error(`GET ${u} -> ${r.statusCode}`));
55
- const out = createWriteStream(to);
56
- r.pipe(out);
57
- out.on("finish", () => out.close(() => res()));
58
- out.on("error", rej);
59
- }).on("error", rej);
60
- follow(url);
61
- });
62
- }
63
- async function fetchPython(resources, cacheDir, versionClass) {
64
- const ver = PBS_VERSIONS[versionClass];
65
- if (!ver)
66
- throw new Error(`python-version "${versionClass}" not available — supported: ${Object.keys(PBS_VERSIONS).join(", ")}`);
67
- const triple = hostTriple();
68
- const asset = `cpython-${ver}+${PBS_TAG}-${triple}-install_only_stripped.tar.gz`;
69
- const base = `https://github.com/astral-sh/python-build-standalone/releases/download/${PBS_TAG}`;
70
- mkdirSync(resources, { recursive: true });
71
- mkdirSync(cacheDir, { recursive: true });
72
- const tarball = join(cacheDir, asset);
73
- if (!existsSync(tarball)) {
74
- console.log(`fetching ${asset}`);
75
- await download(`${base}/${asset}`, tarball);
76
- }
77
- else {
78
- console.log(`using cached ${asset}`);
79
- }
80
- // The interpreter ships to end users — verify against hashes committed
81
- // in-repo (see PBS_SHA256), not a checksum file from the same release.
82
- const want = PBS_SHA256[`${ver}-${triple}`];
83
- if (!want)
84
- throw new Error(`no committed SHA256 for ${ver}/${triple}`);
85
- const got = createHash("sha256").update(readFileSync(tarball)).digest("hex");
86
- if (got !== want)
87
- throw new Error(`SHA256 mismatch for ${asset}: got ${got}, want ${want} — refusing to bundle`);
88
- const dest = join(resources, "python");
89
- rmSync(dest, { recursive: true, force: true });
90
- mkdirSync(dest, { recursive: true });
91
- execFileSync("tar", ["-xzf", tarball, "-C", dest, "--strip-components=1"], { stdio: "inherit" });
92
- const py = join(dest, isWin ? "python.exe" : "bin/python3");
93
- if (!existsSync(py))
94
- throw new Error(`expected interpreter at ${py}`);
95
- return py;
96
- }
97
- function stageEnv(resources, python, appDir, reqs, cacheDir) {
98
- const target = join(resources, "site-packages");
99
- rmSync(target, { recursive: true, force: true });
100
- // dev uses `uv sync` (uv.lock) — build must install the SAME locked set,
101
- // hashed, or dev/prod parity is a fiction. requirements.txt is the
102
- // fallback for projects that don't lock.
103
- const lock = join(appDir, "uv.lock");
104
- let reqsFile = reqs;
105
- let exported;
106
- if (existsSync(lock)) {
107
- exported = join(cacheDir, "requirements.exported.txt");
108
- execFileSync("uv", ["export", "--frozen", "--format", "requirements-txt", "-o", exported], { cwd: appDir, stdio: "inherit" });
109
- reqsFile = exported;
110
- }
111
- else if (!existsSync(reqs)) {
112
- console.log(`no uv.lock and no ${reqs} — bundling stdlib only`);
113
- return;
114
- }
115
- else {
116
- console.warn("warning: no uv.lock — building from requirements.txt; " +
117
- "the bundled env may drift from `pylair dev`'s env");
118
- }
119
- execFileSync("uv", ["pip", "install", "--python", python, "--target", target, "-r", reqsFile], { cwd: appDir, stdio: "inherit" });
120
- }
121
- function run(cmd, args, cwd) {
122
- const r = spawnSync(cmd, args, { cwd, stdio: "inherit" });
123
- if (r.error)
124
- throw new Error(`${cmd} ${args.join(" ")} failed to start: ${r.error.message}`);
125
- if (r.status !== 0)
126
- throw new Error(`${cmd} ${args.join(" ")} exited ${r.status}`);
127
- }
128
- /** Shipped bundles must carry the licenses of what they embed. Collects:
129
- * pylair's own dual license, the interpreter's license tree (PSF license
130
- * requires LICENSE text with redistributed CPython), and each wheel's
131
- * dist-info license files. Runs before prune so nothing collected is
132
- * deleted afterwards. Returns the notice dir.
133
- */
134
- export function stageNotices(resources, pylairDir) {
135
- const out = join(resources, "THIRD-PARTY-NOTICES");
136
- rmSync(out, { recursive: true, force: true });
137
- mkdirSync(out, { recursive: true });
138
- const index = [];
139
- const copyInto = (subdir, src, dest) => {
140
- mkdirSync(join(out, subdir), { recursive: true });
141
- cpSync(src, join(out, subdir, dest));
142
- };
143
- const LICENSEISH = /^(licen[cs]e|copying|notice|authors|copyright)/i;
144
- for (const f of ["LICENSE-MIT", "LICENSE-APACHE"]) {
145
- const src = join(pylairDir, f);
146
- if (existsSync(src))
147
- copyInto("pylair", src, f);
148
- }
149
- index.push("pylair/ — pylair itself (MIT OR Apache-2.0)");
150
- // The interpreter: python-build-standalone ships a licenses/ dir holding
151
- // CPython's license plus every statically-linked dep (OpenSSL, libffi…).
152
- const pyRoot = join(resources, "python");
153
- let found = 0;
154
- const walkPy = (dir) => {
155
- for (const e of readdirSync(dir, { withFileTypes: true })) {
156
- const p = join(dir, e.name);
157
- if (e.isDirectory()) {
158
- if (e.name.toLowerCase() === "licenses") {
159
- cpSync(p, join(out, "python", "licenses"), { recursive: true });
160
- found++;
161
- }
162
- else
163
- walkPy(p);
164
- }
165
- else if (LICENSEISH.test(e.name)) {
166
- copyInto("python", p, e.name);
167
- found++;
168
- }
169
- }
170
- };
171
- if (existsSync(pyRoot))
172
- walkPy(pyRoot);
173
- if (!found) {
174
- mkdirSync(join(out, "python"), { recursive: true });
175
- writeFileSync(join(out, "python", "NOTICE.txt"), "This app bundles CPython (PSF-2.0 license) via python-build-standalone.\n" +
176
- "License texts were not located in the interpreter tree at build time;\n" +
177
- "they ship upstream in the python/licenses directory of each\n" +
178
- "python-build-standalone release.\n");
179
- console.warn("warning: no license files found under resources/python — wrote placeholder NOTICE");
180
- }
181
- index.push("python/ — bundled CPython interpreter (PSF-2.0) and its vendored deps");
182
- // Wheels: every installed dist-info/egg-info carries license files or
183
- // license metadata. Copy whichever exists.
184
- const sp = join(resources, "site-packages");
185
- let wheels = 0;
186
- if (existsSync(sp)) {
187
- for (const e of readdirSync(sp, { withFileTypes: true })) {
188
- if (!e.isDirectory())
189
- continue;
190
- const m = /^(.*?)-[\d.]+.*\.(dist-info|egg-info)$/.exec(e.name);
191
- if (!m)
192
- continue;
193
- const pkg = m[1].replace(/[^\w.-]/g, "_");
194
- const d = join(sp, e.name);
195
- let kept = false;
196
- for (const f of readdirSync(d, { withFileTypes: true })) {
197
- if (f.isDirectory() && f.name.toLowerCase() === "licenses") {
198
- cpSync(join(d, f.name), join(out, pkg, "licenses"), { recursive: true });
199
- kept = true;
200
- }
201
- else if (f.isFile() && LICENSEISH.test(f.name)) {
202
- copyInto(pkg, join(d, f.name), f.name);
203
- kept = true;
204
- }
205
- }
206
- const meta = join(d, "METADATA");
207
- if (existsSync(meta)) {
208
- const lines = readFileSync(meta, "utf-8")
209
- .split("\n")
210
- .filter((l) => /^(License|Classifier: License)/i.test(l));
211
- // Copyleft is legal to ship but app authors deserve to know they
212
- // bundled it — warn, never block.
213
- if (/\b(a?lgpl|gpl)[ -]?v?\d/i.test(lines.join(" ")))
214
- console.warn(`warning: bundled wheel ${e.name} declares a copyleft license`);
215
- if (lines.length) {
216
- mkdirSync(join(out, pkg), { recursive: true });
217
- writeFileSync(join(out, pkg, "METADATA-LICENSE.txt"), lines.join("\n") + "\n");
218
- kept = true;
219
- }
220
- }
221
- if (kept) {
222
- wheels++;
223
- index.push(`${pkg}/ — from ${e.name}`);
224
- }
225
- }
226
- }
227
- writeFileSync(join(out, "INDEX.txt"), index.join("\n") + "\n");
228
- console.log(`third-party notices: pylair, python interpreter, ${wheels} wheel(s)`);
229
- return out;
230
- }
38
+ import { findArtifacts } from "./build/artifacts.js";
39
+ import { compileBytecode } from "./build/bytecode.js";
40
+ import { stageNotices } from "./build/notices.js";
41
+ import { hostTriple } from "./build/pbs.js";
42
+ import { fetchPython, stageEnv } from "./build/python.js";
43
+ import { adHocSign } from "./build/sign.js";
44
+ import { stageSource } from "./build/source.js";
45
+ import { isWin, runTool } from "./build/util.js";
46
+ import { formatDuration, formatSize, ui } from "./ui/index.js";
47
+ import { wrapWarnings } from "./wrapconfig.js";
48
+ import { ROOT_SOURCE_EXCLUDES, STAGED_APP, runSmokeImports, smokeImports, sourceIsRoot, writeRuntimeFile, } from "./wrapbuild.js";
49
+ export { compileBytecode, PYC_INVALIDATION_MODE } from "./build/bytecode.js";
50
+ export { DownloadError, backoffMs, download, downloadTimeoutMs, downloadWithRetry, ensureTarball, } from "./build/download.js";
51
+ export { stageNotices } from "./build/notices.js";
52
+ export { hostTriple } from "./build/pbs.js";
53
+ export { stageSource } from "./build/source.js";
54
+ export { requirementsHaveHashes, uvExportArgs, uvPipInstallArgs } from "./build/python.js";
55
+ const UNSIGNED_WARNING = "UNSIGNED BUILD: Gatekeeper and SmartScreen will warn users (see docs/build.md#signing)";
231
56
  export async function build(opts) {
232
57
  const { appDir } = opts;
58
+ const verbose = opts.verbose ?? false;
59
+ const started = Date.now();
233
60
  const tauriDir = join(appDir, "src-tauri");
234
61
  const resources = join(tauriDir, "resources");
235
62
  const tconf = loadTauriConfig(appDir);
236
63
  const cfg = loadConfig(appDir);
64
+ const wrap = cfg.mode === "wrap" ? cfg.wrap : undefined;
65
+ if (wrap)
66
+ for (const w of wrapWarnings(wrap))
67
+ ui.warn(`warning: ${w}`);
68
+ // Capability scopes are checked first: a bad `allow: []` or a half-scoped
69
+ // window is a configuration error, not worth a Python download to find out.
70
+ for (const w of assertCapabilities(appDir))
71
+ ui.warn(formatFinding(w), { bare: true });
237
72
  const targetTriple = hostTriple(); // cross-compile refused by construction
238
- console.log(`building ${tconf.productName} ${tconf.version} for ${platform()}/${arch()} (${targetTriple})`);
239
- console.log("note: pylair builds native bundles only — run this on each target OS");
73
+ ui.header("pylair build", [
74
+ ["app", tconf.productName],
75
+ ["version", tconf.version],
76
+ ["platform", `${platform()}/${arch()} (${targetTriple}), native build only`],
77
+ ["mode", wrap ? `wrap (${wrap.framework})` : "bridge"],
78
+ ], [
79
+ `building ${tconf.productName} ${tconf.version} for ${platform()}/${arch()} (${targetTriple})`,
80
+ "note: pylair builds native bundles only; run this on each target OS",
81
+ ]);
82
+ const stages = [
83
+ "bundle python",
84
+ "install deps",
85
+ "stage app",
86
+ "prune",
87
+ "compile bytecode",
88
+ "smoke test",
89
+ ...(opts.stageOnly ? [] : ["build installer"]),
90
+ ];
91
+ ui.setStepWidth(Math.max(...stages.map((s) => s.length)));
240
92
  const cacheDir = join(appDir, ".pylair", "cache");
241
- const bundled = opts.skipFetch
242
- ? join(resources, "python", isWin ? "python.exe" : "bin/python3")
243
- : await fetchPython(resources, cacheDir, cfg.pythonVersion);
244
- stageEnv(resources, bundled, appDir, join(appDir, cfg.requirements), cacheDir);
245
- // Licenses ship with the bundle — collect before prune can remove sources.
246
- stageNotices(resources, fileURLToPath(new URL("..", import.meta.url)));
93
+ const bundled = await ui.step("bundle python", async (s) => {
94
+ if (opts.skipFetch) {
95
+ s.detail("reusing staged python");
96
+ return join(resources, "python", isWin ? "python.exe" : "bin/python3");
97
+ }
98
+ return fetchPython(resources, cacheDir, cfg.pythonVersion);
99
+ });
100
+ await ui.step("install deps", (s) => stageEnv(resources, bundled, appDir, join(appDir, cfg.requirements), cacheDir, { step: s, verbose }));
247
101
  // Stage app source so resources/ mirrors the installed layout.
102
+ // Wrap mode stages the app as `app/` whatever the source dir is called, so
103
+ // tauri.conf.json's resource mapping never changes with `source`.
104
+ const staged = wrap ? STAGED_APP : cfg.source;
248
105
  const srcDir = join(appDir, cfg.source);
249
- if (!existsSync(srcDir))
250
- throw new Error(`source dir ${srcDir} missing`);
251
- rmSync(join(resources, cfg.source), { recursive: true, force: true });
252
- cpSync(srcDir, join(resources, cfg.source), { recursive: true });
253
- const res = prune(resources, [...DEFAULT_PRUNE, ...cfg.prune]);
254
- const mib = (res.bytesFreed / 2 ** 20).toFixed(1);
255
- console.log(`pruned ${res.removed} paths (${mib} MiB) from staged resources`);
106
+ await ui.step("stage app", () => {
107
+ // Licenses ship with the bundle: collect before prune can remove sources.
108
+ stageNotices(resources, fileURLToPath(new URL("..", import.meta.url)));
109
+ if (!existsSync(srcDir))
110
+ throw new Error(`source dir ${srcDir} missing`);
111
+ if (wrap?.entry && !existsSync(join(srcDir, wrap.entry)))
112
+ throw new Error(`[tool.pylair.wrap] entry ${wrap.entry} not found under ${srcDir}`);
113
+ rmSync(join(resources, staged), { recursive: true, force: true });
114
+ stageSource(srcDir, join(resources, staged), cfg.include, undefined, wrap && sourceIsRoot(appDir, cfg.source) ? ROOT_SOURCE_EXCLUDES : []);
115
+ // What the plugin reads at startup: the launcher command and the window options.
116
+ if (wrap)
117
+ writeRuntimeFile(join(resources, "pylair-wrap.json"), cfg, STAGED_APP);
118
+ });
119
+ await ui.step("prune", (s) => {
120
+ const res = prune(resources, [...DEFAULT_PRUNE, ...cfg.prune]);
121
+ const mib = (res.bytesFreed / 2 ** 20).toFixed(1);
122
+ if (ui.caps.fancy)
123
+ s.detail(`${res.removed} paths, ${mib} MiB freed`);
124
+ else
125
+ ui.line(`pruned ${res.removed} paths (${mib} MiB) from staged resources`);
126
+ });
127
+ // Precompile what survives the prune: read-only installs cannot
128
+ // write pycs at launch, so the bundle ships them ready-made.
129
+ await ui.step("compile bytecode", (s) => {
130
+ const failed = compileBytecode(resources, bundled, ["site-packages", staged]);
131
+ if (failed.length)
132
+ s.detail(`${failed.length} file(s) left uncompiled`);
133
+ });
256
134
  // Over-pruning must fail at build time, not on the user's machine:
257
- // import the app module with the staged tree exactly as the bundle sees it.
135
+ // import the app (bridge) or the framework (wrap) with the staged tree
136
+ // exactly as the bundle sees it.
258
137
  const sep = isWin ? ";" : ":";
259
- // The import root is the PARENT of the staged source dir ("backend.app"
260
- // resolves from resources/, not resources/backend/). Run from an unrelated
261
- // cwd so the project checkout can't satisfy the import by accident.
262
- const check = spawnSync(bundled, ["-c", `import ${cfg.appModule}; print("staged import ok")`], {
263
- encoding: "utf-8",
264
- cwd: tmpdir(),
265
- env: {
266
- ...process.env,
267
- PYTHONPATH: `${importRoot(resources, cfg.source)}${sep}${join(resources, "site-packages")}`,
268
- PYTHONNOUSERSITE: "1",
269
- },
138
+ await ui.step("smoke test", (s) => {
139
+ if (wrap) {
140
+ // The server runs in the staged app dir; the framework (gradio,
141
+ // streamlit, or the `-m` module of a command) must import with the
142
+ // bundled interpreter after the prune.
143
+ const failure = runSmokeImports(bundled, smokeImports(wrap), {
144
+ PYTHONPATH: `${join(resources, STAGED_APP)}${sep}${join(resources, "site-packages")}`,
145
+ PYTHONNOUSERSITE: "1",
146
+ PYTHONDONTWRITEBYTECODE: "1",
147
+ }, tmpdir());
148
+ if (failure)
149
+ throw new Error(`staged bundle failed the framework import check (${smokeImports(wrap).join(", ")}): ` +
150
+ `pruning or missing deps? ${failure}`);
151
+ s.detail(`imports ${smokeImports(wrap).join(", ")}`);
152
+ }
153
+ else {
154
+ // The import root is the PARENT of the staged source dir ("backend.app"
155
+ // resolves from resources/, not resources/backend/). Run from an unrelated
156
+ // cwd so the project checkout can't satisfy the import by accident.
157
+ // PYTHONDONTWRITEBYTECODE: the check exercises the compiled pycs rather
158
+ // than writing a second, non-deterministic set into the staged tree.
159
+ const check = spawnSync(bundled, ["-c", `import ${cfg.appModule}; print("staged import ok")`], {
160
+ encoding: "utf-8",
161
+ cwd: tmpdir(),
162
+ env: {
163
+ ...process.env,
164
+ PYTHONPATH: `${importRoot(resources, cfg.source)}${sep}${join(resources, "site-packages")}`,
165
+ PYTHONNOUSERSITE: "1",
166
+ PYTHONDONTWRITEBYTECODE: "1",
167
+ },
168
+ });
169
+ if (check.status !== 0)
170
+ throw new Error(`staged bundle failed the import check (${cfg.appModule}): ` +
171
+ `pruning or missing deps? ${check.stderr?.trim()}`);
172
+ s.detail(`imports ${cfg.appModule}`);
173
+ }
174
+ // With the app importable, ask it which functions it exposes and warn
175
+ // about scope patterns that match none. Best effort: a failure here only
176
+ // skips the warning, it never fails the build.
177
+ const caps = wrap ? [] : loadCapabilities(appDir).capabilities;
178
+ if (caps.length) {
179
+ try {
180
+ const m = loadManifest({
181
+ python: bundled,
182
+ module: cfg.appModule,
183
+ cwd: tmpdir(),
184
+ env: {
185
+ PYTHONPATH: `${importRoot(resources, cfg.source)}${sep}${join(resources, "site-packages")}`,
186
+ PYTHONNOUSERSITE: "1",
187
+ PYTHONDONTWRITEBYTECODE: "1",
188
+ },
189
+ });
190
+ const names = (m.functions ?? []).map((f) => f.name);
191
+ for (const w of checkPatterns(caps, names))
192
+ ui.warn(formatFinding(w), { bare: true });
193
+ }
194
+ catch (e) {
195
+ ui.note(`note: skipped the capability pattern check (could not list exposed functions: ${e.message.split("\n")[0]})`);
196
+ }
197
+ }
270
198
  });
271
- if (check.status !== 0)
272
- throw new Error(`staged bundle failed the import check (${cfg.appModule}) — ` +
273
- `pruning or missing deps? ${check.stderr?.trim()}`);
274
- // ── tauri build ────────────────────────────────────────────────────
275
- // NOTE: TAURI_SIGNING_PRIVATE_KEY signs *updater* artifacts, not the app —
276
- // it must NOT silence the unsigned warning.
277
- const hasSigning = !!(process.env.APPLE_SIGNING_IDENTITY ||
278
- process.env.APPLE_CERTIFICATE ||
279
- process.env.WINDOWS_CERTIFICATE_THUMBPRINT);
280
- run(process.execPath, [tauriCliEntry(appDir), "build", ...(opts.tauriArgs ?? [])], appDir);
281
- if (!hasSigning) {
282
- console.warn(`
283
- ╔══════════════════════════════════════════════════════════════════╗
284
- ║ UNSIGNED BUILD — this bundle is not code-signed or notarized. ║
285
- ║ macOS Gatekeeper and Windows SmartScreen will warn users. ║
286
- ║ To sign: set APPLE_SIGNING_IDENTITY / TAURI_SIGNING_PRIVATE_KEY / ║
287
- ║ WINDOWS_CERTIFICATE_THUMBPRINT (see docs/build.md). ║
288
- ╚══════════════════════════════════════════════════════════════════╝`);
199
+ if (opts.stageOnly) {
200
+ ui.line();
201
+ ui.summary("ok", `stage-only: resources staged and verified; tauri build skipped (${formatDuration(Date.now() - started)})`);
202
+ return;
289
203
  }
204
+ // Signing is per-platform: only macOS creds (env OR tauri.conf
205
+ // signingIdentity) mean this Mac build gets a real signature; a Windows
206
+ // thumbprint on its own must not suppress the ad-hoc pass.
207
+ // NOTE: TAURI_SIGNING_PRIVATE_KEY signs *updater* artifacts, not the app,
208
+ // so it must NOT silence the unsigned warning.
209
+ const appleSigned = !!(process.env.APPLE_SIGNING_IDENTITY ||
210
+ process.env.APPLE_CERTIFICATE ||
211
+ tconf.macSigningIdentity);
212
+ const hasSigning = platform() === "darwin"
213
+ ? appleSigned
214
+ : platform() === "win32"
215
+ ? windowsSigningConfigured(appDir)
216
+ : true; // no signing concept on Linux: don't warn
217
+ const tauriArgs = opts.tauriArgs ?? [];
218
+ const tauriStarted = Date.now();
219
+ await ui.step("build installer", (s) => runTool(ui, process.execPath, [tauriCliEntry(appDir), "build", ...tauriArgs], appDir, {
220
+ step: s,
221
+ verbose: verbose || tauriArgs.includes("--verbose"),
222
+ }));
223
+ // Unsigned macOS builds get a full-bundle ad-hoc signature, better
224
+ // than the linker stub Tauri leaves on just the main binary. Skipped
225
+ // entirely when a real identity is configured: ad-hoc must never run
226
+ // over a proper signature.
227
+ if (platform() === "darwin" && !appleSigned)
228
+ await ui.step("ad-hoc sign", () => adHocSign(tauriDir, tconf.productName));
229
+ const artifacts = findArtifacts(tauriDir, tauriStarted, { debug: tauriArgs.includes("--debug") });
230
+ ui.line();
231
+ ui.summary("ok", `built ${tconf.productName} ${tconf.version} in ${formatDuration(Date.now() - started)}`);
232
+ if (artifacts.length)
233
+ ui.rows(artifacts.map((a) => [formatSize(a.bytes).padStart(9), a.path]), 2);
234
+ else
235
+ ui.note(" no installer found under the bundle directory (built with --no-bundle?)");
236
+ if (!hasSigning)
237
+ ui.warn(UNSIGNED_WARNING, { bare: true });
290
238
  }
291
239
  //# sourceMappingURL=build.js.map
package/dist/build.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAW,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,OAAO,GAAG,UAAU,CAAC;AAC3B,MAAM,YAA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,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;IAC3G,IAAI,SAAS,CAAC,MAAM;QAClB,EAAE,CAAC,IAAI,CACL,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAU,CAAC,EACxE,CAAC,CACF,CAAC;;QACC,EAAE,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;IAC1F,IAAI,CAAC,UAAU;QAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Static checks over `src-tauri/capabilities/*.json|toml` for the
3
+ * per-function permissions of `tauri-plugin-pylair` (docs/security.md,
4
+ * "Restricting functions per window"). Run by `pylair build` and
5
+ * `pylair doctor`.
6
+ *
7
+ * The plugin enforces the scopes at runtime and fails closed; these checks
8
+ * exist to catch the configurations that are legal but almost certainly not
9
+ * what the author meant, before an app ships:
10
+ *
11
+ * - `allow: []` on a pylair permission: Tauri treats an empty list as "no
12
+ * scope entries", which permits EVERY function. (error)
13
+ * - a window that scopes `python-call` but not `python-call-stream`, or the
14
+ * reverse: the unscoped command is an open side door. (error)
15
+ * - a malformed scope entry: the plugin refuses every call it covers. (error)
16
+ * - a pattern that matches no exposed function: a typo, or a function that
17
+ * was renamed. (warning, only when the exposed names are known)
18
+ * - different scopes on the two commands of one window. (warning)
19
+ */
20
+ export interface Finding {
21
+ level: "error" | "warn";
22
+ /** Path relative to the app dir, forward slashes. */
23
+ file: string;
24
+ /** Capability `identifier`; empty when the file did not parse. */
25
+ capability: string;
26
+ message: string;
27
+ }
28
+ export interface Capability {
29
+ file: string;
30
+ identifier: string;
31
+ windows: string[];
32
+ permissions: unknown[];
33
+ }
34
+ /** The plugin's matching rule: exact, or a single trailing `*` as a prefix
35
+ * wildcard. A `*` anywhere else is a literal character. Keep in step with
36
+ * `fn_scope::pattern_matches` in the plugin. */
37
+ export declare function patternMatches(pattern: string, name: string): boolean;
38
+ export declare function loadCapabilities(appDir: string): {
39
+ capabilities: Capability[];
40
+ findings: Finding[];
41
+ };
42
+ /** Warn for every pattern that matches no name in `exposed`. */
43
+ export declare function checkPatterns(caps: Capability[], exposed: string[]): Finding[];
44
+ export declare function checkCapabilities(caps: Capability[], exposed?: string[]): Finding[];
45
+ export declare function formatFinding(f: Finding): string;
46
+ /**
47
+ * The static checks `pylair build` runs before any slow work: throws,
48
+ * listing every error, if any; otherwise returns the warnings.
49
+ */
50
+ export declare function assertCapabilities(appDir: string, exposed?: string[]): Finding[];
51
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,OAAO,EAAE,CAAC;CACxB;AAYD;;gDAEgD;AAChD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAErE;AAQD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG;IAChD,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB,CAsCA;AAsED,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAgB9E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CA4DnF;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAGhD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAUhF"}