@pylair/cli 0.1.0-rc.3 → 0.1.0-rc.31
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/artifacts.d.ts +14 -0
- package/dist/build/artifacts.d.ts.map +1 -0
- package/dist/build/artifacts.js +61 -0
- package/dist/build/artifacts.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 +65 -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 +327 -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 +109 -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 +24 -0
- package/dist/build/python.d.ts.map +1 -0
- package/dist/build/python.js +106 -0
- package/dist/build/python.js.map +1 -0
- package/dist/build/sign.d.ts +18 -0
- package/dist/build/sign.d.ts.map +1 -0
- package/dist/build/sign.js +182 -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 +91 -0
- package/dist/build/source.js.map +1 -0
- package/dist/build/util.d.ts +20 -0
- package/dist/build/util.d.ts.map +1 -0
- package/dist/build/util.js +62 -0
- package/dist/build/util.js.map +1 -0
- package/dist/build.d.ts +26 -12
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +240 -270
- 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 +38 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +266 -39
- package/dist/cli.js.map +1 -1
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +12 -1
- package/dist/codegen.js.map +1 -1
- package/dist/config.d.ts +25 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +31 -12
- package/dist/config.js.map +1 -1
- package/dist/dev.d.ts +7 -3
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +120 -16
- package/dist/dev.js.map +1 -1
- package/dist/doctor.d.ts +34 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +268 -19
- package/dist/doctor.js.map +1 -1
- package/dist/keys.d.ts +50 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +192 -0
- package/dist/keys.js.map +1 -0
- package/dist/prune.d.ts.map +1 -1
- package/dist/prune.js +1 -0
- package/dist/prune.js.map +1 -1
- package/dist/ui/caps.d.ts +45 -0
- package/dist/ui/caps.d.ts.map +1 -0
- package/dist/ui/caps.js +81 -0
- package/dist/ui/caps.js.map +1 -0
- package/dist/ui/index.d.ts +106 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +264 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/prompts.d.ts +39 -0
- package/dist/ui/prompts.d.ts.map +1 -0
- package/dist/ui/prompts.js +209 -0
- package/dist/ui/prompts.js.map +1 -0
- package/dist/ui/style.d.ts +27 -0
- package/dist/ui/style.d.ts.map +1 -0
- package/dist/ui/style.js +71 -0
- package/dist/ui/style.js.map +1 -0
- package/dist/update.d.ts +64 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +266 -0
- package/dist/update.js.map +1 -0
- 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 +69 -0
- package/dist/wrap.d.ts.map +1 -0
- package/dist/wrap.js +292 -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 +4 -3
package/dist/wrap.js
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/** `pylair wrap` (alias `pylair init --mode wrap`): turn an existing Python
|
|
2
|
+
* web app into a Pylair wrap-mode app, in place.
|
|
3
|
+
*
|
|
4
|
+
* pylair wrap [entry.py] [--framework command|gradio|streamlit]
|
|
5
|
+
* [--cmd <argv...>] [--source <dir>] [--dir <path>]
|
|
6
|
+
*
|
|
7
|
+
* Dependencies must come from a manifest (docs/wrap-mode-brief.md, decision
|
|
8
|
+
* 3): `pyproject.toml` (ideally with `uv.lock`), or `requirements.txt` as
|
|
9
|
+
* the warned fallback. A bare `app.py` gets an error that offers `uv init`;
|
|
10
|
+
* Pylair does not infer dependencies from imports.
|
|
11
|
+
*
|
|
12
|
+
* What it writes: `[tool.pylair]` / `[tool.pylair.wrap]` in pyproject.toml,
|
|
13
|
+
* and the wrap template's `src-tauri/`, `ui/` and `package.json`, never
|
|
14
|
+
* overwriting a file that exists.
|
|
15
|
+
*/
|
|
16
|
+
import { spawnSync } from "node:child_process";
|
|
17
|
+
import { appendFileSync, existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
18
|
+
import { basename, join } from "node:path";
|
|
19
|
+
import { parse as parseToml } from "smol-toml";
|
|
20
|
+
import { ui } from "./ui/index.js";
|
|
21
|
+
import { askSelect, askText, interactive } from "./ui/prompts.js";
|
|
22
|
+
import { cliVersion } from "./version.js";
|
|
23
|
+
import { parseWrapConfig } from "./wrapconfig.js";
|
|
24
|
+
export const NO_MANIFEST_HELP = (dir) => `no dependency manifest in ${dir}.\n` +
|
|
25
|
+
`Pylair bundles your dependencies into the installer, so they must come from a manifest. ` +
|
|
26
|
+
`It does not guess them from your imports.\n` +
|
|
27
|
+
` uv init # creates pyproject.toml\n` +
|
|
28
|
+
` uv add <packages> # records your dependencies and creates uv.lock\n` +
|
|
29
|
+
`then run \`pylair wrap\` again. (A requirements.txt also works, but pyproject.toml with uv.lock is preferred.)`;
|
|
30
|
+
function mentions(text, pkg) {
|
|
31
|
+
return new RegExp(`(^|[^A-Za-z0-9_-])${pkg}([^A-Za-z0-9_-]|$)`, "im").test(text);
|
|
32
|
+
}
|
|
33
|
+
/** Which framework the manifest says the app uses, if it says. */
|
|
34
|
+
export function inferFramework(manifestText) {
|
|
35
|
+
const g = mentions(manifestText, "gradio");
|
|
36
|
+
const s = mentions(manifestText, "streamlit");
|
|
37
|
+
if (g && !s)
|
|
38
|
+
return "gradio";
|
|
39
|
+
if (s && !g)
|
|
40
|
+
return "streamlit";
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
/** The requirement lines of a requirements.txt as pyproject dependencies,
|
|
44
|
+
* or undefined when it uses anything pip-specific (-r, -e, --hash, urls with
|
|
45
|
+
* options) that does not translate one to one. */
|
|
46
|
+
export function requirementsToDependencies(text) {
|
|
47
|
+
const deps = [];
|
|
48
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
49
|
+
const line = raw.replace(/\s+#.*$/, "").trim();
|
|
50
|
+
if (!line || line.startsWith("#"))
|
|
51
|
+
continue;
|
|
52
|
+
if (line.startsWith("-") || line.includes("--hash"))
|
|
53
|
+
return undefined;
|
|
54
|
+
deps.push(line);
|
|
55
|
+
}
|
|
56
|
+
return deps;
|
|
57
|
+
}
|
|
58
|
+
function tomlString(s) {
|
|
59
|
+
return JSON.stringify(s); // a JSON string is a valid TOML basic string
|
|
60
|
+
}
|
|
61
|
+
export function wrapToml(w, source) {
|
|
62
|
+
const lines = [`[tool.pylair]`, `mode = "wrap"`, `source = ${tomlString(source)}`, ``, `[tool.pylair.wrap]`];
|
|
63
|
+
lines.push(`framework = ${tomlString(w.framework)}`);
|
|
64
|
+
if (w.entry !== undefined)
|
|
65
|
+
lines.push(`entry = ${tomlString(w.entry)}`);
|
|
66
|
+
if (w.cmd)
|
|
67
|
+
lines.push(`cmd = [${w.cmd.map(tomlString).join(", ")}]`);
|
|
68
|
+
if (w.readyPath !== undefined)
|
|
69
|
+
lines.push(`ready-path = ${tomlString(w.readyPath)}`);
|
|
70
|
+
lines.push(`ready-timeout = ${w.readyTimeout}`, `downloads = ${tomlString(w.downloads)}`);
|
|
71
|
+
return lines.join("\n") + "\n";
|
|
72
|
+
}
|
|
73
|
+
const FRAMEWORK_CHOICES = [
|
|
74
|
+
{ value: "command", label: "a server command (uvicorn, gunicorn, ...)" },
|
|
75
|
+
{ value: "gradio", label: "Gradio" },
|
|
76
|
+
{ value: "streamlit", label: "Streamlit" },
|
|
77
|
+
];
|
|
78
|
+
function promptIo() {
|
|
79
|
+
return { input: process.stdin, output: process.stdout, caps: ui.caps };
|
|
80
|
+
}
|
|
81
|
+
/** The interactive framework select for `pylair wrap`: only on a TTY outside
|
|
82
|
+
* CI; otherwise undefined and the caller falls back to the flag error. */
|
|
83
|
+
async function chooseFramework() {
|
|
84
|
+
if (!interactive(process.stdin, process.env))
|
|
85
|
+
return undefined;
|
|
86
|
+
return askSelect(promptIo(), "what does the app run?", FRAMEWORK_CHOICES);
|
|
87
|
+
}
|
|
88
|
+
/** The entry file a gradio/streamlit app needs, asked only on a TTY. */
|
|
89
|
+
async function askEntry(appDir) {
|
|
90
|
+
if (!interactive(process.stdin, process.env))
|
|
91
|
+
return undefined;
|
|
92
|
+
return askText(promptIo(), "entry file (for example app/main.py)", (v) => existsSync(join(appDir, v)) ? undefined : `no such file: ${v}`);
|
|
93
|
+
}
|
|
94
|
+
/** The server argv a "command" framework needs, typed as one line on a TTY. */
|
|
95
|
+
async function askCmd() {
|
|
96
|
+
if (!interactive(process.stdin, process.env))
|
|
97
|
+
return undefined;
|
|
98
|
+
const line = await askText(promptIo(), "server command (for example: python -m uvicorn main:app --port {port})");
|
|
99
|
+
return splitCmd(line);
|
|
100
|
+
}
|
|
101
|
+
/** Split a typed command line into argv, honoring single and double quotes.
|
|
102
|
+
* Not a shell parser: no escapes or operators, just quoting. */
|
|
103
|
+
export function splitCmd(text) {
|
|
104
|
+
const out = [];
|
|
105
|
+
let cur = "";
|
|
106
|
+
let quote;
|
|
107
|
+
let seen = false;
|
|
108
|
+
for (const ch of text) {
|
|
109
|
+
if (quote !== undefined) {
|
|
110
|
+
if (ch === quote)
|
|
111
|
+
quote = undefined;
|
|
112
|
+
else
|
|
113
|
+
cur += ch;
|
|
114
|
+
}
|
|
115
|
+
else if (ch === '"' || ch === "'") {
|
|
116
|
+
quote = ch;
|
|
117
|
+
seen = true;
|
|
118
|
+
}
|
|
119
|
+
else if (/\s/.test(ch)) {
|
|
120
|
+
if (cur || seen) {
|
|
121
|
+
out.push(cur);
|
|
122
|
+
cur = "";
|
|
123
|
+
seen = false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
cur += ch;
|
|
128
|
+
seen = true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (cur || seen)
|
|
132
|
+
out.push(cur);
|
|
133
|
+
return out;
|
|
134
|
+
}
|
|
135
|
+
async function promptYesNo(question) {
|
|
136
|
+
if (!process.stdin.isTTY)
|
|
137
|
+
return false;
|
|
138
|
+
const { createInterface } = await import("node:readline/promises");
|
|
139
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
140
|
+
try {
|
|
141
|
+
return /^y(es)?$/i.test((await rl.question(`${question} [y/N] `)).trim());
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
rl.close();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
export async function initWrap(opts) {
|
|
148
|
+
const { appDir } = opts;
|
|
149
|
+
const log = opts.log ??
|
|
150
|
+
((m) => (m.startsWith("warning:") && ui.caps.fancy ? ui.warn(m) : ui.line(m)));
|
|
151
|
+
const ask = opts.ask ?? promptYesNo;
|
|
152
|
+
const pyproject = join(appDir, "pyproject.toml");
|
|
153
|
+
const requirements = join(appDir, "requirements.txt");
|
|
154
|
+
// A project that already is a wrap app only needs its missing files.
|
|
155
|
+
let existing;
|
|
156
|
+
if (existsSync(pyproject)) {
|
|
157
|
+
try {
|
|
158
|
+
existing = parseToml(readFileSync(pyproject, "utf-8")).tool?.pylair;
|
|
159
|
+
}
|
|
160
|
+
catch (e) {
|
|
161
|
+
throw new Error(`could not parse ${pyproject}: ${e.message}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (existing && existing.mode === "bridge")
|
|
165
|
+
throw new Error(`${pyproject} is a bridge-mode app ([tool.pylair] mode = "bridge"); not converting it`);
|
|
166
|
+
// 1. A manifest, or the helpful error. A bare app.py is the common case.
|
|
167
|
+
if (!existsSync(pyproject) && !existsSync(requirements)) {
|
|
168
|
+
log(`pylair wrap: ${NO_MANIFEST_HELP(appDir)}`);
|
|
169
|
+
if (await ask("Run `uv init --bare` here now?")) {
|
|
170
|
+
const r = spawnSync("uv", ["init", "--bare"], { cwd: appDir, stdio: "inherit" });
|
|
171
|
+
if (r.error || r.status !== 0)
|
|
172
|
+
throw new Error("`uv init` failed or uv is not installed (https://docs.astral.sh/uv/)");
|
|
173
|
+
log("pylair wrap: created pyproject.toml. Add your dependencies with `uv add <packages>`, then run `pylair wrap` again.");
|
|
174
|
+
}
|
|
175
|
+
throw new Error("a dependency manifest is required before wrapping an app");
|
|
176
|
+
}
|
|
177
|
+
const manifestText = (existsSync(pyproject) ? readFileSync(pyproject, "utf-8") : "") +
|
|
178
|
+
"\n" +
|
|
179
|
+
(existsSync(requirements) ? readFileSync(requirements, "utf-8") : "");
|
|
180
|
+
// 2. The config: kept if the project already has one, else derived.
|
|
181
|
+
let config;
|
|
182
|
+
let source;
|
|
183
|
+
let pendingToml;
|
|
184
|
+
if (existing?.mode === "wrap") {
|
|
185
|
+
config = parseWrapConfig(existing.wrap, pyproject);
|
|
186
|
+
source = String(existing.source ?? "app");
|
|
187
|
+
log("pylair wrap: [tool.pylair] mode = \"wrap\" already present; keeping it");
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
if (existing && Object.keys(existing).length)
|
|
191
|
+
throw new Error(`${pyproject} already has a [tool.pylair] table without mode = "wrap"; edit it by hand`);
|
|
192
|
+
const framework = opts.framework ??
|
|
193
|
+
(opts.cmd ? "command" : inferFramework(manifestText)) ??
|
|
194
|
+
(await (opts.chooseFramework ?? chooseFramework)());
|
|
195
|
+
if (!framework)
|
|
196
|
+
throw new Error(`cannot tell which framework to run: pass --framework command|gradio|streamlit ` +
|
|
197
|
+
`(and --cmd <argv...> for command, or an entry file for gradio/streamlit)`);
|
|
198
|
+
// A "command" framework needs the server argv, other frameworks an
|
|
199
|
+
// entry file; when the command line did not give them a TTY gets one
|
|
200
|
+
// more prompt before the config error can.
|
|
201
|
+
const entryOpt = framework !== "command" && opts.entry === undefined
|
|
202
|
+
? await (opts.askEntry ?? (() => askEntry(appDir)))()
|
|
203
|
+
: undefined;
|
|
204
|
+
const cmdOpt = framework === "command" && opts.cmd === undefined ? await (opts.askCmd ?? askCmd)() : opts.cmd;
|
|
205
|
+
const entryPath = (opts.entry ?? entryOpt)?.replace(/\\/g, "/");
|
|
206
|
+
source = opts.source ?? (entryPath && entryPath.includes("/") ? entryPath.slice(0, entryPath.lastIndexOf("/")) : entryPath ? "." : "app");
|
|
207
|
+
const entryInSource = entryPath && source !== "." && entryPath.startsWith(source + "/") ? entryPath.slice(source.length + 1) : entryPath;
|
|
208
|
+
config = parseWrapConfig({
|
|
209
|
+
framework,
|
|
210
|
+
...(framework === "command" ? { cmd: cmdOpt } : { entry: entryInSource }),
|
|
211
|
+
}, pyproject);
|
|
212
|
+
if (entryPath && !existsSync(join(appDir, source, entryInSource ?? entryPath)))
|
|
213
|
+
throw new Error(`entry ${entryPath} not found under ${join(appDir, source)}`);
|
|
214
|
+
pendingToml = wrapToml(config, source);
|
|
215
|
+
}
|
|
216
|
+
// 3. The window shell, from the scaffolder that owns the wrap template
|
|
217
|
+
// (so `pylair wrap` and `create-pylair --mode wrap` can never drift).
|
|
218
|
+
// It goes first: if it refuses (wrap mode not published yet), nothing in
|
|
219
|
+
// the project has been touched.
|
|
220
|
+
const name = readName(pyproject) ?? (basename(appDir).toLowerCase().replace(/[^a-z0-9-]/g, "-") || "app");
|
|
221
|
+
const shell = runScaffolder(appDir, name, opts.local);
|
|
222
|
+
// 4. Only now write the config.
|
|
223
|
+
if (pendingToml !== undefined) {
|
|
224
|
+
if (!existsSync(pyproject)) {
|
|
225
|
+
// `pylair dev` runs `uv sync`, which reads pyproject dependencies, so
|
|
226
|
+
// carry the requirements over when they translate cleanly.
|
|
227
|
+
const deps = requirementsToDependencies(readFileSync(requirements, "utf-8"));
|
|
228
|
+
writeFileSync(pyproject, `[project]\nname = ${tomlString(name)}\nversion = "0.1.0"\nrequires-python = ">=3.12"\n` +
|
|
229
|
+
`dependencies = [${(deps ?? []).map(tomlString).join(", ")}]\n\n`);
|
|
230
|
+
log("warning: no pyproject.toml, only requirements.txt: created a minimal pyproject.toml for the Pylair config. " +
|
|
231
|
+
(deps
|
|
232
|
+
? "Your requirements were copied into its dependencies so `pylair dev` can `uv sync` them. "
|
|
233
|
+
: "requirements.txt uses pip options that do not translate (-r, -e, --hash): add your dependencies to pyproject.toml with `uv add` so `pylair dev` sees them. ") +
|
|
234
|
+
"Without uv.lock the bundled environment can drift from `pylair dev`'s; prefer `uv add` + uv.lock.");
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
const cur = readFileSync(pyproject, "utf-8");
|
|
238
|
+
if (cur.length && !cur.endsWith("\n"))
|
|
239
|
+
appendFileSync(pyproject, "\n");
|
|
240
|
+
appendFileSync(pyproject, "\n");
|
|
241
|
+
}
|
|
242
|
+
appendFileSync(pyproject, pendingToml);
|
|
243
|
+
}
|
|
244
|
+
// The supervisor starts `python -m pylair.wrap`, so the app's own
|
|
245
|
+
// environment must contain pylair. `pylair doctor` and `pylair build`
|
|
246
|
+
// check it; say so now rather than at the first run.
|
|
247
|
+
if (!mentions(manifestText, "pylair"))
|
|
248
|
+
log("pylair wrap: add Pylair to your dependencies, it runs your server: " +
|
|
249
|
+
(opts.local ? `uv add "pylair @ file://<repo>/python/pylair"` : "uv add pylair"));
|
|
250
|
+
if (shell.kept.includes("package.json"))
|
|
251
|
+
log("pylair wrap: package.json already exists; add these to devDependencies yourself: " +
|
|
252
|
+
`"@tauri-apps/cli": "^2", "@pylair/cli": "${cliVersion()}"`);
|
|
253
|
+
log(`pylair wrap: ${name} is a wrap-mode app (framework ${config.framework}, source ${source}).\n` +
|
|
254
|
+
`next: npm install && uv sync && npx pylair dev`);
|
|
255
|
+
return { config, source, wrote: shell.written, kept: shell.kept };
|
|
256
|
+
}
|
|
257
|
+
/** Run `create-pylair --mode wrap --into <dir>`. From a Pylair checkout
|
|
258
|
+
* (`--local`) that is the checkout's own build; otherwise the scaffolder
|
|
259
|
+
* published at this CLI's exact version, so templates and pins always match.
|
|
260
|
+
* `PYLAIR_CREATE_PYLAIR` overrides the script (tests). */
|
|
261
|
+
export function runScaffolder(appDir, name, local) {
|
|
262
|
+
const args = ["--mode", "wrap", "--into", appDir, "--name", name];
|
|
263
|
+
if (local)
|
|
264
|
+
args.push("--local", local);
|
|
265
|
+
const override = process.env.PYLAIR_CREATE_PYLAIR;
|
|
266
|
+
const script = override ?? (local ? join(local, "packages", "create-pylair", "dist", "index.js") : undefined);
|
|
267
|
+
const r = script
|
|
268
|
+
? spawnSync(process.execPath, [script, ...args], { encoding: "utf-8" })
|
|
269
|
+
: spawnSync(process.platform === "win32" ? "npx.cmd" : "npx", ["--yes", `create-pylair@${cliVersion()}`, ...args], { encoding: "utf-8", shell: process.platform === "win32" });
|
|
270
|
+
if (r.error)
|
|
271
|
+
throw new Error(`could not run the scaffolder: ${r.error.message}`);
|
|
272
|
+
if (r.status !== 0)
|
|
273
|
+
throw new Error((r.stderr || r.stdout || "the scaffolder failed").trim());
|
|
274
|
+
const last = r.stdout.trim().split(/\r?\n/).pop() ?? "";
|
|
275
|
+
try {
|
|
276
|
+
return JSON.parse(last);
|
|
277
|
+
}
|
|
278
|
+
catch {
|
|
279
|
+
throw new Error(`unexpected scaffolder output: ${r.stdout.slice(0, 200)}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function readName(pyproject) {
|
|
283
|
+
try {
|
|
284
|
+
const doc = parseToml(readFileSync(pyproject, "utf-8"));
|
|
285
|
+
const n = doc.project?.name;
|
|
286
|
+
return n && /^[a-z][a-z0-9-]*$/.test(n) ? n : undefined;
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
//# sourceMappingURL=wrap.js.map
|
package/dist/wrap.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../src/wrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAiB,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAuC,M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AAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,IAAI,uBAAuB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9F,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IACxD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAA0C,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,SAAiB;IACjC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAoC,CAAC;QAC3F,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC;QAC5B,OAAO,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Wrap-mode pieces of `pylair dev`, `pylair build` and `pylair doctor`:
|
|
2
|
+
* what to import to prove the framework survived pruning, the runtime file
|
|
3
|
+
* the plugin reads, and what to stage.
|
|
4
|
+
*/
|
|
5
|
+
import type { PylairConfig } from "./config.js";
|
|
6
|
+
import { type WrapConfig } from "./wrapconfig.js";
|
|
7
|
+
/** The directory the app is staged into inside the bundle, whatever the
|
|
8
|
+
* source dir is called. Fixed so `tauri.conf.json` never needs editing when
|
|
9
|
+
* `source` changes (`"resources/app": "app/"`). */
|
|
10
|
+
export declare const STAGED_APP = "app";
|
|
11
|
+
/** Top-level names never staged when the source dir is the project root
|
|
12
|
+
* (`source = "."`): the project's own tooling, not the app. */
|
|
13
|
+
export declare const ROOT_SOURCE_EXCLUDES: string[];
|
|
14
|
+
/** `python -m uvicorn ...` style: the module a `command` runs, if it is run
|
|
15
|
+
* with the interpreter's `-m`. */
|
|
16
|
+
export declare function commandModule(cmd: string[] | undefined): string | undefined;
|
|
17
|
+
/** What to import to show the bundle can run: the launcher itself
|
|
18
|
+
* (`pylair.wrap`, which must be one of the app's dependencies: the supervisor
|
|
19
|
+
* starts `python -m pylair.wrap`), and the framework: gradio and streamlit by
|
|
20
|
+
* name; for `command`, the `-m` module when there is one. */
|
|
21
|
+
export declare function smokeImports(w: WrapConfig): string[];
|
|
22
|
+
/** Run the imports with `python`. Returns the failure text, or undefined
|
|
23
|
+
* when every import worked (or there was nothing to import). */
|
|
24
|
+
export declare function runSmokeImports(python: string, mods: string[], env: Record<string, string>, cwd: string): string | undefined;
|
|
25
|
+
/** Write the file the plugin reads at startup. */
|
|
26
|
+
export declare function writeRuntimeFile(path: string, cfg: PylairConfig, source: string): void;
|
|
27
|
+
/** `tauri dev` validates every `bundle.resources` path eagerly, but they
|
|
28
|
+
* only exist after `pylair build`: make placeholders (a dir, or an empty
|
|
29
|
+
* object for a `.json` file). `pylair build` replaces them. */
|
|
30
|
+
export declare function ensureDevResources(appDir: string, keys: string[]): void;
|
|
31
|
+
/** Is `source` the project root itself? */
|
|
32
|
+
export declare function sourceIsRoot(appDir: string, source: string): boolean;
|
|
33
|
+
//# sourceMappingURL=wrapbuild.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapbuild.d.ts","sourceRoot":"","sources":["../src/wrapbuild.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;mDAEmD;AACnD,eAAO,MAAM,UAAU,QAAQ,CAAC;AAEhC;+DAC+D;AAC/D,eAAO,MAAM,oBAAoB,UAAwD,CAAC;AAE1F;kCACkC;AAClC,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO3E;AAED;;;6DAG6D;AAC7D,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,EAAE,CAMpD;AAED;gEACgE;AAChE,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3B,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAOpB;AAED,kDAAkD;AAClD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAItF;AAED;;+DAE+D;AAC/D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAWvE;AAED,2CAA2C;AAC3C,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Wrap-mode pieces of `pylair dev`, `pylair build` and `pylair doctor`:
|
|
2
|
+
* what to import to prove the framework survived pruning, the runtime file
|
|
3
|
+
* the plugin reads, and what to stage.
|
|
4
|
+
*/
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { dirname, join, resolve } from "node:path";
|
|
8
|
+
import { runtimeConfig } from "./wrapconfig.js";
|
|
9
|
+
/** The directory the app is staged into inside the bundle, whatever the
|
|
10
|
+
* source dir is called. Fixed so `tauri.conf.json` never needs editing when
|
|
11
|
+
* `source` changes (`"resources/app": "app/"`). */
|
|
12
|
+
export const STAGED_APP = "app";
|
|
13
|
+
/** Top-level names never staged when the source dir is the project root
|
|
14
|
+
* (`source = "."`): the project's own tooling, not the app. */
|
|
15
|
+
export const ROOT_SOURCE_EXCLUDES = ["src-tauri", "node_modules", "ui", "dist", "target"];
|
|
16
|
+
/** `python -m uvicorn ...` style: the module a `command` runs, if it is run
|
|
17
|
+
* with the interpreter's `-m`. */
|
|
18
|
+
export function commandModule(cmd) {
|
|
19
|
+
if (!cmd || cmd.length < 3)
|
|
20
|
+
return undefined;
|
|
21
|
+
const prog = cmd[0].replace(/\\/g, "/").split("/").pop().toLowerCase().replace(/\.exe$/, "");
|
|
22
|
+
if (!/^python(\d+(\.\d+)*)?$/.test(prog))
|
|
23
|
+
return undefined;
|
|
24
|
+
if (cmd[1] !== "-m")
|
|
25
|
+
return undefined;
|
|
26
|
+
const mod = cmd[2];
|
|
27
|
+
return /^[A-Za-z_][A-Za-z0-9_.]*$/.test(mod) ? mod : undefined;
|
|
28
|
+
}
|
|
29
|
+
/** What to import to show the bundle can run: the launcher itself
|
|
30
|
+
* (`pylair.wrap`, which must be one of the app's dependencies: the supervisor
|
|
31
|
+
* starts `python -m pylair.wrap`), and the framework: gradio and streamlit by
|
|
32
|
+
* name; for `command`, the `-m` module when there is one. */
|
|
33
|
+
export function smokeImports(w) {
|
|
34
|
+
const launcher = "pylair.wrap";
|
|
35
|
+
if (w.framework === "gradio")
|
|
36
|
+
return [launcher, "gradio"];
|
|
37
|
+
if (w.framework === "streamlit")
|
|
38
|
+
return [launcher, "streamlit"];
|
|
39
|
+
const m = commandModule(w.cmd);
|
|
40
|
+
return m ? [launcher, m] : [launcher];
|
|
41
|
+
}
|
|
42
|
+
/** Run the imports with `python`. Returns the failure text, or undefined
|
|
43
|
+
* when every import worked (or there was nothing to import). */
|
|
44
|
+
export function runSmokeImports(python, mods, env, cwd) {
|
|
45
|
+
if (!mods.length)
|
|
46
|
+
return undefined;
|
|
47
|
+
const code = mods.map((m) => `import ${m}`).join("; ") + `; print("imports ok")`;
|
|
48
|
+
const r = spawnSync(python, ["-c", code], { encoding: "utf-8", cwd, env: { ...process.env, ...env } });
|
|
49
|
+
if (r.error)
|
|
50
|
+
return `could not run ${python}: ${r.error.message}`;
|
|
51
|
+
if (r.status === 0)
|
|
52
|
+
return undefined;
|
|
53
|
+
return (r.stderr || r.stdout || `exit ${r.status}`).trim().split(/\r?\n/).slice(-3).join(" | ");
|
|
54
|
+
}
|
|
55
|
+
/** Write the file the plugin reads at startup. */
|
|
56
|
+
export function writeRuntimeFile(path, cfg, source) {
|
|
57
|
+
if (!cfg.wrap)
|
|
58
|
+
throw new Error("not a wrap-mode app");
|
|
59
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
60
|
+
writeFileSync(path, JSON.stringify(runtimeConfig(cfg.wrap, source), null, 2) + "\n");
|
|
61
|
+
}
|
|
62
|
+
/** `tauri dev` validates every `bundle.resources` path eagerly, but they
|
|
63
|
+
* only exist after `pylair build`: make placeholders (a dir, or an empty
|
|
64
|
+
* object for a `.json` file). `pylair build` replaces them. */
|
|
65
|
+
export function ensureDevResources(appDir, keys) {
|
|
66
|
+
for (const rel of keys) {
|
|
67
|
+
const p = join(appDir, "src-tauri", rel);
|
|
68
|
+
if (existsSync(p))
|
|
69
|
+
continue;
|
|
70
|
+
if (rel.endsWith(".json")) {
|
|
71
|
+
mkdirSync(dirname(p), { recursive: true });
|
|
72
|
+
writeFileSync(p, "{}\n");
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
mkdirSync(p, { recursive: true });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** Is `source` the project root itself? */
|
|
80
|
+
export function sourceIsRoot(appDir, source) {
|
|
81
|
+
return resolve(appDir, source) === resolve(appDir);
|
|
82
|
+
}
|
|
83
|
+
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AE,MAAc;IACzD,OAAO,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** `[tool.pylair.wrap]` parsing and validation (wrap mode, W2).
|
|
2
|
+
*
|
|
3
|
+
* Wrap mode shows an existing Python web UI in the window. The config here
|
|
4
|
+
* is the single source of truth: `pylair dev` and `pylair build` turn it
|
|
5
|
+
* into the launcher command line (`launcherArgs`) and the runtime file the
|
|
6
|
+
* plugin reads (`runtimeConfig`).
|
|
7
|
+
*/
|
|
8
|
+
export type Mode = "bridge" | "wrap";
|
|
9
|
+
export declare const MODES: readonly Mode[];
|
|
10
|
+
export type WrapFramework = "command" | "gradio" | "streamlit";
|
|
11
|
+
export declare const WRAP_FRAMEWORKS: readonly WrapFramework[];
|
|
12
|
+
/** Where a download from the wrapped page goes: a native Save As dialog
|
|
13
|
+
* (default) or straight into the user's Downloads folder. */
|
|
14
|
+
export type DownloadMode = "ask" | "downloads";
|
|
15
|
+
export interface WrapConfig {
|
|
16
|
+
framework: WrapFramework;
|
|
17
|
+
/** gradio / streamlit: the app's entry file, relative to `source`. */
|
|
18
|
+
entry?: string;
|
|
19
|
+
/** command: argv of the server; `{port}` is replaced by the launcher. */
|
|
20
|
+
cmd?: string[];
|
|
21
|
+
/** Path probed for readiness and health. Unset means the launcher's own
|
|
22
|
+
* per-framework default ("/" for command, /config for gradio,
|
|
23
|
+
* /_stcore/health for streamlit), which is picked so a slow first page is
|
|
24
|
+
* never a probe miss; setting it here overrides that. */
|
|
25
|
+
readyPath?: string;
|
|
26
|
+
/** Seconds the supervisor waits for the server to answer (default 120). */
|
|
27
|
+
readyTimeout: number;
|
|
28
|
+
downloads: DownloadMode;
|
|
29
|
+
}
|
|
30
|
+
/** Validate a raw `[tool.pylair.wrap]` table. Every message names the key
|
|
31
|
+
* and what is allowed: this is the first thing a new wrap user reads. */
|
|
32
|
+
export declare function parseWrapConfig(raw: unknown, pyproject?: string): WrapConfig;
|
|
33
|
+
/** Findings about a valid wrap config that do not stop a build (printed by
|
|
34
|
+
* `pylair doctor`, `dev` and `build`). */
|
|
35
|
+
export declare function wrapWarnings(w: WrapConfig): string[];
|
|
36
|
+
/** The launcher command line for this config, minus the interpreter:
|
|
37
|
+
* `python -m pylair.wrap --framework F [--entry E] [--cmd ...] --ready-path P`.
|
|
38
|
+
* Launcher options come before `--cmd`, so the command's own arguments can
|
|
39
|
+
* never be mistaken for launcher options (docs/protocol-v1.md section 4.1). */
|
|
40
|
+
export declare function launcherArgs(w: WrapConfig): string[];
|
|
41
|
+
/** What the plugin reads at startup: `<resources>/pylair-wrap.json` in a
|
|
42
|
+
* packaged app, the file `PYLAIR_WRAP_CONFIG` names under `pylair dev`.
|
|
43
|
+
* `source` is the staged source dir, which the server runs in. */
|
|
44
|
+
export interface WrapRuntime {
|
|
45
|
+
version: 1;
|
|
46
|
+
source: string;
|
|
47
|
+
launcher: string[];
|
|
48
|
+
readyTimeoutSecs: number;
|
|
49
|
+
downloads: DownloadMode;
|
|
50
|
+
}
|
|
51
|
+
export declare function runtimeConfig(w: WrapConfig, source: string): WrapRuntime;
|
|
52
|
+
//# sourceMappingURL=wrapconfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapconfig.d.ts","sourceRoot":"","sources":["../src/wrapconfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,MAAM,CAAC;AACrC,eAAO,MAAM,KAAK,EAAE,SAAS,IAAI,EAAuB,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAC/D,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAAuC,CAAC;AAE5F;6DAC6D;AAC7D,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,WAAW,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf;;;6DAGyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,YAAY,CAAC;CACzB;AAQD;yEACyE;AACzE,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,SAAmB,GAAG,UAAU,CA2FtF;AAED;0CAC0C;AAC1C,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,EAAE,CAgBpD;AAED;;;+EAG+E;AAC/E,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,EAAE,CAMpD;AAED;;kEAEkE;AAClE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,YAAY,CAAC;CACzB;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAQxE"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/** `[tool.pylair.wrap]` parsing and validation (wrap mode, W2).
|
|
2
|
+
*
|
|
3
|
+
* Wrap mode shows an existing Python web UI in the window. The config here
|
|
4
|
+
* is the single source of truth: `pylair dev` and `pylair build` turn it
|
|
5
|
+
* into the launcher command line (`launcherArgs`) and the runtime file the
|
|
6
|
+
* plugin reads (`runtimeConfig`).
|
|
7
|
+
*/
|
|
8
|
+
export const MODES = ["bridge", "wrap"];
|
|
9
|
+
export const WRAP_FRAMEWORKS = ["command", "gradio", "streamlit"];
|
|
10
|
+
const WRAP_KEYS = ["framework", "entry", "cmd", "ready-path", "ready-timeout", "downloads"];
|
|
11
|
+
function err(pyproject, msg) {
|
|
12
|
+
return new Error(`[tool.pylair.wrap] ${msg} (${pyproject})`);
|
|
13
|
+
}
|
|
14
|
+
/** Validate a raw `[tool.pylair.wrap]` table. Every message names the key
|
|
15
|
+
* and what is allowed: this is the first thing a new wrap user reads. */
|
|
16
|
+
export function parseWrapConfig(raw, pyproject = "pyproject.toml") {
|
|
17
|
+
if (raw === undefined || raw === null)
|
|
18
|
+
throw new Error(`mode = "wrap" needs a [tool.pylair.wrap] table in ${pyproject}, e.g.\n` +
|
|
19
|
+
` [tool.pylair.wrap]\n` +
|
|
20
|
+
` framework = "command"\n` +
|
|
21
|
+
` cmd = ["python", "-m", "myapp", "--port", "{port}"]`);
|
|
22
|
+
if (typeof raw !== "object" || Array.isArray(raw))
|
|
23
|
+
throw err(pyproject, "must be a table");
|
|
24
|
+
const t = raw;
|
|
25
|
+
const unknown = Object.keys(t).filter((k) => !WRAP_KEYS.includes(k));
|
|
26
|
+
if (unknown.length)
|
|
27
|
+
throw err(pyproject, `unknown key${unknown.length > 1 ? "s" : ""} ${unknown.map((k) => `"${k}"`).join(", ")}; ` +
|
|
28
|
+
`allowed: ${WRAP_KEYS.join(", ")}`);
|
|
29
|
+
const fw = t.framework;
|
|
30
|
+
if (fw === undefined)
|
|
31
|
+
throw err(pyproject, `framework is required (one of ${WRAP_FRAMEWORKS.join(", ")})`);
|
|
32
|
+
if (typeof fw !== "string" || !WRAP_FRAMEWORKS.includes(fw))
|
|
33
|
+
throw err(pyproject, `framework must be one of ${WRAP_FRAMEWORKS.map((f) => `"${f}"`).join(", ")}, got ${JSON.stringify(fw)}`);
|
|
34
|
+
const framework = fw;
|
|
35
|
+
let entry;
|
|
36
|
+
if (t.entry !== undefined) {
|
|
37
|
+
if (typeof t.entry !== "string" || !t.entry.trim())
|
|
38
|
+
throw err(pyproject, "entry must be a non-empty string");
|
|
39
|
+
entry = t.entry;
|
|
40
|
+
const norm = entry.replace(/\\/g, "/");
|
|
41
|
+
if (norm.startsWith("/") || /^[A-Za-z]:/.test(norm) || norm.split("/").includes(".."))
|
|
42
|
+
throw err(pyproject, `entry must be a path inside the source dir (no absolute path, no ".."): ${JSON.stringify(entry)}`);
|
|
43
|
+
}
|
|
44
|
+
let cmd;
|
|
45
|
+
if (t.cmd !== undefined) {
|
|
46
|
+
if (!Array.isArray(t.cmd) || t.cmd.length === 0 || t.cmd.some((a) => typeof a !== "string"))
|
|
47
|
+
throw err(pyproject, "cmd must be a non-empty array of strings (the server's argv)");
|
|
48
|
+
cmd = t.cmd;
|
|
49
|
+
if (!cmd[0].trim())
|
|
50
|
+
throw err(pyproject, "cmd[0] (the program) must not be empty");
|
|
51
|
+
}
|
|
52
|
+
if (framework === "command") {
|
|
53
|
+
if (!cmd)
|
|
54
|
+
throw err(pyproject, `framework "command" needs cmd = ["python", "-m", "myapp", "--port", "{port}"]`);
|
|
55
|
+
if (entry !== undefined)
|
|
56
|
+
throw err(pyproject, `entry is not used by framework "command" (use cmd)`);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
if (entry === undefined)
|
|
60
|
+
throw err(pyproject, `framework "${framework}" needs entry = "app.py" (the file to run)`);
|
|
61
|
+
if (cmd !== undefined)
|
|
62
|
+
throw err(pyproject, `cmd is only for framework "command"; "${framework}" runs entry`);
|
|
63
|
+
}
|
|
64
|
+
const readyPath = t["ready-path"];
|
|
65
|
+
if (readyPath !== undefined &&
|
|
66
|
+
(typeof readyPath !== "string" || !readyPath.startsWith("/") || /\s/.test(readyPath)))
|
|
67
|
+
throw err(pyproject, `ready-path must be a path starting with "/" and without spaces, got ${JSON.stringify(readyPath)}`);
|
|
68
|
+
const readyTimeout = t["ready-timeout"] ?? 120;
|
|
69
|
+
if (typeof readyTimeout !== "number" ||
|
|
70
|
+
!Number.isInteger(readyTimeout) ||
|
|
71
|
+
readyTimeout < 1 ||
|
|
72
|
+
readyTimeout > 3600)
|
|
73
|
+
throw err(pyproject, `ready-timeout must be a whole number of seconds from 1 to 3600, got ${JSON.stringify(readyTimeout)}`);
|
|
74
|
+
const downloads = t.downloads ?? "ask";
|
|
75
|
+
if (downloads !== "ask" && downloads !== "downloads")
|
|
76
|
+
throw err(pyproject, `downloads must be "ask" (Save As dialog) or "downloads" (straight to Downloads), got ${JSON.stringify(downloads)}`);
|
|
77
|
+
return { framework, entry, cmd, readyPath, readyTimeout, downloads };
|
|
78
|
+
}
|
|
79
|
+
/** Findings about a valid wrap config that do not stop a build (printed by
|
|
80
|
+
* `pylair doctor`, `dev` and `build`). */
|
|
81
|
+
export function wrapWarnings(w) {
|
|
82
|
+
const out = [];
|
|
83
|
+
if (w.framework === "command" && w.cmd) {
|
|
84
|
+
if (!w.cmd.some((a) => a.includes("{port}")))
|
|
85
|
+
out.push(`cmd has no "{port}": the server must read $PYLAIR_PORT, otherwise it listens ` +
|
|
86
|
+
`somewhere the window cannot reach`);
|
|
87
|
+
const bad = w.cmd.find((a) => a === "0.0.0.0" || a === "::" || a.endsWith("=0.0.0.0"));
|
|
88
|
+
if (bad)
|
|
89
|
+
out.push(`cmd binds ${bad}: the server would be reachable from the network. ` +
|
|
90
|
+
`Bind 127.0.0.1 (docs/security.md section 9)`);
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
/** The launcher command line for this config, minus the interpreter:
|
|
95
|
+
* `python -m pylair.wrap --framework F [--entry E] [--cmd ...] --ready-path P`.
|
|
96
|
+
* Launcher options come before `--cmd`, so the command's own arguments can
|
|
97
|
+
* never be mistaken for launcher options (docs/protocol-v1.md section 4.1). */
|
|
98
|
+
export function launcherArgs(w) {
|
|
99
|
+
const a = ["-m", "pylair.wrap", "--framework", w.framework];
|
|
100
|
+
if (w.entry !== undefined)
|
|
101
|
+
a.push("--entry", w.entry);
|
|
102
|
+
if (w.readyPath !== undefined)
|
|
103
|
+
a.push("--ready-path", w.readyPath);
|
|
104
|
+
if (w.cmd)
|
|
105
|
+
a.push("--cmd", ...w.cmd);
|
|
106
|
+
return a;
|
|
107
|
+
}
|
|
108
|
+
export function runtimeConfig(w, source) {
|
|
109
|
+
return {
|
|
110
|
+
version: 1,
|
|
111
|
+
source,
|
|
112
|
+
launcher: launcherArgs(w),
|
|
113
|
+
readyTimeoutSecs: w.readyTimeout,
|
|
114
|
+
downloads: w.downloads,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=wrapconfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapconfig.js","sourceRoot":"","sources":["../src/wrapconfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,MAAM,CAAC,MAAM,KAAK,GAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAGzD,MAAM,CAAC,MAAM,eAAe,GAA6B,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAsB5F,MAAM,SAAS,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;AAE5F,SAAS,GAAG,CAAC,SAAiB,EAAE,GAAW;IACzC,OAAO,IAAI,KAAK,CAAC,sBAAsB,GAAG,KAAK,SAAS,GAAG,CAAC,CAAC;AAC/D,CAAC;AAED;yEACyE;AACzE,MAAM,UAAU,eAAe,CAAC,GAAY,EAAE,SAAS,GAAG,gBAAgB;IACxE,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;QACnC,MAAM,IAAI,KAAK,CACb,qDAAqD,SAAS,UAAU;YACtE,wBAAwB;YACxB,2BAA2B;YAC3B,uDAAuD,CAC1D,CAAC;IACJ,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,MAAM,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC3F,MAAM,CAAC,GAAG,GAA8B,CA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