@arkts/image-manager 0.5.10 → 0.5.11
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/default-product-config.cjs +32 -64
- package/dist/default-product-config.d.cts +0 -33
- package/dist/default-product-config.d.mts +0 -33
- package/dist/default-product-config.mjs +32 -64
- package/dist/index.cjs +78 -21
- package/dist/index.d.cts +18 -21
- package/dist/index.d.mts +18 -21
- package/dist/index.mjs +78 -21
- package/package.json +1 -1
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.
|
|
6
|
+
var version = "0.5.11";
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/common/serializable-content.ts
|
|
@@ -384,6 +384,54 @@ var ListsFileImpl = class extends SerializableFileImpl {
|
|
|
384
384
|
//#region src/configs/product/item.ts
|
|
385
385
|
let ProductConfigItem;
|
|
386
386
|
(function(_ProductConfigItem) {
|
|
387
|
+
function isBaseContent(content) {
|
|
388
|
+
return typeof content === "object" && content !== null && "name" in content && "screenWidth" in content && "screenHeight" in content && "screenDiagonal" in content && "screenDensity" in content && "visible" in content;
|
|
389
|
+
}
|
|
390
|
+
_ProductConfigItem.isBaseContent = isBaseContent;
|
|
391
|
+
function isBaseFoldContent(content) {
|
|
392
|
+
return isBaseContent(content) && "outerScreenWidth" in content && "outerScreenHeight" in content && "outerScreenDiagonal" in content;
|
|
393
|
+
}
|
|
394
|
+
_ProductConfigItem.isBaseFoldContent = isBaseFoldContent;
|
|
395
|
+
function isPhoneContent(content) {
|
|
396
|
+
return isBaseContent(content);
|
|
397
|
+
}
|
|
398
|
+
_ProductConfigItem.isPhoneContent = isPhoneContent;
|
|
399
|
+
function isTabletContent(content) {
|
|
400
|
+
return isBaseContent(content);
|
|
401
|
+
}
|
|
402
|
+
_ProductConfigItem.isTabletContent = isTabletContent;
|
|
403
|
+
function isTwoInOneContent(content) {
|
|
404
|
+
return isBaseContent(content);
|
|
405
|
+
}
|
|
406
|
+
_ProductConfigItem.isTwoInOneContent = isTwoInOneContent;
|
|
407
|
+
function isFoldableContent(content) {
|
|
408
|
+
return isBaseFoldContent(content);
|
|
409
|
+
}
|
|
410
|
+
_ProductConfigItem.isFoldableContent = isFoldableContent;
|
|
411
|
+
function isWideFoldContent(content) {
|
|
412
|
+
return isBaseFoldContent(content);
|
|
413
|
+
}
|
|
414
|
+
_ProductConfigItem.isWideFoldContent = isWideFoldContent;
|
|
415
|
+
function isTripleFoldContent(content) {
|
|
416
|
+
return isBaseFoldContent(content) && "outerDoubleScreenWidth" in content && "outerDoubleScreenHeight" in content && "outerDoubleScreenDiagonal" in content;
|
|
417
|
+
}
|
|
418
|
+
_ProductConfigItem.isTripleFoldContent = isTripleFoldContent;
|
|
419
|
+
function isTwoInOneFoldableContent(content) {
|
|
420
|
+
return isBaseFoldContent(content);
|
|
421
|
+
}
|
|
422
|
+
_ProductConfigItem.isTwoInOneFoldableContent = isTwoInOneFoldableContent;
|
|
423
|
+
function isTVContent(content) {
|
|
424
|
+
return isBaseContent(content);
|
|
425
|
+
}
|
|
426
|
+
_ProductConfigItem.isTVContent = isTVContent;
|
|
427
|
+
function isWearableContent(content) {
|
|
428
|
+
return isBaseContent(content);
|
|
429
|
+
}
|
|
430
|
+
_ProductConfigItem.isWearableContent = isWearableContent;
|
|
431
|
+
function isWearableKidContent(content) {
|
|
432
|
+
return isBaseContent(content);
|
|
433
|
+
}
|
|
434
|
+
_ProductConfigItem.isWearableKidContent = isWearableKidContent;
|
|
387
435
|
function is(value) {
|
|
388
436
|
return value instanceof ProductConfigItemImpl;
|
|
389
437
|
}
|
|
@@ -754,8 +802,8 @@ var ScreenPresetImpl = class {
|
|
|
754
802
|
_customizeScreen;
|
|
755
803
|
getCustomizeScreenConfig() {
|
|
756
804
|
if (this._customizeScreen) return this._customizeScreen;
|
|
757
|
-
if (this.getEmulatorDeviceItem().getContent().deviceType === "foldable" && this.options.productConfigItem.getContent().name === "Customize" && "customizeScreen" in this.options && "customizeFoldableScreen" in this.options) this._customizeScreen = new CustomizeFoldableScreenImpl(this, this.options.customizeScreen, this.options.customizeFoldableScreen);
|
|
758
|
-
else if (this.options.productConfigItem.getContent().name === "Customize" && "customizeScreen" in this.options) this._customizeScreen = new CustomizeScreenImpl(this, this.options.customizeScreen);
|
|
805
|
+
if (this.getEmulatorDeviceItem().getContent().deviceType === "foldable" && this.options.productConfigItem.getContent().name === "Customize" && "customizeScreen" in this.options && this.options.customizeScreen !== void 0 && this.options.customizeScreen !== null && "customizeFoldableScreen" in this.options && this.options.customizeFoldableScreen !== void 0 && this.options.customizeFoldableScreen !== null) this._customizeScreen = new CustomizeFoldableScreenImpl(this, this.options.customizeScreen, this.options.customizeFoldableScreen);
|
|
806
|
+
else if (this.options.productConfigItem.getContent().name === "Customize" && "customizeScreen" in this.options && this.options.customizeScreen !== void 0 && this.options.customizeScreen !== null) this._customizeScreen = new CustomizeScreenImpl(this, this.options.customizeScreen);
|
|
759
807
|
return this._customizeScreen;
|
|
760
808
|
}
|
|
761
809
|
toJSON() {
|
|
@@ -840,7 +888,7 @@ var LocalImageImpl = class extends BaseImageImpl {
|
|
|
840
888
|
return name?.[name.length - 1];
|
|
841
889
|
}
|
|
842
890
|
async createDevice(options) {
|
|
843
|
-
const { deployedPath,
|
|
891
|
+
const { deployedPath, configPath, logPath, sdkPath, defaultSdkPath, adapter: { join } } = this.getImageManager().getOptions();
|
|
844
892
|
const screen = new ScreenPresetImpl(options.screen);
|
|
845
893
|
const emulatorDeviceItem = screen.getEmulatorDeviceItem();
|
|
846
894
|
const productConfigItem = screen.getProductConfigItem();
|
|
@@ -856,9 +904,9 @@ var LocalImageImpl = class extends BaseImageImpl {
|
|
|
856
904
|
"memoryRamSize": options.memoryRamSize?.toString(),
|
|
857
905
|
"dataDiskSize": options.dataDiskSize?.toString(),
|
|
858
906
|
"version": this.getSdkPkgFile().data?.version ?? "",
|
|
859
|
-
"imageDir": this.getRelativePath()
|
|
860
|
-
"showVersion": this.getSdkPkgFile().data?.guestVersion
|
|
861
|
-
"harmonyos.sdk.path":
|
|
907
|
+
"imageDir": this.getRelativePath().endsWith("/") ? this.getRelativePath() : `${this.getRelativePath()}/`,
|
|
908
|
+
"showVersion": `${this.getSdkPkgFile().data?.guestVersion?.split(" ")[0]} ${this.getSdkPkgFile().data?.platformVersion}(${this.getSdkPkgFile().data?.apiVersion})`,
|
|
909
|
+
"harmonyos.sdk.path": defaultSdkPath?.fsPath ?? sdkPath.fsPath,
|
|
862
910
|
"harmonyos.config.path": configPath.fsPath,
|
|
863
911
|
"harmonyos.log.path": logPath.fsPath,
|
|
864
912
|
"hw.apiName": this.getSdkPkgFile().data?.platformVersion ?? "",
|
|
@@ -886,13 +934,13 @@ var LocalImageImpl = class extends BaseImageImpl {
|
|
|
886
934
|
"name": listFileItem.getContent()?.name,
|
|
887
935
|
"deviceType": listFileItem.getContent()?.type,
|
|
888
936
|
"deviceModel": listFileItem.getContent()?.devModel,
|
|
889
|
-
"productModel": listFileItem.getContent()?.model,
|
|
937
|
+
"productModel": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? void 0 : listFileItem.getContent()?.model,
|
|
890
938
|
"vendorCountry": options.vendorCountry ?? "CN",
|
|
891
939
|
"uuid": listFileItem.getContent()?.uuid,
|
|
892
940
|
"configPath": listFileItem.getContent()["harmonyos.config.path"],
|
|
893
941
|
"logPath": listFileItem.getContent()["harmonyos.log.path"],
|
|
894
942
|
"sdkPath": listFileItem.getContent()["harmonyos.sdk.path"],
|
|
895
|
-
"imageSubPath": listFileItem.getContent()?.imageDir
|
|
943
|
+
"imageSubPath": listFileItem.getContent()?.imageDir.endsWith("/") ? listFileItem.getContent()?.imageDir : `${listFileItem.getContent()?.imageDir}/`,
|
|
896
944
|
"instancePath": listFileItem.getContent()?.path,
|
|
897
945
|
"os.osVersion": `${this.getSdkPkgFile().data?.guestVersion?.split(" ")[0]} ${this.getSdkPkgFile().data?.platformVersion}(${this.getApiVersion()})`,
|
|
898
946
|
"os.apiVersion": this.getApiVersion().toString(),
|
|
@@ -907,6 +955,9 @@ var LocalImageImpl = class extends BaseImageImpl {
|
|
|
907
955
|
"hw.lcd.double.diagonalSize": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.doubleDiagonalSize?.toString() : void 0,
|
|
908
956
|
"hw.lcd.double.height": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.doubleResolutionHeight?.toString() : void 0,
|
|
909
957
|
"hw.lcd.double.width": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent()?.doubleResolutionWidth?.toString() : void 0,
|
|
958
|
+
"hw.lcd.triple.diagonalSize": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().diagonalSize.toString() : void 0,
|
|
959
|
+
"hw.lcd.triple.height": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().resolutionHeight.toString() : void 0,
|
|
960
|
+
"hw.lcd.triple.width": EmulatorTripleFoldItem.is(emulatorDeviceItem) ? emulatorDeviceItem.getContent().resolutionWidth.toString() : void 0,
|
|
910
961
|
"hw.lcd.phy.height": emulatorDeviceItem.getContent()?.physicalHeight?.toString(),
|
|
911
962
|
"hw.lcd.phy.width": emulatorDeviceItem.getContent()?.physicalWidth?.toString(),
|
|
912
963
|
"hw.lcd.number": EmulatorTripleFoldItem.is(emulatorDeviceItem) || EmulatorFoldItem.is(emulatorDeviceItem) ? "2" : "1",
|
|
@@ -1268,58 +1319,64 @@ let OptionsResolver;
|
|
|
1268
1319
|
_OptionsResolver.resolveAdapter = resolveAdapter;
|
|
1269
1320
|
async function resolveImageManagerOptions(options) {
|
|
1270
1321
|
const adapter = await resolveAdapter(options.adapter);
|
|
1271
|
-
const { os, join, process, URI } = adapter;
|
|
1322
|
+
const { os, join, process, URI, fs } = adapter;
|
|
1272
1323
|
function resolveDefaultImageBasePath() {
|
|
1273
1324
|
switch (process.platform) {
|
|
1274
1325
|
case "win32": return typeof process.env.APPDATA === "string" && process.env.APPDATA.length > 0 ? join(URI.file(process.env.APPDATA), "Local", "Huawei", "Sdk") : join(URI.file(os.homedir()), "AppData", "Local", "Huawei", "Sdk");
|
|
1275
1326
|
case "darwin": return join(URI.file(os.homedir()), "Library", "Huawei", "Sdk");
|
|
1276
|
-
default: return join(URI.file(os.homedir()), ".
|
|
1327
|
+
default: return join(URI.file(os.homedir()), ".Huawei", "Sdk");
|
|
1277
1328
|
}
|
|
1278
1329
|
}
|
|
1279
1330
|
function resolveDefaultDeployedPath() {
|
|
1280
1331
|
switch (process.platform) {
|
|
1281
1332
|
case "win32": return typeof process.env.APPDATA === "string" && process.env.APPDATA.length > 0 ? join(URI.file(process.env.APPDATA), "Local", "Huawei", "Emulator", "deployed") : join(URI.file(os.homedir()), "AppData", "Local", "Huawei", "Emulator", "deployed");
|
|
1282
|
-
default: return join(URI.file(os.homedir()), ".
|
|
1333
|
+
default: return join(URI.file(os.homedir()), ".Huawei", "Emulator", "deployed");
|
|
1283
1334
|
}
|
|
1284
1335
|
}
|
|
1285
1336
|
function resolveDefaultSdkPath() {
|
|
1286
1337
|
switch (process.platform) {
|
|
1287
1338
|
case "darwin": return URI.file("/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony");
|
|
1288
1339
|
case "win32": return URI.file("C:\\Program Files\\Huawei\\DevEco Studio\\sdk\\default\\openharmony");
|
|
1289
|
-
default: return join(URI.file(os.homedir()), ".
|
|
1340
|
+
default: return join(URI.file(os.homedir()), ".Huawei", "Sdk", "default", "openharmony");
|
|
1290
1341
|
}
|
|
1291
1342
|
}
|
|
1292
1343
|
function resolveDefaultConfigPath() {
|
|
1293
1344
|
switch (process.platform) {
|
|
1294
1345
|
case "darwin": return join(URI.file(os.homedir()), "Library", "Application Support", "Huawei", "DevEcoStudio6.0");
|
|
1295
1346
|
case "win32": return join(URI.file(process.env.APPDATA ?? os.homedir()), "Roaming", "Huawei", "DevEcoStudio6.0");
|
|
1296
|
-
default: return join(URI.file(os.homedir()), ".
|
|
1347
|
+
default: return join(URI.file(os.homedir()), ".Huawei", "DevEcoStudio6.0");
|
|
1297
1348
|
}
|
|
1298
1349
|
}
|
|
1299
1350
|
function resolveDefaultLogPath() {
|
|
1300
1351
|
switch (process.platform) {
|
|
1301
1352
|
case "darwin": return join(URI.file(os.homedir()), "Library", "Logs", "Huawei", "DevEcoStudio6.0");
|
|
1302
1353
|
case "win32": return join(URI.file(process.env.APPDATA ?? os.homedir()), "Local", "Huawei", "DevEcoStudio6.0", "log");
|
|
1303
|
-
default: return join(URI.file(os.homedir()), ".
|
|
1354
|
+
default: return join(URI.file(os.homedir()), ".Huawei", "DevEcoStudio6.0", "log");
|
|
1304
1355
|
}
|
|
1305
1356
|
}
|
|
1306
1357
|
function resolveDefaultEmulatorPath() {
|
|
1307
1358
|
switch (process.platform) {
|
|
1308
1359
|
case "darwin": return URI.file("/Applications/DevEco-Studio.app/Contents/tools/emulator");
|
|
1309
1360
|
case "win32": return URI.file("C:\\Program Files\\Huawei\\DevEco Studio\\tools\\emulator");
|
|
1310
|
-
default: return join(URI.file(os.homedir()), ".
|
|
1361
|
+
default: return join(URI.file(os.homedir()), ".Huawei", "Emulator");
|
|
1311
1362
|
}
|
|
1312
1363
|
}
|
|
1313
1364
|
const imageBasePath = typeof options.imageBasePath === "string" ? options.imageBasePath ? URI.file(options.imageBasePath) : resolveDefaultImageBasePath() : options.imageBasePath ? options.imageBasePath : resolveDefaultImageBasePath();
|
|
1314
1365
|
const cachePath = typeof options.cachePath === "string" ? options.cachePath ? URI.file(options.cachePath) : join(imageBasePath, "cache") : options.cachePath ? options.cachePath : join(imageBasePath, "cache");
|
|
1366
|
+
const deployedPath = typeof options.deployedPath === "string" ? options.deployedPath ? URI.file(options.deployedPath) : resolveDefaultDeployedPath() : options.deployedPath ? options.deployedPath : resolveDefaultDeployedPath();
|
|
1367
|
+
const sdkPath = typeof options.sdkPath === "string" ? options.sdkPath ? URI.file(options.sdkPath) : resolveDefaultSdkPath() : options.sdkPath ? options.sdkPath : resolveDefaultSdkPath();
|
|
1368
|
+
const configPath = typeof options.configPath === "string" ? options.configPath ? URI.file(options.configPath) : resolveDefaultConfigPath() : options.configPath ? options.configPath : resolveDefaultConfigPath();
|
|
1369
|
+
const logPath = typeof options.logPath === "string" ? options.logPath ? URI.file(options.logPath) : resolveDefaultLogPath() : options.logPath ? options.logPath : resolveDefaultLogPath();
|
|
1370
|
+
const emulatorPath = typeof options.emulatorPath === "string" ? options.emulatorPath ? URI.file(options.emulatorPath) : resolveDefaultEmulatorPath() : options.emulatorPath ? options.emulatorPath : resolveDefaultEmulatorPath();
|
|
1315
1371
|
return {
|
|
1316
1372
|
imageBasePath,
|
|
1317
|
-
deployedPath
|
|
1373
|
+
deployedPath,
|
|
1318
1374
|
cachePath,
|
|
1319
|
-
sdkPath
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1375
|
+
sdkPath,
|
|
1376
|
+
defaultSdkPath: await fs.isDirectory(resolveDefaultSdkPath()).then((isDirectory) => isDirectory ? resolveDefaultSdkPath() : void 0, () => void 0),
|
|
1377
|
+
configPath,
|
|
1378
|
+
logPath,
|
|
1379
|
+
emulatorPath,
|
|
1323
1380
|
adapter
|
|
1324
1381
|
};
|
|
1325
1382
|
}
|
package/package.json
CHANGED