expo-router 4.0.0-preview.12 → 4.0.0-preview.14

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 (88) hide show
  1. package/assets/error.png +0 -0
  2. package/assets/file.png +0 -0
  3. package/assets/forward.png +0 -0
  4. package/assets/logotype.png +0 -0
  5. package/assets/pkg.png +0 -0
  6. package/assets/sitemap.png +0 -0
  7. package/build/ExpoRoot.js +2 -2
  8. package/build/ExpoRoot.js.map +1 -1
  9. package/build/exports.d.ts +1 -1
  10. package/build/exports.d.ts.map +1 -1
  11. package/build/exports.js +24 -2
  12. package/build/exports.js.map +1 -1
  13. package/build/global-state/router-store.d.ts.map +1 -1
  14. package/build/global-state/router-store.js +1 -2
  15. package/build/global-state/router-store.js.map +1 -1
  16. package/build/layouts/Drawer.d.ts +2 -142
  17. package/build/layouts/Drawer.d.ts.map +1 -1
  18. package/build/layouts/Drawer.js +8 -5
  19. package/build/layouts/Drawer.js.map +1 -1
  20. package/build/layouts/DrawerClient.d.ts +144 -0
  21. package/build/layouts/DrawerClient.d.ts.map +1 -0
  22. package/build/layouts/DrawerClient.js +10 -0
  23. package/build/layouts/DrawerClient.js.map +1 -0
  24. package/build/layouts/Stack.d.ts +2 -126
  25. package/build/layouts/Stack.d.ts.map +1 -1
  26. package/build/layouts/Stack.js +8 -6
  27. package/build/layouts/Stack.js.map +1 -1
  28. package/build/layouts/StackClient.d.ts +128 -0
  29. package/build/layouts/StackClient.d.ts.map +1 -0
  30. package/build/layouts/StackClient.js +10 -0
  31. package/build/layouts/StackClient.js.map +1 -0
  32. package/build/layouts/Tabs.d.ts +2 -134
  33. package/build/layouts/Tabs.d.ts.map +1 -1
  34. package/build/layouts/Tabs.js +5 -37
  35. package/build/layouts/Tabs.js.map +1 -1
  36. package/build/layouts/TabsClient.d.ts +136 -0
  37. package/build/layouts/TabsClient.d.ts.map +1 -0
  38. package/build/layouts/TabsClient.js +44 -0
  39. package/build/layouts/TabsClient.js.map +1 -0
  40. package/build/onboard/Tutorial.d.ts.map +1 -1
  41. package/build/onboard/Tutorial.js +140 -86
  42. package/build/onboard/Tutorial.js.map +1 -1
  43. package/build/renderRootComponent.d.ts.map +1 -1
  44. package/build/renderRootComponent.js +1 -2
  45. package/build/renderRootComponent.js.map +1 -1
  46. package/build/rsc/middleware.d.ts +1 -1
  47. package/build/rsc/middleware.d.ts.map +1 -1
  48. package/build/rsc/middleware.js +2 -1
  49. package/build/rsc/middleware.js.map +1 -1
  50. package/build/rsc/server.d.ts +3 -0
  51. package/build/rsc/server.d.ts.map +1 -1
  52. package/build/rsc/server.js +19 -1
  53. package/build/rsc/server.js.map +1 -1
  54. package/build/ui/TabContext.d.ts +3 -2
  55. package/build/ui/TabContext.d.ts.map +1 -1
  56. package/build/ui/TabContext.js.map +1 -1
  57. package/build/ui/TabList.d.ts +3 -3
  58. package/build/ui/TabList.js +2 -2
  59. package/build/ui/TabList.js.map +1 -1
  60. package/build/ui/TabSlot.d.ts +28 -14
  61. package/build/ui/TabSlot.d.ts.map +1 -1
  62. package/build/ui/TabSlot.js +9 -7
  63. package/build/ui/TabSlot.js.map +1 -1
  64. package/build/ui/TabTrigger.d.ts +22 -9
  65. package/build/ui/TabTrigger.d.ts.map +1 -1
  66. package/build/ui/TabTrigger.js +6 -4
  67. package/build/ui/TabTrigger.js.map +1 -1
  68. package/build/ui/Tabs.d.ts +16 -23
  69. package/build/ui/Tabs.d.ts.map +1 -1
  70. package/build/ui/Tabs.js +15 -10
  71. package/build/ui/Tabs.js.map +1 -1
  72. package/build/utils/splash.d.ts +6 -0
  73. package/build/utils/splash.d.ts.map +1 -0
  74. package/build/utils/splash.js +51 -0
  75. package/build/utils/splash.js.map +1 -0
  76. package/build/views/Sitemap.d.ts.map +1 -1
  77. package/build/views/Sitemap.js +93 -46
  78. package/build/views/Sitemap.js.map +1 -1
  79. package/build/views/Splash.d.ts +1 -1
  80. package/build/views/Splash.d.ts.map +1 -1
  81. package/build/views/Splash.js +3 -13
  82. package/build/views/Splash.js.map +1 -1
  83. package/build/views/Try.d.ts.map +1 -1
  84. package/build/views/Try.js +1 -1
  85. package/build/views/Try.js.map +1 -1
  86. package/package.json +8 -9
  87. package/rsc/headers.d.ts +3 -0
  88. package/rsc/headers.js +5 -0
@@ -10,22 +10,6 @@ const react_native_safe_area_context_1 = require("react-native-safe-area-context
10
10
  const createEntryFile_1 = require("./createEntryFile");
11
11
  const exports_1 = require("../exports");
12
12
  const Pressable_1 = require("../views/Pressable");
13
- // TODO: Use openLinkFromBrowser thing
14
- function Header() {
15
- return (<Pressable_1.Pressable>
16
- {({ hovered }) => (<react_native_1.Text role="heading" aria-level={1} style={[styles.title, react_native_1.Platform.OS !== 'web' && { textAlign: 'left' }]}>
17
- Welcome to{' '}
18
- <exports_1.Link href="https://github.com/expo/expo-router/" style={[
19
- hovered && {
20
- textDecorationColor: 'white',
21
- textDecorationLine: 'underline',
22
- },
23
- ]}>
24
- Expo
25
- </exports_1.Link>
26
- </react_native_1.Text>)}
27
- </Pressable_1.Pressable>);
28
- }
29
13
  const canAutoTouchFile = process.env.EXPO_ROUTER_APP_ROOT != null;
30
14
  function Tutorial() {
31
15
  react_1.default.useEffect(() => {
@@ -39,24 +23,50 @@ function Tutorial() {
39
23
  location.replace('/');
40
24
  }
41
25
  if (typeof window !== 'undefined' && typeof window.document !== 'undefined') {
42
- window.document.title = 'npx expo start';
26
+ window.document.title = 'Welcome to Expo';
43
27
  }
44
28
  }
45
29
  }, []);
46
- return (<react_native_1.View style={styles.background}>
30
+ return (<react_native_safe_area_context_1.SafeAreaView style={styles.background}>
47
31
  <react_native_1.StatusBar barStyle="light-content"/>
48
-
49
- <react_native_safe_area_context_1.SafeAreaView style={styles.safeArea}>
50
- <react_native_1.View style={styles.container}>
51
- <Header />
52
- <react_native_1.Text role="heading" aria-level={2} style={styles.subtitle}>
53
- Start by creating a file{'\n'}in the{' '}
54
- <react_native_1.Text style={{ fontWeight: 'bold' }}>{getRootDir()}</react_native_1.Text> directory.
55
- </react_native_1.Text>
56
- {canAutoTouchFile && <Button />}
32
+ <react_native_1.View style={styles.container}>
33
+ <react_native_1.View style={styles.logotypeWrapper}>
34
+ <react_native_1.Image style={styles.logotype} source={require('expo-router/assets/logotype.png')}/>
57
35
  </react_native_1.View>
58
- </react_native_safe_area_context_1.SafeAreaView>
59
- </react_native_1.View>);
36
+ <react_native_1.Text role="heading" aria-level={1} style={styles.title}>
37
+ Welcome to Expo
38
+ </react_native_1.Text>
39
+ <react_native_1.Text role="heading" aria-level={2} style={[styles.subtitle, styles.textSecondary]}>
40
+ Start by creating a file{react_native_1.Platform.OS !== 'web' ? '\n' : ' '}in the{' '}
41
+ <react_native_1.Text style={{ fontWeight: '600' }}>{getRootDir()}</react_native_1.Text> directory.
42
+ </react_native_1.Text>
43
+ <react_native_1.Text>
44
+ <exports_1.Link href="https://docs.expo.dev/router/introduction/" {...react_native_1.Platform.select({ web: { target: '_blank' }, native: { asChild: true } })}>
45
+ <Pressable_1.Pressable>
46
+ {({ hovered, pressed }) => (<react_native_1.Text style={[
47
+ styles.link,
48
+ react_native_1.Platform.select({
49
+ web: {
50
+ transitionDuration: '200ms',
51
+ marginBottom: 12,
52
+ },
53
+ }),
54
+ hovered && {
55
+ opacity: 0.8,
56
+ textDecorationLine: 'underline',
57
+ },
58
+ pressed && {
59
+ opacity: 0.8,
60
+ },
61
+ ]}>
62
+ Learn more about Expo Router in the documentation.
63
+ </react_native_1.Text>)}
64
+ </Pressable_1.Pressable>
65
+ </exports_1.Link>
66
+ </react_native_1.Text>
67
+ {canAutoTouchFile && <Button />}
68
+ </react_native_1.View>
69
+ </react_native_safe_area_context_1.SafeAreaView>);
60
70
  }
