expo-router 58.0.3 → 58.0.4

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 (160) hide show
  1. package/android/build.gradle +2 -2
  2. package/android/src/main/java/expo/modules/router/ExpoRouterModule.kt +134 -0
  3. package/expo-module.config.json +1 -1
  4. package/{android/build/publications/release/module.json → local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.module} +7 -7
  5. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.module.md5 +1 -0
  6. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.module.sha1 +1 -0
  7. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.module.sha256 +1 -0
  8. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.module.sha512 +1 -0
  9. package/{android/build/publications/release/pom-default.xml → local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.pom} +1 -1
  10. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.pom.md5 +1 -0
  11. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.pom.sha1 +1 -0
  12. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.pom.sha256 +1 -0
  13. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.pom.sha512 +1 -0
  14. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
  15. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
  16. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
  17. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
  18. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
  19. package/package.json +12 -11
  20. package/plugin/build/withRouter.d.ts +10 -2
  21. package/plugin/build/withRouter.js +12 -0
  22. package/plugin/build/withRouter.js.map +1 -1
  23. package/plugin/options.json +6 -2
  24. package/plugin/src/__tests__/withRouter.test.ts +25 -0
  25. package/plugin/src/index.ts +3 -0
  26. package/plugin/src/withRouter.ts +172 -0
  27. package/android/.gitignore +0 -70
  28. package/android/build/intermediates/aapt_friendly_merged_manifests/release/processReleaseManifest/aapt/AndroidManifest.xml +0 -7
  29. package/android/build/intermediates/aapt_friendly_merged_manifests/release/processReleaseManifest/aapt/output-metadata.json +0 -18
  30. package/android/build/intermediates/aar_main_jar/release/syncReleaseLibJars/classes.jar +0 -0
  31. package/android/build/intermediates/aar_metadata/release/writeReleaseAarMetadata/aar-metadata.properties +0 -7
  32. package/android/build/intermediates/annotation_processor_list/release/javaPreCompileRelease/annotationProcessors.json +0 -1
  33. package/android/build/intermediates/annotations_typedef_file/release/extractReleaseAnnotations/typedefs.txt +0 -0
  34. package/android/build/intermediates/compile_r_class_jar/release/generateReleaseRFile/R.jar +0 -0
  35. package/android/build/intermediates/compile_symbol_list/release/generateReleaseRFile/R.txt +0 -0
  36. package/android/build/intermediates/incremental/mergeReleaseAssets/merger.xml +0 -2
  37. package/android/build/intermediates/incremental/mergeReleaseJniLibFolders/merger.xml +0 -2
  38. package/android/build/intermediates/incremental/release/packageReleaseResources/compile-file-map.properties +0 -1
  39. package/android/build/intermediates/incremental/release/packageReleaseResources/merger.xml +0 -2
  40. package/android/build/intermediates/incremental/release-mergeJavaRes/merge-state +0 -0
  41. package/android/build/intermediates/java_res/release/processReleaseJavaRes/out/META-INF/expo-router_release.kotlin_module +0 -0
  42. package/android/build/intermediates/local_only_symbol_list/release/parseReleaseLocalResources/R-def.txt +0 -2
  43. package/android/build/intermediates/manifest_merge_blame_file/release/processReleaseManifest/manifest-merger-blame-release-report.txt +0 -9
  44. package/android/build/intermediates/merged_java_res/release/mergeReleaseJavaResource/feature-expo-router.jar +0 -0
  45. package/android/build/intermediates/merged_manifest/release/processReleaseManifest/AndroidManifest.xml +0 -7
  46. package/android/build/intermediates/nested_resources_validation_report/release/generateReleaseResources/nestedResourcesValidationReport.txt +0 -1
  47. package/android/build/intermediates/symbol_list_with_package_name/release/generateReleaseRFile/package-aware-r.txt +0 -1
  48. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  49. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  50. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  51. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  52. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  53. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  54. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  55. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  56. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  57. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  58. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  59. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  60. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  61. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  62. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  63. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  64. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  65. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  66. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  67. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  68. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  69. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  70. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  71. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  72. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  73. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  74. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  75. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  76. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  77. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  78. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  79. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  80. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  81. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  82. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  83. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  84. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  85. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  86. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  87. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  88. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  89. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  90. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  91. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  92. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  93. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  94. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  95. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  96. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  97. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  98. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  99. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  100. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  101. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  102. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  103. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  104. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
  105. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  106. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  107. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  108. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  109. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  110. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  111. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  112. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  113. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  114. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  115. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  116. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  117. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  118. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  119. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  120. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  121. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  122. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  123. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  124. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  125. package/android/build/kotlin/compileReleaseKotlin/cacheable/last-build.bin +0 -0
  126. package/android/build/kotlin/compileReleaseKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  127. package/android/build/outputs/logs/manifest-merger-release-report.txt +0 -16
  128. package/android/build/tmp/kotlin-classes/release/META-INF/expo-router_release.kotlin_module +0 -0
  129. package/android/build/tmp/kotlin-classes/release/expo/modules/router/ExpoRouterModule$Companion.class +0 -0
  130. package/android/build/tmp/kotlin-classes/release/expo/modules/router/ExpoRouterModule$definition$lambda$2$$inlined$Function$1.class +0 -0
  131. package/android/build/tmp/kotlin-classes/release/expo/modules/router/ExpoRouterModule$definition$lambda$2$$inlined$Function$2.class +0 -0
  132. package/android/build/tmp/kotlin-classes/release/expo/modules/router/ExpoRouterModule$definition$lambda$2$$inlined$Function$3.class +0 -0
  133. package/android/build/tmp/kotlin-classes/release/expo/modules/router/ExpoRouterModule$definition$lambda$2$$inlined$Function$4.class +0 -0
  134. package/android/build/tmp/kotlin-classes/release/expo/modules/router/ExpoRouterModule$definition$lambda$2$$inlined$Function$5.class +0 -0
  135. package/android/build/tmp/kotlin-classes/release/expo/modules/router/ExpoRouterModule$definition$lambda$2$$inlined$Function$6.class +0 -0
  136. package/android/build/tmp/kotlin-classes/release/expo/modules/router/ExpoRouterModule.class +0 -0
  137. package/android/build/tmp/publishReleasePublicationToNPMPackageRepository/module-maven-metadata.xml +0 -13
  138. package/android/build/tmp/sourceReleaseJar/MANIFEST.MF +0 -2
  139. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3-sources.jar +0 -0
  140. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.aar +0 -0
  141. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.module +0 -108
  142. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.module.md5 +0 -1
  143. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.module.sha1 +0 -1
  144. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.module.sha256 +0 -1
  145. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.module.sha512 +0 -1
  146. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.pom +0 -65
  147. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.pom.md5 +0 -1
  148. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.pom.sha1 +0 -1
  149. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.pom.sha256 +0 -1
  150. package/local-maven-repo/expo/modules/router/expo.modules.router/58.0.3/expo.modules.router-58.0.3.pom.sha512 +0 -1
  151. /package/{android/build/intermediates/source_jar/release/release-sources.jar → local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4-sources.jar} +0 -0
  152. /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.3/expo.modules.router-58.0.3-sources.jar.md5 → 58.0.4/expo.modules.router-58.0.4-sources.jar.md5} +0 -0
  153. /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.3/expo.modules.router-58.0.3-sources.jar.sha1 → 58.0.4/expo.modules.router-58.0.4-sources.jar.sha1} +0 -0
  154. /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.3/expo.modules.router-58.0.3-sources.jar.sha256 → 58.0.4/expo.modules.router-58.0.4-sources.jar.sha256} +0 -0
  155. /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.3/expo.modules.router-58.0.3-sources.jar.sha512 → 58.0.4/expo.modules.router-58.0.4-sources.jar.sha512} +0 -0
  156. /package/{android/build/outputs/aar/expo-router-release.aar → local-maven-repo/expo/modules/router/expo.modules.router/58.0.4/expo.modules.router-58.0.4.aar} +0 -0
  157. /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.3/expo.modules.router-58.0.3.aar.md5 → 58.0.4/expo.modules.router-58.0.4.aar.md5} +0 -0
  158. /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.3/expo.modules.router-58.0.3.aar.sha1 → 58.0.4/expo.modules.router-58.0.4.aar.sha1} +0 -0
  159. /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.3/expo.modules.router-58.0.3.aar.sha256 → 58.0.4/expo.modules.router-58.0.4.aar.sha256} +0 -0
  160. /package/local-maven-repo/expo/modules/router/expo.modules.router/{58.0.3/expo.modules.router-58.0.3.aar.sha512 → 58.0.4/expo.modules.router-58.0.4.aar.sha512} +0 -0
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'expo.modules.router'
7
- version = '58.0.3'
7
+ version = '58.0.4'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.router"
11
11
  defaultConfig {
12
12
  versionCode 1
13
- versionName "58.0.3"
13
+ versionName "58.0.4"
14
14
  }
