@seayoo-web/app-info 0.1.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/README.md +94 -0
- package/dist/index.js +2725 -0
- package/package.json +43 -0
- package/types/index.d.ts +4 -0
- package/types/src/file.apk.d.ts +15 -0
- package/types/src/file.app.d.ts +13 -0
- package/types/src/file.ipa.d.ts +29 -0
- package/types/src/utils/arsc.d.ts +56 -0
- package/types/src/utils/base.d.ts +19 -0
- package/types/src/utils/binary.d.ts +191 -0
- package/types/src/utils/manifest.d.ts +121 -0
- package/types/src/utils/module.json.d.ts +175 -0
- package/types/src/utils/pack.info.d.ts +154 -0
- package/types/src/utils/plist.d.ts +27 -0
- package/types/src/utils.d.ts +2 -0
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seayoo-web/app-info",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "app info parser",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"source": "./src/index.ts",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./types/index.d.ts",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"types",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"author": "web@seayoo.com",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/bytebuffer": "^5.0.49",
|
|
23
|
+
"@types/plist": "^3.0.5",
|
|
24
|
+
"jszip": "^3.10.1",
|
|
25
|
+
"tsx": "^4.21.0",
|
|
26
|
+
"@seayoo-web/scripts": "^3.1.6",
|
|
27
|
+
"@seayoo-web/utils": "^4.1.3",
|
|
28
|
+
"@seayoo-web/tsconfig": "^1.0.5"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"jszip": "^3.10.1"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"bytebuffer": "^5.0.1"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"prebuild": "pnpm -F utils build",
|
|
38
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
39
|
+
"test": "npx tsx ./test/index.ts",
|
|
40
|
+
"type-check": "tsc --noEmit",
|
|
41
|
+
"prepublish": "pnpm build"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AppCommonInfo, FileInput, ParserOptions } from "./utils/base";
|
|
2
|
+
import type { Application, CollapsedAttributes, Manifest } from "./utils/manifest";
|
|
3
|
+
export type { Manifest, CollapsedAttributes, CollapsedValue, Application, Provider, Component, IntentFilter, } from "./utils/manifest";
|
|
4
|
+
/**
|
|
5
|
+
* Android APK 应用信息接口
|
|
6
|
+
*/
|
|
7
|
+
export interface ApkInfo extends AppCommonInfo {
|
|
8
|
+
/** Manifest 信息 */
|
|
9
|
+
manifest: Manifest;
|
|
10
|
+
/** Manifest.Application 信息 */
|
|
11
|
+
application?: Application;
|
|
12
|
+
/** Manifest.Application.metaData 信息 */
|
|
13
|
+
metaData?: CollapsedAttributes[];
|
|
14
|
+
}
|
|
15
|
+
export declare function parseApk(file: FileInput, options?: ParserOptions): Promise<ApkInfo | Error>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FileInput, AppCommonInfo, ParserOptions } from "./utils/base";
|
|
2
|
+
import type { PackageInfo, Summary } from "./utils/pack.info";
|
|
3
|
+
export type { HosAppPackInfo, Summary, PackageInfo, AppInfo, ModuleInfo, DeviceType } from "./utils/pack.info";
|
|
4
|
+
export interface HosAppInfo extends AppCommonInfo {
|
|
5
|
+
/** 摘要信息 */
|
|
6
|
+
summary: Summary;
|
|
7
|
+
/** 包信息列表,描述各个模块的安装和交付配置 */
|
|
8
|
+
packages: PackageInfo[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 分析鸿蒙 app 应用的 pack.info 文件
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseHosApp(file: FileInput, options?: ParserOptions): Promise<HosAppInfo | Error>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AppCommonInfo, FileInput, ParserOptions } from "./utils/base";
|
|
2
|
+
import type { PlistInfo } from "./utils/plist";
|
|
3
|
+
export type { PlistInfo, PlistValue } from "./utils/plist";
|
|
4
|
+
/**
|
|
5
|
+
* iOS IPA 应用信息接口
|
|
6
|
+
*/
|
|
7
|
+
export interface IosAppInfo extends AppCommonInfo {
|
|
8
|
+
/** Info.plist 原始数据 */
|
|
9
|
+
plist?: PlistInfo;
|
|
10
|
+
/** 额外的模块 plist 信息 */
|
|
11
|
+
frameworks?: Record<string, PlistInfo | Error | undefined>;
|
|
12
|
+
/** 额外的文件信息 */
|
|
13
|
+
files?: Record<string, ArrayBuffer | Error | undefined>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 解析 iOS IPA 文件
|
|
17
|
+
* @param file IPA 文件输入
|
|
18
|
+
* @returns Promise<IosAppInfo | Error>
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseIpa(file: FileInput, options?: ParserOptions & {
|
|
21
|
+
/**
|
|
22
|
+
* 查找更多模块的 plist 信息,传入模块名称,比如 "ComboSDKSentry"
|
|
23
|
+
*/
|
|
24
|
+
frameworks?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* 读取更多文件信息,比如 "ComboSDK.json"
|
|
27
|
+
*/
|
|
28
|
+
files?: string[];
|
|
29
|
+
}): Promise<IosAppInfo | Error>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code translated from a C# project https://github.com/hylander0/Iteedee.ApkReader/blob/master/Iteedee.ApkReader/ApkResourceFinder.cs
|
|
3
|
+
*
|
|
4
|
+
* Decode binary file `resources.arsc` from a .apk file to a JavaScript Object.
|
|
5
|
+
*/
|
|
6
|
+
declare class ResourceFinder {
|
|
7
|
+
valueStringPool: string[] | null;
|
|
8
|
+
typeStringPool: string[] | null;
|
|
9
|
+
keyStringPool: string[] | null;
|
|
10
|
+
package_id: number;
|
|
11
|
+
responseMap: Record<string, string[]>;
|
|
12
|
+
entryMap: Record<number, string[]>;
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Same to C# BinaryReader.readBytes
|
|
16
|
+
*
|
|
17
|
+
* @param bb ByteBuffer
|
|
18
|
+
* @param len length
|
|
19
|
+
* @returns {ByteBuffer}
|
|
20
|
+
*/
|
|
21
|
+
static readBytes(bb: ByteBuffer, len: number): ByteBuffer;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param resourceBuffer {Buffer | ArrayBuffer}
|
|
25
|
+
* @return {Record<string, string[]>}
|
|
26
|
+
*/
|
|
27
|
+
processResourceTable(resourceBuffer: Buffer | ArrayBuffer): Record<string, string[]>;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {ByteBuffer} bb
|
|
31
|
+
*/
|
|
32
|
+
processPackage(bb: ByteBuffer): void;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param {ByteBuffer} bb
|
|
36
|
+
*/
|
|
37
|
+
processType(bb: ByteBuffer): void;
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @param {ByteBuffer} bb
|
|
41
|
+
* @return {string[]}
|
|
42
|
+
*/
|
|
43
|
+
processStringPool(bb: ByteBuffer): string[];
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param {ByteBuffer} bb
|
|
47
|
+
*/
|
|
48
|
+
processTypeSpec(bb: ByteBuffer): void;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param {string} resId - 格式如 '@10101010'
|
|
52
|
+
* @param {string | null} value - 资源值,可能是 null
|
|
53
|
+
*/
|
|
54
|
+
putIntoMap(resId: string, value: string | null): void;
|
|
55
|
+
}
|
|
56
|
+
export default ResourceFinder;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type FileInput = Uint8Array | ArrayBuffer | Blob;
|
|
2
|
+
export type ParserOptions = {
|
|
3
|
+
/** 是否忽略图标,设置为 true 可以节约解析时间 */
|
|
4
|
+
ignoreIcon?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export interface AppCommonInfo {
|
|
7
|
+
/** 包名 */
|
|
8
|
+
package: string;
|
|
9
|
+
/** 版本号 */
|
|
10
|
+
versionCode: number;
|
|
11
|
+
/** 版本名 */
|
|
12
|
+
versionName: string;
|
|
13
|
+
/** dataURI 格式的图标 */
|
|
14
|
+
icon?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function toString(d: unknown): string;
|
|
17
|
+
export declare function toNumber(d: unknown): number;
|
|
18
|
+
export declare function formatError(e: unknown): Error;
|
|
19
|
+
export declare function base64Icon(data: string): string;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for the options object passed to the BinaryXmlParser constructor.
|
|
3
|
+
*/
|
|
4
|
+
interface ParserOptions {
|
|
5
|
+
debug?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Defines the structure for an XML Element Node.
|
|
9
|
+
*/
|
|
10
|
+
interface XmlElement {
|
|
11
|
+
namespaceURI: string | null;
|
|
12
|
+
nodeType: typeof NodeType.ELEMENT_NODE;
|
|
13
|
+
nodeName: string | null;
|
|
14
|
+
attributes: XmlAttribute[];
|
|
15
|
+
childNodes: XmlNode[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Defines the structure for an XML Attribute Node.
|
|
19
|
+
*/
|
|
20
|
+
interface XmlAttribute {
|
|
21
|
+
namespaceURI: string | null;
|
|
22
|
+
nodeType: typeof NodeType.ATTRIBUTE_NODE;
|
|
23
|
+
nodeName: string | null;
|
|
24
|
+
name: string | null;
|
|
25
|
+
value: string | null;
|
|
26
|
+
typedValue: TypedValueResult;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Defines the structure for an XML CDATA Node.
|
|
30
|
+
*/
|
|
31
|
+
interface XmlCData {
|
|
32
|
+
namespaceURI: string | null;
|
|
33
|
+
nodeType: typeof NodeType.CDATA_SECTION_NODE;
|
|
34
|
+
nodeName: "#cdata";
|
|
35
|
+
data: string | null;
|
|
36
|
+
typedValue: TypedValueResult;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Union type for all possible XML nodes handled by the parser.
|
|
40
|
+
*/
|
|
41
|
+
type XmlNode = XmlElement | XmlAttribute | XmlCData;
|
|
42
|
+
/**
|
|
43
|
+
* Constants for DOM Node Types (subset used in AXML)
|
|
44
|
+
*/
|
|
45
|
+
export declare const NodeType: {
|
|
46
|
+
readonly ELEMENT_NODE: 1;
|
|
47
|
+
readonly ATTRIBUTE_NODE: 2;
|
|
48
|
+
readonly CDATA_SECTION_NODE: 4;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Constants for AXML Chunk Types
|
|
52
|
+
*/
|
|
53
|
+
export declare const ChunkType: {
|
|
54
|
+
readonly NULL: 0;
|
|
55
|
+
readonly STRING_POOL: 1;
|
|
56
|
+
readonly TABLE: 2;
|
|
57
|
+
readonly XML: 3;
|
|
58
|
+
readonly XML_FIRST_CHUNK: 256;
|
|
59
|
+
readonly XML_START_NAMESPACE: 256;
|
|
60
|
+
readonly XML_END_NAMESPACE: 257;
|
|
61
|
+
readonly XML_START_ELEMENT: 258;
|
|
62
|
+
readonly XML_END_ELEMENT: 259;
|
|
63
|
+
readonly XML_CDATA: 260;
|
|
64
|
+
readonly XML_LAST_CHUNK: 383;
|
|
65
|
+
readonly XML_RESOURCE_MAP: 384;
|
|
66
|
+
readonly TABLE_PACKAGE: 512;
|
|
67
|
+
readonly TABLE_TYPE: 513;
|
|
68
|
+
readonly TABLE_TYPE_SPEC: 514;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Constants for String Pool Flags
|
|
72
|
+
*/
|
|
73
|
+
export declare const StringFlags: {
|
|
74
|
+
readonly SORTED: number;
|
|
75
|
+
readonly UTF8: number;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Constants taken from android.util.TypedValue
|
|
79
|
+
*/
|
|
80
|
+
export declare const TypedValue: {
|
|
81
|
+
readonly COMPLEX_MANTISSA_MASK: 16777215;
|
|
82
|
+
readonly COMPLEX_MANTISSA_SHIFT: 8;
|
|
83
|
+
readonly COMPLEX_RADIX_0p23: 3;
|
|
84
|
+
readonly COMPLEX_RADIX_16p7: 1;
|
|
85
|
+
readonly COMPLEX_RADIX_23p0: 0;
|
|
86
|
+
readonly COMPLEX_RADIX_8p15: 2;
|
|
87
|
+
readonly COMPLEX_RADIX_MASK: 3;
|
|
88
|
+
readonly COMPLEX_RADIX_SHIFT: 4;
|
|
89
|
+
readonly COMPLEX_UNIT_DIP: 1;
|
|
90
|
+
readonly COMPLEX_UNIT_FRACTION: 0;
|
|
91
|
+
readonly COMPLEX_UNIT_FRACTION_PARENT: 1;
|
|
92
|
+
readonly COMPLEX_UNIT_IN: 4;
|
|
93
|
+
readonly COMPLEX_UNIT_MASK: 15;
|
|
94
|
+
readonly COMPLEX_UNIT_MM: 5;
|
|
95
|
+
readonly COMPLEX_UNIT_PT: 3;
|
|
96
|
+
readonly COMPLEX_UNIT_PX: 0;
|
|
97
|
+
readonly COMPLEX_UNIT_SHIFT: 0;
|
|
98
|
+
readonly COMPLEX_UNIT_SP: 2;
|
|
99
|
+
readonly DENSITY_DEFAULT: 0;
|
|
100
|
+
readonly DENSITY_NONE: 65535;
|
|
101
|
+
readonly TYPE_ATTRIBUTE: 2;
|
|
102
|
+
readonly TYPE_DIMENSION: 5;
|
|
103
|
+
readonly TYPE_FIRST_COLOR_INT: 28;
|
|
104
|
+
readonly TYPE_FIRST_INT: 16;
|
|
105
|
+
readonly TYPE_FLOAT: 4;
|
|
106
|
+
readonly TYPE_FRACTION: 6;
|
|
107
|
+
readonly TYPE_INT_BOOLEAN: 18;
|
|
108
|
+
readonly TYPE_INT_COLOR_ARGB4: 30;
|
|
109
|
+
readonly TYPE_INT_COLOR_ARGB8: 28;
|
|
110
|
+
readonly TYPE_INT_COLOR_RGB4: 31;
|
|
111
|
+
readonly TYPE_INT_COLOR_RGB8: 29;
|
|
112
|
+
readonly TYPE_INT_DEC: 16;
|
|
113
|
+
readonly TYPE_INT_HEX: 17;
|
|
114
|
+
readonly TYPE_LAST_COLOR_INT: 31;
|
|
115
|
+
readonly TYPE_LAST_INT: 31;
|
|
116
|
+
readonly TYPE_NULL: 0;
|
|
117
|
+
readonly TYPE_REFERENCE: 1;
|
|
118
|
+
readonly TYPE_STRING: 3;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Interface for the result of readDimension.
|
|
122
|
+
*/
|
|
123
|
+
interface DimensionResult {
|
|
124
|
+
value: number;
|
|
125
|
+
unit: string | null;
|
|
126
|
+
rawUnit: number;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Interface for the result of readFraction.
|
|
130
|
+
*/
|
|
131
|
+
interface FractionResult {
|
|
132
|
+
value: number;
|
|
133
|
+
type: string | null;
|
|
134
|
+
rawType: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Interface for the result of readTypedValue.
|
|
138
|
+
*/
|
|
139
|
+
export interface TypedValueResult {
|
|
140
|
+
value: number | string | boolean | null | DimensionResult | FractionResult;
|
|
141
|
+
type: string | null;
|
|
142
|
+
rawType: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Represents a parser for Android Binary XML files (AXML).
|
|
146
|
+
*/
|
|
147
|
+
export declare class BinaryXmlParser {
|
|
148
|
+
private view;
|
|
149
|
+
private cursor;
|
|
150
|
+
private strings;
|
|
151
|
+
private resources;
|
|
152
|
+
private document;
|
|
153
|
+
private parent;
|
|
154
|
+
private stack;
|
|
155
|
+
private debug;
|
|
156
|
+
/**
|
|
157
|
+
* Initializes the parser.
|
|
158
|
+
* @param buffer The ArrayBuffer containing the binary XML data.
|
|
159
|
+
* @param options Configuration options for the parser.
|
|
160
|
+
*/
|
|
161
|
+
constructor(buffer: ArrayBuffer, options?: ParserOptions);
|
|
162
|
+
private readU8;
|
|
163
|
+
private readU16;
|
|
164
|
+
private readS32;
|
|
165
|
+
private readU32;
|
|
166
|
+
private readLength8;
|
|
167
|
+
private readLength16;
|
|
168
|
+
private readDimension;
|
|
169
|
+
private readFraction;
|
|
170
|
+
private readHex24;
|
|
171
|
+
private readHex32;
|
|
172
|
+
private readTypedValue;
|
|
173
|
+
private convertIntToFloat;
|
|
174
|
+
private readString;
|
|
175
|
+
private readChunkHeader;
|
|
176
|
+
private readStringPool;
|
|
177
|
+
private readResourceMap;
|
|
178
|
+
private readXmlNamespaceStart;
|
|
179
|
+
private readXmlNamespaceEnd;
|
|
180
|
+
private readXmlElementStart;
|
|
181
|
+
private readXmlAttribute;
|
|
182
|
+
private readXmlElementEnd;
|
|
183
|
+
private readXmlCData;
|
|
184
|
+
private readNull;
|
|
185
|
+
/**
|
|
186
|
+
* Parses the binary XML buffer.
|
|
187
|
+
* @returns The root XML element of the parsed document.
|
|
188
|
+
*/
|
|
189
|
+
parse(): XmlElement | null;
|
|
190
|
+
}
|
|
191
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { NodeType } from "./binary";
|
|
2
|
+
import type { TypedValueResult } from "./binary";
|
|
3
|
+
interface XmlAttribute {
|
|
4
|
+
namespaceURI: string | null;
|
|
5
|
+
nodeType: typeof NodeType.ATTRIBUTE_NODE;
|
|
6
|
+
nodeName: string | null;
|
|
7
|
+
name: string | null;
|
|
8
|
+
value: string | null;
|
|
9
|
+
typedValue: TypedValueResult;
|
|
10
|
+
}
|
|
11
|
+
interface XmlElement {
|
|
12
|
+
namespaceURI: string | null;
|
|
13
|
+
nodeType: typeof NodeType.ELEMENT_NODE;
|
|
14
|
+
nodeName: string | null;
|
|
15
|
+
attributes: XmlAttribute[];
|
|
16
|
+
childNodes: XmlNode[];
|
|
17
|
+
}
|
|
18
|
+
interface XmlCData {
|
|
19
|
+
namespaceURI: string | null;
|
|
20
|
+
nodeType: typeof NodeType.CDATA_SECTION_NODE;
|
|
21
|
+
nodeName: "#cdata";
|
|
22
|
+
data: string | null;
|
|
23
|
+
typedValue: TypedValueResult;
|
|
24
|
+
}
|
|
25
|
+
type XmlNode = XmlElement | XmlCData;
|
|
26
|
+
export type CollapsedValue = undefined | string | number | boolean | null | Record<string, any>;
|
|
27
|
+
export type CollapsedAttributes = Record<string, CollapsedValue>;
|
|
28
|
+
export interface IntentFilter extends CollapsedAttributes {
|
|
29
|
+
actions: CollapsedAttributes[];
|
|
30
|
+
categories: CollapsedAttributes[];
|
|
31
|
+
data: CollapsedAttributes[];
|
|
32
|
+
}
|
|
33
|
+
export interface Component extends CollapsedAttributes {
|
|
34
|
+
intentFilters: IntentFilter[];
|
|
35
|
+
metaData: CollapsedAttributes[];
|
|
36
|
+
}
|
|
37
|
+
interface Activity extends Component {
|
|
38
|
+
}
|
|
39
|
+
interface Service extends Component {
|
|
40
|
+
}
|
|
41
|
+
interface Receiver extends Component {
|
|
42
|
+
}
|
|
43
|
+
export interface Provider extends CollapsedAttributes {
|
|
44
|
+
grantUriPermissions: CollapsedAttributes[];
|
|
45
|
+
metaData: CollapsedAttributes[];
|
|
46
|
+
pathPermissions: CollapsedAttributes[];
|
|
47
|
+
}
|
|
48
|
+
export interface Application extends CollapsedAttributes {
|
|
49
|
+
activities: Activity[];
|
|
50
|
+
activityAliases: Activity[];
|
|
51
|
+
launcherActivities: Component[];
|
|
52
|
+
services: Service[];
|
|
53
|
+
receivers: Receiver[];
|
|
54
|
+
providers: Provider[];
|
|
55
|
+
usesLibraries: CollapsedAttributes[];
|
|
56
|
+
metaData: CollapsedAttributes[];
|
|
57
|
+
}
|
|
58
|
+
export interface Manifest extends CollapsedAttributes {
|
|
59
|
+
versionCode: number;
|
|
60
|
+
versionName: string;
|
|
61
|
+
package: string;
|
|
62
|
+
installLocation?: number;
|
|
63
|
+
compileSdkVersion?: number;
|
|
64
|
+
compileSdkVersionCodename?: string;
|
|
65
|
+
platformBuildVersionCode?: number;
|
|
66
|
+
platformBuildVersionName?: number;
|
|
67
|
+
usesPermissions: CollapsedAttributes[];
|
|
68
|
+
usesPermissionsSDK23: CollapsedAttributes[];
|
|
69
|
+
permissions: CollapsedAttributes[];
|
|
70
|
+
permissionTrees: CollapsedAttributes[];
|
|
71
|
+
permissionGroups: CollapsedAttributes[];
|
|
72
|
+
instrumentation: CollapsedAttributes | null;
|
|
73
|
+
usesSdk: CollapsedAttributes | null;
|
|
74
|
+
usesConfiguration: CollapsedAttributes | null;
|
|
75
|
+
usesFeatures: CollapsedAttributes[];
|
|
76
|
+
supportsScreens: CollapsedAttributes | null;
|
|
77
|
+
compatibleScreens: CollapsedAttributes[];
|
|
78
|
+
supportsGlTextures: CollapsedAttributes[];
|
|
79
|
+
application?: Application;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Parses an Android Binary Manifest (AndroidManifest.xml).
|
|
83
|
+
*/
|
|
84
|
+
export declare class ManifestParser {
|
|
85
|
+
private buffer;
|
|
86
|
+
private xmlParser;
|
|
87
|
+
/**
|
|
88
|
+
* @param buffer The ArrayBuffer containing the binary XML data.
|
|
89
|
+
* @param options Configuration options for the underlying BinaryXmlParser.
|
|
90
|
+
*/
|
|
91
|
+
constructor(buffer: ArrayBuffer, options?: Record<string, any>);
|
|
92
|
+
/**
|
|
93
|
+
* Flattens the attributes of an XML element into a simple key/value object.
|
|
94
|
+
* **(保留了 Array.from 的原始逻辑)**
|
|
95
|
+
* @param element The XML element node.
|
|
96
|
+
* @returns An object containing the collapsed attributes.
|
|
97
|
+
*/
|
|
98
|
+
collapseAttributes(element: XmlElement | XmlNode): CollapsedAttributes;
|
|
99
|
+
/**
|
|
100
|
+
* Parses child nodes of a component into intent filters and meta data.
|
|
101
|
+
*/
|
|
102
|
+
private parseIntents;
|
|
103
|
+
/**
|
|
104
|
+
* Parses the <application> element and its children.
|
|
105
|
+
* @param element The <application> XML element.
|
|
106
|
+
* @returns The parsed Application object.
|
|
107
|
+
*/
|
|
108
|
+
private parseApplication;
|
|
109
|
+
/**
|
|
110
|
+
* Checks if an Activity or Activity Alias is configured as a launcher component.
|
|
111
|
+
* @param component The Activity or Activity Alias object.
|
|
112
|
+
* @returns True if it is a launcher component.
|
|
113
|
+
*/
|
|
114
|
+
private isLauncherActivity;
|
|
115
|
+
/**
|
|
116
|
+
* Parses the entire binary manifest buffer.
|
|
117
|
+
* @returns The final parsed manifest object.
|
|
118
|
+
*/
|
|
119
|
+
parse(): Manifest;
|
|
120
|
+
}
|
|
121
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
export interface HapModuleJson {
|
|
2
|
+
/**
|
|
3
|
+
* 应用级别配置信息
|
|
4
|
+
*/
|
|
5
|
+
app: AppConfig;
|
|
6
|
+
/**
|
|
7
|
+
* 模块(Module)级别配置信息
|
|
8
|
+
*/
|
|
9
|
+
module: ModuleConfig;
|
|
10
|
+
}
|
|
11
|
+
export interface AppConfig {
|
|
12
|
+
/** 资源ID:应用的图标ID */
|
|
13
|
+
iconId?: number;
|
|
14
|
+
/** 是否为调试模式 */
|
|
15
|
+
debug: boolean;
|
|
16
|
+
/** 最小兼容的 API 版本号(数字形式) */
|
|
17
|
+
minAPIVersion: number;
|
|
18
|
+
/** 资源引用:应用的图标路径或资源名 */
|
|
19
|
+
icon: string;
|
|
20
|
+
/** 构建模式,例如 "release" */
|
|
21
|
+
buildMode: "release" | "debug" | string;
|
|
22
|
+
/** 资源引用:应用显示的标签名 */
|
|
23
|
+
label: string;
|
|
24
|
+
/** Bundle类型,例如 "app" */
|
|
25
|
+
bundleType: "app" | string;
|
|
26
|
+
/** 版本名称,例如 "1.0.7" */
|
|
27
|
+
versionName: string;
|
|
28
|
+
/** 版本代码,例如 79326 */
|
|
29
|
+
versionCode: number;
|
|
30
|
+
/** 应用环境配置列表(通常为空或包含特定配置) */
|
|
31
|
+
appEnvironments: AppEnvironment[];
|
|
32
|
+
/** 编译 SDK 类型,例如 "HarmonyOS" */
|
|
33
|
+
compileSdkType: "HarmonyOS" | string;
|
|
34
|
+
/** 资源ID:应用标签的ID */
|
|
35
|
+
labelId?: number;
|
|
36
|
+
/** 编译 SDK 版本号,例如 "5.1.1.202" */
|
|
37
|
+
compileSdkVersion: string;
|
|
38
|
+
/** 目标 API 版本号(数字形式) */
|
|
39
|
+
targetAPIVersion: number;
|
|
40
|
+
/** 供应商名称,例如 "seayoo" */
|
|
41
|
+
vendor: string;
|
|
42
|
+
/** 应用的包名 (Bundle Name),例如 "com.seayoo.zero.hmos.huawei" */
|
|
43
|
+
bundleName: string;
|
|
44
|
+
/** 是否启用分布式通知 */
|
|
45
|
+
distributedNotificationEnabled: boolean;
|
|
46
|
+
/** API 发布类型,例如 "Release" */
|
|
47
|
+
apiReleaseType: "Release" | "Beta" | string;
|
|
48
|
+
/** 是否启用 ASAN (AddressSanitizer) */
|
|
49
|
+
asanEnabled: boolean;
|
|
50
|
+
}
|
|
51
|
+
interface AppEnvironment {
|
|
52
|
+
}
|
|
53
|
+
export interface ModuleConfig {
|
|
54
|
+
/** 模块使用的虚拟机类型及版本,例如 "ark12.0.6.0" */
|
|
55
|
+
virtualMachine: string;
|
|
56
|
+
/** 模块的主入口组件名称,例如 "ComboSDKAbility" */
|
|
57
|
+
mainElement: string;
|
|
58
|
+
/** 模块的元数据列表 */
|
|
59
|
+
metadata: MetadataItem[];
|
|
60
|
+
/** 是否支持免安装 */
|
|
61
|
+
installationFree: boolean;
|
|
62
|
+
/** 是否随应用安装包交付 */
|
|
63
|
+
deliveryWithInstall: boolean;
|
|
64
|
+
/** 模块请求的权限列表 */
|
|
65
|
+
requestPermissions: RequestPermission[];
|
|
66
|
+
/** 资源引用:模块的描述 */
|
|
67
|
+
description: string;
|
|
68
|
+
/** 模块支持的查询 Scheme 列表,例如 ["weixin"] */
|
|
69
|
+
querySchemes?: string[];
|
|
70
|
+
/** 编译模式,例如 "esmodule" */
|
|
71
|
+
compileMode: "esmodule" | "jsbundle" | string;
|
|
72
|
+
/** 模块类型,例如 "entry"(入口模块) */
|
|
73
|
+
type: "entry" | "feature" | string;
|
|
74
|
+
/** 依赖的模块列表(通常为空) */
|
|
75
|
+
dependencies: ModuleDependency[];
|
|
76
|
+
/** 模块包含的 Ability 列表 */
|
|
77
|
+
abilities: AbilityConfig[];
|
|
78
|
+
/** 支持的设备类型列表 */
|
|
79
|
+
deviceTypes: DeviceType[];
|
|
80
|
+
/** 资源引用:页面配置文件路径,例如 "$profile:main_pages" */
|
|
81
|
+
pages: string;
|
|
82
|
+
/** 资源ID:模块描述的ID */
|
|
83
|
+
descriptionId?: number;
|
|
84
|
+
/** 模块名称,例如 "entry" */
|
|
85
|
+
name: string;
|
|
86
|
+
/** 模块的包名(与 name 相同或不同) */
|
|
87
|
+
packageName: string;
|
|
88
|
+
}
|
|
89
|
+
export interface MetadataItem {
|
|
90
|
+
/** 元数据项名称,例如 "ArkTSPartialUpdate" */
|
|
91
|
+
name: string;
|
|
92
|
+
/** 元数据项值,例如 "true" */
|
|
93
|
+
value: string;
|
|
94
|
+
}
|
|
95
|
+
export interface RequestPermission {
|
|
96
|
+
/** 资源引用:权限请求的原因 */
|
|
97
|
+
reason?: string;
|
|
98
|
+
/** 资源ID:权限请求原因的ID */
|
|
99
|
+
reasonId?: number;
|
|
100
|
+
/** 权限的使用场景 */
|
|
101
|
+
usedScene?: UsedScene;
|
|
102
|
+
/** 权限名称,例如 "ohos.permission.INTERNET" */
|
|
103
|
+
name: string;
|
|
104
|
+
}
|
|
105
|
+
export interface UsedScene {
|
|
106
|
+
/** 使用该权限的 Ability 列表 */
|
|
107
|
+
abilities: string[];
|
|
108
|
+
/** 权限使用的时机,例如 "always"(始终) */
|
|
109
|
+
when: "always" | "inuse" | string;
|
|
110
|
+
}
|
|
111
|
+
interface ModuleDependency {
|
|
112
|
+
}
|
|
113
|
+
export interface AbilityConfig {
|
|
114
|
+
/** 是否可被其他应用调用 */
|
|
115
|
+
exported: boolean;
|
|
116
|
+
/** 资源ID:Ability 的图标ID */
|
|
117
|
+
iconId?: number;
|
|
118
|
+
/** Ability 的屏幕方向,例如 "portrait"(竖屏) */
|
|
119
|
+
orientation: "portrait" | "landscape" | "unspecified" | string;
|
|
120
|
+
/** 资源ID:启动窗口图标的ID */
|
|
121
|
+
startWindowIconId?: number;
|
|
122
|
+
/** 资源引用:Ability 的图标路径或资源名 */
|
|
123
|
+
icon: string;
|
|
124
|
+
/** 资源引用:启动窗口图标路径或资源名 */
|
|
125
|
+
startWindowIcon: string;
|
|
126
|
+
/** 资源ID:启动窗口背景的ID */
|
|
127
|
+
startWindowBackgroundId?: number;
|
|
128
|
+
/** 资源引用:Ability 的描述 */
|
|
129
|
+
description: string;
|
|
130
|
+
/** 资源引用:Ability 的标签名 */
|
|
131
|
+
label: string;
|
|
132
|
+
/** Ability 支持的意图(Intent)配置列表 */
|
|
133
|
+
skills?: SkillConfig[];
|
|
134
|
+
/** Ability 源码的入口路径,例如 "./ets/ability/ComboSDKAbility.ets" */
|
|
135
|
+
srcEntry: string;
|
|
136
|
+
/** 资源ID:描述的ID */
|
|
137
|
+
descriptionId?: number;
|
|
138
|
+
/** 资源ID:标签的ID */
|
|
139
|
+
labelId?: number;
|
|
140
|
+
/** 资源引用:启动窗口背景的路径或资源名 */
|
|
141
|
+
startWindowBackground: string;
|
|
142
|
+
/** Ability 名称,例如 "ComboSDKAbility" */
|
|
143
|
+
name: string;
|
|
144
|
+
/** 支持的窗口模式列表,例如 ["fullscreen"] */
|
|
145
|
+
supportWindowMode: WindowMode[];
|
|
146
|
+
/** Ability 的启动模式,例如 "singleton" */
|
|
147
|
+
launchType: "singleton" | "standard" | "singleTask" | string;
|
|
148
|
+
}
|
|
149
|
+
export interface SkillConfig {
|
|
150
|
+
/** 意图的实体列表 */
|
|
151
|
+
entities?: string[];
|
|
152
|
+
/** 意图的动作列表 */
|
|
153
|
+
actions?: string[];
|
|
154
|
+
/** 意图的 URI 配置列表 */
|
|
155
|
+
uris?: UriConfig[];
|
|
156
|
+
/** 是否进行域验证(Domain Verify) */
|
|
157
|
+
domainVerify?: boolean;
|
|
158
|
+
}
|
|
159
|
+
export interface UriConfig {
|
|
160
|
+
/** 路径,例如 "app" */
|
|
161
|
+
path?: string;
|
|
162
|
+
/** Scheme,例如 "https" */
|
|
163
|
+
scheme?: string;
|
|
164
|
+
/** Host,例如 "xx.seayoo.com" */
|
|
165
|
+
host?: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* 支持的设备类型
|
|
169
|
+
*/
|
|
170
|
+
export type DeviceType = "phone" | "tablet" | "2in1" | "wearable" | "tv" | "car" | string;
|
|
171
|
+
/**
|
|
172
|
+
* 支持的窗口模式
|
|
173
|
+
*/
|
|
174
|
+
export type WindowMode = "fullscreen" | "float" | string;
|
|
175
|
+
export {};
|