@aiot-toolkit/emulator 2.0.6-beta.17 → 2.0.6-beta.19

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.
@@ -27,7 +27,6 @@ Object.defineProperty(exports, "isVelaImageType", {
27
27
  });
28
28
  var _os = _interopRequireDefault(require("os"));
29
29
  var _path = _interopRequireDefault(require("path"));
30
- var _https = _interopRequireDefault(require("https"));
31
30
  var _Vvd = require("../typing/Vvd");
32
31
  var _utils = require("../utils");
33
32
  var _shared = require("../shared");
@@ -51,15 +50,8 @@ async function getSdkUrl() {
51
50
  const internalBaseUrl = 'https://cnbj3-fusion-fds.api.xiaomi.net/vela-ide';
52
51
  // 优先使用内网域名,因为云上工程没有外网环境
53
52
  let base = internalBaseUrl;
54
- await new Promise(resolve => {
55
- _https.default.get(`${base}/versions.json`, {
56
- timeout: 2000
57
- }, res => {
58
- if (res.statusCode !== 200) {
59
- base = externalBaseUrl;
60
- }
61
- resolve();
62
- });
53
+ await fetch(`${base}/versions.json`).catch(() => {
54
+ base = externalBaseUrl;
63
55
  });
64
56
  return {
65
57
  baseUrl: base,
@@ -80,14 +72,14 @@ const VelaImageVersionList = exports.VelaImageVersionList = [{
80
72
  label: 'vela-miwear-watch-5',
81
73
  description: '适用于手表/手环的,带表盘的 vela 5.0 镜像,不可自定义模拟器尺寸',
82
74
  value: _Vvd.VelaImageType.VELA_MIWEAR_WATCH_5,
83
- time: '20260112',
75
+ time: '20260130',
84
76
  hide: false,
85
77
  icon: ''
86
78
  }, {
87
79
  label: 'vela-watch-5',
88
80
  description: '适用于手表/手环的,不带表盘的 vela 5.0 镜像,可自定义模拟器尺寸',
89
81
  value: _Vvd.VelaImageType.VELA_WATCH_5,
90
- time: '20250716',
82
+ time: '20260127',
91
83
  hide: false,
92
84
  icon: ''
93
85
  }, {
@@ -115,8 +107,8 @@ const VelaImageVersionList = exports.VelaImageVersionList = [{
115
107
  label: 'openvela-smartspeaker-5',
116
108
  description: '适用于音响的 vela-miwear 5.0 镜像,不可自定义模拟器尺寸',
117
109
  value: _Vvd.VelaImageType.OPENVELA_SMARTSPEAKER_5,
118
- time: '20260116',
119
- hide: false,
110
+ time: '20260128',
111
+ hide: true,
120
112
  icon: ''
121
113
  }];
122
114
  const EmulatorEnvVersion = exports.EmulatorEnvVersion = {
package/lib/vvd/index.js CHANGED
@@ -135,8 +135,7 @@ class VvdManager {
135
135
  if (marketName) {
136
136
  configIniJson['product.marketname'] = marketName;
137
137
  }
138
- // 默认使用 'image.sysdir.2' 自定义使用 'image.sysdir.1'
139
- configIniJson['image.sysdir.2'] = imagePath;
138
+ configIniJson['image.sysdir.1'] = imagePath;
140
139
  try {
141
140
  _fs.default.mkdirSync(vvdDir, {
142
141
  recursive: true
@@ -197,8 +196,8 @@ class VvdManager {
197
196
  vvdInfo.width = config['hw.lcd.width'];
198
197
  vvdInfo.shape = config['hw.lcd.shape'];
199
198
  vvdInfo.skin = config['skin.name'];
200
- vvdInfo.imageDir = config['image.sysdir.2'];
201
- vvdInfo.customImagePath = config['image.sysdir.1'];
199
+ vvdInfo.imageDir = config['image.sysdir.1'];
200
+ vvdInfo.customImagePath = config['ide.image.reset.sysdir'];
202
201
  vvdInfo.customLcdRadius = config['ide.lcd.radius'];
203
202
  if (config['ide.image.type']) vvdInfo.imageType = config['ide.image.type'];
204
203
  if (vvdInfo.skin) {
@@ -322,6 +321,7 @@ class VvdManager {
322
321
  const configIni = _path.default.resolve(currVvdDir, 'config.ini');
323
322
  const contents = _fs.default.readFileSync(configIni, 'utf-8');
324
323
  const config = (0, _ini.parse)(contents);
324
+ config['ide.image.reset.sysdir'] = config['image.sysdir.1'];
325
325
  config['image.sysdir.1'] = target;
326
326
  await _fs.default.promises.writeFile(configIni, (0, _ini.stringify)(config));
327
327
  const defaultImageHome = config['image.sysdir.1'];
@@ -351,8 +351,7 @@ class VvdManager {
351
351
  const config = (0, _ini.parse)(contents);
352
352
  const home = this.getSDKPart(_Vvd.SDKParts.SYSTEM_IMAGES);
353
353
  let imageDir = _path.default.resolve(home, config['ide.image.type']);
354
- config['image.sysdir.2'] = imageDir;
355
- delete config['image.sysdir.1'];
354
+ config['image.sysdir.1'] = imageDir;
356
355
  _fs.default.writeFileSync(configIni, (0, _ini.stringify)(config));
357
356
  }
358
357
  getEmulatorBinPath(sdkHome) {
@@ -422,6 +421,18 @@ class VvdManager {
422
421
  needUpdate = true;
423
422
  config['image.sysdir.2'] = normalizePath(config['image.sysdir.2'].toString()).replace('.export_dev/system-images', '.vela/sdk/system-images');
424
423
  }
424
+
425
+ // 不在使用 'image.sysdir.2' 字段,统一使用 'ide.image.reset.sysdir'
426
+ if (config['image.sysdir.2']) {
427
+ needUpdate = true;
428
+ const oldVal = config['image.sysdir.2'];
429
+ // TODO delete 会造成 image.sysdir.2= 留下一个空值
430
+ delete config['image.sysdir.2'];
431
+ if (config['image.sysdir.1']) {
432
+ config['ide.image.reset.sysdir'] = config['image.sysdir.1'];
433
+ }
434
+ config['image.sysdir.1'] = oldVal;
435
+ }
425
436
  if (needUpdate) {
426
437
  await _promises.default.writeFile(configIni, (0, _ini.stringify)(config));
427
438
  _ColorConsole.default.log(`update ${vvdName} config.ini`);
@@ -476,8 +487,8 @@ class VvdManager {
476
487
  const verboseOption = options.verbose ? `-verbose` : ``;
477
488
  // 启动模拟器的命令和参数
478
489
 
479
- const vvdInfo = this.getVvdInfo(vvdName);
480
490
  await this.oldEmulatorMigrate(vvdName);
491
+ const vvdInfo = this.getVvdInfo(vvdName);
481
492
  if (vvdInfo.imageType === _Vvd.VelaImageType.OPENVELA_SMARTSPEAKER_5) {
482
493
  qemuOption = `-device virtio-snd,bus=virtio-mmio-bus.2 -allow-host-audio -semihosting -smp 4 -device virtio-gpu-device,xres=480,yres=800,bus=virtio-mmio-bus.5`;
483
494
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/emulator",
3
- "version": "2.0.6-beta.17",
3
+ "version": "2.0.6-beta.19",
4
4
  "description": "vela emulator tool.",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -32,7 +32,7 @@
32
32
  "emulator"
33
33
  ],
34
34
  "dependencies": {
35
- "@aiot-toolkit/shared-utils": "2.0.6-beta.17",
35
+ "@aiot-toolkit/shared-utils": "2.0.6-beta.19",
36
36
  "@grpc/grpc-js": "^1.13.3",
37
37
  "@grpc/proto-loader": "^0.7.13",
38
38
  "@miwt/adb": "0.10.5",
@@ -50,5 +50,5 @@
50
50
  "@types/adm-zip": "^0.5.5",
51
51
  "@types/ini": "^4.1.1"
52
52
  },
53
- "gitHead": "d9d60157e951ebbc58f6a6f6fac63efd9d9d4fd5"
53
+ "gitHead": "29d48c29e9b35e01a722868daba622fd74baefc9"
54
54
  }