react-native-update 10.29.0-beta.0 → 10.29.0-beta.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/client.ts +45 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.29.0-beta.0",
3
+ "version": "10.29.0-beta.2",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "scripts": {
package/src/client.ts CHANGED
@@ -394,26 +394,30 @@ export class Pushy {
394
394
  this.report({ type: 'downloading' });
395
395
  let lastError: any;
396
396
  let errorMessages: string[] = [];
397
- if (!__DEV__) {
398
- const diffUrl = await testUrls(joinUrls(paths, diff));
399
- if (diffUrl) {
400
- log('downloading diff');
401
- try {
402
- await PushyModule.downloadPatchFromPpk({
403
- updateUrl: diffUrl,
404
- hash,
405
- originHash: currentVersion,
406
- });
397
+ const diffUrl = await testUrls(joinUrls(paths, diff));
398
+ if (diffUrl) {
399
+ log('downloading diff');
400
+ try {
401
+ await PushyModule.downloadPatchFromPpk({
402
+ updateUrl: diffUrl,
403
+ hash,
404
+ originHash: currentVersion,
405
+ });
406
+ succeeded = 'diff';
407
+ } catch (e: any) {
408
+ const errorMessage = `diff error: ${e.message}`;
409
+ errorMessages.push(errorMessage);
410
+ lastError = new Error(errorMessage);
411
+ if (__DEV__) {
407
412
  succeeded = 'diff';
408
- } catch (e: any) {
409
- const errorMessage = `diff error: ${e.message}`;
410
- errorMessages.push(errorMessage);
411
- lastError = new Error(errorMessage);
413
+ } else {
412
414
  log(errorMessage);
413
415
  }
414
416
  }
417
+ }
418
+ if (!succeeded) {
415
419
  const pdiffUrl = await testUrls(joinUrls(paths, pdiff));
416
- if (!succeeded && pdiffUrl) {
420
+ if (pdiffUrl) {
417
421
  log('downloading pdiff');
418
422
  try {
419
423
  await PushyModule.downloadPatchFromPackage({
@@ -425,24 +429,35 @@ export class Pushy {
425
429
  const errorMessage = `pdiff error: ${e.message}`;
426
430
  errorMessages.push(errorMessage);
427
431
  lastError = new Error(errorMessage);
428
- log(errorMessage);
432
+ if (__DEV__ && !full) {
433
+ succeeded = 'pdiff';
434
+ log('当前是开发环境,无法执行增量式热更新。如果需要在开发环境中测试全量热更新,请打开“忽略时间戳”开关再重试。');
435
+ } else {
436
+ log(errorMessage);
437
+ }
429
438
  }
430
439
  }
431
440
  }
432
- const fullUrl = await testUrls(joinUrls(paths, full));
433
- if (!succeeded && fullUrl) {
434
- log('downloading full patch');
435
- try {
436
- await PushyModule.downloadFullUpdate({
437
- updateUrl: fullUrl,
438
- hash,
439
- });
440
- succeeded = 'full';
441
- } catch (e: any) {
442
- const errorMessage = `full patch error: ${e.message}`;
443
- errorMessages.push(errorMessage);
444
- lastError = new Error(errorMessage);
445
- log(errorMessage);
441
+ if (!succeeded) {
442
+ const fullUrl = await testUrls(joinUrls(paths, full));
443
+ if (fullUrl) {
444
+ log('downloading full patch');
445
+ try {
446
+ await PushyModule.downloadFullUpdate({
447
+ updateUrl: fullUrl,
448
+ hash,
449
+ });
450
+ succeeded = 'full';
451
+ } catch (e: any) {
452
+ const errorMessage = `full patch error: ${e.message}`;
453
+ errorMessages.push(errorMessage);
454
+ lastError = new Error(errorMessage);
455
+ if (__DEV__) {
456
+ succeeded = 'full';
457
+ } else {
458
+ log(errorMessage);
459
+ }
460
+ }
446
461
  }
447
462
  }
448
463
  if (sharedState.progressHandlers[hash]) {