@vestra-player/sdk 1.7.20 → 1.9.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 +72 -0
- package/README.md +2 -2
- package/bin/vestra-plugin.mjs +139 -100
- package/capability-scan.json +369 -0
- package/dist/api-requests.d.ts +11 -36
- package/dist/api-requests.js +22 -47
- package/dist/capability-scan.d.ts +95 -0
- package/dist/capability-scan.js +249 -0
- package/dist/commands.d.ts +35 -0
- package/dist/commands.js +42 -1
- package/dist/docs-tree.json.gz +0 -0
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/manifest.d.ts +5 -0
- package/dist/manifest.js +9 -24
- package/dist/member-uses.d.ts +61 -0
- package/dist/member-uses.js +160 -0
- package/dist/mpv.d.ts +139 -0
- package/dist/mpv.js +496 -0
- package/dist/player-runtime.d.ts +3 -3
- package/dist/player-runtime.js +3 -3
- package/dist/plugin/appearance.d.ts +1 -1
- package/dist/plugin/appearance.js +2 -2
- package/dist/plugin/bindings.d.ts +1 -1
- package/dist/plugin/bindings.js +2 -2
- package/dist/plugin/commands.js +6 -14
- package/dist/plugin/connection.d.ts +26 -7
- package/dist/plugin/connection.js +68 -36
- package/dist/plugin/drops.js +1 -1
- package/dist/plugin/index.js +9 -15
- package/dist/plugin/media.js +0 -12
- package/dist/plugin/mpv.d.ts +3 -0
- package/dist/plugin/mpv.js +91 -0
- package/dist/plugin/packages.js +1 -2
- package/dist/plugin/player/events.d.ts +4 -3
- package/dist/plugin/player/events.js +7 -6
- package/dist/plugin/player.d.ts +21 -13
- package/dist/plugin/player.js +56 -21
- package/dist/plugin/scope.d.ts +1 -0
- package/dist/plugin/scope.js +2 -0
- package/dist/plugin/services.d.ts +4 -4
- package/dist/plugin/services.js +7 -29
- package/dist/plugin/settings.js +1 -1
- package/dist/plugin/shaders.js +0 -2
- package/dist/plugin/stream.d.ts +2 -1
- package/dist/plugin/stream.js +2 -2
- package/dist/plugin/testing/commands.d.ts +3 -10
- package/dist/plugin/testing/commands.js +43 -24
- package/dist/plugin/testing/index.d.ts +75 -114
- package/dist/plugin/testing/index.js +83 -102
- package/dist/plugin/testing/mpv.d.ts +7 -0
- package/dist/plugin/testing/mpv.js +90 -0
- package/dist/plugin/testing/processing.js +1 -1
- package/dist/plugin/testing/services.js +0 -1
- package/dist/plugin/timeline.d.ts +2 -3
- package/dist/plugin/timeline.js +4 -8
- package/dist/plugin/types/base.d.ts +49 -88
- package/dist/plugin/types/commands.d.ts +44 -77
- package/dist/plugin/types/packages.d.ts +17 -55
- package/dist/plugin/types/playback.d.ts +302 -135
- package/dist/plugin/types/plugin-wire.d.ts +6 -36
- package/dist/plugin/types/processing.d.ts +10 -49
- package/dist/plugin/types/services.d.ts +11 -70
- package/dist/plugin/types/snapshots.d.ts +7 -60
- package/dist/plugin/types/sources.d.ts +2 -11
- package/dist/plugin/types/subtitles.d.ts +5 -26
- package/dist/plugin/types/ui-content.d.ts +1 -16
- package/dist/plugin/types/ui-layout.d.ts +53 -79
- package/dist/plugin/types/ui-locale.d.ts +5 -23
- package/dist/plugin/types/ui-shell.d.ts +13 -59
- package/dist/plugin/view/layout.js +1 -1
- package/dist/plugin/view.js +0 -2
- package/dist/plugin/window.d.ts +1 -1
- package/dist/plugin/window.js +1 -1
- package/dist/plugin/wire-facade.js +1 -2
- package/dist/processing.d.ts +2 -3
- package/dist/protocol.d.ts +14 -0
- package/dist/protocol.js +14 -0
- package/dist/request-queue.js +1 -1
- package/dist/subtitles.d.ts +1 -1
- package/dist/ts-plugin.d.ts +8 -15
- package/dist/ts-plugin.js +3 -141
- package/dist/wire.d.ts +22 -12
- package/dist/wire.js +17 -8
- package/llms.txt +5 -5
- package/package.json +4 -3
- package/slint/vestra/widgets.slint +12 -4
- package/dist/capabilities.d.ts +0 -107
- package/dist/capabilities.js +0 -69
- package/dist/capability-check.d.ts +0 -133
- package/dist/capability-check.js +0 -371
- package/dist/capability-rules.d.ts +0 -125
- package/dist/capability-rules.js +0 -192
- package/dist/host-capabilities.d.ts +0 -10
- package/dist/host-capabilities.js +0 -477
|
@@ -70,7 +70,8 @@ import { join } from "node:path";
|
|
|
70
70
|
import { fileURLToPath } from "node:url";
|
|
71
71
|
import { HostError } from "../../wire.js";
|
|
72
72
|
import { BAR_BUTTON_ICONS, BAR_BUTTON_LIMITS, BUILTIN_COMMANDS, BUILTIN_SUBMENUS, COMMAND_LIMITS, MENU_IDS, } from "../../commands.js";
|
|
73
|
-
import {
|
|
73
|
+
import { CAPABILITIES_REMOVED } from "../../manifest.js";
|
|
74
|
+
import { MESSAGE_LIMIT } from "../../protocol.js";
|
|
74
75
|
import { OSD_LIMITS } from "../osd.js";
|
|
75
76
|
import { TIMELINE_LIMITS } from "../timeline.js";
|
|
76
77
|
import { SECRET_LIMITS, SESSION_STORAGE_LIMITS } from "../services.js";
|
|
@@ -85,11 +86,12 @@ import { PATCH_FEATURE } from "../patch.js";
|
|
|
85
86
|
import { LOCALES, LIST_SEPARATORS, loadPackageCatalog, TEXT_LIMITS, } from "../../i18n.js";
|
|
86
87
|
import { Internals } from "./internals.js";
|
|
87
88
|
import { on, emit, settle, close, keepsRunning, transportHandlers, tick, takenErrors, tellResidency, } from "./transport.js";
|
|
88
|
-
import { bindingClaims, bindingKey, keysChanged, press, barButtons, commandsHandlers, builtinHandlers, runPaletteLead,
|
|
89
|
+
import { bindingClaims, bindingKey, keysChanged, press, barButtons, commandsHandlers, builtinHandlers, runPaletteLead, } from "./commands.js";
|
|
89
90
|
import { registerCoreActions, windowFacts, coreActionsHandlers, } from "./core-actions.js";
|
|
90
91
|
import { translate, i18nHandlers } from "./i18n.js";
|
|
91
92
|
import { mountOther, unmountOther, mounted, setTimelineRanges, setTimelineLayer, layoutHandlers, } from "./layout.js";
|
|
92
93
|
import { osdHandlers } from "./osd.js";
|
|
94
|
+
import { mpvHandlers, setMpvProperty } from "./mpv.js";
|
|
93
95
|
import { packageDirectories } from "./slint-types.js";
|
|
94
96
|
import { failStream, jobsHandlers } from "./jobs.js";
|
|
95
97
|
import { motionState, upscalingState, failVideoRender, failVideoShaders, upscalingDecoding, processingHandlers, } from "./processing.js";
|
|
@@ -103,8 +105,6 @@ export { COMMAND_LIMITS, MENU_IDS };
|
|
|
103
105
|
export { BAR_BUTTON_ICONS, BAR_BUTTON_LIMITS };
|
|
104
106
|
/** The submenus of the player's built-in plugins, by key path. */
|
|
105
107
|
export { BUILTIN_COMMANDS, BUILTIN_SUBMENUS };
|
|
106
|
-
/** The manifest capabilities: what each opens and how the store shows it. */
|
|
107
|
-
export { CAPABILITY_INFO };
|
|
108
108
|
/** The longest message a plugin may send the player. */
|
|
109
109
|
export { MESSAGE_LIMIT };
|
|
110
110
|
/** The player's limits on the on-screen display. */
|
|
@@ -244,7 +244,6 @@ export { LOCALES };
|
|
|
244
244
|
* {@link startPlugin}, drive it, `settle()`, and assert on what it
|
|
245
245
|
* recorded.
|
|
246
246
|
*
|
|
247
|
-
* @capability None.
|
|
248
247
|
* @see [Test a plugin](../../../docs/guides/testing.md)
|
|
249
248
|
* @since 1.0.0
|
|
250
249
|
* @category Testing
|
|
@@ -256,7 +255,7 @@ export class TestHost {
|
|
|
256
255
|
* Wire-level; prefer {@link TestHost.sent} for one method.
|
|
257
256
|
*/
|
|
258
257
|
calls = [];
|
|
259
|
-
/** The host events the plugin subscribed to
|
|
258
|
+
/** The host events the plugin subscribed to. */
|
|
260
259
|
subscriptions = new Set();
|
|
261
260
|
/**
|
|
262
261
|
* The subscribed events the plugin really listens to: an `onChange` and
|
|
@@ -361,7 +360,6 @@ export class TestHost {
|
|
|
361
360
|
* await host.pressOsdAction(0); // runs the plugin's `reveal` command
|
|
362
361
|
* ```
|
|
363
362
|
*
|
|
364
|
-
* @capability None.
|
|
365
363
|
* @since 1.6.9
|
|
366
364
|
*/
|
|
367
365
|
async pressOsdAction(index) {
|
|
@@ -424,8 +422,6 @@ export class TestHost {
|
|
|
424
422
|
* @param directory - The package directory (holding `locales/`).
|
|
425
423
|
* @since 1.5.9
|
|
426
424
|
*
|
|
427
|
-
* @capability None.
|
|
428
|
-
*
|
|
429
425
|
* @example Load the translations after changing the language
|
|
430
426
|
* The test switches the host to German before starting the plugin and
|
|
431
427
|
* loads that catalog itself (`startPlugin` does the same). Texts are then
|
|
@@ -462,8 +458,6 @@ export class TestHost {
|
|
|
462
458
|
* ```
|
|
463
459
|
*
|
|
464
460
|
* @since 1.5.9
|
|
465
|
-
*
|
|
466
|
-
* @capability None.
|
|
467
461
|
*/
|
|
468
462
|
translate(text, args) {
|
|
469
463
|
return translate(this, this.#inner, text, args);
|
|
@@ -482,11 +476,9 @@ export class TestHost {
|
|
|
482
476
|
* @param language - `"system"` or a locale.
|
|
483
477
|
* @since 1.5.9
|
|
484
478
|
*
|
|
485
|
-
* @capability None.
|
|
486
|
-
*
|
|
487
479
|
* @example Simulate the user choosing French for the next start
|
|
488
480
|
* The plugin hears that the saved interface language changed. The host
|
|
489
|
-
* pushes `appearance.changed`, which a plugin
|
|
481
|
+
* pushes `appearance.changed`, which a plugin sees (after `plugin.player.subscribe()`) in
|
|
490
482
|
* `appearance.language` once it has read it and subscribed; this run's
|
|
491
483
|
* language does not change.
|
|
492
484
|
* ```ts
|
|
@@ -704,7 +696,6 @@ export class TestHost {
|
|
|
704
696
|
* assert.equal(plugin.timeline.ranges[0]?.plugin, "community.clips");
|
|
705
697
|
* ```
|
|
706
698
|
*
|
|
707
|
-
* @capability None.
|
|
708
699
|
* @since 1.6.9
|
|
709
700
|
*/
|
|
710
701
|
setTimelineRanges(pluginId, ranges) {
|
|
@@ -720,8 +711,8 @@ export class TestHost {
|
|
|
720
711
|
* @example Let another plugin publish chapters
|
|
721
712
|
* The plugin under test sees two chapter marks another plugin put on the
|
|
722
713
|
* timeline. `setTimelineLayer` stores that plugin's whole layer and pushes
|
|
723
|
-
* `timeline.changed`; once the plugin uses `plugin.timeline` (
|
|
724
|
-
* `
|
|
714
|
+
* `timeline.changed`; once the plugin uses `plugin.timeline` (after
|
|
715
|
+
* `plugin.player.subscribe()`) the SDK keeps `marks` current from that event, and `settle()`
|
|
725
716
|
* lets it arrive.
|
|
726
717
|
* ```ts
|
|
727
718
|
* import assert from "node:assert/strict";
|
|
@@ -735,7 +726,6 @@ export class TestHost {
|
|
|
735
726
|
* assert.equal(plugin.timeline.marks.length, 2);
|
|
736
727
|
* ```
|
|
737
728
|
*
|
|
738
|
-
* @capability None.
|
|
739
729
|
* @since 1.0.0
|
|
740
730
|
*/
|
|
741
731
|
setTimelineLayer(pluginId, marks) {
|
|
@@ -769,7 +759,6 @@ export class TestHost {
|
|
|
769
759
|
* );
|
|
770
760
|
* ```
|
|
771
761
|
*
|
|
772
|
-
* @capability None.
|
|
773
762
|
* @since 1.0.0
|
|
774
763
|
*/
|
|
775
764
|
imagePath(value) {
|
|
@@ -815,7 +804,6 @@ export class TestHost {
|
|
|
815
804
|
* });
|
|
816
805
|
* ```
|
|
817
806
|
*
|
|
818
|
-
* @capability None.
|
|
819
807
|
* @throws Never: files nobody takes are ignored, as in the player.
|
|
820
808
|
* @since 1.0.0
|
|
821
809
|
*/
|
|
@@ -828,17 +816,15 @@ export class TestHost {
|
|
|
828
816
|
* Simulate another plugin switching the palette: updates
|
|
829
817
|
* {@link TestHost.appearance} and pushes `appearance.changed`.
|
|
830
818
|
*
|
|
831
|
-
* @capability None.
|
|
832
|
-
*
|
|
833
819
|
* @example Simulate another plugin switching to the light palette
|
|
834
820
|
* The plugin hears the palette change. The host updates `appearance` and
|
|
835
|
-
* pushes `appearance.changed` to a plugin that listens
|
|
821
|
+
* pushes `appearance.changed` to a plugin that listens (after `plugin.player.subscribe()`).
|
|
836
822
|
* ```ts
|
|
837
823
|
* import assert from "node:assert/strict";
|
|
838
824
|
* declare const host: TestHost;
|
|
839
825
|
* // ---cut---
|
|
840
826
|
* const themes: string[] = [];
|
|
841
|
-
* plugin.player.on("appearance.changed", ({ theme }) => themes.push(theme)); // subscribes
|
|
827
|
+
* plugin.player.on("appearance.changed", ({ theme }) => themes.push(theme)); // subscribes
|
|
842
828
|
* host.setAppearance("vestra-light");
|
|
843
829
|
* await host.settle();
|
|
844
830
|
* assert.deepEqual(themes, ["vestra-light"]);
|
|
@@ -882,7 +868,6 @@ export class TestHost {
|
|
|
882
868
|
* assert.equal(page.props["step"], 10);
|
|
883
869
|
* ```
|
|
884
870
|
*
|
|
885
|
-
* @capability None.
|
|
886
871
|
* @since 1.0.0
|
|
887
872
|
*/
|
|
888
873
|
settingsPage(id) {
|
|
@@ -897,8 +882,6 @@ export class TestHost {
|
|
|
897
882
|
* Simulate the backdrop's `effective` changing (`false`: a video frame
|
|
898
883
|
* appeared; `true`: there is none again); pushed to the plugin.
|
|
899
884
|
*
|
|
900
|
-
* @capability None.
|
|
901
|
-
*
|
|
902
885
|
* @example Make a video picture replace the backdrop
|
|
903
886
|
* The plugin's backdrop hears that a video frame now covers it. `false`
|
|
904
887
|
* means a picture appeared; the change is pushed like the player's
|
|
@@ -949,8 +932,6 @@ export class TestHost {
|
|
|
949
932
|
* ```
|
|
950
933
|
*
|
|
951
934
|
* @since 1.5.2
|
|
952
|
-
*
|
|
953
|
-
* @capability None.
|
|
954
935
|
*/
|
|
955
936
|
mountOther(slot, plugin, options = {}) {
|
|
956
937
|
return mountOther(this, this.#inner, slot, plugin, options);
|
|
@@ -961,8 +942,6 @@ export class TestHost {
|
|
|
961
942
|
*
|
|
962
943
|
* @since 1.5.2
|
|
963
944
|
*
|
|
964
|
-
* @capability None.
|
|
965
|
-
*
|
|
966
945
|
* @example Let the playlist's tab go away
|
|
967
946
|
* The other plugin's sidebar tab disappears and the plugin's own tab
|
|
968
947
|
* becomes current. When the removed tab was current, the next tab (else
|
|
@@ -986,8 +965,6 @@ export class TestHost {
|
|
|
986
965
|
*
|
|
987
966
|
* @since 1.5.2
|
|
988
967
|
*
|
|
989
|
-
* @capability None.
|
|
990
|
-
*
|
|
991
968
|
* @example Click another plugin's sidebar tab
|
|
992
969
|
* The user switches the sidebar to the playlist; the plugin's panel is in
|
|
993
970
|
* a background tab now. The change is pushed as `window.state`.
|
|
@@ -1021,8 +998,6 @@ export class TestHost {
|
|
|
1021
998
|
* `video.view()` then fails with `conflict`), or, with `null`, releasing
|
|
1022
999
|
* it (values reset to the defaults).
|
|
1023
1000
|
*
|
|
1024
|
-
* @capability None.
|
|
1025
|
-
*
|
|
1026
1001
|
* @example Let another plugin own the display layer
|
|
1027
1002
|
* The plugin's `video.view()` fails with `conflict` because another plugin
|
|
1028
1003
|
* took the display layer first. `null` releases it again.
|
|
@@ -1055,8 +1030,6 @@ export class TestHost {
|
|
|
1055
1030
|
* `video.render()` then fails with `conflict`), or, with `null`, releasing
|
|
1056
1031
|
* them (values reset to the defaults).
|
|
1057
1032
|
*
|
|
1058
|
-
* @capability None.
|
|
1059
|
-
*
|
|
1060
1033
|
* @example Let another plugin own the render options
|
|
1061
1034
|
* The plugin's render options report `conflict` while another plugin owns
|
|
1062
1035
|
* them; `null` releases them and resets the values to the defaults.
|
|
@@ -1104,7 +1077,6 @@ export class TestHost {
|
|
|
1104
1077
|
* assert.equal(render.status.state, "failed");
|
|
1105
1078
|
* ```
|
|
1106
1079
|
*
|
|
1107
|
-
* @capability None.
|
|
1108
1080
|
* @since 1.0.0
|
|
1109
1081
|
*/
|
|
1110
1082
|
failVideoRender(code, message) {
|
|
@@ -1142,8 +1114,6 @@ export class TestHost {
|
|
|
1142
1114
|
* player never pushes it, it refuses the `set` request itself after
|
|
1143
1115
|
* an abnormal end. To test that, set {@link TestHost.previousCrash}.
|
|
1144
1116
|
*
|
|
1145
|
-
* @capability None.
|
|
1146
|
-
*
|
|
1147
1117
|
* @example Make the plugin's shader fail to compile
|
|
1148
1118
|
* The plugin's shader handle reports `failed`, as when mpv rejects a
|
|
1149
1119
|
* shader. The host pushes the failure only to a handle that holds
|
|
@@ -1341,8 +1311,6 @@ export class TestHost {
|
|
|
1341
1311
|
* plugin's file resolvers and of {@link TestHost.otherResolvers}, sorted,
|
|
1342
1312
|
* each once.
|
|
1343
1313
|
*
|
|
1344
|
-
* @capability None.
|
|
1345
|
-
*
|
|
1346
1314
|
* @example Check the file types a resolver adds
|
|
1347
1315
|
* The test checks the list the plugin will hear in
|
|
1348
1316
|
* `resolvers.fileTypes`: the extensions of its own file resolvers and of
|
|
@@ -1383,7 +1351,7 @@ export class TestHost {
|
|
|
1383
1351
|
* declare const host: TestHost;
|
|
1384
1352
|
* // ---cut---
|
|
1385
1353
|
* const heard: string[][] = [];
|
|
1386
|
-
* // A listener of the event
|
|
1354
|
+
* // A listener of the event: each list the player sends.
|
|
1387
1355
|
* plugin.player.on("resolvers.fileTypes", ({ fileTypes }) => heard.push(fileTypes));
|
|
1388
1356
|
* // Another plugin starts with a resolver for .ch8 files.
|
|
1389
1357
|
* host.otherResolvers.push({ owner: "example.emulator", extensions: ["ch8"] });
|
|
@@ -1392,7 +1360,6 @@ export class TestHost {
|
|
|
1392
1360
|
* assert.deepEqual(heard, [["ch8"]]);
|
|
1393
1361
|
* ```
|
|
1394
1362
|
*
|
|
1395
|
-
* @capability None.
|
|
1396
1363
|
* @since 1.5.8
|
|
1397
1364
|
*/
|
|
1398
1365
|
updateFileTypes() {
|
|
@@ -1476,6 +1443,57 @@ export class TestHost {
|
|
|
1476
1443
|
active: false,
|
|
1477
1444
|
},
|
|
1478
1445
|
};
|
|
1446
|
+
/**
|
|
1447
|
+
* The mpv pass-through (`plugin.mpv`), without an mpv: `commands` are
|
|
1448
|
+
* the commands the plugin sent, in order (they do nothing else);
|
|
1449
|
+
* `properties` is what `get` answers and `set` writes (a property not in
|
|
1450
|
+
* it fails `backend`, "mpv: property not found"); `labels` are the
|
|
1451
|
+
* owners of filter labels by `"vf/<label>"` or `"af/<label>"` (preset
|
|
1452
|
+
* another plugin's id to test `conflict`); `observed` are the properties
|
|
1453
|
+
* the plugin observes. The player's refusals apply (`refused`,
|
|
1454
|
+
* `invalid`, the limit of 64 observed properties), from the same table
|
|
1455
|
+
* as the player's.
|
|
1456
|
+
*
|
|
1457
|
+
* @since 1.8.0
|
|
1458
|
+
*/
|
|
1459
|
+
mpv = {
|
|
1460
|
+
/** The commands the plugin sent, in order, as their arrays. */
|
|
1461
|
+
commands: [],
|
|
1462
|
+
/** Property values by name: what `get` answers and `set` writes. */
|
|
1463
|
+
properties: new Map(),
|
|
1464
|
+
/** The owner (a plugin id) of each filter label, by `"vf/<label>"` or `"af/<label>"`. */
|
|
1465
|
+
labels: new Map(),
|
|
1466
|
+
/** The properties the plugin observes now. */
|
|
1467
|
+
observed: new Set(),
|
|
1468
|
+
};
|
|
1469
|
+
/**
|
|
1470
|
+
* Simulate mpv changing a property: store the value and send it to the
|
|
1471
|
+
* plugin if it observes the property (`plugin.mpv.observe`).
|
|
1472
|
+
*
|
|
1473
|
+
* @param name - The property, as mpv names it.
|
|
1474
|
+
* @param value - Its new value.
|
|
1475
|
+
*
|
|
1476
|
+
* @example The frame rate behind the filters changes
|
|
1477
|
+
* The plugin's listener hears the value the test gives the property.
|
|
1478
|
+
* `setMpvProperty` stores it and sends the `mpv.property` event that
|
|
1479
|
+
* the player sends to an observer; `settle` lets it arrive.
|
|
1480
|
+
* ```ts
|
|
1481
|
+
* import assert from "node:assert/strict";
|
|
1482
|
+
* declare const host: TestHost;
|
|
1483
|
+
* // ---cut---
|
|
1484
|
+
* const seen: unknown[] = [];
|
|
1485
|
+
* plugin.mpv.observe("estimated-vf-fps", (fps) => seen.push(fps));
|
|
1486
|
+
* await host.settle();
|
|
1487
|
+
* host.setMpvProperty("estimated-vf-fps", 59.94);
|
|
1488
|
+
* await host.settle();
|
|
1489
|
+
* assert.deepEqual(seen, [null, 59.94]); // no value at first, then the change
|
|
1490
|
+
* ```
|
|
1491
|
+
*
|
|
1492
|
+
* @since 1.8.0
|
|
1493
|
+
*/
|
|
1494
|
+
setMpvProperty(name, value) {
|
|
1495
|
+
setMpvProperty(this, name, value);
|
|
1496
|
+
}
|
|
1479
1497
|
/**
|
|
1480
1498
|
* The player's secret store for this plugin: name → value. Preset entries
|
|
1481
1499
|
* to simulate stored secrets; inject failures with
|
|
@@ -1674,7 +1692,6 @@ export class TestHost {
|
|
|
1674
1692
|
* assert.match(String(host.window("upscale").props.blocker), /Picture Adjustments/);
|
|
1675
1693
|
* ```
|
|
1676
1694
|
*
|
|
1677
|
-
* @capability None.
|
|
1678
1695
|
* @since 1.5.43
|
|
1679
1696
|
*/
|
|
1680
1697
|
upscalingDecoding(cause, plugins = []) {
|
|
@@ -1686,8 +1703,6 @@ export class TestHost {
|
|
|
1686
1703
|
* plugin listening with `plugin.video.upscaling.onChange` receives it.
|
|
1687
1704
|
* Nothing reaches a plugin that does not listen.
|
|
1688
1705
|
*
|
|
1689
|
-
* @capability None.
|
|
1690
|
-
*
|
|
1691
1706
|
* @example Show the new factor in the plugin's window
|
|
1692
1707
|
* The window resized: the test changes the area and the factor, sends
|
|
1693
1708
|
* the change, and checks that the plugin's window shows the new factor.
|
|
@@ -1762,8 +1777,6 @@ export class TestHost {
|
|
|
1762
1777
|
* plugin listening with `plugin.video.motion("amd").onChange` receives it.
|
|
1763
1778
|
* Nothing reaches a plugin that does not listen.
|
|
1764
1779
|
*
|
|
1765
|
-
* @capability None.
|
|
1766
|
-
*
|
|
1767
1780
|
* @example The GPU fell behind
|
|
1768
1781
|
* The player turned the converter off for this video; the plugin's
|
|
1769
1782
|
* panel shows the reason.
|
|
@@ -1904,9 +1917,9 @@ export class TestHost {
|
|
|
1904
1917
|
// ------------------------------------------------------------ built-in only
|
|
1905
1918
|
/**
|
|
1906
1919
|
* The plugin is built into the player (`startPlugin`'s `builtin`). Only
|
|
1907
|
-
* then does the host
|
|
1908
|
-
* (`commands.run`, `palette.lead
|
|
1909
|
-
* `capability`, as in the player.
|
|
1920
|
+
* then does the host answer the built-in-only requests
|
|
1921
|
+
* (`commands.list`, `commands.run`, `palette.lead.*`); otherwise they
|
|
1922
|
+
* fail with `capability`, as in the player.
|
|
1910
1923
|
*
|
|
1911
1924
|
* @since 1.7.9
|
|
1912
1925
|
*/
|
|
@@ -1962,7 +1975,6 @@ export class TestHost {
|
|
|
1962
1975
|
* await stop();
|
|
1963
1976
|
* ```
|
|
1964
1977
|
*
|
|
1965
|
-
* @capability None.
|
|
1966
1978
|
* @throws `Error` without a code (rejects) The plugin has no lead row.
|
|
1967
1979
|
* @since 1.7.9
|
|
1968
1980
|
*/
|
|
@@ -1992,7 +2004,6 @@ export class TestHost {
|
|
|
1992
2004
|
* assert.deepEqual(host.coreRuns, ["play-pause"]);
|
|
1993
2005
|
* ```
|
|
1994
2006
|
*
|
|
1995
|
-
* @capability None.
|
|
1996
2007
|
* @since 1.0.0
|
|
1997
2008
|
*/
|
|
1998
2009
|
coreAction(id) {
|
|
@@ -2073,7 +2084,6 @@ export class TestHost {
|
|
|
2073
2084
|
* host.reset("system.openPath");
|
|
2074
2085
|
* ```
|
|
2075
2086
|
*
|
|
2076
|
-
* @capability None.
|
|
2077
2087
|
* @since 1.0.0
|
|
2078
2088
|
*/
|
|
2079
2089
|
handle(method, handler) {
|
|
@@ -2082,8 +2092,6 @@ export class TestHost {
|
|
|
2082
2092
|
/**
|
|
2083
2093
|
* Restore the default behaviour of a method replaced with {@link TestHost.handle}.
|
|
2084
2094
|
*
|
|
2085
|
-
* @capability None.
|
|
2086
|
-
*
|
|
2087
2095
|
* @example Restore the default answer after a simulated failure
|
|
2088
2096
|
* The first write fails, the second succeeds. `reset` removes the handler
|
|
2089
2097
|
* that `handle` installed, so the method is answered by the test host
|
|
@@ -2109,14 +2117,12 @@ export class TestHost {
|
|
|
2109
2117
|
* Deliver a host event to the plugin. Like the player, subscription-based
|
|
2110
2118
|
* events (`source.state`, `playback.backend`, `window.state`,
|
|
2111
2119
|
* `timeline.changed`, `appearance.changed`) are delivered only when the
|
|
2112
|
-
* plugin subscribed (it
|
|
2120
|
+
* plugin subscribed (it called `plugin.player.subscribe()` and listens). Most tests use the
|
|
2113
2121
|
* higher-level helpers (`setSource`, `setMainWindow`, ...) instead.
|
|
2114
2122
|
*
|
|
2115
2123
|
* @param event - The wire event name.
|
|
2116
2124
|
* @param data - The event payload (wire-level shape).
|
|
2117
2125
|
*
|
|
2118
|
-
* @capability None.
|
|
2119
|
-
*
|
|
2120
2126
|
* @example Deliver a raw event the helpers do not cover
|
|
2121
2127
|
* The test pushes a `window.state` event after changing `layout` by hand.
|
|
2122
2128
|
* Like the player, the host delivers it only when the plugin subscribed;
|
|
@@ -2165,7 +2171,6 @@ export class TestHost {
|
|
|
2165
2171
|
* await host.settle();
|
|
2166
2172
|
* ```
|
|
2167
2173
|
*
|
|
2168
|
-
* @capability None.
|
|
2169
2174
|
* @since 1.0.0
|
|
2170
2175
|
*/
|
|
2171
2176
|
setSource(patch) {
|
|
@@ -2200,7 +2205,6 @@ export class TestHost {
|
|
|
2200
2205
|
* assert.equal(plugin.window.state.maximized, true);
|
|
2201
2206
|
* ```
|
|
2202
2207
|
*
|
|
2203
|
-
* @capability None.
|
|
2204
2208
|
* @since 1.0.0
|
|
2205
2209
|
*/
|
|
2206
2210
|
setMainWindow(patch) {
|
|
@@ -2212,8 +2216,6 @@ export class TestHost {
|
|
|
2212
2216
|
* those switched on, pop out or collapse (reference §6.3). No effect outside
|
|
2213
2217
|
* fullscreen, or on a column switched off or floating.
|
|
2214
2218
|
*
|
|
2215
|
-
* @capability None.
|
|
2216
|
-
*
|
|
2217
2219
|
* @example Pop the sidebar out in fullscreen
|
|
2218
2220
|
* The pointer reaches the right edge in fullscreen and the attached
|
|
2219
2221
|
* sidebar pops out over the video. Outside fullscreen, or with the
|
|
@@ -2263,7 +2265,6 @@ export class TestHost {
|
|
|
2263
2265
|
* assert.equal(plugin.player.isCurrent(before), false);
|
|
2264
2266
|
* ```
|
|
2265
2267
|
*
|
|
2266
|
-
* @capability None.
|
|
2267
2268
|
* @since 1.0.0
|
|
2268
2269
|
*/
|
|
2269
2270
|
openElsewhere(source, phase = "ready") {
|
|
@@ -2297,7 +2298,6 @@ export class TestHost {
|
|
|
2297
2298
|
* host.failStream(producer!.id, "producer transport closed");
|
|
2298
2299
|
* ```
|
|
2299
2300
|
*
|
|
2300
|
-
* @capability None.
|
|
2301
2301
|
* @since 1.5.7
|
|
2302
2302
|
*/
|
|
2303
2303
|
failStream(producerId, message) {
|
|
@@ -2333,7 +2333,6 @@ export class TestHost {
|
|
|
2333
2333
|
* await host.press("Delete", { panel: true }); // while the panel has focus
|
|
2334
2334
|
* ```
|
|
2335
2335
|
*
|
|
2336
|
-
* @capability None.
|
|
2337
2336
|
* @throws `command` (rejects) A `HostError`: the command that would run is
|
|
2338
2337
|
* busy (the player only logs this).
|
|
2339
2338
|
* @throws `Error` (rejects) Nothing is bound to the key.
|
|
@@ -2386,7 +2385,6 @@ export class TestHost {
|
|
|
2386
2385
|
* assert.equal(host.window("picture").props["brightness-down"], "⇧W");
|
|
2387
2386
|
* ```
|
|
2388
2387
|
*
|
|
2389
|
-
* @capability None.
|
|
2390
2388
|
* @throws `Error` `command` is neither a command of the plugin nor a
|
|
2391
2389
|
* core command.
|
|
2392
2390
|
* @since 1.6.6
|
|
@@ -2439,7 +2437,7 @@ export class TestHost {
|
|
|
2439
2437
|
* // ---cut---
|
|
2440
2438
|
* host.candidates.set("/downloads/someone.demo-1.0.0.vxp", {
|
|
2441
2439
|
* id: "someone.demo", version: "1.0.0", apiVersion: "vestra/1",
|
|
2442
|
-
* entry: "main.js",
|
|
2440
|
+
* entry: "main.js",
|
|
2443
2441
|
* });
|
|
2444
2442
|
* ```
|
|
2445
2443
|
*/
|
|
@@ -2461,7 +2459,6 @@ export class TestHost {
|
|
|
2461
2459
|
* host.installKeepsDisabled = false; // every install runs
|
|
2462
2460
|
* ```
|
|
2463
2461
|
*
|
|
2464
|
-
* @capability None.
|
|
2465
2462
|
* @since 1.5.55
|
|
2466
2463
|
*/
|
|
2467
2464
|
installKeepsDisabled = true;
|
|
@@ -2490,7 +2487,6 @@ export class TestHost {
|
|
|
2490
2487
|
* assert.equal(host.markdown(rows[0]!.body)?.text, "**Hello**");
|
|
2491
2488
|
* ```
|
|
2492
2489
|
*
|
|
2493
|
-
* @capability None.
|
|
2494
2490
|
* @since 1.1.0
|
|
2495
2491
|
*/
|
|
2496
2492
|
markdown(value) {
|
|
@@ -2509,8 +2505,6 @@ export class TestHost {
|
|
|
2509
2505
|
* Replace the plugin list and push `packages.changed` (another plugin
|
|
2510
2506
|
* started, stopped, was installed or removed).
|
|
2511
2507
|
*
|
|
2512
|
-
* @capability None.
|
|
2513
|
-
*
|
|
2514
2508
|
* @example Simulate another plugin starting
|
|
2515
2509
|
* The plugin's store window hears that a plugin is running now. The list
|
|
2516
2510
|
* replaces `packages` and is pushed as `packages.changed`, which the
|
|
@@ -2533,7 +2527,6 @@ export class TestHost {
|
|
|
2533
2527
|
* asks this plugin's sequence provider. Rejects with `unavailable` when
|
|
2534
2528
|
* there is no provider or its flag is false.
|
|
2535
2529
|
*
|
|
2536
|
-
* @capability None.
|
|
2537
2530
|
* @throws `unavailable` (rejects) A `HostError`: there is no sequence
|
|
2538
2531
|
* provider, or its flag is false.
|
|
2539
2532
|
*
|
|
@@ -2559,8 +2552,6 @@ export class TestHost {
|
|
|
2559
2552
|
* The plugin's command with this local id. Throws when it is not
|
|
2560
2553
|
* registered (never added, or disposed).
|
|
2561
2554
|
*
|
|
2562
|
-
* @capability None.
|
|
2563
|
-
*
|
|
2564
2555
|
* @example Read a command's state after a change
|
|
2565
2556
|
* The test checks that Export becomes enabled once a file is ready. The
|
|
2566
2557
|
* record is updated as the plugin sends new state; read it after
|
|
@@ -2629,7 +2620,6 @@ export class TestHost {
|
|
|
2629
2620
|
* assert.equal(host.window("picture").props["brightness"], 0);
|
|
2630
2621
|
* ```
|
|
2631
2622
|
*
|
|
2632
|
-
* @capability None.
|
|
2633
2623
|
* @since 1.0.0
|
|
2634
2624
|
*/
|
|
2635
2625
|
window(id) {
|
|
@@ -2659,7 +2649,6 @@ export class TestHost {
|
|
|
2659
2649
|
* await host.settle();
|
|
2660
2650
|
* ```
|
|
2661
2651
|
*
|
|
2662
|
-
* @capability None.
|
|
2663
2652
|
* @since 1.0.0
|
|
2664
2653
|
*/
|
|
2665
2654
|
mounted(slot) {
|
|
@@ -2679,7 +2668,6 @@ export class TestHost {
|
|
|
2679
2668
|
* assert.deepEqual(host.sent("osd.show").at(-1), { text: "Saved" });
|
|
2680
2669
|
* ```
|
|
2681
2670
|
*
|
|
2682
|
-
* @capability None.
|
|
2683
2671
|
* @since 1.0.0
|
|
2684
2672
|
*/
|
|
2685
2673
|
sent(method) {
|
|
@@ -2738,7 +2726,6 @@ export class TestHost {
|
|
|
2738
2726
|
* assert.equal(importWindow.props["status-text"], expected);
|
|
2739
2727
|
* ```
|
|
2740
2728
|
*
|
|
2741
|
-
* @capability None.
|
|
2742
2729
|
* @throws Never.
|
|
2743
2730
|
* @since 1.0.0
|
|
2744
2731
|
*/
|
|
@@ -2752,8 +2739,6 @@ export class TestHost {
|
|
|
2752
2739
|
* `ENOTEMPTY`, `EBUSY`, `EPERM`) is retried for about 1.5 s, then left
|
|
2753
2740
|
* for the system to clean, with a warning on the console.
|
|
2754
2741
|
*
|
|
2755
|
-
* @capability None.
|
|
2756
|
-
*
|
|
2757
2742
|
* @example Clean up a host that was never started
|
|
2758
2743
|
* A test that made a host but failed before `startPlugin` removes the
|
|
2759
2744
|
* host's temporary directories itself. `stop()` from `startPlugin` calls
|
|
@@ -2786,7 +2771,6 @@ export class TestHost {
|
|
|
2786
2771
|
* and start it again on its next use. Filter chains, streams, jobs and the
|
|
2787
2772
|
* like (which also keep a plugin running) are not listed.
|
|
2788
2773
|
*
|
|
2789
|
-
* @capability None.
|
|
2790
2774
|
* @since 1.5.40
|
|
2791
2775
|
*
|
|
2792
2776
|
* @example Check that a plugin can be stopped while idle
|
|
@@ -2813,6 +2797,7 @@ export class TestHost {
|
|
|
2813
2797
|
...i18nHandlers(this, this.#inner),
|
|
2814
2798
|
...layoutHandlers(this, this.#inner),
|
|
2815
2799
|
...osdHandlers(this, this.#inner),
|
|
2800
|
+
...mpvHandlers(this, this.#inner),
|
|
2816
2801
|
...jobsHandlers(this, this.#inner),
|
|
2817
2802
|
...processingHandlers(this, this.#inner),
|
|
2818
2803
|
...mediaHandlers(this, this.#inner),
|
|
@@ -2825,18 +2810,16 @@ export class TestHost {
|
|
|
2825
2810
|
* registration started during activation (commands, panels, resolvers, ...),
|
|
2826
2811
|
* then wait until the host is idle.
|
|
2827
2812
|
*
|
|
2828
|
-
* The manifest id
|
|
2829
|
-
*
|
|
2830
|
-
*
|
|
2831
|
-
*
|
|
2832
|
-
*
|
|
2833
|
-
*
|
|
2834
|
-
* marks, video shaders and views, among others) fail with `capability` as in
|
|
2835
|
-
* the player, but a call the player refuses for an undeclared capability can
|
|
2836
|
-
* succeed here. `vestra-plugin check` (and the TypeScript plugin) reports
|
|
2837
|
-
* those calls from the sources.
|
|
2813
|
+
* The manifest id comes from `directory/manifest.json` unless `id` is
|
|
2814
|
+
* given; then no manifest is read (and without `directory` none is read
|
|
2815
|
+
* either: the id is `"test.plugin"`). Nothing in the manifest changes how
|
|
2816
|
+
* the plugin runs: event delivery and the start-up reads are the plugin's
|
|
2817
|
+
* own calls (`plugin.player.subscribe()`, `plugin.player.read()`), as in
|
|
2818
|
+
* the player.
|
|
2838
2819
|
*
|
|
2839
|
-
* Rejects when `manifest.json` cannot be read or parsed, when
|
|
2820
|
+
* Rejects when `manifest.json` cannot be read or parsed, when it still has
|
|
2821
|
+
* `capabilities` (removed in 1.9.0; the message says what to call
|
|
2822
|
+
* instead), when `activate`
|
|
2840
2823
|
* throws, or when a registration made during activation fails (for example
|
|
2841
2824
|
* `limit`, `conflict`, `invalid`). Stricter than the player's runner for
|
|
2842
2825
|
* commands: there the SDK logs a command declaration the player refuses during
|
|
@@ -2898,7 +2881,6 @@ export class TestHost {
|
|
|
2898
2881
|
* player's runner does and returns the host to drive, the `plugin` object
|
|
2899
2882
|
* to call directly, and `stop` to end it like the player.
|
|
2900
2883
|
*
|
|
2901
|
-
* @capability None.
|
|
2902
2884
|
* @see [Test a plugin](../../../docs/guides/testing.md)
|
|
2903
2885
|
* @since 1.0.0
|
|
2904
2886
|
* @category Testing
|
|
@@ -2910,16 +2892,15 @@ export async function startPlugin(activate, options = {}) {
|
|
|
2910
2892
|
const directory = options.directory instanceof URL
|
|
2911
2893
|
? fileURLToPath(options.directory)
|
|
2912
2894
|
: (options.directory ?? process.cwd());
|
|
2913
|
-
let manifest = {
|
|
2914
|
-
|
|
2915
|
-
capabilities: options.capabilities ?? [],
|
|
2916
|
-
};
|
|
2917
|
-
if (options.directory && !options.capabilities) {
|
|
2895
|
+
let manifest = { id: options.id ?? "test.plugin" };
|
|
2896
|
+
if (options.directory && options.id === undefined) {
|
|
2918
2897
|
const read = JSON.parse(readFileSync(join(directory, "manifest.json"), "utf8"));
|
|
2919
|
-
|
|
2898
|
+
// As `vestra-plugin check` and the player: the field is gone.
|
|
2899
|
+
if (read && typeof read === "object" && "capabilities" in read)
|
|
2900
|
+
throw new Error(CAPABILITIES_REMOVED);
|
|
2901
|
+
manifest = { id: read.id };
|
|
2920
2902
|
}
|
|
2921
2903
|
host.manifestId = manifest.id;
|
|
2922
|
-
pluginCapabilities.set(host, manifest.capabilities);
|
|
2923
2904
|
if (options.builtin)
|
|
2924
2905
|
host.builtin = true;
|
|
2925
2906
|
host.loadCatalog(directory);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Json } from "../../wire.ts";
|
|
2
|
+
import type { TestHost } from "./index.ts";
|
|
3
|
+
import type { Handler, Internals } from "./internals.ts";
|
|
4
|
+
/** Implements `TestHost.setMpvProperty`. */
|
|
5
|
+
export declare function setMpvProperty(host: TestHost, name: string, value: Json): void;
|
|
6
|
+
/** The default handlers of this area's wire methods, by method name. */
|
|
7
|
+
export declare function mpvHandlers(host: TestHost, _inner: Internals): Record<string, Handler>;
|