expo-router 1.5.0 → 1.5.2

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/babel.js CHANGED
@@ -30,16 +30,16 @@ function getExpoRouterImportMode(projectRoot, platform) {
30
30
  if (process.env.EXPO_ROUTER_IMPORT_MODE) {
31
31
  return process.env.EXPO_ROUTER_IMPORT_MODE;
32
32
  }
33
+ const env = process.env.NODE_ENV || process.env.BABEL_ENV;
34
+
33
35
  const { exp } = getConfigMemo(projectRoot);
34
- let mode = [process.env.NODE_ENV, true].includes(
35
- exp.extra?.router?.asyncRoutes
36
- )
36
+ let mode = [env, true].includes(exp.extra?.router?.asyncRoutes)
37
37
  ? "lazy"
38
38
  : "sync";
39
39
 
40
40
  // TODO: Production bundle splitting
41
41
 
42
- if (process.env.NODE_ENV === "production" && mode === "lazy") {
42
+ if (env === "production" && mode === "lazy") {
43
43
  throw new Error(
44
44
  "Async routes are not supported in production yet. Set `extra.router.asyncRoutes` to `development`, `false`, or `undefined`."
45
45
  );
@@ -1 +1 @@
1
- {"version":3,"file":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"AAwEA,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,UAGjD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE;IAClC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB,UAMA"}
1
+ {"version":3,"file":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"AAwFA,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,UAGjD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE;IAClC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB,UAMA"}
@@ -19,7 +19,7 @@ export type ScreenProps<TOptions extends Record<string, any> = Record<string, an
19
19
  */
20
20
  export declare function useSortedScreens(order: ScreenProps[]): React.ReactNode[];
21
21
  /** Wrap the component with various enhancements and add access to child routes. */
22
- export declare function getQualifiedRouteComponent(value: RouteNode): React.ComponentType<any> | React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
22
+ export declare function getQualifiedRouteComponent(value: RouteNode): React.ComponentType<any> | React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
23
23
  /** @returns a function which provides a screen id that matches the dynamic route name in params. */
24
24
  export declare function createGetIdForRoute(route: Pick<RouteNode, "dynamic" | "route">): (({ params }: {
25
25
  params?: Record<string, any> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useScreens.d.ts","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAIL,SAAS,EAGV,MAAM,SAAS,CAAC;AAMjB,MAAM,MAAM,WAAW,CACrB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IACxD;IACF,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACvC,OAAO,CAAC,EAAE,QAAQ,CAAC;IAGnB,SAAS,CAAC,EAAE,GAAG,CAAC;CACjB,CAAC;AA8DF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,CAUxE;AA6BD,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS,+GA2E1D;AAED,oGAAoG;AACpG,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC;;sCA0B5C"}
1
+ {"version":3,"file":"useScreens.d.ts","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAIL,SAAS,EAGV,MAAM,SAAS,CAAC;AAMjB,MAAM,MAAM,WAAW,CACrB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IACxD;IACF,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACvC,OAAO,CAAC,EAAE,QAAQ,CAAC;IAGnB,SAAS,CAAC,EAAE,GAAG,CAAC;CACjB,CAAC;AA8DF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,CAUxE;AA6BD,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS,kIA2E1D;AAED,oGAAoG;AACpG,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC;;sCA0B5C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "main": "src/index.tsx",
5
5
  "types": "build/index.d.ts",
6
6
  "files": [
@@ -92,7 +92,7 @@
92
92
  },
93
93
  "dependencies": {
94
94
  "@bacons/react-views": "^1.1.3",
95
- "@expo/metro-runtime": "2.0.4",
95
+ "@expo/metro-runtime": "2.0.5",
96
96
  "@radix-ui/react-slot": "^1.0.0",
97
97
  "@react-navigation/bottom-tabs": "~6.5.7",
98
98
  "@react-navigation/native": "~6.1.6",
@@ -3,7 +3,7 @@ import * as Linking from "expo-linking";
3
3
  import URL from "url-parse";
4
4
 
5
5
  // This is only run on native.
6
- function extractExactPathFromURL(url: string) {
6
+ function extractExactPathFromURL(url: string): string {
7
7
  if (
8
8
  // If a universal link / app link / web URL is used, we should use the path
9
9
  // from the URL, while stripping the origin.
@@ -43,10 +43,26 @@ function extractExactPathFromURL(url: string) {
43
43
  return fromDeepLink(url);
44
44
  }
45
45
 
46
- function fromDeepLink(url: string) {
46
+ /** Major hack to support the makeshift expo-development-client system. */
47
+ function isExpoDevelopmentClient(
48
+ url: URL<Record<string, string | undefined>>
49
+ ): boolean {
50
+ return !!url.hostname.match(/^expo-development-client$/);
51
+ }
52
+
53
+ function fromDeepLink(url: string): string {
47
54
  // This is for all standard deep links, e.g. `foobar://` where everything
48
55
  // after the `://` is the path.
49
56
  const res = new URL(url, true);
57
+
58
+ if (isExpoDevelopmentClient(res)) {
59
+ if (!res.query || !res.query.url) {
60
+ return "";
61
+ }
62
+ const incomingUrl = res.query.url;
63
+ return extractExactPathFromURL(decodeURI(incomingUrl));
64
+ }
65
+
50
66
  const qs = !res.query
51
67
  ? ""
52
68
  : Object.entries(res.query as Record<string, string>)