@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
|
@@ -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"}
|
|
@@ -0,0 +1,232 @@
|
|
|
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
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
import { parse as parseToml } from "smol-toml";
|
|
23
|
+
const CALL = "python-call";
|
|
24
|
+
const STREAM = "python-call-stream";
|
|
25
|
+
/** Permission identifier -> the call commands it grants. */
|
|
26
|
+
const GRANTS = {
|
|
27
|
+
"pylair:default": [CALL, STREAM],
|
|
28
|
+
"pylair:allow-python-call": [CALL],
|
|
29
|
+
"pylair:allow-python-call-stream": [STREAM],
|
|
30
|
+
};
|
|
31
|
+
/** The plugin's matching rule: exact, or a single trailing `*` as a prefix
|
|
32
|
+
* wildcard. A `*` anywhere else is a literal character. Keep in step with
|
|
33
|
+
* `fn_scope::pattern_matches` in the plugin. */
|
|
34
|
+
export function patternMatches(pattern, name) {
|
|
35
|
+
return pattern.endsWith("*") ? name.startsWith(pattern.slice(0, -1)) : pattern === name;
|
|
36
|
+
}
|
|
37
|
+
const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
38
|
+
const strings = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
|
|
39
|
+
export function loadCapabilities(appDir) {
|
|
40
|
+
const dir = join(appDir, "src-tauri", "capabilities");
|
|
41
|
+
const capabilities = [];
|
|
42
|
+
const findings = [];
|
|
43
|
+
if (!existsSync(dir))
|
|
44
|
+
return { capabilities, findings };
|
|
45
|
+
for (const name of readdirSync(dir).sort()) {
|
|
46
|
+
if (!/\.(json|toml)$/.test(name))
|
|
47
|
+
continue;
|
|
48
|
+
const file = `src-tauri/capabilities/${name}`;
|
|
49
|
+
let raw;
|
|
50
|
+
try {
|
|
51
|
+
const text = readFileSync(join(dir, name), "utf-8");
|
|
52
|
+
raw = name.endsWith(".toml") ? parseToml(text) : JSON.parse(text);
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
findings.push({
|
|
56
|
+
level: "error",
|
|
57
|
+
file,
|
|
58
|
+
capability: "",
|
|
59
|
+
message: `cannot parse this capability file: ${e.message}`,
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (!isObj(raw)) {
|
|
64
|
+
findings.push({
|
|
65
|
+
level: "error",
|
|
66
|
+
file,
|
|
67
|
+
capability: "",
|
|
68
|
+
message: "a capability file must hold one capability object",
|
|
69
|
+
});
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
capabilities.push({
|
|
73
|
+
file,
|
|
74
|
+
identifier: typeof raw.identifier === "string" ? raw.identifier : name,
|
|
75
|
+
windows: strings(raw.windows).length ? strings(raw.windows) : strings(raw.webviews),
|
|
76
|
+
permissions: Array.isArray(raw.permissions) ? raw.permissions : [],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return { capabilities, findings };
|
|
80
|
+
}
|
|
81
|
+
function scopedEntries(cap, out) {
|
|
82
|
+
const res = [];
|
|
83
|
+
for (const p of cap.permissions) {
|
|
84
|
+
// A bare string grants the permission with no scope entries.
|
|
85
|
+
if (typeof p === "string" && p.startsWith("pylair:")) {
|
|
86
|
+
res.push({ cap, id: p, names: [], scoped: false });
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (!isObj(p) || typeof p.identifier !== "string")
|
|
90
|
+
continue;
|
|
91
|
+
const id = p.identifier;
|
|
92
|
+
if (!id.startsWith("pylair:"))
|
|
93
|
+
continue;
|
|
94
|
+
const at = (message) => out.push({ level: "error", file: cap.file, capability: cap.identifier, message });
|
|
95
|
+
const s = { cap, id, names: [], scoped: false };
|
|
96
|
+
for (const list of ["allow", "deny"]) {
|
|
97
|
+
const v = p[list];
|
|
98
|
+
if (v === undefined)
|
|
99
|
+
continue;
|
|
100
|
+
if (!Array.isArray(v)) {
|
|
101
|
+
at(`\`${id}\`: \`${list}\` must be a list of { "name": ... } entries`);
|
|
102
|
+
s.scoped = true;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (v.length === 0) {
|
|
106
|
+
if (list === "allow")
|
|
107
|
+
at(`\`${id}\` has \`allow: []\`. An empty allow list is the same as no scope ` +
|
|
108
|
+
"entries and permits everything; it does NOT mean allow nothing. " +
|
|
109
|
+
"List the functions to allow, add a `deny` list, or drop the permission " +
|
|
110
|
+
"to withhold the command.");
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
s.scoped = true;
|
|
114
|
+
for (const e of v) {
|
|
115
|
+
if (!isObj(e)) {
|
|
116
|
+
at(`\`${id}\`: ${list} entry ${JSON.stringify(e)} must be an object like { "name": "fn" }; the plugin refuses every call this entry covers`);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const extra = Object.keys(e).filter((k) => k !== "name");
|
|
120
|
+
if (typeof e.name !== "string" || extra.length) {
|
|
121
|
+
const why = [
|
|
122
|
+
typeof e.name !== "string" ? 'needs a string "name"' : "",
|
|
123
|
+
extra.length ? `has unknown key(s) ${extra.map((k) => `"${k}"`).join(", ")}` : "",
|
|
124
|
+
]
|
|
125
|
+
.filter(Boolean)
|
|
126
|
+
.join(" and ");
|
|
127
|
+
at(`\`${id}\`: ${list} entry ${JSON.stringify(e)} ${why}; the plugin refuses every call this entry covers`);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
s.names.push({ list, name: e.name });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
res.push(s);
|
|
134
|
+
}
|
|
135
|
+
return res;
|
|
136
|
+
}
|
|
137
|
+
/** Warn for every pattern that matches no name in `exposed`. */
|
|
138
|
+
export function checkPatterns(caps, exposed) {
|
|
139
|
+
const out = [];
|
|
140
|
+
const sink = [];
|
|
141
|
+
for (const cap of caps)
|
|
142
|
+
for (const s of scopedEntries(cap, sink))
|
|
143
|
+
for (const { list, name } of s.names)
|
|
144
|
+
if (!exposed.some((f) => patternMatches(name, f)))
|
|
145
|
+
out.push({
|
|
146
|
+
level: "warn",
|
|
147
|
+
file: cap.file,
|
|
148
|
+
capability: cap.identifier,
|
|
149
|
+
message: `\`${s.id}\`: ${list} pattern "${name}" matches no exposed function ` +
|
|
150
|
+
"(typo, or a renamed function?)",
|
|
151
|
+
});
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
export function checkCapabilities(caps, exposed) {
|
|
155
|
+
const findings = [];
|
|
156
|
+
const perWindow = new Map();
|
|
157
|
+
for (const cap of caps) {
|
|
158
|
+
for (const s of scopedEntries(cap, findings)) {
|
|
159
|
+
const cmds = GRANTS[s.id];
|
|
160
|
+
if (!cmds)
|
|
161
|
+
continue;
|
|
162
|
+
for (const w of cap.windows) {
|
|
163
|
+
if (!perWindow.has(w))
|
|
164
|
+
perWindow.set(w, []);
|
|
165
|
+
perWindow.get(w).push({ s, cmds });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
for (const [window, entries] of perWindow) {
|
|
170
|
+
const scopeOf = (cmd) => {
|
|
171
|
+
const mine = entries.filter((e) => e.cmds.includes(cmd));
|
|
172
|
+
const scoped = mine.filter((e) => e.s.scoped);
|
|
173
|
+
return {
|
|
174
|
+
granted: mine.length > 0,
|
|
175
|
+
scoped,
|
|
176
|
+
sig: scoped
|
|
177
|
+
.flatMap((e) => e.s.names.map((n) => `${n.list}:${n.name}`))
|
|
178
|
+
.sort()
|
|
179
|
+
.join("\n"),
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
const call = scopeOf(CALL);
|
|
183
|
+
const stream = scopeOf(STREAM);
|
|
184
|
+
const half = (scopedCmd, openCmd, from) => {
|
|
185
|
+
const e = from.scoped[0];
|
|
186
|
+
findings.push({
|
|
187
|
+
level: "error",
|
|
188
|
+
file: e.s.cap.file,
|
|
189
|
+
capability: e.s.cap.identifier,
|
|
190
|
+
message: `window "${window}" scopes \`${scopedCmd}\` (via \`${e.s.id}\`) but not \`${openCmd}\`; ` +
|
|
191
|
+
`the unscoped command bypasses the function restriction. Scope both: use the ` +
|
|
192
|
+
"set-level form { \"identifier\": \"pylair:default\", \"deny\": [...] } or give " +
|
|
193
|
+
"both commands the same entries.",
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
if (call.scoped.length && !stream.scoped.length && stream.granted)
|
|
197
|
+
half(CALL, STREAM, call);
|
|
198
|
+
else if (stream.scoped.length && !call.scoped.length && call.granted)
|
|
199
|
+
half(STREAM, CALL, stream);
|
|
200
|
+
else if (call.scoped.length && stream.scoped.length && call.sig !== stream.sig) {
|
|
201
|
+
const e = call.scoped[0];
|
|
202
|
+
findings.push({
|
|
203
|
+
level: "warn",
|
|
204
|
+
file: e.s.cap.file,
|
|
205
|
+
capability: e.s.cap.identifier,
|
|
206
|
+
message: `window "${window}" has different function scopes on \`${CALL}\` and ` +
|
|
207
|
+
`\`${STREAM}\`; a function may be callable one way and denied the other`,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (exposed)
|
|
212
|
+
findings.push(...checkPatterns(caps, exposed));
|
|
213
|
+
return findings;
|
|
214
|
+
}
|
|
215
|
+
export function formatFinding(f) {
|
|
216
|
+
const cap = f.capability ? ` (capability "${f.capability}")` : "";
|
|
217
|
+
return `${f.level}: ${f.file}${cap}: ${f.message}`;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* The static checks `pylair build` runs before any slow work: throws,
|
|
221
|
+
* listing every error, if any; otherwise returns the warnings.
|
|
222
|
+
*/
|
|
223
|
+
export function assertCapabilities(appDir, exposed) {
|
|
224
|
+
const { capabilities, findings } = loadCapabilities(appDir);
|
|
225
|
+
const all = [...findings, ...checkCapabilities(capabilities, exposed)];
|
|
226
|
+
const errors = all.filter((f) => f.level === "error");
|
|
227
|
+
if (errors.length)
|
|
228
|
+
throw new Error(`capability check failed (${errors.length} error${errors.length === 1 ? "" : "s"}):\n` +
|
|
229
|
+
errors.map((f) => ` ${formatFinding(f)}`).join("\n"));
|
|
230
|
+
return all.filter((f) => f.level === "warn");
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,C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C,MAAM;QACf,MAAM,IAAI,KAAK,CACb,4BAA4B,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM;YACpF,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACxD,CAAC;IACJ,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -3,5 +3,42 @@
|
|
|
3
3
|
* pylair CLI. `codegen` is implemented (M2, docs/codegen.md);
|
|
4
4
|
* dev/build/doctor arrive in M4.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
import { type WrapFramework } from "./wrapconfig.js";
|
|
7
|
+
/** The app directory a command works on, as an absolute path: `--dir`
|
|
8
|
+
* resolved against the current directory, or the current directory.
|
|
9
|
+
* Commands spawn tools with `cwd` set to this directory while also passing
|
|
10
|
+
* paths built from it, so a relative value would be resolved twice. */
|
|
11
|
+
export declare function resolveAppDir(dir: string | undefined, cwd?: string): string;
|
|
12
|
+
/** Split `pylair build` args into ours and tauri's. Pass-through flags
|
|
13
|
+
* forward `--flag`, `--flag value` (when the value doesn't start with
|
|
14
|
+
* `-`) and `--flag=value`; everything after a bare `--` forwards
|
|
15
|
+
* verbatim. Exported for tests. */
|
|
16
|
+
export declare function parseBuildArgs(rest: string[]): {
|
|
17
|
+
dir?: string;
|
|
18
|
+
bundles?: string;
|
|
19
|
+
sign: boolean;
|
|
20
|
+
skipFetch: boolean;
|
|
21
|
+
stageOnly: boolean;
|
|
22
|
+
verbose: boolean;
|
|
23
|
+
tauriArgs: string[];
|
|
24
|
+
};
|
|
25
|
+
/** Split `pylair wrap` / `pylair init` args. Everything after `--cmd` is the
|
|
26
|
+
* server command, verbatim. Exported for tests. */
|
|
27
|
+
export declare function parseWrapArgs(rest: string[]): {
|
|
28
|
+
dir?: string;
|
|
29
|
+
entry?: string;
|
|
30
|
+
framework?: WrapFramework;
|
|
31
|
+
cmd?: string[];
|
|
32
|
+
source?: string;
|
|
33
|
+
local?: string;
|
|
34
|
+
mode?: string;
|
|
35
|
+
};
|
|
36
|
+
/** Drop the global `--plain` flag. It only counts before `--cmd` or a bare
|
|
37
|
+
* `--`: after those the arguments belong to the wrapped server command or to
|
|
38
|
+
* tauri, verbatim. */
|
|
39
|
+
export declare function stripPlain(argv: string[]): {
|
|
40
|
+
argv: string[];
|
|
41
|
+
plain: boolean;
|
|
42
|
+
};
|
|
43
|
+
export declare function main(rawArgv: string[]): number | Promise<number>;
|
|
7
44
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;GAGG;AAeH,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA4FtE;;;uEAGuE;AACvE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,CAE1F;AAwBD;;;mCAGmC;AACnC,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAA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