61
71
  exports.Tutorial = Tutorial;
62
72
  function getRootDir() {
@@ -72,111 +82,155 @@ function getRootDir() {
72
82
  function Button() {
73
83
  return (<Pressable_1.Pressable onPress={() => {
74
84
  (0, createEntryFile_1.createEntryFileAsync)();
75
- }} style={{
76
- ...react_native_1.Platform.select({
77
- web: {
78
- // subtle white shadow
79
- boxShadow: 'rgba(255, 255, 255, 0.15) 0px 0px 20px 5px',
80
- },
81
- native: {
82
- position: 'absolute',
83
- bottom: 24,
84
- left: 24,
85
- right: 24,
86
- overflow: 'hidden',
87
- },
88
- }),
89
- }}>
85
+ }} style={styles.button}>
90
86
  {({ pressed, hovered }) => (<react_native_1.View style={[
91
87
  styles.buttonContainer,
92
88
  hovered && {
93
- backgroundColor: 'white',
94
- },
95
- pressed && {
96
- backgroundColor: 'rgba(255,255,255,0.7)',
89
+ backgroundColor: '#fff',
97
90
  },
91
+ pressed &&
92
+ react_native_1.Platform.select({
93
+ web: {
94
+ transform: 'scale(0.98)',
95
+ transitionDuration: '200ms',
96
+ },
97
+ default: {
98
+ backgroundColor: '#fff',
99
+ },
100
+ }),
101
+ ]}>
102
+ <react_native_1.Text style={[
103
+ styles.code,
104
+ hovered && { color: '#000' },
105
+ pressed &&
106
+ react_native_1.Platform.select({
107
+ native: { color: '#000' },
108
+ }),
98
109
  ]}>
99
- <react_native_1.Text style={[styles.code, hovered && { color: 'black' }]}>
100
- <react_native_1.Text style={{ color: '#BCC3CD' }}>$</react_native_1.Text> touch {getRootDir()}
101
- /index.js
110
+ <react_native_1.Text style={styles.textSecondary}>$</react_native_1.Text> touch {getRootDir()}
111
+ /index.tsx
102
112
  </react_native_1.Text>
103
113
  </react_native_1.View>)}
104
114
  </Pressable_1.Pressable>);
105
115
  }