15
15
  lintOptions {
16
16
  abortOnError false
@@ -0,0 +1,134 @@
1
+ package expo.modules.router
2
+
3
+ import android.content.Context
4
+ import android.content.res.Configuration
5
+ import android.graphics.Color
6
+ import expo.modules.kotlin.exception.Exceptions
7
+ import expo.modules.kotlin.modules.Module
8
+ import expo.modules.kotlin.modules.ModuleDefinition
9
+ import androidx.appcompat.view.ContextThemeWrapper
10
+ import com.google.android.material.color.MaterialColors
11
+
12
+ class ExpoRouterModule : Module() {
13
+ private val context: Context
14
+ get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
15
+
16
+ override fun definition() = ModuleDefinition {
17
+ Name("ExpoRouter")
18
+
19
+ Function("Material3Color") { name: String, scheme: String ->
20
+ materialColor(name, scheme)
21
+ }
22
+
23
+ Function("Material3DynamicColor") { name: String, scheme: String ->
24
+ dynamicColor(name, scheme)
25
+ }
26
+ }
27
+
28
+ private fun materialColor(name: String, scheme: String): String? {
29
+ val scheme = if (scheme != "dark" && scheme != "light") {
30
+ getSystemScheme()
31
+ } else {
32
+ scheme
33
+ }
34
+
35
+ val theme = if (scheme == "dark") {
36
+ com.google.android.material.R.style.Theme_Material3_Dark
37
+ } else {
38
+ com.google.android.material.R.style.Theme_Material3_Light
39
+ }
40
+
41
+ return getColorFromTheme(name, theme)
42
+ }
43
+
44
+ private fun dynamicColor(name: String, scheme: String): String? {
45
+ val scheme = if (scheme != "dark" && scheme != "light") {
46
+ getSystemScheme()
47
+ } else {
48
+ scheme
49
+ }
50
+
51
+ val theme = if (scheme == "dark") {
52
+ com.google.android.material.R.style.Theme_Material3_DynamicColors_Dark
53
+ } else {
54
+ com.google.android.material.R.style.Theme_Material3_DynamicColors_Light
55
+ }
56
+
57
+ return getColorFromTheme(name, theme)
58
+ }
59
+
60
+ private fun getColorFromTheme(name: String, themeResId: Int): String? {
61
+ val wrappedContext = ContextThemeWrapper(context, themeResId)
62
+ val attr = attrMap[name.lowercase()]
63
+ ?: return null
64
+
65
+ return MaterialColors.getColorOrNull(wrappedContext, attr)?.let { colorToHex(it) }
66
+ }
67
+
68
+ private fun getSystemScheme(): String {
69
+ val currentNightMode =
70
+ context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
71
+ return when (currentNightMode) {
72
+ Configuration.UI_MODE_NIGHT_YES -> "dark"
73
+ Configuration.UI_MODE_NIGHT_NO -> "light"
74
+ else -> "light"
75
+ }
76
+ }
77
+
78
+ companion object {
79
+ fun colorToHex(color: Int): String {
80
+ return String.format("#%02x%02x%02x", Color.red(color), Color.green(color), Color.blue(color))
81
+ }
82
+
83
+ val attrMap = mapOf(
84
+ // Some of the colors are androidx.appcompat.*
85
+ // https://github.com/material-components/material-components-android/issues/4709
86
+ "primary" to androidx.appcompat.R.attr.colorPrimary,
87
+ "onprimary" to com.google.android.material.R.attr.colorOnPrimary,
88
+ "primarycontainer" to com.google.android.material.R.attr.colorPrimaryContainer,
89
+ "onprimarycontainer" to com.google.android.material.R.attr.colorOnPrimaryContainer,
90
+ "primaryinverse" to com.google.android.material.R.attr.colorPrimaryInverse,
91
+ "primaryfixed" to com.google.android.material.R.attr.colorPrimaryFixed,
92
+ "primaryfixeddim" to com.google.android.material.R.attr.colorPrimaryFixedDim,
93
+ "onprimaryfixed" to com.google.android.material.R.attr.colorOnPrimaryFixed,
94
+ "onprimaryfixedvariant" to com.google.android.material.R.attr.colorOnPrimaryFixedVariant,
95
+ "secondary" to com.google.android.material.R.attr.colorSecondary,
96
+ "onsecondary" to com.google.android.material.R.attr.colorOnSecondary,
97
+ "secondarycontainer" to com.google.android.material.R.attr.colorSecondaryContainer,
98
+ "onsecondarycontainer" to com.google.android.material.R.attr.colorOnSecondaryContainer,
99
+ "secondaryfixed" to com.google.android.material.R.attr.colorSecondaryFixed,
100
+ "secondaryfixeddim" to com.google.android.material.R.attr.colorSecondaryFixedDim,
101
+ "onsecondaryfixed" to com.google.android.material.R.attr.colorOnSecondaryFixed,
102
+ "onsecondaryfixedvariant" to com.google.android.material.R.attr.colorOnSecondaryFixedVariant,
103
+ "tertiary" to com.google.android.material.R.attr.colorTertiary,
104
+ "ontertiary" to com.google.android.material.R.attr.colorOnTertiary,
105
+ "tertiarycontainer" to com.google.android.material.R.attr.colorTertiaryContainer,
106
+ "ontertiarycontainer" to com.google.android.material.R.attr.colorOnTertiaryContainer,
107
+ "tertiaryfixed" to com.google.android.material.R.attr.colorTertiaryFixed,
108
+ "tertiaryfixeddim" to com.google.android.material.R.attr.colorTertiaryFixedDim,
109
+ "ontertiaryfixed" to com.google.android.material.R.attr.colorOnTertiaryFixed,
110
+ "ontertiaryfixedvariant" to com.google.android.material.R.attr.colorOnTertiaryFixedVariant,
111
+ "error" to androidx.appcompat.R.attr.colorError,
112
+ "onerror" to com.google.android.material.R.attr.colorOnError,
113
+ "errorcontainer" to com.google.android.material.R.attr.colorErrorContainer,
114
+ "onerrorcontainer" to com.google.android.material.R.attr.colorOnErrorContainer,
115
+ "outline" to com.google.android.material.R.attr.colorOutline,
116
+ "outlinevariant" to com.google.android.material.R.attr.colorOutlineVariant,
117
+ "background" to android.R.attr.colorBackground,
118
+ "onbackground" to com.google.android.material.R.attr.colorOnBackground,
119
+ "surface" to com.google.android.material.R.attr.colorSurface,
120
+ "onsurface" to com.google.android.material.R.attr.colorOnSurface,
121
+ "surfacevariant" to com.google.android.material.R.attr.colorSurfaceVariant,
122
+ "onsurfacevariant" to com.google.android.material.R.attr.colorOnSurfaceVariant,
123
+ "surfaceinverse" to com.google.android.material.R.attr.colorSurfaceInverse,
124
+ "onsurfaceinverse" to com.google.android.material.R.attr.colorOnSurfaceInverse,
125
+ "surfacebright" to com.google.android.material.R.attr.colorSurfaceBright,
126
+ "surfacedim" to com.google.android.material.R.attr.colorSurfaceDim,
127
+ "surfacecontainer" to com.google.android.material.R.attr.colorSurfaceContainer,
128
+ "surfacecontainerlow" to com.google.android.material.R.attr.colorSurfaceContainerLow,
129
+ "surfacecontainerlowest" to com.google.android.material.R.attr.colorSurfaceContainerLowest,
130
+ "surfacecontainerhigh" to com.google.android.material.R.attr.colorSurfaceContainerHigh,
131
+ "surfacecontainerhighest" to com.google.android.material.R.attr.colorSurfaceContainerHighest
132
+ )
133
+ }
134
+ }
@@ -13,7 +13,7 @@
13
13
  "publication": {
14
14
  "groupId": "expo.modules.router",
15
15
  "artifactId": "expo.modules.router",
16
- "version": "58.0.3",
16
+ "version": "58.0.4",
17
17
  "repository": "local-maven-repo"
18
18
  }
19
19
  }
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "expo.modules.router",
5
5
  "module": "expo.modules.router",
