@arkts/image-manager 0.5.8 → 0.5.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.
package/dist/index.cjs CHANGED
@@ -32,7 +32,7 @@ let base64_js = require("base64-js");
32
32
  let vscode_fs = require("vscode-fs");
33
33
 
34
34
  //#region package.json
35
- var version = "0.5.8";
35
+ var version = "0.5.10";
36
36
 
37
37
  //#endregion
38
38
  //#region src/common/serializable-content.ts
@@ -378,7 +378,7 @@ var ListsFileImpl = class extends SerializableFileImpl {
378
378
  this.content = listsFileItems.filter((item, index, self) => index === self.findIndex((t) => t.uuid === item.uuid)).filter((item, index, self) => index === self.findIndex((t) => t.name === item.name));
379
379
  }
380
380
  addListsFileItem(listsFileItem) {
381
- this.content.push(listsFileItem);
381
+ this.content.push(Object.fromEntries(Object.entries(listsFileItem).filter(([_, value]) => value !== void 0 && value !== null)));
382
382
  this.removeDuplicateListFileItems(this.content);
383
383
  this._isChanged = true;
384
384
  return new ListsFileItemImpl(this, listsFileItem);
@@ -880,10 +880,10 @@ var LocalImageImpl = class extends BaseImageImpl {
880
880
  uuid,
881
881
  "name": options.name,
882
882
  "apiVersion": this.getApiVersion().toString(),
883
- "cpuNumber": options.cpuNumber.toString(),
883
+ "cpuNumber": options.cpuNumber?.toString(),
884
884
  "path": deviceFolderPath.fsPath,
885
- "memoryRamSize": options.memoryRamSize.toString(),
886
- "dataDiskSize": options.dataDiskSize.toString(),
885
+ "memoryRamSize": options.memoryRamSize?.toString(),
886
+ "dataDiskSize": options.dataDiskSize?.toString(),
887
887
  "version": this.getSdkPkgFile().data?.version ?? "",
888
888
  "imageDir": this.getRelativePath(),
889
889
  "showVersion": this.getSdkPkgFile().data?.guestVersion ?? "",
@@ -891,19 +891,19 @@ var LocalImageImpl = class extends BaseImageImpl {
891
891
  "harmonyos.config.path": configPath.fsPath,
892
892
  "harmonyos.log.path": logPath.fsPath,
893
893
  "hw.apiName": this.getSdkPkgFile().data?.platformVersion ?? "",
894
- "abi": this.infoFile.abi,
894
+ "abi": this.infoFile?.abi,
895
895
  "harmonyOSVersion": `${this.getSdkPkgFile().data?.guestVersion?.split(" ")[0]}-${this.getSdkPkgFile().data?.platformVersion}`,
896
896
  "guestVersion": this.getSdkPkgFile().data?.guestVersion ?? "",
897
- "diagonalSize": emulatorDeviceItem.getContent().diagonalSize.toString(),
898
- "density": emulatorDeviceItem.getContent().density.toString(),
899
- "resolutionWidth": emulatorDeviceItem.getContent().resolutionWidth.toString(),
900
- "resolutionHeight": emulatorDeviceItem.getContent().resolutionHeight.toString(),
901
- "coverResolutionWidth": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().coverResolutionWidth.toString() : void 0,
902
- "coverResolutionHeight": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().coverResolutionHeight.toString() : void 0,
903
- "coverDiagonalSize": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().coverDiagonalSize.toString() : void 0,
904
- "type": emulatorDeviceItem.getContent().deviceType,
897
+ "diagonalSize": emulatorDeviceItem.getContent()?.diagonalSize?.toString(),
898
+ "density": emulatorDeviceItem.getContent()?.density?.toString(),
899
+ "resolutionWidth": emulatorDeviceItem.getContent()?.resolutionWidth?.toString(),
900
+ "resolutionHeight": emulatorDeviceItem.getContent()?.resolutionHeight?.toString(),
901
+ "coverResolutionWidth": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.coverResolutionWidth?.toString() : void 0,
902
+ "coverResolutionHeight": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.coverResolutionHeight?.toString() : void 0,
903
+ "coverDiagonalSize": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.coverDiagonalSize?.toString() : void 0,
904
+ "type": emulatorDeviceItem.getContent()?.deviceType,
905
905
  "devModel": productConfigItem.getDevModel(),
906
- "model": productConfigItem.getContent().name
906
+ "model": productConfigItem.getContent()?.name
907
907
  });
908
908
  const device = new DeviceImpl({
909
909
  imageManager: this.getImageManager(),
@@ -912,42 +912,42 @@ var LocalImageImpl = class extends BaseImageImpl {
912
912
  screen
913
913
  });
914
914
  const deviceIniFile = new ConfigIniFileImpl(device, ConfigIniFileImpl.getFileUri(device), {
915
- "name": listFileItem.getContent().name,
916
- "deviceType": listFileItem.getContent().type,
917
- "deviceModel": listFileItem.getContent().devModel,
918
- "productModel": listFileItem.getContent().model,
915
+ "name": listFileItem.getContent()?.name,
916
+ "deviceType": listFileItem.getContent()?.type,
917
+ "deviceModel": listFileItem.getContent()?.devModel,
918
+ "productModel": listFileItem.getContent()?.model,
919
919
  "vendorCountry": options.vendorCountry ?? "CN",
920
- "uuid": listFileItem.getContent().uuid,
920
+ "uuid": listFileItem.getContent()?.uuid,
921
921
  "configPath": listFileItem.getContent()["harmonyos.config.path"],
922
922
  "logPath": listFileItem.getContent()["harmonyos.log.path"],
923
923
  "sdkPath": listFileItem.getContent()["harmonyos.sdk.path"],
924
- "imageSubPath": listFileItem.getContent().imageDir,
925
- "instancePath": listFileItem.getContent().path,
924
+ "imageSubPath": listFileItem.getContent()?.imageDir,
925
+ "instancePath": listFileItem.getContent()?.path,
926
926
  "os.osVersion": `${this.getSdkPkgFile().data?.guestVersion?.split(" ")[0]} ${this.getSdkPkgFile().data?.platformVersion}(${this.getApiVersion()})`,
927
927
  "os.apiVersion": this.getApiVersion().toString(),
928
928
  "os.softwareVersion": this.getSdkPkgFile().data?.version ?? "",
929
929
  "os.isPublic": options.isPublic ?? true ? "true" : "false",
930
- "hw.cpu.arch": listFileItem.getContent().abi,
931
- "hw.cpu.ncore": listFileItem.getContent().cpuNumber,
932
- "hw.lcd.density": emulatorDeviceItem.getContent().density.toFixed(),
933
- "hw.lcd.single.diagonalSize": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().singleDiagonalSize.toString() : void 0,
934
- "hw.lcd.single.height": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().singleResolutionHeight.toString() : void 0,
935
- "hw.lcd.single.width": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().singleResolutionWidth.toString() : void 0,
936
- "hw.lcd.double.diagonalSize": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().doubleDiagonalSize.toString() : void 0,
937
- "hw.lcd.double.height": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().doubleResolutionHeight.toString() : void 0,
938
- "hw.lcd.double.width": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().doubleResolutionWidth.toString() : void 0,
939
- "hw.lcd.phy.height": emulatorDeviceItem.getContent().physicalHeight.toString(),
940
- "hw.lcd.phy.width": emulatorDeviceItem.getContent().physicalWidth.toString(),
930
+ "hw.cpu.arch": listFileItem.getContent()?.abi,
931
+ "hw.cpu.ncore": listFileItem.getContent()?.cpuNumber,
932
+ "hw.lcd.density": emulatorDeviceItem.getContent()?.density?.toFixed(),
933
+ "hw.lcd.single.diagonalSize": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.singleDiagonalSize?.toString() : void 0,
934
+ "hw.lcd.single.height": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.singleResolutionHeight?.toString() : void 0,
935
+ "hw.lcd.single.width": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.singleResolutionWidth?.toString() : void 0,
936
+ "hw.lcd.double.diagonalSize": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.doubleDiagonalSize?.toString() : void 0,
937
+ "hw.lcd.double.height": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.doubleResolutionHeight?.toString() : void 0,
938
+ "hw.lcd.double.width": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.doubleResolutionWidth?.toString() : void 0,
939
+ "hw.lcd.phy.height": emulatorDeviceItem.getContent()?.physicalHeight?.toString(),
940
+ "hw.lcd.phy.width": emulatorDeviceItem.getContent()?.physicalWidth?.toString(),
941
941
  "hw.lcd.number": EmulatorTripleFoldItem.is(emulatorDeviceItem) || EmulatorFoldItem.is(emulatorDeviceItem) ? "2" : "1",
942
- "hw.ramSize": listFileItem.getContent().memoryRamSize,
943
- "hw.dataPartitionSize": listFileItem.getContent().dataDiskSize,
942
+ "hw.ramSize": listFileItem.getContent()?.memoryRamSize,
943
+ "hw.dataPartitionSize": listFileItem.getContent()?.dataDiskSize,
944
944
  "isCustomize": "true",
945
945
  "hw.hdc.port": "notset"
946
946
  });
947
947
  device.setConfigIniFile(deviceIniFile);
948
948
  const namedIniFile = new NamedIniFileImpl(device, NamedIniFileImpl.getFileUri(device), {
949
949
  "hvd.ini.encoding": "UTF-8",
950
- "path": listFileItem.getContent().path
950
+ "path": listFileItem.getContent()?.path
951
951
  });
952
952
  device.setNamedIniFile(namedIniFile);
953
953
  await namedIniFile.write();
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { fromByteArray } from "base64-js";
3
3
  import { RelativePattern, WriteableFlags, createNodeFileSystem } from "vscode-fs";
4
4
 
5
5
  //#region package.json
6
- var version = "0.5.8";
6
+ var version = "0.5.10";
7
7
 
8
8
  //#endregion
9
9
  //#region src/common/serializable-content.ts
@@ -349,7 +349,7 @@ var ListsFileImpl = class extends SerializableFileImpl {
349
349
  this.content = listsFileItems.filter((item, index, self) => index === self.findIndex((t) => t.uuid === item.uuid)).filter((item, index, self) => index === self.findIndex((t) => t.name === item.name));
350
350
  }
351
351
  addListsFileItem(listsFileItem) {
352
- this.content.push(listsFileItem);
352
+ this.content.push(Object.fromEntries(Object.entries(listsFileItem).filter(([_, value]) => value !== void 0 && value !== null)));
353
353
  this.removeDuplicateListFileItems(this.content);
354
354
  this._isChanged = true;
355
355
  return new ListsFileItemImpl(this, listsFileItem);
@@ -851,10 +851,10 @@ var LocalImageImpl = class extends BaseImageImpl {
851
851
  uuid,
852
852
  "name": options.name,
853
853
  "apiVersion": this.getApiVersion().toString(),
854
- "cpuNumber": options.cpuNumber.toString(),
854
+ "cpuNumber": options.cpuNumber?.toString(),
855
855
  "path": deviceFolderPath.fsPath,
856
- "memoryRamSize": options.memoryRamSize.toString(),
857
- "dataDiskSize": options.dataDiskSize.toString(),
856
+ "memoryRamSize": options.memoryRamSize?.toString(),
857
+ "dataDiskSize": options.dataDiskSize?.toString(),
858
858
  "version": this.getSdkPkgFile().data?.version ?? "",
859
859
  "imageDir": this.getRelativePath(),
860
860
  "showVersion": this.getSdkPkgFile().data?.guestVersion ?? "",
@@ -862,19 +862,19 @@ var LocalImageImpl = class extends BaseImageImpl {
862
862
  "harmonyos.config.path": configPath.fsPath,
863
863
  "harmonyos.log.path": logPath.fsPath,
864
864
  "hw.apiName": this.getSdkPkgFile().data?.platformVersion ?? "",
865
- "abi": this.infoFile.abi,
865
+ "abi": this.infoFile?.abi,
866
866
  "harmonyOSVersion": `${this.getSdkPkgFile().data?.guestVersion?.split(" ")[0]}-${this.getSdkPkgFile().data?.platformVersion}`,
867
867
  "guestVersion": this.getSdkPkgFile().data?.guestVersion ?? "",
868
- "diagonalSize": emulatorDeviceItem.getContent().diagonalSize.toString(),
869
- "density": emulatorDeviceItem.getContent().density.toString(),
870
- "resolutionWidth": emulatorDeviceItem.getContent().resolutionWidth.toString(),
871
- "resolutionHeight": emulatorDeviceItem.getContent().resolutionHeight.toString(),
872
- "coverResolutionWidth": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().coverResolutionWidth.toString() : void 0,
873
- "coverResolutionHeight": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().coverResolutionHeight.toString() : void 0,
874
- "coverDiagonalSize": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().coverDiagonalSize.toString() : void 0,
875
- "type": emulatorDeviceItem.getContent().deviceType,
868
+ "diagonalSize": emulatorDeviceItem.getContent()?.diagonalSize?.toString(),
869
+ "density": emulatorDeviceItem.getContent()?.density?.toString(),
870
+ "resolutionWidth": emulatorDeviceItem.getContent()?.resolutionWidth?.toString(),
871
+ "resolutionHeight": emulatorDeviceItem.getContent()?.resolutionHeight?.toString(),
872
+ "coverResolutionWidth": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.coverResolutionWidth?.toString() : void 0,
873
+ "coverResolutionHeight": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.coverResolutionHeight?.toString() : void 0,
874
+ "coverDiagonalSize": EmulatorFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.coverDiagonalSize?.toString() : void 0,
875
+ "type": emulatorDeviceItem.getContent()?.deviceType,
876
876
  "devModel": productConfigItem.getDevModel(),
877
- "model": productConfigItem.getContent().name
877
+ "model": productConfigItem.getContent()?.name
878
878
  });
879
879
  const device = new DeviceImpl({
880
880
  imageManager: this.getImageManager(),
@@ -883,42 +883,42 @@ var LocalImageImpl = class extends BaseImageImpl {
883
883
  screen
884
884
  });
885
885
  const deviceIniFile = new ConfigIniFileImpl(device, ConfigIniFileImpl.getFileUri(device), {
886
- "name": listFileItem.getContent().name,
887
- "deviceType": listFileItem.getContent().type,
888
- "deviceModel": listFileItem.getContent().devModel,
889
- "productModel": listFileItem.getContent().model,
886
+ "name": listFileItem.getContent()?.name,
887
+ "deviceType": listFileItem.getContent()?.type,
888
+ "deviceModel": listFileItem.getContent()?.devModel,
889
+ "productModel": listFileItem.getContent()?.model,
890
890
  "vendorCountry": options.vendorCountry ?? "CN",
891
- "uuid": listFileItem.getContent().uuid,
891
+ "uuid": listFileItem.getContent()?.uuid,
892
892
  "configPath": listFileItem.getContent()["harmonyos.config.path"],
893
893
  "logPath": listFileItem.getContent()["harmonyos.log.path"],
894
894
  "sdkPath": listFileItem.getContent()["harmonyos.sdk.path"],
895
- "imageSubPath": listFileItem.getContent().imageDir,
896
- "instancePath": listFileItem.getContent().path,
895
+ "imageSubPath": listFileItem.getContent()?.imageDir,
896
+ "instancePath": listFileItem.getContent()?.path,
897
897
  "os.osVersion": `${this.getSdkPkgFile().data?.guestVersion?.split(" ")[0]} ${this.getSdkPkgFile().data?.platformVersion}(${this.getApiVersion()})`,
898
898
  "os.apiVersion": this.getApiVersion().toString(),
899
899
  "os.softwareVersion": this.getSdkPkgFile().data?.version ?? "",
900
900
  "os.isPublic": options.isPublic ?? true ? "true" : "false",
901
- "hw.cpu.arch": listFileItem.getContent().abi,
902
- "hw.cpu.ncore": listFileItem.getContent().cpuNumber,
903
- "hw.lcd.density": emulatorDeviceItem.getContent().density.toFixed(),
904
- "hw.lcd.single.diagonalSize": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().singleDiagonalSize.toString() : void 0,
905
- "hw.lcd.single.height": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().singleResolutionHeight.toString() : void 0,
906
- "hw.lcd.single.width": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().singleResolutionWidth.toString() : void 0,
907
- "hw.lcd.double.diagonalSize": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().doubleDiagonalSize.toString() : void 0,
908
- "hw.lcd.double.height": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().doubleResolutionHeight.toString() : void 0,
909
- "hw.lcd.double.width": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().doubleResolutionWidth.toString() : void 0,
910
- "hw.lcd.phy.height": emulatorDeviceItem.getContent().physicalHeight.toString(),
911
- "hw.lcd.phy.width": emulatorDeviceItem.getContent().physicalWidth.toString(),
901
+ "hw.cpu.arch": listFileItem.getContent()?.abi,
902
+ "hw.cpu.ncore": listFileItem.getContent()?.cpuNumber,
903
+ "hw.lcd.density": emulatorDeviceItem.getContent()?.density?.toFixed(),
904
+ "hw.lcd.single.diagonalSize": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.singleDiagonalSize?.toString() : void 0,
905
+ "hw.lcd.single.height": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.singleResolutionHeight?.toString() : void 0,
906
+ "hw.lcd.single.width": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.singleResolutionWidth?.toString() : void 0,
907
+ "hw.lcd.double.diagonalSize": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.doubleDiagonalSize?.toString() : void 0,
908
+ "hw.lcd.double.height": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.doubleResolutionHeight?.toString() : void 0,
909
+ "hw.lcd.double.width": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.doubleResolutionWidth?.toString() : void 0,
910
+ "hw.lcd.phy.height": emulatorDeviceItem.getContent()?.physicalHeight?.toString(),
911
+ "hw.lcd.phy.width": emulatorDeviceItem.getContent()?.physicalWidth?.toString(),
912
912
  "hw.lcd.number": EmulatorTripleFoldItem.is(emulatorDeviceItem) || EmulatorFoldItem.is(emulatorDeviceItem) ? "2" : "1",
913
- "hw.ramSize": listFileItem.getContent().memoryRamSize,
914
- "hw.dataPartitionSize": listFileItem.getContent().dataDiskSize,
913
+ "hw.ramSize": listFileItem.getContent()?.memoryRamSize,
914
+ "hw.dataPartitionSize": listFileItem.getContent()?.dataDiskSize,
915
915
  "isCustomize": "true",
916
916
  "hw.hdc.port": "notset"
917
917
  });
918
918
  device.setConfigIniFile(deviceIniFile);
919
919
  const namedIniFile = new NamedIniFileImpl(device, NamedIniFileImpl.getFileUri(device), {
920
920
  "hvd.ini.encoding": "UTF-8",
921
- "path": listFileItem.getContent().path
921
+ "path": listFileItem.getContent()?.path
922
922
  });
923
923
  device.setNamedIniFile(namedIniFile);
924
924
  await namedIniFile.write();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arkts/image-manager",
3
3
  "type": "module",
4
- "version": "0.5.8",
4
+ "version": "0.5.10",
5
5
  "description": "OpenHarmony/HarmonyOS qemu image manager.",
6
6
  "author": "Naily Zero <zero@naily.cc> (https://naily.cc)",
7
7
  "license": "MIT",
@@ -68,7 +68,7 @@
68
68
  "progress-stream": "^2.0.0",
69
69
  "semver": "^7.7.4",
70
70
  "unzipper": "^0.12.3",
71
- "vscode-fs": "^0.1.0",
71
+ "vscode-fs": "^0.1.1",
72
72
  "vscode-uri": "^3.1.0"
73
73
  },
74
74
  "devDependencies": {