@scm-js/plugin-api 1.23.0 → 1.25.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.
Files changed (2) hide show
  1. package/index.d.ts +35 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1141,6 +1141,15 @@ export interface MapImageOptions {
1141
1141
  */
1142
1142
  rect?: Rect | null;
1143
1143
  }
1144
+ export type TestRoute = "desktop" | "folder" | "download";
1145
+ export interface TestMapOutcome {
1146
+ route: TestRoute;
1147
+ /** The file's name, or its full path when the desktop wrote it. */
1148
+ path: string;
1149
+ launched: boolean;
1150
+ /** Why the game did not start, when it was asked to. */
1151
+ message?: string;
1152
+ }
1144
1153
  /** What the registry knows about a section name, sized for one map. */
1145
1154
  export interface SectionKnowledge {
1146
1155
  name: string;
@@ -1957,6 +1966,20 @@ export interface PluginManifest {
1957
1966
  icon?: string;
1958
1967
  /** The `PLUGIN_API_VERSION` the plugin was written against. */
1959
1968
  api?: number;
1969
+ /**
1970
+ * Plugins this one needs running, as the specs Manage Plugins takes
1971
+ * (`"github:owner/repo"`, `"github:owner/repo@v1.2.0"`, a URL to a `plugin.json`,
1972
+ * `"builtin:name"`). Adding this plugin installs them first, enabling it enables them,
1973
+ * and the editor starts them before it; a required plugin cannot be turned off or
1974
+ * removed while something enabled needs it.
1975
+ *
1976
+ * Which *version* of the required plugin is enough is not said here. The two plugins
1977
+ * meet through `api.services`: the required one provides a service with a `version`
1978
+ * (`ServiceOptions`), and this one checks `ServiceInfo.version` in its `watch` and says
1979
+ * so in its own words when it is too old. A version range in the manifest would have
1980
+ * the editor arbitrate a contract it never reads.
1981
+ */
1982
+ requires?: string[];
1960
1983
  }
1961
1984
  /** What `activate` may hand back: nothing, a cleanup function, or a Disposable. */
1962
1985
  export type Deactivate = void | (() => void) | Disposable;
@@ -2295,6 +2318,18 @@ export interface DocumentApi {
2295
2318
  * a map, null.
2296
2319
  */
2297
2320
  renderImage(options?: Partial<MapImageOptions>): Promise<Blob | null>;
2321
+ /**
2322
+ * Tools ▸ Test Map for bytes of the plugin's own — a built map that is not the open
2323
+ * one. On the desktop the file is written into the game's `Maps\scmJS` folder and, with
2324
+ * `launch` (the preference when omitted), the game is started; in a browser it is
2325
+ * written into the test folder the user picked once. It never downloads: a browser
2326
+ * with no folder answers null, so a plugin that has already saved the file says "open
2327
+ * it with Test Map" instead of handing out a second copy. `fileName` gets an archive's
2328
+ * extension if it lacks one.
2329
+ */
2330
+ test(bytes: Uint8Array, fileName: string, options?: {
2331
+ launch?: boolean;
2332
+ }): Promise<TestMapOutcome | null>;
2298
2333
  /**
2299
2334
  * Scenario ▸ Resize / Crop Map: a transaction outside the undo model that drops both
2300
2335
  * history stacks (as the dialog does). Content keeps its place relative to `anchor`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.23.0",
3
+ "version": "1.25.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",