expo-modules-core 55.0.25 → 55.0.27

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 CHANGED
@@ -10,6 +10,18 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 55.0.27 — 2026-10-21
14
+
15
+ ### 💡 Others
16
+
17
+ - [Android] Improve performance of `PersistentFileLog`. ([#45058](https://github.com/expo/expo/pull/45058) by [@lukmccall](https://github.com/lukmccall))
18
+
19
+ ## 55.0.26 — 2026-08-31
20
+
21
+ ### 💡 Others
22
+
23
+ - Migrated from deprecated react-native-worklets WorkletRuntime API `executeSync` to up-to-date `runSync`. `runSync` is available since 0.7.0. ([#48691](https://github.com/expo/expo/pull/48691) by [@tjzel](https://github.com/tjzel))
24
+
13
25
  ## 55.0.25 — 2026-05-05
14
26
 
15
27
  _This version does not introduce any user-facing changes._
@@ -29,7 +29,7 @@ if (shouldIncludeCompose) {
29
29
  }
30
30
 
31
31
  group = 'host.exp.exponent'
32
- version = '55.0.25'
32
+ version = '55.0.27'
33
33
 
34
34
  def isExpoModulesCoreTests = {
35
35
  Gradle gradle = getGradle()
@@ -96,7 +96,7 @@ android {
96
96
  defaultConfig {
97
97
  consumerProguardFiles 'proguard-rules.pro'
98
98
  versionCode 1
99
- versionName "55.0.25"
99
+ versionName "55.0.27"
100
100
  buildConfigField "String", "EXPO_MODULES_CORE_VERSION", "\"${versionName}\""
101
101
  buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", "true"
102
102
 
@@ -24,10 +24,7 @@ namespace expo {
24
24
  return;
25
25
  }
26
26
 
27
- workletRuntime->executeSync([func = std::move(func)](jsi::Runtime &rt) -> jsi::Value {
28
- func(rt);
29
- return jsi::Value::undefined();
30
- });
27
+ workletRuntime->runSync(func);
31
28
  }
32
29
  } // namespace expo
33
30
 
@@ -2,6 +2,7 @@ package expo.modules.core.logging
2
2
 
3
3
  import java.io.File
4
4
  import java.io.IOException
5
+ import java.io.PrintWriter
5
6
  import java.nio.charset.Charset
6
7
 
7
8
  /**
@@ -25,6 +26,11 @@ class PersistentFileLog(
25
26
  category: String,
26
27
  filesDirectory: File
27
28
  ) {
29
+ private val filePath = "${filesDirectory.path}/$FILE_NAME_PREFIX.$category"
30
+
31
+ init {
32
+ ensureFileExists()
33
+ }
28
34
 
29
35
  /**
30
36
  * Read entries from log file
@@ -43,7 +49,6 @@ class PersistentFileLog(
43
49
  fun appendEntry(entry: String, completionHandler: ((_: Error?) -> Unit) = { }) {
44
50
  queue.add {
45
51
  try {
46
- this.ensureFileExists()
47
52
  val text = when (this.getFileSize()) {
48
53
  0L -> entry
49
54
  else -> {
@@ -66,7 +71,6 @@ class PersistentFileLog(
66
71
  fun purgeEntriesNotMatchingFilter(filter: (_: String) -> Boolean, completionHandler: (_: Exception?) -> Unit) {
67
72
  queue.add {
68
73
  try {
69
- this.ensureFileExists()
70
74
  val contents = this.readFileLinesSync()
71
75
  val reducedContents = contents.filter(filter)
72
76
  this.writeFileLinesSync(reducedContents)
@@ -83,7 +87,10 @@ class PersistentFileLog(
83
87
  fun clearEntries(completionHandler: (_: Error?) -> Unit) {
84
88
  queue.add {
85
89
  try {
86
- this.deleteFileSync()
90
+ // Clearing the file can be done by writing an empty string to it
91
+ PrintWriter(File(filePath)).use { writer ->
92
+ writer.print("")
93
+ }
87
94
  completionHandler.invoke(null)
88
95
  } catch (e: Error) {
89
96
  completionHandler.invoke(e)
@@ -93,8 +100,6 @@ class PersistentFileLog(
93
100
 
94
101
  // Private functions
95
102
 
96
- private val filePath = "${filesDirectory.path}/$FILE_NAME_PREFIX.$category"
97
-
98
103
  private fun ensureFileExists() {
99
104
  val fd = File(filePath)
100
105
  if (!fd.exists()) {
@@ -110,12 +115,10 @@ class PersistentFileLog(
110
115
  if (!file.exists()) {
111
116
  return 0L
112
117
  }
113
- return try {
114
- file.inputStream().use { it.channel.size() }
115
- } catch (e: IOException) {
116
- // File does not exist or is inaccessible
117
- 0L
118
- }
118
+
119
+ return runCatching {
120
+ file.length()
121
+ }.getOrDefault(0L)
119
122
  }
120
123
 
121
124
  private fun appendTextToFile(text: String) {
@@ -130,13 +133,6 @@ class PersistentFileLog(
130
133
  File(filePath).writeText(entries.joinToString("\n"), Charset.defaultCharset())
131
134
  }
132
135
 
133
- private fun deleteFileSync() {
134
- val fd = File(filePath)
135
- if (fd.exists()) {
136
- fd.delete()
137
- }
138
- }
139
-
140
136
  companion object {
141
137
  private val queue = PersistentFileLogSerialDispatchQueue()
142
138
  private const val FILE_NAME_PREFIX = "dev.expo.modules.core.logging"
@@ -1,27 +1,15 @@
1
1
  package expo.modules.core.logging
2
2
 
3
- import kotlinx.coroutines.DelicateCoroutinesApi
4
- import kotlinx.coroutines.GlobalScope
5
- import kotlinx.coroutines.channels.Channel
6
- import kotlinx.coroutines.launch
7
- import kotlinx.coroutines.runBlocking
3
+ import java.util.concurrent.Executors
8
4
 
9
5
  internal typealias PersistentFileLogSerialDispatchQueueBlock = () -> Unit
10
6
 
11
7
  internal class PersistentFileLogSerialDispatchQueue {
12
- private val channel = Channel<PersistentFileLogSerialDispatchQueueBlock>(Channel.BUFFERED)
13
-
14
- // Queue a block in the channel
15
- fun add(block: PersistentFileLogSerialDispatchQueueBlock) = runBlocking { channel.send(block) }
16
-
17
- fun stop() = queueRunner.cancel()
8
+ fun add(block: PersistentFileLogSerialDispatchQueueBlock) {
9
+ executor.execute(block)
10
+ }
18
11
 
19
- // On creation, this starts and runs for the lifetime of the app, pulling blocks off the channel
20
- // and running them as needed
21
- @OptIn(DelicateCoroutinesApi::class)
22
- private val queueRunner = GlobalScope.launch {
23
- while (true) {
24
- channel.receive()()
25
- }
12
+ companion object {
13
+ private val executor = Executors.newSingleThreadExecutor()
26
14
  }
27
15
  }
@@ -82,7 +82,7 @@
82
82
  return;
83
83
  }
84
84
 
85
- workletRuntime->executeSync([worklet, arguments](jsi::Runtime &rt) -> jsi::Value {
85
+ workletRuntime->runSync([worklet, arguments](jsi::Runtime &rt) -> jsi::Value {
86
86
  std::vector<jsi::Value> convertedArgs = expo::convertNSArrayToStdVector(rt, arguments);
87
87
 
88
88
  auto func = worklet->toJSValue(rt).asObject(rt).asFunction(rt);
@@ -25,10 +25,7 @@ void WorkletJSCallInvoker::invokeSync(react::CallFunc &&func) {
25
25
  return;
26
26
  }
27
27
 
28
- workletRuntime->executeSync([func = std::move(func)](jsi::Runtime &rt) -> jsi::Value {
29
- func(rt);
30
- return jsi::Value::undefined();
31
- });
28
+ workletRuntime->runSync(func);
32
29
  }
33
30
 
34
31
  } // namespace expo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-core",
3
- "version": "55.0.25",
3
+ "version": "55.0.27",
4
4
  "description": "The core of Expo Modules architecture",
5
5
  "main": "src/index.ts",
6
6
  "types": "build/index.d.ts",
@@ -72,5 +72,5 @@
72
72
  "@testing-library/react-native": "^13.3.0",
73
73
  "expo-module-scripts": "^55.0.2"
74
74
  },
75
- "gitHead": "7c081282cf88968f81732feb67a71840e769a40f"
75
+ "gitHead": "0cf0c5a69371bf46b796226ab69a20a77a344e91"
76
76
  }