@arkts/image-manager 0.5.3 → 0.5.5
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 +27 -14
- package/dist/index.d.cts +377 -375
- package/dist/index.d.mts +377 -375
- package/dist/index.mjs +27 -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.5";
|
|
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,29 @@ 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
|
+
}
|
|
286
|
+
findRemoteImageByDeviceItem(deviceItem, remoteImages) {
|
|
287
|
+
return remoteImages.find((image) => {
|
|
288
|
+
if (image.getApiVersion() !== deviceItem.getContent().api) return false;
|
|
289
|
+
if (image.getFullDeviceType() === deviceItem.getContent().deviceType) return true;
|
|
290
|
+
if (image.getFullDeviceType() === "pc_all") {
|
|
291
|
+
if (deviceItem.getContent().deviceType === "2in1") return true;
|
|
292
|
+
else if (deviceItem.getContent().deviceType === "2in1_foldable") return true;
|
|
293
|
+
} else if (image.getFullDeviceType() === "phone_all") {
|
|
294
|
+
if (deviceItem.getContent().deviceType === "phone") return true;
|
|
295
|
+
else if (deviceItem.getContent().deviceType === "foldable") return true;
|
|
296
|
+
else if (deviceItem.getContent().deviceType === "widefold") return true;
|
|
297
|
+
else if (deviceItem.getContent().deviceType === "triplefold") return true;
|
|
298
|
+
}
|
|
299
|
+
return false;
|
|
300
|
+
});
|
|
301
|
+
}
|
|
285
302
|
findDeviceItems(options = {}) {
|
|
286
303
|
const items = [];
|
|
287
304
|
const pushDeviceItem = (item) => {
|
|
@@ -312,6 +329,7 @@ var EmulatorFileImpl = class extends SerializableFileImpl {
|
|
|
312
329
|
toJSON() {
|
|
313
330
|
return {
|
|
314
331
|
...super.toJSON(),
|
|
332
|
+
deviceItems: this.getDeviceItems().map((item) => item.toJSON()),
|
|
315
333
|
items: this.getItems().map((item) => item.toJSON())
|
|
316
334
|
};
|
|
317
335
|
}
|
|
@@ -340,7 +358,6 @@ var ListsFileItemImpl = class extends SerializableContentImpl {
|
|
|
340
358
|
}
|
|
341
359
|
toJSON() {
|
|
342
360
|
return {
|
|
343
|
-
imageManager: this.getImageManager().toJSON(),
|
|
344
361
|
content: this.getContent(),
|
|
345
362
|
listsFile: this.getListsFile().toJSON()
|
|
346
363
|
};
|
|
@@ -390,7 +407,6 @@ var ListsFileImpl = class extends SerializableFileImpl {
|
|
|
390
407
|
}
|
|
391
408
|
toJSON() {
|
|
392
409
|
return {
|
|
393
|
-
imageManager: this.getImageManager().toJSON(),
|
|
394
410
|
content: this.getContent(),
|
|
395
411
|
listsFileItems: this.getListsFileItems().map((item) => item.toJSON())
|
|
396
412
|
};
|
|
@@ -435,7 +451,6 @@ var ProductConfigItemImpl = class extends SerializableContentImpl {
|
|
|
435
451
|
}
|
|
436
452
|
toJSON() {
|
|
437
453
|
return {
|
|
438
|
-
imageManager: this.getImageManager().toJSON(),
|
|
439
454
|
content: this.getContent(),
|
|
440
455
|
devModel: this.getDevModel(),
|
|
441
456
|
deviceType: this.getDeviceType(),
|
|
@@ -666,7 +681,6 @@ var NamedIniFileImpl = class extends SerializableFileImpl {
|
|
|
666
681
|
}
|
|
667
682
|
toJSON() {
|
|
668
683
|
return {
|
|
669
|
-
imageManager: this.getImageManager().toJSON(),
|
|
670
684
|
content: this.getContent(),
|
|
671
685
|
fileUri: this.getFileUri().toJSON()
|
|
672
686
|
};
|
|
@@ -822,7 +836,6 @@ var BaseImageImpl = class {
|
|
|
822
836
|
toJSON() {
|
|
823
837
|
return {
|
|
824
838
|
imageType: this.imageType,
|
|
825
|
-
imageManager: this.getImageManager().toJSON(),
|
|
826
839
|
relativePath: this.getRelativePath(),
|
|
827
840
|
fullPath: this.getFullPath().toJSON(),
|
|
828
841
|
apiVersion: this.getApiVersion(),
|