106
116
  const styles = react_native_1.StyleSheet.create({
107
117
  background: {
108
- ...react_native_1.Platform.select({
109
- web: {
110
- backgroundImage: 'radial-gradient(circle at 1px 1px, rgba(255,255,255,0.15) 1px, transparent 0)',
111
- backgroundPositionX: -3,
112
- backgroundPositionY: -3,
113
- backgroundSize: '40px 40px',
114
- },
115
- }),
116
- backgroundColor: 'black',
118
+ backgroundColor: '#000',
117
119
  flex: 1,
118
120
  },
119
- safeArea: {
120
- flex: 1,
121
- maxWidth: 960,
122
- marginHorizontal: 'auto',
123
- alignItems: 'stretch',
124
- },
125
121
  container: {
126
122
  flex: 1,
127
123
  padding: 24,
128
- alignItems: 'flex-start',
124
+ paddingBottom: 64,
125
+ alignItems: 'center',
129
126
  justifyContent: 'center',
127
+ marginHorizontal: 'auto',
128
+ gap: 16,
129
+ ...react_native_1.Platform.select({
130
+ web: {
131
+ maxWidth: 960,
132
+ },
133
+ native: {
134
+ width: '100%',
135
+ },
136
+ }),
137
+ },
138
+ logotypeWrapper: {
139
+ alignItems: 'center',
140
+ justifyContent: 'center',
141
+ backgroundColor: '#151718',
142
+ borderRadius: 12,
143
+ borderWidth: 1,
144
+ borderStyle: 'solid',
145
+ borderColor: '#313538',
146
+ width: 78,
147
+ height: 78,
148
+ marginBottom: 8,
149
+ },
150
+ logotype: {
151
+ width: 48,
152
+ height: 44,
130
153
  },
131
154
  title: {
132
- color: 'white',
133
- fontSize: 64,
134
- paddingBottom: 24,
135
- fontWeight: 'bold',
155
+ ...react_native_1.Platform.select({
156
+ web: {
157
+ fontSize: 64,
158
+ lineHeight: 68,
159
+ },
160
+ default: {
161
+ fontSize: 56,
162
+ lineHeight: 60,
163
+ },
164
+ }),
165
+ color: '#fff',
166
+ fontWeight: '800',
167
+ textAlign: 'center',
136
168
  },
137
169
  buttonContainer: {
138
170
  ...react_native_1.Platform.select({
139
171
  web: {
140
172
  transitionDuration: '200ms',
141
- backgroundColor: 'transparent',
142
- },
143
- default: {
144
- backgroundColor: 'white',
145
173
  },
146
174
  }),
147
- borderColor: 'white',
175
+ backgroundColor: 'transparent',
176
+ borderColor: '#fff',
148
177
  borderWidth: 2,
149
178
  paddingVertical: 12,
150
179
  paddingHorizontal: 24,
180
+ borderRadius: 8,
151
181
  },
152
- buttonText: {
153
- color: 'black',
182
+ button: {
183
+ ...react_native_1.Platform.select({
184
+ web: {
185
+ marginTop: 12,
186
+ },
187
+ native: {
188
+ position: 'absolute',
189
+ bottom: 24,
190
+ left: 32,
191
+ right: 32,
192
+ overflow: 'hidden',
193
+ },
194
+ }),
154
195
  },
155
196
  code: {
156
197
  ...react_native_1.Platform.select({
157
198
  web: {
158
199
  transitionDuration: '200ms',
159
- color: 'white',
160
- fontFamily: 'Courier',
200
+ fontFamily: 'Courier, monospace',
161
201
  },
162
202
  default: {
163
- color: 'black',
164
203
  fontFamily: react_native_1.Platform.select({
165
204
  ios: 'Courier New',
166
205
  android: 'monospace',
167
206
  }),
168
207
  },
169
208
  }),
209
+ color: '#fff',
210
+ textAlign: 'center',
170
211
  userSelect: 'none',
171
212
  fontSize: 18,
172
213
  fontWeight: 'bold',
173
214
  },
174
215
  subtitle: {
175
- color: '#BCC3CD',
176
- fontSize: 36,
177
- fontWeight: '100',
178
- paddingBottom: 36,
179
- maxWidth: 960,
216
+ fontSize: 34,
217
+ fontWeight: '200',
218
+ textAlign: 'center',
219
+ },
220
+ link: {
221
+ fontSize: 20,
222
+ lineHeight: 26,
223
+ textAlign: 'center',
224
+ color: '#52a9ff',
225
+ marginTop: 12,
226
+ ...react_native_1.Platform.select({
227
+ web: {
228
+ marginBottom: 24,
229
+ },
230
+ }),
231
+ },
232
+ textSecondary: {
233
+ color: '#9ba1a6',
180
234
  },
181
235
  });
182
236
  //# sourceMappingURL=Tutorial.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tutorial.js","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAA2E;AAC3E,mFAA8D;AAE9D,uDAAyD;AACzD,wCAAkC;AAClC,kDAA+C;AAE/C,sCAAsC;AACtC,SAAS,MAAM;IACb,OAAO,CACL,CAAC,qBAAS,CACR;MAAA,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAChB,CAAC,mBAAI,CACH,IAAI,CAAC,SAAS,CACd,UAAU,CAAC,CAAC,CAAC,CAAC,CACd,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI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E,YAAY;QACxB,cAAc,EAAE,QAAQ;KACzB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,aAAa,EAAE,EAAE;QACjB,UAAU,EAAE,MAAM;KACnB;IACD,eAAe,EAAE;QACf,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,kBAAkB,EAAE,OAAO;gBAC3B,eAAe,EAAE,aAAa;aAC/B;YACD,OAAO,EAAE;gBACP,eAAe,EAAE,OAAO;aACzB;SACF,CAAC;QAEF,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,CAAC;QACd,eAAe,EAAE,EAAE;QACnB,iBAAiB,EAAE,EAAE;KACtB;IACD,UAAU,EAAE;QACV,KAAK,EAAE,OAAO;KACf;IACD,IAAI,EAAE;QACJ,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,kBAAkB,EAAE,OAAO;gBAC3B,KAAK,EAAE,OAAO;gBACd,UAAU,EAAE,SAAS;aACtB;YACD,OAAO,EAAE;gBACP,KAAK,EAAE,OAAO;gBACd,UAAU,EAAE,uBAAQ,CAAC,MAAM,CAAC;oBAC1B,GAAG,EAAE,aAAa;oBAClB,OAAO,EAAE,WAAW;iBACrB,CAAC;aACH;SACF,CAAC;QAEF,UAAU,EAAE,MAAM;QAClB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;KACnB;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,aAAa,EAAE,EAAE;QACjB,QAAQ,EAAE,GAAG;KACd;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Platform, StatusBar, StyleSheet, Text, View } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { createEntryFileAsync } from './createEntryFile';\nimport { Link } from '../exports';\nimport { Pressable } from '../views/Pressable';\n\n// TODO: Use openLinkFromBrowser thing\nfunction Header() {\n return (\n <Pressable>\n {({ hovered }) => (\n <Text\n role=\"heading\"\n aria-level={1}\n style={[styles.title, Platform.OS !== 'web' && { textAlign: 'left' }]}>\n Welcome to{' '}\n <Link\n href=\"https://github.com/expo/expo-router/\"\n style={[\n hovered && {\n textDecorationColor: 'white',\n textDecorationLine: 'underline',\n },\n ]}>\n Expo\n </Link>\n </Text>\n )}\n </Pressable>\n );\n}\n\nconst canAutoTouchFile = process.env.EXPO_ROUTER_APP_ROOT != null;\n\nexport function Tutorial() {\n React.useEffect(() => {\n if (Platform.OS === 'web') {\n // Reset the route on web so the initial route isn't a 404 after\n // the user has created the entry file.\n // This is useful for cases where you are testing the tutorial.\n // To test: touch the new file, then navigate to a missing route `/foobar`, then delete the app folder.\n // you should see the tutorial again and be able to create the entry file once more.\n if (typeof location !== 'undefined' && location.pathname !== '/') {\n location.replace('/');\n }\n if (typeof window !== 'undefined' && typeof window.document !== 'undefined') {\n window.document.title = 'npx expo start';\n }\n }\n }, []);\n\n return (\n <View style={styles.background}>\n <StatusBar barStyle=\"light-content\" />\n\n <SafeAreaView style={styles.safeArea}>\n <View style={styles.container}>\n <Header />\n <Text role=\"heading\" aria-level={2} style={styles.subtitle}>\n Start by creating a file{'\\n'}in the{' '}\n <Text style={{ fontWeight: 'bold' }}>{getRootDir()}</Text> directory.\n </Text>\n {canAutoTouchFile && <Button />}\n </View>\n </SafeAreaView>\n </View>\n );\n}\n\nfunction getRootDir() {\n const dir = process.env.EXPO_ROUTER_ABS_APP_ROOT!;\n if (dir.match(/\\/src\\/app$/)) {\n return 'src/app';\n } else if (dir.match(/\\/app$/)) {\n return 'app';\n }\n return dir.split('/').pop() ?? dir;\n}\n\nfunction Button() {\n return (\n <Pressable\n onPress={() => {\n createEntryFileAsync();\n }}\n style={{\n ...Platform.select({\n web: {\n // subtle white shadow\n boxShadow: 'rgba(255, 255, 255, 0.15) 0px 0px 20px 5px',\n },\n native: {\n position: 'absolute',\n bottom: 24,\n left: 24,\n right: 24,\n overflow: 'hidden',\n },\n }),\n }}>\n {({ pressed, hovered }) => (\n <View\n style={[\n styles.buttonContainer,\n hovered && {\n backgroundColor: 'white',\n },\n pressed && {\n backgroundColor: 'rgba(255,255,255,0.7)',\n },\n ]}>\n <Text style={[styles.code, hovered && { color: 'black' }]}>\n <Text style={{ color: '#BCC3CD' }}>$</Text> touch {getRootDir()}\n /index.js\n </Text>\n </View>\n )}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n background: {\n ...Platform.select({\n web: {\n backgroundImage:\n 'radial-gradient(circle at 1px 1px, rgba(255,255,255,0.15) 1px, transparent 0)',\n backgroundPositionX: -3,\n backgroundPositionY: -3,\n backgroundSize: '40px 40px',\n },\n }),\n backgroundColor: 'black',\n flex: 1,\n },\n safeArea: {\n flex: 1,\n maxWidth: 960,\n marginHorizontal: 'auto',\n alignItems: 'stretch',\n },\n container: {\n flex: 1,\n padding: 24,\n alignItems: 'flex-start',\n justifyContent: 'center',\n },\n title: {\n color: 'white',\n fontSize: 64,\n paddingBottom: 24,\n fontWeight: 'bold',\n },\n buttonContainer: {\n ...Platform.select({\n web: {\n transitionDuration: '200ms',\n backgroundColor: 'transparent',\n },\n default: {\n backgroundColor: 'white',\n },\n }),\n\n borderColor: 'white',\n borderWidth: 2,\n paddingVertical: 12,\n paddingHorizontal: 24,\n },\n buttonText: {\n color: 'black',\n },\n code: {\n ...Platform.select({\n web: {\n transitionDuration: '200ms',\n color: 'white',\n fontFamily: 'Courier',\n },\n default: {\n color: 'black',\n fontFamily: Platform.select({\n ios: 'Courier New',\n android: 'monospace',\n }),\n },\n }),\n\n userSelect: 'none',\n fontSize: 18,\n fontWeight: 'bold',\n },\n subtitle: {\n color: '#BCC3CD',\n fontSize: 36,\n fontWeight: '100',\n paddingBottom: 36,\n maxWidth: 960,\n },\n});\n"]}
1
+ {"version":3,"file":"Tutorial.js","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"m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,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,EAAE;QACb,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,YAAY,EAAE,EAAE;aACjB;SACF,CAAC;KACH;IACD,aAAa,EAAE;QACb,KAAK,EAAE,SAAS;KACjB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Platform, StatusBar, StyleSheet, Text, View, Image } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { createEntryFileAsync } from './createEntryFile';\nimport { Link } from '../exports';\nimport { Pressable } from '../views/Pressable';\n\nconst canAutoTouchFile = process.env.EXPO_ROUTER_APP_ROOT != null;\n\nexport function Tutorial() {\n React.useEffect(() => {\n if (Platform.OS === 'web') {\n // Reset the route on web so the initial route isn't a 404 after\n // the user has created the entry file.\n // This is useful for cases where you are testing the tutorial.\n // To test: touch the new file, then navigate to a missing route `/foobar`, then delete the app folder.\n // you should see the tutorial again and be able to create the entry file once more.\n if (typeof location !== 'undefined' && location.pathname !== '/') {\n location.replace('/');\n }\n if (typeof window !== 'undefined' && typeof window.document !== 'undefined') {\n window.document.title = 'Welcome to Expo';\n }\n }\n }, []);\n\n return (\n <SafeAreaView style={styles.background}>\n <StatusBar barStyle=\"light-content\" />\n <View style={styles.container}>\n <View style={styles.logotypeWrapper}>\n <Image style={styles.logotype} source={require('expo-router/assets/logotype.png')} />\n </View>\n <Text role=\"heading\" aria-level={1} style={styles.title}>\n Welcome to Expo\n </Text>\n <Text role=\"heading\" aria-level={2} style={[styles.subtitle, styles.textSecondary]}>\n Start by creating a file{Platform.OS !== 'web' ? '\\n' : ' '}in the{' '}\n <Text style={{ fontWeight: '600' }}>{getRootDir()}</Text> directory.\n </Text>\n <Text>\n <Link\n href=\"https://docs.expo.dev/router/introduction/\"\n {...Platform.select({ web: { target: '_blank' }, native: { asChild: true } })}>\n <Pressable>\n {({ hovered, pressed }) => (\n <Text\n style={[\n styles.link,\n Platform.select({\n web: {\n transitionDuration: '200ms',\n marginBottom: 12,\n },\n }),\n hovered && {\n opacity: 0.8,\n textDecorationLine: 'underline',\n },\n pressed && {\n opacity: 0.8,\n },\n ]}>\n Learn more about Expo Router in the documentation.\n </Text>\n )}\n </Pressable>\n </Link>\n </Text>\n {canAutoTouchFile && <Button />}\n </View>\n </SafeAreaView>\n );\n}\n\nfunction getRootDir() {\n const dir = process.env.EXPO_ROUTER_ABS_APP_ROOT!;\n if (dir.match(/\\/src\\/app$/)) {\n return 'src/app';\n } else if (dir.match(/\\/app$/)) {\n return 'app';\n }\n return dir.split('/').pop() ?? dir;\n}\n\nfunction Button() {\n return (\n <Pressable\n onPress={() => {\n createEntryFileAsync();\n }}\n style={styles.button}>\n {({ pressed, hovered }) => (\n <View\n style={[\n styles.buttonContainer,\n hovered && {\n backgroundColor: '#fff',\n },\n pressed &&\n Platform.select({\n web: {\n transform: 'scale(0.98)',\n transitionDuration: '200ms',\n },\n default: {\n backgroundColor: '#fff',\n },\n }),\n ]}>\n <Text\n style={[\n styles.code,\n hovered && { color: '#000' },\n pressed &&\n Platform.select({\n native: { color: '#000' },\n }),\n ]}>\n <Text style={styles.textSecondary}>$</Text> touch {getRootDir()}\n /index.tsx\n </Text>\n </View>\n )}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n background: {\n backgroundColor: '#000',\n flex: 1,\n },\n container: {\n flex: 1,\n padding: 24,\n paddingBottom: 64,\n alignItems: 'center',\n justifyContent: 'center',\n marginHorizontal: 'auto',\n gap: 16,\n ...Platform.select({\n web: {\n maxWidth: 960,\n },\n native: {\n width: '100%',\n },\n }),\n },\n logotypeWrapper: {\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: '#151718',\n borderRadius: 12,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: '#313538',\n width: 78,\n height: 78,\n marginBottom: 8,\n },\n logotype: {\n width: 48,\n height: 44,\n },\n title: {\n ...Platform.select({\n web: {\n fontSize: 64,\n lineHeight: 68,\n },\n default: {\n fontSize: 56,\n lineHeight: 60,\n },\n }),\n color: '#fff',\n fontWeight: '800',\n textAlign: 'center',\n },\n buttonContainer: {\n ...Platform.select({\n web: {\n transitionDuration: '200ms',\n },\n }),\n backgroundColor: 'transparent',\n borderColor: '#fff',\n borderWidth: 2,\n paddingVertical: 12,\n paddingHorizontal: 24,\n borderRadius: 8,\n },\n button: {\n ...Platform.select({\n web: {\n marginTop: 12,\n },\n native: {\n position: 'absolute',\n bottom: 24,\n left: 32,\n right: 32,\n overflow: 'hidden',\n },\n }),\n },\n code: {\n ...Platform.select({\n web: {\n transitionDuration: '200ms',\n fontFamily: 'Courier, monospace',\n },\n default: {\n fontFamily: Platform.select({\n ios: 'Courier New',\n android: 'monospace',\n }),\n },\n }),\n color: '#fff',\n textAlign: 'center',\n userSelect: 'none',\n fontSize: 18,\n fontWeight: 'bold',\n },\n subtitle: {\n fontSize: 34,\n fontWeight: '200',\n textAlign: 'center',\n },\n link: {\n fontSize: 20,\n lineHeight: 26,\n textAlign: 'center',\n color: '#52a9ff',\n marginTop: 12,\n ...Platform.select({\n web: {\n marginBottom: 24,\n },\n }),\n },\n textSecondary: {\n color: '#9ba1a6',\n },\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"renderRootComponent.d.ts","sourceRoot":"","sources":["../src/renderRootComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA6C/B;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,QAyCtE"}
1
+ {"version":3,"file":"renderRootComponent.d.ts","sourceRoot":"","sources":["../src/renderRootComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA+C/B;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,QAwCtE"}
@@ -25,9 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.renderRootComponent = void 0;
27
27
  const expo_1 = require("expo");
28
- const SplashScreen = __importStar(require("expo-splash-screen"));
29
28
  const React = __importStar(require("react"));
30
29
  const react_native_1 = require("react-native");
30
+ const SplashScreen = __importStar(require("./utils/splash"));
31
31
  function isBaseObject(obj) {
32
32
  if (Object.prototype.toString.call(obj) !== '[object Object]') {
33
33
  return false;
@@ -70,7 +70,6 @@ function renderRootComponent(Component) {
70
70
  try {
71
71
  // This must be delayed so the user has a chance to call it first.
72
72
  setTimeout(() => {
73
- // @ts-expect-error: This function is native-only and for internal-use only.
74
73
  SplashScreen._internal_preventAutoHideAsync?.();
75
74
  });
76
75
  React.startTransition(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"renderRootComponent.js","sourceRoot":"","sources":["../src/renderRootComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA6C;AAC7C,iEAAmD;AACnD,6CAA+B;AAC/B,+CAAoC;AAEpC,SAAS,YAAY,CAAC,GAAQ;IAC5B,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,iBAAiB,EAAE;QAC7D,OAAO,KAAK,CAAC;KACd;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,CAAC;AACpC,CAAC;AAED,SAAS,aAAa,CAAC,KAAU;IAC/B,OAAO,CACL,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,OAAO,KAAK,CA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QAC/F,IAAA,4BAAqB,EAAC,GAAG,EAAE,CAAC,CAAC,mBAAI,CAAC,AAAD,EAAG,CAAC,CAAC;QAEtC,gFAAgF;QAChF,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE;YACjC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;SACnF;QAED,+CAA+C;QAC/C,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,+CAA+C;KAChD;AACH,CAAC;AAzCD,kDAyCC","sourcesContent":["import { registerRootComponent } from 'expo';\nimport * as SplashScreen from 'expo-splash-screen';\nimport * as React from 'react';\nimport { View } from 'react-native';\n\nfunction isBaseObject(obj: any) {\n if (Object.prototype.toString.call(obj) !== '[object Object]') {\n return false;\n }\n const proto = Object.getPrototypeOf(obj);\n if (proto === null) {\n return true;\n }\n return proto === Object.prototype;\n}\n\nfunction isErrorShaped(error: any): error is Error {\n return (\n error &&\n typeof error === 'object' &&\n typeof error.name === 'string' &&\n typeof error.message === 'string'\n );\n}\n\n/**\n * After we throw this error, any number of tools could handle it.\n * This check ensures the error is always in a reason state before surfacing it to the runtime.\n */\nfunction convertError(error: any) {\n if (isErrorShaped(error)) {\n return error;\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (error == null) {\n return new Error('A null/undefined error was thrown.');\n }\n }\n\n if (isBaseObject(error)) {\n return new Error(JSON.stringify(error));\n }\n\n return new Error(String(error));\n}\n\n/**\n * Register and mount the root component using the predefined rendering\n * method. This function ensures the Splash Screen and errors are handled correctly.\n */\nexport function renderRootComponent(Component: React.ComponentType<any>) {\n try {\n // This must be delayed so the user has a chance to call it first.\n setTimeout(() => {\n // @ts-expect-error: This function is native-only and for internal-use only.\n SplashScreen._internal_preventAutoHideAsync?.();\n });\n\n React.startTransition(() => {\n if (process.env.NODE_ENV !== 'production') {\n const { withErrorOverlay } =\n require('@expo/metro-runtime/error-overlay') as typeof import('@expo/metro-runtime/error-overlay');\n registerRootComponent(withErrorOverlay(Component));\n } else {\n registerRootComponent(Component);\n }\n });\n } catch (e) {\n // Hide the splash screen if there was an error so the user can see it.\n SplashScreen.hideAsync();\n\n const error = convertError(e);\n // Prevent the app from throwing confusing:\n // ERROR Invariant Violation: \"main\" has not been registered. This can happen if:\n // * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.\n // * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.\n registerRootComponent(() => <View />);\n\n // Console is pretty useless on native, on web you get interactive stack traces.\n if (process.env.EXPO_OS === 'web') {\n console.error(error);\n console.error(`A runtime error has occurred while rendering the root component.`);\n }\n\n // Give React a tick to render before throwing.\n setTimeout(() => {\n throw error;\n });\n\n // TODO: Render a production-only error screen.\n }\n}\n"]}
1
+ {"version":3,"file":"renderRootComponent.js","sourceRoot":"","sources":["../src/renderRootComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA6C;AAC7C,6CAA+B;AAC/B,+CAAoC;AAEpC,6DAA+C;AAE/C,SAAS,YAAY,CAAC,GAAQ;IAC5B,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,iBAAiB,EAAE;QAC7D,OAAO,KAAK,CAAC;KACd;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,CAAC;AACpC,CAAC;AAED,SAAS,aAAa,CAAC,KAAU;IAC/B,OAAO,CACL,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,OAAO,KAAK,CAAC,OAAO,KAAK,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G,EAAE,CAAC,CAAC,mBAAI,CAAC,AAAD,EAAG,CAAC,CAAC;QAEtC,gFAAgF;QAChF,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE;YACjC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;SACnF;QAED,+CAA+C;QAC/C,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,+CAA+C;KAChD;AACH,CAAC;AAxCD,kDAwCC","sourcesContent":["import { registerRootComponent } from 'expo';\nimport * as React from 'react';\nimport { View } from 'react-native';\n\nimport * as SplashScreen from './utils/splash';\n\nfunction isBaseObject(obj: any) {\n if (Object.prototype.toString.call(obj) !== '[object Object]') {\n return false;\n }\n const proto = Object.getPrototypeOf(obj);\n if (proto === null) {\n return true;\n }\n return proto === Object.prototype;\n}\n\nfunction isErrorShaped(error: any): error is Error {\n return (\n error &&\n typeof error === 'object' &&\n typeof error.name === 'string' &&\n typeof error.message === 'string'\n );\n}\n\n/**\n * After we throw this error, any number of tools could handle it.\n * This check ensures the error is always in a reason state before surfacing it to the runtime.\n */\nfunction convertError(error: any) {\n if (isErrorShaped(error)) {\n return error;\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (error == null) {\n return new Error('A null/undefined error was thrown.');\n }\n }\n\n if (isBaseObject(error)) {\n return new Error(JSON.stringify(error));\n }\n\n return new Error(String(error));\n}\n\n/**\n * Register and mount the root component using the predefined rendering\n * method. This function ensures the Splash Screen and errors are handled correctly.\n */\nexport function renderRootComponent(Component: React.ComponentType<any>) {\n try {\n // This must be delayed so the user has a chance to call it first.\n setTimeout(() => {\n SplashScreen._internal_preventAutoHideAsync?.();\n });\n\n React.startTransition(() => {\n if (process.env.NODE_ENV !== 'production') {\n const { withErrorOverlay } =\n require('@expo/metro-runtime/error-overlay') as typeof import('@expo/metro-runtime/error-overlay');\n registerRootComponent(withErrorOverlay(Component));\n } else {\n registerRootComponent(Component);\n }\n });\n } catch (e) {\n // Hide the splash screen if there was an error so the user can see it.\n SplashScreen.hideAsync();\n\n const error = convertError(e);\n // Prevent the app from throwing confusing:\n // ERROR Invariant Violation: \"main\" has not been registered. This can happen if:\n // * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.\n // * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.\n registerRootComponent(() => <View />);\n\n // Console is pretty useless on native, on web you get interactive stack traces.\n if (process.env.EXPO_OS === 'web') {\n console.error(error);\n console.error(`A runtime error has occurred while rendering the root component.`);\n }\n\n // Give React a tick to render before throwing.\n setTimeout(() => {\n throw error;\n });\n\n // TODO: Render a production-only error screen.\n }\n}\n"]}
@@ -9,7 +9,7 @@ import type { RenderRscArgs } from '@expo/server/build/middleware/rsc';
9
9
  type ImportMap = {
10
10
  router: () => Promise<typeof import('./router/expo-definedRouter')>;
11
11
  };
12
- export declare function renderRscWithImportsAsync(distFolder: string, imports: ImportMap, { body, platform, searchParams, config, method, input, contentType }: RenderRscArgs): Promise<ReadableStream<any>>;
12
+ export declare function renderRscWithImportsAsync(distFolder: string, imports: ImportMap, { body, platform, searchParams, config, method, input, contentType, headers }: RenderRscArgs): Promise<ReadableStream<any>>;
13
13
  export declare function renderRscAsync(distFolder: string, args: RenderRscArgs): Promise<ReadableStream<any>>;
14
14
  export {};
15
15
  //# sourceMappingURL=middleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/rsc/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAyEvE,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,MAAM,OAAO,CAAC,cAAc,6BAA6B,CAAC,CAAC,CAAC;CACrE,CAAC;AAEF,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,SAAS,EAClB,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,aAAa,GAClF,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAiE9B;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAa9B"}
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/rsc/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAyEvE,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,MAAM,OAAO,CAAC,cAAc,6BAA6B,CAAC,CAAC,CAAC;CACrE,CAAC;AAEF,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,SAAS,EAClB,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,aAAa,GAC3F,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAmE9B;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAa9B"}
@@ -37,11 +37,12 @@ async function getSSRManifest(distFolder, platform) {
37
37
  const filePath = `../../rsc/${platform}/ssr-manifest.js`;
38
38
  return interopDefault(await (0, _async_server_import_1.asyncServerImport)(filePath));
39
39
  }
40
- async function renderRscWithImportsAsync(distFolder, imports, { body, platform, searchParams, config, method, input, contentType }) {
40
+ async function renderRscWithImportsAsync(distFolder, imports, { body, platform, searchParams, config, method, input, contentType, headers }) {
41
41
  if (method === 'POST' && !body) {
42
42
  throw new Error('Server request must be provided when method is POST (server actions)');
43
43
  }
44
44
  const context = getRscRenderContext(platform);
45
+ context['__expo_requestHeaders'] = headers;
45
46
  const entries = await imports.router();
46
47
  const ssrManifest = await getSSRManifest(distFolder, platform);
47
48
  const actionManifest = await getServerActionManifest(distFolder, platform);
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/rsc/middleware.ts"],"names":[],"mappings":";;;;;;AASA,2EAAqE;AACrE,0DAA6B;AAE7B,iDAA2C;AAE3C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,0BAA0B,CAAC,CAAC;AAE3D,kEAAkE;AAClE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAe,CAAC;AAEhD,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,0GAA0G;IAC1G,IAAI,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QAClC,OAAO,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;KACxC;IAED,MAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,cAAc,CAAC,GAAQ;IAC9B,IAAI,SAAS,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE;QACtE,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC;QACxB,IAAI,SAAS,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE;YACtE,OAAO,GAAG,CAAC,OAAO,CAAC;SACpB;QACD,OAAO,GAAG,CAAC,OAAO,CAAC;KACpB;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,KAAK,UAAU,uBAAuB,CACpC,UAAkB,EACl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AAQ,CAAC;IAC/B,OAAO,yBAAyB,CAC9B,UAAU,EACV;QACE,MAAM,EAAE,GAAG,EAAE;YACX,mFAAmF;YACnF,MAAM,QAAQ,GAAG,aAAa,QAAQ,YAAY,CAAC;YACnD,OAAO,IAAA,wCAAiB,EAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;KACF,EACD,IAAI,CACL,CAAC;AACJ,CAAC;AAhBD,wCAgBC","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\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 */\n// This module is bundled with Metro in web/react-server mode and redirects to platform specific renderers.\nimport type { RenderRscArgs } from '@expo/server/build/middleware/rsc';\nimport { asyncServerImport } from 'expo-router/_async-server-import';\nimport path from 'node:path';\n\nimport { renderRsc } from './rsc-renderer';\n\nconst debug = require('debug')('expo:server:rsc-renderer');\n\n// Tracking the implementation in expo/cli's MetroBundlerDevServer\nconst rscRenderContext = new Map<string, any>();\n\nfunction getRscRenderContext(platform: string) {\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRenderContext.has(platform)) {\n return rscRenderContext.get(platform)!;\n }\n\n const context = {};\n\n rscRenderContext.set(platform, context);\n return context;\n}\n\nfunction interopDefault(mod: any) {\n if ('default' in mod && typeof mod.default === 'object' && mod.default) {\n const def = mod.default;\n if ('default' in def && typeof def.default === 'object' && def.default) {\n return def.default;\n }\n return mod.default;\n }\n return mod;\n}\n\nasync function getServerActionManifest(\n distFolder: string,\n platform: string\n): Promise<\n Record<\n // Input ID\n string,\n [\n // Metro ID\n string,\n // Chunk location.\n string,\n ]\n >\n> {\n const filePath = `../../rsc/${platform}/action-manifest.js`;\n return interopDefault(await asyncServerImport(filePath));\n}\n\nasync function getSSRManifest(\n distFolder: string,\n platform: string\n): Promise<\n Record<\n // Input ID\n string,\n [\n // Metro ID\n string,\n // Chunk location.\n string,\n ]\n >\n> {\n const filePath = `../../rsc/${platform}/ssr-manifest.js`;\n return interopDefault(await asyncServerImport(filePath));\n}\n\n// The import map allows us to use external modules from different bundling contexts.\ntype ImportMap = {\n router: () => Promise<typeof import('./router/expo-definedRouter')>;\n};\n\nexport async function renderRscWithImportsAsync(\n distFolder: string,\n imports: ImportMap,\n { body, platform, searchParams, config, method, input, contentType }: RenderRscArgs\n): Promise<ReadableStream<any>> {\n if (method === 'POST' && !body) {\n throw new Error('Server request must be provided when method is POST (server actions)');\n }\n\n const context = getRscRenderContext(platform);\n\n const entries = await imports.router();\n\n const ssrManifest = await getSSRManifest(distFolder, platform);\n const actionManifest = await getServerActionManifest(distFolder, platform);\n return renderRsc(\n {\n body: body ?? undefined,\n context,\n config,\n input,\n contentType,\n decodedBody: searchParams.get('x-expo-params'),\n },\n {\n isExporting: true,\n\n resolveClientEntry(file: string, isServer: boolean) {\n debug('resolveClientEntry', file, { isServer });\n\n if (isServer) {\n if (!(file in actionManifest)) {\n throw new Error(\n `Could not find file in server action manifest: ${file}. ${JSON.stringify(actionManifest)}`\n );\n }\n\n const [id, chunk] = actionManifest[file];\n return {\n id,\n chunks: chunk ? [chunk] : [],\n };\n }\n\n if (!(file in ssrManifest)) {\n throw new Error(`Could not find file in SSR manifest: ${file}`);\n }\n\n const [id, chunk] = ssrManifest[file];\n return {\n id,\n chunks: chunk ? [chunk] : [],\n };\n },\n async loadServerModuleRsc(file) {\n debug('loadServerModuleRsc', file);\n const filePath = path.join('../../../', file);\n const m = await asyncServerImport(filePath);\n\n // TODO: This is a hack to workaround a cloudflare/metro issue where there's an extra `default` wrapper.\n if (typeof caches !== 'undefined') {\n return m.default;\n }\n return m;\n },\n\n entries: entries!,\n }\n );\n}\n\nexport async function renderRscAsync(\n distFolder: string,\n args: RenderRscArgs\n): Promise<ReadableStream<any>> {\n const platform = args.platform;\n return renderRscWithImportsAsync(\n distFolder,\n {\n router: () => {\n // Assumes this file is saved to: `dist/server/_expo/functions/_flight/[...rsc].js`\n const filePath = `../../rsc/${platform}/router.js`;\n return asyncServer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AG,aAAa,QAAQ,YAAY,CAAC;YACnD,OAAO,IAAA,wCAAiB,EAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;KACF,EACD,IAAI,CACL,CAAC;AACJ,CAAC;AAhBD,wCAgBC","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\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 */\n// This module is bundled with Metro in web/react-server mode and redirects to platform specific renderers.\nimport type { RenderRscArgs } from '@expo/server/build/middleware/rsc';\nimport { asyncServerImport } from 'expo-router/_async-server-import';\nimport path from 'node:path';\n\nimport { renderRsc } from './rsc-renderer';\n\nconst debug = require('debug')('expo:server:rsc-renderer');\n\n// Tracking the implementation in expo/cli's MetroBundlerDevServer\nconst rscRenderContext = new Map<string, any>();\n\nfunction getRscRenderContext(platform: string) {\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRenderContext.has(platform)) {\n return rscRenderContext.get(platform)!;\n }\n\n const context = {};\n\n rscRenderContext.set(platform, context);\n return context;\n}\n\nfunction interopDefault(mod: any) {\n if ('default' in mod && typeof mod.default === 'object' && mod.default) {\n const def = mod.default;\n if ('default' in def && typeof def.default === 'object' && def.default) {\n return def.default;\n }\n return mod.default;\n }\n return mod;\n}\n\nasync function getServerActionManifest(\n distFolder: string,\n platform: string\n): Promise<\n Record<\n // Input ID\n string,\n [\n // Metro ID\n string,\n // Chunk location.\n string,\n ]\n >\n> {\n const filePath = `../../rsc/${platform}/action-manifest.js`;\n return interopDefault(await asyncServerImport(filePath));\n}\n\nasync function getSSRManifest(\n distFolder: string,\n platform: string\n): Promise<\n Record<\n // Input ID\n string,\n [\n // Metro ID\n string,\n // Chunk location.\n string,\n ]\n >\n> {\n const filePath = `../../rsc/${platform}/ssr-manifest.js`;\n return interopDefault(await asyncServerImport(filePath));\n}\n\n// The import map allows us to use external modules from different bundling contexts.\ntype ImportMap = {\n router: () => Promise<typeof import('./router/expo-definedRouter')>;\n};\n\nexport async function renderRscWithImportsAsync(\n distFolder: string,\n imports: ImportMap,\n { body, platform, searchParams, config, method, input, contentType, headers }: RenderRscArgs\n): Promise<ReadableStream<any>> {\n if (method === 'POST' && !body) {\n throw new Error('Server request must be provided when method is POST (server actions)');\n }\n\n const context = getRscRenderContext(platform);\n\n context['__expo_requestHeaders'] = headers;\n\n const entries = await imports.router();\n\n const ssrManifest = await getSSRManifest(distFolder, platform);\n const actionManifest = await getServerActionManifest(distFolder, platform);\n return renderRsc(\n {\n body: body ?? undefined,\n context,\n config,\n input,\n contentType,\n decodedBody: searchParams.get('x-expo-params'),\n },\n {\n isExporting: true,\n\n resolveClientEntry(file: string, isServer: boolean) {\n debug('resolveClientEntry', file, { isServer });\n\n if (isServer) {\n if (!(file in actionManifest)) {\n throw new Error(\n `Could not find file in server action manifest: ${file}. ${JSON.stringify(actionManifest)}`\n );\n }\n\n const [id, chunk] = actionManifest[file];\n return {\n id,\n chunks: chunk ? [chunk] : [],\n };\n }\n\n if (!(file in ssrManifest)) {\n throw new Error(`Could not find file in SSR manifest: ${file}`);\n }\n\n const [id, chunk] = ssrManifest[file];\n return {\n id,\n chunks: chunk ? [chunk] : [],\n };\n },\n async loadServerModuleRsc(file) {\n debug('loadServerModuleRsc', file);\n const filePath = path.join('../../../', file);\n const m = await asyncServerImport(filePath);\n\n // TODO: This is a hack to workaround a cloudflare/metro issue where there's an extra `default` wrapper.\n if (typeof caches !== 'undefined') {\n return m.default;\n }\n return m;\n },\n\n entries: entries!,\n }\n );\n}\n\nexport async function renderRscAsync(\n distFolder: string,\n args: RenderRscArgs\n): Promise<ReadableStream<any>> {\n const platform = args.platform;\n return renderRscWithImportsAsync(\n distFolder,\n {\n router: () => {\n // Assumes this file is saved to: `dist/server/_expo/functions/_flight/[...rsc].js`\n const filePath = `../../rsc/${platform}/router.js`;\n return asyncServerImport(filePath);\n },\n },\n args\n );\n}\n"]}
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import type { ReactNode } from 'react';
9
9
  import type { PathSpec } from './path';
10
+ export declare const REQUEST_HEADERS = "__expo_requestHeaders";
10
11
  type Config = any;
11
12
  type Elements = Record<string, ReactNode>;
12
13
  export type BuildConfig = {
@@ -58,5 +59,7 @@ type RenderStore = {
58
59
  export declare const runWithRenderStore: <T>(renderStore: RenderStore, fn: () => T) => T;
59
60
  export declare function rerender(input: string, params?: unknown): void;
60
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>;
61
64
  export {};
62
65
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
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;AAQvC,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,MAAM,aAAa,GAAG,CAC1B,KAAK,EAAE,MAAM,EACb,OAA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ACpD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AA4CF;;GAEG;AACH,eAAO,MAAM,kBAAkB,mBAAoB,WAAW,mBAW7D,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,QAMvD;AAED,wBAAgB,UAAU,CACxB,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACjE,UAAU,CAMd;AAED,mFAAmF;AACnF,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAGzD"}
@@ -7,7 +7,8 @@
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.getContext = exports.rerender = exports.runWithRenderStore = exports.defineEntries = void 0;
10
+ exports.unstable_headers = exports.getContext = exports.rerender = exports.runWithRenderStore = exports.defineEntries = exports.REQUEST_HEADERS = void 0;
11
+ exports.REQUEST_HEADERS = '__expo_requestHeaders';
11
12
  function defineEntries(renderEntries, getBuildConfig, getSsrConfig) {
12
13
  return { renderEntries, getBuildConfig, getSsrConfig };
13
14
  }
@@ -84,4 +85,21 @@ function getContext() {
84
85
  return renderStore.context;
85
86
  }
86
87
  exports.getContext = getContext;
88
+ /** Get the request headers used to make the server component or action request. */
89
+ async function unstable_headers() {
90
+ const headers = (getContext()[exports.REQUEST_HEADERS] || {});
91
+ return new ReadonlyHeaders(headers);
92
+ }
93
+ exports.unstable_headers = unstable_headers;
94
+ class ReadonlyHeaders extends Headers {
95
+ set() {
96
+ throw new Error('Server component Headers are read-only');
97
+ }
98
+ append() {
99
+ throw new Error('Server component Headers are read-only');
100
+ }
101
+ delete() {
102
+ throw new Error('Server component Headers are read-only');
103
+ }
104
+ }
87
105
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sour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AAC;AARD,gCAQC","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 { type AsyncLocalStorage } from 'node:async_hooks';\nimport type { ReactNode } from 'react';\n\nimport type { PathSpec } from './path';\n\ndeclare let globalThis: {\n __EXPO_RSC_CACHE__?: Map<string, any>;\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(): Pick<AsyncLocalStorage<RenderStore>, 'getStore' | 'run'> {\n if (!globalThis.__EXPO_RSC_CACHE__) {\n globalThis.__EXPO_RSC_CACHE__ = new Map();\n }\n\n if (globalThis.__EXPO_RSC_CACHE__.has(process.env.EXPO_OS!)) {\n return globalThis.__EXPO_RSC_CACHE__.get(process.env.EXPO_OS!)!;\n }\n try {\n const { AsyncLocalStorage } = require('node:async_hooks');\n // @ts-expect-error: This is a Node.js feature.\n const serverCache = new AsyncLocalStorage<RenderStore>();\n globalThis.__EXPO_RSC_CACHE__.set(process.env.EXPO_OS!, serverCache);\n return serverCache;\n } catch (error) {\n console.log('[RSC]: Failed to create cache:', error);\n\n // Fallback to a simple in-memory cache.\n const cache = new Map();\n const serverCache = {\n getStore: () => cache.get('store'),\n run: <T>(store: RenderStore, fn: () => T) => {\n cache.set('store', store);\n try {\n return fn();\n } finally {\n cache.delete('store');\n }\n },\n };\n globalThis.__EXPO_RSC_CACHE__.set(process.env.EXPO_OS!, serverCache);\n return serverCache;\n }\n}\n\nlet previousRenderStore: RenderStore | undefined;\nlet currentRenderStore: RenderStore | undefined;\n\nconst renderStorage = getGlobalCacheForPlatform();\n\n/**\n * This is an internal function and not for public use.\n */\nexport const runWithRenderStore = <T>(renderStore: RenderStore, fn: () => T): T => {\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 function rerender(input: string, params?: unknown) {\n const renderStore = renderStorage?.getStore() ?? currentRenderStore;\n if (!renderStore) {\n throw new Error('Render store is not available');\n }\n renderStore.rerender(input, params);\n}\n\nexport function getContext<\n RscContext extends Record<string, unknown> = Record<string, unknown>,\n>(): RscContext {\n const renderStore = renderStorage?.getStore() ?? currentRenderStore;\n if (!renderStore) {\n throw new Error('Render store is not available');\n }\n return renderStore.context as RscContext;\n}\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/rsc/server.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAOU,QAAA,eAAe,GAAG,uBAAuB,CAAC;AAiDvD,SAAgB,aAAa,CAC3B,aAA4B,EAC5B,cAA+B,EAC/B,YAA2B;IAE3B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC;AACzD,CAAC;AAND,sCAMC;AAkBD,6DAA6D;AAC7D,oIAAoI;AACpI,SAAS,yBAAyB;IAChC,IAAI,CAAC,UAAU,CAAC,kBAAkB,EAAE;QAClC,UAAU,CAAC,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAC;KAC3C;IAED,IAAI,UAAU,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAQ,CAAC,EAAE;QAC3D,OAAO,UAAU,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAQ,CAAE,CAAC;KACjE;IACD,IAAI;QACF,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC1D,+CAA+C;QAC/C,MAAM,WAAW,GAAG,IAAI,iBAAiB,EAAe,CAAC;QACzD,UAAU,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAQ,EAAE,WAAW,CAAC,CAAC;QACrE,OAAO,WAAW,CAAC;KACpB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QAErD,wCAAwC;QACxC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QACxB,MAAM,WAAW,GAAG;YAClB,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC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AAkB,CAAC;IACpE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IACD,OAAO,WAAW,CAAC,OAAqB,CAAC;AAC3C,CAAC;AARD,gCAQC;AAED,mFAAmF;AAC5E,KAAK,UAAU,gBAAgB;IACpC,MAAM,OAAO,GAAG,CAAC,UAAU,EAAE,CAAC,uBAAe,CAAC,IAAI,EAAE,CAA2B,CAAC;IAChF,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAHD,4CAGC;AAED,MAAM,eAAgB,SAAQ,OAAO;IACnC,GAAG;QACD,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IACD,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IACD,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,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 { type AsyncLocalStorage } from 'node: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 __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(): Pick<AsyncLocalStorage<RenderStore>, 'getStore' | 'run'> {\n if (!globalThis.__EXPO_RSC_CACHE__) {\n globalThis.__EXPO_RSC_CACHE__ = new Map();\n }\n\n if (globalThis.__EXPO_RSC_CACHE__.has(process.env.EXPO_OS!)) {\n return globalThis.__EXPO_RSC_CACHE__.get(process.env.EXPO_OS!)!;\n }\n try {\n const { AsyncLocalStorage } = require('node:async_hooks');\n // @ts-expect-error: This is a Node.js feature.\n const serverCache = new AsyncLocalStorage<RenderStore>();\n globalThis.__EXPO_RSC_CACHE__.set(process.env.EXPO_OS!, serverCache);\n return serverCache;\n } catch (error) {\n console.log('[RSC]: Failed to create cache:', error);\n\n // Fallback to a simple in-memory cache.\n const cache = new Map();\n const serverCache = {\n getStore: () => cache.get('store'),\n run: <T>(store: RenderStore, fn: () => T) => {\n cache.set('store', store);\n try {\n return fn();\n } finally {\n cache.delete('store');\n }\n },\n };\n globalThis.__EXPO_RSC_CACHE__.set(process.env.EXPO_OS!, serverCache);\n return serverCache;\n }\n}\n\nlet previousRenderStore: RenderStore | undefined;\nlet currentRenderStore: RenderStore | undefined;\n\nconst renderStorage = getGlobalCacheForPlatform();\n\n/**\n * This is an internal function and not for public use.\n */\nexport const runWithRenderStore = <T>(renderStore: RenderStore, fn: () => T): T => {\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 function rerender(input: string, params?: unknown) {\n const renderStore = renderStorage?.getStore() ?? currentRenderStore;\n if (!renderStore) {\n throw new Error('Render store is not available');\n }\n renderStore.rerender(input, params);\n}\n\nexport function getContext<\n RscContext extends Record<string, unknown> = Record<string, unknown>,\n>(): RscContext {\n const renderStore = renderStorage?.getStore() ?? currentRenderStore;\n if (!renderStore) {\n throw new Error('Render store is not available');\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"]}
@@ -38,8 +38,9 @@ export type TabNavigationEventMap = {
38
38
  };
39
39
  };
40
40
  /**
41
- * The React Navigation custom navigator
42
- * @see https://reactnavigation.org/docs/custom-navigators/#usenavigationbuilder
41
+ * The React Navigation custom navigator.
42
+ *
43
+ * @see [`useNavigationBuilder`](https://reactnavigation.org/docs/custom-navigators/#usenavigationbuilder) hook from React Navigation for more information.
43
44
  */
44
45
  export type TabsContextValue = ReturnType<typeof useNavigationBuilder<TabNavigationState<any>, TabRouterOptions, TabActionHelpers<ParamListBase>, ExpoTabsNavigatorScreenOptions, TabNavigationEventMap>>;
45
46
  export type TabContextValue = TabsDescriptor['options'];
@@ -1 +1 @@
1
- {"version":3,"file":"TabContext.d.ts","sourceRoot":"","sources":["../../src/ui/TabContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAErD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,uBAAuB,CAC5D,aAAa,EACb,MAAM,GAAG,SAAS,EAClB,kBAAkB,CAAC,aAAa,CAAC,EACjC,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,CAAC,aAAa,CAAC,CACtC,GAEC,IAAI,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,GAC1C,8BAA8B,CAAC;AAEjC,MAAM,MAAM,sBAAsB,CAChC,SAAS,SAAS,aAAa,EAC/B,SAAS,SAAS,MAAM,SAAS,GAAG,MAAM,SAAS,EACnD,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,IAChD,cAAc,CAChB,SAAS,EACT,SAAS,EACT,WAAW,EACX,kBAAkB,CAAC,aAAa,CAAC,EACjC,qBAAqB,EACrB,qBAAqB,CACtB,CA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