@aiot-nexus/plugin-sdk 3.0.2 → 3.1.1

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.
@@ -34,6 +34,7 @@ const plugin_manifest_schema_json_1 = __importDefault(require("../.generated/plu
34
34
  const plugin_framework_version_1 = require("../.generated/plugin-framework-version");
35
35
  const manifestValidator = new _2020_1.default({ allErrors: true, strict: true })
36
36
  .compile(plugin_manifest_schema_json_1.default);
37
+ const hostStatusBarFrameworkVersion = "3.1.0";
37
38
  function validatePluginPackage(packageDirectory, options = {}) {
38
39
  const resolvedDirectory = path.resolve(packageDirectory);
39
40
  try {
@@ -85,6 +86,11 @@ function validateResolvedPluginPackage(resolvedDirectory, options) {
85
86
  if (!(0, plugin_framework_version_1.isPluginFrameworkVersionCompatible)(manifest.hostApiVersion, plugin_framework_version_1.PLUGIN_FRAMEWORK_VERSION)) {
86
87
  errors.push("Plugin Framework API version is incompatible with " + plugin_framework_version_1.PLUGIN_FRAMEWORK_VERSION + ".");
87
88
  }
89
+ const hostStatusBarVersionComparison = (0, plugin_framework_version_1.comparePluginVersions)(manifest.hostApiVersion, hostStatusBarFrameworkVersion);
90
+ if (usesHostStatusBarDeclaration(manifest)
91
+ && (hostStatusBarVersionComparison === undefined || hostStatusBarVersionComparison < 0)) {
92
+ errors.push("businessEntries.showHostStatusBar requires Plugin Framework API 3.1.0 or newer.");
93
+ }
88
94
  if (!(0, plugin_framework_version_1.parsePluginCompatibleVersion)(manifest.minHostVersion)) {
89
95
  errors.push("minHostVersion contains an unsupported numeric version.");
90
96
  }
@@ -141,6 +147,9 @@ function usesPluginFrame(manifest) {
141
147
  || (manifest.tools || []).some((entry) => entry.component === "PluginFrame")
142
148
  || (manifest.settingsSections || []).some((entry) => entry.component === "PluginFrame");
143
149
  }
150
+ function usesHostStatusBarDeclaration(manifest) {
151
+ return (manifest.businessEntries || []).some((entry) => (Object.prototype.hasOwnProperty.call(entry, "showHostStatusBar")));
152
+ }
144
153
  function isPathInside(rootDirectory, childPath) {
145
154
  const relative = path.relative(path.resolve(rootDirectory), path.resolve(childPath));
146
155
  return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-nexus/plugin-sdk",
3
- "version": "3.0.2",
3
+ "version": "3.1.1",
4
4
  "description": "Types, PluginFrame client, and CLI for AIoT Nexus independent plugins.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -38,7 +38,7 @@
38
38
  "postinstall": "node scripts/sdk-update-check.js --install",
39
39
  "verify:package": "node scripts/verify-package.js",
40
40
  "test:types": "tsc -p tsconfig.types-test.json",
41
- "test": "npm run build && npm run test:types && node tests/package.test.js && node tests/sdk-update-check.test.js && node tests/cli.test.js && node tests/cli-entry.test.js && node tests/update-notice.test.js && node tests/dev.test.js && node tests/nexus-dev.test.js && node tests/frame-client.test.js && node tests/web-dev.test.js && npm run verify:package",
41
+ "test": "npm run build && npm run test:types && node tests/package.test.js && node tests/sdk-update-check.test.js && node tests/cli.test.js && node tests/cli-entry.test.js && node tests/update-notice.test.js && node tests/upgrade.test.js && node tests/dev.test.js && node tests/nexus-dev.test.js && node tests/frame-client.test.js && node tests/web-dev.test.js && npm run verify:package",
42
42
  "prepack": "node scripts/prepack.js",
43
43
  "pack:sdk": "npm run build && npm run verify:package && node scripts/pack.js",
44
44
  "publish:sdk": "npm publish"
@@ -348,7 +348,7 @@ function formatUpdateNotice(result) {
348
348
  const lines = [
349
349
  "npm notice",
350
350
  "npm notice Update available for " + result.packageName + ": " + result.currentVersion + " -> " + result.latestVersion,
351
- "npm notice Run npm install --save-dev " + result.packageName + "@latest"
351
+ "npm notice Run npx --package=" + result.packageName + "@" + result.latestVersion + " nexus-plugin upgrade ."
352
352
  ];
353
353
  if (result.isMajorUpdate) {
354
354
  lines.push("npm notice Major update: first confirm Nexus Framework API compatibility.");
@@ -13,7 +13,7 @@ npm run dev:nexus -- --host C:\path\to\nexus.exe
13
13
 
14
14
  SDK checks for a newer `@aiot-nexus/plugin-sdk` in two steps. The package `postinstall` refreshes a user cache; npm 7+ hides dependency lifecycle output by default, so use `npm install --foreground-scripts` to see it. The `nexus-plugin` CLI reads that cache and prints npm-style notices when it is fresh; missing or older-than-24-hours cache data is checked in the background without blocking the command. `npm install --ignore-scripts` skips only the install check, while CLI checks remain available.
15
15
 
16
- The check follows the npm-configured registry, falls back to the official npm registry when needed, and silently ignores offline, timeout, malformed-response, or corrupt-cache failures. Use `NEXUS_PLUGIN_SDK_UPDATE_CHECK=0` or `NO_UPDATE_NOTIFIER=1` to disable both checks. A major SDK update requires confirming Nexus Framework API compatibility; upgrades are never automatic. When a notice appears, review compatibility and run `npm install --save-dev @aiot-nexus/plugin-sdk@latest` manually.
16
+ The check follows the npm-configured registry, falls back to the official npm registry when needed, and silently ignores offline, timeout, malformed-response, or corrupt-cache failures. Use `NEXUS_PLUGIN_SDK_UPDATE_CHECK=0` or `NO_UPDATE_NOTIFIER=1` to disable both checks. Notices never modify the project. When one appears, substitute the exact version printed by the notice for `X.Y.Z`: `npx --package=@aiot-nexus/plugin-sdk@X.Y.Z nexus-plugin upgrade . --check`, then repeat without `--check`. The transaction synchronizes package.json, package-lock.json, and node_modules, runs project checks, and rolls back on failure. A major update additionally requires `--allow-major` and the migration guide linked by the CLI; source and manifest files are never rewritten.
17
17
 
18
18
  The deployable plugin package is `dist/__PLUGIN_ID__/`. For a manual installation, stop Nexus before replacing `Plugins/__PLUGIN_ID__/`, then start it again. During development, use `npm run dev:nexus` so the CLI coordinates Nexus shutdown, atomic replacement, and restart for trusted `mainEntry` changes.
19
19
 
@@ -109,9 +109,9 @@ Use `npm run dev:web` for renderer-only UI work in the system browser. It runs `
109
109
 
110
110
  Use `npm run dev:nexus -- --host C:\path\to\nexus.exe` for live development against a compiled, packaged Nexus. The CLI atomically deploys this plugin to `<exeDir>/Plugins/__PLUGIN_ID__/`. Renderer changes rebuild and reload the iframe without changing the Nexus PID; safe manifest changes rescan contributions in the same process; `mainEntry`, dependency, native-module, or restart-sensitive manifest changes stop Nexus, replace the complete package, and start a new Nexus process because trusted modules cannot be unloaded safely from Node's module cache. Failed builds keep the previous deployment; launch or readiness failures restore the previous package and host. Add `--no-devtools`, `--inspect[=<port>]`, `--inspect-brk[=<port>]`, `--surface`, or `--contribution-id` after the second `--` as needed.
111
111
 
112
- When this project was created from a local SDK archive, `vendor/aiot-nexus-plugin-sdk.tgz` is part of the source project and must be kept when the project is moved or committed.
112
+ When this project was created from a local SDK archive, `vendor/aiot-nexus-plugin-sdk.tgz` is part of the source project and must be kept when the project is moved or committed. An explicit local upgrade copies the target archive to `vendor/aiot-nexus-plugin-sdk-<version>.tgz` and updates the exact file dependency.
113
113
 
114
- For a local SDK archive, the tgz version remains the plugin's current SDK version for comparison. It is not replaced automatically by a newer npm package; fully offline work can disable checks with the environment variables above.
114
+ For a local SDK archive, the tgz version remains the plugin's current SDK version for comparison. It is not replaced automatically by a newer npm package; pass the target archive to both npx and `nexus-plugin upgrade --sdk-source <archive>`. Fully offline work can disable checks with the environment variables above.
115
115
 
116
116
  For trusted-main breakpoints, open this plugin directory in VS Code, set breakpoints in `src/main.ts`, and run `Debug Nexus plugin`. To attach manually, start `npm run dev:debug` and select `Attach Nexus plugin main process (9229)`. Renderer DevTools opens automatically, with `src/renderer/app.ts` available through the development source map. `npm run dev` rebuilds before launch; use `npm run dev -- --no-build` only when intentionally reusing the current `dist` output.
117
117
 
@@ -13,7 +13,7 @@ npm run dev:nexus -- --host C:\path\to\nexus.exe
13
13
 
14
14
  SDK checks for a newer `@aiot-nexus/plugin-sdk` in two steps. The package `postinstall` refreshes a user cache; npm 7+ hides dependency lifecycle output by default, so use `npm install --foreground-scripts` to see it. The `nexus-plugin` CLI reads that cache and prints npm-style notices when it is fresh; missing or older-than-24-hours cache data is checked in the background without blocking the command. `npm install --ignore-scripts` skips only the install check, while CLI checks remain available.
15
15
 
16
- The check follows the npm-configured registry, falls back to the official npm registry when needed, and silently ignores offline, timeout, malformed-response, or corrupt-cache failures. Use `NEXUS_PLUGIN_SDK_UPDATE_CHECK=0` or `NO_UPDATE_NOTIFIER=1` to disable both checks. A major SDK update requires confirming Nexus Framework API compatibility; upgrades are never automatic. When a notice appears, review compatibility and run `npm install --save-dev @aiot-nexus/plugin-sdk@latest` manually.
16
+ The check follows the npm-configured registry, falls back to the official npm registry when needed, and silently ignores offline, timeout, malformed-response, or corrupt-cache failures. Use `NEXUS_PLUGIN_SDK_UPDATE_CHECK=0` or `NO_UPDATE_NOTIFIER=1` to disable both checks. Notices never modify the project. When one appears, substitute the exact version printed by the notice for `X.Y.Z`: `npx --package=@aiot-nexus/plugin-sdk@X.Y.Z nexus-plugin upgrade . --check`, then repeat without `--check`. The transaction synchronizes package.json, package-lock.json, and node_modules, runs project checks (including the Electron 22 native rebuild), and rolls back on failure. A major update additionally requires `--allow-major` and the migration guide linked by the CLI; source and manifest files are never rewritten.
17
17
 
18
18
  Every `npm run build` rebuilds `better-sqlite3@8.7.0` for Electron 22.3.27 with `@electron/rebuild@3.7.2` before packaging. `npm run rebuild:native` remains available as a standalone diagnostic command.
19
19
 
@@ -57,9 +57,9 @@ Use `npm run dev:web` for renderer-only layout, styling, localization, and respo
57
57
 
58
58
  Use `npm run dev:nexus -- --host C:\path\to\nexus.exe` to run the plugin inside a compiled, packaged Nexus. The initial deployment and every full package replacement are atomic. Renderer-only and safe manifest updates keep the Nexus PID; `mainEntry`, dependency, native-module, or restart-sensitive manifest changes run the complete build (including the Electron 22.3.27 native rebuild), stop Nexus, replace the package, and start a new Nexus process. The database remains under the host-provided plugin data directory across host restarts. Failed builds keep the previous deployment, and launch or readiness failures roll the package back and restore the previous host. Add `--no-devtools`, `--inspect[=<port>]`, `--inspect-brk[=<port>]`, `--surface`, or `--contribution-id` after the second `--` as needed.
59
59
 
60
- When this project was created from a local SDK archive, `vendor/aiot-nexus-plugin-sdk.tgz` is part of the source project and must be kept when the project is moved or committed.
60
+ When this project was created from a local SDK archive, `vendor/aiot-nexus-plugin-sdk.tgz` is part of the source project and must be kept when the project is moved or committed. An explicit local upgrade copies the target archive to `vendor/aiot-nexus-plugin-sdk-<version>.tgz` and updates the exact file dependency.
61
61
 
62
- For a local SDK archive, the tgz version remains the plugin's current SDK version for comparison. It is not replaced automatically by a newer npm package; fully offline work can disable checks with the environment variables above.
62
+ For a local SDK archive, the tgz version remains the plugin's current SDK version for comparison. It is not replaced automatically by a newer npm package; pass the target archive to both npx and `nexus-plugin upgrade --sdk-source <archive>`. Fully offline work can disable checks with the environment variables above.
63
63
 
64
64
  For trusted-main breakpoints, open this plugin directory in VS Code, set breakpoints in `src/main.ts`, and run `Debug Nexus plugin`. To attach manually, start `npm run dev:debug` and select `Attach Nexus plugin main process (9229)`. Renderer DevTools opens automatically, with `src/renderer/app.ts` available through the development source map. The default debug build also runs the Electron 22.3.27 native rebuild before launch. Use `npm run dev -- --no-build` only when intentionally reusing a compatible current `dist` output.
65
65