expo-router 6.1.0-canary-20251015-a6a1272 → 7.0.0-canary-20251031-b135dff

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 (279) hide show
  1. package/_error.js +36 -3
  2. package/build/ExpoRoot.js +1 -1
  3. package/build/ExpoRoot.js.map +1 -1
  4. package/build/global-state/router-store.d.ts +2 -0
  5. package/build/global-state/router-store.d.ts.map +1 -1
  6. package/build/global-state/router-store.js +16 -12
  7. package/build/global-state/router-store.js.map +1 -1
  8. package/build/global-state/routing.d.ts +12 -4
  9. package/build/global-state/routing.d.ts.map +1 -1
  10. package/build/global-state/routing.js +35 -10
  11. package/build/global-state/routing.js.map +1 -1
  12. package/build/global-state/storeContext.d.ts +2 -0
  13. package/build/global-state/storeContext.d.ts.map +1 -1
  14. package/build/internal/routing.d.ts +7 -0
  15. package/build/internal/routing.d.ts.map +1 -0
  16. package/build/internal/routing.js +21 -0
  17. package/build/internal/routing.js.map +1 -0
  18. package/build/internal/rsc.d.ts +5 -0
  19. package/build/internal/rsc.d.ts.map +1 -0
  20. package/build/internal/rsc.js +18 -0
  21. package/build/internal/rsc.js.map +1 -0
  22. package/build/internal/static.d.ts +3 -0
  23. package/build/internal/static.d.ts.map +1 -0
  24. package/build/internal/static.js +8 -0
  25. package/build/internal/static.js.map +1 -0
  26. package/build/internal/testing.d.ts +3 -0
  27. package/build/internal/testing.d.ts.map +1 -0
  28. package/build/internal/testing.js +11 -0
  29. package/build/internal/testing.js.map +1 -0
  30. package/build/internal/utils.d.ts +2 -0
  31. package/build/internal/utils.d.ts.map +1 -0
  32. package/build/internal/utils.js +6 -0
  33. package/build/internal/utils.js.map +1 -0
  34. package/build/layouts/BaseStack.d.ts +3 -0
  35. package/build/layouts/BaseStack.d.ts.map +1 -0
  36. package/build/layouts/BaseStack.js +8 -0
  37. package/build/layouts/BaseStack.js.map +1 -0
  38. package/build/layouts/ExperimentalModalStack.d.ts +9 -0
  39. package/build/layouts/ExperimentalModalStack.d.ts.map +1 -0
  40. package/build/layouts/ExperimentalModalStack.js +15 -0
  41. package/build/layouts/ExperimentalModalStack.js.map +1 -0
  42. package/build/layouts/IsWithinLayoutContext.d.ts +2 -0
  43. package/build/layouts/IsWithinLayoutContext.d.ts.map +1 -0
  44. package/build/layouts/IsWithinLayoutContext.js +7 -0
  45. package/build/layouts/IsWithinLayoutContext.js.map +1 -0
  46. package/build/layouts/Stack.web.d.ts +1 -14
  47. package/build/layouts/Stack.web.d.ts.map +1 -1
  48. package/build/layouts/Stack.web.js +10 -13
  49. package/build/layouts/Stack.web.js.map +1 -1
  50. package/build/layouts/_web-modal.d.ts +3 -0
  51. package/build/layouts/_web-modal.d.ts.map +1 -0
  52. package/build/layouts/_web-modal.js +8 -0
  53. package/build/layouts/_web-modal.js.map +1 -0
  54. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  55. package/build/layouts/withLayoutContext.js +5 -2
  56. package/build/layouts/withLayoutContext.js.map +1 -1
  57. package/build/loaders/ServerDataLoaderContext.d.ts +2 -1
  58. package/build/loaders/ServerDataLoaderContext.d.ts.map +1 -1
  59. package/build/loaders/ServerDataLoaderContext.js.map +1 -1
  60. package/build/modal/web/ModalStack.d.ts.map +1 -1
  61. package/build/modal/web/ModalStack.js +7 -2
  62. package/build/modal/web/ModalStack.js.map +1 -1
  63. package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsNavigator.d.ts → NativeBottomTabsNavigator.d.ts} +3 -3
  64. package/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +1 -0
  65. package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsNavigator.js → NativeBottomTabsNavigator.js} +49 -14
  66. package/build/native-tabs/NativeBottomTabsNavigator.js.map +1 -0
  67. package/build/native-tabs/NativeBottomTabsRouter.d.ts.map +1 -0
  68. package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsRouter.js → NativeBottomTabsRouter.js} +1 -1
  69. package/build/native-tabs/NativeBottomTabsRouter.js.map +1 -0
  70. package/build/native-tabs/{NativeBottomTabs/NativeTabTrigger.d.ts → NativeTabTrigger.d.ts} +1 -1
  71. package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -0
  72. package/build/native-tabs/{NativeBottomTabs/NativeTabTrigger.js → NativeTabTrigger.js} +9 -5
  73. package/build/native-tabs/NativeTabTrigger.js.map +1 -0
  74. package/build/native-tabs/NativeTabs.d.ts.map +1 -0
  75. package/build/native-tabs/{NativeBottomTabs/NativeTabs.js → NativeTabs.js} +2 -0
  76. package/build/native-tabs/NativeTabs.js.map +1 -0
  77. package/build/native-tabs/NativeTabsTriggerTabBar.d.ts.map +1 -0
  78. package/build/native-tabs/NativeTabsTriggerTabBar.js.map +1 -0
  79. package/build/native-tabs/NativeTabsView.d.ts.map +1 -0
  80. package/build/native-tabs/NativeTabsView.js +103 -0
  81. package/build/native-tabs/NativeTabsView.js.map +1 -0
  82. package/build/native-tabs/NativeTabsView.web.d.ts.map +1 -0
  83. package/build/native-tabs/{NativeBottomTabs/NativeTabsView.web.js → NativeTabsView.web.js} +18 -57
  84. package/build/native-tabs/NativeTabsView.web.js.map +1 -0
  85. package/build/native-tabs/{NativeBottomTabs/appearance.d.ts → appearance.d.ts} +2 -2
  86. package/build/native-tabs/appearance.d.ts.map +1 -0
  87. package/build/native-tabs/{NativeBottomTabs/appearance.js → appearance.js} +18 -6
  88. package/build/native-tabs/appearance.js.map +1 -0
  89. package/build/native-tabs/common/elements.d.ts +1 -1
  90. package/build/native-tabs/common/elements.d.ts.map +1 -1
  91. package/build/native-tabs/common/elements.js.map +1 -1
  92. package/build/native-tabs/index.d.ts +4 -4
  93. package/build/native-tabs/index.d.ts.map +1 -1
  94. package/build/native-tabs/index.js +3 -3
  95. package/build/native-tabs/index.js.map +1 -1
  96. package/build/native-tabs/{NativeBottomTabs/types.d.ts → types.d.ts} +19 -6
  97. package/build/native-tabs/types.d.ts.map +1 -0
  98. package/build/native-tabs/types.js.map +1 -0
  99. package/build/native-tabs/{NativeBottomTabs/utils.d.ts → utils/children.d.ts} +1 -3
  100. package/build/native-tabs/utils/children.d.ts.map +1 -0
  101. package/build/native-tabs/{NativeBottomTabs/utils.js → utils/children.js} +1 -7
  102. package/build/native-tabs/utils/children.js.map +1 -0
  103. package/build/native-tabs/utils/icon.d.ts +25 -0
  104. package/build/native-tabs/utils/icon.d.ts.map +1 -0
  105. package/build/native-tabs/utils/icon.js +68 -0
  106. package/build/native-tabs/utils/icon.js.map +1 -0
  107. package/build/native-tabs/utils/index.d.ts +4 -0
  108. package/build/native-tabs/utils/index.d.ts.map +1 -0
  109. package/build/native-tabs/utils/index.js +11 -0
  110. package/build/native-tabs/utils/index.js.map +1 -0
  111. package/build/native-tabs/utils/label.d.ts +6 -0
  112. package/build/native-tabs/utils/label.d.ts.map +1 -0
  113. package/build/native-tabs/utils/label.js +15 -0
  114. package/build/native-tabs/utils/label.js.map +1 -0
  115. package/build/renderRootComponent.d.ts.map +1 -1
  116. package/build/renderRootComponent.js +4 -7
  117. package/build/renderRootComponent.js.map +1 -1
  118. package/build/split-view/elements.d.ts +10 -0
  119. package/build/split-view/elements.d.ts.map +1 -0
  120. package/build/split-view/elements.js +15 -0
  121. package/build/split-view/elements.js.map +1 -0
  122. package/build/split-view/index.d.ts +2 -0
  123. package/build/split-view/index.d.ts.map +1 -0
  124. package/build/split-view/index.js +6 -0
  125. package/build/split-view/index.js.map +1 -0
  126. package/build/split-view/split-view.d.ts +13 -0
  127. package/build/split-view/split-view.d.ts.map +1 -0
  128. package/build/split-view/split-view.js +93 -0
  129. package/build/split-view/split-view.js.map +1 -0
  130. package/build/static/html.d.ts +5 -15
  131. package/build/static/html.d.ts.map +1 -1
  132. package/build/static/html.js +9 -25
  133. package/build/static/html.js.map +1 -1
  134. package/build/static/registerRootComponent.d.ts +11 -0
  135. package/build/static/registerRootComponent.d.ts.map +1 -0
  136. package/build/static/registerRootComponent.js +11 -0
  137. package/build/static/registerRootComponent.js.map +1 -0
  138. package/build/types.d.ts +4 -2
  139. package/build/types.d.ts.map +1 -1
  140. package/build/types.js.map +1 -1
  141. package/build/ui/TabRouter.d.ts +3 -4
  142. package/build/ui/TabRouter.d.ts.map +1 -1
  143. package/build/ui/TabRouter.js +14 -67
  144. package/build/ui/TabRouter.js.map +1 -1
  145. package/build/ui/TabTrigger.d.ts +4 -5
  146. package/build/ui/TabTrigger.d.ts.map +1 -1
  147. package/build/ui/TabTrigger.js +9 -8
  148. package/build/ui/TabTrigger.js.map +1 -1
  149. package/build/ui/Tabs.d.ts +0 -1
  150. package/build/ui/Tabs.d.ts.map +1 -1
  151. package/build/ui/Tabs.js.map +1 -1
  152. package/html.js +1 -1
  153. package/internal/routing.d.ts +1 -0
  154. package/internal/routing.js +1 -0
  155. package/internal/rsc.d.ts +1 -0
  156. package/internal/rsc.js +1 -0
  157. package/internal/static.d.ts +1 -0
  158. package/internal/static.js +1 -0
  159. package/internal/testing.d.ts +1 -0
  160. package/internal/testing.js +1 -0
  161. package/internal/utils.d.ts +1 -0
  162. package/internal/utils.js +1 -0
  163. package/package.json +13 -11
  164. package/plugin/build/index.js +10 -0
  165. package/plugin/options.json +5 -0
  166. package/plugin/src/index.ts +17 -1
  167. package/rsc/headers.d.ts +1 -1
  168. package/rsc/headers.js +1 -1
  169. package/unstable-split-view.d.ts +1 -0
  170. package/unstable-split-view.js +1 -0
  171. package/build/getRoutesSSR.d.ts +0 -20
  172. package/build/getRoutesSSR.d.ts.map +0 -1
  173. package/build/getRoutesSSR.js +0 -97
  174. package/build/getRoutesSSR.js.map +0 -1
  175. package/build/getServerManifest.d.ts +0 -88
  176. package/build/getServerManifest.d.ts.map +0 -1
  177. package/build/getServerManifest.js +0 -238
  178. package/build/getServerManifest.js.map +0 -1
  179. package/build/loadStaticParamsAsync.d.ts +0 -9
  180. package/build/loadStaticParamsAsync.d.ts.map +0 -1
  181. package/build/loadStaticParamsAsync.js +0 -163
  182. package/build/loadStaticParamsAsync.js.map +0 -1
  183. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +0 -1
  184. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +0 -1
  185. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts.map +0 -1
  186. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js.map +0 -1
  187. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +0 -1
  188. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +0 -1
  189. package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +0 -1
  190. package/build/native-tabs/NativeBottomTabs/NativeTabs.js.map +0 -1
  191. package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts.map +0 -1
  192. package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js.map +0 -1
  193. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +0 -1
  194. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +0 -187
  195. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +0 -1
  196. package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.d.ts.map +0 -1
  197. package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js.map +0 -1
  198. package/build/native-tabs/NativeBottomTabs/appearance.d.ts.map +0 -1
  199. package/build/native-tabs/NativeBottomTabs/appearance.js.map +0 -1
  200. package/build/native-tabs/NativeBottomTabs/types.d.ts.map +0 -1
  201. package/build/native-tabs/NativeBottomTabs/types.js.map +0 -1
  202. package/build/native-tabs/NativeBottomTabs/utils.d.ts.map +0 -1
  203. package/build/native-tabs/NativeBottomTabs/utils.js.map +0 -1
  204. package/build/routes-manifest.d.ts +0 -28
  205. package/build/routes-manifest.d.ts.map +0 -1
  206. package/build/routes-manifest.js +0 -30
  207. package/build/routes-manifest.js.map +0 -1
  208. package/build/rsc/middleware.d.ts +0 -8
  209. package/build/rsc/middleware.d.ts.map +0 -1
  210. package/build/rsc/middleware.js +0 -105
  211. package/build/rsc/middleware.js.map +0 -1
  212. package/build/rsc/path.d.ts +0 -34
  213. package/build/rsc/path.d.ts.map +0 -1
  214. package/build/rsc/path.js +0 -174
  215. package/build/rsc/path.js.map +0 -1
  216. package/build/rsc/router/create-expo-pages.d.ts +0 -20
  217. package/build/rsc/router/create-expo-pages.d.ts.map +0 -1
  218. package/build/rsc/router/create-expo-pages.js +0 -21
  219. package/build/rsc/router/create-expo-pages.js.map +0 -1
  220. package/build/rsc/router/create-pages.d.ts +0 -80
  221. package/build/rsc/router/create-pages.d.ts.map +0 -1
  222. package/build/rsc/router/create-pages.js +0 -232
  223. package/build/rsc/router/create-pages.js.map +0 -1
  224. package/build/rsc/router/defineRouter.d.ts +0 -30
  225. package/build/rsc/router/defineRouter.d.ts.map +0 -1
  226. package/build/rsc/router/defineRouter.js +0 -171
  227. package/build/rsc/router/defineRouter.js.map +0 -1
  228. package/build/rsc/router/expo-definedRouter.d.ts +0 -3
  229. package/build/rsc/router/expo-definedRouter.d.ts.map +0 -1
  230. package/build/rsc/router/expo-definedRouter.js +0 -112
  231. package/build/rsc/router/expo-definedRouter.js.map +0 -1
  232. package/build/rsc/router/noopRouter.d.ts +0 -3
  233. package/build/rsc/router/noopRouter.d.ts.map +0 -1
  234. package/build/rsc/router/noopRouter.js +0 -7
  235. package/build/rsc/router/noopRouter.js.map +0 -1
  236. package/build/rsc/rsc-renderer.d.ts +0 -44
  237. package/build/rsc/rsc-renderer.d.ts.map +0 -1
  238. package/build/rsc/rsc-renderer.js +0 -200
  239. package/build/rsc/rsc-renderer.js.map +0 -1
  240. package/build/rsc/server.d.ts +0 -65
  241. package/build/rsc/server.d.ts.map +0 -1
  242. package/build/rsc/server.js +0 -89
  243. package/build/rsc/server.js.map +0 -1
  244. package/build/static/getRootComponent.d.ts +0 -2
  245. package/build/static/getRootComponent.d.ts.map +0 -1
  246. package/build/static/getRootComponent.js +0 -25
  247. package/build/static/getRootComponent.js.map +0 -1
  248. package/build/static/getServerManifest.d.ts +0 -22
  249. package/build/static/getServerManifest.d.ts.map +0 -1
  250. package/build/static/getServerManifest.js +0 -50
  251. package/build/static/getServerManifest.js.map +0 -1
  252. package/build/static/renderStaticContent.d.ts +0 -15
  253. package/build/static/renderStaticContent.d.ts.map +0 -1
  254. package/build/static/renderStaticContent.js +0 -130
  255. package/build/static/renderStaticContent.js.map +0 -1
  256. package/build/typed-routes/generate.d.ts +0 -8
  257. package/build/typed-routes/generate.d.ts.map +0 -1
  258. package/build/typed-routes/generate.js +0 -186
  259. package/build/typed-routes/generate.js.map +0 -1
  260. package/build/typed-routes/index.d.ts +0 -35
  261. package/build/typed-routes/index.d.ts.map +0 -1
  262. package/build/typed-routes/index.js +0 -99
  263. package/build/typed-routes/index.js.map +0 -1
  264. package/build/typed-routes/testSetup.d.ts +0 -2
  265. package/build/typed-routes/testSetup.d.ts.map +0 -1
  266. package/build/typed-routes/testSetup.js +0 -42
  267. package/build/typed-routes/testSetup.js.map +0 -1
  268. package/build/utils/html.d.ts +0 -12
  269. package/build/utils/html.d.ts.map +0 -1
  270. package/build/utils/html.js +0 -29
  271. package/build/utils/html.js.map +0 -1
  272. package/node/render.js +0 -3
  273. /package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsRouter.d.ts → NativeBottomTabsRouter.d.ts} +0 -0
  274. /package/build/native-tabs/{NativeBottomTabs/NativeTabs.d.ts → NativeTabs.d.ts} +0 -0
  275. /package/build/native-tabs/{NativeBottomTabs/NativeTabsTriggerTabBar.d.ts → NativeTabsTriggerTabBar.d.ts} +0 -0
  276. /package/build/native-tabs/{NativeBottomTabs/NativeTabsTriggerTabBar.js → NativeTabsTriggerTabBar.js} +0 -0
  277. /package/build/native-tabs/{NativeBottomTabs/NativeTabsView.d.ts → NativeTabsView.d.ts} +0 -0
  278. /package/build/native-tabs/{NativeBottomTabs/NativeTabsView.web.d.ts → NativeTabsView.web.d.ts} +0 -0
  279. /package/build/native-tabs/{NativeBottomTabs/types.js → types.js} +0 -0
