rn-update-cli 1.0.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.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +167 -0
  3. package/README.zh-CN.md +167 -0
  4. package/cli.json +525 -0
  5. package/lib/api.d.ts +56 -0
  6. package/lib/api.js +671 -0
  7. package/lib/app.d.ts +107 -0
  8. package/lib/app.js +329 -0
  9. package/lib/auto-update.d.ts +35 -0
  10. package/lib/auto-update.js +507 -0
  11. package/lib/bin.d.ts +2 -0
  12. package/lib/bin.js +133 -0
  13. package/lib/bundle-pack.d.ts +6 -0
  14. package/lib/bundle-pack.js +91 -0
  15. package/lib/bundle-runner.d.ts +168 -0
  16. package/lib/bundle-runner.js +1305 -0
  17. package/lib/bundle.d.ts +45 -0
  18. package/lib/bundle.js +226 -0
  19. package/lib/cache.d.ts +10 -0
  20. package/lib/cache.js +25 -0
  21. package/lib/commands.d.ts +11 -0
  22. package/lib/commands.js +72 -0
  23. package/lib/diff.d.ts +18 -0
  24. package/lib/diff.js +690 -0
  25. package/lib/exports.d.ts +11 -0
  26. package/lib/exports.js +20 -0
  27. package/lib/install.d.ts +9 -0
  28. package/lib/install.js +51 -0
  29. package/lib/locales/en.d.ts +187 -0
  30. package/lib/locales/en.js +194 -0
  31. package/lib/locales/zh.d.ts +187 -0
  32. package/lib/locales/zh.js +194 -0
  33. package/lib/native-package.d.ts +21 -0
  34. package/lib/native-package.js +298 -0
  35. package/lib/package.d.ts +68 -0
  36. package/lib/package.js +487 -0
  37. package/lib/provider.d.ts +24 -0
  38. package/lib/provider.js +244 -0
  39. package/lib/standalone-publish.d.ts +17 -0
  40. package/lib/standalone-publish.js +433 -0
  41. package/lib/symbolicate.d.ts +35 -0
  42. package/lib/symbolicate.js +130 -0
  43. package/lib/types.d.ts +152 -0
  44. package/lib/types.js +2 -0
  45. package/lib/user.d.ts +8 -0
  46. package/lib/user.js +50 -0
  47. package/lib/utils/add-gitignore.d.ts +6 -0
  48. package/lib/utils/add-gitignore.js +44 -0
  49. package/lib/utils/app-info-parser/aab.d.ts +27 -0
  50. package/lib/utils/app-info-parser/aab.js +256 -0
  51. package/lib/utils/app-info-parser/apk.d.ts +19 -0
  52. package/lib/utils/app-info-parser/apk.js +95 -0
  53. package/lib/utils/app-info-parser/app.d.ts +9 -0
  54. package/lib/utils/app-info-parser/app.js +15 -0
  55. package/lib/utils/app-info-parser/index.d.ts +21 -0
  56. package/lib/utils/app-info-parser/index.js +51 -0
  57. package/lib/utils/app-info-parser/ipa.d.ts +19 -0
  58. package/lib/utils/app-info-parser/ipa.js +101 -0
  59. package/lib/utils/app-info-parser/resource-finder.d.ts +49 -0
  60. package/lib/utils/app-info-parser/resource-finder.js +429 -0
  61. package/lib/utils/app-info-parser/utils.d.ts +36 -0
  62. package/lib/utils/app-info-parser/utils.js +140 -0
  63. package/lib/utils/app-info-parser/xml-parser/binary.d.ts +61 -0
  64. package/lib/utils/app-info-parser/xml-parser/binary.js +577 -0
  65. package/lib/utils/app-info-parser/xml-parser/manifest.d.ts +15 -0
  66. package/lib/utils/app-info-parser/xml-parser/manifest.js +207 -0
  67. package/lib/utils/app-info-parser/zip.d.ts +29 -0
  68. package/lib/utils/app-info-parser/zip.js +97 -0
  69. package/lib/utils/check-lockfile.d.ts +6 -0
  70. package/lib/utils/check-lockfile.js +93 -0
  71. package/lib/utils/check-plugin.d.ts +12 -0
  72. package/lib/utils/check-plugin.js +36 -0
  73. package/lib/utils/command-result.d.ts +8 -0
  74. package/lib/utils/command-result.js +27 -0
  75. package/lib/utils/constants.d.ts +10 -0
  76. package/lib/utils/constants.js +39 -0
  77. package/lib/utils/dep-versions.d.ts +20 -0
  78. package/lib/utils/dep-versions.js +129 -0
  79. package/lib/utils/git.d.ts +14 -0
  80. package/lib/utils/git.js +64 -0
  81. package/lib/utils/hbcTransform.d.ts +111 -0
  82. package/lib/utils/hbcTransform.js +561 -0
  83. package/lib/utils/hermes-base.d.ts +227 -0
  84. package/lib/utils/hermes-base.js +1287 -0
  85. package/lib/utils/hermes-literals.d.ts +64 -0
  86. package/lib/utils/hermes-literals.js +260 -0
  87. package/lib/utils/http-helper.d.ts +10 -0
  88. package/lib/utils/http-helper.js +150 -0
  89. package/lib/utils/i18n.d.ts +22 -0
  90. package/lib/utils/i18n.js +46 -0
  91. package/lib/utils/index.d.ts +67 -0
  92. package/lib/utils/index.js +545 -0
  93. package/lib/utils/latest-version/index.d.ts +154 -0
  94. package/lib/utils/latest-version/index.js +331 -0
  95. package/lib/utils/options.d.ts +10 -0
  96. package/lib/utils/options.js +68 -0
  97. package/lib/utils/plugin-config.d.ts +14 -0
  98. package/lib/utils/plugin-config.js +66 -0
  99. package/lib/utils/runtime.d.ts +54 -0
  100. package/lib/utils/runtime.js +263 -0
  101. package/lib/utils/slim-sourcemap.d.ts +28 -0
  102. package/lib/utils/slim-sourcemap.js +106 -0
  103. package/lib/utils/zip-entries.d.ts +10 -0
  104. package/lib/utils/zip-entries.js +211 -0
  105. package/lib/utils/zip-options.d.ts +17 -0
  106. package/lib/utils/zip-options.js +190 -0
  107. package/lib/utils/zip-range.d.ts +148 -0
  108. package/lib/utils/zip-range.js +581 -0
  109. package/lib/utils/zip-raw-writer.d.ts +52 -0
  110. package/lib/utils/zip-raw-writer.js +209 -0
  111. package/lib/version-operations.d.ts +21 -0
  112. package/lib/version-operations.js +320 -0
  113. package/lib/versions.d.ts +66 -0
  114. package/lib/versions.js +402 -0
  115. package/package.json +113 -0
  116. package/proto/Configuration.proto +183 -0
  117. package/proto/Resources.proto +569 -0
