react-native-update-cli 2.8.4 → 2.9.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 (112) hide show
  1. package/lib/api.d.ts +18 -0
  2. package/lib/app.d.ts +38 -0
  3. package/lib/app.js +5 -4
  4. package/lib/bundle-pack.d.ts +1 -0
  5. package/lib/bundle-pack.js +104 -0
  6. package/lib/bundle-runner.d.ts +20 -0
  7. package/lib/bundle-runner.js +404 -0
  8. package/lib/bundle.d.ts +6 -0
  9. package/lib/bundle.js +73 -471
  10. package/lib/diff.d.ts +13 -0
  11. package/lib/diff.js +144 -123
  12. package/lib/exports.d.ts +12 -0
  13. package/lib/index.d.ts +5 -0
  14. package/lib/index.js +5 -13
  15. package/lib/install.d.ts +4 -0
  16. package/lib/locales/en.d.ts +137 -0
  17. package/lib/locales/en.js +11 -0
  18. package/lib/locales/zh.d.ts +136 -0
  19. package/lib/locales/zh.js +11 -0
  20. package/lib/module-manager.d.ts +20 -0
  21. package/lib/module-manager.js +3 -9
  22. package/lib/modules/app-module.d.ts +2 -0
  23. package/lib/modules/app-module.js +84 -44
  24. package/lib/modules/bundle-module.d.ts +2 -0
  25. package/lib/modules/bundle-module.js +7 -8
  26. package/lib/modules/index.d.ts +6 -0
  27. package/lib/modules/package-module.d.ts +2 -0
  28. package/lib/modules/user-module.d.ts +2 -0
  29. package/lib/modules/user-module.js +55 -44
  30. package/lib/modules/version-module.d.ts +2 -0
  31. package/lib/package.d.ts +58 -0
  32. package/lib/package.js +103 -139
  33. package/lib/provider.d.ts +26 -0
  34. package/lib/provider.js +115 -217
  35. package/lib/types.d.ts +120 -0
  36. package/lib/user.d.ts +8 -0
  37. package/lib/utils/add-gitignore.d.ts +1 -0
  38. package/lib/utils/app-info-parser/aab.d.ts +22 -0
  39. package/lib/utils/app-info-parser/aab.js +0 -4
  40. package/lib/utils/app-info-parser/apk.d.ts +14 -0
  41. package/lib/utils/app-info-parser/apk.js +6 -4
  42. package/lib/utils/app-info-parser/app.d.ts +4 -0
  43. package/lib/utils/app-info-parser/app.js +3 -0
  44. package/lib/utils/app-info-parser/index.d.ts +16 -0
  45. package/lib/utils/app-info-parser/index.js +2 -0
  46. package/lib/utils/app-info-parser/ipa.d.ts +14 -0
  47. package/lib/utils/app-info-parser/ipa.js +1 -1
  48. package/lib/utils/app-info-parser/resource-finder.d.ts +49 -0
  49. package/lib/utils/app-info-parser/utils.d.ts +31 -0
  50. package/lib/utils/app-info-parser/utils.js +1 -0
  51. package/lib/utils/app-info-parser/xml-parser/binary.d.ts +56 -0
  52. package/lib/utils/app-info-parser/xml-parser/manifest.d.ts +10 -0
  53. package/lib/utils/app-info-parser/zip.d.ts +18 -0
  54. package/lib/utils/app-info-parser/zip.js +7 -9
  55. package/lib/utils/check-lockfile.d.ts +1 -0
  56. package/lib/utils/check-plugin.d.ts +7 -0
  57. package/lib/utils/command-result.d.ts +3 -0
  58. package/lib/utils/command-result.js +35 -0
  59. package/lib/utils/constants.d.ts +9 -0
  60. package/lib/utils/dep-versions.d.ts +1 -0
  61. package/lib/utils/git.d.ts +8 -0
  62. package/lib/utils/http-helper.d.ts +4 -0
  63. package/lib/utils/i18n.d.ts +12 -0
  64. package/lib/utils/index.d.ts +22 -0
  65. package/lib/utils/index.js +52 -22
  66. package/lib/utils/latest-version/cli.d.ts +1 -0
  67. package/lib/utils/latest-version/cli.js +24 -60
  68. package/lib/utils/latest-version/index.d.ts +146 -0
  69. package/lib/utils/latest-version/index.js +22 -22
  70. package/lib/utils/options.d.ts +4 -0
  71. package/lib/utils/options.js +63 -0
  72. package/lib/utils/plugin-config.d.ts +9 -0
  73. package/lib/utils/zip-entries.d.ts +3 -0
  74. package/lib/versions.d.ts +43 -0
  75. package/lib/versions.js +186 -2
  76. package/lib/workflow-runner.d.ts +2 -0
  77. package/lib/workflow-runner.js +25 -0
  78. package/package.json +20 -5
  79. package/src/api.ts +1 -1
  80. package/src/app.ts +20 -11
  81. package/src/bundle-pack.ts +51 -0
  82. package/src/bundle-runner.ts +463 -0
  83. package/src/bundle.ts +184 -571
  84. package/src/diff.ts +208 -174
  85. package/src/index.ts +15 -17
  86. package/src/locales/en.ts +15 -0
  87. package/src/locales/zh.ts +13 -0
  88. package/src/module-manager.ts +15 -15
  89. package/src/modules/app-module.ts +120 -48
  90. package/src/modules/bundle-module.ts +21 -11
  91. package/src/modules/package-module.ts +0 -1
  92. package/src/modules/user-module.ts +117 -58
  93. package/src/package.ts +158 -138
  94. package/src/provider.ts +164 -240
  95. package/src/types.ts +15 -8
  96. package/src/utils/app-info-parser/aab.ts +0 -7
  97. package/src/utils/app-info-parser/apk.ts +9 -6
  98. package/src/utils/app-info-parser/app.ts +5 -1
  99. package/src/utils/app-info-parser/index.ts +11 -6
  100. package/src/utils/app-info-parser/ipa.ts +1 -1
  101. package/src/utils/app-info-parser/utils.ts +3 -0
  102. package/src/utils/app-info-parser/xml-parser/manifest.ts +3 -1
  103. package/src/utils/app-info-parser/zip.ts +12 -14
  104. package/src/utils/command-result.ts +24 -0
  105. package/src/utils/index.ts +138 -39
  106. package/src/utils/latest-version/cli.ts +22 -20
  107. package/src/utils/latest-version/index.ts +20 -20
  108. package/src/utils/options.ts +56 -0
  109. package/src/utils/zip-entries.ts +1 -1
  110. package/src/versions.ts +265 -2
  111. package/src/workflow-runner.ts +24 -0
  112. package/index.js +0 -1
