react-native-update-cli 2.18.0 → 2.19.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/lib/api.d.ts +1 -1
- package/lib/api.js +140 -134
- package/lib/app.d.ts +2 -2
- package/lib/app.js +60 -107
- package/lib/bin.js +38 -35
- package/lib/bundle-pack.js +57 -77
- package/lib/bundle-runner.js +249 -312
- package/lib/bundle.js +71 -89
- package/lib/diff.js +188 -235
- package/lib/exports.js +14 -37
- package/lib/index.js +16 -17
- package/lib/install.js +24 -37
- package/lib/locales/en.js +3 -11
- package/lib/locales/zh.js +3 -11
- package/lib/package.js +164 -218
- package/lib/provider.js +85 -107
- package/lib/types.js +1 -3
- package/lib/user.d.ts +1 -1
- package/lib/user.js +26 -39
- package/lib/utils/add-gitignore.js +16 -29
- package/lib/utils/app-info-parser/aab.js +133 -157
- package/lib/utils/app-info-parser/apk.js +42 -39
- package/lib/utils/app-info-parser/app.js +5 -11
- package/lib/utils/app-info-parser/index.js +21 -31
- package/lib/utils/app-info-parser/ipa.js +35 -35
- package/lib/utils/app-info-parser/resource-finder.js +84 -71
- package/lib/utils/app-info-parser/utils.js +52 -77
- package/lib/utils/app-info-parser/xml-parser/binary.js +82 -90
- package/lib/utils/app-info-parser/xml-parser/manifest.js +88 -98
- package/lib/utils/app-info-parser/zip.js +43 -51
- package/lib/utils/check-lockfile.js +28 -37
- package/lib/utils/check-plugin.js +16 -32
- package/lib/utils/command-result.js +7 -20
- package/lib/utils/constants.js +23 -63
- package/lib/utils/dep-versions.js +21 -27
- package/lib/utils/git.js +20 -64
- package/lib/utils/hbcTransform.js +133 -246
- package/lib/utils/http-helper.js +33 -44
- package/lib/utils/i18n.js +17 -26
- package/lib/utils/index.js +137 -179
- package/lib/utils/latest-version/index.js +128 -137
- package/lib/utils/options.js +13 -34
- package/lib/utils/plugin-config.js +43 -56
- package/lib/utils/runtime.js +50 -108
- package/lib/utils/zip-entries.js +70 -97
- package/lib/utils/zip-options.js +80 -181
- package/lib/versions.js +231 -265
- package/package.json +19 -21
- package/src/api.ts +44 -3
- package/src/package.ts +1 -1
- package/src/user.ts +1 -1
- package/src/versions.ts +1 -1
package/lib/utils/zip-options.js
CHANGED
|
@@ -1,83 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
4
17
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get MANIFEST_COMPRESSION_THRESHOLD_BYTES () {
|
|
13
|
-
return MANIFEST_COMPRESSION_THRESHOLD_BYTES;
|
|
14
|
-
},
|
|
15
|
-
get ZIP_ENTRY_SNIFF_BYTES () {
|
|
16
|
-
return ZIP_ENTRY_SNIFF_BYTES;
|
|
17
|
-
},
|
|
18
|
-
get zipOptionsForManifestEntry () {
|
|
19
|
-
return zipOptionsForManifestEntry;
|
|
20
|
-
},
|
|
21
|
-
get zipOptionsForPatchEntry () {
|
|
22
|
-
return zipOptionsForPatchEntry;
|
|
23
|
-
},
|
|
24
|
-
get zipOptionsForPayloadEntry () {
|
|
25
|
-
return zipOptionsForPayloadEntry;
|
|
26
|
-
},
|
|
27
|
-
get zipOptionsForPayloadFile () {
|
|
28
|
-
return zipOptionsForPayloadFile;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const _fs = /*#__PURE__*/ _interop_require_wildcard(require("fs"));
|
|
32
|
-
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
33
|
-
function _interop_require_default(obj) {
|
|
34
|
-
return obj && obj.__esModule ? obj : {
|
|
35
|
-
default: obj
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
39
|
-
if (typeof WeakMap !== "function") return null;
|
|
40
|
-
var cacheBabelInterop = new WeakMap();
|
|
41
|
-
var cacheNodeInterop = new WeakMap();
|
|
42
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
43
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
44
|
-
})(nodeInterop);
|
|
45
|
-
}
|
|
46
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
47
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
48
|
-
return obj;
|
|
49
|
-
}
|
|
50
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
51
|
-
return {
|
|
52
|
-
default: obj
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
53
24
|
};
|
|
54
|
-
|
|
55
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
56
|
-
if (cache && cache.has(obj)) {
|
|
57
|
-
return cache.get(obj);
|
|
58
|
-
}
|
|
59
|
-
var newObj = {
|
|
60
|
-
__proto__: null
|
|
25
|
+
return ownKeys(o);
|
|
61
26
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
const
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.MANIFEST_COMPRESSION_THRESHOLD_BYTES = exports.ZIP_ENTRY_SNIFF_BYTES = void 0;
|
|
40
|
+
exports.zipOptionsForPatchEntry = zipOptionsForPatchEntry;
|
|
41
|
+
exports.zipOptionsForManifestEntry = zipOptionsForManifestEntry;
|
|
42
|
+
exports.zipOptionsForPayloadEntry = zipOptionsForPayloadEntry;
|
|
43
|
+
exports.zipOptionsForPayloadFile = zipOptionsForPayloadFile;
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const path_1 = __importDefault(require("path"));
|
|
46
|
+
exports.ZIP_ENTRY_SNIFF_BYTES = 64;
|
|
47
|
+
exports.MANIFEST_COMPRESSION_THRESHOLD_BYTES = 256;
|
|
81
48
|
const alreadyCompressedExtensions = new Set([
|
|
82
49
|
'.7z',
|
|
83
50
|
'.aab',
|
|
@@ -100,112 +67,58 @@ const alreadyCompressedExtensions = new Set([
|
|
|
100
67
|
'.woff2',
|
|
101
68
|
'.xz',
|
|
102
69
|
'.zip',
|
|
103
|
-
'.zst'
|
|
70
|
+
'.zst',
|
|
104
71
|
]);
|
|
105
72
|
const HERMES_MAGIC = Buffer.from([
|
|
106
|
-
0xc6,
|
|
107
|
-
0x1f,
|
|
108
|
-
0xbc,
|
|
109
|
-
0x03,
|
|
110
|
-
0xc1,
|
|
111
|
-
0x03,
|
|
112
|
-
0x19,
|
|
113
|
-
0x1f
|
|
73
|
+
0xc6, 0x1f, 0xbc, 0x03, 0xc1, 0x03, 0x19, 0x1f,
|
|
114
74
|
]);
|
|
115
75
|
const HERMES_DELTA_MAGIC = Buffer.from([
|
|
116
|
-
0x39,
|
|
117
|
-
0xe0,
|
|
118
|
-
0x43,
|
|
119
|
-
0xfc,
|
|
120
|
-
0x3e,
|
|
121
|
-
0xfc,
|
|
122
|
-
0xe6,
|
|
123
|
-
0xe0
|
|
76
|
+
0x39, 0xe0, 0x43, 0xfc, 0x3e, 0xfc, 0xe6, 0xe0,
|
|
124
77
|
]);
|
|
125
78
|
function startsWith(bytes, signature) {
|
|
126
|
-
return bytes.length >= signature.length &&
|
|
79
|
+
return (bytes.length >= signature.length &&
|
|
80
|
+
bytes.subarray(0, signature.length).equals(signature));
|
|
127
81
|
}
|
|
128
82
|
function hasHermesBytecodeMagic(bytes) {
|
|
129
|
-
return startsWith(bytes, HERMES_MAGIC) || startsWith(bytes, HERMES_DELTA_MAGIC);
|
|
83
|
+
return (startsWith(bytes, HERMES_MAGIC) || startsWith(bytes, HERMES_DELTA_MAGIC));
|
|
130
84
|
}
|
|
131
85
|
function hasAlreadyCompressedMagic(bytes) {
|
|
132
86
|
if (bytes.length < 2) {
|
|
133
87
|
return false;
|
|
134
88
|
}
|
|
135
|
-
if (startsWith(bytes, Buffer.from([
|
|
136
|
-
0x89,
|
|
137
|
-
0x50,
|
|
138
|
-
0x4e,
|
|
139
|
-
0x47
|
|
140
|
-
]))) {
|
|
89
|
+
if (startsWith(bytes, Buffer.from([0x89, 0x50, 0x4e, 0x47]))) {
|
|
141
90
|
return true;
|
|
142
91
|
}
|
|
143
|
-
if (startsWith(bytes, Buffer.from([
|
|
144
|
-
0xff,
|
|
145
|
-
0xd8,
|
|
146
|
-
0xff
|
|
147
|
-
]))) {
|
|
92
|
+
if (startsWith(bytes, Buffer.from([0xff, 0xd8, 0xff]))) {
|
|
148
93
|
return true;
|
|
149
94
|
}
|
|
150
|
-
if (startsWith(bytes, Buffer.from('GIF87a', 'ascii')) ||
|
|
95
|
+
if (startsWith(bytes, Buffer.from('GIF87a', 'ascii')) ||
|
|
96
|
+
startsWith(bytes, Buffer.from('GIF89a', 'ascii'))) {
|
|
151
97
|
return true;
|
|
152
98
|
}
|
|
153
|
-
if (bytes.length >= 12 &&
|
|
99
|
+
if (bytes.length >= 12 &&
|
|
100
|
+
bytes.subarray(0, 4).equals(Buffer.from('RIFF', 'ascii')) &&
|
|
101
|
+
bytes.subarray(8, 12).equals(Buffer.from('WEBP', 'ascii'))) {
|
|
154
102
|
return true;
|
|
155
103
|
}
|
|
156
|
-
if (startsWith(bytes, Buffer.from([
|
|
157
|
-
0x50,
|
|
158
|
-
0x4b,
|
|
159
|
-
0x03,
|
|
160
|
-
0x04
|
|
161
|
-
])) || startsWith(bytes, Buffer.from([
|
|
162
|
-
0x50,
|
|
163
|
-
0x4b,
|
|
164
|
-
0x05,
|
|
165
|
-
0x06
|
|
166
|
-
])) || startsWith(bytes, Buffer.from([
|
|
167
|
-
0x50,
|
|
168
|
-
0x4b,
|
|
169
|
-
0x07,
|
|
170
|
-
0x08
|
|
171
|
-
]))) {
|
|
104
|
+
if (startsWith(bytes, Buffer.from([0x50, 0x4b, 0x03, 0x04])) ||
|
|
105
|
+
startsWith(bytes, Buffer.from([0x50, 0x4b, 0x05, 0x06])) ||
|
|
106
|
+
startsWith(bytes, Buffer.from([0x50, 0x4b, 0x07, 0x08]))) {
|
|
172
107
|
return true;
|
|
173
108
|
}
|
|
174
|
-
if (startsWith(bytes, Buffer.from([
|
|
175
|
-
0x1f,
|
|
176
|
-
0x8b
|
|
177
|
-
]))) {
|
|
109
|
+
if (startsWith(bytes, Buffer.from([0x1f, 0x8b]))) {
|
|
178
110
|
return true;
|
|
179
111
|
}
|
|
180
112
|
if (startsWith(bytes, Buffer.from('BZh', 'ascii'))) {
|
|
181
113
|
return true;
|
|
182
114
|
}
|
|
183
|
-
if (startsWith(bytes, Buffer.from([
|
|
184
|
-
0xfd,
|
|
185
|
-
0x37,
|
|
186
|
-
0x7a,
|
|
187
|
-
0x58,
|
|
188
|
-
0x5a,
|
|
189
|
-
0x00
|
|
190
|
-
]))) {
|
|
115
|
+
if (startsWith(bytes, Buffer.from([0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00]))) {
|
|
191
116
|
return true;
|
|
192
117
|
}
|
|
193
|
-
if (startsWith(bytes, Buffer.from([
|
|
194
|
-
0x37,
|
|
195
|
-
0x7a,
|
|
196
|
-
0xbc,
|
|
197
|
-
0xaf,
|
|
198
|
-
0x27,
|
|
199
|
-
0x1c
|
|
200
|
-
]))) {
|
|
118
|
+
if (startsWith(bytes, Buffer.from([0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c]))) {
|
|
201
119
|
return true;
|
|
202
120
|
}
|
|
203
|
-
if (startsWith(bytes, Buffer.from([
|
|
204
|
-
0x28,
|
|
205
|
-
0xb5,
|
|
206
|
-
0x2f,
|
|
207
|
-
0xfd
|
|
208
|
-
]))) {
|
|
121
|
+
if (startsWith(bytes, Buffer.from([0x28, 0xb5, 0x2f, 0xfd]))) {
|
|
209
122
|
return true;
|
|
210
123
|
}
|
|
211
124
|
if (bytes.length >= 12 && bytes.subarray(4, 8).equals(Buffer.from('ftyp'))) {
|
|
@@ -220,61 +133,47 @@ function hasAlreadyCompressedMagic(bytes) {
|
|
|
220
133
|
if (bytes[0] === 0xff && bytes.length >= 2 && (bytes[1] & 0xe0) === 0xe0) {
|
|
221
134
|
return true;
|
|
222
135
|
}
|
|
223
|
-
if (startsWith(bytes, Buffer.from('wOFF', 'ascii')) ||
|
|
136
|
+
if (startsWith(bytes, Buffer.from('wOFF', 'ascii')) ||
|
|
137
|
+
startsWith(bytes, Buffer.from('wOF2', 'ascii'))) {
|
|
224
138
|
return true;
|
|
225
139
|
}
|
|
226
140
|
return false;
|
|
227
141
|
}
|
|
228
142
|
function readFilePrefix(filePath) {
|
|
229
|
-
const buffer = Buffer.alloc(ZIP_ENTRY_SNIFF_BYTES);
|
|
230
|
-
const fd =
|
|
143
|
+
const buffer = Buffer.alloc(exports.ZIP_ENTRY_SNIFF_BYTES);
|
|
144
|
+
const fd = fs.openSync(filePath, 'r');
|
|
231
145
|
try {
|
|
232
|
-
const bytesRead =
|
|
146
|
+
const bytesRead = fs.readSync(fd, buffer, 0, buffer.length, 0);
|
|
233
147
|
return buffer.subarray(0, bytesRead);
|
|
234
|
-
}
|
|
235
|
-
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
fs.closeSync(fd);
|
|
236
151
|
}
|
|
237
152
|
}
|
|
238
153
|
function zipOptionsForPatchEntry() {
|
|
239
|
-
return {
|
|
240
|
-
compress: false
|
|
241
|
-
};
|
|
154
|
+
return { compress: false };
|
|
242
155
|
}
|
|
243
156
|
function zipOptionsForManifestEntry(byteLength = 0) {
|
|
244
|
-
if (byteLength >= MANIFEST_COMPRESSION_THRESHOLD_BYTES) {
|
|
245
|
-
return {
|
|
246
|
-
compressionLevel: 9
|
|
247
|
-
};
|
|
157
|
+
if (byteLength >= exports.MANIFEST_COMPRESSION_THRESHOLD_BYTES) {
|
|
158
|
+
return { compressionLevel: 9 };
|
|
248
159
|
}
|
|
249
|
-
return {
|
|
250
|
-
compress: false
|
|
251
|
-
};
|
|
160
|
+
return { compress: false };
|
|
252
161
|
}
|
|
253
162
|
function zipOptionsForPayloadEntry(fileName, prefix) {
|
|
254
163
|
if (prefix && prefix.length > 0) {
|
|
255
164
|
if (hasHermesBytecodeMagic(prefix)) {
|
|
256
165
|
// Hermes bytecode is binary, but still benefits significantly from zip deflate.
|
|
257
|
-
return {
|
|
258
|
-
compress: true,
|
|
259
|
-
compressionLevel: 9
|
|
260
|
-
};
|
|
166
|
+
return { compress: true, compressionLevel: 9 };
|
|
261
167
|
}
|
|
262
168
|
if (hasAlreadyCompressedMagic(prefix)) {
|
|
263
|
-
return {
|
|
264
|
-
compress: false
|
|
265
|
-
};
|
|
169
|
+
return { compress: false };
|
|
266
170
|
}
|
|
267
171
|
}
|
|
268
|
-
const extension =
|
|
172
|
+
const extension = path_1.default.extname(fileName).toLowerCase();
|
|
269
173
|
if (alreadyCompressedExtensions.has(extension)) {
|
|
270
|
-
return {
|
|
271
|
-
compress: false
|
|
272
|
-
};
|
|
174
|
+
return { compress: false };
|
|
273
175
|
}
|
|
274
|
-
return {
|
|
275
|
-
compress: true,
|
|
276
|
-
compressionLevel: 9
|
|
277
|
-
};
|
|
176
|
+
return { compress: true, compressionLevel: 9 };
|
|
278
177
|
}
|
|
279
178
|
function zipOptionsForPayloadFile(filePath, entryName = filePath) {
|
|
280
179
|
return zipOptionsForPayloadEntry(entryName, readFilePrefix(filePath));
|