react-native-update-cli 2.4.2 → 2.6.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 (49) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/cli.json +40 -0
  4. package/lib/api.js +1 -1
  5. package/lib/locales/en.js +16 -1
  6. package/lib/locales/zh.js +16 -1
  7. package/lib/package.js +60 -6
  8. package/lib/provider.js +3 -0
  9. package/lib/utils/app-info-parser/aab.js +230 -0
  10. package/lib/utils/app-info-parser/apk.js +25 -27
  11. package/lib/utils/app-info-parser/app.js +10 -11
  12. package/lib/utils/app-info-parser/index.js +13 -8
  13. package/lib/utils/app-info-parser/ipa.js +16 -21
  14. package/lib/utils/app-info-parser/resource-finder.js +365 -305
  15. package/lib/utils/app-info-parser/utils.js +78 -63
  16. package/lib/utils/app-info-parser/xml-parser/binary.js +57 -51
  17. package/lib/utils/app-info-parser/xml-parser/manifest.js +47 -39
  18. package/lib/utils/app-info-parser/zip.js +21 -11
  19. package/lib/utils/http-helper.js +1 -1
  20. package/lib/utils/index.js +137 -0
  21. package/lib/versions.js +22 -0
  22. package/package.json +3 -2
  23. package/proto/Configuration.proto +183 -0
  24. package/proto/Resources.proto +569 -0
  25. package/src/api.ts +2 -6
  26. package/src/locales/en.ts +20 -0
  27. package/src/locales/zh.ts +18 -0
  28. package/src/modules/version-module.ts +1 -1
  29. package/src/package.ts +112 -12
  30. package/src/provider.ts +3 -0
  31. package/src/utils/app-info-parser/aab.ts +240 -0
  32. package/src/utils/app-info-parser/{apk.js → apk.ts} +30 -41
  33. package/src/utils/app-info-parser/app.ts +3 -0
  34. package/src/utils/app-info-parser/index.ts +9 -5
  35. package/src/utils/app-info-parser/{ipa.js → ipa.ts} +17 -31
  36. package/src/utils/app-info-parser/resource-finder.ts +508 -0
  37. package/src/utils/app-info-parser/utils.ts +162 -0
  38. package/src/utils/app-info-parser/xml-parser/{binary.js → binary.ts} +69 -61
  39. package/src/utils/app-info-parser/xml-parser/{manifest.js → manifest.ts} +50 -51
  40. package/src/utils/app-info-parser/zip.ts +86 -0
  41. package/src/utils/dep-versions.ts +7 -4
  42. package/src/utils/http-helper.ts +1 -1
  43. package/src/utils/index.ts +154 -0
  44. package/src/utils/latest-version/index.ts +2 -1
  45. package/src/versions.ts +27 -2
  46. package/src/utils/app-info-parser/app.js +0 -16
  47. package/src/utils/app-info-parser/resource-finder.js +0 -495
  48. package/src/utils/app-info-parser/utils.js +0 -172
  49. package/src/utils/app-info-parser/zip.js +0 -66
@@ -1,66 +0,0 @@
1
- const Unzip = require('isomorphic-unzip');
2
- const { isBrowser, decodeNullUnicode } = require('./utils');
3
- const { enumZipEntries, readEntry } = require('../../bundle');
4
-
5
- class Zip {
6
- constructor(file) {
7
- if (isBrowser()) {
8
- if (!(file instanceof window.Blob || typeof file.size !== 'undefined')) {
9
- throw new Error(
10
- 'Param error: [file] must be an instance of Blob or File in browser.',
11
- );
12
- }
13
- this.file = file;
14
- } else {
15
- if (typeof file !== 'string') {
16
- throw new Error('Param error: [file] must be file path in Node.');
17
- }
18
- this.file = require('path').resolve(file);
19
- }
20
- this.unzip = new Unzip(this.file);
21
- }
22
-
23
- /**
24
- * get entries by regexps, the return format is: { <filename>: <Buffer|Blob> }
25
- * @param {Array} regexps // regexps for matching files
26
- * @param {String} type // return type, can be buffer or blob, default buffer
27
- */
28
- getEntries(regexps, type = 'buffer') {
29
- regexps = regexps.map((regex) => decodeNullUnicode(regex));
30
- return new Promise((resolve, reject) => {
31
- this.unzip.getBuffer(regexps, { type }, (err, buffers) => {
32
- err ? reject(err) : resolve(buffers);
33
- });
34
- });
35
- }
36
- /**
37
- * get entry by regex, return an instance of Buffer or Blob
38
- * @param {Regex} regex // regex for matching file
39
- * @param {String} type // return type, can be buffer or blob, default buffer
40
- */
41
- getEntry(regex, type = 'buffer') {
42
- regex = decodeNullUnicode(regex);
43
- return new Promise((resolve, reject) => {
44
- this.unzip.getBuffer([regex], { type }, (err, buffers) => {
45
- // console.log(buffers);
46
- err ? reject(err) : resolve(buffers[regex]);
47
- });
48
- });
49
- }
50
-
51
- async getEntryFromHarmonyApp(regex) {
52
- try {
53
- let originSource;
54
- await enumZipEntries(this.file, (entry, zipFile) => {
55
- if (regex.test(entry.fileName)) {
56
- return readEntry(entry, zipFile).then((v) => (originSource = v));
57
- }
58
- });
59
- return originSource;
60
- } catch (error) {
61
- console.error('Error in getEntryFromHarmonyApp:', error);
62
- }
63
- }
64
- }
65
-
66
- module.exports = Zip;