@mpcore/simulator 0.1.3 → 0.1.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.d.mts CHANGED
@@ -1388,7 +1388,7 @@ declare function createHeadlessWxState(): {
1388
1388
  duration?: undefined;
1389
1389
  thumbTempFilePath?: undefined;
1390
1390
  })[];
1391
- type: string;
1391
+ type: "image" | "video" | "mix";
1392
1392
  };
1393
1393
  chooseVideo(option: {
1394
1394
  compressed?: boolean;
package/dist/index.mjs CHANGED
@@ -1863,10 +1863,12 @@ function inferImageType(filePath, fileContent) {
1863
1863
  }
1864
1864
  function inferImageSize(fileContent) {
1865
1865
  try {
1866
- const payload = JSON.parse(fileContent);
1866
+ const config = JSON.parse(fileContent)?.config;
1867
+ const destHeight = config && "destHeight" in config ? config.destHeight : void 0;
1868
+ const destWidth = config && "destWidth" in config ? config.destWidth : void 0;
1867
1869
  return {
1868
- height: payload?.config?.destHeight ?? payload?.config?.height ?? 0,
1869
- width: payload?.config?.destWidth ?? payload?.config?.width ?? 0
1870
+ height: destHeight ?? config?.height ?? 0,
1871
+ width: destWidth ?? config?.width ?? 0
1870
1872
  };
1871
1873
  } catch {
1872
1874
  return {
@@ -2647,7 +2649,7 @@ function createHeadlessWxState() {
2647
2649
  width
2648
2650
  };
2649
2651
  }),
2650
- type: mediaTypes.length > 1 ? "mix" : mediaTypes[0]
2652
+ type: mediaTypes.length > 1 ? "mix" : mediaTypes[0] ?? "image"
2651
2653
  };
2652
2654
  },
2653
2655
  chooseVideo(option) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mpcore/simulator",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "description": "Headless mini-program runtime and testing kernel for the weapp-vite ecosystem",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",