@scm-js/plugin-api 1.26.0 → 1.27.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/index.d.ts +26 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2179,8 +2179,34 @@ export interface BuildStepSpec {
|
|
|
2179
2179
|
*/
|
|
2180
2180
|
run(input: BuildStepInput): Promise<Uint8Array>;
|
|
2181
2181
|
}
|
|
2182
|
+
/**
|
|
2183
|
+
* Work a plugin does on the *document* before the map's bytes are produced for Save, Test
|
|
2184
|
+
* Map or `export` — the place to bring generated content up to date, such as writing a
|
|
2185
|
+
* script's triggers into the trigger list with `document.update`. It runs before any
|
|
2186
|
+
* build step is asked whether it applies, so a step can rely on what it did.
|
|
2187
|
+
*/
|
|
2188
|
+
export interface BeforeBuildSpec {
|
|
2189
|
+
/** Unique within the plugin. */
|
|
2190
|
+
id: string;
|
|
2191
|
+
/** What a failure notice names: "TrigScript". */
|
|
2192
|
+
label: string;
|
|
2193
|
+
/** Whether there is anything to do for the open map. Cheap and synchronous; every save asks. Always, when omitted. */
|
|
2194
|
+
applies?(): boolean;
|
|
2195
|
+
/**
|
|
2196
|
+
* May be asynchronous and may write to the document. A throw does not stop the save:
|
|
2197
|
+
* the map is written as it stands and a notice shows the error's message, so word it
|
|
2198
|
+
* for the user. Inside it `document.export()` answers the map as it stands, without
|
|
2199
|
+
* running anything.
|
|
2200
|
+
*/
|
|
2201
|
+
run(ctx: {
|
|
2202
|
+
purpose: BuildPurpose;
|
|
2203
|
+
signal: AbortSignal;
|
|
2204
|
+
}): void | Promise<void>;
|
|
2205
|
+
}
|
|
2182
2206
|
export interface BuildStepsApi {
|
|
2183
2207
|
add(spec: BuildStepSpec): Disposable;
|
|
2208
|
+
/** Run `spec.run` before the map's bytes are produced, every time the map leaves the editor. */
|
|
2209
|
+
before(spec: BeforeBuildSpec): Disposable;
|
|
2184
2210
|
/** The steps behind the file the open map came from or was last saved to; null for a plain map. */
|
|
2185
2211
|
builtBy(): BuiltBy[] | null;
|
|
2186
2212
|
}
|