react-native-update-cli 2.29.0 → 2.29.2
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/account.js +2 -4
- package/lib/api.d.ts +1 -1
- package/lib/api.js +35 -73
- package/lib/app.js +13 -27
- package/lib/auto-update.d.ts +1 -1
- package/lib/auto-update.js +6 -16
- package/lib/bin.js +4 -6
- package/lib/bundle-pack.js +26 -60
- package/lib/bundle-runner.js +89 -119
- package/lib/bundle.js +18 -26
- package/lib/diff.js +43 -133
- package/lib/locales/en.d.ts +0 -10
- package/lib/locales/en.js +0 -10
- package/lib/locales/zh.d.ts +0 -10
- package/lib/locales/zh.js +0 -10
- package/lib/native-package.js +27 -99
- package/lib/package.d.ts +6 -1
- package/lib/package.js +56 -108
- package/lib/provider.js +3 -5
- package/lib/symbolicate.js +1 -16
- package/lib/utils/add-gitignore.js +0 -1
- package/lib/utils/app-info-parser/aab.d.ts +5 -22
- package/lib/utils/app-info-parser/aab.js +89 -226
- package/lib/utils/app-info-parser/apk.d.ts +12 -13
- package/lib/utils/app-info-parser/apk.js +28 -78
- package/lib/utils/app-info-parser/ipa.d.ts +2 -14
- package/lib/utils/app-info-parser/ipa.js +9 -70
- package/lib/utils/app-info-parser/resource-finder.d.ts +1 -34
- package/lib/utils/app-info-parser/resource-finder.js +95 -234
- package/lib/utils/app-info-parser/xml-parser/binary.d.ts +6 -55
- package/lib/utils/app-info-parser/xml-parser/binary.js +152 -556
- package/lib/utils/app-info-parser/zip.d.ts +6 -24
- package/lib/utils/app-info-parser/zip.js +19 -86
- package/lib/utils/check-plugin.d.ts +7 -5
- package/lib/utils/check-plugin.js +15 -25
- package/lib/utils/dep-versions.d.ts +0 -6
- package/lib/utils/dep-versions.js +2 -27
- package/lib/utils/failure-fingerprint.js +3 -4
- package/lib/utils/fs-helpers.d.ts +18 -0
- package/lib/utils/fs-helpers.js +84 -0
- package/lib/utils/git.d.ts +0 -1
- package/lib/utils/git.js +0 -8
- package/lib/utils/hash.d.ts +3 -0
- package/lib/utils/hash.js +19 -0
- package/lib/utils/hbcTransform.d.ts +9 -2
- package/lib/utils/hbcTransform.js +41 -70
- package/lib/utils/hermes-base.d.ts +1 -5
- package/lib/utils/hermes-base.js +136 -196
- package/lib/utils/hermes-literals.d.ts +5 -3
- package/lib/utils/hermes-literals.js +30 -53
- package/lib/utils/hermes-raw.d.ts +7 -0
- package/lib/utils/hermes-raw.js +26 -9
- package/lib/utils/http-helper.d.ts +0 -1
- package/lib/utils/http-helper.js +0 -20
- package/lib/utils/i18n.js +0 -2
- package/lib/utils/index.d.ts +5 -19
- package/lib/utils/index.js +95 -189
- package/lib/utils/latest-version.d.ts +19 -0
- package/lib/utils/latest-version.js +137 -0
- package/lib/utils/options.d.ts +2 -1
- package/lib/utils/options.js +5 -7
- package/lib/utils/runtime.d.ts +1 -1
- package/lib/utils/runtime.js +2 -10
- package/lib/utils/upload-request.d.ts +33 -0
- package/lib/utils/upload-request.js +120 -0
- package/lib/utils/zip-entries.d.ts +23 -0
- package/lib/utils/zip-entries.js +130 -139
- package/lib/utils/zip-options.js +29 -56
- package/lib/utils/zip-range.js +29 -69
- package/lib/utils/zip-raw-writer.js +6 -5
- package/lib/versions.d.ts +5 -0
- package/lib/versions.js +86 -153
- package/package.json +1 -9
- package/lib/utils/app-info-parser/app.d.ts +0 -4
- package/lib/utils/app-info-parser/app.js +0 -10
- package/lib/utils/app-info-parser/index.d.ts +0 -16
- package/lib/utils/app-info-parser/index.js +0 -46
- package/lib/utils/app-info-parser/utils.d.ts +0 -31
- package/lib/utils/app-info-parser/utils.js +0 -135
- package/lib/utils/app-info-parser/xml-parser/manifest.d.ts +0 -10
- package/lib/utils/app-info-parser/xml-parser/manifest.js +0 -202
- package/lib/utils/latest-version/index.d.ts +0 -149
- package/lib/utils/latest-version/index.js +0 -326
- package/lib/utils/plugin-config.d.ts +0 -9
- package/lib/utils/plugin-config.js +0 -61
package/lib/bundle-runner.js
CHANGED
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
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;
|
|
17
|
-
});
|
|
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;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -57,17 +24,17 @@ exports.buildSentrySourcemapsUploadArgs = buildSentrySourcemapsUploadArgs;
|
|
|
57
24
|
exports.uploadSourcemapForSentry = uploadSourcemapForSentry;
|
|
58
25
|
const child_process_1 = require("child_process");
|
|
59
26
|
const compare_versions_1 = require("compare-versions");
|
|
60
|
-
const
|
|
27
|
+
const fs_1 = __importDefault(require("fs"));
|
|
61
28
|
const os_1 = __importDefault(require("os"));
|
|
62
29
|
const path_1 = __importDefault(require("path"));
|
|
63
30
|
const api_1 = require("./api");
|
|
64
31
|
const dep_versions_1 = require("./utils/dep-versions");
|
|
32
|
+
const fs_helpers_1 = require("./utils/fs-helpers");
|
|
65
33
|
const hermes_base_1 = require("./utils/hermes-base");
|
|
66
34
|
const hermes_timeout_1 = require("./utils/hermes-timeout");
|
|
67
35
|
const i18n_1 = require("./utils/i18n");
|
|
68
36
|
const runtime_1 = require("./utils/runtime");
|
|
69
37
|
const g2js = require('gradle-to-js/lib/parser');
|
|
70
|
-
const properties = require('properties');
|
|
71
38
|
const dependencyFields = [
|
|
72
39
|
'dependencies',
|
|
73
40
|
'devDependencies',
|
|
@@ -77,7 +44,7 @@ const dependencyFields = [
|
|
|
77
44
|
const ANDROID_SENTRY_BUNDLE_NAME = 'index.android.bundle';
|
|
78
45
|
function hasProjectDependency(dependencyName, projectRoot = process.cwd()) {
|
|
79
46
|
try {
|
|
80
|
-
const packageJson = JSON.parse(
|
|
47
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(path_1.default.join(projectRoot, 'package.json'), 'utf8'));
|
|
81
48
|
return dependencyFields.some((field) => {
|
|
82
49
|
const dependencies = packageJson[field];
|
|
83
50
|
if (typeof dependencies !== 'object' || dependencies === null) {
|
|
@@ -111,7 +78,7 @@ function resolveExpoCli(projectRoot = process.cwd()) {
|
|
|
111
78
|
const cliPath = require.resolve('@expo/cli', {
|
|
112
79
|
paths: searchPaths,
|
|
113
80
|
});
|
|
114
|
-
const expoCliVersion = JSON.parse(
|
|
81
|
+
const expoCliVersion = JSON.parse(fs_1.default.readFileSync(require.resolve('@expo/cli/package.json', {
|
|
115
82
|
paths: searchPaths,
|
|
116
83
|
}), 'utf8')).version;
|
|
117
84
|
if (!(0, compare_versions_1.satisfies)(expoCliVersion, '>= 0.10.17')) {
|
|
@@ -146,7 +113,7 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
146
113
|
reactNativeBundleArgs.push(...envArgs.trim().split(/\s+/));
|
|
147
114
|
}
|
|
148
115
|
outputFolder = assertSafeToEmpty(outputFolder);
|
|
149
|
-
|
|
116
|
+
(0, fs_helpers_1.emptyDirSync)(outputFolder);
|
|
150
117
|
let cliPath = '';
|
|
151
118
|
let usingExpo = false;
|
|
152
119
|
const getExpoCli = () => {
|
|
@@ -192,15 +159,12 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
192
159
|
}
|
|
193
160
|
}
|
|
194
161
|
if (isSentry) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
else if (platform === 'harmony' &&
|
|
202
|
-
fs.existsSync('harmony/sentry.properties')) {
|
|
203
|
-
process.env.SENTRY_PROPERTIES = 'harmony/sentry.properties';
|
|
162
|
+
// optional only on harmony
|
|
163
|
+
const sentryProperties = `${platform}/sentry.properties`;
|
|
164
|
+
if (platform === 'ios' ||
|
|
165
|
+
platform === 'android' ||
|
|
166
|
+
(platform === 'harmony' && fs_1.default.existsSync(sentryProperties))) {
|
|
167
|
+
process.env.SENTRY_PROPERTIES = sentryProperties;
|
|
204
168
|
}
|
|
205
169
|
}
|
|
206
170
|
let bundleCommand = 'bundle';
|
|
@@ -275,13 +239,14 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
275
239
|
}
|
|
276
240
|
if (platform === 'harmony') {
|
|
277
241
|
const harmonyRawAssetsPath = 'harmony/entry/src/main/resources/rawfile/assets';
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
242
|
+
(0, fs_helpers_1.ensureDirSync)(harmonyRawAssetsPath);
|
|
243
|
+
fs_1.default.cpSync(outputFolder, harmonyRawAssetsPath, {
|
|
244
|
+
recursive: true,
|
|
245
|
+
force: true,
|
|
281
246
|
// sourcemaps must not ship inside the native package
|
|
282
247
|
filter: (src) => !src.endsWith('.map'),
|
|
283
248
|
});
|
|
284
|
-
|
|
249
|
+
(0, fs_helpers_1.moveSync)(`${harmonyRawAssetsPath}/bundle.harmony.js`, `${harmonyRawAssetsPath}/../bundle.harmony.js`);
|
|
285
250
|
}
|
|
286
251
|
resolve();
|
|
287
252
|
}
|
|
@@ -338,13 +303,13 @@ function assertSafeToEmpty(dir, cwd = process.cwd()) {
|
|
|
338
303
|
validate(requested, lexicalCwd, lexicalHome, lexicalTmp);
|
|
339
304
|
// A final-component symlink is the direct dangerous case: emptyDirSync would
|
|
340
305
|
// enumerate and remove entries from its target rather than removing the link.
|
|
341
|
-
if (
|
|
306
|
+
if (fs_1.default.existsSync(requested) && fs_1.default.lstatSync(requested).isSymbolicLink()) {
|
|
342
307
|
reject(requested);
|
|
343
308
|
}
|
|
344
309
|
// emptyDirSync creates a missing directory too; create it first so it can be
|
|
345
310
|
// canonicalized and the exact validated path can be passed to deletion.
|
|
346
|
-
|
|
347
|
-
const canonical = (value) =>
|
|
311
|
+
(0, fs_helpers_1.ensureDirSync)(requested);
|
|
312
|
+
const canonical = (value) => fs_1.default.realpathSync.native(value);
|
|
348
313
|
const target = canonical(requested);
|
|
349
314
|
const canonicalCwd = canonical(lexicalCwd);
|
|
350
315
|
const canonicalHome = canonical(lexicalHome);
|
|
@@ -358,9 +323,8 @@ function assertSafeToEmpty(dir, cwd = process.cwd()) {
|
|
|
358
323
|
[lexicalHome, canonicalHome],
|
|
359
324
|
[lexicalTmp, canonicalTmp],
|
|
360
325
|
]) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
(!relative.startsWith('..') && !path_1.default.isAbsolute(relative))) {
|
|
326
|
+
if (contains(lexicalBase, requested)) {
|
|
327
|
+
const relative = path_1.default.relative(lexicalBase, requested);
|
|
364
328
|
if (!samePath(path_1.default.resolve(canonicalBase, relative), target)) {
|
|
365
329
|
reject(target);
|
|
366
330
|
}
|
|
@@ -388,9 +352,9 @@ async function detectHermesEnabled(platform, forceHermes, gradleConfig, projectR
|
|
|
388
352
|
return true;
|
|
389
353
|
}
|
|
390
354
|
if (platform === 'android') {
|
|
391
|
-
const
|
|
392
|
-
if (
|
|
393
|
-
return
|
|
355
|
+
const hermesEnabled = await readGradleHermesEnabled(path_1.default.join(projectRoot, 'android', 'gradle.properties'));
|
|
356
|
+
if (hermesEnabled !== undefined) {
|
|
357
|
+
return hermesEnabled;
|
|
394
358
|
}
|
|
395
359
|
if (typeof gradleConfig.enableHermes === 'boolean') {
|
|
396
360
|
return gradleConfig.enableHermes;
|
|
@@ -402,20 +366,27 @@ async function detectHermesEnabled(platform, forceHermes, gradleConfig, projectR
|
|
|
402
366
|
}
|
|
403
367
|
return false;
|
|
404
368
|
}
|
|
405
|
-
/**
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
|
|
369
|
+
/**
|
|
370
|
+
* `hermesEnabled` from gradle.properties (the last assignment wins, as in
|
|
371
|
+
* Gradle); undefined when the file, the key or a boolean value is missing.
|
|
372
|
+
*/
|
|
373
|
+
async function readGradleHermesEnabled(file) {
|
|
374
|
+
let content;
|
|
375
|
+
try {
|
|
376
|
+
content = await fs_1.default.promises.readFile(file, 'utf8');
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
if (error.code !== 'ENOENT') {
|
|
380
|
+
console.warn(`${file}: ${error.message ?? error}`);
|
|
381
|
+
}
|
|
382
|
+
return undefined;
|
|
383
|
+
}
|
|
384
|
+
let value;
|
|
385
|
+
for (const match of content.matchAll(/^[ \t\f]*hermesEnabled[ \t\f]*[=: \t\f][ \t\f]*(.*?)[ \t\f]*\r?$/gm)) {
|
|
386
|
+
value =
|
|
387
|
+
match[1] === 'true' ? true : match[1] === 'false' ? false : undefined;
|
|
388
|
+
}
|
|
389
|
+
return value;
|
|
419
390
|
}
|
|
420
391
|
/** React Native's gradle plugin (0.71+) enables Hermes unless a property says otherwise */
|
|
421
392
|
function reactNativeDefaultsToHermes(projectRoot) {
|
|
@@ -470,7 +441,7 @@ function stripRubyComments(source) {
|
|
|
470
441
|
function configuredIosEngine(ios) {
|
|
471
442
|
let expoEngine;
|
|
472
443
|
try {
|
|
473
|
-
const value = JSON.parse(
|
|
444
|
+
const value = JSON.parse(fs_1.default.readFileSync(path_1.default.join(ios, 'Podfile.properties.json'), 'utf8'))?.['expo.jsEngine'];
|
|
474
445
|
if (value === 'hermes' || value === 'jsc')
|
|
475
446
|
expoEngine = value;
|
|
476
447
|
}
|
|
@@ -479,7 +450,7 @@ function configuredIosEngine(ios) {
|
|
|
479
450
|
}
|
|
480
451
|
let podfile = '';
|
|
481
452
|
try {
|
|
482
|
-
podfile =
|
|
453
|
+
podfile = fs_1.default.readFileSync(path_1.default.join(ios, 'Podfile'), 'utf8');
|
|
483
454
|
}
|
|
484
455
|
catch {
|
|
485
456
|
// no Podfile
|
|
@@ -515,12 +486,12 @@ function detectIosHermes(projectRoot) {
|
|
|
515
486
|
const configured = configuredIosEngine(ios);
|
|
516
487
|
if (configured)
|
|
517
488
|
return configured === 'hermes';
|
|
518
|
-
if (
|
|
489
|
+
if (fs_1.default.existsSync(path_1.default.join(ios, 'Pods', 'hermes-engine'))) {
|
|
519
490
|
return true;
|
|
520
491
|
}
|
|
521
492
|
// CI may not have run pod install, so use the lockfile only as weak evidence.
|
|
522
493
|
try {
|
|
523
|
-
const lock =
|
|
494
|
+
const lock = fs_1.default.readFileSync(path_1.default.join(ios, 'Podfile.lock'), 'utf8');
|
|
524
495
|
if (/^\s*-\s+hermes-engine\b/m.test(lock))
|
|
525
496
|
return true;
|
|
526
497
|
}
|
|
@@ -588,7 +559,7 @@ function resolveHermesCommand(projectRoot = process.cwd()) {
|
|
|
588
559
|
catch {
|
|
589
560
|
// RN 0.70-era projects commonly used hermes-engine; optional for newer RN.
|
|
590
561
|
}
|
|
591
|
-
const hermesCommand = candidates.find((candidate) =>
|
|
562
|
+
const hermesCommand = candidates.find((candidate) => fs_1.default.existsSync(candidate));
|
|
592
563
|
if (hermesCommand) {
|
|
593
564
|
return hermesCommand;
|
|
594
565
|
}
|
|
@@ -790,10 +761,10 @@ async function compileHermesByteCode({ bundleName, outputFolder, sourcemapOutput
|
|
|
790
761
|
// hermesc is about to write its own map at `<bundle>.map`, which is where
|
|
791
762
|
// the packager map normally sits: move it aside (copy only when elsewhere)
|
|
792
763
|
if (path_1.default.resolve(sourcemapOutput) === path_1.default.resolve(hermesMap)) {
|
|
793
|
-
|
|
764
|
+
fs_1.default.renameSync(sourcemapOutput, packagerMap);
|
|
794
765
|
}
|
|
795
766
|
else {
|
|
796
|
-
|
|
767
|
+
fs_1.default.copyFileSync(sourcemapOutput, packagerMap);
|
|
797
768
|
}
|
|
798
769
|
}
|
|
799
770
|
else {
|
|
@@ -829,8 +800,8 @@ async function compileHermesByteCode({ bundleName, outputFolder, sourcemapOutput
|
|
|
829
800
|
const jsSource = path_1.default.join(workDir, bundleName);
|
|
830
801
|
const plainPath = path_1.default.join(workDir, 'plain', bundleName);
|
|
831
802
|
const wantPlain = Boolean(baseRequest?.verify);
|
|
832
|
-
|
|
833
|
-
|
|
803
|
+
(0, fs_helpers_1.ensureDirSync)(path_1.default.dirname(plainPath));
|
|
804
|
+
fs_1.default.renameSync(bundlePath, jsSource);
|
|
834
805
|
const args = (0, hermes_base_1.hermescArgsWithBase)(buildHermescArgs(bundlePath, jsSource), base.path);
|
|
835
806
|
console.log((0, i18n_1.t)('runningHermesc', { command, args: args.join(' ') }));
|
|
836
807
|
const [attempt, plain] = await Promise.all([
|
|
@@ -858,7 +829,7 @@ async function compileHermesByteCode({ bundleName, outputFolder, sourcemapOutput
|
|
|
858
829
|
// the intermediate dir, never inside it (its content is packed)
|
|
859
830
|
const logPath = hermesBaseErrorLogPath(outputFolder);
|
|
860
831
|
try {
|
|
861
|
-
|
|
832
|
+
fs_1.default.writeFileSync(logPath, fullStderr);
|
|
862
833
|
console.warn((0, i18n_1.t)('hermesBaseCompileFailedLog', { file: logPath }));
|
|
863
834
|
}
|
|
864
835
|
catch { }
|
|
@@ -934,16 +905,16 @@ async function compileHermesByteCode({ bundleName, outputFolder, sourcemapOutput
|
|
|
934
905
|
}
|
|
935
906
|
if (!usedBase) {
|
|
936
907
|
if (plainOk) {
|
|
937
|
-
|
|
938
|
-
if (
|
|
939
|
-
|
|
908
|
+
(0, fs_helpers_1.moveSync)(plainPath, bundlePath);
|
|
909
|
+
if (fs_1.default.existsSync(`${plainPath}.map`)) {
|
|
910
|
+
(0, fs_helpers_1.moveSync)(`${plainPath}.map`, hermesMap);
|
|
940
911
|
}
|
|
941
912
|
}
|
|
942
913
|
else {
|
|
943
914
|
await compilePlain(command, bundlePath, jsSource);
|
|
944
915
|
}
|
|
945
916
|
}
|
|
946
|
-
|
|
917
|
+
(0, fs_helpers_1.removeSync)(workDir);
|
|
947
918
|
result.base = usedBase ? base : null;
|
|
948
919
|
if (usedBase)
|
|
949
920
|
result.outcome = 'used';
|
|
@@ -952,7 +923,7 @@ async function compileHermesByteCode({ bundleName, outputFolder, sourcemapOutput
|
|
|
952
923
|
await composeSourceMaps(packagerMap, hermesMap, sourcemapOutput);
|
|
953
924
|
}
|
|
954
925
|
if (shouldCleanSourcemap) {
|
|
955
|
-
|
|
926
|
+
(0, fs_helpers_1.removeSync)(packagerMap);
|
|
956
927
|
}
|
|
957
928
|
return result;
|
|
958
929
|
}
|
|
@@ -1035,7 +1006,6 @@ async function selectHermesBase(hermesCommand, request) {
|
|
|
1035
1006
|
try {
|
|
1036
1007
|
const base = await (0, hermes_base_1.resolveHermesBase)({
|
|
1037
1008
|
option: request.option,
|
|
1038
|
-
hermesCommand,
|
|
1039
1009
|
bytecodeVersion,
|
|
1040
1010
|
appId: request.appId,
|
|
1041
1011
|
cacheMaxMb: request.cacheMaxMb,
|
|
@@ -1061,7 +1031,7 @@ async function copyDebugidForSentry(bundleName, outputFolder, sourcemapOutput) {
|
|
|
1061
1031
|
console.error((0, i18n_1.t)('sentryReactNativeNotFound'));
|
|
1062
1032
|
return;
|
|
1063
1033
|
}
|
|
1064
|
-
if (!
|
|
1034
|
+
if (!fs_1.default.existsSync(copyDebugidPath)) {
|
|
1065
1035
|
return;
|
|
1066
1036
|
}
|
|
1067
1037
|
console.log((0, i18n_1.t)('copyingDebugId'));
|
|
@@ -1073,7 +1043,7 @@ async function copyDebugidForSentry(bundleName, outputFolder, sourcemapOutput) {
|
|
|
1073
1043
|
stdio: 'ignore',
|
|
1074
1044
|
}), copyDebugidPath);
|
|
1075
1045
|
}
|
|
1076
|
-
|
|
1046
|
+
(0, fs_helpers_1.removeSync)(path_1.default.join(outputFolder, `${bundleName}.txt.map`));
|
|
1077
1047
|
}
|
|
1078
1048
|
async function prepareSentryUploadArtifacts(bundleName, outputFolder, platform) {
|
|
1079
1049
|
const bundlePath = path_1.default.join(outputFolder, bundleName);
|
|
@@ -1086,10 +1056,10 @@ async function prepareSentryUploadArtifacts(bundleName, outputFolder, platform)
|
|
|
1086
1056
|
}
|
|
1087
1057
|
const androidBundlePath = path_1.default.join(outputFolder, ANDROID_SENTRY_BUNDLE_NAME);
|
|
1088
1058
|
const androidSourcemapPath = path_1.default.join(outputFolder, `${ANDROID_SENTRY_BUNDLE_NAME}.map`);
|
|
1089
|
-
await
|
|
1090
|
-
const sourcemap = JSON.parse(await
|
|
1059
|
+
await fs_1.default.promises.copyFile(bundlePath, androidBundlePath);
|
|
1060
|
+
const sourcemap = JSON.parse(await fs_1.default.promises.readFile(sourcemapPath, 'utf8'));
|
|
1091
1061
|
sourcemap.file = ANDROID_SENTRY_BUNDLE_NAME;
|
|
1092
|
-
await
|
|
1062
|
+
await fs_1.default.promises.writeFile(androidSourcemapPath, JSON.stringify(sourcemap));
|
|
1093
1063
|
return {
|
|
1094
1064
|
bundlePath: androidBundlePath,
|
|
1095
1065
|
sourcemapPath: androidSourcemapPath,
|
|
@@ -1097,7 +1067,7 @@ async function prepareSentryUploadArtifacts(bundleName, outputFolder, platform)
|
|
|
1097
1067
|
}
|
|
1098
1068
|
async function readSourcemapDebugId(sourcemapPath) {
|
|
1099
1069
|
try {
|
|
1100
|
-
const sourcemap = JSON.parse(await
|
|
1070
|
+
const sourcemap = JSON.parse(await fs_1.default.promises.readFile(sourcemapPath, 'utf8'));
|
|
1101
1071
|
const debugId = sourcemap.debugId ?? sourcemap.debug_id;
|
|
1102
1072
|
return typeof debugId === 'string' ? normalizeString(debugId) : undefined;
|
|
1103
1073
|
}
|
|
@@ -1179,20 +1149,25 @@ function buildSentrySourcemapsUploadArgs({ sentryCliPath, bundlePath, sourcemapP
|
|
|
1179
1149
|
...uploadArgs,
|
|
1180
1150
|
];
|
|
1181
1151
|
}
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1152
|
+
/**
|
|
1153
|
+
* What the installed sentry-cli supports, from one `sourcemaps upload --help`
|
|
1154
|
+
* run: the standalone `sourcemaps upload` command (else the legacy
|
|
1155
|
+
* `releases files upload-sourcemaps`), and its `--debug-id-reference` flag.
|
|
1156
|
+
*/
|
|
1157
|
+
function probeSentryCli(sentryCliPath) {
|
|
1158
|
+
const result = (0, runtime_1.spawnJavaScriptSync)([sentryCliPath, 'sourcemaps', 'upload', '--help'], { encoding: 'utf8' });
|
|
1159
|
+
const standalone = !result.error && result.status === 0;
|
|
1160
|
+
return {
|
|
1161
|
+
standalone,
|
|
1162
|
+
debugIdReference: standalone &&
|
|
1163
|
+
typeof result.stdout === 'string' &&
|
|
1164
|
+
result.stdout.includes('--debug-id-reference'),
|
|
1165
|
+
};
|
|
1187
1166
|
}
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
return (!result.error &&
|
|
1193
|
-
result.status === 0 &&
|
|
1194
|
-
typeof result.stdout === 'string' &&
|
|
1195
|
-
result.stdout.includes('--debug-id-reference'));
|
|
1167
|
+
/** --sentry-release/--sentry-dist, else SENTRY_RELEASE/SENTRY_DIST */
|
|
1168
|
+
function explicitSentryRelease(options) {
|
|
1169
|
+
return (resolveSentryReleaseFromValues(options.sentryRelease, options.sentryDist) ??
|
|
1170
|
+
resolveSentryReleaseFromValues(process.env.SENTRY_RELEASE, process.env.SENTRY_DIST));
|
|
1196
1171
|
}
|
|
1197
1172
|
function runSentryCli(args) {
|
|
1198
1173
|
return (0, runtime_1.spawnJavaScriptSync)(args, {
|
|
@@ -1226,12 +1201,10 @@ async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutpu
|
|
|
1226
1201
|
console.error((0, i18n_1.t)('sentryCliNotFound'));
|
|
1227
1202
|
return;
|
|
1228
1203
|
}
|
|
1229
|
-
if (!fs.existsSync(sentryCliPath)) {
|
|
1230
|
-
return;
|
|
1231
|
-
}
|
|
1232
1204
|
const { bundlePath, sourcemapPath } = await prepareSentryUploadArtifacts(bundleName, outputFolder, platform);
|
|
1233
1205
|
const uploadMode = await resolveSentryUploadMode(sourcemapPath, sentryOptions);
|
|
1234
|
-
const
|
|
1206
|
+
const sentryCli = probeSentryCli(sentryCliPath);
|
|
1207
|
+
const useStandaloneSourcemapsCommand = sentryCli.standalone;
|
|
1235
1208
|
if (uploadMode.type === 'release') {
|
|
1236
1209
|
uploadSourcemapsWithRelease({
|
|
1237
1210
|
sentryCliPath,
|
|
@@ -1244,10 +1217,8 @@ async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutpu
|
|
|
1244
1217
|
return;
|
|
1245
1218
|
}
|
|
1246
1219
|
console.log((0, i18n_1.t)('uploadingSourcemap'));
|
|
1247
|
-
if (!
|
|
1248
|
-
|
|
1249
|
-
const explicitRelease = resolveSentryReleaseFromValues(sentryOptions.sentryRelease, sentryOptions.sentryDist) ??
|
|
1250
|
-
resolveSentryReleaseFromValues(process.env.SENTRY_RELEASE, process.env.SENTRY_DIST);
|
|
1220
|
+
if (!sentryCli.debugIdReference) {
|
|
1221
|
+
const explicitRelease = explicitSentryRelease(sentryOptions);
|
|
1251
1222
|
if (!explicitRelease) {
|
|
1252
1223
|
throw new Error('[pushy/sentry] sentry-cli does not support Debug ID source map upload. ' +
|
|
1253
1224
|
'Upgrade @sentry/cli, or set --sentry-release/--sentry-dist for legacy release matching.');
|
|
@@ -1273,8 +1244,7 @@ async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutpu
|
|
|
1273
1244
|
if (debugIdResult.status === 0 && !debugIdResult.error) {
|
|
1274
1245
|
return;
|
|
1275
1246
|
}
|
|
1276
|
-
const explicitRelease =
|
|
1277
|
-
resolveSentryReleaseFromValues(process.env.SENTRY_RELEASE, process.env.SENTRY_DIST);
|
|
1247
|
+
const explicitRelease = explicitSentryRelease(sentryOptions);
|
|
1278
1248
|
if (!explicitRelease) {
|
|
1279
1249
|
assertSuccessfulSyncProcess(debugIdResult, sentryCliPath);
|
|
1280
1250
|
return;
|
package/lib/bundle.js
CHANGED
|
@@ -152,14 +152,15 @@ exports.bundleCommands = {
|
|
|
152
152
|
]);
|
|
153
153
|
const sourcemapOutput = path_1.default.join(normalized.intermediaDir, `${normalized.bundleName}.map`);
|
|
154
154
|
const realOutput = normalized.output.replace(/\$\{time\}/g, `${Date.now()}`);
|
|
155
|
-
|
|
155
|
+
const sourcemap = normalized.sourcemap || bundleParams.sourcemap;
|
|
156
|
+
console.log((0, i18n_1.t)('bundlingWithRN', { version: (0, dep_versions_1.getDepVersion)('react-native') }));
|
|
156
157
|
const hermesResult = await (0, bundle_runner_1.runReactNativeBundleCommand)({
|
|
157
158
|
bundleName: normalized.bundleName,
|
|
158
159
|
dev: normalized.dev,
|
|
159
160
|
entryFile: normalized.entryFile,
|
|
160
161
|
outputFolder: normalized.intermediaDir,
|
|
161
162
|
platform,
|
|
162
|
-
sourcemapOutput:
|
|
163
|
+
sourcemapOutput: sourcemap ? sourcemapOutput : '',
|
|
163
164
|
forceHermes: normalized.hermes,
|
|
164
165
|
hermesBase: hermesBase ? { ...hermesBase, appId } : undefined,
|
|
165
166
|
resetCache: normalized.resetCache,
|
|
@@ -177,9 +178,20 @@ exports.bundleCommands = {
|
|
|
177
178
|
detail: hermesResult.outcomeDetail,
|
|
178
179
|
})
|
|
179
180
|
: undefined;
|
|
180
|
-
|
|
181
|
+
const publishAndUploadSentry = async (payload = {}) => {
|
|
181
182
|
await publishBundleVersion(realOutput, platform, {
|
|
182
183
|
appId: await getAppId(),
|
|
184
|
+
hermesBase: baseMeta,
|
|
185
|
+
sourcemap: sourcemap ? sourcemapOutput : undefined,
|
|
186
|
+
...payload,
|
|
187
|
+
});
|
|
188
|
+
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
|
|
189
|
+
sentryRelease: normalized.sentryRelease,
|
|
190
|
+
sentryDist: normalized.sentryDist,
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
if (normalized.name) {
|
|
194
|
+
await publishAndUploadSentry({
|
|
183
195
|
name: normalized.name,
|
|
184
196
|
description: normalized.description,
|
|
185
197
|
metaInfo: normalized.metaInfo,
|
|
@@ -190,32 +202,12 @@ exports.bundleCommands = {
|
|
|
190
202
|
packageVersionRange: normalized.packageVersionRange,
|
|
191
203
|
rollout: normalized.rollout,
|
|
192
204
|
dryRun: normalized.dryRun,
|
|
193
|
-
hermesBase: baseMeta,
|
|
194
|
-
sourcemap: normalized.sourcemap || bundleParams.sourcemap
|
|
195
|
-
? sourcemapOutput
|
|
196
|
-
: undefined,
|
|
197
|
-
});
|
|
198
|
-
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
|
|
199
|
-
sentryRelease: normalized.sentryRelease,
|
|
200
|
-
sentryDist: normalized.sentryDist,
|
|
201
205
|
});
|
|
202
206
|
return;
|
|
203
207
|
}
|
|
204
|
-
if (!(0, options_1.getBooleanOption)(options, 'no-interactive', false)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
await publishBundleVersion(realOutput, platform, {
|
|
208
|
-
appId: await getAppId(),
|
|
209
|
-
hermesBase: baseMeta,
|
|
210
|
-
sourcemap: normalized.sourcemap || bundleParams.sourcemap
|
|
211
|
-
? sourcemapOutput
|
|
212
|
-
: undefined,
|
|
213
|
-
});
|
|
214
|
-
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
|
|
215
|
-
sentryRelease: normalized.sentryRelease,
|
|
216
|
-
sentryDist: normalized.sentryDist,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
208
|
+
if (!(0, options_1.getBooleanOption)(options, 'no-interactive', false) &&
|
|
209
|
+
(await (0, utils_1.question)((0, i18n_1.t)('uploadBundlePrompt'))).toLowerCase() === 'y') {
|
|
210
|
+
await publishAndUploadSentry();
|
|
219
211
|
}
|
|
220
212
|
},
|
|
221
213
|
};
|