@aiot-nexus/plugin-sdk 3.3.0 → 3.3.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.
- package/README.md +8 -8
- package/dist/src/sdk-info.d.ts +1 -1
- package/dist/src/sdk-info.js +1 -1
- package/dist/src/upgrade.d.ts +6 -0
- package/dist/src/upgrade.js +24 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @aiot-nexus/plugin-sdk
|
|
2
2
|
|
|
3
|
-
> 当前 SDK 包版本为 `3.3.
|
|
3
|
+
> 当前 SDK 包版本为 `3.3.1`,Framework API 为 `3.2.0`,manifest schema 保持 `1`。Framework 3 将可信插件的 `mainEntry` 直接加载到 AIoT Toolkits Electron 主进程;它不是安全沙箱。PluginFrame iframe 仍保持 sandbox、无 Node/Electron 访问。宿主运行模型见 [Framework v3 架构](../docs/plugin-framework-v3-architecture.md)。
|
|
4
4
|
|
|
5
5
|
本包提供公开 TypeScript 契约、PluginFrame 浏览器客户端和 `nexus-plugin` CLI。v2 项目升级前请先阅读 [v2 到 v3 迁移说明](../docs/plugin-framework-v2-v3-migration.md)。完整开发流程见 [独立插件开发指南](../docs/standalone-plugin-development-guide.md)。
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
| 项目 | 固定值 |
|
|
15
15
|
| --- | --- |
|
|
16
|
-
| SDK | `3.3.
|
|
16
|
+
| SDK | `3.3.1` |
|
|
17
17
|
| Framework API | `3.2.0` |
|
|
18
18
|
| Manifest schema | `1` |
|
|
19
19
|
| Node 安装和构建 | `>=16.20.0 <17` |
|
|
@@ -53,15 +53,15 @@ npm run publish:sdk
|
|
|
53
53
|
registry 升级与只读预检:
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
npx --package=@aiot-nexus/plugin-sdk@3.3.
|
|
57
|
-
npx --package=@aiot-nexus/plugin-sdk@3.3.
|
|
56
|
+
npx --package=@aiot-nexus/plugin-sdk@3.3.1 nexus-plugin upgrade . --check
|
|
57
|
+
npx --package=@aiot-nexus/plugin-sdk@3.3.1 nexus-plugin upgrade .
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
发布前或本地 tgz:
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
npx --package=./aiot-nexus-plugin-sdk-3.3.
|
|
64
|
-
--sdk-source ./aiot-nexus-plugin-sdk-3.3.
|
|
63
|
+
npx --package=./aiot-nexus-plugin-sdk-3.3.1.tgz nexus-plugin upgrade . \
|
|
64
|
+
--sdk-source ./aiot-nexus-plugin-sdk-3.3.1.tgz
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
CI 可以追加 `--json` 获得 `up-to-date`、`upgrade-available`、`upgraded`、`rolled-back` 或 `blocked`。`--allow-major` 只解除 major 保护,不会改写业务源码;跨 major 必须先阅读迁移指南。`--skip-project-checks` 只跳过项目 typecheck/build,安装后的 SDK、package 和 lockfile 一致性仍会验证。
|
|
@@ -72,7 +72,7 @@ CI 可以追加 `--json` 获得 `up-to-date`、`upgrade-available`、`upgraded`
|
|
|
72
72
|
|
|
73
73
|
安装或项目验证失败时恢复备份,并在原 lockfile 存在时运行 `npm ci`。没有原 lockfile 时会运行 `npm install` 并恢复原 SDK,但无法证明完整传递依赖树与升级前一致,因此返回 `blocked` 并保留恢复数据。标准脚手架 build 的 `dist/<pluginId>` 在回滚范围内;自定义 typecheck/build 若修改其他路径,这些副作用不属于升级事务,项目必须自行管理。
|
|
74
74
|
|
|
75
|
-
SDK `3.0.x` / `3.1.x` 插件可以由 3.2.x 宿主继续加载。升级到 SDK `3.2.0` 只提供主题能力和新的契约;插件必须引用 `--nexus-color-*` 或读取 `context.theme` 才会使用宿主主题色。没有引用新变量的插件保持原有颜色;需要自定义主题时传入 `autoApplyHostTheme: false`。原有 `hostApiVersion: 3.0.0` 可以保持不变,只有实际使用 `showHostStatusBar` 时才需要声明 `hostApiVersion: 3.1.0` 或更高。SDK 3.1.1 修复 registry 升级命令丢失 npm 包名的问题,SDK 3.3.0 将 `dev:nexus --host` 目录查找目标改为 `AIoT Toolkits.exe
|
|
75
|
+
SDK `3.0.x` / `3.1.x` 插件可以由 3.2.x 宿主继续加载。升级到 SDK `3.2.0` 只提供主题能力和新的契约;插件必须引用 `--nexus-color-*` 或读取 `context.theme` 才会使用宿主主题色。没有引用新变量的插件保持原有颜色;需要自定义主题时传入 `autoApplyHostTheme: false`。原有 `hostApiVersion: 3.0.0` 可以保持不变,只有实际使用 `showHostStatusBar` 时才需要声明 `hostApiVersion: 3.1.0` 或更高。SDK 3.1.1 修复 registry 升级命令丢失 npm 包名的问题,SDK 3.3.0 将 `dev:nexus --host` 目录查找目标改为 `AIoT Toolkits.exe`,SDK 3.3.1 修复 npx 启动升级器时误用 `npx-cli.js` 执行 npm 命令的问题,均作为历史兼容说明保留。
|
|
76
76
|
|
|
77
77
|
## 创建插件
|
|
78
78
|
|
|
@@ -95,7 +95,7 @@ nexus-plugin create my-frame-plugin \
|
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
97
|
npm run pack:sdk
|
|
98
|
-
nexus-plugin create my-frame-plugin --sdk-source ./package/aiot-nexus-plugin-sdk-3.3.
|
|
98
|
+
nexus-plugin create my-frame-plugin --sdk-source ./package/aiot-nexus-plugin-sdk-3.3.1.tgz --install
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
生成插件后,可以在 `src/manifest.json` 的业务入口中静态控制 AIoT Toolkits 宿主状态栏。相关 manifest 片段如下,其余必填字段沿用脚手架生成值:
|
package/dist/src/sdk-info.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PLUGIN_SDK_VERSION = "3.3.
|
|
1
|
+
export declare const PLUGIN_SDK_VERSION = "3.3.1";
|
|
2
2
|
export declare const PLUGIN_SDK_NODE_ENGINE = ">=16.20.0 <17";
|
|
3
3
|
export declare const PLUGIN_SDK_NPM_ENGINE = ">=6.13.4";
|
|
4
4
|
export declare const PLUGIN_SDK_ELECTRON_VERSION = "22.3.27";
|
package/dist/src/sdk-info.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPluginSdkInfo = exports.PLUGIN_SDK_TYPES_NODE_VERSION = exports.PLUGIN_SDK_TYPESCRIPT_VERSION = exports.PLUGIN_SDK_ELECTRON_VERSION = exports.PLUGIN_SDK_NPM_ENGINE = exports.PLUGIN_SDK_NODE_ENGINE = exports.PLUGIN_SDK_VERSION = void 0;
|
|
4
4
|
const plugin_framework_version_1 = require("../.generated/plugin-framework-version");
|
|
5
|
-
exports.PLUGIN_SDK_VERSION = "3.3.
|
|
5
|
+
exports.PLUGIN_SDK_VERSION = "3.3.1";
|
|
6
6
|
exports.PLUGIN_SDK_NODE_ENGINE = ">=16.20.0 <17";
|
|
7
7
|
exports.PLUGIN_SDK_NPM_ENGINE = ">=6.13.4";
|
|
8
8
|
exports.PLUGIN_SDK_ELECTRON_VERSION = "22.3.27";
|
package/dist/src/upgrade.d.ts
CHANGED
|
@@ -42,3 +42,9 @@ export interface PluginSdkUpgradeRuntime {
|
|
|
42
42
|
}
|
|
43
43
|
export declare function runPluginSdkUpgrade(options: PluginSdkUpgradeOptions, runtime?: PluginSdkUpgradeRuntime): PluginSdkUpgradeResult;
|
|
44
44
|
export declare function formatPluginSdkUpgradeResult(result: PluginSdkUpgradeResult): string;
|
|
45
|
+
/**
|
|
46
|
+
* npm_execpath points at npm-cli.js under `npm run`, but at npx-cli.js under
|
|
47
|
+
* `npx`; routing npm commands through npx-cli.js fails on the first npm-only
|
|
48
|
+
* flag. npx-cli.js and npm-cli.js live in the same npm bin directory.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveNpmCliEntryPoint(npmExecPath: string | undefined): string | undefined;
|
package/dist/src/upgrade.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.formatPluginSdkUpgradeResult = exports.runPluginSdkUpgrade = void 0;
|
|
26
|
+
exports.resolveNpmCliEntryPoint = exports.formatPluginSdkUpgradeResult = exports.runPluginSdkUpgrade = void 0;
|
|
27
27
|
const child_process_1 = require("child_process");
|
|
28
28
|
const fs = __importStar(require("fs"));
|
|
29
29
|
const path = __importStar(require("path"));
|
|
@@ -1070,12 +1070,32 @@ function defaultRuntime() {
|
|
|
1070
1070
|
};
|
|
1071
1071
|
}
|
|
1072
1072
|
function runNpm(args, cwd) {
|
|
1073
|
-
const
|
|
1074
|
-
if (
|
|
1075
|
-
return runProcess(process.execPath, [
|
|
1073
|
+
const npmCliEntryPoint = resolveNpmCliEntryPoint(process.env.npm_execpath);
|
|
1074
|
+
if (npmCliEntryPoint) {
|
|
1075
|
+
return runProcess(process.execPath, [npmCliEntryPoint, ...args], cwd);
|
|
1076
1076
|
}
|
|
1077
1077
|
return runProcess(process.platform === "win32" ? "npm.cmd" : "npm", args, cwd);
|
|
1078
1078
|
}
|
|
1079
|
+
/**
|
|
1080
|
+
* npm_execpath points at npm-cli.js under `npm run`, but at npx-cli.js under
|
|
1081
|
+
* `npx`; routing npm commands through npx-cli.js fails on the first npm-only
|
|
1082
|
+
* flag. npx-cli.js and npm-cli.js live in the same npm bin directory.
|
|
1083
|
+
*/
|
|
1084
|
+
function resolveNpmCliEntryPoint(npmExecPath) {
|
|
1085
|
+
if (!npmExecPath) {
|
|
1086
|
+
return undefined;
|
|
1087
|
+
}
|
|
1088
|
+
const base = path.basename(npmExecPath).toLowerCase();
|
|
1089
|
+
if (base === "npm-cli.js") {
|
|
1090
|
+
return npmExecPath;
|
|
1091
|
+
}
|
|
1092
|
+
if (base === "npx-cli.js") {
|
|
1093
|
+
const sibling = path.join(path.dirname(npmExecPath), "npm-cli.js");
|
|
1094
|
+
return fs.existsSync(sibling) ? sibling : undefined;
|
|
1095
|
+
}
|
|
1096
|
+
return undefined;
|
|
1097
|
+
}
|
|
1098
|
+
exports.resolveNpmCliEntryPoint = resolveNpmCliEntryPoint;
|
|
1079
1099
|
function runProcess(command, args, cwd) {
|
|
1080
1100
|
const result = (0, child_process_1.spawnSync)(command, args, {
|
|
1081
1101
|
cwd,
|