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
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _ctx_1 = require("expo-router/_ctx");
4
- const create_expo_pages_1 = require("./create-expo-pages");
5
- const getRoutesSSR_1 = require("../../getRoutesSSR");
6
- const loadStaticParamsAsync_1 = require("../../loadStaticParamsAsync");
7
- const matchers_1 = require("../../matchers");
8
- const sortRoutes_1 = require("../../sortRoutes");
9
- const UNIMPLEMENTED_PARAMS = new Proxy({}, {
10
- // Assert that params is unimplemented when accessed.
11
- get() {
12
- throw new Error('generateStaticParams(): params is not implemented yet');
13
- },
14
- });
15
- exports.default = (0, create_expo_pages_1.createExpoPages)(async ({ createPage, createLayout }, { getRouteOptions }) => {
16
- const routes = (0, getRoutesSSR_1.getRoutes)(_ctx_1.ctx, {
17
- ...getRouteOptions,
18
- platform: process.env.EXPO_OS,
19
- skipGenerated: true,
20
- importMode: 'lazy',
21
- });
22
- if (!routes)
23
- return;
24
- async function loadAndConvertStaticParamsAsync(route) {
25
- const loaded = route.loadRoute();
26
- let staticPaths = undefined;
27
- if (route.dynamic) {
28
- const params = await (0, loadStaticParamsAsync_1.evalStaticParamsAsync)(route, { parentParams: UNIMPLEMENTED_PARAMS }, loaded.generateStaticParams);
29
- // Sort `params` like `[{a: 'x', b: 'y'}, { a: 'z', b: 'w' }]` for a route.dynamic like `[{name: 'a', deep: false}, {name: 'b', deep: false}]` to `[['a', 'y'], ['z', 'w]]`
30
- staticPaths = params?.map((p) => {
31
- const grouped = [];
32
- for (const dynamic of route.dynamic) {
33
- const defined = p[dynamic.name];
34
- if (!defined) {
35
- throw new Error('generateStaticParams is missing param: ' +
36
- dynamic.name +
37
- '. In route: ' +
38
- route.contextKey);
39
- }
40
- if (Array.isArray(defined)) {
41
- if (defined.length > 1) {
42
- throw new Error('generateStaticParams does not support returning multiple static paths for deep dynamic routes in React Server Components yet. Update route: ' +
43
- route.contextKey);
44
- }
45
- }
46
- const first = Array.isArray(defined) ? defined[0] : defined;
47
- grouped.push(first);
48
- }
49
- return grouped;
50
- });
51
- }
52
- else if (loaded.generateStaticParams) {
53
- throw new Error('Cannot use generateStaticParams without a dynamic route: ' + route.contextKey);
54
- }
55
- return staticPaths;
56
- }
57
- async function addLayout(route) {
58
- const normal = (0, matchers_1.getContextKey)(route.contextKey).replace(/\/index$/, '');
59
- const loaded = route.loadRoute();
60
- if (loaded.generateStaticParams) {
61
- throw new Error('generateStaticParams is not supported in _layout routes with React Server Components enabled yet.');
62
- }
63
- createLayout({
64
- // NOTE(EvanBacon): Support routes with top-level "use client"
65
- component: loaded.default,
66
- path: normal,
67
- render: 'static',
68
- ...loaded.unstable_settings,
69
- });
70
- await Promise.all(route.children.sort(sortRoutes_1.sortRoutes).map(async (child) => {
71
- if (child.type === 'layout') {
72
- await addLayout(child);
73
- }
74
- else {
75
- const normal = (0, matchers_1.getContextKey)(child.contextKey).replace(/\/index$/, '');
76
- const loaded = child.loadRoute();
77
- const settings = loaded.unstable_settings;
78
- // Support generateStaticParams for dynamic routes by defining the route twice.
79
- if (loaded.generateStaticParams) {
80
- createPage({
81
- // NOTE(EvanBacon): Support routes with top-level "use client"
82
- component: loaded.default,
83
- path: normal,
84
- render: 'static',
85
- ...loaded.unstable_settings,
86
- staticPaths: (await loadAndConvertStaticParamsAsync(child)),
87
- });
88
- if (settings?.render !== 'static') {
89
- createPage({
90
- // NOTE(EvanBacon): Support routes with top-level "use client"
91
- component: loaded.default,
92
- path: normal,
93
- render: 'dynamic',
94
- ...settings,
95
- });
96
- }
97
- }
98
- else {
99
- createPage({
100
- // NOTE(EvanBacon): Support routes with top-level "use client"
101
- component: loaded.default,
102
- path: normal,
103
- render: 'dynamic',
104
- ...settings,
105
- });
106
- }
107
- }
108
- }));
109
- }
110
- await addLayout(routes);
111
- });
112
- //# sourceMappingURL=expo-definedRouter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expo-definedRouter.js","sourceRoot":"","sources":["../../../src/rsc/router/expo-definedRouter.ts"],"names":[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ACH,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC","sourcesContent":["import { ctx } from 'expo-router/_ctx';\n\nimport { createExpoPages } from './create-expo-pages';\nimport type { RouteNode } from '../../Route';\nimport { getRoutes } from '../../getRoutesSSR';\nimport { evalStaticParamsAsync } from '../../loadStaticParamsAsync';\nimport { getContextKey } from '../../matchers';\nimport { sortRoutes } from '../../sortRoutes';\n\nconst UNIMPLEMENTED_PARAMS = new Proxy(\n {},\n {\n // Assert that params is unimplemented when accessed.\n get() {\n throw new Error('generateStaticParams(): params is not implemented yet');\n },\n }\n);\n\nexport default createExpoPages(async ({ createPage, createLayout }, { getRouteOptions }) => {\n const routes = getRoutes(ctx, {\n ...getRouteOptions,\n platform: process.env.EXPO_OS,\n skipGenerated: true,\n importMode: 'lazy',\n });\n\n if (!routes) return;\n\n async function loadAndConvertStaticParamsAsync(route: RouteNode) {\n const loaded = route.loadRoute();\n\n let staticPaths: string[][] | undefined = undefined;\n\n if (route.dynamic) {\n const params = await evalStaticParamsAsync(\n route,\n { parentParams: UNIMPLEMENTED_PARAMS },\n loaded.generateStaticParams\n );\n\n // Sort `params` like `[{a: 'x', b: 'y'}, { a: 'z', b: 'w' }]` for a route.dynamic like `[{name: 'a', deep: false}, {name: 'b', deep: false}]` to `[['a', 'y'], ['z', 'w]]`\n staticPaths = params?.map((p) => {\n const grouped: string[] = [];\n\n for (const dynamic of route.dynamic!) {\n const defined = p[dynamic.name];\n if (!defined) {\n throw new Error(\n 'generateStaticParams is missing param: ' +\n dynamic.name +\n '. In route: ' +\n route.contextKey\n );\n }\n if (Array.isArray(defined)) {\n if (defined.length > 1) {\n throw new Error(\n 'generateStaticParams does not support returning multiple static paths for deep dynamic routes in React Server Components yet. Update route: ' +\n route.contextKey\n );\n }\n }\n\n const first = Array.isArray(defined) ? defined[0] : defined;\n\n grouped.push(first);\n }\n return grouped;\n });\n } else if (loaded.generateStaticParams) {\n throw new Error(\n 'Cannot use generateStaticParams without a dynamic route: ' + route.contextKey\n );\n }\n return staticPaths;\n }\n async function addLayout(route: RouteNode) {\n const normal = getContextKey(route.contextKey).replace(/\\/index$/, '');\n\n const loaded = route.loadRoute();\n\n if (loaded.generateStaticParams) {\n throw new Error(\n 'generateStaticParams is not supported in _layout routes with React Server Components enabled yet.'\n );\n }\n\n createLayout({\n // NOTE(EvanBacon): Support routes with top-level \"use client\"\n component: loaded.default! as any,\n path: normal as any,\n render: 'static',\n ...loaded.unstable_settings,\n });\n\n await Promise.all(\n route.children.sort(sortRoutes).map(async (child) => {\n if (child.type === 'layout') {\n await addLayout(child);\n } else {\n const normal = getContextKey(child.contextKey).replace(/\\/index$/, '');\n const loaded = child.loadRoute();\n const settings = loaded.unstable_settings;\n\n // Support generateStaticParams for dynamic routes by defining the route twice.\n if (loaded.generateStaticParams) {\n createPage({\n // NOTE(EvanBacon): Support routes with top-level \"use client\"\n component: loaded.default as any,\n path: normal as any,\n render: 'static',\n ...loaded.unstable_settings,\n staticPaths: (await loadAndConvertStaticParamsAsync(child)) as any,\n });\n\n if (settings?.render !== 'static') {\n createPage({\n // NOTE(EvanBacon): Support routes with top-level \"use client\"\n component: loaded.default as any,\n path: normal as any,\n render: 'dynamic',\n ...settings,\n });\n }\n } else {\n createPage({\n // NOTE(EvanBacon): Support routes with top-level \"use client\"\n component: loaded.default as any,\n path: normal as any,\n render: 'dynamic',\n ...settings,\n });\n }\n }\n })\n );\n }\n\n await addLayout(routes);\n});\n"]}
@@ -1,3 +0,0 @@
1
- declare const _default: (getRouteOptions?: import("../../getRoutes").Options) => import("../server").EntriesDev;
2
- export default _default;
3
- //# sourceMappingURL=noopRouter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noopRouter.d.ts","sourceRoot":"","sources":["../../../src/rsc/router/noopRouter.ts"],"names":[],"mappings":";AAEA,wBAEG"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const create_expo_pages_1 = require("./create-expo-pages");
4
- exports.default = (0, create_expo_pages_1.createExpoPages)(async () => {
5
- // noop the router for client-only mode. This ensures we skip loading the routes in react-server mode.
6
- });
7
- //# sourceMappingURL=noopRouter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noopRouter.js","sourceRoot":"","sources":["../../../src/rsc/router/noopRouter.ts"],"names":[],"mappings":";;AAAA,2DAAsD;AAEtD,kBAAe,IAAA,mCAAe,EAAC,KAAK,IAAI,EAAE;IACxC,sGAAsG;AACxG,CAAC,CAAC,CAAC","sourcesContent":["import { createExpoPages } from './create-expo-pages';\n\nexport default createExpoPages(async () => {\n // noop the router for client-only mode. This ensures we skip loading the routes in react-server mode.\n});\n"]}
@@ -1,44 +0,0 @@
1
- /**
2
- * Copyright © 2024 650 Industries.
3
- * Copyright © 2024 dai-shi.
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
- * From waku https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/lib/renderers/rsc-renderer.ts
9
- */
10
- import '@expo/metro-runtime/rsc/runtime';
11
- import { type EntriesDev } from './server';
12
- export interface RenderContext<T = unknown> {
13
- rerender: (input: string, searchParams?: URLSearchParams) => void;
14
- context: T;
15
- }
16
- type ResolvedConfig = any;
17
- export type RenderRscArgs = {
18
- config: ResolvedConfig;
19
- input: string;
20
- context: Record<string, unknown> | undefined;
21
- body?: ReadableStream | undefined;
22
- contentType?: string | undefined;
23
- decodedBody?: unknown;
24
- moduleIdCallback?: (module: {
25
- id: string;
26
- chunks: string[];
27
- name: string;
28
- async: boolean;
29
- }) => void;
30
- onError?: (err: unknown) => void;
31
- };
32
- type ResolveClientEntry = (id: string, server: boolean) => {
33
- id: string;
34
- chunks: string[];
35
- };
36
- type RenderRscOpts = {
37
- isExporting: boolean;
38
- entries: EntriesDev;
39
- resolveClientEntry: ResolveClientEntry;
40
- loadServerModuleRsc: (url: string) => Promise<any>;
41
- };
42
- export declare function renderRsc(args: RenderRscArgs, opts: RenderRscOpts): Promise<ReadableStream>;
43
- export {};
44
- //# sourceMappingURL=rsc-renderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rsc-renderer.d.ts","sourceRoot":"","sources":["../../src/rsc/rsc-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,iCAAiC,CAAC;AAOzC,OAAO,EAAsB,KAAK,UAAU,EAAmB,MAAM,UAAU,CAAC;AAOhF,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO;IACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;IAClE,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,KAAK,cAAc,GAAG,GAAG,CAAC;AAE1B,MAAM,MAAM,aAAa,GAAG;IAE1B,MAAM,EAAE,cAAc,CAAC;IAGvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7C,IAAI,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE;QAC1B,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,OAAO,CAAC;KAChB,KAAK,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,KAAK,kBAAkB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE5F,KAAK,aAAa,GAAG;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,UAAU,CAAC;IACpB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,mBAAmB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACpD,CAAC;AAEF,wBAAsB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAwKjG"}
@@ -1,200 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright © 2024 650 Industries.
4
- * Copyright © 2024 dai-shi.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE file in the root directory of this source tree.
8
- *
9
- * From waku https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/lib/renderers/rsc-renderer.ts
10
- */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.renderRsc = renderRsc;
13
- // This file must remain platform agnostic for production exports.
14
- // Import the runtime to support polyfills for webpack to load modules in the server using Metro.
15
- require("@expo/metro-runtime/rsc/runtime");
16
- const server_1 = require("react-server-dom-webpack/server");
17
- const path_1 = require("./path");
18
- const utils_1 = require("./router/utils");
19
- const server_2 = require("./server");
20
- async function renderRsc(args, opts) {
21
- const { input, body, contentType, context, onError } = args;
22
- const { resolveClientEntry, entries } = opts;
23
- const { default: { renderEntries },
24
- // @ts-expect-error
25
- buildConfig, } = entries;
26
- function resolveRequest(isServer, encodedId) {
27
- const [
28
- // File is the on-disk location of the module, this is injected during the "use client" transformation (babel).
29
- file,
30
- // The name of the import (e.g. "default" or "")
31
- // This will be empty when using `module.exports = ` and `require('...')`.
32
- name = '',] = encodedId.split('#');
33
- const filePath = file.startsWith('file://') ? (0, path_1.fileURLToFilePath)(file) : file;
34
- args.moduleIdCallback?.({
35
- id: filePath,
36
- chunks: [
37
- // TODO: Add a lookup later which reads from the SSR manifest to get the correct chunk.
38
- // NOTE(EvanBacon): This is a placeholder since we need to render RSC to get the client boundaries, which we then inject later.
39
- 'chunk:' + filePath,
40
- ],
41
- name,
42
- async: true,
43
- });
44
- // We'll augment the file path with the incoming RSC request which will forward the metro props required to make a cache hit, e.g. platform=web&...
45
- // This is similar to how we handle lazy bundling.
46
- const resolved = resolveClientEntry(filePath, isServer);
47
- return { id: resolved.id, chunks: resolved.chunks, name, async: true };
48
- }
49
- const bundlerConfig = new Proxy({}, {
50
- get(_target, encodedId) {
51
- return resolveRequest(false, encodedId);
52
- },
53
- });
54
- const serverConfig = new Proxy({}, {
55
- get(_target, encodedId) {
56
- return resolveRequest(true, encodedId);
57
- },
58
- });
59
- // @ts-ignore: Not part of global types. This is added to support server actions loading more actions.
60
- global[`${__METRO_GLOBAL_PREFIX__}__loadBundleAsync`] = opts.loadServerModuleRsc;
61
- const renderWithContext = async (context, input, params) => {
62
- const renderStore = {
63
- context: context || {},
64
- rerender: () => {
65
- throw new Error('Cannot rerender');
66
- },
67
- };
68
- return (0, server_2.runWithRenderStore)(renderStore, async () => {
69
- const elements = await renderEntries(input, {
70
- params,
71
- buildConfig,
72
- });
73
- if (elements === null) {
74
- const err = new Error('No function component found at: ' + input);
75
- err.statusCode = 404;
76
- throw err;
77
- }
78
- if (Object.keys(elements).some((key) => key.startsWith('_'))) {
79
- throw new Error('"_" prefix is reserved');
80
- }
81
- return (0, server_1.renderToReadableStream)(elements, bundlerConfig, {
82
- onError,
83
- });
84
- });
85
- };
86
- const renderWithContextWithAction = async (context, actionFn, actionArgs) => {
87
- let elementsPromise = Promise.resolve({});
88
- let rendered = false;
89
- const renderStore = {
90
- context: context || {},
91
- rerender: async (input, params) => {
92
- if (rendered) {
93
- throw new Error('already rendered');
94
- }
95
- elementsPromise = Promise.all([
96
- elementsPromise,
97
- renderEntries(input, { params, buildConfig }),
98
- ]).then(([oldElements, newElements]) => ({
99
- ...oldElements,
100
- // FIXME we should actually check if newElements is null and send an error
101
- ...newElements,
102
- }));
103
- },
104
- };
105
- return (0, server_2.runWithRenderStore)(renderStore, async () => {
106
- const actionValue = await actionFn(...actionArgs);
107
- const elements = await elementsPromise;
108
- rendered = true;
109
- if (Object.keys(elements).some((key) => key.startsWith('_'))) {
110
- throw new Error('"_" prefix is reserved');
111
- }
112
- return (0, server_1.renderToReadableStream)({ ...elements, _value: actionValue }, bundlerConfig, {
113
- onError,
114
- });
115
- });
116
- };
117
- let decodedBody = args.decodedBody;
118
- if (body) {
119
- const bodyStr = await streamToString(body);
120
- if (typeof contentType === 'string' && contentType.startsWith('multipart/form-data')) {
121
- // XXX This doesn't support streaming unlike busboy
122
- const formData = parseFormData(bodyStr, contentType);
123
- decodedBody = await (0, server_1.decodeReply)(formData, serverConfig);
124
- }
125
- else if (bodyStr) {
126
- decodedBody = await (0, server_1.decodeReply)(bodyStr, serverConfig);
127
- }
128
- }
129
- const actionId = (0, utils_1.decodeActionId)(input);
130
- if (actionId) {
131
- if (!opts.isExporting &&
132
- // @ts-ignore
133
- !process.env.EXPO_UNSTABLE_SERVER_FUNCTIONS) {
134
- throw new Error('Experimental support for React Server Functions is not enabled');
135
- }
136
- const args = Array.isArray(decodedBody) ? decodedBody : [];
137
- const chunkInfo = serverConfig[actionId];
138
- // Load module into memory.
139
- await Promise.all(chunkInfo.chunks.map((chunk) => globalThis.__webpack_chunk_load__(chunk)));
140
- // Import module.
141
- const mod = globalThis.__webpack_require__(chunkInfo.id);
142
- const fn = chunkInfo.name === '*' ? chunkInfo.name : mod[chunkInfo.name] || mod;
143
- if (!fn) {
144
- throw new Error(`Could not find server action: ${actionId}. Module: ${JSON.stringify(chunkInfo, null, 2)}`);
145
- }
146
- return renderWithContextWithAction(context, fn, args);
147
- }
148
- // method === 'GET'
149
- return renderWithContext(context, input, decodedBody);
150
- }
151
- // TODO is this correct? better to use a library?
152
- const parseFormData = (body, contentType) => {
153
- const boundary = contentType.split('boundary=')[1];
154
- const parts = body.split(`--${boundary}`);
155
- const formData = new FormData();
156
- for (const part of parts) {
157
- if (part.trim() === '' || part === '--')
158
- continue;
159
- const [rawHeaders, content] = part.split('\r\n\r\n', 2);
160
- const headers = rawHeaders.split('\r\n').reduce((acc, currentHeader) => {
161
- const [key, value] = currentHeader.split(': ');
162
- acc[key.toLowerCase()] = value;
163
- return acc;
164
- }, {});
165
- const contentDisposition = headers['content-disposition'];
166
- const nameMatch = /name="([^"]+)"/.exec(contentDisposition);
167
- const filenameMatch = /filename="([^"]+)"/.exec(contentDisposition);
168
- if (nameMatch) {
169
- const name = nameMatch[1];
170
- if (filenameMatch) {
171
- const filename = filenameMatch[1];
172
- const type = headers['content-type'] || 'application/octet-stream';
173
- const blob = new Blob([content], { type });
174
- formData.append(name, blob, filename);
175
- }
176
- else {
177
- formData.append(name, content.trim());
178
- }
179
- }
180
- }
181
- return formData;
182
- };
183
- const streamToString = async (stream) => {
184
- const decoder = new TextDecoder();
185
- const reader = stream.getReader();
186
- const outs = [];
187
- let result;
188
- do {
189
- result = await reader.read();
190
- if (result.value) {
191
- if (!(result.value instanceof Uint8Array)) {
192
- throw new Error('Unexepected buffer type');
193
- }
194
- outs.push(decoder.decode(result.value, { stream: true }));
195
- }
196
- } while (!result.done);
197
- outs.push(decoder.decode());
198
- return outs.join('');
199
- };
200
- //# sourceMappingURL=rsc-renderer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rsc-renderer.js","sourceRoot":"","sources":["../../src/rsc/rsc-renderer.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAsDH,8BAwKC;AA5ND,kEAAkE;AAElE,iGAAiG;AACjG,2CAAyC;AAGzC,4DAAsF;AAEtF,iCAA2C;AAC3C,0CAAgD;AAChD,qCAAgF;AA0CzE,KAAK,UAAU,SAAS,CAAC,IAAmB,EAAE,IAAmB;IACtE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,GA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CAAC,KAAK,EAAE,CAAC;YACjB,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;gBAC1C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE;IACvB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC,CAAC","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n * Copyright © 2024 dai-shi.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * From waku https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/lib/renderers/rsc-renderer.ts\n */\n\n// This file must remain platform agnostic for production exports.\n\n// Import the runtime to support polyfills for webpack to load modules in the server using Metro.\nimport '@expo/metro-runtime/rsc/runtime';\n\nimport type { ReactNode } from 'react';\nimport { renderToReadableStream, decodeReply } from 'react-server-dom-webpack/server';\n\nimport { fileURLToFilePath } from './path';\nimport { decodeActionId } from './router/utils';\nimport { runWithRenderStore, type EntriesDev, type EntriesPrd } from './server';\n\ndeclare namespace globalThis {\n function __webpack_chunk_load__(id: string): Promise<unknown>;\n function __webpack_require__(id: string): any;\n}\n\nexport interface RenderContext<T = unknown> {\n rerender: (input: string, searchParams?: URLSearchParams) => void;\n context: T;\n}\n\ntype ResolvedConfig = any;\n\nexport type RenderRscArgs = {\n // TODO:\n config: ResolvedConfig;\n\n // Done\n input: string;\n context: Record<string, unknown> | undefined;\n body?: ReadableStream | undefined;\n contentType?: string | undefined;\n decodedBody?: unknown;\n moduleIdCallback?: (module: {\n id: string;\n chunks: string[];\n name: string;\n async: boolean;\n }) => void;\n onError?: (err: unknown) => void;\n};\n\ntype ResolveClientEntry = (id: string, server: boolean) => { id: string; chunks: string[] };\n\ntype RenderRscOpts = {\n isExporting: boolean;\n entries: EntriesDev;\n resolveClientEntry: ResolveClientEntry;\n loadServerModuleRsc: (url: string) => Promise<any>;\n};\n\nexport async function renderRsc(args: RenderRscArgs, opts: RenderRscOpts): Promise<ReadableStream> {\n const { input, body, contentType, context, onError } = args;\n const { resolveClientEntry, entries } = opts;\n\n const {\n default: { renderEntries },\n // @ts-expect-error\n buildConfig,\n } = entries as (EntriesDev & { loadModule: never; buildConfig: never }) | EntriesPrd;\n\n function resolveRequest(isServer: boolean, encodedId: string) {\n const [\n // File is the on-disk location of the module, this is injected during the \"use client\" transformation (babel).\n file,\n // The name of the import (e.g. \"default\" or \"\")\n // This will be empty when using `module.exports = ` and `require('...')`.\n name = '',\n ] = encodedId.split('#') as [string, string];\n\n const filePath = file.startsWith('file://') ? fileURLToFilePath(file) : file;\n\n args.moduleIdCallback?.({\n id: filePath,\n chunks: [\n // TODO: Add a lookup later which reads from the SSR manifest to get the correct chunk.\n // NOTE(EvanBacon): This is a placeholder since we need to render RSC to get the client boundaries, which we then inject later.\n 'chunk:' + filePath,\n ],\n name,\n async: true,\n });\n // We'll augment the file path with the incoming RSC request which will forward the metro props required to make a cache hit, e.g. platform=web&...\n // This is similar to how we handle lazy bundling.\n const resolved = resolveClientEntry(filePath, isServer);\n return { id: resolved.id, chunks: resolved.chunks, name, async: true };\n }\n\n const bundlerConfig: Record<string, ReturnType<typeof resolveRequest>> = new Proxy(\n {},\n {\n get(_target, encodedId: string) {\n return resolveRequest(false, encodedId);\n },\n }\n );\n\n const serverConfig: Record<string, ReturnType<typeof resolveRequest>> = new Proxy(\n {},\n {\n get(_target, encodedId: string) {\n return resolveRequest(true, encodedId);\n },\n }\n );\n\n // @ts-ignore: Not part of global types. This is added to support server actions loading more actions.\n global[`${__METRO_GLOBAL_PREFIX__}__loadBundleAsync`] = opts.loadServerModuleRsc;\n\n const renderWithContext = async (\n context: Record<string, unknown> | undefined,\n input: string,\n params: unknown\n ) => {\n const renderStore = {\n context: context || {},\n rerender: () => {\n throw new Error('Cannot rerender');\n },\n };\n return runWithRenderStore(renderStore, async () => {\n const elements = await renderEntries(input, {\n params,\n buildConfig,\n });\n if (elements === null) {\n const err = new Error('No function component found at: ' + input);\n (err as any).statusCode = 404;\n throw err;\n }\n if (Object.keys(elements).some((key) => key.startsWith('_'))) {\n throw new Error('\"_\" prefix is reserved');\n }\n return renderToReadableStream(elements, bundlerConfig, {\n onError,\n });\n });\n };\n\n const renderWithContextWithAction = async (\n context: Record<string, unknown> | undefined,\n actionFn: (...args: unknown[]) => unknown,\n actionArgs: unknown[]\n ) => {\n let elementsPromise: Promise<Record<string, ReactNode>> = Promise.resolve({});\n let rendered = false;\n const renderStore = {\n context: context || {},\n rerender: async (input: string, params?: unknown) => {\n if (rendered) {\n throw new Error('already rendered');\n }\n elementsPromise = Promise.all([\n elementsPromise,\n renderEntries(input, { params, buildConfig }),\n ]).then(([oldElements, newElements]) => ({\n ...oldElements,\n // FIXME we should actually check if newElements is null and send an error\n ...newElements,\n }));\n },\n };\n return runWithRenderStore(renderStore, async () => {\n const actionValue = await actionFn(...actionArgs);\n const elements = await elementsPromise;\n rendered = true;\n if (Object.keys(elements).some((key) => key.startsWith('_'))) {\n throw new Error('\"_\" prefix is reserved');\n }\n return renderToReadableStream({ ...elements, _value: actionValue }, bundlerConfig, {\n onError,\n });\n });\n };\n\n let decodedBody: unknown | undefined = args.decodedBody;\n if (body) {\n const bodyStr = await streamToString(body);\n if (typeof contentType === 'string' && contentType.startsWith('multipart/form-data')) {\n // XXX This doesn't support streaming unlike busboy\n const formData = parseFormData(bodyStr, contentType);\n decodedBody = await decodeReply(formData, serverConfig);\n } else if (bodyStr) {\n decodedBody = await decodeReply(bodyStr, serverConfig);\n }\n }\n\n const actionId = decodeActionId(input);\n if (actionId) {\n if (\n !opts.isExporting &&\n // @ts-ignore\n !process.env.EXPO_UNSTABLE_SERVER_FUNCTIONS\n ) {\n throw new Error('Experimental support for React Server Functions is not enabled');\n }\n\n const args = Array.isArray(decodedBody) ? decodedBody : [];\n\n const chunkInfo = serverConfig[actionId];\n\n // Load module into memory.\n await Promise.all(chunkInfo.chunks.map((chunk) => globalThis.__webpack_chunk_load__(chunk)));\n\n // Import module.\n const mod: any = globalThis.__webpack_require__(chunkInfo.id);\n const fn = chunkInfo.name === '*' ? chunkInfo.name : mod[chunkInfo.name] || mod;\n\n if (!fn) {\n throw new Error(\n `Could not find server action: ${actionId}. Module: ${JSON.stringify(chunkInfo, null, 2)}`\n );\n }\n\n return renderWithContextWithAction(context, fn, args);\n }\n\n // method === 'GET'\n return renderWithContext(context, input, decodedBody);\n}\n\n// TODO is this correct? better to use a library?\nconst parseFormData = (body: string, contentType: string) => {\n const boundary = contentType.split('boundary=')[1];\n const parts = body.split(`--${boundary}`);\n const formData = new FormData();\n for (const part of parts) {\n if (part.trim() === '' || part === '--') continue;\n const [rawHeaders, content] = part.split('\\r\\n\\r\\n', 2);\n const headers = rawHeaders!.split('\\r\\n').reduce(\n (acc, currentHeader) => {\n const [key, value] = currentHeader.split(': ');\n acc[key!.toLowerCase()] = value!;\n return acc;\n },\n {} as Record<string, string>\n );\n const contentDisposition = headers['content-disposition'];\n const nameMatch = /name=\"([^\"]+)\"/.exec(contentDisposition!);\n const filenameMatch = /filename=\"([^\"]+)\"/.exec(contentDisposition!);\n if (nameMatch) {\n const name = nameMatch[1];\n if (filenameMatch) {\n const filename = filenameMatch[1];\n const type = headers['content-type'] || 'application/octet-stream';\n const blob = new Blob([content!], { type });\n formData.append(name!, blob, filename);\n } else {\n formData.append(name!, content!.trim());\n }\n }\n }\n return formData;\n};\n\nconst streamToString = async (stream: ReadableStream): Promise<string> => {\n const decoder = new TextDecoder();\n const reader = stream.getReader();\n const outs: string[] = [];\n let result: ReadableStreamReadResult<unknown>;\n do {\n result = await reader.read();\n if (result.value) {\n if (!(result.value instanceof Uint8Array)) {\n throw new Error('Unexepected buffer type');\n }\n outs.push(decoder.decode(result.value, { stream: true }));\n }\n } while (!result.done);\n outs.push(decoder.decode());\n return outs.join('');\n};\n"]}
@@ -1,65 +0,0 @@
1
- /**
2
- * Copyright © 2024 650 Industries.
3
- * Copyright © 2024 2023 Daishi Kato
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
- import type { ReactNode } from 'react';
9
- import type { PathSpec } from './path';
10
- export declare const REQUEST_HEADERS = "__expo_requestHeaders";
11
- type Config = any;
12
- type Elements = Record<string, ReactNode>;
13
- export type BuildConfig = {
14
- pathname: string | PathSpec;
15
- isStatic?: boolean | undefined;
16
- entries?: {
17
- input: string;
18
- skipPrefetch?: boolean | undefined;
19
- isStatic?: boolean | undefined;
20
- }[];
21
- context?: Record<string, unknown>;
22
- customCode?: string;
23
- customData?: unknown;
24
- }[];
25
- export type RenderEntries = (input: string, options: {
26
- params: unknown | undefined;
27
- buildConfig: BuildConfig | undefined;
28
- }) => Promise<Elements | null>;
29
- export type GetBuildConfig = (unstable_collectClientModules: (input: string) => Promise<string[]>) => Promise<BuildConfig>;
30
- export type GetSsrConfig = (pathname: string, options: {
31
- searchParams: URLSearchParams;
32
- buildConfig?: BuildConfig | undefined;
33
- }) => Promise<{
34
- input: string;
35
- searchParams?: URLSearchParams;
36
- html: ReactNode;
37
- } | null>;
38
- export declare function defineEntries(renderEntries: RenderEntries, getBuildConfig?: GetBuildConfig, getSsrConfig?: GetSsrConfig): {
39
- renderEntries: RenderEntries;
40
- getBuildConfig: GetBuildConfig | undefined;
41
- getSsrConfig: GetSsrConfig | undefined;
42
- };
43
- export type EntriesDev = {
44
- default: ReturnType<typeof defineEntries>;
45
- };
46
- export type EntriesPrd = EntriesDev & {
47
- loadConfig: () => Promise<Config>;
48
- loadModule: (id: string) => Promise<unknown>;
49
- dynamicHtmlPaths: [pathSpec: PathSpec, htmlHead: string][];
50
- publicIndexHtml: string;
51
- };
52
- type RenderStore = {
53
- rerender: (input: string, params?: unknown) => void;
54
- context: Record<string, unknown>;
55
- };
56
- /**
57
- * This is an internal function and not for public use.
58
- */
59
- export declare const runWithRenderStore: <T>(renderStore: RenderStore, fn: () => T) => T;
60
- export declare function rerender(input: string, params?: unknown): Promise<void>;
61
- export declare function getContext<RscContext extends Record<string, unknown> = Record<string, unknown>>(): RscContext;
62
- /** Get the request headers used to make the server component or action request. */
63
- export declare function unstable_headers(): Promise<Headers>;
64
- export {};
65
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/rsc/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC,eAAO,MAAM,eAAe,0BAA0B,CAAC;AASvD,KAAK,MAAM,GAAG,GAAG,CAAC;AAElB,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAE1C,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACnC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAChC,EAAE,CAAC;IACJ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,EAAE,CAAC;AAEJ,MAAM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AE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AA2BF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,aAAa,WAAW,EAAE,IAAI,MAAM,CAAC,KAAG,CAY7E,CAAC;AAEF,wBAAsB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,iBAO7D;AAED,wBAAgB,UAAU,CACxB,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACjE,UAAU,CAOd;AAED,mFAAmF;AACnF,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAGzD"}
@@ -1,89 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright © 2024 650 Industries.
4
- * Copyright © 2024 2023 Daishi Kato
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE file in the root directory of this source tree.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.runWithRenderStore = exports.REQUEST_HEADERS = void 0;
11
- exports.defineEntries = defineEntries;
12
- exports.rerender = rerender;
13
- exports.getContext = getContext;
14
- exports.unstable_headers = unstable_headers;
15
- const async_hooks_1 = require("async_hooks");
16
- exports.REQUEST_HEADERS = '__expo_requestHeaders';
17
- function defineEntries(renderEntries, getBuildConfig, getSsrConfig) {
18
- return { renderEntries, getBuildConfig, getSsrConfig };
19
- }
20
- // TODO(EvanBacon): This can leak between platforms and runs.
21
- // We need to share this module between the server action module and the renderer module, per platform, and invalidate on refreshes.
22
- function getGlobalCacheForPlatform() {
23
- // HACK: This is a workaround for the shared middleware being shared between web and native.
24
- // In production the shared middleware is web-only and that causes the first version of this module
25
- // to be bound to web.
26
- const platform = globalThis.__expo_platform_header ?? process.env.EXPO_OS;
27
- if (!globalThis.__EXPO_RSC_CACHE__) {
28
- globalThis.__EXPO_RSC_CACHE__ = new Map();
29
- }
30
- if (globalThis.__EXPO_RSC_CACHE__.has(platform)) {
31
- return globalThis.__EXPO_RSC_CACHE__.get(platform);
32
- }
33
- const serverCache = new async_hooks_1.AsyncLocalStorage();
34
- globalThis.__EXPO_RSC_CACHE__.set(platform, serverCache);
35
- return serverCache;
36
- }
37
- let previousRenderStore;
38
- let currentRenderStore;
39
- /**
40
- * This is an internal function and not for public use.
41
- */
42
- const runWithRenderStore = (renderStore, fn) => {
43
- const renderStorage = getGlobalCacheForPlatform();
44
- if (renderStorage) {
45
- return renderStorage.run(renderStore, fn);
46
- }
47
- previousRenderStore = currentRenderStore;
48
- currentRenderStore = renderStore;
49
- try {
50
- return fn();
51
- }
52
- finally {
53
- currentRenderStore = previousRenderStore;
54
- }
55
- };
56
- exports.runWithRenderStore = runWithRenderStore;
57
- async function rerender(input, params) {
58
- const renderStorage = getGlobalCacheForPlatform();
59
- const renderStore = renderStorage.getStore() ?? currentRenderStore;
60
- if (!renderStore) {
61
- throw new Error('Render store is not available for rerender');
62
- }
63
- renderStore.rerender(input, params);
64
- }
65
- function getContext() {
66
- const renderStorage = getGlobalCacheForPlatform();
67
- const renderStore = renderStorage.getStore() ?? currentRenderStore;
68
- if (!renderStore) {
69
- throw new Error('Render store is not available for accessing context');
70
- }
71
- return renderStore.context;
72
- }
73
- /** Get the request headers used to make the server component or action request. */
74
- async function unstable_headers() {
75
- const headers = (getContext()[exports.REQUEST_HEADERS] || {});
76
- return new ReadonlyHeaders(headers);
77
- }
78
- class ReadonlyHeaders extends Headers {
79
- set() {
80
- throw new Error('Server component Headers are read-only');
81
- }
82
- append() {
83
- throw new Error('Server component Headers are read-only');
84
- }
85
- delete() {
86
- throw new Error('Server component Headers are read-only');
87
- }
88
- }
89
- //# sourceMappingURL=server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/rsc/server.ts"],"names":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,CAAC;CACF","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n * Copyright © 2024 2023 Daishi Kato\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { AsyncLocalStorage } from 'async_hooks';\nimport type { ReactNode } from 'react';\n\nimport type { PathSpec } from './path';\n\nexport const REQUEST_HEADERS = '__expo_requestHeaders';\n\ndeclare let globalThis: {\n __EXPO_RSC_CACHE__?: Map<string, any>;\n __expo_platform_header?: string;\n __webpack_chunk_load__: (id: string) => Promise<any>;\n __webpack_require__: (id: string) => any;\n};\n\ntype Config = any;\n\ntype Elements = Record<string, ReactNode>;\n\nexport type BuildConfig = {\n pathname: string | PathSpec; // TODO drop support for string?\n isStatic?: boolean | undefined;\n entries?: {\n input: string;\n skipPrefetch?: boolean | undefined;\n isStatic?: boolean | undefined;\n }[];\n context?: Record<string, unknown>;\n customCode?: string; // optional code to inject TODO hope to remove this\n customData?: unknown; // should be serializable with JSON.stringify\n}[];\n\nexport type RenderEntries = (\n input: string,\n options: {\n params: unknown | undefined;\n buildConfig: BuildConfig | undefined;\n }\n) => Promise<Elements | null>;\n\nexport type GetBuildConfig = (\n unstable_collectClientModules: (input: string) => Promise<string[]>\n) => Promise<BuildConfig>;\n\nexport type GetSsrConfig = (\n pathname: string,\n options: {\n searchParams: URLSearchParams;\n buildConfig?: BuildConfig | undefined;\n }\n) => Promise<{\n input: string;\n searchParams?: URLSearchParams;\n html: ReactNode;\n} | null>;\n\nexport function defineEntries(\n renderEntries: RenderEntries,\n getBuildConfig?: GetBuildConfig,\n getSsrConfig?: GetSsrConfig\n) {\n return { renderEntries, getBuildConfig, getSsrConfig };\n}\n\nexport type EntriesDev = {\n default: ReturnType<typeof defineEntries>;\n};\n\nexport type EntriesPrd = EntriesDev & {\n loadConfig: () => Promise<Config>;\n loadModule: (id: string) => Promise<unknown>;\n dynamicHtmlPaths: [pathSpec: PathSpec, htmlHead: string][];\n publicIndexHtml: string;\n};\n\ntype RenderStore<> = {\n rerender: (input: string, params?: unknown) => void;\n context: Record<string, unknown>;\n};\n\n// TODO(EvanBacon): This can leak between platforms and runs.\n// We need to share this module between the server action module and the renderer module, per platform, and invalidate on refreshes.\nfunction getGlobalCacheForPlatform() {\n // HACK: This is a workaround for the shared middleware being shared between web and native.\n // In production the shared middleware is web-only and that causes the first version of this module\n // to be bound to web.\n const platform = globalThis.__expo_platform_header ?? process.env.EXPO_OS;\n if (!globalThis.__EXPO_RSC_CACHE__) {\n globalThis.__EXPO_RSC_CACHE__ = new Map();\n }\n\n if (globalThis.__EXPO_RSC_CACHE__.has(platform!)) {\n return globalThis.__EXPO_RSC_CACHE__.get(platform!)!;\n }\n\n const serverCache = new AsyncLocalStorage<RenderStore>();\n\n globalThis.__EXPO_RSC_CACHE__.set(platform!, serverCache);\n\n return serverCache;\n}\n\nlet previousRenderStore: RenderStore | undefined;\nlet currentRenderStore: RenderStore | undefined;\n\n/**\n * This is an internal function and not for public use.\n */\nexport const runWithRenderStore = <T>(renderStore: RenderStore, fn: () => T): T => {\n const renderStorage = getGlobalCacheForPlatform();\n if (renderStorage) {\n return renderStorage.run(renderStore, fn);\n }\n previousRenderStore = currentRenderStore;\n currentRenderStore = renderStore;\n try {\n return fn();\n } finally {\n currentRenderStore = previousRenderStore;\n }\n};\n\nexport async function rerender(input: string, params?: unknown) {\n const renderStorage = getGlobalCacheForPlatform();\n const renderStore = renderStorage.getStore() ?? currentRenderStore;\n if (!renderStore) {\n throw new Error('Render store is not available for rerender');\n }\n renderStore.rerender(input, params);\n}\n\nexport function getContext<\n RscContext extends Record<string, unknown> = Record<string, unknown>,\n>(): RscContext {\n const renderStorage = getGlobalCacheForPlatform();\n const renderStore = renderStorage.getStore() ?? currentRenderStore;\n if (!renderStore) {\n throw new Error('Render store is not available for accessing context');\n }\n return renderStore.context as RscContext;\n}\n\n/** Get the request headers used to make the server component or action request. */\nexport async function unstable_headers(): Promise<Headers> {\n const headers = (getContext()[REQUEST_HEADERS] || {}) as Record<string, string>;\n return new ReadonlyHeaders(headers);\n}\n\nclass ReadonlyHeaders extends Headers {\n set() {\n throw new Error('Server component Headers are read-only');\n }\n append() {\n throw new Error('Server component Headers are read-only');\n }\n delete() {\n throw new Error('Server component Headers are read-only');\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- export declare function getRootComponent(): any;
2
- //# sourceMappingURL=getRootComponent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRootComponent.d.ts","sourceRoot":"","sources":["../../src/static/getRootComponent.ts"],"names":[],"mappings":"AAQA,wBAAgB,gBAAgB,QAe/B"}