@seayoo-web/app-info 0.2.0 → 0.2.2
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.js +3652 -1812
- package/package.json +7 -4
- package/types/index.d.ts +1 -1
- package/types/src/file.apk.d.ts +5 -2
- package/types/src/file.app.d.ts +5 -2
- package/types/src/file.ipa.d.ts +5 -2
- package/types/src/utils/base.d.ts +20 -0
- package/types/src/utils/cgbi.d.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seayoo-web/app-info",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "app info parser",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -20,18 +20,21 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/bytebuffer": "^5.0.49",
|
|
23
|
+
"@types/pako": "^2.0.4",
|
|
23
24
|
"@types/plist": "^3.0.5",
|
|
24
25
|
"jszip": "^3.10.1",
|
|
25
26
|
"tsx": "^4.21.0",
|
|
26
27
|
"@seayoo-web/scripts": "^3.1.6",
|
|
27
|
-
"@seayoo-web/
|
|
28
|
-
"@seayoo-web/
|
|
28
|
+
"@seayoo-web/utils": "^4.1.3",
|
|
29
|
+
"@seayoo-web/tsconfig": "^1.0.5"
|
|
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
|
+
"cgbi-to-png": "^1.0.7",
|
|
37
|
+
"pako": "^2.0.4"
|
|
35
38
|
},
|
|
36
39
|
"scripts": {
|
|
37
40
|
"prebuild": "pnpm -F utils build",
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from "./src/file.app";
|
|
2
2
|
export * from "./src/file.apk";
|
|
3
3
|
export * from "./src/file.ipa";
|
|
4
|
-
export type { AppCommonInfo, ParserOptions, FileInput } from "./src/utils/base";
|
|
4
|
+
export type { AppCommonInfo, ParserOptions, FileInput, OutputType } from "./src/utils/base";
|
package/types/src/file.apk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppCommonInfo, FileInput, ParserOptions } from "./utils/base";
|
|
1
|
+
import type { AppCommonInfo, FileInput, OutputByType, OutputType, ParserOptions } from "./utils/base";
|
|
2
2
|
import type { Manifest } from "./utils/manifest";
|
|
3
3
|
export type { Manifest, CollapsedAttributes, Application } from "./utils/manifest";
|
|
4
4
|
/**
|
|
@@ -15,5 +15,8 @@ export declare class AndroidAppParser {
|
|
|
15
15
|
/**
|
|
16
16
|
* 读取指定文件的内容
|
|
17
17
|
*/
|
|
18
|
-
readFile(filePath: string
|
|
18
|
+
readFile<T extends OutputType>(filePath: string, output: T): Promise<{
|
|
19
|
+
name: string;
|
|
20
|
+
content: OutputByType[T];
|
|
21
|
+
} | Error>;
|
|
19
22
|
}
|
package/types/src/file.app.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileInput, AppCommonInfo, ParserOptions } from "./utils/base";
|
|
1
|
+
import type { FileInput, AppCommonInfo, ParserOptions, OutputType, OutputByType } from "./utils/base";
|
|
2
2
|
import type { HosAppPackInfo } from "./utils/pack.info";
|
|
3
3
|
export type { HosAppPackInfo, Summary, PackageInfo, DeviceType } from "./utils/pack.info";
|
|
4
4
|
export interface HosAppInfo extends AppCommonInfo {
|
|
@@ -12,5 +12,8 @@ export declare class HosAppParser {
|
|
|
12
12
|
/**
|
|
13
13
|
* 读取指定文件的内容
|
|
14
14
|
*/
|
|
15
|
-
readFile(filePath: string
|
|
15
|
+
readFile<T extends OutputType>(filePath: string, output: T): Promise<{
|
|
16
|
+
name: string;
|
|
17
|
+
content: OutputByType[T];
|
|
18
|
+
} | Error>;
|
|
16
19
|
}
|
package/types/src/file.ipa.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppCommonInfo, FileInput, ParserOptions } from "./utils/base";
|
|
1
|
+
import type { AppCommonInfo, FileInput, OutputByType, OutputType, ParserOptions } from "./utils/base";
|
|
2
2
|
import type { PlistInfo } from "./utils/plist";
|
|
3
3
|
export type { PlistInfo } from "./utils/plist";
|
|
4
4
|
/**
|
|
@@ -22,5 +22,8 @@ export declare class IosAppParser {
|
|
|
22
22
|
/**
|
|
23
23
|
* 读取指定文件的内容
|
|
24
24
|
*/
|
|
25
|
-
readFile(filePath: string
|
|
25
|
+
readFile<T extends OutputType>(filePath: string, output: T): Promise<{
|
|
26
|
+
name: string;
|
|
27
|
+
content: OutputByType[T];
|
|
28
|
+
} | Error>;
|
|
26
29
|
}
|
|
@@ -6,6 +6,17 @@ export type ParserOptions = {
|
|
|
6
6
|
ignoreIcon?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export type JSZip = PromiseValue<ReturnType<typeof loadAsync>>;
|
|
9
|
+
export interface OutputByType {
|
|
10
|
+
base64: string;
|
|
11
|
+
string: string;
|
|
12
|
+
text: string;
|
|
13
|
+
binarystring: string;
|
|
14
|
+
array: number[];
|
|
15
|
+
uint8array: Uint8Array;
|
|
16
|
+
arraybuffer: ArrayBuffer;
|
|
17
|
+
blob: Blob;
|
|
18
|
+
}
|
|
19
|
+
export type OutputType = keyof OutputByType;
|
|
9
20
|
export interface AppCommonInfo {
|
|
10
21
|
/** 包名 */
|
|
11
22
|
package: string;
|
|
@@ -15,8 +26,17 @@ export interface AppCommonInfo {
|
|
|
15
26
|
versionName: string;
|
|
16
27
|
/** dataURI 格式的图标 */
|
|
17
28
|
icon?: string;
|
|
29
|
+
iconPath?: string;
|
|
18
30
|
}
|
|
19
31
|
export declare function toString(d: unknown): string;
|
|
20
32
|
export declare function toNumber(d: unknown): number;
|
|
21
33
|
export declare function formatError(e: unknown): Error;
|
|
22
34
|
export declare function base64Icon(data: string): string;
|
|
35
|
+
export declare function readFile<T extends keyof OutputByType>(zip: JSZip, filePath: string, output: T): Promise<{
|
|
36
|
+
name: string;
|
|
37
|
+
content: OutputByType[T];
|
|
38
|
+
} | Error>;
|
|
39
|
+
/**
|
|
40
|
+
* 将 ArrayBuffer 转换为 Base64 字符串
|
|
41
|
+
*/
|
|
42
|
+
export declare function bufferToBase64(buffer: Uint8Array): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 同步将 CgBI PNG Uint8Array 转换为标准 PNG Uint8Array。使用 pako 库进行 Zlib (Deflate/Inflate) 操作。
|
|
3
|
+
* 如果输入不是 CgBI PNG,则直接返回原始数据。
|
|
4
|
+
*
|
|
5
|
+
* @param data - CgBI PNG 文件的 Uint8Array 数据。
|
|
6
|
+
* @returns 还原后的标准 PNG 文件的 Uint8Array Promise。
|
|
7
|
+
* @throws {Error} 如果文件头不正确、数据截断或内存不足。
|
|
8
|
+
*/
|
|
9
|
+
export declare function revertCgBIBuffer(data: Uint8Array): Promise<Uint8Array>;
|