@scm-js/plugin-api 1.0.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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -0
  3. package/index.d.ts +3411 -0
  4. package/package.json +18 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 scmJS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @scm-js/plugin-api
2
+
3
+ Type declarations for the plugin API of [scmJS](https://github.com/scm-js/scm-js), the
4
+ browser-based StarCraft: Brood War map editor.
5
+
6
+ ```sh
7
+ npm i -D @scm-js/plugin-api
8
+ ```
9
+
10
+ ```ts
11
+ import type { PluginApi } from "@scm-js/plugin-api";
12
+
13
+ export function activate(api: PluginApi) {
14
+ api.ui.toast("Hello from a plugin.");
15
+ }
16
+ ```
17
+
18
+ Types only. A plugin imports them with `import type`, which is erased before the editor's
19
+ loader ever sees the specifier — which is what lets this be a normal npm dependency
20
+ without breaking the rule that a plugin's *runtime* code cannot import packages by name.
21
+
22
+ ## Versions
23
+
24
+ The major **is** `PLUGIN_API_VERSION`, so `"^1"` is the range to write and it means what
25
+ it says: the minor moves whenever the declarations change, and a change that would break a
26
+ plugin moves the major and `PLUGIN_API_VERSION` together. The editor's own version is
27
+ deliberately not in here — editor 0.1.0 to 0.2.0 is an ordinary release, and semver would
28
+ read it as a break.
29
+
30
+ `PLUGIN_API_VERSION` is 1 and has never moved. Your manifest's `"api": 1` is the version
31
+ your plugin *needs*; an editor providing an older one refuses to load it.
32
+
33
+ ## This repository
34
+
35
+ **Nothing here is written by hand** except this README and the LICENSE. `index.d.ts` and
36
+ `package.json` are generated from `src/plugins/api.ts` in the editor by
37
+ `npm run build:plugin-types` and published from there, so the contract has one source and
38
+ one copy of its declarations. `main` is the tip; each `v*` tag is a published version.
39
+
40
+ It exists beside the registry as the audit trail behind the tarball, and as the way in for
41
+ anyone whose registry the package is not on — `npm i -D github:scm-js/plugin-api#v1.0.0`
42
+ works and installs exactly the same two files.
43
+
44
+ ## What the API covers
45
+
46
+ [`docs/plugins.md`](https://github.com/scm-js/scm-js/blob/main/docs/plugins.md) in the
47
+ editor is the author's guide and the tour of what a plugin can do; this repository is only
48
+ the typings for it. [`plugin-hello-world`](https://github.com/scm-js/plugin-hello-world) is
49
+ the smallest working example.
50
+
51
+ MIT, like the editor.