@@ -0,0 +1 @@
1
+ module.exports = require('../build/internal/static');
@@ -0,0 +1 @@
1
+ export * from '../build/internal/testing';
@@ -0,0 +1 @@
1
+ module.exports = require('../build/internal/testing');
@@ -0,0 +1 @@
1
+ export * from '../build/internal/utils';
@@ -0,0 +1 @@
1
+ module.exports = require('../build/internal/utils');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "6.1.0-canary-20251015-a6a1272",
3
+ "version": "7.0.0-canary-20251031-b135dff",
4
4
  "description": "Expo Router is a file-based router for React Native and web applications.",
5
5
  "author": "650 Industries, Inc.",
6
6
  "license": "MIT",
@@ -15,6 +15,7 @@
15
15
  "link",
16
16
  "assets",
17
17
  "build",
18
+ "internal",
18
19
  "vendor",
19
20
  "!src",
20
21
  "_ctx-html.js",
@@ -37,6 +38,8 @@
37
38
  "ios",
38
39
  "unstable-native-tabs.js",
39
40
  "unstable-native-tabs.d.ts",
41
+ "unstable-split-view.js",
42
+ "unstable-split-view.d.ts",
40
43
  "node",
41
44
  "plugin",
42
45
  "rsc",
@@ -68,7 +71,6 @@
68
71
  "lint": "expo-module lint",
