@vestra-player/sdk 1.7.20 → 1.8.0
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/CHANGELOG.md +32 -0
- package/bin/vestra-plugin.mjs +128 -0
- package/capability-scan.json +367 -0
- package/dist/api-requests.js +4 -0
- package/dist/capability-check.d.ts +43 -0
- package/dist/capability-check.js +90 -0
- package/dist/capability-scan.d.ts +95 -0
- package/dist/capability-scan.js +250 -0
- package/dist/commands.d.ts +35 -0
- package/dist/commands.js +42 -1
- package/dist/docs-tree.json.gz +0 -0
- package/dist/host-capabilities.js +15 -0
- package/dist/mpv.d.ts +139 -0
- package/dist/mpv.js +496 -0
- package/dist/player-runtime.d.ts +2 -1
- package/dist/player-runtime.js +2 -1
- package/dist/plugin/commands.js +5 -2
- package/dist/plugin/mpv.d.ts +3 -0
- package/dist/plugin/mpv.js +98 -0
- package/dist/plugin/scope.d.ts +1 -0
- package/dist/plugin/scope.js +2 -0
- package/dist/plugin/testing/commands.js +37 -9
- package/dist/plugin/testing/index.d.ts +51 -0
- package/dist/plugin/testing/index.js +55 -0
- package/dist/plugin/testing/mpv.d.ts +7 -0
- package/dist/plugin/testing/mpv.js +90 -0
- package/dist/plugin/types/base.d.ts +9 -2
- package/dist/plugin/types/commands.d.ts +34 -10
- package/dist/plugin/types/playback.d.ts +185 -0
- package/dist/wire.d.ts +15 -0
- package/dist/wire.js +11 -0
- package/llms.txt +2 -2
- package/package.json +4 -2
- package/slint/vestra/widgets.slint +12 -4
package/dist/capability-check.js
CHANGED
|
@@ -369,3 +369,93 @@ export function addCapabilityEdit(ts, text, capability) {
|
|
|
369
369
|
: `, ${quoted}`,
|
|
370
370
|
};
|
|
371
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Every use, in `files`, of the SDK members named by `apis`
|
|
374
|
+
* (`Interface.member`), and every request sent by name
|
|
375
|
+
* (`ARGUMENT_APIS`' `method` members: `Wire.request`), in file and position
|
|
376
|
+
* order. The same type-aware resolution as {@link checkCapabilities}, for
|
|
377
|
+
* any list of members: a use is a property access, an element access with
|
|
378
|
+
* a literal name or a destructured property whose symbol is the SDK's
|
|
379
|
+
* declaration of the member. It reads no manifest and no capability rule
|
|
380
|
+
* (the capability scan, `capability-scan.ts`, gives it its own lists).
|
|
381
|
+
*
|
|
382
|
+
* `resolved` is `false` when the program has no import of
|
|
383
|
+
* `@vestra-player/sdk` that resolves: nothing can be found by type then.
|
|
384
|
+
*
|
|
385
|
+
* @internal
|
|
386
|
+
*/
|
|
387
|
+
export function findMemberUses(ts, program, options) {
|
|
388
|
+
const uses = [];
|
|
389
|
+
const requests = [];
|
|
390
|
+
const members = resolveMembers(ts, program, options.apis);
|
|
391
|
+
const senders = resolveMembers(ts, program, Object.entries(ARGUMENT_APIS)
|
|
392
|
+
.filter(([, kind]) => kind === "method")
|
|
393
|
+
.map(([api]) => api));
|
|
394
|
+
const resolved = members.size > 0 || senders.size > 0;
|
|
395
|
+
if (!resolved)
|
|
396
|
+
return { resolved, uses, requests };
|
|
397
|
+
const checker = program.getTypeChecker();
|
|
398
|
+
const apiOf = (table, symbol) => {
|
|
399
|
+
for (const declaration of symbol?.declarations ?? []) {
|
|
400
|
+
const api = table.get(declaration);
|
|
401
|
+
if (api)
|
|
402
|
+
return api;
|
|
403
|
+
}
|
|
404
|
+
return undefined;
|
|
405
|
+
};
|
|
406
|
+
for (const fileName of options.files) {
|
|
407
|
+
const file = program.getSourceFile(fileName);
|
|
408
|
+
if (!file)
|
|
409
|
+
continue;
|
|
410
|
+
const position = (name) => {
|
|
411
|
+
const { line, character } = file.getLineAndCharacterOfPosition(name.getStart(file));
|
|
412
|
+
return { file: file.fileName, line: line + 1, column: character + 1 };
|
|
413
|
+
};
|
|
414
|
+
const seen = (name, symbol) => {
|
|
415
|
+
const api = apiOf(members, symbol);
|
|
416
|
+
if (api)
|
|
417
|
+
uses.push({ ...position(name), api });
|
|
418
|
+
if (!apiOf(senders, symbol))
|
|
419
|
+
return;
|
|
420
|
+
// A direct call with one literal name is a request of that name;
|
|
421
|
+
// anything else (a computed name, the member taken as a value) is a
|
|
422
|
+
// request the scan cannot name.
|
|
423
|
+
const access = name.parent;
|
|
424
|
+
const call = access?.parent;
|
|
425
|
+
const direct = access &&
|
|
426
|
+
(ts.isPropertyAccessExpression(access) ||
|
|
427
|
+
ts.isElementAccessExpression(access)) &&
|
|
428
|
+
call &&
|
|
429
|
+
ts.isCallExpression(call) &&
|
|
430
|
+
call.expression === access
|
|
431
|
+
? call
|
|
432
|
+
: undefined;
|
|
433
|
+
const values = direct
|
|
434
|
+
? literalStrings(ts, checker, direct.arguments[0])
|
|
435
|
+
: undefined;
|
|
436
|
+
requests.push({
|
|
437
|
+
...position(name),
|
|
438
|
+
method: values?.length === 1 ? values[0] : undefined,
|
|
439
|
+
});
|
|
440
|
+
};
|
|
441
|
+
const visit = (node) => {
|
|
442
|
+
if (ts.isPropertyAccessExpression(node))
|
|
443
|
+
seen(node.name, checker.getSymbolAtLocation(node.name));
|
|
444
|
+
else if (ts.isElementAccessExpression(node) &&
|
|
445
|
+
ts.isStringLiteralLike(node.argumentExpression))
|
|
446
|
+
seen(node.argumentExpression, checker.getSymbolAtLocation(node.argumentExpression));
|
|
447
|
+
else if (ts.isBindingElement(node) &&
|
|
448
|
+
ts.isObjectBindingPattern(node.parent)) {
|
|
449
|
+
const name = node.propertyName ?? node.name;
|
|
450
|
+
const text = ts.isIdentifier(name) || ts.isStringLiteralLike(name)
|
|
451
|
+
? name.text
|
|
452
|
+
: undefined;
|
|
453
|
+
if (text !== undefined)
|
|
454
|
+
seen(name, checker.getTypeAtLocation(node.parent).getProperty(text));
|
|
455
|
+
}
|
|
456
|
+
ts.forEachChild(node, visit);
|
|
457
|
+
};
|
|
458
|
+
visit(file);
|
|
459
|
+
}
|
|
460
|
+
return { resolved, uses, requests };
|
|
461
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type TS from "typescript";
|
|
2
|
+
/** @internal The scan's categories, in the order results list them. */
|
|
3
|
+
export declare const SCAN_CATEGORIES: readonly ["player", "plugins", "clipboard", "credentials", "camera", "microphone", "screen", "notifications"];
|
|
4
|
+
/** @internal One of {@link SCAN_CATEGORIES}. */
|
|
5
|
+
export type ScanCategory = (typeof SCAN_CATEGORIES)[number];
|
|
6
|
+
/** @internal The version of the result's format (`scan`). */
|
|
7
|
+
export declare const SCAN_FORMAT = 1;
|
|
8
|
+
/** @internal One list of `capability-scan.json`. */
|
|
9
|
+
export interface ScanList {
|
|
10
|
+
readonly about: string;
|
|
11
|
+
/** API members, `Interface.member` (`Clipboard.readText`, `Scope.video.filter`). */
|
|
12
|
+
readonly members: readonly string[];
|
|
13
|
+
/** Methods of the player's protocol, as its capability table names them (`packages.*`). */
|
|
14
|
+
readonly requests: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
/** @internal `capability-scan.json`. */
|
|
17
|
+
export interface ScanTable {
|
|
18
|
+
readonly about: string;
|
|
19
|
+
readonly version: number;
|
|
20
|
+
readonly categories: Readonly<Record<ScanCategory, ScanList>>;
|
|
21
|
+
readonly none: ScanList;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `capability-scan.json`, read once from the package's root (one level
|
|
25
|
+
* above this module, in `src/` and in `dist/` alike).
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function scanTable(): ScanTable;
|
|
30
|
+
/** @internal Where the scan found a use, for people who check it. */
|
|
31
|
+
export interface ScanEvidence {
|
|
32
|
+
/** The API member used (`Clipboard.readText`); absent for a request by name. */
|
|
33
|
+
readonly member?: string;
|
|
34
|
+
/** The protocol method requested by name (`clipboard.readText`); absent for a member. */
|
|
35
|
+
readonly request?: string;
|
|
36
|
+
/** The file, relative to the plugin's directory, with `/`. */
|
|
37
|
+
readonly file: string;
|
|
38
|
+
/** 1-based line. */
|
|
39
|
+
readonly line: number;
|
|
40
|
+
/** `"types"`: found by type; `"names"`: found by name (best effort). */
|
|
41
|
+
readonly by: "types" | "names";
|
|
42
|
+
}
|
|
43
|
+
/** @internal A request by name the scan could not put in a category. */
|
|
44
|
+
export interface ScanUnchecked {
|
|
45
|
+
readonly file: string;
|
|
46
|
+
readonly line: number;
|
|
47
|
+
/** One line for people. */
|
|
48
|
+
readonly message: string;
|
|
49
|
+
}
|
|
50
|
+
/** @internal What a scan found, before `vestra-plugin scan` adds the plugin's identity. */
|
|
51
|
+
export interface ScanFindings {
|
|
52
|
+
/** The categories used, in {@link SCAN_CATEGORIES}' order. */
|
|
53
|
+
readonly uses: ScanCategory[];
|
|
54
|
+
/** Per used category, where: by file, line, then name. */
|
|
55
|
+
readonly evidence: Partial<Record<ScanCategory, ScanEvidence[]>>;
|
|
56
|
+
readonly unchecked: ScanUnchecked[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The category of a request by name, as the player routes a method: the
|
|
60
|
+
* exact name first, then the first `prefix.*` entry it starts with.
|
|
61
|
+
* `null`: in `none`; `undefined`: the table does not know the method.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export declare function requestCategory(method: string, scan?: ScanTable): ScanCategory | null | undefined;
|
|
66
|
+
/** @internal What {@link scan} reads. */
|
|
67
|
+
export interface ScanOptions {
|
|
68
|
+
/** The plugin's TypeScript files, in `program`: scanned by type. */
|
|
69
|
+
readonly typed: readonly string[];
|
|
70
|
+
/** The plugin's JavaScript files, with their text: scanned by name. */
|
|
71
|
+
readonly named: readonly {
|
|
72
|
+
readonly file: string;
|
|
73
|
+
readonly text: string;
|
|
74
|
+
}[];
|
|
75
|
+
/** How the result names a file (relative to the plugin, with `/`). */
|
|
76
|
+
readonly relative?: (file: string) => string;
|
|
77
|
+
/** Default: `capability-scan.json`. */
|
|
78
|
+
readonly table?: ScanTable;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The categories a plugin's files use.
|
|
82
|
+
*
|
|
83
|
+
* `resolved` is `false` when there are TypeScript files and the program
|
|
84
|
+
* resolves no import of `@vestra-player/sdk` in them (the SDK is not
|
|
85
|
+
* installed where the plugin looks, or nothing imports it): the caller
|
|
86
|
+
* then scans those files by name too, or reports it.
|
|
87
|
+
*
|
|
88
|
+
* @param program - A program that has the `typed` files; `undefined` with
|
|
89
|
+
* none.
|
|
90
|
+
*
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
export declare function scan(ts: typeof TS, program: TS.Program | undefined, options: ScanOptions): ScanFindings & {
|
|
94
|
+
resolved: boolean;
|
|
95
|
+
};
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The capability scan: which boundary categories a plugin's code uses
|
|
3
|
+
* (`player`, `plugins`, `clipboard`, `credentials`, `camera`, `microphone`,
|
|
4
|
+
* `screen`, `notifications`), read from its source. `vestra-plugin scan`
|
|
5
|
+
* prints the result; the plugin repository's index and the store show it.
|
|
6
|
+
*
|
|
7
|
+
* The table is `capability-scan.json` at the package's root, maintained by
|
|
8
|
+
* hand: every method of the public API and every method of the player's
|
|
9
|
+
* capability table is in one category's list or in `none`'s
|
|
10
|
+
* (test/capability-scan.test.ts). Nothing here is read at run time: the
|
|
11
|
+
* manifest's capabilities gate the API as before.
|
|
12
|
+
*
|
|
13
|
+
* TypeScript files are scanned by type, with the capability checker's
|
|
14
|
+
* resolution (`findMemberUses`, capability-check.ts): a member counts
|
|
15
|
+
* however its object was reached. JavaScript files have no types and are
|
|
16
|
+
* scanned by name, best effort (`scanNamesInto`); the result says which
|
|
17
|
+
* way each file was read.
|
|
18
|
+
*
|
|
19
|
+
* The TypeScript module is passed in, never imported (as in
|
|
20
|
+
* capability-check.ts). Node only: it reads the table from disk.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
import { readFileSync } from "node:fs";
|
|
25
|
+
import { findMemberUses } from "./capability-check.js";
|
|
26
|
+
/** @internal The scan's categories, in the order results list them. */
|
|
27
|
+
export const SCAN_CATEGORIES = [
|
|
28
|
+
"player",
|
|
29
|
+
"plugins",
|
|
30
|
+
"clipboard",
|
|
31
|
+
"credentials",
|
|
32
|
+
"camera",
|
|
33
|
+
"microphone",
|
|
34
|
+
"screen",
|
|
35
|
+
"notifications",
|
|
36
|
+
];
|
|
37
|
+
/** @internal The version of the result's format (`scan`). */
|
|
38
|
+
export const SCAN_FORMAT = 1;
|
|
39
|
+
let table;
|
|
40
|
+
/**
|
|
41
|
+
* `capability-scan.json`, read once from the package's root (one level
|
|
42
|
+
* above this module, in `src/` and in `dist/` alike).
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export function scanTable() {
|
|
47
|
+
table ??= JSON.parse(readFileSync(new URL("../capability-scan.json", import.meta.url), "utf8"));
|
|
48
|
+
return table;
|
|
49
|
+
}
|
|
50
|
+
/** The category of a member; `undefined` for `none` and for unknown names. */
|
|
51
|
+
function memberCategories(scan) {
|
|
52
|
+
const categories = new Map();
|
|
53
|
+
for (const category of SCAN_CATEGORIES)
|
|
54
|
+
for (const member of scan.categories[category].members)
|
|
55
|
+
categories.set(member, category);
|
|
56
|
+
return categories;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The category of a request by name, as the player routes a method: the
|
|
60
|
+
* exact name first, then the first `prefix.*` entry it starts with.
|
|
61
|
+
* `null`: in `none`; `undefined`: the table does not know the method.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export function requestCategory(method, scan = scanTable()) {
|
|
66
|
+
const lists = [
|
|
67
|
+
...SCAN_CATEGORIES.map((category) => [
|
|
68
|
+
category,
|
|
69
|
+
scan.categories[category].requests,
|
|
70
|
+
]),
|
|
71
|
+
[null, scan.none.requests],
|
|
72
|
+
];
|
|
73
|
+
for (const [category, requests] of lists)
|
|
74
|
+
if (requests.includes(method))
|
|
75
|
+
return category;
|
|
76
|
+
for (const [category, requests] of lists)
|
|
77
|
+
if (requests.some((entry) => entry.endsWith(".*") && method.startsWith(entry.slice(0, -1))))
|
|
78
|
+
return category;
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
/** Collects evidence and the requests the scan cannot place. */
|
|
82
|
+
class Findings {
|
|
83
|
+
evidence = new Map();
|
|
84
|
+
unchecked = [];
|
|
85
|
+
#scan;
|
|
86
|
+
#relative;
|
|
87
|
+
constructor(scan, relative) {
|
|
88
|
+
this.#scan = scan;
|
|
89
|
+
this.#relative = relative;
|
|
90
|
+
}
|
|
91
|
+
add(category, evidence) {
|
|
92
|
+
const list = this.evidence.get(category) ?? [];
|
|
93
|
+
this.evidence.set(category, list);
|
|
94
|
+
list.push({ ...evidence, file: this.#relative(evidence.file) });
|
|
95
|
+
}
|
|
96
|
+
request(method, file, line, by) {
|
|
97
|
+
if (method === undefined) {
|
|
98
|
+
this.unchecked.push({
|
|
99
|
+
file: this.#relative(file),
|
|
100
|
+
line,
|
|
101
|
+
message: "a request whose method name is not one literal string: the scan cannot tell what it asks for",
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const category = requestCategory(method, this.#scan);
|
|
106
|
+
if (category === undefined)
|
|
107
|
+
this.unchecked.push({
|
|
108
|
+
file: this.#relative(file),
|
|
109
|
+
line,
|
|
110
|
+
message: `a request of ${JSON.stringify(method)}, which the player's capability table does not know`,
|
|
111
|
+
});
|
|
112
|
+
else if (category !== null)
|
|
113
|
+
this.add(category, { request: method, file, line, by });
|
|
114
|
+
}
|
|
115
|
+
result() {
|
|
116
|
+
const order = (a, b) => a.file.localeCompare(b.file, "en") ||
|
|
117
|
+
a.line - b.line ||
|
|
118
|
+
(a.member ?? a.request ?? "").localeCompare(b.member ?? b.request ?? "", "en");
|
|
119
|
+
const uses = SCAN_CATEGORIES.filter((category) => this.evidence.has(category));
|
|
120
|
+
return {
|
|
121
|
+
uses,
|
|
122
|
+
evidence: Object.fromEntries(uses.map((category) => [
|
|
123
|
+
category,
|
|
124
|
+
this.evidence.get(category).toSorted(order),
|
|
125
|
+
])),
|
|
126
|
+
unchecked: this.unchecked.toSorted((a, b) => a.file.localeCompare(b.file, "en") || a.line - b.line),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/** `Clipboard` → `clipboard`: the name a module has on `plugin`. */
|
|
131
|
+
const lowerFirst = (name) => name[0].toLowerCase() + name.slice(1);
|
|
132
|
+
/**
|
|
133
|
+
* A file's uses, by name (best effort, no types; for JavaScript, and for
|
|
134
|
+
* TypeScript that imports no SDK types): a property
|
|
135
|
+
* access or a destructured property named as a category's member, on
|
|
136
|
+
* something named as the member's interface is on `plugin`
|
|
137
|
+
* (`plugin.clipboard.readText`, `clipboard.readText`,
|
|
138
|
+
* `const { readText } = plugin.clipboard`; `Clipboard.readText` is on
|
|
139
|
+
* `clipboard`); and a call of something named `request` with one string
|
|
140
|
+
* literal, as a request by name. Missed: an object reached under another
|
|
141
|
+
* name, a computed member name, a member whose interface is not a module
|
|
142
|
+
* of `plugin` (`PackageCandidate.install`). A name that only looks like
|
|
143
|
+
* one is counted.
|
|
144
|
+
*/
|
|
145
|
+
function scanNamesInto(ts, fileName, text, scan, into) {
|
|
146
|
+
// The kind (JavaScript, TypeScript) is the file name's.
|
|
147
|
+
const source = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
|
|
148
|
+
// "clipboard.readText" → category and member.
|
|
149
|
+
const pairs = new Map();
|
|
150
|
+
for (const [member, category] of memberCategories(scan)) {
|
|
151
|
+
const parts = member.split(".");
|
|
152
|
+
const name = parts.at(-1);
|
|
153
|
+
const owner = parts.length > 2 ? parts.at(-2) : lowerFirst(parts[0]);
|
|
154
|
+
pairs.set(`${owner}.${name}`, { category, member });
|
|
155
|
+
}
|
|
156
|
+
const line = (node) => source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1;
|
|
157
|
+
/** The last name of an expression: `plugin.clipboard` → `clipboard`. */
|
|
158
|
+
const lastName = (node) => {
|
|
159
|
+
if (!node)
|
|
160
|
+
return undefined;
|
|
161
|
+
if (ts.isIdentifier(node))
|
|
162
|
+
return node.text;
|
|
163
|
+
if (ts.isPropertyAccessExpression(node))
|
|
164
|
+
return node.name.text;
|
|
165
|
+
if (ts.isElementAccessExpression(node) &&
|
|
166
|
+
ts.isStringLiteralLike(node.argumentExpression))
|
|
167
|
+
return node.argumentExpression.text;
|
|
168
|
+
if (ts.isParenthesizedExpression(node) ||
|
|
169
|
+
ts.isNonNullExpression(node) ||
|
|
170
|
+
ts.isAwaitExpression(node))
|
|
171
|
+
return lastName(node.expression);
|
|
172
|
+
return undefined;
|
|
173
|
+
};
|
|
174
|
+
const member = (owner, name, at) => {
|
|
175
|
+
const found = owner === undefined ? undefined : pairs.get(`${owner}.${name}`);
|
|
176
|
+
if (found)
|
|
177
|
+
into.add(found.category, {
|
|
178
|
+
member: found.member,
|
|
179
|
+
file: fileName,
|
|
180
|
+
line: line(at),
|
|
181
|
+
by: "names",
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
const visit = (node) => {
|
|
185
|
+
if (ts.isPropertyAccessExpression(node))
|
|
186
|
+
member(lastName(node.expression), node.name.text, node.name);
|
|
187
|
+
else if (ts.isElementAccessExpression(node) &&
|
|
188
|
+
ts.isStringLiteralLike(node.argumentExpression))
|
|
189
|
+
member(lastName(node.expression), node.argumentExpression.text, node.argumentExpression);
|
|
190
|
+
else if (ts.isBindingElement(node) &&
|
|
191
|
+
ts.isObjectBindingPattern(node.parent)) {
|
|
192
|
+
const name = node.propertyName ?? node.name;
|
|
193
|
+
const declaration = node.parent.parent;
|
|
194
|
+
const from = ts.isVariableDeclaration(declaration) ||
|
|
195
|
+
ts.isParameter(declaration) ||
|
|
196
|
+
ts.isBindingElement(declaration)
|
|
197
|
+
? ts.isBindingElement(declaration)
|
|
198
|
+
? // `{ clipboard: { readText } }`: the outer property's name.
|
|
199
|
+
(declaration.propertyName ?? declaration.name)
|
|
200
|
+
: declaration.initializer
|
|
201
|
+
: undefined;
|
|
202
|
+
if (ts.isIdentifier(name) || ts.isStringLiteralLike(name))
|
|
203
|
+
member(lastName(from), name.text, name);
|
|
204
|
+
}
|
|
205
|
+
if (ts.isCallExpression(node) && lastName(node.expression) === "request") {
|
|
206
|
+
const first = node.arguments[0];
|
|
207
|
+
into.request(first && ts.isStringLiteralLike(first) ? first.text : undefined, fileName, line(node.expression), "names");
|
|
208
|
+
}
|
|
209
|
+
ts.forEachChild(node, visit);
|
|
210
|
+
};
|
|
211
|
+
visit(source);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The categories a plugin's files use.
|
|
215
|
+
*
|
|
216
|
+
* `resolved` is `false` when there are TypeScript files and the program
|
|
217
|
+
* resolves no import of `@vestra-player/sdk` in them (the SDK is not
|
|
218
|
+
* installed where the plugin looks, or nothing imports it): the caller
|
|
219
|
+
* then scans those files by name too, or reports it.
|
|
220
|
+
*
|
|
221
|
+
* @param program - A program that has the `typed` files; `undefined` with
|
|
222
|
+
* none.
|
|
223
|
+
*
|
|
224
|
+
* @internal
|
|
225
|
+
*/
|
|
226
|
+
export function scan(ts, program, options) {
|
|
227
|
+
const table = options.table ?? scanTable();
|
|
228
|
+
const findings = new Findings(table, options.relative ?? ((file) => file));
|
|
229
|
+
let resolved = true;
|
|
230
|
+
if (program && options.typed.length) {
|
|
231
|
+
const categories = memberCategories(table);
|
|
232
|
+
const found = findMemberUses(ts, program, {
|
|
233
|
+
files: options.typed,
|
|
234
|
+
apis: categories.keys(),
|
|
235
|
+
});
|
|
236
|
+
resolved = found.resolved;
|
|
237
|
+
for (const use of found.uses)
|
|
238
|
+
findings.add(categories.get(use.api), {
|
|
239
|
+
member: use.api,
|
|
240
|
+
file: use.file,
|
|
241
|
+
line: use.line,
|
|
242
|
+
by: "types",
|
|
243
|
+
});
|
|
244
|
+
for (const request of found.requests)
|
|
245
|
+
findings.request(request.method, request.file, request.line, "types");
|
|
246
|
+
}
|
|
247
|
+
for (const { file, text } of options.named)
|
|
248
|
+
scanNamesInto(ts, file, text, table, findings);
|
|
249
|
+
return { ...findings.result(), resolved };
|
|
250
|
+
}
|
package/dist/commands.d.ts
CHANGED
|
@@ -196,6 +196,41 @@ export declare const COMMAND_RUN_LIMITS: {
|
|
|
196
196
|
/** A ticket ends this long after it was given or last ran a command (ms). */
|
|
197
197
|
readonly ticketIdleMs: 120000;
|
|
198
198
|
};
|
|
199
|
+
/**
|
|
200
|
+
* The player's limits on the texts of `palette.lead.set`, in characters as
|
|
201
|
+
* shown (translated, a text value with its arguments), each on one line;
|
|
202
|
+
* the same values as the player's (its agreement test checks that they
|
|
203
|
+
* agree). The player checks them; `TestHost` does the same.
|
|
204
|
+
* Internal: exported from `@vestra-player/sdk/runtime` only.
|
|
205
|
+
*
|
|
206
|
+
* @internal
|
|
207
|
+
*/
|
|
208
|
+
export declare const PALETTE_LEAD_LIMITS: {
|
|
209
|
+
/** `title` (40). */
|
|
210
|
+
readonly title: 40;
|
|
211
|
+
/** `placeholder` (60). */
|
|
212
|
+
readonly placeholder: 60;
|
|
213
|
+
/** `empty` (80). */
|
|
214
|
+
readonly empty: 80;
|
|
215
|
+
/** `note` (40). */
|
|
216
|
+
readonly note: 40;
|
|
217
|
+
/** `status.text` of a working status: one line of the row and the strip (80). */
|
|
218
|
+
readonly statusText: 80;
|
|
219
|
+
/** `status.text` of an end state: what the strip's two lines hold (160). */
|
|
220
|
+
readonly statusEndText: 160;
|
|
221
|
+
/** `status.note` (40). */
|
|
222
|
+
readonly statusNote: 40;
|
|
223
|
+
/** `status.strip`: one line of the strip (80). */
|
|
224
|
+
readonly statusStrip: 80;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* `palette.lead.set`'s `status.state` values, the first the default
|
|
228
|
+
* (absent or `null`); the others are end states. The same list as the
|
|
229
|
+
* player's. Internal: exported from `@vestra-player/sdk/runtime` only.
|
|
230
|
+
*
|
|
231
|
+
* @internal
|
|
232
|
+
*/
|
|
233
|
+
export declare const PALETTE_LEAD_STATES: readonly ["working", "done", "failed", "note", "stopped"];
|
|
199
234
|
/**
|
|
200
235
|
* What is wrong with `commands.run`'s `then` (given, not `null`), as
|
|
201
236
|
* the player words it; `null` when nothing is. The SDK and `TestHost`
|
package/dist/commands.js
CHANGED
|
@@ -242,6 +242,47 @@ export const COMMAND_RUN_LIMITS = {
|
|
|
242
242
|
/** A ticket ends this long after it was given or last ran a command (ms). */
|
|
243
243
|
ticketIdleMs: 120_000,
|
|
244
244
|
};
|
|
245
|
+
/**
|
|
246
|
+
* The player's limits on the texts of `palette.lead.set`, in characters as
|
|
247
|
+
* shown (translated, a text value with its arguments), each on one line;
|
|
248
|
+
* the same values as the player's (its agreement test checks that they
|
|
249
|
+
* agree). The player checks them; `TestHost` does the same.
|
|
250
|
+
* Internal: exported from `@vestra-player/sdk/runtime` only.
|
|
251
|
+
*
|
|
252
|
+
* @internal
|
|
253
|
+
*/
|
|
254
|
+
export const PALETTE_LEAD_LIMITS = {
|
|
255
|
+
/** `title` (40). */
|
|
256
|
+
title: 40,
|
|
257
|
+
/** `placeholder` (60). */
|
|
258
|
+
placeholder: 60,
|
|
259
|
+
/** `empty` (80). */
|
|
260
|
+
empty: 80,
|
|
261
|
+
/** `note` (40). */
|
|
262
|
+
note: 40,
|
|
263
|
+
/** `status.text` of a working status: one line of the row and the strip (80). */
|
|
264
|
+
statusText: 80,
|
|
265
|
+
/** `status.text` of an end state: what the strip's two lines hold (160). */
|
|
266
|
+
statusEndText: 160,
|
|
267
|
+
/** `status.note` (40). */
|
|
268
|
+
statusNote: 40,
|
|
269
|
+
/** `status.strip`: one line of the strip (80). */
|
|
270
|
+
statusStrip: 80,
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* `palette.lead.set`'s `status.state` values, the first the default
|
|
274
|
+
* (absent or `null`); the others are end states. The same list as the
|
|
275
|
+
* player's. Internal: exported from `@vestra-player/sdk/runtime` only.
|
|
276
|
+
*
|
|
277
|
+
* @internal
|
|
278
|
+
*/
|
|
279
|
+
export const PALETTE_LEAD_STATES = [
|
|
280
|
+
"working",
|
|
281
|
+
"done",
|
|
282
|
+
"failed",
|
|
283
|
+
"note",
|
|
284
|
+
"stopped",
|
|
285
|
+
];
|
|
245
286
|
/**
|
|
246
287
|
* What is wrong with `commands.run`'s `then` (given, not `null`), as
|
|
247
288
|
* the player words it; `null` when nothing is. The SDK and `TestHost`
|
|
@@ -505,7 +546,7 @@ vestra.playlist | playlist.remove | (Remove Selected) | Delete | panel
|
|
|
505
546
|
vestra.playlist | playlist.remove-unselected | (Remove Unselected) | Ctrl+Delete | panel
|
|
506
547
|
vestra.playlist | playlist.remove-invalid | (Remove Invalid Items)
|
|
507
548
|
vestra.playlist | playlist.clear | (Remove All) | Alt+Delete | panel
|
|
508
|
-
vestra.playlist | playlist.reveal | (Show in
|
|
549
|
+
vestra.playlist | playlist.reveal | (Show in Folder) | Ctrl+F | panel
|
|
509
550
|
vestra.playlist | playlist.move-top | (Move to Top)
|
|
510
551
|
vestra.playlist | playlist.move-up | (Move Up) | Ctrl+ArrowUp | panel
|
|
511
552
|
vestra.playlist | playlist.move-down | (Move Down) | Ctrl+ArrowDown | panel
|
package/dist/docs-tree.json.gz
CHANGED
|
Binary file
|
|
@@ -459,6 +459,21 @@ export const HOST_CAPABILITIES = {
|
|
|
459
459
|
residency: "recordable",
|
|
460
460
|
risky: false,
|
|
461
461
|
},
|
|
462
|
+
{
|
|
463
|
+
builtinOnly: false,
|
|
464
|
+
label: "Control the playback engine (mpv) directly: send its commands and change its options",
|
|
465
|
+
methods: [
|
|
466
|
+
{ name: "mpv.command", needs: "mpv" },
|
|
467
|
+
{ name: "mpv.get", needs: "mpv" },
|
|
468
|
+
{ name: "mpv.set", needs: "mpv" },
|
|
469
|
+
{ name: "mpv.observe", needs: "mpv" },
|
|
470
|
+
{ name: "mpv.unobserve", needs: "mpv" },
|
|
471
|
+
],
|
|
472
|
+
name: "mpv",
|
|
473
|
+
requires: [],
|
|
474
|
+
residency: "live",
|
|
475
|
+
risky: true,
|
|
476
|
+
},
|
|
462
477
|
],
|
|
463
478
|
uncapable: [
|
|
464
479
|
{ name: "packages.list", needs: null },
|