@@ -0,0 +1,16 @@
1
+ import { AabParser } from './aab';
2
+ import { ApkParser } from './apk';
3
+ import { AppParser } from './app';
4
+ import { IpaParser } from './ipa';
5
+ type AppInfoInnerParser = AabParser | ApkParser | AppParser | IpaParser;
6
+ declare class AppInfoParser {
7
+ file: string | File;
8
+ parser: AppInfoInnerParser;
9
+ /**
10
+ * parser for parsing .ipa or .apk file
11
+ * @param {String | File} file // file's path in Node, instance of File in Browser
12
+ */
13
+ constructor(file: string | File);
14
+ parse<T = unknown>(): Promise<T>;
15
+ }
16
+ export default AppInfoParser;
@@ -48,6 +48,8 @@ class AppInfoParser {
48
48
  case 'aab':
49
49
  this.parser = new _aab.AabParser(this.file);
50
50
  break;
51
+ default:
52
+ throw new Error('Unsupported parser file type.');
51
53
  }
52
54
  }
53
55
  }
@@ -0,0 +1,14 @@
1
+ import { Zip } from './zip';
2
+ export declare class IpaParser extends Zip {
3
+ parse(): Promise<any>;
4
+ /**
5
+ * Parse plist
6
+ * @param {Buffer} buffer // plist file's buffer
7
+ */
8
+ private _parsePlist;
9
+ /**
10
+ * parse provision
11
+ * @param {Buffer} buffer // provision file's buffer
12
+ */
13
+ private _parseProvision;
14
+ }
@@ -55,7 +55,7 @@ class IpaParser extends _zip.Zip {
55
55
  */ _parsePlist(buffer) {
56
56
  let result;
57
57
  const bufferType = buffer[0];
58
- if (bufferType === 60 || bufferType === '<' || bufferType === 239) {
58
+ if (bufferType === 60 || bufferType === 239) {
59
59
  result = parsePlist(buffer.toString());
60
60
  } else if (bufferType === 98) {
61
61
  result = parseBplist(buffer)[0];
@@ -0,0 +1,49 @@
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
+ export declare class ResourceFinder {
7
+ private valueStringPool;
8
+ private typeStringPool;
9
+ private keyStringPool;
10
+ private packageId;
11
+ private responseMap;
12
+ private entryMap;
13
+ /**
14
+ * Same to C# BinaryReader.readBytes
15
+ *
16
+ * @param bb ByteBuffer
17
+ * @param len length
18
+ * @returns {Buffer}
19
+ */
20
+ static readBytes(bb: any, len: number): any;
21
+ /**
22
+ *
23
+ * @param {ByteBuffer} bb
24
+ * @return {Map<String, Set<String>>}
25
+ */
26
+ processResourceTable(resourceBuffer: Buffer): Record<string, any[]>;
27
+ /**
28
+ *
29
+ * @param {ByteBuffer} bb
30
+ */
31
+ private processPackage;
32
+ /**
33
+ *
34
+ * @param {ByteBuffer} bb
35
+ */
36
+ private processType;
37
+ /**
38
+ *
39
+ * @param {ByteBuffer} bb
40
+ * @return {Array}
41
+ */
42
+ private processStringPool;
43
+ /**
44
+ *
45
+ * @param {ByteBuffer} bb
46
+ */
47
+ private processTypeSpec;
48
+ private putIntoMap;
49
+ }
@@ -0,0 +1,31 @@
1
+ declare const isArray: (value: unknown) => value is unknown[];
2
+ declare const isObject: (value: unknown) => value is Record<string, unknown>;
3
+ declare const isPrimitive: (value: unknown) => boolean;
4
+ declare const isBrowser: () => boolean;
5
+ /**
6
+ * map file place with resourceMap
7
+ * @param {Object} apkInfo // json info parsed from .apk file
8
+ * @param {Object} resourceMap // resourceMap
9
+ */
10
+ declare const mapInfoResource: (apkInfo: Record<string, any>, resourceMap: Record<string, any>) => Record<string, any>;
11
+ /**
12
+ * find .apk file's icon path from json info
13
+ * @param info // json info parsed from .apk file
14
+ */
15
+ declare const findApkIconPath: (info: any) => string;
16
+ /**
17
+ * find .ipa file's icon path from json info
18
+ * @param info // json info parsed from .ipa file
19
+ */
20
+ declare const findIpaIconPath: (info: any) => any;
21
+ /**
22
+ * transform buffer to base64
23
+ * @param {Buffer} buffer
24
+ */
25
+ declare const getBase64FromBuffer: (buffer: Buffer | string) => string;
26
+ /**
27
+ * 去除unicode空字符
28
+ * @param {String} str
29
+ */
30
+ declare const decodeNullUnicode: (value: string | RegExp) => string | RegExp;
31
+ export { isArray, isObject, isPrimitive, isBrowser, mapInfoResource, findApkIconPath, findIpaIconPath, getBase64FromBuffer, decodeNullUnicode, };
@@ -46,6 +46,7 @@ const isPrimitive = (value)=>value === null || [
46
46
  'string',
47
47
  'undefined'
48
48
  ].includes(objectType(value));
49
+ const isBrowser = ()=>typeof window !== 'undefined' && typeof window.document !== 'undefined';
49
50
  /**
50
51
  * map file place with resourceMap
51
52
  * @param {Object} apkInfo // json info parsed from .apk file
@@ -0,0 +1,56 @@
1
+ type BinaryXmlParserOptions = {
2
+ debug?: boolean;
3
+ };
4
+ export declare class BinaryXmlParser {
5
+ buffer: Buffer;
6
+ cursor: number;
7
+ strings: string[];
8
+ resources: number[];
9
+ document: any;
10
+ parent: any;
11
+ stack: any[];
12
+ debug: boolean;
13
+ constructor(buffer: Buffer, options?: BinaryXmlParserOptions);
14
+ readU8(): number;
15
+ readU16(): number;
16
+ readS32(): number;
17
+ readU32(): number;
18
+ readLength8(): number;
19
+ readLength16(): number;
20
+ readDimension(): {
21
+ value: number | null;
22
+ unit: string | null;
23
+ rawUnit: number | null;
24
+ };
25
+ readFraction(): {
26
+ value: number | null;
27
+ type: string | null;
28
+ rawType: number | null;
29
+ };
30
+ readHex24(): string;
31
+ readHex32(): string;
32
+ readTypedValue(): {
33
+ value: any;
34
+ type: string | null;
35
+ rawType: number | null;
36
+ };
37
+ convertIntToFloat(int: number): number;
38
+ readString(encoding: string): string;
39
+ readChunkHeader(): {
40
+ startOffset: number;
41
+ chunkType: number;
42
+ headerSize: number;
43
+ chunkSize: number;
44
+ };
45
+ readStringPool(header: any): null;
46
+ readResourceMap(header: any): null;
47
+ readXmlNamespaceStart(): null;
48
+ readXmlNamespaceEnd(): null;
49
+ readXmlElementStart(): any;
50
+ readXmlAttribute(): any;
51
+ readXmlElementEnd(): null;
52
+ readXmlCData(): any;
53
+ readNull(header: any): null;
54
+ parse(): any;
55
+ }
56
+ export {};
@@ -0,0 +1,10 @@
1
+ export declare class ManifestParser {
2
+ private buffer;
3
+ private xmlParser;
4
+ constructor(buffer: Buffer, options?: Record<string, any>);
5
+ private collapseAttributes;
6
+ private parseIntents;
7
+ private parseApplication;
8
+ private isLauncherActivity;
9
+ parse(): Record<string, any>;
10
+ }
@@ -0,0 +1,18 @@
1
+ export declare class Zip {
2
+ file: string | File;
3
+ unzip: any;
4
+ constructor(file: string | File);
5
+ /**
6
+ * get entries by regexps, the return format is: { <filename>: <Buffer|Blob> }
7
+ * @param {Array} regexps // regexps for matching files
8
+ * @param {String} type // return type, can be buffer or blob, default buffer
9
+ */
10
+ getEntries(regexps: Array<RegExp | string>, type?: 'buffer' | 'blob'): Promise<Record<string, Buffer<ArrayBufferLike> | Blob>>;
11
+ /**
12
+ * get entry by regex, return an instance of Buffer or Blob
13
+ * @param {Regex} regex // regex for matching file
14
+ * @param {String} type // return type, can be buffer or blob, default buffer
15
+ */
16
+ getEntry(regex: RegExp | string, type?: 'buffer' | 'blob'): Promise<Buffer<ArrayBufferLike> | Blob | undefined>;
17
+ getEntryFromHarmonyApp(regex: RegExp): Promise<Buffer | Blob | undefined>;
18
+ }
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "Zip", {
8
8
  return Zip;
9
9
  }
10
10
  });
11
- const _utils = require("./utils");
12
11
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ const _utils = require("./utils");
13
13
  const _zipentries = require("../zip-entries");
14
14
  function _interop_require_default(obj) {
15
15
  return obj && obj.__esModule ? obj : {
@@ -51,11 +51,12 @@ class Zip {
51
51
  async getEntryFromHarmonyApp(regex) {
52
52
  try {
53
53
  let originSource;
54
- await (0, _zipentries.enumZipEntries)(this.file, (entry, zipFile)=>{
54
+ if (typeof this.file !== 'string') {
55
+ throw new Error('Param error: [file] must be file path in Node.');
56
+ }
57
+ await (0, _zipentries.enumZipEntries)(this.file, async (entry, zipFile)=>{
55
58
  if (regex.test(entry.fileName)) {
56
- return (0, _zipentries.readEntry)(entry, zipFile).then((value)=>{
57
- originSource = value;
58
- });
59
+ originSource = await (0, _zipentries.readEntry)(entry, zipFile);
59
60
  }
60
61
  });
61
62
  return originSource;
@@ -64,10 +65,7 @@ class Zip {
64
65
  }
65
66
  }
66
67
  constructor(file){
67
- if (typeof file !== 'string') {
68
- throw new Error('Param error: [file] must be file path in Node.');
69
- }
70
- this.file = _path.default.resolve(file);
68
+ this.file = typeof file === 'string' ? _path.default.resolve(file) : file;
71
69
  this.unzip = new Unzip(this.file);
72
70
  }
73
71
  }
@@ -0,0 +1 @@
1
+ export declare function checkLockFiles(): void;
@@ -0,0 +1,7 @@
1
+ interface BundleParams {
2
+ sentry: boolean;
3
+ sourcemap: boolean;
4
+ [key: string]: any;
5
+ }
6
+ export declare function checkPlugins(): Promise<BundleParams>;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { CommandResult } from '../types';
2
+ export declare function toErrorMessage(error: unknown, fallback: string): string;
3
+ export declare function runAsCommandResult<T>(task: () => Promise<T>, fallbackError: string, mapSuccess?: (result: T) => unknown): Promise<CommandResult>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ runAsCommandResult: function() {
13
+ return runAsCommandResult;
14
+ },
15
+ toErrorMessage: function() {
16
+ return toErrorMessage;
17
+ }
18
+ });
19
+ function toErrorMessage(error, fallback) {
20
+ return error instanceof Error ? error.message : fallback;
21
+ }
22
+ async function runAsCommandResult(task, fallbackError, mapSuccess) {
23
+ try {
24
+ const result = await task();
25
+ return {
26
+ success: true,
27
+ data: mapSuccess ? mapSuccess(result) : result
28
+ };
29
+ } catch (error) {
30
+ return {
31
+ success: false,
32
+ error: toErrorMessage(error, fallbackError)
33
+ };
34
+ }
35
+ }
@@ -0,0 +1,9 @@
1
+ export declare const scriptName: "cresc" | "pushy";
2
+ export declare const IS_CRESC: boolean;
3
+ export declare const ppkBundleFileNames: string[];
4
+ export declare const isPPKBundleFileName: (fileName: string) => boolean;
5
+ export declare const credentialFile: string;
6
+ export declare const updateJson: string;
7
+ export declare const tempDir: string;
8
+ export declare const pricingPageUrl: string;
9
+ export declare const defaultEndpoints: string[];
@@ -0,0 +1 @@
1
+ export declare const depVersions: Record<string, string>;
@@ -0,0 +1,8 @@
1
+ export interface CommitInfo {
2
+ hash: string;
3
+ message: string;
4
+ author: string;
5
+ timestamp: string;
6
+ origin: string;
7
+ }
8
+ export declare function getCommitInfo(): Promise<CommitInfo | undefined>;
@@ -0,0 +1,4 @@
1
+ export declare function promiseAny<T>(promises: Promise<T>[]): Promise<T>;
2
+ export declare const ping: (url: string) => Promise<string | null>;
3
+ export declare const testUrls: (urls?: string[]) => Promise<string | null>;
4
+ export declare const getBaseUrl: Promise<string>;
@@ -0,0 +1,12 @@
1
+ import en from '../locales/en';
2
+ import zh from '../locales/zh';
3
+ declare module 'i18next' {
4
+ interface CustomTypeOptions {
5
+ defaultNS: 'en';
6
+ resources: {
7
+ en: typeof en;
8
+ zh: typeof zh;
9
+ };
10
+ }
11
+ }
12
+ export declare function t(key: string, options?: any): string;
@@ -0,0 +1,22 @@
1
+ import { checkPlugins } from './check-plugin';
2
+ export declare function question(query: string, password?: boolean): Promise<string>;
3
+ export declare function translateOptions<T extends Record<string, unknown>>(options: T): T & Record<string, unknown>;
4
+ export declare function getApkInfo(fn: string): Promise<{
5
+ versionName: string;
6
+ buildTime: number;
7
+ }>;
8
+ export declare function getAppInfo(fn: string): Promise<{
9
+ versionName: string | undefined;
10
+ buildTime: number;
11
+ }>;
12
+ export declare function getIpaInfo(fn: string): Promise<{
13
+ versionName: string;
14
+ buildTime: string;
15
+ }>;
16
+ export declare function getAabInfo(fn: string): Promise<{
17
+ versionName: string;
18
+ buildTime: number;
19
+ }>;
20
+ export declare function saveToLocal(originPath: string, destName: string): void;
21
+ export declare function printVersionCommand(): Promise<void>;
22
+ export { checkPlugins };
@@ -42,6 +42,7 @@ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
42
42
  const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
43
43
  const _compareversions = require("compare-versions");
44
44
  const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
45
+ const _yauzl = require("yauzl");
45
46
  const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../package.json"));
46
47
  const _latestversion = /*#__PURE__*/ _interop_require_default(require("./latest-version"));
47
48
  const _appinfoparser = /*#__PURE__*/ _interop_require_default(require("./app-info-parser"));
@@ -68,11 +69,18 @@ async function question(query, password) {
68
69
  function translateOptions(options) {
69
70
  const ret = {};
70
71
  for(const key in options){
71
- const v = options[key];
72
- if (typeof v === 'string') {
73
- ret[key] = v.replace(/\$\{(\w+)\}/g, (v, n)=>options[n] || process.env[n] || v);
72
+ const value = options[key];
73
+ if (typeof value === 'string') {
74
+ ret[key] = value.replace(/\$\{(\w+)\}/g, (placeholder, name)=>{
75
+ var _options_name;
76
+ const replacement = (_options_name = options[name]) != null ? _options_name : process.env[name];
77
+ if (typeof replacement === 'string' || typeof replacement === 'number' || typeof replacement === 'boolean') {
78
+ return String(replacement);
79
+ }
80
+ return placeholder;
81
+ });
74
82
  } else {
75
- ret[key] = v;
83
+ ret[key] = value;
76
84
  }
77
85
  }
78
86
  return ret;
@@ -96,7 +104,12 @@ async function getApkInfo(fn) {
96
104
  if (Array.isArray(application.metaData)) {
97
105
  for (const meta of application.metaData){
98
106
  if (meta.name === 'pushy_build_time') {
99
- buildTime = meta.value[0];
107
+ if (Array.isArray(meta.value)) {
108
+ const firstValue = meta.value[0];
109
+ buildTime = Number(firstValue);
110
+ } else if (meta.value !== undefined) {
111
+ buildTime = Number(meta.value);
112
+ }
100
113
  }
101
114
  }
102
115
  }
@@ -131,7 +144,7 @@ async function getAppInfo(fn) {
131
144
  const { versionName, pushy_build_time } = metaData;
132
145
  let buildTime = 0;
133
146
  if (pushy_build_time) {
134
- buildTime = pushy_build_time;
147
+ buildTime = Number(pushy_build_time);
135
148
  }
136
149
  if (buildTime == 0) {
137
150
  throw new Error((0, _i18n.t)('buildTimeNotFound'));
@@ -198,14 +211,25 @@ async function getAabInfo(fn) {
198
211
  let buildTime = 0;
199
212
  const appCredential = {};
200
213
  // Find application node
201
- const applicationNode = manifestElement.child.find((c)=>c.element && c.element.name === 'application');
202
- if (applicationNode) {
203
- const metaDataNodes = applicationNode.element.child.filter((c)=>c.element && c.element.name === 'meta-data');
214
+ const applicationNode = manifestElement.child.find((child)=>{
215
+ var _child_element;
216
+ return ((_child_element = child.element) == null ? void 0 : _child_element.name) === 'application';
217
+ });
218
+ const applicationElement = applicationNode == null ? void 0 : applicationNode.element;
219
+ if (applicationElement) {
220
+ const metaDataNodes = applicationElement.child.filter((child)=>{
221
+ var _child_element;
222
+ return ((_child_element = child.element) == null ? void 0 : _child_element.name) === 'meta-data';
223
+ });
204
224
  for (const meta of metaDataNodes){
205
225
  let name = '';
206
226
  let value = '';
207
227
  let resourceId = 0;
208
- for (const attr of meta.element.attribute){
228
+ const metaElement = meta.element;
229
+ if (!metaElement) {
230
+ continue;
231
+ }
232
+ for (const attr of metaElement.attribute){
209
233
  if (attr.name === 'name') {
210
234
  name = attr.value;
211
235
  }
@@ -240,19 +264,24 @@ async function getAabInfo(fn) {
240
264
  };
241
265
  }
242
266
  async function readZipEntry(fn, entryName) {
243
- const yauzl = require('yauzl');
244
267
  return new Promise((resolve, reject)=>{
245
- yauzl.open(fn, {
268
+ (0, _yauzl.open)(fn, {
246
269
  lazyEntries: true
247
270
  }, (err, zipfile)=>{
248
- if (err) return reject(err);
271
+ if (err || !zipfile) {
272
+ reject(err != null ? err : new Error('Failed to open zip file'));
273
+ return;
274
+ }
249
275
  let found = false;
250
276
  zipfile.readEntry();
251
277
  zipfile.on('entry', (entry)=>{
252
278
  if (entry.fileName === entryName) {
253
279
  found = true;
254
- zipfile.openReadStream(entry, (err, readStream)=>{
255
- if (err) return reject(err);
280
+ zipfile.openReadStream(entry, (streamError, readStream)=>{
281
+ if (streamError || !readStream) {
282
+ reject(streamError != null ? streamError : new Error('Failed to read zip entry'));
283
+ return;
284
+ }
256
285
  const chunks = [];
257
286
  readStream.on('data', (chunk)=>chunks.push(chunk));
258
287
  readStream.on('end', ()=>resolve(Buffer.concat(chunks)));
@@ -285,20 +314,21 @@ async function resolveResource(fn, resourceId, root) {
285
314
  arrays: true
286
315
  });
287
316
  // Find package
288
- const pkg = object.package.find((p)=>p.packageId === pkgId);
317
+ const pkg = object.package.find((pkgItem)=>pkgItem.packageId === pkgId);
289
318
  if (!pkg) return null;
290
319
  // Find type
291
- const type = pkg.type.find((t)=>t.typeId === typeId);
320
+ const type = pkg.type.find((typeItem)=>typeItem.typeId === typeId);
292
321
  if (!type) return null;
293
322
  // Find entry
294
- const entry = type.entry.find((e)=>e.entryId === entryId);
323
+ const entry = type.entry.find((entryItem)=>entryItem.entryId === entryId);
295
324
  if (!entry) return null;
296
325
  // Get value from configValue
297
326
  if (entry.configValue && entry.configValue.length > 0) {
298
- var _val_item;
299
- const val = entry.configValue[0].value;
300
- if ((_val_item = val.item) == null ? void 0 : _val_item.str) {
301
- return val.item.str.value;
327
+ var _entry_configValue_, _val_item_str, _val_item;
328
+ const val = (_entry_configValue_ = entry.configValue[0]) == null ? void 0 : _entry_configValue_.value;
329
+ const stringValue = val == null ? void 0 : (_val_item = val.item) == null ? void 0 : (_val_item_str = _val_item.str) == null ? void 0 : _val_item_str.value;
330
+ if (typeof stringValue === 'string') {
331
+ return stringValue;
302
332
  }
303
333
  }
304
334
  } catch (e) {
@@ -0,0 +1 @@
1
+ export {};