expo-updates 58.0.20 → 58.0.22
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/CHANGELOG.md +20 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/updates/UpdatesUtils.kt +47 -25
- package/android/src/main/java/expo/modules/updates/loader/FileDownloader.kt +72 -34
- package/android/src/main/java/expo/modules/updates/statemachine/UpdatesStateMachine.kt +7 -1
- package/cli/build/cli.js +8 -8
- package/cli/build/cli.js.map +1 -1
- package/cli/src/cli.ts +1 -1
- package/ios/EXUpdates/UpdatesStateMachine.swift +6 -1
- package/package.json +6 -9
- package/utils/build/vcs.js +23 -14
- package/utils/build/vcs.js.map +1 -1
- package/utils/src/vcs.ts +22 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix gitignore discovery on older supported Node versions. ([#52960](https://github.com/expo/expo/pull/52960) by [@kitten](https://github.com/kitten))
|
|
8
|
+
- Use @expo/env instead of getenv to read environment variables. ([#52934](https://github.com/expo/expo/pull/52934) by [@kitten](https://github.com/kitten))
|
|
9
|
+
- Send download progress to JavaScript in 1% steps, so updates with many assets no longer use a large amount of memory while they download. ([#53250](https://github.com/expo/expo/pull/53250) by [@alanjhughes](https://github.com/alanjhughes))
|
|
10
|
+
- Updated dependencies. ([#52929](https://github.com/expo/expo/pull/52929), [#52934](https://github.com/expo/expo/pull/52934))
|
|
11
|
+
- @expo/plist@0.10.2
|
|
12
|
+
- @expo/env@2.6.0
|
|
13
|
+
|
|
14
|
+
## 58.0.21
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [Android] Fix a startup crash (`Compiling JS failed: Buffer is smaller than the size stated in the file header`) caused by a truncated update asset. Downloaded assets are now moved into place with an atomic rename after the hash is verified, instead of being stream-copied into the final path, and an asset file that already exists on disk is only reused when it matches the hash declared in the manifest. ([#51715](https://github.com/expo/expo/pull/51715) by [@AndreiCalazans](https://github.com/AndreiCalazans))
|
|
19
|
+
- Replace glob with Node glob and skip node_modules when discovering gitignore files. ([#52775](https://github.com/expo/expo/pull/52775) by [@kitten](https://github.com/kitten))
|
|
20
|
+
- Updated dependencies. ([#52688](https://github.com/expo/expo/pull/52688))
|
|
21
|
+
- @expo/env@2.5.4
|
|
22
|
+
|
|
3
23
|
## 58.0.20
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/android/build.gradle
CHANGED
|
@@ -42,7 +42,7 @@ expoModule {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
group = 'host.exp.exponent'
|
|
45
|
-
version = '58.0.
|
|
45
|
+
version = '58.0.22'
|
|
46
46
|
|
|
47
47
|
// Utility method to derive boolean values from the environment or from Java properties,
|
|
48
48
|
// and return them as strings to be used in BuildConfig fields
|
|
@@ -103,7 +103,7 @@ android {
|
|
|
103
103
|
namespace "expo.modules.updates"
|
|
104
104
|
defaultConfig {
|
|
105
105
|
versionCode 31
|
|
106
|
-
versionName '58.0.
|
|
106
|
+
versionName '58.0.22'
|
|
107
107
|
consumerProguardFiles("proguard-rules.pro")
|
|
108
108
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
109
109
|
|
|
@@ -113,39 +113,61 @@ object UpdatesUtils {
|
|
|
113
113
|
@Throws(NoSuchAlgorithmException::class, IOException::class)
|
|
114
114
|
fun verifySHA256AndWriteToFile(inputStream: InputStream, destination: File, expectedBase64URLEncodedHash: String?): ByteArray {
|
|
115
115
|
DigestInputStream(inputStream, MessageDigest.getInstance("SHA-256")).use { digestInputStream ->
|
|
116
|
-
//
|
|
117
|
-
//
|
|
116
|
+
// Write to a temporary path first and only move the file into place after the hash is
|
|
117
|
+
// verified. The move is a rename on the same filesystem, so the destination is either absent
|
|
118
|
+
// or complete; it can never be observed partially written. A streamed copy into the
|
|
119
|
+
// destination (the previous implementation) left a truncated file behind when the process
|
|
120
|
+
// was killed mid-copy, and that file was later trusted because it existed.
|
|
118
121
|
val tmpFile = File(destination.absolutePath + ".tmp")
|
|
119
122
|
tmpFile.parentFile?.mkdirs()
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
try {
|
|
124
|
+
digestInputStream.use { input ->
|
|
125
|
+
FileOutputStream(tmpFile).use { output ->
|
|
126
|
+
input.copyTo(output)
|
|
127
|
+
// flush to disk before the file becomes visible at the final path, so a reboot or
|
|
128
|
+
// power loss right after the move cannot leave a truncated file behind
|
|
129
|
+
output.fd.sync()
|
|
130
|
+
}
|
|
123
131
|
}
|
|
124
|
-
}
|
|
125
132
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
tmpFile.copyTo(destination, true)
|
|
140
|
-
} catch (e: NoSuchFileException) {
|
|
141
|
-
throw IOException("File download was successful, but temp file ${tmpFile.absolutePath} does not exist")
|
|
142
|
-
} catch (e: Exception) {
|
|
143
|
-
throw IOException("File download was successful, but an exception occurred: $e")
|
|
133
|
+
// this message digest must be read after the input stream has been consumed in order to get the hash correctly
|
|
134
|
+
val md = digestInputStream.messageDigest
|
|
135
|
+
val hash = md.digest()
|
|
136
|
+
val hashBase64String = toBase64Url(hash)
|
|
137
|
+
if (expectedBase64URLEncodedHash != null && expectedBase64URLEncodedHash != hashBase64String) {
|
|
138
|
+
throw IOException("File download was successful but base64url-encoded SHA-256 did not match expected; expected: $expectedBase64URLEncodedHash; actual: $hashBase64String")
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// if there are two assets with identical content, they will be written to the same file path,
|
|
142
|
+
// so we allow overwrites
|
|
143
|
+
moveFileAtomically(tmpFile, destination)
|
|
144
|
+
|
|
145
|
+
return hash
|
|
144
146
|
} finally {
|
|
145
147
|
tmpFile.delete()
|
|
146
148
|
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
147
151
|
|
|
148
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Moves [source] to [destination], replacing any existing file. The temp file and the destination
|
|
154
|
+
* live in the same directory, so `rename(2)` applies and the move is atomic. If the rename is
|
|
155
|
+
* rejected anyway (for example, the two paths end up on different mount points), fall back to a
|
|
156
|
+
* copy so the download still succeeds.
|
|
157
|
+
*/
|
|
158
|
+
@Throws(IOException::class)
|
|
159
|
+
internal fun moveFileAtomically(source: File, destination: File) {
|
|
160
|
+
if (!source.exists()) {
|
|
161
|
+
throw IOException("File download was successful, but temp file ${source.absolutePath} does not exist")
|
|
162
|
+
}
|
|
163
|
+
if (source.renameTo(destination)) {
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
Log.w(TAG, "Atomic rename of ${source.absolutePath} to ${destination.absolutePath} failed; falling back to copy")
|
|
167
|
+
try {
|
|
168
|
+
source.copyTo(destination, true)
|
|
169
|
+
} catch (e: Exception) {
|
|
170
|
+
throw IOException("File download was successful, but an exception occurred: $e")
|
|
149
171
|
}
|
|
150
172
|
}
|
|
151
173
|
|
|
@@ -773,47 +773,85 @@ class FileDownloader(
|
|
|
773
773
|
val path = File(destinationDirectory, filename)
|
|
774
774
|
|
|
775
775
|
if (path.exists()) {
|
|
776
|
-
asset
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
776
|
+
if (isExistingAssetFileValid(path, asset, requestedUpdate)) {
|
|
777
|
+
asset.relativePath = filename
|
|
778
|
+
return AssetDownloadResult(asset, false)
|
|
779
|
+
}
|
|
780
|
+
// the file on disk is not the asset we expect (for example, it was truncated when a previous
|
|
781
|
+
// process was killed); throw it away and download again
|
|
782
|
+
path.delete()
|
|
783
|
+
}
|
|
784
784
|
|
|
785
|
-
|
|
786
|
-
|
|
785
|
+
val canApplyPatch =
|
|
786
|
+
asset.isLaunchAsset &&
|
|
787
|
+
launchedUpdate != null &&
|
|
788
|
+
requestedUpdate != null &&
|
|
789
|
+
launchedUpdate.id != requestedUpdate.id
|
|
790
|
+
|
|
791
|
+
try {
|
|
792
|
+
val downloadResult = downloadAssetAndVerifyHashAndWriteToPath(
|
|
793
|
+
asset,
|
|
794
|
+
extraHeaders,
|
|
795
|
+
createRequestForAsset(
|
|
787
796
|
asset,
|
|
788
797
|
extraHeaders,
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
requestedUpdate = requestedUpdate,
|
|
802
|
-
embeddedAssetExtractor = embeddedAssetExtractor
|
|
803
|
-
)
|
|
798
|
+
configuration,
|
|
799
|
+
allowPatch = canApplyPatch
|
|
800
|
+
),
|
|
801
|
+
asset.expectedHash,
|
|
802
|
+
path,
|
|
803
|
+
destinationDirectory,
|
|
804
|
+
assetLoadProgressListener?.let { listener -> { listener.invoke(it) } },
|
|
805
|
+
allowPatch = canApplyPatch,
|
|
806
|
+
launchedUpdate = launchedUpdate,
|
|
807
|
+
requestedUpdate = requestedUpdate,
|
|
808
|
+
embeddedAssetExtractor = embeddedAssetExtractor
|
|
809
|
+
)
|
|
804
810
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
}
|
|
811
|
+
asset.downloadTime = Date()
|
|
812
|
+
asset.relativePath = filename
|
|
813
|
+
asset.hash = downloadResult.hash
|
|
814
|
+
return AssetDownloadResult(asset, true)
|
|
815
|
+
} catch (e: Exception) {
|
|
816
|
+
val message = "Failed to download asset ${asset.key}"
|
|
817
|
+
logger.error(message, e, UpdatesErrorCode.AssetsFailedToLoad)
|
|
818
|
+
throw IOException(message, e)
|
|
814
819
|
}
|
|
815
820
|
}
|
|
816
821
|
|
|
822
|
+
/**
|
|
823
|
+
* An asset file that already exists on disk is only reused when its contents match the hash the
|
|
824
|
+
* manifest declares for the asset. Trusting the file because it exists is unsafe: a process
|
|
825
|
+
* killed while the file was being written leaves a truncated file behind, and the launch asset
|
|
826
|
+
* then fails to load with a Hermes `Buffer is smaller than the size stated in the file header`
|
|
827
|
+
* error. When the manifest has no hash for the asset there is nothing to verify against, so the
|
|
828
|
+
* file is reused as before.
|
|
829
|
+
*/
|
|
830
|
+
private fun isExistingAssetFileValid(path: File, asset: AssetEntity, requestedUpdate: UpdateEntity?): Boolean {
|
|
831
|
+
val expectedHash = asset.expectedHash ?: return true
|
|
832
|
+
val actualHash = try {
|
|
833
|
+
UpdatesUtils.toBase64Url(UpdatesUtils.sha256(path))
|
|
834
|
+
} catch (e: Exception) {
|
|
835
|
+
logger.warn(
|
|
836
|
+
"Failed to hash existing file for asset ${asset.key}; re-downloading: ${e.message}",
|
|
837
|
+
UpdatesErrorCode.AssetsFailedToLoad,
|
|
838
|
+
requestedUpdate?.id?.toString(),
|
|
839
|
+
asset.key
|
|
840
|
+
)
|
|
841
|
+
return false
|
|
842
|
+
}
|
|
843
|
+
if (actualHash == expectedHash) {
|
|
844
|
+
return true
|
|
845
|
+
}
|
|
846
|
+
logger.warn(
|
|
847
|
+
"Existing file for asset ${asset.key} did not match expected hash (size ${path.length()} bytes); re-downloading",
|
|
848
|
+
UpdatesErrorCode.AssetsFailedToLoad,
|
|
849
|
+
requestedUpdate?.id?.toString(),
|
|
850
|
+
asset.key
|
|
851
|
+
)
|
|
852
|
+
return false
|
|
853
|
+
}
|
|
854
|
+
|
|
817
855
|
private suspend fun downloadData(request: Request, progressListener: FileDownloadProgressListener? = null): Response =
|
|
818
856
|
suspendCancellableCoroutine { continuation ->
|
|
819
857
|
val call = client.newCall(request)
|
|
@@ -11,6 +11,7 @@ import expo.modules.updatesinterface.UpdatesControllerRegistry
|
|
|
11
11
|
import kotlinx.coroutines.CoroutineScope
|
|
12
12
|
import kotlinx.coroutines.Dispatchers
|
|
13
13
|
import java.util.Date
|
|
14
|
+
import kotlin.math.floor
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* The Updates state machine class. There should be only one instance of this class
|
|
@@ -93,6 +94,7 @@ class UpdatesStateMachine(
|
|
|
93
94
|
*/
|
|
94
95
|
private fun processEvent(event: UpdatesStateEvent) {
|
|
95
96
|
if (transition(event)) {
|
|
97
|
+
val previousProgress = context.downloadProgress
|
|
96
98
|
context = reduceContext(context, event)
|
|
97
99
|
if (event !is UpdatesStateEvent.DownloadProgress) {
|
|
98
100
|
logger.info("Updates state change: ${event.type}, context = ${context.json}")
|
|
@@ -105,7 +107,9 @@ class UpdatesStateMachine(
|
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
|
-
|
|
110
|
+
if (event !is UpdatesStateEvent.DownloadProgress || floor(context.downloadProgress * 100) != floor(previousProgress * 100)) {
|
|
111
|
+
sendContextToJS()
|
|
112
|
+
}
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -255,12 +259,14 @@ class UpdatesStateMachine(
|
|
|
255
259
|
isDownloading = false,
|
|
256
260
|
downloadError = null,
|
|
257
261
|
isUpdatePending = true,
|
|
262
|
+
downloadProgress = 1.0,
|
|
258
263
|
downloadStartTime = null,
|
|
259
264
|
downloadFinishTime = null
|
|
260
265
|
)
|
|
261
266
|
is UpdatesStateEvent.DownloadCompleteWithUpdate -> context.copyAndIncrementSequenceNumber(
|
|
262
267
|
isDownloading = false,
|
|
263
268
|
downloadError = null,
|
|
269
|
+
downloadProgress = 1.0,
|
|
264
270
|
latestManifest = event.manifest,
|
|
265
271
|
downloadedManifest = event.manifest,
|
|
266
272
|
rollback = null,
|
package/cli/build/cli.js
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
function _env() {
|
|
7
|
+
const data = require("@expo/env");
|
|
8
|
+
_env = function() {
|
|
9
|
+
return data;
|
|
10
|
+
};
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
6
13
|
function _arg() {
|
|
7
14
|
const data = /*#__PURE__*/ _interop_require_default(require("arg"));
|
|
8
15
|
_arg = function() {
|
|
@@ -24,13 +31,6 @@ function _debug() {
|
|
|
24
31
|
};
|
|
25
32
|
return data;
|
|
26
33
|
}
|
|
27
|
-
function _getenv() {
|
|
28
|
-
const data = require("getenv");
|
|
29
|
-
_getenv = function() {
|
|
30
|
-
return data;
|
|
31
|
-
};
|
|
32
|
-
return data;
|
|
33
|
-
}
|
|
34
34
|
const _errors = require("./utils/errors");
|
|
35
35
|
const _log = /*#__PURE__*/ _interop_require_wildcard(require("./utils/log"));
|
|
36
36
|
function _interop_require_default(obj) {
|
|
@@ -80,7 +80,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
80
80
|
return newObj;
|
|
81
81
|
}
|
|
82
82
|
// Setup before requiring `debug`.
|
|
83
|
-
if ((0,
|
|
83
|
+
if ((0, _env().boolish)('EXPO_DEBUG', false)) {
|
|
84
84
|
_debug().default.enable('expo-updates:*');
|
|
85
85
|
} else if (_debug().default.enabled('expo-updates:')) {
|
|
86
86
|
process.env.EXPO_DEBUG = '1';
|
package/cli/build/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["cli.ts"],"sourcesContent":[null],"names":["boolish","Debug","enable","enabled","process","env","EXPO_DEBUG","commands","then","i","generateCodeSigning","configureCodeSigning","expoAssetsVerify","generateFingerprint","resolveRuntimeVersion","syncConfigurationToNative","args","arg","Boolean","permissive","packageJSON","require","console","log","version","exit","command","_","commandArgs","slice","Log","chalk","Object","keys","sort","join","push","on","error","exec","catch","logCmdError"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"sources":["cli.ts"],"sourcesContent":[null],"names":["boolish","Debug","enable","enabled","process","env","EXPO_DEBUG","commands","then","i","generateCodeSigning","configureCodeSigning","expoAssetsVerify","generateFingerprint","resolveRuntimeVersion","syncConfigurationToNative","args","arg","Boolean","permissive","packageJSON","require","console","log","version","exit","command","_","commandArgs","slice","Log","chalk","Object","keys","sort","join","push","on","error","exec","catch","logCmdError"],"mappings":";;;;;;yBACwB;;;;;;;gEACR;;;;;;;gEACE;;;;;;;gEACA;;;;;;wBAEU;6DACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,kCAAkC;AAClC,IAAIA,IAAAA,cAAO,EAAC,cAAc,QAAQ;IAChCC,gBAAK,CAACC,MAAM,CAAC;AACf,OAAO,IAAID,gBAAK,CAACE,OAAO,CAAC,kBAAkB;IACzCC,QAAQC,GAAG,CAACC,UAAU,GAAG;AAC3B;AAIA,MAAMC,WAA0D;IAC9D,yBAAyB;IACzB,wBAAwB,IACtB,MAAM,CAAC,4BAA4BC,IAAI,CAAC,CAACC,IAAMA,EAAEC,mBAAmB;IACtE,yBAAyB,IACvB,MAAM,CAAC,6BAA6BF,IAAI,CAAC,CAACC,IAAMA,EAAEE,oBAAoB;IACxE,iBAAiB,IAAM,MAAM,CAAC,qBAAqBH,IAAI,CAAC,CAACC,IAAMA,EAAEG,gBAAgB;IACjF,wBAAwB,IACtB,MAAM,CAAC,4BAA4BJ,IAAI,CAAC,CAACC,IAAMA,EAAEI,mBAAmB;IACtE,0BAA0B,IACxB,MAAM,CAAC,8BAA8BL,IAAI,CAAC,CAACC,IAAMA,EAAEK,qBAAqB;IAC1E,4BAA4B,IAC1B,MAAM,CAAC,kCAAkCN,IAAI,CAAC,CAACC,IAAMA,EAAEM,yBAAyB;AACpF;AAEA,MAAMC,OAAOC,IAAAA,cAAG,EACd;IACE,QAAQ;IACR,aAAaC;IACb,UAAUA;IAEV,UAAU;IACV,MAAM;AACR,GACA;IACEC,YAAY;AACd;AAGF,IAAIH,IAAI,CAAC,YAAY,EAAE;IACrB,wCAAwC;IACxC,MAAMI,cAAcC,QAAQ;IAC5BC,QAAQC,GAAG,CAACH,YAAYI,OAAO;IAC/BpB,QAAQqB,IAAI,CAAC;AACf;AAEA,MAAMC,UAAUV,KAAKW,CAAC,CAAC,EAAE;AACzB,MAAMC,cAAcZ,KAAKW,CAAC,CAACE,KAAK,CAAC;AAEjC,uBAAuB;AACvB,IAAI,AAACb,IAAI,CAAC,SAAS,IAAI,CAACU,WAAY,CAACA,SAAS;IAC5CI,KAAIL,IAAI,CACNM,IAAAA,gBAAK,CAAA,CAAC;;;;;EAKR,EAAEC,OAAOC,IAAI,CAAC1B,UAAU2B,IAAI,GAAGC,IAAI,CAAC,MAAM;;;;;;;EAO1C,CAAC,EACC;AAEJ;AAEA,6CAA6C;AAC7C,IAAInB,IAAI,CAAC,SAAS,EAAE;IAClBY,YAAYQ,IAAI,CAAC;AACnB;AAEA,qBAAqB;AACrBhC,QAAQiC,EAAE,CAAC,UAAU,IAAMjC,QAAQqB,IAAI,CAAC;AACxCrB,QAAQiC,EAAE,CAAC,WAAW,IAAMjC,QAAQqB,IAAI,CAAC;AAEzC,IAAI,CAAClB,QAAQ,CAACmB,QAAQ,EAAE;IACtBJ,QAAQgB,KAAK,CAAC,CAAC,iBAAiB,EAAEZ,SAAS;IAC3CtB,QAAQqB,IAAI,CAAC;AACf;AAEAlB,QAAQ,CAACmB,QAAQ,GACdlB,IAAI,CAAC,CAAC+B,OAASA,KAAKX,cACpBY,KAAK,CAACC,mBAAW"}
|
package/cli/src/cli.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { boolish } from '@expo/env';
|
|
2
3
|
import arg from 'arg';
|
|
3
4
|
import chalk from 'chalk';
|
|
4
5
|
import Debug from 'debug';
|
|
5
|
-
import { boolish } from 'getenv';
|
|
6
6
|
|
|
7
7
|
import { logCmdError } from './utils/errors';
|
|
8
8
|
import * as Log from './utils/log';
|
|
@@ -409,6 +409,7 @@ internal class UpdatesStateMachine {
|
|
|
409
409
|
private func processEvent(_ event: UpdatesStateEvent) {
|
|
410
410
|
// Execute state transition
|
|
411
411
|
if transition(event) {
|
|
412
|
+
let previousProgress = context.downloadProgress
|
|
412
413
|
// Only change context if transition succeeds
|
|
413
414
|
context = reducedContext(context, event)
|
|
414
415
|
if event.type != .downloadProgress {
|
|
@@ -420,7 +421,9 @@ internal class UpdatesStateMachine {
|
|
|
420
421
|
listener.updatesStateDidChange(event.toMap)
|
|
421
422
|
}
|
|
422
423
|
}
|
|
423
|
-
|
|
424
|
+
if event.type != .downloadProgress || (context.downloadProgress * 100).rounded(.down) != (previousProgress * 100).rounded(.down) {
|
|
425
|
+
sendContextToJS()
|
|
426
|
+
}
|
|
424
427
|
}
|
|
425
428
|
}
|
|
426
429
|
internal func processEventForTesting(_ event: UpdatesStateEvent) {
|
|
@@ -547,6 +550,7 @@ internal class UpdatesStateMachine {
|
|
|
547
550
|
$0.isDownloading = false
|
|
548
551
|
$0.downloadError = nil
|
|
549
552
|
$0.isUpdatePending = true
|
|
553
|
+
$0.downloadProgress = 1.0
|
|
550
554
|
$0.downloadStartTime = nil
|
|
551
555
|
$0.downloadFinishTime = nil
|
|
552
556
|
}
|
|
@@ -554,6 +558,7 @@ internal class UpdatesStateMachine {
|
|
|
554
558
|
return context.copyAndIncrementSequenceNumber {
|
|
555
559
|
$0.isDownloading = false
|
|
556
560
|
$0.downloadError = nil
|
|
561
|
+
$0.downloadProgress = 1.0
|
|
557
562
|
$0.latestManifest = manifest
|
|
558
563
|
$0.downloadedManifest = manifest
|
|
559
564
|
$0.rollback = nil
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-updates",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.22",
|
|
4
4
|
"description": "Fetches and manages remotely-hosted assets and updates to your app's JS bundle.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expo",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@expo/code-signing-certificates": "^0.0.7",
|
|
49
|
-
"@expo/env": "^2.
|
|
50
|
-
"@expo/plist": "^0.10.
|
|
49
|
+
"@expo/env": "^2.6.0",
|
|
50
|
+
"@expo/plist": "^0.10.2",
|
|
51
51
|
"@expo/spawn-async": "^1.8.0",
|
|
52
52
|
"@react-native/asset-utils": "0.88.1",
|
|
53
53
|
"arg": "^4.1.0",
|
|
@@ -57,25 +57,22 @@
|
|
|
57
57
|
"expo-manifests": "~58.0.1",
|
|
58
58
|
"expo-structured-headers": "~58.0.1",
|
|
59
59
|
"expo-updates-interface": "~58.0.1",
|
|
60
|
-
"getenv": "^2.0.0",
|
|
61
|
-
"glob": "^13.0.0",
|
|
62
60
|
"ignore": "^5.3.1",
|
|
63
61
|
"nullthrows": "^1.1.1",
|
|
64
62
|
"resolve-from": "^5.0.0"
|
|
65
63
|
},
|
|
66
64
|
"devDependencies": {
|
|
67
|
-
"@expo/internal-scripts": "58.0.
|
|
68
|
-
"@expo/metro-config": "58.0.
|
|
65
|
+
"@expo/internal-scripts": "58.0.6",
|
|
66
|
+
"@expo/metro-config": "58.0.22",
|
|
69
67
|
"@testing-library/react-native": "^14.0.1",
|
|
70
68
|
"@types/debug": "^4.1.7",
|
|
71
|
-
"@types/getenv": "^1.0.3",
|
|
72
69
|
"@types/jest": "^30.0.0",
|
|
73
70
|
"@types/node": "^22.14.0",
|
|
74
71
|
"@types/node-forge": "^1.0.0",
|
|
75
72
|
"@types/picomatch": "^4.0.0",
|
|
76
73
|
"@types/react": "~19.3.0",
|
|
77
74
|
"@vercel/ncc": "^0.38.4",
|
|
78
|
-
"expo-dev-client": "58.0.
|
|
75
|
+
"expo-dev-client": "58.0.19",
|
|
79
76
|
"express": "^5.1.0",
|
|
80
77
|
"form-data": "^4.0.4",
|
|
81
78
|
"memfs": "^3.6.0",
|
package/utils/build/vcs.js
CHANGED
|
@@ -22,13 +22,6 @@ function _promises() {
|
|
|
22
22
|
};
|
|
23
23
|
return data;
|
|
24
24
|
}
|
|
25
|
-
function _glob() {
|
|
26
|
-
const data = require("glob");
|
|
27
|
-
_glob = function() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
25
|
function _ignore() {
|
|
33
26
|
const data = /*#__PURE__*/ _interop_require_default(require("ignore"));
|
|
34
27
|
_ignore = function() {
|
|
@@ -135,13 +128,7 @@ node_modules
|
|
|
135
128
|
this.rootDir = rootDir;
|
|
136
129
|
}
|
|
137
130
|
async initIgnoreAsync() {
|
|
138
|
-
const ignoreFilePaths = (await (
|
|
139
|
-
cwd: this.rootDir,
|
|
140
|
-
ignore: [
|
|
141
|
-
'node_modules'
|
|
142
|
-
],
|
|
143
|
-
follow: false
|
|
144
|
-
}))// ensure that parent dir is before child directories
|
|
131
|
+
const ignoreFilePaths = (await findIgnoreFilesAsync(this.rootDir))// ensure that parent dir is before child directories
|
|
145
132
|
.sort((a, b)=>a.length - b.length && a.localeCompare(b));
|
|
146
133
|
const ignoreMapping = await Promise.all(ignoreFilePaths.map(async (filePath)=>{
|
|
147
134
|
return [
|
|
@@ -166,5 +153,27 @@ node_modules
|
|
|
166
153
|
return false;
|
|
167
154
|
}
|
|
168
155
|
}
|
|
156
|
+
async function findIgnoreFilesAsync(root) {
|
|
157
|
+
const files = [];
|
|
158
|
+
const directories = [
|
|
159
|
+
''
|
|
160
|
+
];
|
|
161
|
+
for (const directory of directories){
|
|
162
|
+
const entries = await _promises().default.readdir(_path().default.join(root, directory), {
|
|
163
|
+
withFileTypes: true
|
|
164
|
+
}).catch(()=>[]);
|
|
165
|
+
for (const entry of entries){
|
|
166
|
+
const file = _path().default.join(directory, entry.name);
|
|
167
|
+
if (entry.isDirectory()) {
|
|
168
|
+
if (entry.name !== 'node_modules' && !entry.name.startsWith('.')) {
|
|
169
|
+
directories.push(file);
|
|
170
|
+
}
|
|
171
|
+
} else if (entry.name === GITIGNORE_FILENAME) {
|
|
172
|
+
files.push(file);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return files;
|
|
177
|
+
}
|
|
169
178
|
|
|
170
179
|
//# sourceMappingURL=vcs.js.map
|
package/utils/build/vcs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["vcs.ts"],"sourcesContent":[null],"names":["getVCSClientAsync","projectDir","isGitInstalledAndConfiguredAsync","GitClient","NoVCSClient","getRootPathAsync","spawnAsync","stdout","trim","isFileIgnoredAsync","filePath","cwd","path","normalize","ignore","Ignore","initIgnoreAsync","ignores","error","code","GITIGNORE_FILENAME","DEFAULT_IGNORE","ignoreMapping","rootDir","ignoreFilePaths","
|
|
1
|
+
{"version":3,"sources":["vcs.ts"],"sourcesContent":[null],"names":["getVCSClientAsync","projectDir","isGitInstalledAndConfiguredAsync","GitClient","NoVCSClient","getRootPathAsync","spawnAsync","stdout","trim","isFileIgnoredAsync","filePath","cwd","path","normalize","ignore","Ignore","initIgnoreAsync","ignores","error","code","GITIGNORE_FILENAME","DEFAULT_IGNORE","ignoreMapping","rootDir","ignoreFilePaths","findIgnoreFilesAsync","sort","a","b","length","localeCompare","Promise","all","map","slice","createIgnore","add","fs","readFile","join","relativePath","prefix","startsWith","root","files","directories","directory","entries","readdir","withFileTypes","catch","entry","file","name","isDirectory","push"],"mappings":";;;;+BAUA;;;eAA8BA;;;;gEAVP;;;;;;;gEACR;;;;;;;gEAC0C;;;;;;;gEACxC;;;;;;;;;;;AAOF,eAAeA,kBAAkBC,UAAkB;IAChE,IAAI,MAAMC,oCAAoC;QAC5C,OAAO,IAAIC;IACb,OAAO;QACL,OAAO,IAAIC,YAAYH;IACzB;AACF;AAEA,MAAME;IACJ,MAAaE,mBAAoC;QAC/C,OAAO,AAAC,CAAA,MAAMC,IAAAA,qBAAU,EAAC,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YAAYU,IAAI,CAACH;gBACnB;YACF,OAAO,IAAID,MAAME,IAAI,KAAKjC,oBAAoB;gBAC5CwB,MAAMW,IAAI,CAACH;YACb;QACF;IACF;IACA,OAAOR;AACT"}
|
package/utils/src/vcs.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import spawnAsync from '@expo/spawn-async';
|
|
2
2
|
import fs from 'fs/promises';
|
|
3
|
-
import { glob } from 'glob';
|
|
4
3
|
import createIgnore, { Ignore as SingleFileIgnore } from 'ignore';
|
|
5
4
|
import path from 'path';
|
|
6
5
|
|
|
@@ -91,13 +90,7 @@ class Ignore {
|
|
|
91
90
|
constructor(private rootDir: string) {}
|
|
92
91
|
|
|
93
92
|
public async initIgnoreAsync(): Promise<void> {
|
|
94
|
-
const ignoreFilePaths = (
|
|
95
|
-
await glob(`**/${GITIGNORE_FILENAME}`, {
|
|
96
|
-
cwd: this.rootDir,
|
|
97
|
-
ignore: ['node_modules'],
|
|
98
|
-
follow: false,
|
|
99
|
-
})
|
|
100
|
-
)
|
|
93
|
+
const ignoreFilePaths = (await findIgnoreFilesAsync(this.rootDir))
|
|
101
94
|
// ensure that parent dir is before child directories
|
|
102
95
|
.sort((a, b) => a.length - b.length && a.localeCompare(b));
|
|
103
96
|
|
|
@@ -121,3 +114,24 @@ class Ignore {
|
|
|
121
114
|
return false;
|
|
122
115
|
}
|
|
123
116
|
}
|
|
117
|
+
|
|
118
|
+
async function findIgnoreFilesAsync(root: string): Promise<string[]> {
|
|
119
|
+
const files: string[] = [];
|
|
120
|
+
const directories = [''];
|
|
121
|
+
for (const directory of directories) {
|
|
122
|
+
const entries = await fs
|
|
123
|
+
.readdir(path.join(root, directory), { withFileTypes: true })
|
|
124
|
+
.catch(() => []);
|
|
125
|
+
for (const entry of entries) {
|
|
126
|
+
const file = path.join(directory, entry.name);
|
|
127
|
+
if (entry.isDirectory()) {
|
|
128
|
+
if (entry.name !== 'node_modules' && !entry.name.startsWith('.')) {
|
|
129
|
+
directories.push(file);
|
|
130
|
+
}
|
|
131
|
+
} else if (entry.name === GITIGNORE_FILENAME) {
|
|
132
|
+
files.push(file);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return files;
|
|
137
|
+
}
|