69
72
  "test": "expo-module test",
70
73
  "test:rsc": "jest --config jest-rsc.config.js",
71
- "test:tsd": "EXPORT_ROUTER_JEST_TSD=true expo-module test",
72
74
  "prepublishOnly": "expo-module prepublishOnly",
73
75
  "expo-module": "expo-module"
74
76
  },
@@ -77,12 +79,13 @@
77
79
  "expo"
78
80
  ],
79
81
  "peerDependencies": {
80
- "@expo/metro-runtime": "6.1.3-canary-20251015-a6a1272",
82
+ "@expo/metro-runtime": "6.2.0-canary-20251031-b135dff",
83
+ "@expo/log-box": "0.0.13-canary-20251031-b135dff",
81
84
  "@react-navigation/drawer": "^7.5.0",
82
85
  "@testing-library/react-native": ">= 12.0.0",
83
- "expo": "55.0.0-canary-20251015-a6a1272",
84
- "expo-constants": "18.0.10-canary-20251015-a6a1272",
85
- "expo-linking": "8.0.9-canary-20251015-a6a1272",
86
+ "expo": "55.0.0-canary-20251031-b135dff",
87
+ "expo-constants": "18.1.0-canary-20251031-b135dff",
88
+ "expo-linking": "8.0.9-canary-20251031-b135dff",
86
89
  "react": "*",
87
90
  "react-dom": "*",
88
91
  "react-native": "*",
@@ -124,12 +127,11 @@
124
127
  "@types/react-dom": "^19.1.7",
125
128
  "@types/semver": "^7.7.0",
126
129
  "immer": "^10.1.1",
127
- "react-server-dom-webpack": "~19.0.0",
128
- "tsd": "^0.28.1"
130
+ "react-server-dom-webpack": "~19.0.0"
129
131
  },