@@ -0,0 +1,36 @@
1
+ /**
2
+ * [INPUT]: 依赖 JavaScript 值判定、平台包元数据结构与 Buffer 编码规则
3
+ * [OUTPUT]: 对外提供资源映射、图标路径、Base64 转换、Unicode 解码等解析辅助函数
4
+ * [POS]: 应用包解析子域的无状态工具层,被 AAB/APK/IPA 解析器共享
5
+ */
6
+ declare const isArray: (value: unknown) => value is unknown[];
7
+ declare const isObject: (value: unknown) => value is Record<string, unknown>;
8
+ declare const isPrimitive: (value: unknown) => boolean;
9
+ declare const isBrowser: () => boolean;
10
+ /**
11
+ * map file place with resourceMap
12
+ * @param {Object} apkInfo // json info parsed from .apk file
13
+ * @param {Object} resourceMap // resourceMap
14
+ */
15
+ declare const mapInfoResource: (apkInfo: Record<string, any>, resourceMap: Record<string, any>) => Record<string, any>;
16
+ /**
17
+ * find .apk file's icon path from json info
18
+ * @param info // json info parsed from .apk file
19
+ */
20
+ declare const findApkIconPath: (info: any) => string;
21
+ /**
22
+ * find .ipa file's icon path from json info
23
+ * @param info // json info parsed from .ipa file
24
+ */
25
+ declare const findIpaIconPath: (info: any) => any;
26
+ /**
27
+ * transform buffer to base64
28
+ * @param {Buffer} buffer
29
+ */
30
+ declare const getBase64FromBuffer: (buffer: Buffer | string) => string;
31
+ /**
32
+ * 去除unicode空字符
33
+ * @param {String} str
34
+ */
35
+ declare const decodeNullUnicode: (value: string | RegExp) => string | RegExp;
36
+ export { decodeNullUnicode, findApkIconPath, findIpaIconPath, getBase64FromBuffer, isArray, isBrowser, isObject, isPrimitive, mapInfoResource, };
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ /**
3
+ * [INPUT]: 依赖 JavaScript 值判定、平台包元数据结构与 Buffer 编码规则
4
+ * [OUTPUT]: 对外提供资源映射、图标路径、Base64 转换、Unicode 解码等解析辅助函数
5
+ * [POS]: 应用包解析子域的无状态工具层,被 AAB/APK/IPA 解析器共享
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.mapInfoResource = exports.isPrimitive = exports.isObject = exports.isBrowser = exports.isArray = exports.getBase64FromBuffer = exports.findIpaIconPath = exports.findApkIconPath = exports.decodeNullUnicode = void 0;
9
+ const objectType = (value) => Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
10
+ const isArray = (value) => objectType(value) === 'array';
11
+ exports.isArray = isArray;
12
+ const isObject = (value) => objectType(value) === 'object';
13
+ exports.isObject = isObject;
14
+ const isPrimitive = (value) => value === null ||
15
+ ['boolean', 'number', 'string', 'undefined'].includes(objectType(value));
16
+ exports.isPrimitive = isPrimitive;
17
+ const isBrowser = () => typeof window !== 'undefined' && typeof window.document !== 'undefined';
18
+ exports.isBrowser = isBrowser;
19
+ /**
20
+ * map file place with resourceMap
21
+ * @param {Object} apkInfo // json info parsed from .apk file
22
+ * @param {Object} resourceMap // resourceMap
23
+ */
24
+ const mapInfoResource = (apkInfo, resourceMap) => {
25
+ const iteratorObj = (obj) => {
26
+ for (const i in obj) {
27
+ if (isArray(obj[i])) {
28
+ iteratorArray(obj[i]);
29
+ }
30
+ else if (isObject(obj[i])) {
31
+ iteratorObj(obj[i]);
32
+ }
33
+ else if (isPrimitive(obj[i])) {
34
+ if (isResources(obj[i])) {
35
+ obj[i] = resourceMap[transKeyToMatchResourceMap(obj[i])];
36
+ }
37
+ }
38
+ }
39
+ };
40
+ const iteratorArray = (array) => {
41
+ const l = array.length;
42
+ for (let i = 0; i < l; i++) {
43
+ if (isArray(array[i])) {
44
+ iteratorArray(array[i]);
45
+ }
46
+ else if (isObject(array[i])) {
47
+ iteratorObj(array[i]);
48
+ }
49
+ else if (isPrimitive(array[i])) {
50
+ if (isResources(array[i])) {
51
+ array[i] = resourceMap[transKeyToMatchResourceMap(array[i])];
52
+ }
53
+ }
54
+ }
55
+ };
56
+ const isResources = (attrValue) => {
57
+ if (!attrValue)
58
+ return false;
59
+ const value = typeof attrValue === 'string' ? attrValue : attrValue.toString();
60
+ return value.indexOf('resourceId:') === 0;
61
+ };
62
+ const transKeyToMatchResourceMap = (resourceId) => `@${resourceId.replace('resourceId:0x', '').toUpperCase()}`;
63
+ iteratorObj(apkInfo);
64
+ return apkInfo;
65
+ };
66
+ exports.mapInfoResource = mapInfoResource;
67
+ /**
68
+ * find .apk file's icon path from json info
69
+ * @param info // json info parsed from .apk file
70
+ */
71
+ const findApkIconPath = (info) => {
72
+ if (!info.application.icon?.splice) {
73
+ return '';
74
+ }
75
+ const rulesMap = {
76
+ mdpi: 48,
77
+ hdpi: 72,
78
+ xhdpi: 96,
79
+ xxdpi: 144,
80
+ xxxhdpi: 192,
81
+ };
82
+ const resultMap = {};
83
+ const maxDpiIcon = { dpi: 120, icon: '' };
84
+ for (const i in rulesMap) {
85
+ info.application.icon.some((icon) => {
86
+ if (icon && icon.indexOf(i) !== -1) {
87
+ resultMap[`application-icon-${rulesMap[i]}`] = icon;
88
+ return true;
89
+ }
90
+ return false;
91
+ });
92
+ if (resultMap[`application-icon-${rulesMap[i]}`] &&
93
+ rulesMap[i] >= maxDpiIcon.dpi) {
94
+ maxDpiIcon.dpi = rulesMap[i];
95
+ maxDpiIcon.icon = resultMap[`application-icon-${rulesMap[i]}`];
96
+ }
97
+ }
98
+ if (Object.keys(resultMap).length === 0 || !maxDpiIcon.icon) {
99
+ maxDpiIcon.dpi = 120;
100
+ maxDpiIcon.icon = info.application.icon[0] || '';
101
+ resultMap['applicataion-icon-120'] = maxDpiIcon.icon;
102
+ }
103
+ return maxDpiIcon.icon;
104
+ };
105
+ exports.findApkIconPath = findApkIconPath;
106
+ /**
107
+ * find .ipa file's icon path from json info
108
+ * @param info // json info parsed from .ipa file
109
+ */
110
+ const findIpaIconPath = (info) => {
111
+ if (info.CFBundleIcons?.CFBundlePrimaryIcon?.CFBundleIconFiles?.length) {
112
+ return info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles[info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length - 1];
113
+ }
114
+ if (info.CFBundleIconFiles?.length) {
115
+ return info.CFBundleIconFiles[info.CFBundleIconFiles.length - 1];
116
+ }
117
+ return '.app/Icon.png';
118
+ };
119
+ exports.findIpaIconPath = findIpaIconPath;
120
+ /**
121
+ * transform buffer to base64
122
+ * @param {Buffer} buffer
123
+ */
124
+ const getBase64FromBuffer = (buffer) => {
125
+ const base64 = typeof buffer === 'string' ? buffer : buffer.toString('base64');
126
+ return `data:image/png;base64,${base64}`;
127
+ };
128
+ exports.getBase64FromBuffer = getBase64FromBuffer;
129
+ /**
130
+ * 去除unicode空字符
131
+ * @param {String} str
132
+ */
133
+ const decodeNullUnicode = (value) => {
134
+ if (typeof value === 'string') {
135
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: strips null unicode padding from decoded strings
136
+ return value.replace(/\u0000/g, '');
137
+ }
138
+ return value;
139
+ };
140
+ exports.decodeNullUnicode = decodeNullUnicode;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * [INPUT]: 依赖 Android binary XML chunk、节点/属性编码与 Buffer 读取规则
3
+ * [OUTPUT]: 对外提供 BinaryXmlParser,解析 AndroidManifest 二进制 XML
4
+ * [POS]: Android manifest 解析底座,只产出结构化节点,不决定应用业务字段
5
+ */
6
+ type BinaryXmlParserOptions = {
7
+ debug?: boolean;
8
+ };
9
+ export declare class BinaryXmlParser {
10
+ buffer: Buffer;
11
+ cursor: number;
12
+ strings: string[];
13
+ resources: number[];
14
+ document: any;
15
+ parent: any;
16
+ stack: any[];
17
+ debug: boolean;
18
+ constructor(buffer: Buffer, options?: BinaryXmlParserOptions);
19
+ readU8(): number;
20
+ readU16(): number;
21
+ readS32(): number;
22
+ readU32(): number;
23
+ readLength8(): number;
24
+ readLength16(): number;
25
+ readDimension(): {
26
+ value: number | null;
27
+ unit: string | null;
28
+ rawUnit: number | null;
29
+ };
30
+ readFraction(): {
31
+ value: number | null;
32
+ type: string | null;
33
+ rawType: number | null;
34
+ };
35
+ readHex24(): string;
36
+ readHex32(): string;
37
+ readTypedValue(): {
38
+ value: any;
39
+ type: string | null;
40
+ rawType: number | null;
41
+ };
42
+ convertIntToFloat(int: number): number;
43
+ readString(encoding: string): string;
44
+ readChunkHeader(): {
45
+ startOffset: number;
46
+ chunkType: number;
47
+ headerSize: number;
48
+ chunkSize: number;
49
+ };
50
+ readStringPool(header: any): null;
51
+ readResourceMap(header: any): null;
52
+ readXmlNamespaceStart(): null;
53
+ readXmlNamespaceEnd(): null;
54
+ readXmlElementStart(): any;
55
+ readXmlAttribute(): any;
56
+ readXmlElementEnd(): null;
57
+ readXmlCData(): any;
58
+ readNull(header: any): null;
59
+ parse(): any;
60
+ }
61
+ export {};