@seayoo-web/app-info 0.2.1 → 0.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seayoo-web/app-info",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "app info parser",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -20,23 +20,26 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/bytebuffer": "^5.0.49",
23
- "@types/plist": "^3.0.5",
23
+ "@types/pako": "^2.0.4",
24
24
  "jszip": "^3.10.1",
25
25
  "tsx": "^4.21.0",
26
+ "vitest": "^4.0.16",
26
27
  "@seayoo-web/scripts": "^3.1.6",
27
- "@seayoo-web/utils": "^4.1.3",
28
- "@seayoo-web/tsconfig": "^1.0.5"
28
+ "@seayoo-web/tsconfig": "^1.0.5",
29
+ "@seayoo-web/utils": "^4.1.3"
29
30
  },
30
31
  "peerDependencies": {
31
32
  "jszip": "^3.10.1"
32
33
  },
33
34
  "dependencies": {
34
- "bytebuffer": "^5.0.1"
35
+ "bytebuffer": "^5.0.1",
36
+ "pako": "^2.0.4"
35
37
  },
36
38
  "scripts": {
37
39
  "prebuild": "pnpm -F utils build",
38
40
  "build": "vite build && tsc --emitDeclarationOnly",
39
- "test": "npx tsx ./test/index.ts",
41
+ "test": "vitest",
42
+ "play": "tsx ./playground/index.ts",
40
43
  "type-check": "tsc --noEmit",
41
44
  "prepublish": "pnpm build"
42
45
  }
@@ -1,6 +1,6 @@
1
1
  import type { PromiseValue } from "@seayoo-web/utils";
2
2
  import type { loadAsync } from "jszip";
3
- export type FileInput = Uint8Array | ArrayBuffer | Blob;
3
+ export type FileInput = Uint8Array | ArrayBuffer | Blob | NodeJS.ReadableStream;
4
4
  export type ParserOptions = {
5
5
  /** 是否忽略图标,设置为 true 可以节约解析时间 */
6
6
  ignoreIcon?: boolean;
@@ -36,3 +36,7 @@ export declare function readFile<T extends keyof OutputByType>(zip: JSZip, fileP
36
36
  name: string;
37
37
  content: OutputByType[T];
38
38
  } | Error>;
39
+ /**
40
+ * 将 ArrayBuffer 转换为 Base64 字符串
41
+ */
42
+ export declare function bufferToBase64(buffer: Uint8Array): string;
@@ -1,18 +1,9 @@
1
- /** CgBI PNG 处理工具*/
2
1
  /**
3
- * iOS CgBI PNG 转换为标准 PNG
4
- * CgBI 是 iOS 特有的 PNG 优化格式,在 PNG 签名后插入了 CgBI 坊块
5
- * 标准 PNG 解码器无法正确处理这种格式
2
+ * 同步将 CgBI PNG Uint8Array 转换为标准 PNG Uint8Array。使用 pako 库进行 Zlib (Deflate/Inflate) 操作。
3
+ * 如果输入不是 CgBI PNG,则直接返回原始数据。
6
4
  *
7
- * @param arrayBuffer - PNG 文件的 ArrayBuffer 数据
8
- * @returns 修复后的 ArrayBuffer
5
+ * @param data - CgBI PNG 文件的 Uint8Array 数据。
6
+ * @returns 还原后的标准 PNG 文件的 Uint8Array Promise。
7
+ * @throws {Error} 如果文件头不正确、数据截断或内存不足。
9
8
  */
10
- export declare function fixCgbiPng(arrayBuffer: ArrayBuffer): ArrayBuffer;
11
- /**
12
- * 检查 ArrayBuffer 是否为 CgBI PNG
13
- */
14
- export declare function isCgbiPng(arrayBuffer: ArrayBuffer): boolean;
15
- /**
16
- * 将 ArrayBuffer 转换为 Base64 字符串
17
- */
18
- export declare function arrayBufferToBase64(buffer: ArrayBuffer): string;
9
+ export declare function revertCgBIBuffer(data: Uint8Array): Promise<Uint8Array>;
@@ -22,7 +22,7 @@ interface XmlCData {
22
22
  data: string | null;
23
23
  typedValue: TypedValueResult;
24
24
  }
25
- type XmlNode = XmlElement | XmlCData;
25
+ export type XmlNode = XmlElement | XmlCData;
26
26
  export type CollapsedValue = undefined | string | number | boolean | null | Record<string, any>;
27
27
  export type CollapsedAttributes = Record<string, CollapsedValue>;
28
28
  export interface IntentFilter extends CollapsedAttributes {