130
132
  "dependencies": {
131
- "@expo/metro-runtime": "6.1.3-canary-20251015-a6a1272",
132
- "@expo/schema-utils": "0.1.8-canary-20251015-a6a1272",
133
+ "@expo/metro-runtime": "6.2.0-canary-20251031-b135dff",
134
+ "@expo/schema-utils": "0.1.8-canary-20251031-b135dff",
133
135
  "@radix-ui/react-slot": "1.2.0",
134
136
  "@radix-ui/react-tabs": "^1.1.12",
135
137
  "@react-navigation/bottom-tabs": "^7.4.0",
@@ -138,7 +140,7 @@
138
140
  "client-only": "^0.0.1",
139
141
  "debug": "^4.3.4",
140
142
  "escape-string-regexp": "^4.0.0",
141
- "expo-server": "1.1.0-canary-20251015-a6a1272",
143
+ "expo-server": "1.0.4-canary-20251031-b135dff",
142
144
  "fast-deep-equal": "^3.1.3",
143
145
  "invariant": "^2.2.4",
144
146
  "nanoid": "^3.3.8",
@@ -21,10 +21,20 @@ const withExpoHeadIos = (config) => {
21
21
  return config;
22
22
  });
23
23
  };
24
+ const withGammaScreens = (config, props) => {
25
+ const value = props?.unstable_splitView ?? false;
26
+ return (0, config_plugins_1.withPodfile)(config, (config) => {
27
+ if (!config.modResults.contents.includes('RNS_GAMMA_ENABLED')) {
28
+ config.modResults.contents = `ENV['RNS_GAMMA_ENABLED']='${value ? 1 : 0}'\n${config.modResults.contents}`;
29
+ }
30
+ return config;
31
+ });
32
+ };
24
33
  const withRouter = (config, _props) => {
25
34
  const props = _props || {};
26
35
  (0, schema_utils_1.validate)(schema, props);
27
36
  withExpoHeadIos(config);
37
+ withGammaScreens(config, props);
28
38
  return {
29
39
  ...config,
30
40
  extra: {
@@ -162,6 +162,11 @@
162
162
  "description": "Enable experimental data loader support. This is only supported for `web.output: 'static'` outputs at the moment.",
163
163
  "type": "boolean",
164
164
  "default": false
165
+ },
166
+ "unstable_splitView": {
167
+ "description": "Enable experimental SplitView support on ios",
168
+ "type": "boolean",
169
+ "default": false
165
170
  }
166
171
  },
167
172
  "additionalProperties": false
@@ -1,5 +1,5 @@
1
1
  import { validate } from '@expo/schema-utils';
2
- import { ConfigPlugin, withInfoPlist } from 'expo/config-plugins';
2
+ import { ConfigPlugin, withInfoPlist, withPodfile } from 'expo/config-plugins';
3
3
 
4
4
  const schema = require('../options.json');
5
5
 
@@ -23,6 +23,21 @@ const withExpoHeadIos: ConfigPlugin = (config) => {
23
23
  });
24
24
  };
25
25
 
26
+ const withGammaScreens: ConfigPlugin<
27
+ {
28
+ /** Enable experimental data loader support. Requires `web.output: 'static'` to be set in app config. */
29
+ unstable_splitView?: boolean;
30
+ } | void
31
+ > = (config, props) => {
32
+ const value = props?.unstable_splitView ?? false;
33
+ return withPodfile(config, (config) => {
34
+ if (!config.modResults.contents.includes('RNS_GAMMA_ENABLED')) {
35
+ config.modResults.contents = `ENV['RNS_GAMMA_ENABLED']='${value ? 1 : 0}'\n${config.modResults.contents}`;
36
+ }
37
+ return config;
38
+ });
39
+ };
40
+
26
41
  const withRouter: ConfigPlugin<
