@skyvexsoftware/stratos-sdk 0.1.8 → 0.1.10
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.
|
@@ -6,14 +6,14 @@ import type { PluginBackgroundModule } from "../types/module";
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```ts
|
|
9
|
-
* import { createPlugin } from "@skyvexsoftware/stratos-sdk";
|
|
9
|
+
* import { createPlugin } from "@skyvexsoftware/stratos-sdk/helpers";
|
|
10
10
|
*
|
|
11
11
|
* export default createPlugin({
|
|
12
12
|
* async onStart(ctx) {
|
|
13
13
|
* ctx.logger.info("MyPlugin", "Starting up...");
|
|
14
14
|
* },
|
|
15
|
-
* async onStop() {
|
|
16
|
-
*
|
|
15
|
+
* async onStop(ctx) {
|
|
16
|
+
* ctx.logger.info("MyPlugin", "Shutting down...");
|
|
17
17
|
* },
|
|
18
18
|
* });
|
|
19
19
|
* ```
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* ```ts
|
|
8
|
-
* import { createPlugin } from "@skyvexsoftware/stratos-sdk";
|
|
8
|
+
* import { createPlugin } from "@skyvexsoftware/stratos-sdk/helpers";
|
|
9
9
|
*
|
|
10
10
|
* export default createPlugin({
|
|
11
11
|
* async onStart(ctx) {
|
|
12
12
|
* ctx.logger.info("MyPlugin", "Starting up...");
|
|
13
13
|
* },
|
|
14
|
-
* async onStop() {
|
|
15
|
-
*
|
|
14
|
+
* async onStop(ctx) {
|
|
15
|
+
* ctx.logger.info("MyPlugin", "Shutting down...");
|
|
16
16
|
* },
|
|
17
17
|
* });
|
|
18
18
|
* ```
|
|
@@ -24,9 +24,6 @@ export function createPlugin(module) {
|
|
|
24
24
|
if (typeof module.onStop !== "function") {
|
|
25
25
|
throw new Error("Plugin module must export an onStop function");
|
|
26
26
|
}
|
|
27
|
-
if (module.onResume !== undefined && typeof module.onResume !== "function") {
|
|
28
|
-
throw new Error("Plugin module onResume must be a function if provided");
|
|
29
|
-
}
|
|
30
27
|
return module;
|
|
31
28
|
}
|
|
32
29
|
//# sourceMappingURL=createPlugin.js.map
|
package/dist/types/module.d.ts
CHANGED
|
@@ -13,9 +13,7 @@ export type PluginBackgroundModule = {
|
|
|
13
13
|
/** Called during shell startup after auth is initialized */
|
|
14
14
|
onStart(ctx: PluginContext): Promise<void>;
|
|
15
15
|
/** Called during shell shutdown for graceful teardown */
|
|
16
|
-
onStop(): Promise<void>;
|
|
17
|
-
/** Optional: called when a plugin is reloaded after an update */
|
|
18
|
-
onResume?(ctx: PluginContext): Promise<void>;
|
|
16
|
+
onStop(ctx: PluginContext): Promise<void>;
|
|
19
17
|
};
|
|
20
18
|
/**
|
|
21
19
|
* A plugin UI route component — either a regular React component
|
|
@@ -21,11 +21,7 @@ import { UI_EXTERNALS } from "./externals.js";
|
|
|
21
21
|
import { serveExternals } from "./serve-externals.js";
|
|
22
22
|
import { stratosDevServer } from "./stratos-dev-server.js";
|
|
23
23
|
/** Modules external in background builds (available in Electron main process) */
|
|
24
|
-
const BG_EXTERNALS = [
|
|
25
|
-
"electron",
|
|
26
|
-
"@skyvexsoftware/stratos-sdk",
|
|
27
|
-
"socket.io-client",
|
|
28
|
-
];
|
|
24
|
+
const BG_EXTERNALS = ["electron", "socket.io-client"];
|
|
29
25
|
/** Node.js built-in modules to externalize in background builds */
|
|
30
26
|
const NODE_BUILTINS = [
|
|
31
27
|
"assert",
|
|
@@ -238,11 +234,18 @@ function createBackgroundConfig(pluginDir, entry) {
|
|
|
238
234
|
fileName: () => "index.js",
|
|
239
235
|
},
|
|
240
236
|
rollupOptions: {
|
|
241
|
-
external:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
237
|
+
external: (id) => {
|
|
238
|
+
// Bundle the SDK helpers subpath (createPlugin) into the output
|
|
239
|
+
if (id === "@skyvexsoftware/stratos-sdk/helpers")
|
|
240
|
+
return false;
|
|
241
|
+
if (id === "@skyvexsoftware/stratos-sdk")
|
|
242
|
+
return true;
|
|
243
|
+
if (BG_EXTERNALS.some((ext) => id === ext || id.startsWith(`${ext}/`)))
|
|
244
|
+
return true;
|
|
245
|
+
if (NODE_BUILTINS.some((b) => id === b || id === `node:${b}`))
|
|
246
|
+
return true;
|
|
247
|
+
return false;
|
|
248
|
+
},
|
|
246
249
|
},
|
|
247
250
|
sourcemap: !isProduction,
|
|
248
251
|
minify: false,
|