@arkts/image-manager 0.5.2 → 0.5.4
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 +26 -14
- package/dist/index.d.cts +15 -13
- package/dist/index.d.mts +15 -13
- package/dist/index.mjs +26 -14
- package/package.json +1 -1
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.
|
|
35
|
+
var version = "0.5.4";
|
|
36
36
|
|
|
37
37
|
//#endregion
|
|
38
38
|
//#region src/common/serializable-content.ts
|
|
@@ -48,10 +48,7 @@ var SerializableContentImpl = class {
|
|
|
48
48
|
return this.content;
|
|
49
49
|
}
|
|
50
50
|
toJSON() {
|
|
51
|
-
return {
|
|
52
|
-
imageManager: this.getImageManager().toJSON(),
|
|
53
|
-
content: this.getContent()
|
|
54
|
-
};
|
|
51
|
+
return { content: this.getContent() };
|
|
55
52
|
}
|
|
56
53
|
};
|
|
57
54
|
|
|
@@ -75,10 +72,7 @@ var SerializableFileImpl = class extends SerializableContentImpl {
|
|
|
75
72
|
await fs.writeFile(uri, encodedContent);
|
|
76
73
|
}
|
|
77
74
|
toJSON() {
|
|
78
|
-
return {
|
|
79
|
-
imageManager: this.getImageManager().toJSON(),
|
|
80
|
-
content: this.getContent()
|
|
81
|
-
};
|
|
75
|
+
return { content: this.getContent() };
|
|
82
76
|
}
|
|
83
77
|
};
|
|
84
78
|
|
|
@@ -282,6 +276,13 @@ var EmulatorFileImpl = class extends SerializableFileImpl {
|
|
|
282
276
|
}
|
|
283
277
|
}).filter(Boolean);
|
|
284
278
|
}
|
|
279
|
+
getDeviceItems(items = []) {
|
|
280
|
+
for (const item of this.getItems()) if (EmulatorBasicItem.is(item)) items.push(item);
|
|
281
|
+
else if (EmulatorFoldItem.is(item)) items.push(item);
|
|
282
|
+
else if (EmulatorTripleFoldItem.is(item)) items.push(item);
|
|
283
|
+
else this.getDeviceItems(item.getChildren());
|
|
284
|
+
return items;
|
|
285
|
+
}
|
|
285
286
|
findDeviceItems(options = {}) {
|
|
286
287
|
const items = [];
|
|
287
288
|
const pushDeviceItem = (item) => {
|
|
@@ -312,6 +313,7 @@ var EmulatorFileImpl = class extends SerializableFileImpl {
|
|
|
312
313
|
toJSON() {
|
|
313
314
|
return {
|
|
314
315
|
...super.toJSON(),
|
|
316
|
+
deviceItems: this.getDeviceItems().map((item) => item.toJSON()),
|
|
315
317
|
items: this.getItems().map((item) => item.toJSON())
|
|
316
318
|
};
|
|
317
319
|
}
|
|
@@ -340,7 +342,6 @@ var ListsFileItemImpl = class extends SerializableContentImpl {
|
|
|
340
342
|
}
|
|
341
343
|
toJSON() {
|
|
342
344
|
return {
|
|
343
|
-
imageManager: this.getImageManager().toJSON(),
|
|
344
345
|
content: this.getContent(),
|
|
345
346
|
listsFile: this.getListsFile().toJSON()
|
|
346
347
|
};
|
|
@@ -390,7 +391,6 @@ var ListsFileImpl = class extends SerializableFileImpl {
|
|
|
390
391
|
}
|
|
391
392
|
toJSON() {
|
|
392
393
|
return {
|
|
393
|
-
imageManager: this.getImageManager().toJSON(),
|
|
394
394
|
content: this.getContent(),
|
|
395
395
|
listsFileItems: this.getListsFileItems().map((item) => item.toJSON())
|
|
396
396
|
};
|
|
@@ -435,7 +435,6 @@ var ProductConfigItemImpl = class extends SerializableContentImpl {
|
|
|
435
435
|
}
|
|
436
436
|
toJSON() {
|
|
437
437
|
return {
|
|
438
|
-
imageManager: this.getImageManager().toJSON(),
|
|
439
438
|
content: this.getContent(),
|
|
440
439
|
devModel: this.getDevModel(),
|
|
441
440
|
deviceType: this.getDeviceType(),
|
|
@@ -666,7 +665,6 @@ var NamedIniFileImpl = class extends SerializableFileImpl {
|
|
|
666
665
|
}
|
|
667
666
|
toJSON() {
|
|
668
667
|
return {
|
|
669
|
-
imageManager: this.getImageManager().toJSON(),
|
|
670
668
|
content: this.getContent(),
|
|
671
669
|
fileUri: this.getFileUri().toJSON()
|
|
672
670
|
};
|
|
@@ -822,7 +820,6 @@ var BaseImageImpl = class {
|
|
|
822
820
|
toJSON() {
|
|
823
821
|
return {
|
|
824
822
|
imageType: this.imageType,
|
|
825
|
-
imageManager: this.getImageManager().toJSON(),
|
|
826
823
|
relativePath: this.getRelativePath(),
|
|
827
824
|
fullPath: this.getFullPath().toJSON(),
|
|
828
825
|
apiVersion: this.getApiVersion(),
|
|
@@ -1391,6 +1388,21 @@ let DeviceTypeConverter;
|
|
|
1391
1388
|
}
|
|
1392
1389
|
}
|
|
1393
1390
|
_DeviceTypeConverter.snakecaseToCamelcase = snakecaseToCamelcase;
|
|
1391
|
+
function camelcaseToSnakecase(camelcaseDeviceType) {
|
|
1392
|
+
switch (camelcaseDeviceType) {
|
|
1393
|
+
case "Phone": return "phone";
|
|
1394
|
+
case "2in1": return "2in1";
|
|
1395
|
+
case "2in1 Foldable": return "2in1_foldable";
|
|
1396
|
+
case "Foldable": return "foldable";
|
|
1397
|
+
case "TV": return "tv";
|
|
1398
|
+
case "Tablet": return "tablet";
|
|
1399
|
+
case "TripleFold": return "triplefold";
|
|
1400
|
+
case "Wearable": return "wearable";
|
|
1401
|
+
case "WideFold": return "widefold";
|
|
1402
|
+
default: return camelcaseDeviceType.toLowerCase().split(" ").join("_");
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
_DeviceTypeConverter.camelcaseToSnakecase = camelcaseToSnakecase;
|
|
1394
1406
|
})(DeviceTypeConverter || (DeviceTypeConverter = {}));
|
|
1395
1407
|
|
|
1396
1408
|
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -33,7 +33,7 @@ interface SerializableContent<T extends SerializableContent.Content = Serializab
|
|
|
33
33
|
}
|
|
34
34
|
declare namespace SerializableContent {
|
|
35
35
|
type Content = Record<PropertyKey, any> | Content[];
|
|
36
|
-
interface Serializable extends BaseSerializable<SerializableContent> {}
|
|
36
|
+
interface Serializable extends Omit<BaseSerializable<SerializableContent>, 'imageManager'> {}
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/configs/product/product.d.ts
|
|
@@ -90,7 +90,7 @@ declare namespace ProductConfigFile {
|
|
|
90
90
|
} ? Content[DeviceType][number] : Content[DeviceType][number];
|
|
91
91
|
/** Names from device types other than DeviceType. Used to detect ambiguous names like "Customize". */
|
|
92
92
|
type OtherDeviceTypeNames<DeviceType extends ProductConfigFile.DeviceType> = Exclude<ProductConfigItem.Name, Content[DeviceType][number]['name']>;
|
|
93
|
-
interface Serializable extends BaseSerializable<ProductConfigFile> {}
|
|
93
|
+
interface Serializable extends Omit<BaseSerializable<ProductConfigFile>, 'imageManager'> {}
|
|
94
94
|
interface Generic {
|
|
95
95
|
readonly deviceType: DeviceType;
|
|
96
96
|
readonly name: ProductConfigItem.NameWithString;
|
|
@@ -295,7 +295,7 @@ declare namespace ProductConfigItem {
|
|
|
295
295
|
readonly name: WearableKidName;
|
|
296
296
|
}
|
|
297
297
|
type Content = PhoneContent | TabletContent | TwoInOneContent | FoldableContent | WideFoldContent | TripleFoldContent | TwoInOneFoldableContent | TVContent | WearableContent | WearableKidContent;
|
|
298
|
-
interface Serializable extends BaseSerializable<ProductConfigItem> {}
|
|
298
|
+
interface Serializable extends Omit<BaseSerializable<ProductConfigItem>, 'imageManager'> {}
|
|
299
299
|
type DevModel = 'MCHEMU-AL00CN' | 'PHEMU-FD00' | 'PHEMU-FD01' | 'PHEMU-FD02' | 'PCEMU-FD05' | 'PHEMU-FD06';
|
|
300
300
|
type DevModelWithString = DevModel | (string & {});
|
|
301
301
|
function is(value: unknown): value is ProductConfigItem;
|
|
@@ -309,7 +309,7 @@ interface ListsFile extends Serializable<ListsFile.Serializable>, Omit<Serializa
|
|
|
309
309
|
}
|
|
310
310
|
declare namespace ListsFile {
|
|
311
311
|
type Content = ListsFileItem.Content[];
|
|
312
|
-
interface Serializable extends BaseSerializable<ListsFile> {}
|
|
312
|
+
interface Serializable extends Omit<BaseSerializable<ListsFile>, 'imageManager'> {}
|
|
313
313
|
function is(value: unknown): value is ListsFile;
|
|
314
314
|
}
|
|
315
315
|
//#endregion
|
|
@@ -318,7 +318,7 @@ interface ListsFileItem<ProductDeviceType extends ProductConfigFile.DeviceType =
|
|
|
318
318
|
getListsFile(): ListsFile;
|
|
319
319
|
}
|
|
320
320
|
declare namespace ListsFileItem {
|
|
321
|
-
interface Serializable extends BaseSerializable<ListsFileItem> {}
|
|
321
|
+
interface Serializable extends Omit<BaseSerializable<ListsFileItem>, 'imageManager'> {}
|
|
322
322
|
type DeviceType = 'phone' | 'tablet' | '2in1' | 'foldable' | 'widefold' | 'triplefold' | '2in1_foldable' | 'tv' | 'wearable';
|
|
323
323
|
type DeviceTypeWithString = DeviceType | (string & {});
|
|
324
324
|
interface Content<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> {
|
|
@@ -618,9 +618,10 @@ interface EmulatorFile extends Serializable<EmulatorFile.Serializable>, Omit<Ser
|
|
|
618
618
|
findItems(options?: EmulatorFile.FindItemOptions): EmulatorFile.Item[];
|
|
619
619
|
findItem(options?: EmulatorFile.FindItemOptions): EmulatorFile.Item | undefined;
|
|
620
620
|
getItems(): EmulatorFile.Item[];
|
|
621
|
+
getDeviceItems(): EmulatorFile.DeviceItem[];
|
|
621
622
|
}
|
|
622
623
|
declare namespace EmulatorFile {
|
|
623
|
-
interface Serializable extends BaseSerializable<EmulatorFile> {}
|
|
624
|
+
interface Serializable extends Omit<BaseSerializable<EmulatorFile>, 'imageManager'> {}
|
|
624
625
|
type ItemContent = EmulatorBasicItem.Content | EmulatorFoldItem.Content | EmulatorTripleFoldItem.Content;
|
|
625
626
|
type Content = Array<ContentItem>;
|
|
626
627
|
type ContentItem = EmulatorGroupItem.Content | ItemContent;
|
|
@@ -926,7 +927,7 @@ interface RemoteImage extends Serializable<RemoteImage.Serializable>, Omit<BaseI
|
|
|
926
927
|
createDownloader(signals?: AbortController): Promise<ImageDownloader>;
|
|
927
928
|
}
|
|
928
929
|
declare namespace RemoteImage {
|
|
929
|
-
interface Serializable extends BaseImage.Serializable, BaseSerializable<RemoteImage> {}
|
|
930
|
+
interface Serializable extends BaseImage.Serializable, Omit<BaseSerializable<RemoteImage>, 'imageManager'> {}
|
|
930
931
|
function is(value: unknown): value is RemoteImage;
|
|
931
932
|
}
|
|
932
933
|
//#endregion
|
|
@@ -969,7 +970,7 @@ interface BaseImage extends Serializable<BaseImage.Serializable> {
|
|
|
969
970
|
getFullDeviceType(): EmulatorFile.FullDeviceTypeWithString;
|
|
970
971
|
}
|
|
971
972
|
declare namespace BaseImage {
|
|
972
|
-
interface Serializable extends BaseSerializable<BaseImage> {
|
|
973
|
+
interface Serializable extends Omit<BaseSerializable<BaseImage>, 'imageManager'> {
|
|
973
974
|
imageType: 'local' | 'remote';
|
|
974
975
|
}
|
|
975
976
|
function is(value: unknown): value is BaseImage;
|
|
@@ -992,7 +993,7 @@ interface LocalImage extends Serializable<LocalImage.Serializable>, Omit<BaseIma
|
|
|
992
993
|
createDevice<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']>(options: LocalImage.CreateDeviceOptions<ProductDeviceType, ProductName>): Promise<Device<ProductDeviceType, ProductName>>;
|
|
993
994
|
}
|
|
994
995
|
declare namespace LocalImage {
|
|
995
|
-
interface Serializable extends BaseImage.Serializable, BaseSerializable<LocalImage> {}
|
|
996
|
+
interface Serializable extends BaseImage.Serializable, Omit<BaseSerializable<LocalImage>, 'imageManager'> {}
|
|
996
997
|
interface SdkPkgFile {
|
|
997
998
|
/**
|
|
998
999
|
* The SDK package file data.
|
|
@@ -1230,7 +1231,7 @@ interface SerializableFile extends Serializable<SerializableFile.Serializable>,
|
|
|
1230
1231
|
}
|
|
1231
1232
|
declare namespace SerializableFile {
|
|
1232
1233
|
type Content = SerializableContent.Content;
|
|
1233
|
-
interface Serializable extends BaseSerializable<SerializableFile> {}
|
|
1234
|
+
interface Serializable extends Omit<BaseSerializable<SerializableFile>, 'imageManager'> {}
|
|
1234
1235
|
}
|
|
1235
1236
|
//#endregion
|
|
1236
1237
|
//#region src/configs/config-ini/config-ini.d.ts
|
|
@@ -1243,7 +1244,7 @@ declare namespace ConfigIniFile {
|
|
|
1243
1244
|
type GenericContent<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> = Content & {
|
|
1244
1245
|
productModel: ProductName;
|
|
1245
1246
|
};
|
|
1246
|
-
interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<ConfigIniFile<ProductDeviceType, ProductName>>, 'device'> {}
|
|
1247
|
+
interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<ConfigIniFile<ProductDeviceType, ProductName>>, 'device' | 'imageManager'> {}
|
|
1247
1248
|
function is(value: unknown): value is ConfigIniFile;
|
|
1248
1249
|
}
|
|
1249
1250
|
//#endregion
|
|
@@ -1254,7 +1255,7 @@ interface NamedIniFile<ProductDeviceType extends ProductConfigFile.DeviceType =
|
|
|
1254
1255
|
}
|
|
1255
1256
|
declare namespace NamedIniFile {
|
|
1256
1257
|
type Content = Record<string, string>;
|
|
1257
|
-
interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<NamedIniFile<ProductDeviceType, ProductName>>, 'device'> {}
|
|
1258
|
+
interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<NamedIniFile<ProductDeviceType, ProductName>>, 'device' | 'imageManager'> {}
|
|
1258
1259
|
function is(value: unknown): value is NamedIniFile;
|
|
1259
1260
|
}
|
|
1260
1261
|
//#endregion
|
|
@@ -1268,7 +1269,8 @@ declare class RemoteImageRequestError<T = unknown> extends Error {
|
|
|
1268
1269
|
//#endregion
|
|
1269
1270
|
//#region src/utils/devicetype-converter.d.ts
|
|
1270
1271
|
declare namespace DeviceTypeConverter {
|
|
1271
|
-
function snakecaseToCamelcase(snakecaseDeviceType: ListsFileItem.
|
|
1272
|
+
function snakecaseToCamelcase(snakecaseDeviceType: ListsFileItem.DeviceTypeWithString): ProductConfigFile.DeviceType;
|
|
1273
|
+
function camelcaseToSnakecase(camelcaseDeviceType: ProductConfigFile.DeviceTypeWithString): ListsFileItem.DeviceType;
|
|
1272
1274
|
}
|
|
1273
1275
|
//#endregion
|
|
1274
1276
|
export { BaseImage, BaseSerializable, ConfigIniFile, CustomizeFoldableScreen, CustomizeScreen, DeepPartial, Device, DeviceTypeConverter, EmulatorBasicItem, EmulatorFile, EmulatorFoldItem, EmulatorGroupItem, EmulatorTripleFoldItem, Image, type ImageManager, ListsFile, ListsFileItem, LocalImage, NamedIniFile, ProductConfigFile, ProductConfigItem, RemoteImage, RemoteImageRequestError, SDKList, ScreenPreset, Serializable, createImageManager, version };
|
package/dist/index.d.mts
CHANGED
|
@@ -33,7 +33,7 @@ interface SerializableContent<T extends SerializableContent.Content = Serializab
|
|
|
33
33
|
}
|
|
34
34
|
declare namespace SerializableContent {
|
|
35
35
|
type Content = Record<PropertyKey, any> | Content[];
|
|
36
|
-
interface Serializable extends BaseSerializable<SerializableContent> {}
|
|
36
|
+
interface Serializable extends Omit<BaseSerializable<SerializableContent>, 'imageManager'> {}
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/configs/product/product.d.ts
|
|
@@ -90,7 +90,7 @@ declare namespace ProductConfigFile {
|
|
|
90
90
|
} ? Content[DeviceType][number] : Content[DeviceType][number];
|
|
91
91
|
/** Names from device types other than DeviceType. Used to detect ambiguous names like "Customize". */
|
|
92
92
|
type OtherDeviceTypeNames<DeviceType extends ProductConfigFile.DeviceType> = Exclude<ProductConfigItem.Name, Content[DeviceType][number]['name']>;
|
|
93
|
-
interface Serializable extends BaseSerializable<ProductConfigFile> {}
|
|
93
|
+
interface Serializable extends Omit<BaseSerializable<ProductConfigFile>, 'imageManager'> {}
|
|
94
94
|
interface Generic {
|
|
95
95
|
readonly deviceType: DeviceType;
|
|
96
96
|
readonly name: ProductConfigItem.NameWithString;
|
|
@@ -295,7 +295,7 @@ declare namespace ProductConfigItem {
|
|
|
295
295
|
readonly name: WearableKidName;
|
|
296
296
|
}
|
|
297
297
|
type Content = PhoneContent | TabletContent | TwoInOneContent | FoldableContent | WideFoldContent | TripleFoldContent | TwoInOneFoldableContent | TVContent | WearableContent | WearableKidContent;
|
|
298
|
-
interface Serializable extends BaseSerializable<ProductConfigItem> {}
|
|
298
|
+
interface Serializable extends Omit<BaseSerializable<ProductConfigItem>, 'imageManager'> {}
|
|
299
299
|
type DevModel = 'MCHEMU-AL00CN' | 'PHEMU-FD00' | 'PHEMU-FD01' | 'PHEMU-FD02' | 'PCEMU-FD05' | 'PHEMU-FD06';
|
|
300
300
|
type DevModelWithString = DevModel | (string & {});
|
|
301
301
|
function is(value: unknown): value is ProductConfigItem;
|
|
@@ -309,7 +309,7 @@ interface ListsFile extends Serializable<ListsFile.Serializable>, Omit<Serializa
|
|
|
309
309
|
}
|
|
310
310
|
declare namespace ListsFile {
|
|
311
311
|
type Content = ListsFileItem.Content[];
|
|
312
|
-
interface Serializable extends BaseSerializable<ListsFile> {}
|
|
312
|
+
interface Serializable extends Omit<BaseSerializable<ListsFile>, 'imageManager'> {}
|
|
313
313
|
function is(value: unknown): value is ListsFile;
|
|
314
314
|
}
|
|
315
315
|
//#endregion
|
|
@@ -318,7 +318,7 @@ interface ListsFileItem<ProductDeviceType extends ProductConfigFile.DeviceType =
|
|
|
318
318
|
getListsFile(): ListsFile;
|
|
319
319
|
}
|
|
320
320
|
declare namespace ListsFileItem {
|
|
321
|
-
interface Serializable extends BaseSerializable<ListsFileItem> {}
|
|
321
|
+
interface Serializable extends Omit<BaseSerializable<ListsFileItem>, 'imageManager'> {}
|
|
322
322
|
type DeviceType = 'phone' | 'tablet' | '2in1' | 'foldable' | 'widefold' | 'triplefold' | '2in1_foldable' | 'tv' | 'wearable';
|
|
323
323
|
type DeviceTypeWithString = DeviceType | (string & {});
|
|
324
324
|
interface Content<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> {
|
|
@@ -618,9 +618,10 @@ interface EmulatorFile extends Serializable<EmulatorFile.Serializable>, Omit<Ser
|
|
|
618
618
|
findItems(options?: EmulatorFile.FindItemOptions): EmulatorFile.Item[];
|
|
619
619
|
findItem(options?: EmulatorFile.FindItemOptions): EmulatorFile.Item | undefined;
|
|
620
620
|
getItems(): EmulatorFile.Item[];
|
|
621
|
+
getDeviceItems(): EmulatorFile.DeviceItem[];
|
|
621
622
|
}
|
|
622
623
|
declare namespace EmulatorFile {
|
|
623
|
-
interface Serializable extends BaseSerializable<EmulatorFile> {}
|
|
624
|
+
interface Serializable extends Omit<BaseSerializable<EmulatorFile>, 'imageManager'> {}
|
|
624
625
|
type ItemContent = EmulatorBasicItem.Content | EmulatorFoldItem.Content | EmulatorTripleFoldItem.Content;
|
|
625
626
|
type Content = Array<ContentItem>;
|
|
626
627
|
type ContentItem = EmulatorGroupItem.Content | ItemContent;
|
|
@@ -926,7 +927,7 @@ interface RemoteImage extends Serializable<RemoteImage.Serializable>, Omit<BaseI
|
|
|
926
927
|
createDownloader(signals?: AbortController): Promise<ImageDownloader>;
|
|
927
928
|
}
|
|
928
929
|
declare namespace RemoteImage {
|
|
929
|
-
interface Serializable extends BaseImage.Serializable, BaseSerializable<RemoteImage> {}
|
|
930
|
+
interface Serializable extends BaseImage.Serializable, Omit<BaseSerializable<RemoteImage>, 'imageManager'> {}
|
|
930
931
|
function is(value: unknown): value is RemoteImage;
|
|
931
932
|
}
|
|
932
933
|
//#endregion
|
|
@@ -969,7 +970,7 @@ interface BaseImage extends Serializable<BaseImage.Serializable> {
|
|
|
969
970
|
getFullDeviceType(): EmulatorFile.FullDeviceTypeWithString;
|
|
970
971
|
}
|
|
971
972
|
declare namespace BaseImage {
|
|
972
|
-
interface Serializable extends BaseSerializable<BaseImage> {
|
|
973
|
+
interface Serializable extends Omit<BaseSerializable<BaseImage>, 'imageManager'> {
|
|
973
974
|
imageType: 'local' | 'remote';
|
|
974
975
|
}
|
|
975
976
|
function is(value: unknown): value is BaseImage;
|
|
@@ -992,7 +993,7 @@ interface LocalImage extends Serializable<LocalImage.Serializable>, Omit<BaseIma
|
|
|
992
993
|
createDevice<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']>(options: LocalImage.CreateDeviceOptions<ProductDeviceType, ProductName>): Promise<Device<ProductDeviceType, ProductName>>;
|
|
993
994
|
}
|
|
994
995
|
declare namespace LocalImage {
|
|
995
|
-
interface Serializable extends BaseImage.Serializable, BaseSerializable<LocalImage> {}
|
|
996
|
+
interface Serializable extends BaseImage.Serializable, Omit<BaseSerializable<LocalImage>, 'imageManager'> {}
|
|
996
997
|
interface SdkPkgFile {
|
|
997
998
|
/**
|
|
998
999
|
* The SDK package file data.
|
|
@@ -1230,7 +1231,7 @@ interface SerializableFile extends Serializable<SerializableFile.Serializable>,
|
|
|
1230
1231
|
}
|
|
1231
1232
|
declare namespace SerializableFile {
|
|
1232
1233
|
type Content = SerializableContent.Content;
|
|
1233
|
-
interface Serializable extends BaseSerializable<SerializableFile> {}
|
|
1234
|
+
interface Serializable extends Omit<BaseSerializable<SerializableFile>, 'imageManager'> {}
|
|
1234
1235
|
}
|
|
1235
1236
|
//#endregion
|
|
1236
1237
|
//#region src/configs/config-ini/config-ini.d.ts
|
|
@@ -1243,7 +1244,7 @@ declare namespace ConfigIniFile {
|
|
|
1243
1244
|
type GenericContent<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> = Content & {
|
|
1244
1245
|
productModel: ProductName;
|
|
1245
1246
|
};
|
|
1246
|
-
interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<ConfigIniFile<ProductDeviceType, ProductName>>, 'device'> {}
|
|
1247
|
+
interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<ConfigIniFile<ProductDeviceType, ProductName>>, 'device' | 'imageManager'> {}
|
|
1247
1248
|
function is(value: unknown): value is ConfigIniFile;
|
|
1248
1249
|
}
|
|
1249
1250
|
//#endregion
|
|
@@ -1254,7 +1255,7 @@ interface NamedIniFile<ProductDeviceType extends ProductConfigFile.DeviceType =
|
|
|
1254
1255
|
}
|
|
1255
1256
|
declare namespace NamedIniFile {
|
|
1256
1257
|
type Content = Record<string, string>;
|
|
1257
|
-
interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<NamedIniFile<ProductDeviceType, ProductName>>, 'device'> {}
|
|
1258
|
+
interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<NamedIniFile<ProductDeviceType, ProductName>>, 'device' | 'imageManager'> {}
|
|
1258
1259
|
function is(value: unknown): value is NamedIniFile;
|
|
1259
1260
|
}
|
|
1260
1261
|
//#endregion
|
|
@@ -1268,7 +1269,8 @@ declare class RemoteImageRequestError<T = unknown> extends Error {
|
|
|
1268
1269
|
//#endregion
|
|
1269
1270
|
//#region src/utils/devicetype-converter.d.ts
|
|
1270
1271
|
declare namespace DeviceTypeConverter {
|
|
1271
|
-
function snakecaseToCamelcase(snakecaseDeviceType: ListsFileItem.
|
|
1272
|
+
function snakecaseToCamelcase(snakecaseDeviceType: ListsFileItem.DeviceTypeWithString): ProductConfigFile.DeviceType;
|
|
1273
|
+
function camelcaseToSnakecase(camelcaseDeviceType: ProductConfigFile.DeviceTypeWithString): ListsFileItem.DeviceType;
|
|
1272
1274
|
}
|
|
1273
1275
|
//#endregion
|
|
1274
1276
|
export { BaseImage, BaseSerializable, ConfigIniFile, CustomizeFoldableScreen, CustomizeScreen, DeepPartial, Device, DeviceTypeConverter, EmulatorBasicItem, EmulatorFile, EmulatorFoldItem, EmulatorGroupItem, EmulatorTripleFoldItem, type Image, type ImageManager, ListsFile, ListsFileItem, LocalImage, type NamedIniFile, ProductConfigFile, ProductConfigItem, RemoteImage, RemoteImageRequestError, SDKList, ScreenPreset, Serializable, createImageManager, version };
|
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.4";
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/common/serializable-content.ts
|
|
@@ -19,10 +19,7 @@ var SerializableContentImpl = class {
|
|
|
19
19
|
return this.content;
|
|
20
20
|
}
|
|
21
21
|
toJSON() {
|
|
22
|
-
return {
|
|
23
|
-
imageManager: this.getImageManager().toJSON(),
|
|
24
|
-
content: this.getContent()
|
|
25
|
-
};
|
|
22
|
+
return { content: this.getContent() };
|
|
26
23
|
}
|
|
27
24
|
};
|
|
28
25
|
|
|
@@ -46,10 +43,7 @@ var SerializableFileImpl = class extends SerializableContentImpl {
|
|
|
46
43
|
await fs.writeFile(uri, encodedContent);
|
|
47
44
|
}
|
|
48
45
|
toJSON() {
|
|
49
|
-
return {
|
|
50
|
-
imageManager: this.getImageManager().toJSON(),
|
|
51
|
-
content: this.getContent()
|
|
52
|
-
};
|
|
46
|
+
return { content: this.getContent() };
|
|
53
47
|
}
|
|
54
48
|
};
|
|
55
49
|
|
|
@@ -253,6 +247,13 @@ var EmulatorFileImpl = class extends SerializableFileImpl {
|
|
|
253
247
|
}
|
|
254
248
|
}).filter(Boolean);
|
|
255
249
|
}
|
|
250
|
+
getDeviceItems(items = []) {
|
|
251
|
+
for (const item of this.getItems()) if (EmulatorBasicItem.is(item)) items.push(item);
|
|
252
|
+
else if (EmulatorFoldItem.is(item)) items.push(item);
|
|
253
|
+
else if (EmulatorTripleFoldItem.is(item)) items.push(item);
|
|
254
|
+
else this.getDeviceItems(item.getChildren());
|
|
255
|
+
return items;
|
|
256
|
+
}
|
|
256
257
|
findDeviceItems(options = {}) {
|
|
257
258
|
const items = [];
|
|
258
259
|
const pushDeviceItem = (item) => {
|
|
@@ -283,6 +284,7 @@ var EmulatorFileImpl = class extends SerializableFileImpl {
|
|
|
283
284
|
toJSON() {
|
|
284
285
|
return {
|
|
285
286
|
...super.toJSON(),
|
|
287
|
+
deviceItems: this.getDeviceItems().map((item) => item.toJSON()),
|
|
286
288
|
items: this.getItems().map((item) => item.toJSON())
|
|
287
289
|
};
|
|
288
290
|
}
|
|
@@ -311,7 +313,6 @@ var ListsFileItemImpl = class extends SerializableContentImpl {
|
|
|
311
313
|
}
|
|
312
314
|
toJSON() {
|
|
313
315
|
return {
|
|
314
|
-
imageManager: this.getImageManager().toJSON(),
|
|
315
316
|
content: this.getContent(),
|
|
316
317
|
listsFile: this.getListsFile().toJSON()
|
|
317
318
|
};
|
|
@@ -361,7 +362,6 @@ var ListsFileImpl = class extends SerializableFileImpl {
|
|
|
361
362
|
}
|
|
362
363
|
toJSON() {
|
|
363
364
|
return {
|
|
364
|
-
imageManager: this.getImageManager().toJSON(),
|
|
365
365
|
content: this.getContent(),
|
|
366
366
|
listsFileItems: this.getListsFileItems().map((item) => item.toJSON())
|
|
367
367
|
};
|
|
@@ -406,7 +406,6 @@ var ProductConfigItemImpl = class extends SerializableContentImpl {
|
|
|
406
406
|
}
|
|
407
407
|
toJSON() {
|
|
408
408
|
return {
|
|
409
|
-
imageManager: this.getImageManager().toJSON(),
|
|
410
409
|
content: this.getContent(),
|
|
411
410
|
devModel: this.getDevModel(),
|
|
412
411
|
deviceType: this.getDeviceType(),
|
|
@@ -637,7 +636,6 @@ var NamedIniFileImpl = class extends SerializableFileImpl {
|
|
|
637
636
|
}
|
|
638
637
|
toJSON() {
|
|
639
638
|
return {
|
|
640
|
-
imageManager: this.getImageManager().toJSON(),
|
|
641
639
|
content: this.getContent(),
|
|
642
640
|
fileUri: this.getFileUri().toJSON()
|
|
643
641
|
};
|
|
@@ -793,7 +791,6 @@ var BaseImageImpl = class {
|
|
|
793
791
|
toJSON() {
|
|
794
792
|
return {
|
|
795
793
|
imageType: this.imageType,
|
|
796
|
-
imageManager: this.getImageManager().toJSON(),
|
|
797
794
|
relativePath: this.getRelativePath(),
|
|
798
795
|
fullPath: this.getFullPath().toJSON(),
|
|
799
796
|
apiVersion: this.getApiVersion(),
|
|
@@ -1362,6 +1359,21 @@ let DeviceTypeConverter;
|
|
|
1362
1359
|
}
|
|
1363
1360
|
}
|
|
1364
1361
|
_DeviceTypeConverter.snakecaseToCamelcase = snakecaseToCamelcase;
|
|
1362
|
+
function camelcaseToSnakecase(camelcaseDeviceType) {
|
|
1363
|
+
switch (camelcaseDeviceType) {
|
|
1364
|
+
case "Phone": return "phone";
|
|
1365
|
+
case "2in1": return "2in1";
|
|
1366
|
+
case "2in1 Foldable": return "2in1_foldable";
|
|
1367
|
+
case "Foldable": return "foldable";
|
|
1368
|
+
case "TV": return "tv";
|
|
1369
|
+
case "Tablet": return "tablet";
|
|
1370
|
+
case "TripleFold": return "triplefold";
|
|
1371
|
+
case "Wearable": return "wearable";
|
|
1372
|
+
case "WideFold": return "widefold";
|
|
1373
|
+
default: return camelcaseDeviceType.toLowerCase().split(" ").join("_");
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
_DeviceTypeConverter.camelcaseToSnakecase = camelcaseToSnakecase;
|
|
1365
1377
|
})(DeviceTypeConverter || (DeviceTypeConverter = {}));
|
|
1366
1378
|
|
|
1367
1379
|
//#endregion
|
package/package.json
CHANGED