27
42
  {
28
43
  /** 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. */
@@ -49,6 +64,7 @@ const withRouter: ConfigPlugin<
49
64
  validate(schema, props);
50
65
 
51
66
  withExpoHeadIos(config);
67
+ withGammaScreens(config, props);
52
68
 
53
69
  return {
54
70
  ...config,
package/rsc/headers.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { unstable_headers } from 'expo-router/build/rsc/server';
1
+ import { unstable_headers } from '@expo/router-server/build/rsc/server';
2
2
 
3
3
  export { unstable_headers };
package/rsc/headers.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'server-only';
2
2
 
3
- import { unstable_headers } from 'expo-router/build/rsc/server';
3
+ import { unstable_headers } from '@expo/router-server/build/rsc/server';
4
4
 
5
5
  export { unstable_headers };
@@ -0,0 +1 @@
1
+ export * from './build/split-view';
@@ -0,0 +1 @@
1
+ module.exports = require('./build/split-view');
@@ -1,20 +0,0 @@
1
- import type { RouteNode } from './Route';
2
- import { type Options as OptionsCore } from './getRoutesCore';
3
- import type { RequireContext } from './types';
4
- export type Options = Omit<OptionsCore, 'getSystemRoute'>;
5
- /**
6
- * Given a Metro context module, return an array of nested routes.
7
- *
8
- * This is a two step process:
9
- * 1. Convert the RequireContext keys (file paths) into a directory tree.
10
- * - This should extrapolate array syntax into multiple routes
11
- * - Routes are given a specificity score
12
- * 2. Flatten the directory tree into routes
13
- * - Routes in directories without _layout files are hoisted to the nearest _layout
14
- * - The name of the route is relative to the nearest _layout
15
- * - If multiple routes have the same name, the most specific route is used
16
- */
17
- export declare function getRoutes(contextModule: RequireContext, options?: Options): RouteNode | null;
18
- export declare function getExactRoutes(contextModule: RequireContext, options?: Options): RouteNode | null;
19
- export { generateDynamic, extrapolateGroups } from './getRoutesCore';
20
- //# sourceMappingURL=getRoutesSSR.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRoutesSSR.d.ts","sourceRoot":"","sources":["../src/getRoutesSSR.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAA8B,KAAK,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAC1D;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,aAAa,EAAE,cAAc,EAAE,OAAO,GAAE,OAAY,GAAG,SAAS,GAAG,IAAI,CAkEhG;AAED,wBAAgB,cAAc,CAC5B,aAAa,EAAE,cAAc,EAC7B,OAAO,GAAE,OAAY,GACpB,SAAS,GAAG,IAAI,CAKlB;AAED,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extrapolateGroups = exports.generateDynamic = void 0;
4
- exports.getRoutes = getRoutes;
5
- exports.getExactRoutes = getExactRoutes;
6
- const getRoutesCore_1 = require("./getRoutesCore");
7
- /**
8
- * Given a Metro context module, return an array of nested routes.
9
- *
10
- * This is a two step process:
11
- * 1. Convert the RequireContext keys (file paths) into a directory tree.
12
- * - This should extrapolate array syntax into multiple routes
13
- * - Routes are given a specificity score
14
- * 2. Flatten the directory tree into routes
15
- * - Routes in directories without _layout files are hoisted to the nearest _layout
16
- * - The name of the route is relative to the nearest _layout
17
- * - If multiple routes have the same name, the most specific route is used
18
- */
19
- function getRoutes(contextModule, options = {}) {
20
- return (0, getRoutesCore_1.getRoutes)(contextModule, {
21
- getSystemRoute({ route, type, defaults, redirectConfig, rewriteConfig }) {
22
- if (route === '' && type === 'layout') {
23
- // Root layout when no layout is defined.
24
- return {
25
- type: 'layout',
26
- loadRoute: () => ({
27
- default: () => null,
28
- }),
29
- // Generate a fake file name for the directory
30
- contextKey: 'expo-router/build/views/Navigator.js',
31
- route: '',
32
- generated: true,
33
- dynamic: null,
34
- children: [],
35
- };
36
- }
37
- else if (route === '_sitemap' && type === 'route') {
38
- return {
39
- loadRoute: () => ({
40
- default: () => null,
41
- }),
42
- route: '_sitemap',
43
- type: 'route',
44
- contextKey: 'expo-router/build/views/Sitemap.js',
45
- generated: true,
46
- internal: true,
47
- dynamic: null,
48
- children: [],
49
- };
50
- }
51
- else if (route === '+not-found' && type === 'route') {
52
- return {
53
- loadRoute: () => ({
54
- default: () => null,
55
- }),
56
- type: 'route',
57
- route: '+not-found',
58
- contextKey: 'expo-router/build/views/Unmatched.js',
59
- generated: true,
60
- internal: true,
61
- dynamic: [{ name: '+not-found', deep: true, notFound: true }],
62
- children: [],
63
- };
64
- }
65
- else if (type === 'redirect' && redirectConfig && defaults) {
66
- return {
67
- ...defaults,
68
- loadRoute() {
69
- return require('./getRoutesRedirects').getRedirectModule(redirectConfig);
70
- },
71
- };
72
- }
73
- else if (type === 'rewrite' && rewriteConfig && defaults) {
74
- return {
75
- ...defaults,
76
- loadRoute() {
77
- return {
78
- default: contextModule(rewriteConfig.destinationContextKey).default,
79
- };
80
- },
81
- };
82
- }
83
- throw new Error(`Unknown system route: ${route} and type: ${type} and redirectConfig: ${redirectConfig} and rewriteConfig: ${rewriteConfig}`);
84
- },
85
- ...options,
86
- });
87
- }
88
- function getExactRoutes(contextModule, options = {}) {
89
- return getRoutes(contextModule, {
90
- ...options,
91
- skipGenerated: true,
92
- });
93
- }
94
- var getRoutesCore_2 = require("./getRoutesCore");
95
- Object.defineProperty(exports, "generateDynamic", { enumerable: true, get: function () { return getRoutesCore_2.generateDynamic; } });
96
- Object.defineProperty(exports, "extrapolateGroups", { enumerable: true, get: function () { return getRoutesCore_2.extrapolateGroups; } });
97
- //# sourceMappingURL=getRoutesSSR.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRoutesSSR.js","sourceRoot":"","sources":["../src/getRoutesSSR.ts"],"names":[],"mappings":";;;AAiBA,8BAkEC;AAED,wCAQC;AA5FD,mDAA0F;AAI1F;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,aAA6B,EAAE,UAAmB,EAAE;IAC5E,OAAO,IAAA,yBAAa,EAAC,aAAa,EAAE;QAClC,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE;YACrE,IAAI,KAAK,KAAK,EAAE,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtC,yCAAyC;gBACzC,OAAO;oBACL,IAAI,EAAE,QAAQ;oBACd,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;wBAChB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;qBACpB,CAAC;oBACF,8CAA8C;oBAC9C,UAAU,EAAE,sCAAsC;oBAClD,KAAK,EAAE,EAAE;oBACT,SAAS,EAAE,IAAI;oBACf,OAAO,EAAE,IAAI;oBACb,QAAQ,EAAE,EAAE;iBACb,CAAC;YACJ,CAAC;iBAAM,IAAI,KAAK,KAAK,UAAU,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;gBACpD,OAAO;oBACL,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;wBAChB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;qBACpB,CAAC;oBACF,KAAK,EAAE,UAAU;oBACjB,IAAI,EAAE,OAAO;oBACb,UAAU,EAAE,oCAAoC;oBAChD,SAAS,EAAE,IAAI;oBACf,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,IAAI;oBACb,QAAQ,EAAE,EAAE;iBACb,CAAC;YACJ,CAAC;iBAAM,IAAI,KAAK,KAAK,YAAY,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;gBACtD,OAAO;oBACL,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;wBAChB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;qBACpB,CAAC;oBACF,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,YAAY;oBACnB,UAAU,EAAE,sCAAsC;oBAClD,SAAS,EAAE,IAAI;oBACf,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;oBAC7D,QAAQ,EAAE,EAAE;iBACb,CAAC;YACJ,CAAC;iBAAM,IAAI,IAAI,KAAK,UAAU,IAAI,cAAc,IAAI,QAAQ,EAAE,CAAC;gBAC7D,OAAO;oBACL,GAAG,QAAQ;oBACX,SAAS;wBACP,OAAO,OAAO,CAAC,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;oBAC3E,CAAC;iBACF,CAAC;YACJ,CAAC;iBAAM,IAAI,IAAI,KAAK,SAAS,IAAI,aAAa,IAAI,QAAQ,EAAE,CAAC;gBAC3D,OAAO;oBACL,GAAG,QAAQ;oBACX,SAAS;wBACP,OAAO;4BACL,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,OAAO;yBACpE,CAAC;oBACJ,CAAC;iBACF,CAAC;YACJ,CAAC;YACD,MAAM,IAAI,KAAK,CACb,yBAAyB,KAAK,cAAc,IAAI,wBAAwB,cAAc,uBAAuB,aAAa,EAAE,CAC7H,CAAC;QACJ,CAAC;QACD,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,cAAc,CAC5B,aAA6B,EAC7B,UAAmB,EAAE;IAErB,OAAO,SAAS,CAAC,aAAa,EAAE;QAC9B,GAAG,OAAO;QACV,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;AACL,CAAC;AAED,iDAAqE;AAA5D,gHAAA,eAAe,OAAA;AAAE,kHAAA,iBAAiB,OAAA","sourcesContent":["import type { RouteNode } from './Route';\nimport { getRoutes as getRoutesCore, type Options as OptionsCore } from './getRoutesCore';\nimport type { RequireContext } from './types';\n\nexport type Options = Omit<OptionsCore, 'getSystemRoute'>;\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options = {}): RouteNode | null {\n return getRoutesCore(contextModule, {\n getSystemRoute({ route, type, defaults, redirectConfig, rewriteConfig }) {\n if (route === '' && type === 'layout') {\n // Root layout when no layout is defined.\n return {\n type: 'layout',\n loadRoute: () => ({\n default: () => null,\n }),\n // Generate a fake file name for the directory\n contextKey: 'expo-router/build/views/Navigator.js',\n route: '',\n generated: true,\n dynamic: null,\n children: [],\n };\n } else if (route === '_sitemap' && type === 'route') {\n return {\n loadRoute: () => ({\n default: () => null,\n }),\n route: '_sitemap',\n type: 'route',\n contextKey: 'expo-router/build/views/Sitemap.js',\n generated: true,\n internal: true,\n dynamic: null,\n children: [],\n };\n } else if (route === '+not-found' && type === 'route') {\n return {\n loadRoute: () => ({\n default: () => null,\n }),\n type: 'route',\n route: '+not-found',\n contextKey: 'expo-router/build/views/Unmatched.js',\n generated: true,\n internal: true,\n dynamic: [{ name: '+not-found', deep: true, notFound: true }],\n children: [],\n };\n } else if (type === 'redirect' && redirectConfig && defaults) {\n return {\n ...defaults,\n loadRoute() {\n return require('./getRoutesRedirects').getRedirectModule(redirectConfig);\n },\n };\n } else if (type === 'rewrite' && rewriteConfig && defaults) {\n return {\n ...defaults,\n loadRoute() {\n return {\n default: contextModule(rewriteConfig.destinationContextKey).default,\n };\n },\n };\n }\n throw new Error(\n `Unknown system route: ${route} and type: ${type} and redirectConfig: ${redirectConfig} and rewriteConfig: ${rewriteConfig}`\n );\n },\n ...options,\n });\n}\n\nexport function getExactRoutes(\n contextModule: RequireContext,\n options: Options = {}\n): RouteNode | null {\n return getRoutes(contextModule, {\n ...options,\n skipGenerated: true,\n });\n}\n\nexport { generateDynamic, extrapolateGroups } from './getRoutesCore';\n"]}
@@ -1,88 +0,0 @@
1
- /**
2
- * Copyright © 2023 650 Industries.
3
- * Copyright © 2023 Vercel, Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- *
8
- * Based on https://github.com/vercel/next.js/blob/1df2686bc9964f1a86c444701fa5cbf178669833/packages/next/src/shared/lib/router/utils/route-regex.ts
9
- */
10
- import type { RouteNode } from './Route';
11
- export type ExpoRouterServerManifestV1Route<TRegex = string> = {
12
- file: string;
13
- page: string;
14
- /**
15
- * Keys are route param names that have been normalized for a regex named-matcher, values are the original route param names.
16
- */
17
- routeKeys: Record<string, string>;
18
- /**
19
- * Regex for matching a path against the route.
20
- * The regex is normalized for named matchers so keys must be looked up against the `routeKeys` object to collect the original route param names.
21
- * Regex matching alone cannot accurately route to a file, the order in which routes are matched is equally important to ensure correct priority.
22
- */
23
- namedRegex: TRegex;
24
- /** Indicates that the route was generated and does not map to any file in the project's routes directory. */
25
- generated?: boolean;
26
- /** Indicates that this is a redirect that should use 301 instead of 307 */
27
- permanent?: boolean;
28
- /** If a redirect, which methods are allowed. Undefined represents all methods */
29
- methods?: string[];
30
- };
31
- export type ExpoRouterServerManifestV1Middleware = {
32
- /**
33
- * Path to the module that contains the middleware function as a default export.
34
- *
35
- * @example _expo/functions/+middleware.js
36
- */
37
- file: string;
38
- };
39
- export type ExpoRouterServerManifestV1<TRegex = string> = {
40
- /**
41
- * Middleware function that runs before any route matching.
42
- * Only allowed at the root level and requires web.output: "server".
43
- */
44
- middleware?: ExpoRouterServerManifestV1Middleware;
45
- /**
46
- * Headers to be applied to all responses from the server.
47
- */
48
- headers?: Record<string, string | string[]>;
49
- /**
50
- * Rewrites. After middleware has processed and regular routing resumes, these occur first.
51
- */
52
- rewrites: ExpoRouterServerManifestV1Route<TRegex>[];
53
- /**
54
- * List of routes that match second. Returns 301 and redirects to another path.
55
- */
56
- redirects: ExpoRouterServerManifestV1Route<TRegex>[];
57
- /**
58
- * Routes that return static HTML files for a given path.
59
- * These are only matched against requests with method `GET` and `HEAD`.
60
- */
61
- htmlRoutes: ExpoRouterServerManifestV1Route<TRegex>[];
62
- /**
63
- * Routes that are matched after HTML routes and invoke WinterCG-compliant functions.
64
- */
65
- apiRoutes: ExpoRouterServerManifestV1Route<TRegex>[];
66
- /** List of routes that are matched last and return with status code 404. */
67
- notFoundRoutes: ExpoRouterServerManifestV1Route<TRegex>[];
68
- };
69
- export interface Group {
70
- pos: number;
71
- repeat: boolean;
72
- optional: boolean;
73
- }
74
- export interface RouteRegex {
75
- groups: Record<string, Group>;
76
- re: RegExp;
77
- }
78
- type GetServerManifestOptions = {
79
- headers?: Record<string, string | string[]>;
80
- };
81
- export declare function getServerManifest(route: RouteNode, options: GetServerManifestOptions | undefined): ExpoRouterServerManifestV1;
82
- export declare function parseParameter(param: string): {
83
- name: string;
84
- repeat: boolean;
85
- optional: boolean;
86
- };
87
- export {};
88
- //# sourceMappingURL=getServerManifest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getServerManifest.d.ts","sourceRoot":"","sources":["../src/getServerManifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMzC,MAAM,MAAM,+BAA+B,CAAC,MAAM,GAAG,MAAM,IAAI;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,6GAA6G;IAC7G,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,MAAM,GAAG,MAAM,IAAI;IACxD;;;OAGG;IACH,UAAU,CAAC,EAAE,oCAAoC,CAAC;IAClD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC5C;;OAEG;IACH,QAAQ,EAAE,+BAA+B,CAAC,MAAM,CAAC,EAAE,CAAC;IACpD;;OAEG;IACH,SAAS,EAAE,+BAA+B,CAAC,MAAM,CAAC,EAAE,CAAC;IACrD;;;OAGG;IACH,UAAU,EAAE,+BAA+B,CAAC,MAAM,CAAC,EAAE,CAAC;IACtD;;OAEG;IACH,SAAS,EAAE,+BAA+B,CAAC,MAAM,CAAC,EAAE,CAAC;IACrD,4EAA4E;IAC5E,cAAc,EAAE,+BAA+B,CAAC,MAAM,CAAC,EAAE,CAAC;CAC3D,CAAC;AAEF,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;CACZ;AAqBD,KAAK,wBAAwB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;CAC7C,CAAC;AAGF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,wBAAwB,GAAG,SAAS,GAC5C,0BAA0B,CA8F5B;AA6JD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM;;;;EAgB3C"}
@@ -1,238 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getServerManifest = getServerManifest;
4
- exports.parseParameter = parseParameter;
5
- const matchers_1 = require("./matchers");
6
- const sortRoutes_1 = require("./sortRoutes");
7
- const url_1 = require("./utils/url");
8
- function isNotFoundRoute(route) {
9
- return route.dynamic && route.dynamic[route.dynamic.length - 1].notFound;
10
- }
11
- function uniqueBy(arr, key) {
12
- const seen = new Set();
13
- return arr.filter((item) => {
14
- const id = key(item);
15
- if (seen.has(id)) {
16
- return false;
17
- }
18
- seen.add(id);
19
- return true;
20
- });
21
- }
22
- // Given a nested route tree, return a flattened array of all routes that can be matched.
23
- function getServerManifest(route, options) {
24
- function getFlatNodes(route, parentRoute = '') {
25
- // Use a recreated route instead of contextKey because we duplicate nodes to support array syntax.
26
- const absoluteRoute = [parentRoute, route.route].filter(Boolean).join('/');
27
- if (route.children.length) {
28
- return route.children.map((child) => getFlatNodes(child, absoluteRoute)).flat();
29
- }
30
- // API Routes are handled differently to HTML routes because they have no nested behavior.
31
- // An HTML route can be different based on parent segments due to layout routes, therefore multiple
32
- // copies should be rendered. However, an API route is always the same regardless of parent segments.
33
- let key;
34
- if (route.type.includes('api')) {
35
- key = getNormalizedContextKey(route.contextKey);
36
- }
37
- else {
38
- key = getNormalizedContextKey(absoluteRoute);
39
- }
40
- return [[key, '/' + absoluteRoute, route]];
41
- }
42
- // Remove duplicates from the runtime manifest which expands array syntax.
43
- const flat = getFlatNodes(route)
44
- .sort(([, , a], [, , b]) => (0, sortRoutes_1.sortRoutes)(b, a))
45
- .reverse();
46
- const apiRoutes = uniqueBy(flat.filter(([, , route]) => route.type === 'api'), ([path]) => path);
47
- const otherRoutes = uniqueBy(flat.filter(([, , route]) => route.type === 'route' ||
48
- (route.type === 'rewrite' && (route.methods === undefined || route.methods.includes('GET')))), ([path]) => path);
49
- const redirects = uniqueBy(flat.filter(([, , route]) => route.type === 'redirect'), ([path]) => path)
50
- .map((redirect) => {
51
- // TODO(@hassankhan): ENG-16577
52
- // For external redirects, use `destinationContextKey` as the destination URL
53
- if ((0, url_1.shouldLinkExternally)(redirect[2].destinationContextKey)) {
54
- redirect[1] = redirect[2].destinationContextKey;
55
- }
56
- else {
57
- redirect[1] =
58
- flat.find(([, , route]) => route.contextKey === redirect[2].destinationContextKey)?.[0] ??
59
- '/';
60
- }
61
- return redirect;
62
- })
63
- .reverse();
64
- const rewrites = uniqueBy(flat.filter(([, , route]) => route.type === 'rewrite'), ([path]) => path)
65
- .map((rewrite) => {
66
- rewrite[1] =
67
- flat.find(([, , route]) => route.contextKey === rewrite[2].destinationContextKey)?.[0] ??
68
- '/';
69
- return rewrite;
70
- })
71
- .reverse();
72
- const standardRoutes = otherRoutes.filter(([, , route]) => !isNotFoundRoute(route));
73
- const notFoundRoutes = otherRoutes.filter(([, , route]) => isNotFoundRoute(route));
74
- const manifest = {
75
- apiRoutes: getMatchableManifestForPaths(apiRoutes),
76
- htmlRoutes: getMatchableManifestForPaths(standardRoutes),
77
- notFoundRoutes: getMatchableManifestForPaths(notFoundRoutes),
78
- redirects: getMatchableManifestForPaths(redirects),
79
- rewrites: getMatchableManifestForPaths(rewrites),
80
- };
81
- if (route.middleware) {
82
- manifest.middleware = {
83
- file: route.middleware.contextKey,
84
- };
85
- }
86
- if (options?.headers) {
87
- manifest.headers = options.headers;
88
- }
89
- return manifest;
90
- }
91
- function getMatchableManifestForPaths(paths) {
92
- return paths.map(([normalizedRoutePath, absoluteRoute, node]) => {
93
- const matcher = getNamedRouteRegex(normalizedRoutePath, absoluteRoute, node.contextKey);
94
- if (node.generated) {
95
- matcher.generated = true;
96
- }
97
- if (node.permanent) {
98
- matcher.permanent = true;
99
- }
100
- if (node.methods) {
101
- matcher.methods = node.methods;
102
- }
103
- return matcher;
104
- });
105
- }
106
- function getNamedRouteRegex(normalizedRoute, page, file) {
107
- const result = getNamedParametrizedRoute(normalizedRoute);
108
- return {
109
- file,
110
- page,
111
- namedRegex: `^${result.namedParameterizedRoute}(?:/)?$`,
112
- routeKeys: result.routeKeys,
113
- };
114
- }
115
- /**
116
- * Builds a function to generate a minimal routeKey using only a-z and minimal
117
- * number of characters.
118
- */
119
- function buildGetSafeRouteKey() {
120
- let currentCharCode = 96; // Starting one before 'a' to make the increment logic simpler
121
- let currentLength = 1;
122
- return () => {
123
- let result = '';
124
- let incrementNext = true;
125
- // Iterate from right to left to build the key
126
- for (let i = 0; i < currentLength; i++) {
127
- if (incrementNext) {
128
- currentCharCode++;
129
- if (currentCharCode > 122) {
130
- currentCharCode = 97; // Reset to 'a'
131
- incrementNext = true; // Continue to increment the next character
132
- }
133
- else {
134
- incrementNext = false;
135
- }
136
- }
137
- result = String.fromCharCode(currentCharCode) + result;
138
- }
139
- // If all characters are 'z', increase the length of the key
140
- if (incrementNext) {
141
- currentLength++;
142
- currentCharCode = 96; // This will make the next key start with 'a'
143
- }
144
- return result;
145
- };
146
- }
147
- function removeTrailingSlash(route) {
148
- return route.replace(/\/$/, '') || '/';
149
- }
150
- function getNamedParametrizedRoute(route) {
151
- const segments = removeTrailingSlash(route).slice(1).split('/');
152
- const getSafeRouteKey = buildGetSafeRouteKey();
153
- const routeKeys = {};
154
- return {
155
- namedParameterizedRoute: segments
156
- .map((segment, index) => {
157
- if (segment === '+not-found' && index === segments.length - 1) {
158
- segment = '[...not-found]';
159
- }
160
- if (/^\[.*\]$/.test(segment)) {
161
- const { name, optional, repeat } = parseParameter(segment);
162
- // replace any non-word characters since they can break
163
- // the named regex
164
- let cleanedKey = name.replace(/\W/g, '');
165
- let invalidKey = false;
166
- // check if the key is still invalid and fallback to using a known
167
- // safe key
168
- if (cleanedKey.length === 0 || cleanedKey.length > 30) {
169
- invalidKey = true;
170
- }
171
- if (!isNaN(parseInt(cleanedKey.slice(0, 1), 10))) {
172
- invalidKey = true;
173
- }
174
- // Prevent duplicates after sanitizing the key
175
- if (cleanedKey in routeKeys) {
176
- invalidKey = true;
177
- }
178
- if (invalidKey) {
179
- cleanedKey = getSafeRouteKey();
180
- }
181
- routeKeys[cleanedKey] = name;
182
- return repeat
183
- ? optional
184
- ? `(?:/(?<${cleanedKey}>.+?))?`
185
- : `/(?<${cleanedKey}>.+?)`
186
- : `/(?<${cleanedKey}>[^/]+?)`;
187
- }
188
- else if (/^\(.*\)$/.test(segment)) {
189
- const groupName = (0, matchers_1.matchGroupName)(segment)
190
- .split(',')
191
- .map((group) => group.trim())
192
- .filter(Boolean);
193
- if (groupName.length > 1) {
194
- const optionalSegment = `\\((?:${groupName.map(escapeStringRegexp).join('|')})\\)`;
195
- // Make section optional
196
- return `(?:/${optionalSegment})?`;
197
- }
198
- else {
199
- // Use simpler regex for single groups
200
- return `(?:/${escapeStringRegexp(segment)})?`;
201
- }
202
- }
203
- else {
204
- return `/${escapeStringRegexp(segment)}`;
205
- }
206
- })
207
- .join(''),
208
- routeKeys,
209
- };
210
- }
211
- // regexp is based on https://github.com/sindresorhus/escape-string-regexp
212
- const reHasRegExp = /[|\\{}()[\]^$+*?.-]/;
213
- const reReplaceRegExp = /[|\\{}()[\]^$+*?.-]/g;
214
- function escapeStringRegexp(str) {
215
- // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23
216
- if (reHasRegExp.test(str)) {
217
- return str.replace(reReplaceRegExp, '\\$&');
218
- }
219
- return str;
220
- }
221
- function parseParameter(param) {
222
- let repeat = false;
223
- let optional = false;
224
- let name = param;
225
- if (/^\[.*\]$/.test(name)) {
226
- optional = true;
227
- name = name.slice(1, -1);
228
- }
229
- if (/^\.\.\./.test(name)) {
230
- repeat = true;
231
- name = name.slice(3);
232
- }
233
- return { name, repeat, optional };
234
- }
235
- function getNormalizedContextKey(contextKey) {
236
- return (0, matchers_1.getContextKey)(contextKey).replace(/\/index$/, '') ?? '/';
237
- }
238
- //# sourceMappingURL=getServerManifest.js.map