Validate a package directory. A package whose id is
reserved for the built-in plugins (vestra or vestra.*) fails with
reserved.
The player keeps the 32 most recent candidates of all plugins; an older
one's install fails with stale (validate again).
host (rejects) Not a package directory, or a manifest that
breaks the rules (another apiVersion included); message says why.
The plugin checks a folder it unpacked and installs it if the player
accepts it. validate runs the player's checks and resolves with a
candidate; a package that fails them rejects with the reason.
try {
// Rejects with the reason when the package fails the checks.
const candidate = await plugin.packages.validate(directory);
await (await candidate.install()).done;
} catch (error) {
await plugin.osd.show("Not a valid plugin: {}", [(error as Error).message]);
}
Validate a .vxp package file: the same checks as
Packages.validate after unpacking. Check the file's sha256 yourself
before calling when you know it. A reserved id fails with reserved, as in
Packages.validate.
invalid (rejects) The path does not end in .vxp, or the
archive cannot be unpacked (over 64 MB, too many files, a damaged zip,
an unsafe path).
A .vxp the plugin downloaded is checked and installed. The player
unpacks and checks it like a directory; checking the file's sha256
first, when the store publishes one, is up to the plugin.
const candidate = await plugin.packages.validateArchive(file); // a .vxp path
const change = await candidate.install();
await plugin.osd.show("Install: {}", [await change.done]);
Every plugin: running, installed, and this run's development loads.
The plugin lists the running plugins by name. list asks the player
and resolves with every plugin it knows, with its state, origin and
display texts in the interface language.
const plugins = await plugin.packages.list();
const running = plugins.filter((info) => info.state === "running");
console.log(running.map((info) => info.display?.name ?? info.id));
The new list after any start, stop, failure, install or uninstall.
Stop or start a plugin. An installed plugin stays
disabled across launches; a development load only for this run.
invalid to disable oneself, missing unknown.
busy while it is being installed or reloaded. unsupported to disable a built-in
(PluginInfo.builtin): users manage third-party plugins only.
unavailable (rejects) The player is a temporary window
(AppInfo.temporary, player 0.10.3): it runs the main window's
plugins as they are and enables or disables none.
Restart a plugin: stop it and start it again from the same package with the same data directory, for example to recover one that misbehaves. Built-ins included. A stopped or failed plugin is just started. The disabled flag is never written, so a reload never leaves a plugin disabled.
Resolves once the plugin is stopped and its start is scheduled; the
player starts it as soon as the old process is gone (at most 20 s).
Follow it with Packages.onChange: starting, then running,
or failed with the reason.
invalid for oneself or a disabled plugin (enable it instead),
missing unknown, busy while it is being installed or reloaded.
Remove an installed plugin; removeData also deletes
its data directory, otherwise reinstalling it from the same source
reconnects to its data. Its user bindings stay (as orphans).
unsupported for built-ins and development loads, missing
unknown, invalid for oneself.
Optionaloptions: { removeData?: boolean }busy (rejects) The plugin library is being cleaned up, or that
plugin is being installed or reloaded.
revisionConflict (rejects) The installed revision of that
plugin changed meanwhile; call uninstall again.
unavailable (rejects) The player is a temporary window
(AppInfo.temporary, player 0.10.3): it runs the main window's
plugins as they are and removes none.
The other plugin is removed and its data directory deleted, so a later
reinstall starts fresh. Without removeData a reinstall from the same
source finds its data again.
const change = await plugin.packages.uninstall("someone.demo", { removeData: true });
await change.done;
plugin.packages: the plugins the player knows, and installing, enabling, reloading and uninstalling them.Example: Install a plugin from an unpacked package
The plugin installs a package directory it downloaded and unpacked, and reports why when it does not work.
validateasks the player to check the package and returns a candidate;installstarts the change anddoneresolves with its final status:committedonly once the new plugin reported that it is running, otherwisefailed,cancelled,failedDegradedortooLate.Remarks
The plugins the player knows: installed, built-in and this run's development loads. Installing, enabling, reloading and uninstalling act on other plugins, never on the calling one. Built-in plugins update with the player and cannot be installed, disabled or uninstalled.
Since
1.0.0