expo-router 4.0.19 → 4.0.20-rc.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"getLinkingConfig.d.ts","sourceRoot":"","sources":["../src/getLinkingConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG9E,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAC;AAEvD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAE,OAAc;;;EAE9E;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG;IAC/F,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,CAAC;IAC3C,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,aAAa,CAAC;CACtC,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,cAAc,EACvB,EAAE,QAAe,EAAE,SAAS,EAAE,GAAE,oBAAyB,GACxD,kBAAkB,CA6DpB"}
1
+ {"version":3,"file":"getLinkingConfig.d.ts","sourceRoot":"","sources":["../src/getLinkingConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG9E,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAC;AAEvD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAE,OAAc;;;EAE9E;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG;IAC/F,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,CAAC;IAC3C,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,aAAa,CAAC;CACtC,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,cAAc,EACvB,EAAE,QAAe,EAAE,SAAS,EAAE,GAAE,oBAAyB,GACxD,kBAAkB,CAgEpB"}
@@ -19,9 +19,11 @@ function getLinkingConfig(store, routes, context, { metaOnly = true, serverUrl }
19
19
  const nativeLinking = nativeLinkingKey
20
20
  ? context(nativeLinkingKey)
21
21
  : undefined;
22
+ const config = getNavigationConfig(routes, metaOnly);
23
+ const boundGetStateFromPath = linking_1.getStateFromPath.bind(store);
22
24
  return {
23
25
  prefixes: [],
24
- config: getNavigationConfig(routes, metaOnly),
26
+ config,
25
27
  // A custom getInitialURL is used on native to ensure the app always starts at
26
28
  // the root path if it's launched from something other than a deep link.
27
29
  // This helps keep the native functionality working like the web functionality.
@@ -55,12 +57,12 @@ function getLinkingConfig(store, routes, context, { metaOnly = true, serverUrl }
55
57
  return initialUrl;
56
58
  },
57
59
  subscribe: (0, linking_1.addEventListener)(nativeLinking),
58
- getStateFromPath: linking_1.getStateFromPath.bind(store),
60
+ getStateFromPath: boundGetStateFromPath,
59
61
  getPathFromState(state, options) {
60
62
  return ((0, linking_1.getPathFromState)(state, {
61
- screens: {},
62
- ...this.config,
63
+ ...config,
63
64
  ...options,
65
+ screens: config.screens ?? options?.screens ?? {},
64
66
  }) ?? '/');
65
67
  },
66
68
  // Add all functions to ensure the types never need to fallback.
@@ -1 +1 @@
1
- {"version":3,"file":"getLinkingConfig.js","sourceRoot":"","sources":["../src/getLinkingConfig.ts"],"names":[],"mappings":";;;AAAA,qDAA8E;AAC9E,yDAA6C;AAI7C,yEAAsE;AAEtE,4CAKwB;AAGxB,SAAgB,mBAAmB,CAAC,MAAiB,EAAE,WAAoB,IAAI;IAC7E,OAAO,IAAA,mDAAwB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACpD,CAAC;AAFD,kDAEC;AAaD,SAAgB,gBAAgB,CAC9B,KAAkB,EAClB,MAAiB,EACjB,OAAuB,EACvB,EAAE,QAAQ,GAAG,IAAI,EAAE,SAAS,KAA2B,EAAE;IAEzD,gHAAgH;IAChH,IAAI,mBAAmB,GAAG,KAAK,CAAC;IAChC,IAAI,UAAwD,CAAC;IAE7D,MAAM,gBAAgB,GAAG,OAAO;SAC7B,IAAI,EAAE;SACN,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC;IAC9D,MAAM,aAAa,GAA6B,gBAAgB;QAC9D,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;QAC3B,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACL,QAAQ,EAAE,EAAE;QACZ,MAAM,EA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E,EAAE;gBACX,GAAG,IAAI,CAAC,MAAM;gBACd,GAAG,OAAO;aACX,CAAC,IAAI,GAAG,CACV,CAAC;QACJ,CAAC;QACD,gEAAgE;QAChE,kDAAkD;QAClD,kBAAkB,EAAlB,2BAAkB;KACnB,CAAC;AACJ,CAAC;AAlED,4CAkEC","sourcesContent":["import { getActionFromState, LinkingOptions } from '@react-navigation/native';\nimport { Platform } from 'expo-modules-core';\n\nimport { RouteNode } from './Route';\nimport { State } from './fork/getPathFromState';\nimport { getReactNavigationConfig } from './getReactNavigationConfig';\nimport { RouterStore } from './global-state/router-store';\nimport {\n addEventListener,\n getInitialURL,\n getPathFromState,\n getStateFromPath,\n} from './link/linking';\nimport { NativeIntent, RequireContext } from './types';\n\nexport function getNavigationConfig(routes: RouteNode, metaOnly: boolean = true) {\n return getReactNavigationConfig(routes, metaOnly);\n}\n\nexport type ExpoLinkingOptions<T extends object = Record<string, unknown>> = LinkingOptions<T> & {\n getPathFromState?: typeof getPathFromState;\n getStateFromPath?: typeof getStateFromPath;\n};\n\nexport type LinkingConfigOptions = {\n metaOnly?: boolean;\n serverUrl?: string;\n getInitialURL?: typeof getInitialURL;\n};\n\nexport function getLinkingConfig(\n store: RouterStore,\n routes: RouteNode,\n context: RequireContext,\n { metaOnly = true, serverUrl }: LinkingConfigOptions = {}\n): ExpoLinkingOptions {\n // Returning `undefined` / `null from `getInitialURL` are valid values, so we need to track if it's been called.\n let hasCachedInitialUrl = false;\n let initialUrl: ReturnType<typeof getInitialURL> | undefined;\n\n const nativeLinkingKey = context\n .keys()\n .find((key) => key.match(/^\\.\\/\\+native-intent\\.[tj]sx?$/));\n const nativeLinking: NativeIntent | undefined = nativeLinkingKey\n ? context(nativeLinkingKey)\n : undefined;\n\n return {\n prefixes: [],\n config: getNavigationConfig(routes, metaOnly),\n // A custom getInitialURL is used on native to ensure the app always starts at\n // the root path if it's launched from something other than a deep link.\n // This helps keep the native functionality working like the web functionality.\n // For example, if you had a root navigator where the first screen was `/settings` and the second was `/index`\n // then `/index` would be used on web and `/settings` would be used on native.\n getInitialURL() {\n // Expo Router calls `getInitialURL` twice, which may confuse the user if they provide a custom `getInitialURL`.\n // Therefor we memoize the result.\n if (!hasCachedInitialUrl) {\n if (Platform.OS === 'web') {\n initialUrl = serverUrl ?? getInitialURL();\n } else {\n initialUrl = serverUrl ?? getInitialURL();\n\n if (typeof initialUrl === 'string') {\n if (typeof nativeLinking?.redirectSystemPath === 'function') {\n initialUrl = nativeLinking.redirectSystemPath({ path: initialUrl, initial: true });\n }\n } else if (initialUrl) {\n initialUrl = initialUrl.then((url) => {\n if (url && typeof nativeLinking?.redirectSystemPath === 'function') {\n return nativeLinking.redirectSystemPath({ path: url, initial: true });\n }\n return url;\n });\n }\n }\n hasCachedInitialUrl = true;\n }\n return initialUrl;\n },\n subscribe: addEventListener(nativeLinking),\n getStateFromPath: getStateFromPath.bind(store),\n getPathFromState(state: State, options: Parameters<typeof getPathFromState>[1]) {\n return (\n getPathFromState(state, {\n screens: {},\n ...this.config,\n ...options,\n }) ?? '/'\n );\n },\n // Add all functions to ensure the types never need to fallback.\n // This is a convenience for usage in the package.\n getActionFromState,\n };\n}\n"]}
1
+ {"version":3,"file":"getLinkingConfig.js","sourceRoot":"","sources":["../src/getLinkingConfig.ts"],"names":[],"mappings":";;;AAAA,qDAA8E;AAC9E,yDAA6C;AAI7C,yEAAsE;AAEtE,4CAKwB;AAGxB,SAAgB,mBAAmB,CAAC,MAAiB,EAAE,WAAoB,IAAI;IAC7E,OAAO,IAAA,mDAAwB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACpD,CAAC;AAFD,kDAEC;AAaD,SAAgB,gBAAgB,CAC9B,KAAkB,EAClB,MAAiB,EACjB,OAAuB,EACvB,EAAE,QAAQ,GAAG,IAAI,EAAE,SAAS,KAA2B,EAAE;IAEzD,gHAAgH;IAChH,IAAI,mBAAmB,GAAG,KAAK,CAAC;IAChC,IAAI,UAAwD,CAAC;IAE7D,MAAM,g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,EAAE,IAAI,EAAE,CAAC,CAAC;6BACvE;4BACD,OAAO,GAAG,CAAC;wBACb,CAAC,CAAC,CAAC;qBACJ;iBACF;gBACD,mBAAmB,GAAG,IAAI,CAAC;aAC5B;YACD,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,SAAS,EAAE,IAAA,0BAAgB,EAAC,aAAa,CAAC;QAC1C,gBAAgB,EAAE,qBAAqB;QACvC,gBAAgB,CAAC,KAAY,EAAE,OAA+C;YAC5E,OAAO,CACL,IAAA,0BAAgB,EAAC,KAAK,EAAE;gBACtB,GAAG,MAAM;gBACT,GAAG,OAAO;gBACV,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,OAAO,EAAE,OAAO,IAAI,EAAE;aAClD,CAAC,IAAI,GAAG,CACV,CAAC;QACJ,CAAC;QACD,gEAAgE;QAChE,kDAAkD;QAClD,kBAAkB,EAAlB,2BAAkB;KACnB,CAAC;AACJ,CAAC;AArED,4CAqEC","sourcesContent":["import { getActionFromState, LinkingOptions } from '@react-navigation/native';\nimport { Platform } from 'expo-modules-core';\n\nimport { RouteNode } from './Route';\nimport { State } from './fork/getPathFromState';\nimport { getReactNavigationConfig } from './getReactNavigationConfig';\nimport { RouterStore } from './global-state/router-store';\nimport {\n addEventListener,\n getInitialURL,\n getPathFromState,\n getStateFromPath,\n} from './link/linking';\nimport { NativeIntent, RequireContext } from './types';\n\nexport function getNavigationConfig(routes: RouteNode, metaOnly: boolean = true) {\n return getReactNavigationConfig(routes, metaOnly);\n}\n\nexport type ExpoLinkingOptions<T extends object = Record<string, unknown>> = LinkingOptions<T> & {\n getPathFromState?: typeof getPathFromState;\n getStateFromPath?: typeof getStateFromPath;\n};\n\nexport type LinkingConfigOptions = {\n metaOnly?: boolean;\n serverUrl?: string;\n getInitialURL?: typeof getInitialURL;\n};\n\nexport function getLinkingConfig(\n store: RouterStore,\n routes: RouteNode,\n context: RequireContext,\n { metaOnly = true, serverUrl }: LinkingConfigOptions = {}\n): ExpoLinkingOptions {\n // Returning `undefined` / `null from `getInitialURL` are valid values, so we need to track if it's been called.\n let hasCachedInitialUrl = false;\n let initialUrl: ReturnType<typeof getInitialURL> | undefined;\n\n const nativeLinkingKey = context\n .keys()\n .find((key) => key.match(/^\\.\\/\\+native-intent\\.[tj]sx?$/));\n const nativeLinking: NativeIntent | undefined = nativeLinkingKey\n ? context(nativeLinkingKey)\n : undefined;\n\n const config = getNavigationConfig(routes, metaOnly);\n const boundGetStateFromPath = getStateFromPath.bind(store);\n\n return {\n prefixes: [],\n config,\n // A custom getInitialURL is used on native to ensure the app always starts at\n // the root path if it's launched from something other than a deep link.\n // This helps keep the native functionality working like the web functionality.\n // For example, if you had a root navigator where the first screen was `/settings` and the second was `/index`\n // then `/index` would be used on web and `/settings` would be used on native.\n getInitialURL() {\n // Expo Router calls `getInitialURL` twice, which may confuse the user if they provide a custom `getInitialURL`.\n // Therefor we memoize the result.\n if (!hasCachedInitialUrl) {\n if (Platform.OS === 'web') {\n initialUrl = serverUrl ?? getInitialURL();\n } else {\n initialUrl = serverUrl ?? getInitialURL();\n\n if (typeof initialUrl === 'string') {\n if (typeof nativeLinking?.redirectSystemPath === 'function') {\n initialUrl = nativeLinking.redirectSystemPath({ path: initialUrl, initial: true });\n }\n } else if (initialUrl) {\n initialUrl = initialUrl.then((url) => {\n if (url && typeof nativeLinking?.redirectSystemPath === 'function') {\n return nativeLinking.redirectSystemPath({ path: url, initial: true });\n }\n return url;\n });\n }\n }\n hasCachedInitialUrl = true;\n }\n return initialUrl;\n },\n subscribe: addEventListener(nativeLinking),\n getStateFromPath: boundGetStateFromPath,\n getPathFromState(state: State, options: Parameters<typeof getPathFromState>[1]) {\n return (\n getPathFromState(state, {\n ...config,\n ...options,\n screens: config.screens ?? options?.screens ?? {},\n }) ?? '/'\n );\n },\n // Add all functions to ensure the types never need to fallback.\n // This is a convenience for usage in the package.\n getActionFromState,\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "4.0.19",
3
+ "version": "4.0.20-rc.0",
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",
@@ -117,5 +117,5 @@
117
117
  "semver": "~7.6.3",
118
118
  "server-only": "^0.0.1"
119
119
  },
120
- "gitHead": "d0aa5eeb2e585c1a2d1848f240e35a27a2ab7136"
120
+ "gitHead": "356fc4659cc556a690b5e01555221f9629ec83d2"
121
121
  }