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