6
- "version": "58.0.3",
6
+ "version": "58.0.4",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "files": [
26
26
  {
27
- "name": "expo.modules.router-58.0.3.aar",
28
- "url": "expo.modules.router-58.0.3.aar",
27
+ "name": "expo.modules.router-58.0.4.aar",
28
+ "url": "expo.modules.router-58.0.4.aar",
29
29
  "size": 16133,
30
30
  "sha512": "32ccb33ae7df2d0abc96fb77d87c776773a15d8de0818d83bbca865581f60f85a0c280a75de2f770590ccabadb78874cec32689a50a0bc29b6a9025ed6c592b1",
31
31
  "sha256": "5a620cdcb41c5bc3c82e954ffd02de6b85954cd41bde5b5694ac9d5f5f25aa8f",
@@ -74,8 +74,8 @@
74
74
  ],
75
75
  "files": [
76
76
  {
77
- "name": "expo.modules.router-58.0.3.aar",
78
- "url": "expo.modules.router-58.0.3.aar",
77
+ "name": "expo.modules.router-58.0.4.aar",
78
+ "url": "expo.modules.router-58.0.4.aar",
79
79
  "size": 16133,
80
80
  "sha512": "32ccb33ae7df2d0abc96fb77d87c776773a15d8de0818d83bbca865581f60f85a0c280a75de2f770590ccabadb78874cec32689a50a0bc29b6a9025ed6c592b1",
81
81
  "sha256": "5a620cdcb41c5bc3c82e954ffd02de6b85954cd41bde5b5694ac9d5f5f25aa8f",
@@ -94,8 +94,8 @@
94
94
  },
95
95
  "files": [
96
96
  {
97
- "name": "expo.modules.router-58.0.3-sources.jar",
98
- "url": "expo.modules.router-58.0.3-sources.jar",
97
+ "name": "expo.modules.router-58.0.4-sources.jar",
98
+ "url": "expo.modules.router-58.0.4-sources.jar",
99
99
  "size": 1986,
100
100
  "sha512": "c1d7dd32034c271b8e8d511c2e8ea7705b8378c4e2859d4bf810cd75ea33bbd4c212c9bbb5f0d27ae90f8f599fbb8f865b37001791bb539e94b90413396e6139",
101
101
  "sha256": "3027e02be198959073884cd5afb9b46f39f0d7396a590f6840bb63ef37010adc",
@@ -0,0 +1 @@
1
+ 360156f6b142925851bdcb9ecf53ff2dcadfd4e1e3bfc6baf520b85476f9c037
@@ -0,0 +1 @@
1
+ abf544811791f013cb517b113df6f5d2daa30122294e99e48403d576bf2fdebe87ecee4438ad620d0274d1389cfb414770ce1ee181da96e8279517ada0223d65
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>expo.modules.router</groupId>
11
11
  <artifactId>expo.modules.router</artifactId>
12
- <version>58.0.3</version>
12
+ <version>58.0.4</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.router</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 1a1483ba6afaa71ae4609ba65fcdb5abb20e4f84776063e9f5b19d9b4a0a79de
@@ -0,0 +1 @@
1
+ 4b6d2f1b5bb79480c2dac17129a3ecbe00514f455d64d6bc269a7f03e0ff787b784400ac02dabd73a943580c6534b3e7386b3b1899c18443051fc135f382b210
@@ -3,11 +3,11 @@
3
3
  <groupId>expo.modules.router</groupId>
4
4
  <artifactId>expo.modules.router</artifactId>
5
5
  <versioning>
6
- <latest>58.0.3</latest>
7
- <release>58.0.3</release>
6
+ <latest>58.0.4</latest>
7
+ <release>58.0.4</release>
8
8
  <versions>
9
- <version>58.0.3</version>
9
+ <version>58.0.4</version>
10
10
  </versions>
11
- <lastUpdated>20260915202021</lastUpdated>
11
+ <lastUpdated>20260916230014</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- b85d1f9d3471bd2f8d32e0a23f328c6e
1
+ 9738245bd0d34cbbc3935edb58237bbf
@@ -1 +1 @@
1
- 1835cab4fbe734f206727555def133ae6f7dc022
1
+ 76a51919a8bf9ffd6ef1a0bda9b6c272b15f30bb
@@ -1 +1 @@
1
- d001eb8214dae276b16a57c04e8f96976a1390ae3724430ea29b548b9524b3d4
1
+ a6c47c922656db6b78d125e403ece7fd161b5cea2c3115bdc63b5a13ee8ce1c2
@@ -1 +1 @@
1
- 30af61047daf66876fa2d4d4224c2c0be942fa784a19d1ffc86ab34d2cfe993c9e188534d7c8bd96fa3bffbe42132119f765e6ea92c1371108ae76b7e8428cd7
1
+ ceb75026c3e03d1957f39f65c40e1d9527d174a873f290299c005438087a87e7bb6ae20fb5106b847df179e9ea684884a7396210c227430d3e9df37c4b3b5b26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "58.0.3",
3
+ "version": "58.0.4",
4
4
  "description": "Expo Router is a file-based router for React Native and web applications.",
5
5
  "keywords": [
6
6
  "expo",
@@ -20,12 +20,13 @@
20
20
  "files": [
21
21
  "link",
22
22
  "android",
23
+ "!android/.gitignore",
24
+ "!android/build/**",
23
25
  "local-maven-repo",
24
26
  "assets",
25
27
  "build",
26
28
  "internal",
27
29
  "vendor",
28
- "!src",
29
30
  "_ctx-html.js",
30
31
  "_ctx-shared.js",
31
32
  "_ctx.*",
@@ -273,8 +274,8 @@
273
274
  "./package.json": "./package.json"
274
275
  },
275
276
  "dependencies": {
276
- "@expo/log-box": "^58.0.2",
277
- "@expo/metro-runtime": "^58.0.2",
277
+ "@expo/log-box": "^58.0.3",
278
+ "@expo/metro-runtime": "^58.0.3",
278
279
  "@expo/schema-utils": "^58.0.0",
279
280
  "@radix-ui/react-slot": "^1.2.0",
280
281
  "@radix-ui/react-tabs": "^1.1.12",
@@ -294,7 +295,7 @@
294
295
  "standard-navigation": "^0.0.5"
295
296
  },
296
297
  "devDependencies": {
297
- "@expo/ui": "^58.0.2",
298
+ "@expo/ui": "^58.0.3",
298
299
  "@jest/globals": "^29.7.0",
299
300
  "@testing-library/dom": "^10.4.0",
300
301
  "@testing-library/jest-dom": "^6.9.1",
@@ -321,13 +322,13 @@
321
322
  "react-server-dom-webpack": "~19.0.8"
322
323
  },
323
324
  "peerDependencies": {
324
- "@expo/log-box": "^58.0.2",
325
- "@expo/metro-runtime": "^58.0.2",
326
- "@expo/ui": "^58.0.2",
325
+ "@expo/log-box": "^58.0.3",
326
+ "@expo/metro-runtime": "^58.0.3",
327
+ "@expo/ui": "^58.0.3",
327
328
  "@testing-library/react-native": ">= 13.2.0",
328
329
  "expo": "*",
329
- "expo-constants": "^58.0.2",
330
- "expo-linking": "^58.0.2",
330
+ "expo-constants": "^58.0.3",
331
+ "expo-linking": "^58.0.3",
331
332
  "expo-symbols": "^58.0.1",
332
333
  "react": "*",
333
334
  "react-dom": "*",
@@ -369,7 +370,7 @@
369
370
  "optional": true
370
371
  }
371
372
  },
372
- "gitHead": "313e67f5c9dfb16f9deca74a271cd1d4f33a6f82",
373
+ "gitHead": "917a61b581baeb852aa4fe331da2c1395d824351",
373
374
  "scripts": {
374
375
  "build": "pnpm run build:lib && pnpm run build:plugin",
375
376
  "build:lib": "expo-build cjs:src",
@@ -53,14 +53,22 @@ export type Props = {
53
53
  headers?: Record<string, string | string[]>;
54
54
  /** A list of headers that are set on a specific path's response from the server. */
55
55
  pageHeaders?: PageHeadersConfig[];
56
+ /** Enable API routes with static or server output. Defaults to `true` for server output and `false` for static output. */
57
+ apiRoutes?: boolean;
56
58
  /**
57
59
  * (Deprecated) Enable experimental server middleware support. Middleware no longer requires an opt-in as of SDK 58.
58
60
  * @deprecated
59
61
  */
60
62
  unstable_useServerMiddleware?: boolean;
61
- /** Enable experimental data loader support. Requires `web.output: 'static' | 'server'` to be set in app config. */
63
+ /**
64
+ * Data loaders no longer require an opt-in as of SDK 58. This option has no effect.
65
+ * @deprecated
66
+ */
62
67
  unstable_useServerDataLoaders?: boolean;
63
- /** Enable experimental server-side rendering. When enabled with `web.output: 'server'`, HTML is rendered at request time instead of being pre-rendered at build time. */
68
+ /**
69
+ * Server rendering no longer requires an opt-in as of SDK 58. This option has no effect.
70
+ * @deprecated
71
+ */
64
72
  unstable_useServerRendering?: boolean;
65
73
  /** Disable synchronous layout updates for native screens. */
66
74
  disableSynchronousScreensUpdates?: boolean;
@@ -61,7 +61,19 @@ const withRouter = (config, _props)=>{
61
61
  if (Object.hasOwn(props, 'unstable_useServerMiddleware')) {
62
62
  warnOnce('`unstable_useServerMiddleware` in the `expo-router` config plugin is deprecated as of SDK 58 and has no effect. Remove it from your app config.');
63
63
  }
64
+ if (Object.hasOwn(props, 'unstable_useServerDataLoaders')) {
65
+ warnOnce('`unstable_useServerDataLoaders` in the `expo-router` config plugin is deprecated as of SDK 58 and has no effect. Remove it from your app config.');
66
+ }
67
+ if (Object.hasOwn(props, 'unstable_useServerRendering')) {
68
+ warnOnce('`unstable_useServerRendering` in the `expo-router` config plugin is deprecated as of SDK 58 and has no effect. Remove it from your app config.');
69
+ }
64
70
  (0, _schemautils().validate)(schema, props);
71
+ if (props.apiRoutes === true && ![
72
+ 'static',
73
+ 'server'
74
+ ].includes(config.web?.output ?? '')) {
75
+ throw new Error('The `apiRoutes` option requires `web.output` to be set to `static` or `server`.');
76
+ }
65
77
  withExpoHeadIos(config);
66
78
  withGammaScreens(config);
67
79
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["withRouter.ts"],"sourcesContent":[null],"names":["schema","require","withExpoHeadIos","config","withInfoPlist","Array","isArray","modResults","NSUserActivityTypes","activityType","includes","push","withGammaScreens","withPodfile","contents","withRouter","_props","props","Object","hasOwn","warnOnce","validate","extra","router","warnMap","message","console","warn","styleText","stream","process","stderr"],"mappings":";;;;+BAiJA;;;eAAA;;;;yBAjJyB;;;;;;;yBACgC;;;;;;;yBAC/B;;;;;;AAE1B,MAAMA,SAASC,QAAQ;AAEvB,MAAMC,kBAAgC,CAACC;IACrC,OAAOC,IAAAA,8BAAa,EAACD,QAAQ,CAACA;QAC5B,oCAAoC;QACpC,sDAAsD;QAEtD,gDAAgD;QAChD,IAAI,CAACE,MAAMC,OAAO,CAACH,OAAOI,UAAU,CAACC,mBAAmB,GAAG;YACzDL,OAAOI,UAAU,CAACC,mBAAmB,GAAG,EAAE;QAC5C;QACA,uEAAuE;QACvE,4FAA4F;QAC5F,oCAAoC;QACpC,MAAMC,eAAe;QACrB,IAAI,CAACN,OAAOI,UAAU,CAACC,mBAAmB,CAACE,QAAQ,CAACD,eAAe;YACjEN,OAAOI,UAAU,CAACC,mBAAmB,CAACG,IAAI,CAACF;QAC7C;QACA,OAAON;IACT;AACF;AAEA,MAAMS,mBAAiC,CAACT;IACtC,OAAOU,IAAAA,4BAAW,EAACV,QAAQ,CAACA;QAC1B,IAAI,CAACA,OAAOI,UAAU,CAACO,QAAQ,CAACJ,QAAQ,CAAC,sBAAsB;YAC7DP,OAAOI,UAAU,CAACO,QAAQ,GAAG,CAAC,qHAAqH,EAAEX,OAAOI,UAAU,CAACO,QAAQ,EAAE;QACnL;QACA,OAAOX;IACT;AACF;AA8EA,MAAMY,aAAyC,CAACZ,QAAQa;IACtD,MAAMC,QAAQD,UAAU,CAAC;IAEzB,IAAIE,OAAOC,MAAM,CAACF,OAAO,iCAAiC;QACxDG,SACE;IAEJ;IAEAC,IAAAA,uBAAQ,EAACrB,QAAQiB;IAEjBf,gBAAgBC;IAChBS,iBAAiBT;IAEjB,OAAO;QACL,GAAGA,MAAM;QACTmB,OAAO;YACL,GAAGnB,OAAOmB,KAAK;YACfC,QAAQ;gBACN,GAAGpB,OAAOmB,KAAK,EAAEC,MAAM;gBACvB,GAAGN,KAAK;YACV;QACF;IACF;AACF;AAEA,MAAMO,UAAmC,CAAC;AAC1C,SAASJ,SAASK,OAAe;IAC/B,IAAI,CAACD,OAAO,CAACC,QAAQ,EAAE;QACrBD,OAAO,CAACC,QAAQ,GAAG;QACnBC,QAAQC,IAAI,CAACC,IAAAA,qBAAS,EAAC,OAAOH,SAAS;YAAEI,QAAQC,QAAQC,MAAM;QAAC;IAClE;AACF;MAEA,WAAehB"}
1
+ {"version":3,"sources":["withRouter.ts"],"sourcesContent":[null],"names":["schema","require","withExpoHeadIos","config","withInfoPlist","Array","isArray","modResults","NSUserActivityTypes","activityType","includes","push","withGammaScreens","withPodfile","contents","withRouter","_props","props","Object","hasOwn","warnOnce","validate","apiRoutes","web","output","Error","extra","router","warnMap","message","console","warn","styleText","stream","process","stderr"],"mappings":";;;;+BA2KA;;;eAAA;;;;yBA3KyB;;;;;;;yBACgC;;;;;;;yBAC/B;;;;;;AAE1B,MAAMA,SAASC,QAAQ;AAEvB,MAAMC,kBAAgC,CAACC;IACrC,OAAOC,IAAAA,8BAAa,EAACD,QAAQ,CAACA;QAC5B,oCAAoC;QACpC,sDAAsD;QAEtD,gDAAgD;QAChD,IAAI,CAACE,MAAMC,OAAO,CAACH,OAAOI,UAAU,CAACC,mBAAmB,GAAG;YACzDL,OAAOI,UAAU,CAACC,mBAAmB,GAAG,EAAE;QAC5C;QACA,uEAAuE;QACvE,4FAA4F;QAC5F,oCAAoC;QACpC,MAAMC,eAAe;QACrB,IAAI,CAACN,OAAOI,UAAU,CAACC,mBAAmB,CAACE,QAAQ,CAACD,eAAe;YACjEN,OAAOI,UAAU,CAACC,mBAAmB,CAACG,IAAI,CAACF;QAC7C;QACA,OAAON;IACT;AACF;AAEA,MAAMS,mBAAiC,CAACT;IACtC,OAAOU,IAAAA,4BAAW,EAACV,QAAQ,CAACA;QAC1B,IAAI,CAACA,OAAOI,UAAU,CAACO,QAAQ,CAACJ,QAAQ,CAAC,sBAAsB;YAC7DP,OAAOI,UAAU,CAACO,QAAQ,GAAG,CAAC,qHAAqH,EAAEX,OAAOI,UAAU,CAACO,QAAQ,EAAE;QACnL;QACA,OAAOX;IACT;AACF;AAsFA,MAAMY,aAAyC,CAACZ,QAAQa;IACtD,MAAMC,QAAQD,UAAU,CAAC;IAEzB,IAAIE,OAAOC,MAAM,CAACF,OAAO,iCAAiC;QACxDG,SACE;IAEJ;IAEA,IAAIF,OAAOC,MAAM,CAACF,OAAO,kCAAkC;QACzDG,SACE;IAEJ;IAEA,IAAIF,OAAOC,MAAM,CAACF,OAAO,gCAAgC;QACvDG,SACE;IAEJ;IAEAC,IAAAA,uBAAQ,EAACrB,QAAQiB;IAEjB,IAAIA,MAAMK,SAAS,KAAK,QAAQ,CAAC;QAAC;QAAU;KAAS,CAACZ,QAAQ,CAACP,OAAOoB,GAAG,EAAEC,UAAU,KAAK;QACxF,MAAM,IAAIC,MACR;IAEJ;IAEAvB,gBAAgBC;IAChBS,iBAAiBT;IAEjB,OAAO;QACL,GAAGA,MAAM;QACTuB,OAAO;YACL,GAAGvB,OAAOuB,KAAK;YACfC,QAAQ;gBACN,GAAGxB,OAAOuB,KAAK,EAAEC,MAAM;gBACvB,GAAGV,KAAK;YACV;QACF;IACF;AACF;AAEA,MAAMW,UAAmC,CAAC;AAC1C,SAASR,SAASS,OAAe;IAC/B,IAAI,CAACD,OAAO,CAACC,QAAQ,EAAE;QACrBD,OAAO,CAACC,QAAQ,GAAG;QACnBC,QAAQC,IAAI,CAACC,IAAAA,qBAAS,EAAC,OAAOH,SAAS;YAAEI,QAAQC,QAAQC,MAAM;QAAC;IAClE;AACF;MAEA,WAAepB"}
@@ -184,18 +184,22 @@
184
184
  }
185
185
  }
186
186
  },
187
+ "apiRoutes": {
188
+ "description": "Enable API routes with static or server output. Defaults to `true` for server output and `false` for static output.",
189
+ "type": "boolean"
190
+ },
187
191
  "unstable_useServerMiddleware": {
188
192
  "description": "Deprecated as of SDK 58. Server middleware no longer requires an opt-in; this option has no effect.",
189
193
  "type": "boolean",
190
194
  "default": false
191
195
  },
192
196
  "unstable_useServerDataLoaders": {
193
- "description": "Enable experimental data loader support. Requires `web.output: 'static' | 'server'` to be set in app config.",
197
+ "description": "Deprecated as of SDK 58. Data loaders no longer require an opt-in; this option has no effect.",
194
198
  "type": "boolean",
195
199
  "default": false
196
200
  },
197
201
  "unstable_useServerRendering": {
198
- "description": "Enable experimental server-side rendering. When enabled with `web.output: 'server'`, HTML is rendered at request time instead of being pre-rendered at build time.",
202
+ "description": "Deprecated as of SDK 58. Server rendering no longer requires an opt-in; this option has no effect.",
199
203
  "type": "boolean",
200
204
  "default": false
201
205
  },
@@ -0,0 +1,25 @@
1
+ import withRouter from '../withRouter';
2
+
3
+ describe('apiRoutes', () => {
4
+ it.each(['static', 'server'] as const)('accepts API routes with %s output', (output) => {
5
+ const config = withRouter({ name: 'test', slug: 'test', web: { output } }, { apiRoutes: true });
6
+ expect(config.extra?.router.apiRoutes).toBe(true);
7
+ });
8
+
9
+ it.each(['single', undefined] as const)('rejects the setting with %s output', (output) => {
10
+ expect(() =>
11
+ withRouter({ name: 'test', slug: 'test', web: { output } }, { apiRoutes: true })
12
+ ).toThrow('The `apiRoutes` option requires `web.output` to be set to `static` or `server`.');
13
+ });
14
+
15
+ it.each(['static', 'server', 'single', undefined] as const)(
16
+ 'preserves an explicit false value with %s output',
17
+ (output) => {
18
+ const config = withRouter(
19
+ { name: 'test', slug: 'test', web: { output } },
20
+ { apiRoutes: false }
21
+ );
22
+ expect(config.extra?.router.apiRoutes).toBe(false);
23
+ }
24
+ );
25
+ });
@@ -0,0 +1,3 @@
1
+ import { Props } from './withRouter';
2
+
3
+ export default (props: Props = {}): [string, Props] => ['expo-router', props];
@@ -0,0 +1,172 @@
1
+ import { validate } from '@expo/schema-utils';
2
+ import { ConfigPlugin, withInfoPlist, withPodfile } from 'expo/config-plugins';
3
+ import { styleText } from 'node:util';
4
+
5
+ const schema = require('../options.json');
6
+
7
+ const withExpoHeadIos: ConfigPlugin = (config) => {
8
+ return withInfoPlist(config, (config) => {
9
+ // TODO: Add a way to enable this...
10
+ // config.modResults.CoreSpotlightContinuation = true;
11
+
12
+ // $(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route
13
+ if (!Array.isArray(config.modResults.NSUserActivityTypes)) {
14
+ config.modResults.NSUserActivityTypes = [];
15
+ }
16
+ // This ensures that stored `NSUserActivityType`s can be opened in-app.
17
+ // This is important for moving between native devices or from opening a link that was saved
18
+ // in a Quick Note or Siri Reminder.
19
+ const activityType = '$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route';
20
+ if (!config.modResults.NSUserActivityTypes.includes(activityType)) {
21
+ config.modResults.NSUserActivityTypes.push(activityType);
22
+ }
23
+ return config;
24
+ });
25
+ };
26
+
27
+ const withGammaScreens: ConfigPlugin = (config) => {
28
+ return withPodfile(config, (config) => {
29
+ if (!config.modResults.contents.includes('RNS_GAMMA_ENABLED')) {
30
+ config.modResults.contents = `# Set by expo-router. This enables Fabric-only features from react-native-screens\nENV['RNS_GAMMA_ENABLED'] ||= '1'\n${config.modResults.contents}`;
31
+ }
32
+ return config;
33
+ });
34
+ };
35
+
36
+ type AsyncRouteOption = 'development' | 'production' | boolean;
37
+
38
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD';
39
+
40
+ type RedirectConfig = {
41
+ /** The previous file path that this route should redirect from */
42
+ source: string;
43
+ /** The target file path that this route should redirect to */
44
+ destination: string;
45
+ /** Whether the redirect is temporary or permanent. Defaults to `false`. */
46
+ permanent?: boolean;
47
+ /** HTTP methods that should be redirected. Omit to redirect all methods. */
48
+ methods?: HttpMethod[];
49
+ };
50
+
51
+ type RewriteConfig = {
52
+ /** The previous file path that should be rewritten */
53
+ source: string;
54
+ /** The target file path that this route should rewrite */
55
+ destination: string;
56
+ /** HTTP methods that should be rewritten. Omit to rewrite all methods. */
57
+ methods?: HttpMethod[];
58
+ };
59
+
60
+ type PageHeadersConfig = {
61
+ /** The path to match for the headers to apply. */
62
+ source: string;
63
+ /** Response headers to apply for matching paths. */
64
+ headers: Record<string, string | string[]>;
65
+ };
66
+
67
+ export type Props = {
68
+ /** Production origin URL where assets in the public folder are hosted. The fetch function is polyfilled to support relative requests from this origin in production, development origin is inferred using the Expo CLI development server. */
69
+ origin?: string | boolean;
70
+ /** A more specific origin URL used in the `expo-router/head` module for iOS handoff. Defaults to `origin`. */
71
+ headOrigin?: string;
72
+ /** Changes the routes directory from `app` to another value. Defaults to `app`. Avoid using this property. */
73
+ root?: string;
74
+ /** Enable or disable platform-specific routes. Defaults to `true`. */
75
+ platformRoutes?: boolean;
76
+ /** Enable or disable automatically generated routes. Defaults to `true`. */
77
+ sitemap?: boolean;
78
+ /** Should Async Routes be enabled. `production` is currently web-only and will be disabled on native. */
79
+ asyncRoutes?:
80
+ | AsyncRouteOption
81
+ | {
82
+ android?: AsyncRouteOption;
83
+ ios?: AsyncRouteOption;
84
+ web?: AsyncRouteOption;
85
+ default?: AsyncRouteOption;
86
+ };
87
+ /** Enable or disable partial route type generation. Defaults to `true`. */
88
+ partialRouteTypes?: boolean;
89
+ /** Enable static redirects. Defaults to `true`. */
90
+ redirects?: RedirectConfig[];
91
+ /** Enable static rewrites */
92
+ rewrites?: RewriteConfig[];
93
+ /** A list of headers that are set on every route response from the server */
94
+ headers?: Record<string, string | string[]>;
95
+ /** A list of headers that are set on a specific path's response from the server. */
96
+ pageHeaders?: PageHeadersConfig[];
97
+ /** Enable API routes with static or server output. Defaults to `true` for server output and `false` for static output. */
98
+ apiRoutes?: boolean;
99
+ /**
100
+ * (Deprecated) Enable experimental server middleware support. Middleware no longer requires an opt-in as of SDK 58.
101
+ * @deprecated
102
+ */
103
+ unstable_useServerMiddleware?: boolean;
104
+ /**
105
+ * Data loaders no longer require an opt-in as of SDK 58. This option has no effect.
106
+ * @deprecated
107
+ */
108
+ unstable_useServerDataLoaders?: boolean;
109
+ /**
110
+ * Server rendering no longer requires an opt-in as of SDK 58. This option has no effect.
111
+ * @deprecated
112
+ */
113
+ unstable_useServerRendering?: boolean;
114
+ /** Disable synchronous layout updates for native screens. */
115
+ disableSynchronousScreensUpdates?: boolean;
116
+ /** Rerender the app on color scheme changes. When enabled, the app tree will rerender when the system theme changes (light/dark mode). Defaults to `true`. */
117
+ adaptiveColors?: boolean;
118
+ };
119
+
120
+ const withRouter: ConfigPlugin<Props | void> = (config, _props) => {
121
+ const props = _props || {};
122
+
123
+ if (Object.hasOwn(props, 'unstable_useServerMiddleware')) {
124
+ warnOnce(
125
+ '`unstable_useServerMiddleware` in the `expo-router` config plugin is deprecated as of SDK 58 and has no effect. Remove it from your app config.'
126
+ );
127
+ }
128
+
129
+ if (Object.hasOwn(props, 'unstable_useServerDataLoaders')) {
130
+ warnOnce(
131
+ '`unstable_useServerDataLoaders` in the `expo-router` config plugin is deprecated as of SDK 58 and has no effect. Remove it from your app config.'
132
+ );
133
+ }
134
+
135
+ if (Object.hasOwn(props, 'unstable_useServerRendering')) {
136
+ warnOnce(
137
+ '`unstable_useServerRendering` in the `expo-router` config plugin is deprecated as of SDK 58 and has no effect. Remove it from your app config.'
138
+ );
139
+ }
140
+
141
+ validate(schema, props);
142
+
143
+ if (props.apiRoutes === true && !['static', 'server'].includes(config.web?.output ?? '')) {
144
+ throw new Error(
145
+ 'The `apiRoutes` option requires `web.output` to be set to `static` or `server`.'
146
+ );
147
+ }
148
+
149
+ withExpoHeadIos(config);
150
+ withGammaScreens(config);
151
+
152
+ return {
153
+ ...config,
154
+ extra: {
155
+ ...config.extra,
156
+ router: {
157
+ ...config.extra?.router,
158
+ ...props,
159
+ },
160
+ },
161
+ };
162
+ };
163
+
164
+ const warnMap: Record<string, boolean> = {};
165
+ function warnOnce(message: string) {
166
+ if (!warnMap[message]) {
167
+ warnMap[message] = true;
168
+ console.warn(styleText('red', message, { stream: process.stderr }));
169
+ }
170
+ }
171
+
172
+ export default withRouter;