expo-router 3.4.6 → 3.4.7

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":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"AAwFA,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAW,UAGtD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,UAMjF"}
1
+ {"version":3,"file":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"AAyFA,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAW,UAGtD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,UAMjF"}
@@ -24,7 +24,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.adjustPathname = exports.extractExpoPathFromURL = void 0;
27
- const expo_constants_1 = __importStar(require("expo-constants"));
28
27
  const Linking = __importStar(require("expo-linking"));
29
28
  // This is only run on native.
30
29
  function extractExactPathFromURL(url) {
@@ -35,8 +34,9 @@ function extractExactPathFromURL(url) {
35
34
  const { origin, href } = new URL(url);
36
35
  return href.replace(origin, '');
37
36
  }
37
+ const isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;
38
38
  // Handle special URLs used in Expo Go: `/--/pathname` -> `pathname`
39
- if (expo_constants_1.default.executionEnvironment === expo_constants_1.ExecutionEnvironment.StoreClient &&
39
+ if (isExpoGo &&
40
40
  // while not exhaustive, `exp` and `exps` are the only two schemes which
41
41
  // are passed through to other apps in Expo Go.
42
42
  url.match(/^exp(s)?:\/\//)) {
@@ -1 +1 @@
1
- {"version":3,"file":"extractPathFromURL.js","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAiE;AACjE,sDAAwC;AAExC,8BAA8B;AAC9B,SAAS,uBAAuB,CAAC,GAAW;IAC1C;IACE,2EAA2E;IAC3E,4CAA4C;IAC5C,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,EACzB;QACA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;KACjC;IAED,oEAAoE;IACpE,IACE,wBAAS,CAAC,oBAAoB,KAAK,qCAAoB,CAAC,WAAW;QACnE,wEAAwE;QACxE,+CAA+C;QAC/C,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,EAC1B;QACA,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,QAAQ,EAAE;YACZ,OAAO,YAAY,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC;SACxC;QAED,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE/B,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,WAAW;YACzB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;iBAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;iBAC5B,IAAI,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,CACL,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,CAA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C,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/F,IAAI,EAAE,EAAE;QACN,OAAO,IAAI,GAAG,GAAG,EAAE,CAAC;KACrB;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,sBAAsB,CAAC,MAAc,EAAE;IACrD,sEAAsE;IACtE,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACzD,CAAC;AAHD,wDAGC;AAED,SAAgB,cAAc,CAAC,GAAmD;IAChF,IAAI,GAAG,CAAC,QAAQ,KAAK,UAAU,IAAI,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QAChE,6CAA6C;QAC7C,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACnD;IACD,OAAO,GAAG,CAAC,QAAQ,CAAC;AACtB,CAAC;AAND,wCAMC","sourcesContent":["import Constants, { ExecutionEnvironment } from 'expo-constants';\nimport * as Linking from 'expo-linking';\n\n// This is only run on native.\nfunction extractExactPathFromURL(url: string): string {\n if (\n // If a universal link / app link / web URL is used, we should use the path\n // from the URL, while stripping the origin.\n url.match(/^https?:\\/\\//)\n ) {\n const { origin, href } = new URL(url);\n return href.replace(origin, '');\n }\n\n // Handle special URLs used in Expo Go: `/--/pathname` -> `pathname`\n if (\n Constants.executionEnvironment === ExecutionEnvironment.StoreClient &&\n // while not exhaustive, `exp` and `exps` are the only two schemes which\n // are passed through to other apps in Expo Go.\n url.match(/^exp(s)?:\\/\\//)\n ) {\n const pathname = url.match(/exps?:\\/\\/.*?\\/--\\/(.*)/)?.[1];\n if (pathname) {\n return fromDeepLink('a://' + pathname);\n }\n\n const res = Linking.parse(url);\n\n const qs = !res.queryParams\n ? ''\n : Object.entries(res.queryParams)\n .map(([k, v]) => `${k}=${v}`)\n .join('&');\n return (\n adjustPathname({ hostname: res.hostname, pathname: res.path || '' }) + (qs ? '?' + qs : '')\n );\n }\n\n // TODO: Support dev client URLs\n\n return fromDeepLink(url);\n}\n\n/** Major hack to support the makeshift expo-development-client system. */\nfunction isExpoDevelopmentClient(url: URL): boolean {\n return url.hostname === 'expo-development-client';\n}\n\nfunction fromDeepLink(url: string): string {\n let res: URL;\n try {\n // This is for all standard deep links, e.g. `foobar://` where everything\n // after the `://` is the path.\n res = new URL(url);\n } catch {\n return url;\n }\n\n if (isExpoDevelopmentClient(res)) {\n if (!res.searchParams.get('url')) {\n return '';\n }\n const incomingUrl = res.searchParams.get('url')!;\n return extractExactPathFromURL(decodeURI(incomingUrl));\n }\n\n let results = '';\n\n if (res.host) {\n results += res.host;\n }\n\n if (res.pathname) {\n results += res.pathname;\n }\n\n const qs = !res.search\n ? ''\n : // @ts-ignore: `entries` is not on `URLSearchParams` in some typechecks.\n [...res.searchParams.entries()].map(([k, v]) => `${k}=${decodeURIComponent(v)}`).join('&');\n\n if (qs) {\n results += '?' + qs;\n }\n\n return results;\n}\n\nexport function extractExpoPathFromURL(url: string = '') {\n // TODO: We should get rid of this, dropping specificities is not good\n return extractExactPathFromURL(url).replace(/^\\//, '');\n}\n\nexport function adjustPathname(url: { hostname?: string | null; pathname: string }) {\n if (url.hostname === 'exp.host' || url.hostname === 'u.expo.dev') {\n // drop the first two segments from pathname:\n return url.pathname.split('/').slice(2).join('/');\n }\n return url.pathname;\n}\n"]}
1
+ {"version":3,"file":"extractPathFromURL.js","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AAExC,8BAA8B;AAC9B,SAAS,uBAAuB,CAAC,GAAW;IAC1C;IACE,2EAA2E;IAC3E,4CAA4C;IAC5C,GAAG,CAA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CAAC;AAED,SAAgB,sBAAsB,CAAC,MAAc,EAAE;IACrD,sEAAsE;IACtE,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACzD,CAAC;AAHD,wDAGC;AAED,SAAgB,cAAc,CAAC,GAAmD;IAChF,IAAI,GAAG,CAAC,QAAQ,KAAK,UAAU,IAAI,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QAChE,6CAA6C;QAC7C,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACnD;IACD,OAAO,GAAG,CAAC,QAAQ,CAAC;AACtB,CAAC;AAND,wCAMC","sourcesContent":["import * as Linking from 'expo-linking';\n\n// This is only run on native.\nfunction extractExactPathFromURL(url: string): string {\n if (\n // If a universal link / app link / web URL is used, we should use the path\n // from the URL, while stripping the origin.\n url.match(/^https?:\\/\\//)\n ) {\n const { origin, href } = new URL(url);\n return href.replace(origin, '');\n }\n\n const isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;\n\n // Handle special URLs used in Expo Go: `/--/pathname` -> `pathname`\n if (\n isExpoGo &&\n // while not exhaustive, `exp` and `exps` are the only two schemes which\n // are passed through to other apps in Expo Go.\n url.match(/^exp(s)?:\\/\\//)\n ) {\n const pathname = url.match(/exps?:\\/\\/.*?\\/--\\/(.*)/)?.[1];\n if (pathname) {\n return fromDeepLink('a://' + pathname);\n }\n\n const res = Linking.parse(url);\n\n const qs = !res.queryParams\n ? ''\n : Object.entries(res.queryParams)\n .map(([k, v]) => `${k}=${v}`)\n .join('&');\n return (\n adjustPathname({ hostname: res.hostname, pathname: res.path || '' }) + (qs ? '?' + qs : '')\n );\n }\n\n // TODO: Support dev client URLs\n\n return fromDeepLink(url);\n}\n\n/** Major hack to support the makeshift expo-development-client system. */\nfunction isExpoDevelopmentClient(url: URL): boolean {\n return url.hostname === 'expo-development-client';\n}\n\nfunction fromDeepLink(url: string): string {\n let res: URL;\n try {\n // This is for all standard deep links, e.g. `foobar://` where everything\n // after the `://` is the path.\n res = new URL(url);\n } catch {\n return url;\n }\n\n if (isExpoDevelopmentClient(res)) {\n if (!res.searchParams.get('url')) {\n return '';\n }\n const incomingUrl = res.searchParams.get('url')!;\n return extractExactPathFromURL(decodeURI(incomingUrl));\n }\n\n let results = '';\n\n if (res.host) {\n results += res.host;\n }\n\n if (res.pathname) {\n results += res.pathname;\n }\n\n const qs = !res.search\n ? ''\n : // @ts-ignore: `entries` is not on `URLSearchParams` in some typechecks.\n [...res.searchParams.entries()].map(([k, v]) => `${k}=${decodeURIComponent(v)}`).join('&');\n\n if (qs) {\n results += '?' + qs;\n }\n\n return results;\n}\n\nexport function extractExpoPathFromURL(url: string = '') {\n // TODO: We should get rid of this, dropping specificities is not good\n return extractExactPathFromURL(url).replace(/^\\//, '');\n}\n\nexport function adjustPathname(url: { hostname?: string | null; pathname: string }) {\n if (url.hostname === 'exp.host' || url.hostname === 'u.expo.dev') {\n // drop the first two segments from pathname:\n return url.pathname.split('/').slice(2).join('/');\n }\n return url.pathname;\n}\n"]}
@@ -33,4 +33,9 @@ export interface RouteRegex {
33
33
  }
34
34
  export declare function getServerManifest(route: RouteNode): ExpoRouterServerManifestV1;
35
35
  export declare function getNamedRouteRegex(normalizedRoute: string, page: string): ExpoRouterServerManifestV1Route;
36
+ export declare function parseParameter(param: string): {
37
+ name: string;
38
+ repeat: boolean;
39
+ optional: boolean;
40
+ };
36
41
  //# sourceMappingURL=getServerManifest.d.ts.map
@@ -1 +1 @@
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;AAKzC,MAAM,MAAM,+BAA+B,CAAC,MAAM,GAAG,MAA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AAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,MAAM,GAAG,MAAM,IAAI;IACxD,SAAS,EAAE,+BAA+B,CAAC,MAAM,CAAC,EAAE,CAAC;IACrD,UAAU,EAAE,+BAA+B,CAAC,MAAM,CAAC,EAAE,CAAC;IACtD,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;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAA;KAAE,CAAC;IACvC,EAAE,EAAE,MAAM,CAAC;CACZ;AAWD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,0BAA0B,CA8B9E;AAiBD,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,GACX,+BAA+B,CAQjC;AA2GD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM;;;;EAgB3C"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNamedRouteRegex = exports.getServerManifest = void 0;
3
+ exports.parseParameter = exports.getNamedRouteRegex = exports.getServerManifest = void 0;
4
4
  const matchers_1 = require("./matchers");
5
5
  const sortRoutes_1 = require("./sortRoutes");
6
6
  function isApiRoute(route) {
@@ -33,10 +33,13 @@ function getServerManifest(route) {
33
33
  }
34
34
  exports.getServerManifest = getServerManifest;
35
35
  function getMatchableManifestForPaths(paths) {
36
- return paths.map((normalizedRoutePath) => ({
37
- ...getNamedRouteRegex(normalizedRoutePath[0], normalizedRoutePath[1].contextKey),
38
- generated: normalizedRoutePath[1].generated,
39
- }));
36
+ return paths.map((normalizedRoutePath) => {
37
+ const matcher = getNamedRouteRegex(normalizedRoutePath[0], normalizedRoutePath[1].contextKey);
38
+ if (normalizedRoutePath[1].generated) {
39
+ matcher.generated = true;
40
+ }
41
+ return matcher;
42
+ });
40
43
  }
41
44
  function getNamedRouteRegex(normalizedRoute, page) {
42
45
  const result = getNamedParametrizedRoute(normalizedRoute);
@@ -94,7 +97,7 @@ function getNamedParametrizedRoute(route) {
94
97
  segment = '[...not-found]';
95
98
  }
96
99
  if (/^\[.*\]$/.test(segment)) {
97
- const { name, optional, repeat } = parseParameter(segment.slice(1, -1));
100
+ const { name, optional, repeat } = parseParameter(segment);
98
101
  // replace any non-word characters since they can break
99
102
  // the named regex
100
103
  let cleanedKey = name.replace(/\W/g, '');
@@ -157,4 +160,5 @@ function parseParameter(param) {
157
160
  }
158
161
  return { name, repeat, optional };
159
162
  }
163
+ exports.parseParameter = parseParameter;
160
164
  //# sourceMappingURL=getServerManifest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getServerManifest.js","sourceRoot":"","sources":["../src/getServerManifest.ts"],"names":[],"mappings":";;;AAUA,yCAA2C;AAC3C,6CAA0C;AA4B1C,SAAS,UAAU,CAAC,KAAgB;IAClC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,eAAe,CAAC,KAAgB;IACvC,OAAO,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC3E,CAAC;AAED,yFAAyF;AACzF,SAAgB,iBAAiB,CAAC,KAAgB;IAChD,SAAS,YAAY,CAAC,KAAgB;QACpC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;YACzB,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KA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BAAqB,CAAC;AAC1C,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C,SAAS,kBAAkB,CAAC,GAAW;IACrC,+GAA+G;IAC/G,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;KAC7C;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,IAAI,GAAG,KAAK,CAAC;IAEjB,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACzB,QAAQ,GAAG,IAAI,CAAC;QAChB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC1B;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACxB,MAAM,GAAG,IAAI,CAAC;QACd,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtB;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACpC,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n * Copyright © 2023 Vercel, Inc.\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 * Based on https://github.com/vercel/next.js/blob/1df2686bc9964f1a86c444701fa5cbf178669833/packages/next/src/shared/lib/router/utils/route-regex.ts\n */\nimport type { RouteNode } from './Route';\nimport { getContextKey } from './matchers';\nimport { sortRoutes } from './sortRoutes';\n\n// TODO: Share these types across cli, server, router, etc.\nexport type ExpoRouterServerManifestV1Route<TRegex = string> = {\n file: string;\n page: string;\n routeKeys: Record<string, string>;\n namedRegex: TRegex;\n generated?: boolean;\n};\n\nexport type ExpoRouterServerManifestV1<TRegex = string> = {\n apiRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n htmlRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n notFoundRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n};\n\nexport interface Group {\n pos: number;\n repeat: boolean;\n optional: boolean;\n}\n\nexport interface RouteRegex {\n groups: { [groupName: string]: Group };\n re: RegExp;\n}\n\nfunction isApiRoute(route: RouteNode) {\n return !route.children.length && !!route.contextKey.match(/\\+api\\.[jt]sx?$/);\n}\n\nfunction isNotFoundRoute(route: RouteNode) {\n return route.dynamic && route.dynamic[route.dynamic.length - 1].notFound;\n}\n\n// Given a nested route tree, return a flattened array of all routes that can be matched.\nexport function getServerManifest(route: RouteNode): ExpoRouterServerManifestV1 {\n function getFlatNodes(route: RouteNode): [string, RouteNode][] {\n if (route.children.length) {\n return route.children.map((child) => getFlatNodes(child)).flat();\n }\n\n const key = getContextKey(route.contextKey).replace(/\\/index$/, '') ?? '/';\n return [[key, route]];\n }\n\n const flat = getFlatNodes(route)\n .sort(([, a], [, b]) => sortRoutes(b, a))\n .reverse();\n\n const apiRoutes = flat.filter(([, route]) => isApiRoute(route));\n const otherRoutes = flat.filter(([, route]) => !isApiRoute(route));\n const standardRoutes = otherRoutes.filter(([, route]) => !isNotFoundRoute(route));\n const notFoundRoutes = otherRoutes.filter(([, route]) => isNotFoundRoute(route));\n\n return {\n apiRoutes: getMatchableManifestForPaths(\n apiRoutes.map(([normalizedRoutePath, node]) => [normalizedRoutePath, node])\n ),\n htmlRoutes: getMatchableManifestForPaths(\n standardRoutes.map(([normalizedRoutePath, node]) => [normalizedRoutePath, node])\n ),\n notFoundRoutes: getMatchableManifestForPaths(\n notFoundRoutes.map(([normalizedRoutePath, node]) => [normalizedRoutePath, node])\n ),\n };\n}\n\nfunction getMatchableManifestForPaths(\n paths: [string, RouteNode][]\n): ExpoRouterServerManifestV1Route[] {\n return paths.map((normalizedRoutePath) => ({\n ...getNamedRouteRegex(normalizedRoutePath[0], normalizedRoutePath[1].contextKey),\n generated: normalizedRoutePath[1].generated,\n }));\n}\n\nexport function getNamedRouteRegex(\n normalizedRoute: string,\n page: string\n): ExpoRouterServerManifestV1Route {\n const result = getNamedParametrizedRoute(normalizedRoute);\n return {\n file: page,\n page: page.replace(/\\.[jt]sx?$/, ''),\n namedRegex: `^${result.namedParameterizedRoute}(?:/)?$`,\n routeKeys: result.routeKeys,\n };\n}\n\n/**\n * Builds a function to generate a minimal routeKey using only a-z and minimal\n * number of characters.\n */\nfunction buildGetSafeRouteKey() {\n let currentCharCode = 96; // Starting one before 'a' to make the increment logic simpler\n let currentLength = 1;\n\n return () => {\n let result = '';\n let incrementNext = true;\n\n // Iterate from right to left to build the key\n for (let i = 0; i < currentLength; i++) {\n if (incrementNext) {\n currentCharCode++;\n if (currentCharCode > 122) {\n currentCharCode = 97; // Reset to 'a'\n incrementNext = true; // Continue to increment the next character\n } else {\n incrementNext = false;\n }\n }\n result = String.fromCharCode(currentCharCode) + result;\n }\n\n // If all characters are 'z', increase the length of the key\n if (incrementNext) {\n currentLength++;\n currentCharCode = 96; // This will make the next key start with 'a'\n }\n\n return result;\n };\n}\n\nfunction removeTrailingSlash(route: string): string {\n return route.replace(/\\/$/, '') || '/';\n}\n\nfunction getNamedParametrizedRoute(route: string) {\n const segments = removeTrailingSlash(route).slice(1).split('/');\n const getSafeRouteKey = buildGetSafeRouteKey();\n const routeKeys: { [named: string]: string } = {};\n return {\n namedParameterizedRoute: segments\n .map((segment, index) => {\n if (segment === '+not-found' && index === segments.length - 1) {\n segment = '[...not-found]';\n }\n if (/^\\[.*\\]$/.test(segment)) {\n const { name, optional, repeat } = parseParameter(segment.slice(1, -1));\n // replace any non-word characters since they can break\n // the named regex\n let cleanedKey = name.replace(/\\W/g, '');\n let invalidKey = false;\n\n // check if the key is still invalid and fallback to using a known\n // safe key\n if (cleanedKey.length === 0 || cleanedKey.length > 30) {\n invalidKey = true;\n }\n if (!isNaN(parseInt(cleanedKey.slice(0, 1), 10))) {\n invalidKey = true;\n }\n\n // Prevent duplicates after sanitizing the key\n if (cleanedKey in routeKeys) {\n invalidKey = true;\n }\n\n if (invalidKey) {\n cleanedKey = getSafeRouteKey();\n }\n\n routeKeys[cleanedKey] = name;\n return repeat\n ? optional\n ? `(?:/(?<${cleanedKey}>.+?))?`\n : `/(?<${cleanedKey}>.+?)`\n : `/(?<${cleanedKey}>[^/]+?)`;\n } else if (/^\\(.*\\)$/.test(segment)) {\n // Make section optional\n return `(?:/${escapeStringRegexp(segment)})?`;\n } else {\n return `/${escapeStringRegexp(segment)}`;\n }\n })\n .join(''),\n routeKeys,\n };\n}\n\n// regexp is based on https://github.com/sindresorhus/escape-string-regexp\nconst reHasRegExp = /[|\\\\{}()[\\]^$+*?.-]/;\nconst reReplaceRegExp = /[|\\\\{}()[\\]^$+*?.-]/g;\n\nfunction escapeStringRegexp(str: string) {\n // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23\n if (reHasRegExp.test(str)) {\n return str.replace(reReplaceRegExp, '\\\\$&');\n }\n return str;\n}\n\nfunction parseParameter(param: string) {\n let repeat = false;\n let optional = false;\n let name = param;\n\n if (/^\\[.*\\]$/.test(name)) {\n optional = true;\n name = name.slice(1, -1);\n }\n\n if (/^\\.\\.\\./.test(name)) {\n repeat = true;\n name = name.slice(3);\n }\n\n return { name, repeat, optional };\n}\n"]}
1
+ {"version":3,"file":"getServerManifest.js","sourceRoot":"","sources":["../src/getServerManifest.ts"],"names":[],"mappings":";;;AAUA,yCAA2C;AAC3C,6CAA0C;AA4B1C,SAAS,UAAU,CAAC,KAAgB;IAClC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,eAAe,CAAC,KAAgB;IACvC,OAAO,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAA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AAC,IAAI,CAAC,OAAO,CAAC,EAAE;gBACnC,wBAAwB;gBACxB,OAAO,OAAO,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC;aAC/C;iBAAM;gBACL,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;aAC1C;QACH,CAAC,CAAC;aACD,IAAI,CAAC,EAAE,CAAC;QACX,SAAS;KACV,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAC1C,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C,SAAS,kBAAkB,CAAC,GAAW;IACrC,+GAA+G;IAC/G,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;KAC7C;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,IAAI,GAAG,KAAK,CAAC;IAEjB,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACzB,QAAQ,GAAG,IAAI,CAAC;QAChB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC1B;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACxB,MAAM,GAAG,IAAI,CAAC;QACd,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtB;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACpC,CAAC;AAhBD,wCAgBC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n * Copyright © 2023 Vercel, Inc.\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 * Based on https://github.com/vercel/next.js/blob/1df2686bc9964f1a86c444701fa5cbf178669833/packages/next/src/shared/lib/router/utils/route-regex.ts\n */\nimport type { RouteNode } from './Route';\nimport { getContextKey } from './matchers';\nimport { sortRoutes } from './sortRoutes';\n\n// TODO: Share these types across cli, server, router, etc.\nexport type ExpoRouterServerManifestV1Route<TRegex = string> = {\n file: string;\n page: string;\n routeKeys: Record<string, string>;\n namedRegex: TRegex;\n generated?: boolean;\n};\n\nexport type ExpoRouterServerManifestV1<TRegex = string> = {\n apiRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n htmlRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n notFoundRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n};\n\nexport interface Group {\n pos: number;\n repeat: boolean;\n optional: boolean;\n}\n\nexport interface RouteRegex {\n groups: { [groupName: string]: Group };\n re: RegExp;\n}\n\nfunction isApiRoute(route: RouteNode) {\n return !route.children.length && !!route.contextKey.match(/\\+api\\.[jt]sx?$/);\n}\n\nfunction isNotFoundRoute(route: RouteNode) {\n return route.dynamic && route.dynamic[route.dynamic.length - 1].notFound;\n}\n\n// Given a nested route tree, return a flattened array of all routes that can be matched.\nexport function getServerManifest(route: RouteNode): ExpoRouterServerManifestV1 {\n function getFlatNodes(route: RouteNode): [string, RouteNode][] {\n if (route.children.length) {\n return route.children.map((child) => getFlatNodes(child)).flat();\n }\n\n const key = getContextKey(route.contextKey).replace(/\\/index$/, '') ?? '/';\n return [[key, route]];\n }\n\n const flat = getFlatNodes(route)\n .sort(([, a], [, b]) => sortRoutes(b, a))\n .reverse();\n\n const apiRoutes = flat.filter(([, route]) => isApiRoute(route));\n const otherRoutes = flat.filter(([, route]) => !isApiRoute(route));\n const standardRoutes = otherRoutes.filter(([, route]) => !isNotFoundRoute(route));\n const notFoundRoutes = otherRoutes.filter(([, route]) => isNotFoundRoute(route));\n\n return {\n apiRoutes: getMatchableManifestForPaths(\n apiRoutes.map(([normalizedRoutePath, node]) => [normalizedRoutePath, node])\n ),\n htmlRoutes: getMatchableManifestForPaths(\n standardRoutes.map(([normalizedRoutePath, node]) => [normalizedRoutePath, node])\n ),\n notFoundRoutes: getMatchableManifestForPaths(\n notFoundRoutes.map(([normalizedRoutePath, node]) => [normalizedRoutePath, node])\n ),\n };\n}\n\nfunction getMatchableManifestForPaths(\n paths: [string, RouteNode][]\n): ExpoRouterServerManifestV1Route[] {\n return paths.map((normalizedRoutePath) => {\n const matcher: ExpoRouterServerManifestV1Route = getNamedRouteRegex(\n normalizedRoutePath[0],\n normalizedRoutePath[1].contextKey\n );\n if (normalizedRoutePath[1].generated) {\n matcher.generated = true;\n }\n return matcher;\n });\n}\n\nexport function getNamedRouteRegex(\n normalizedRoute: string,\n page: string\n): ExpoRouterServerManifestV1Route {\n const result = getNamedParametrizedRoute(normalizedRoute);\n return {\n file: page,\n page: page.replace(/\\.[jt]sx?$/, ''),\n namedRegex: `^${result.namedParameterizedRoute}(?:/)?$`,\n routeKeys: result.routeKeys,\n };\n}\n\n/**\n * Builds a function to generate a minimal routeKey using only a-z and minimal\n * number of characters.\n */\nfunction buildGetSafeRouteKey() {\n let currentCharCode = 96; // Starting one before 'a' to make the increment logic simpler\n let currentLength = 1;\n\n return () => {\n let result = '';\n let incrementNext = true;\n\n // Iterate from right to left to build the key\n for (let i = 0; i < currentLength; i++) {\n if (incrementNext) {\n currentCharCode++;\n if (currentCharCode > 122) {\n currentCharCode = 97; // Reset to 'a'\n incrementNext = true; // Continue to increment the next character\n } else {\n incrementNext = false;\n }\n }\n result = String.fromCharCode(currentCharCode) + result;\n }\n\n // If all characters are 'z', increase the length of the key\n if (incrementNext) {\n currentLength++;\n currentCharCode = 96; // This will make the next key start with 'a'\n }\n\n return result;\n };\n}\n\nfunction removeTrailingSlash(route: string): string {\n return route.replace(/\\/$/, '') || '/';\n}\n\nfunction getNamedParametrizedRoute(route: string) {\n const segments = removeTrailingSlash(route).slice(1).split('/');\n const getSafeRouteKey = buildGetSafeRouteKey();\n const routeKeys: { [named: string]: string } = {};\n return {\n namedParameterizedRoute: segments\n .map((segment, index) => {\n if (segment === '+not-found' && index === segments.length - 1) {\n segment = '[...not-found]';\n }\n if (/^\\[.*\\]$/.test(segment)) {\n const { name, optional, repeat } = parseParameter(segment);\n // replace any non-word characters since they can break\n // the named regex\n let cleanedKey = name.replace(/\\W/g, '');\n let invalidKey = false;\n\n // check if the key is still invalid and fallback to using a known\n // safe key\n if (cleanedKey.length === 0 || cleanedKey.length > 30) {\n invalidKey = true;\n }\n if (!isNaN(parseInt(cleanedKey.slice(0, 1), 10))) {\n invalidKey = true;\n }\n\n // Prevent duplicates after sanitizing the key\n if (cleanedKey in routeKeys) {\n invalidKey = true;\n }\n\n if (invalidKey) {\n cleanedKey = getSafeRouteKey();\n }\n\n routeKeys[cleanedKey] = name;\n return repeat\n ? optional\n ? `(?:/(?<${cleanedKey}>.+?))?`\n : `/(?<${cleanedKey}>.+?)`\n : `/(?<${cleanedKey}>[^/]+?)`;\n } else if (/^\\(.*\\)$/.test(segment)) {\n // Make section optional\n return `(?:/${escapeStringRegexp(segment)})?`;\n } else {\n return `/${escapeStringRegexp(segment)}`;\n }\n })\n .join(''),\n routeKeys,\n };\n}\n\n// regexp is based on https://github.com/sindresorhus/escape-string-regexp\nconst reHasRegExp = /[|\\\\{}()[\\]^$+*?.-]/;\nconst reReplaceRegExp = /[|\\\\{}()[\\]^$+*?.-]/g;\n\nfunction escapeStringRegexp(str: string) {\n // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23\n if (reHasRegExp.test(str)) {\n return str.replace(reReplaceRegExp, '\\\\$&');\n }\n return str;\n}\n\nexport function parseParameter(param: string) {\n let repeat = false;\n let optional = false;\n let name = param;\n\n if (/^\\[.*\\]$/.test(name)) {\n optional = true;\n name = name.slice(1, -1);\n }\n\n if (/^\\.\\.\\./.test(name)) {\n repeat = true;\n name = name.slice(3);\n }\n\n return { name, repeat, optional };\n}\n"]}
@@ -20,7 +20,7 @@ export type UserActivity = {
20
20
  dateModified?: Date;
21
21
  expirationDate?: Date;
22
22
  };
23
- export declare const ExpoHead: {
23
+ declare let ExpoHead: {
24
24
  activities: {
25
25
  INDEXED_ROUTE: string;
26
26
  };
@@ -30,4 +30,5 @@ export declare const ExpoHead: {
30
30
  suspendActivity(id: string): void;
31
31
  revokeActivity(id: string): void;
32
32
  } | null;
33
+ export { ExpoHead };
33
34
  //# sourceMappingURL=ExpoHeadModule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoHeadModule.d.ts","sourceRoot":"","sources":["../../src/head/ExpoHeadModule.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB,YAAY,EAAE,MAAM,CAAC;IAErB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,cAAc,CAAC,EAAE,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE;IACrB,UAAU,EAAE;QACV,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,iBAAiB,IAAI,YAAY,CAAC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oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,GAAG,IAAW,CAAC;AAOhB,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -3,5 +3,10 @@
3
3
  // https://developer.apple.com/documentation/foundation/nsuseractivity/2980674-iseligibleforprediction
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.ExpoHead = void 0;
6
- exports.ExpoHead = null;
6
+ let ExpoHead = null;
7
+ exports.ExpoHead = ExpoHead;
8
+ // If running in Expo Go.
9
+ if (typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo) {
10
+ exports.ExpoHead = ExpoHead = globalThis.expo?.modules?.ExpoHead;
11
+ }
7
12
  //# sourceMappingURL=ExpoHeadModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoHeadModule.js","sourceRoot":"","sources":["../../src/head/ExpoHeadModule.ts"],"names":[],"mappings":";AAAA,0BAA0B;AAC1B,sGAAsG;;;AA+BzF,QAAA,QAAQ,GASV,IAAI,CAAC","sourcesContent":["// isEligibleForPrediction\n// https://developer.apple.com/documentation/foundation/nsuseractivity/2980674-iseligibleforprediction\n\nexport type UserActivity = {\n id?: string;\n /**\n * The activity title should be clear and concise. This text describes the content of the link, like “Photo taken on July 27, 2020” or “Conversation with Maria”. Use nouns for activity titles.\n */\n title?: string;\n description?: string;\n webpageURL?: string;\n keywords?: string[];\n // TODO: Get this automatically somehow\n activityType: string;\n // TODO: Maybe something like robots.txt?\n phrase?: string;\n\n thumbnailURL?: string;\n\n userInfo?: Record<string, string>;\n\n isEligibleForHandoff?: boolean;\n isEligibleForPrediction?: boolean;\n isEligibleForSearch?: boolean;\n\n /** Local file path for an image */\n imageUrl?: string;\n darkImageUrl?: string;\n dateModified?: Date;\n expirationDate?: Date;\n};\n\nexport const ExpoHead: {\n activities: {\n INDEXED_ROUTE: string;\n };\n getLaunchActivity(): UserActivity;\n createActivity(userActivity: UserActivity): void;\n clearActivitiesAsync(ids: string[]): Promise<void>;\n suspendActivity(id: string): void;\n revokeActivity(id: string): void;\n} | null = null;\n"]}
1
+ {"version":3,"file":"ExpoHeadModule.js","sourceRoot":"","sources":["../../src/head/ExpoHeadModule.ts"],"names":[],"mappings":";AAAA,0BAA0B;AAC1B,sGAAsG;;;AA+BtG,IAAI,QAAQ,GASD,IAAI,CAAC;AAOP,4BAAQ;AALjB,yBAAyB;AACzB,IAAI,OAAO,IAAI,KAAK,WAAW,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IACnE,mBAAA,QAAQ,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC;CAC/C","sourcesContent":["// isEligibleForPrediction\n// https://developer.apple.com/documentation/foundation/nsuseractivity/2980674-iseligibleforprediction\n\nexport type UserActivity = {\n id?: string;\n /**\n * The activity title should be clear and concise. This text describes the content of the link, like “Photo taken on July 27, 2020” or “Conversation with Maria”. Use nouns for activity titles.\n */\n title?: string;\n description?: string;\n webpageURL?: string;\n keywords?: string[];\n // TODO: Get this automatically somehow\n activityType: string;\n // TODO: Maybe something like robots.txt?\n phrase?: string;\n\n thumbnailURL?: string;\n\n userInfo?: Record<string, string>;\n\n isEligibleForHandoff?: boolean;\n isEligibleForPrediction?: boolean;\n isEligibleForSearch?: boolean;\n\n /** Local file path for an image */\n imageUrl?: string;\n darkImageUrl?: string;\n dateModified?: Date;\n expirationDate?: Date;\n};\n\nlet ExpoHead: {\n activities: {\n INDEXED_ROUTE: string;\n };\n getLaunchActivity(): UserActivity;\n createActivity(userActivity: UserActivity): void;\n clearActivitiesAsync(ids: string[]): Promise<void>;\n suspendActivity(id: string): void;\n revokeActivity(id: string): void;\n} | null = null;\n\n// If running in Expo Go.\nif (typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo) {\n ExpoHead = globalThis.expo?.modules?.ExpoHead;\n}\n\nexport { ExpoHead };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../src/link/linking.ts"],"names":[],"mappings":"AAKA,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AAOxD,wBAAgB,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,CA8C/D;AAID,wBAAgB,UAAU,IAAI,MAAM,CAKnC;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,cA4B/D;AAED,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../src/link/linking.ts"],"names":[],"mappings":"AAIA,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AASxD,wBAAgB,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,CA8C/D;AAID,wBAAgB,UAAU,IAAI,MAAM,CAKnC;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,cA4B/D;AAED,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
@@ -27,7 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.getPathFromState = exports.getStateFromPath = exports.addEventListener = exports.getRootURL = exports.getInitialURL = void 0;
30
- const expo_constants_1 = __importStar(require("expo-constants"));
31
30
  const Linking = __importStar(require("expo-linking"));
32
31
  const react_native_1 = require("react-native");
33
32
  const extractPathFromURL_1 = require("../fork/extractPathFromURL");
@@ -35,6 +34,7 @@ const getPathFromState_1 = __importDefault(require("../fork/getPathFromState"));
35
34
  exports.getPathFromState = getPathFromState_1.default;
36
35
  const getStateFromPath_1 = __importDefault(require("../fork/getStateFromPath"));
37
36
  exports.getStateFromPath = getStateFromPath_1.default;
37
+ const isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;
38
38
  // A custom getInitialURL is used on native to ensure the app always starts at
39
39
  // the root path if it's launched from something other than a deep link.
40
40
  // This helps keep the native functionality working like the web functionality.
@@ -58,7 +58,7 @@ function getInitialURL() {
58
58
  // NOTE(EvanBacon): This could probably be wrapped with the development boundary
59
59
  // since Expo Go is mostly just used in development.
60
60
  // Expo Go is weird and requires the root path to be `/--/`
61
- if (url && expo_constants_1.default.executionEnvironment === expo_constants_1.ExecutionEnvironment.StoreClient) {
61
+ if (url && isExpoGo) {
62
62
  const parsed = Linking.parse(url);
63
63
  // If the URL is defined (default in Expo Go dev apps) and the URL has no path:
64
64
  // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`
@@ -91,7 +91,7 @@ function getRootURL() {
91
91
  exports.getRootURL = getRootURL;
92
92
  function addEventListener(listener) {
93
93
  let callback = undefined;
94
- if (expo_constants_1.default.executionEnvironment === expo_constants_1.ExecutionEnvironment.StoreClient) {
94
+ if (isExpoGo) {
95
95
  // This extra work is only done in the Expo Go app.
96
96
  callback = ({ url }) => {
97
97
  const parsed = Linking.parse(url);
@@ -1 +1 @@
1
- {"version":3,"file":"linking.js","sourceRoot":"","sources":["../../src/link/linking.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAiE;AACjE,sDAAwC;AACxC,+CAAwC;AAExC,mEAA4D;AAC5D,gFAAwD;AA+F7B,2BA/FpB,0BAAgB,CA+FoB;AA9F3C,gFAAwD;AA8F/C,2BA9FF,0BAAgB,CA8FE;AA5FzB,8EAA8E;AAC9E,wEAAwE;AACxE,+EAA+E;AAC/E,8GAA8G;AA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ACJ,CAAC;AA5BD,4CA4BC","sourcesContent":["import Constants, { ExecutionEnvironment } from 'expo-constants';\nimport * as Linking from 'expo-linking';\nimport { Platform } from 'react-native';\n\nimport { adjustPathname } from '../fork/extractPathFromURL';\nimport getPathFromState from '../fork/getPathFromState';\nimport getStateFromPath from '../fork/getStateFromPath';\n\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.\nexport function getInitialURL(): Promise<string | null> | string {\n if (process.env.NODE_ENV === 'test') {\n return Linking.getInitialURL() ?? getRootURL();\n }\n\n if (Platform.OS === 'web') {\n if (typeof window === 'undefined') {\n return '';\n } else if (typeof window.location?.href === 'string') {\n return window.location.href;\n }\n }\n return Promise.race<string>([\n (async () => {\n const url = await Linking.getInitialURL();\n\n // NOTE(EvanBacon): This could probably be wrapped with the development boundary\n // since Expo Go is mostly just used in development.\n\n // Expo Go is weird and requires the root path to be `/--/`\n if (url && Constants.executionEnvironment === ExecutionEnvironment.StoreClient) {\n const parsed = Linking.parse(url);\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n if (\n parsed.path === null ||\n ['', '/'].includes(\n adjustPathname({\n hostname: parsed.hostname,\n pathname: parsed.path,\n })\n )\n ) {\n return getRootURL();\n }\n }\n // The path will be nullish in bare apps when the app is launched from the home screen.\n // TODO(EvanBacon): define some policy around notifications.\n return url ?? getRootURL();\n })(),\n new Promise<string>((resolve) =>\n // Timeout in 150ms if `getInitialState` doesn't resolve\n // Workaround for https://github.com/facebook/react-native/issues/25675\n setTimeout(() => resolve(getRootURL()), 150)\n ),\n ]);\n}\n\nlet _rootURL: string | undefined;\n\nexport function getRootURL(): string {\n if (_rootURL === undefined) {\n _rootURL = Linking.createURL('/');\n }\n return _rootURL;\n}\n\nexport function addEventListener(listener: (url: string) => void) {\n let callback: (({ url }: { url: string }) => void) | undefined = undefined;\n\n if (Constants.executionEnvironment === ExecutionEnvironment.StoreClient) {\n // This extra work is only done in the Expo Go app.\n callback = ({ url }: { url: string }) => {\n const parsed = Linking.parse(url);\n\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n if (\n parsed.path === null ||\n ['', '/'].includes(adjustPathname({ hostname: parsed.hostname, pathname: parsed.path }))\n ) {\n listener(getRootURL());\n } else {\n listener(url);\n }\n };\n } else {\n callback = ({ url }: { url: string }) => listener(url);\n }\n const subscription = Linking.addEventListener('url', callback);\n\n return () => {\n // https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7\n subscription?.remove?.();\n };\n}\n\nexport { getStateFromPath, getPathFromState };\n"]}
1
+ {"version":3,"file":"linking.js","sourceRoot":"","sources":["../../src/link/linking.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,+CAAwC;AAExC,mEAA4D;AAC5D,gFAAwD;AAiG7B,2BAjGpB,0BAAgB,CAiGoB;AAhG3C,gFAAwD;AAgG/C,2BAhGF,0BAAgB,CAgGE;AA9FzB,MAAM,QAAQ,GAAG,OAAO,IAAI,KAAK,WAAW,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC;AAEjF,8EAA8E;AAC9E,wEAAwE;AACxE,+EAA+E;AAC/E,8GAA8G;AAC9G,8EAA8E;AAC9E,SAAgB,aAAa;IAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;QACnC,OAAO,OAAO,CAAC,aAAa,EAAE,IAAI,UAAU,EAAE,CAAC;KAChD;IAED,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACzB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YACjC,OA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SAAgB,gBAAgB,CAAC,QAA+B;IAC9D,IAAI,QAAQ,GAAqD,SAAS,CAAC;IAE3E,IAAI,QAAQ,EAAE;QACZ,mDAAmD;QACnD,QAAQ,GAAG,CAAC,EAAE,GAAG,EAAmB,EAAE,EAAE;YACtC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAElC,+EAA+E;YAC/E,oFAAoF;YACpF,IACE,MAAM,CAAC,IAAI,KAAK,IAAI;gBACpB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAA,mCAAc,EAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,EACxF;gBACA,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;aACxB;iBAAM;gBACL,QAAQ,CAAC,GAAG,CAAC,CAAC;aACf;QACH,CAAC,CAAC;KACH;SAAM;QACL,QAAQ,GAAG,CAAC,EAAE,GAAG,EAAmB,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;KACxD;IACD,MAAM,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAE/D,OAAO,GAAG,EAAE;QACV,2FAA2F;QAC3F,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC;AA5BD,4CA4BC","sourcesContent":["import * as Linking from 'expo-linking';\nimport { Platform } from 'react-native';\n\nimport { adjustPathname } from '../fork/extractPathFromURL';\nimport getPathFromState from '../fork/getPathFromState';\nimport getStateFromPath from '../fork/getStateFromPath';\n\nconst isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;\n\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.\nexport function getInitialURL(): Promise<string | null> | string {\n if (process.env.NODE_ENV === 'test') {\n return Linking.getInitialURL() ?? getRootURL();\n }\n\n if (Platform.OS === 'web') {\n if (typeof window === 'undefined') {\n return '';\n } else if (typeof window.location?.href === 'string') {\n return window.location.href;\n }\n }\n return Promise.race<string>([\n (async () => {\n const url = await Linking.getInitialURL();\n\n // NOTE(EvanBacon): This could probably be wrapped with the development boundary\n // since Expo Go is mostly just used in development.\n\n // Expo Go is weird and requires the root path to be `/--/`\n if (url && isExpoGo) {\n const parsed = Linking.parse(url);\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n if (\n parsed.path === null ||\n ['', '/'].includes(\n adjustPathname({\n hostname: parsed.hostname,\n pathname: parsed.path,\n })\n )\n ) {\n return getRootURL();\n }\n }\n // The path will be nullish in bare apps when the app is launched from the home screen.\n // TODO(EvanBacon): define some policy around notifications.\n return url ?? getRootURL();\n })(),\n new Promise<string>((resolve) =>\n // Timeout in 150ms if `getInitialState` doesn't resolve\n // Workaround for https://github.com/facebook/react-native/issues/25675\n setTimeout(() => resolve(getRootURL()), 150)\n ),\n ]);\n}\n\nlet _rootURL: string | undefined;\n\nexport function getRootURL(): string {\n if (_rootURL === undefined) {\n _rootURL = Linking.createURL('/');\n }\n return _rootURL;\n}\n\nexport function addEventListener(listener: (url: string) => void) {\n let callback: (({ url }: { url: string }) => void) | undefined = undefined;\n\n if (isExpoGo) {\n // This extra work is only done in the Expo Go app.\n callback = ({ url }: { url: string }) => {\n const parsed = Linking.parse(url);\n\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n if (\n parsed.path === null ||\n ['', '/'].includes(adjustPathname({ hostname: parsed.hostname, pathname: parsed.path }))\n ) {\n listener(getRootURL());\n } else {\n listener(url);\n }\n };\n } else {\n callback = ({ url }: { url: string }) => listener(url);\n }\n const subscription = Linking.addEventListener('url', callback);\n\n return () => {\n // https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7\n subscription?.remove?.();\n };\n}\n\nexport { getStateFromPath, getPathFromState };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "3.4.6",
3
+ "version": "3.4.7",
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",
@@ -91,7 +91,7 @@
91
91
  "tsd": "^0.28.1"
92
92
  },
93
93
  "dependencies": {
94
- "@expo/metro-runtime": "3.1.2",
94
+ "@expo/metro-runtime": "3.1.3",
95
95
  "@expo/server": "^0.3.0",
96
96
  "@radix-ui/react-slot": "1.0.1",
97
97
  "@react-navigation/bottom-tabs": "~6.5.7",
@@ -101,5 +101,5 @@
101
101
  "react-helmet-async": "^1.3.0",
102
102
  "schema-utils": "^4.0.1"
103
103
  },
104
- "gitHead": "82b69cba5b2e967806ca03413c3277f1d53bff8d"
104
+ "gitHead": "4f3dcf3e23eae997f884117fdd34ad734efad9fd"
105
105
  }
@@ -1,3 +0,0 @@
1
- declare let ExpoHead: null | any;
2
- export { ExpoHead };
3
- //# sourceMappingURL=ExpoHeadModule.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpoHeadModule.native.d.ts","sourceRoot":"","sources":["../../src/head/ExpoHeadModule.native.ts"],"names":[],"mappings":"AAGA,QAAA,IAAI,QAAQ,EAAE,IAAI,GAAG,GAAU,CAAC;AAQhC,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ExpoHead = void 0;
27
- const expo_constants_1 = __importStar(require("expo-constants"));
28
- const expo_modules_core_1 = require("expo-modules-core");
29
- let ExpoHead = null;
30
- exports.ExpoHead = ExpoHead;
31
- if (expo_constants_1.default.executionEnvironment === expo_constants_1.ExecutionEnvironment.Bare) {
32
- // Loads the native module object from the JSI or falls back to
33
- // the bridge module (from NativeModulesProxy) if the remote debugger is on.
34
- exports.ExpoHead = ExpoHead = (0, expo_modules_core_1.requireNativeModule)('ExpoHead');
35
- }
36
- //# sourceMappingURL=ExpoHeadModule.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpoHeadModule.native.js","sourceRoot":"","sources":["../../src/head/ExpoHeadModule.native.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAiE;AACjE,yDAAwD;AAExD,IAAI,QAAQ,GAAe,IAAI,CAAC;AAQvB,4BAAQ;AANjB,IAAI,wBAAS,CAAC,oBAAoB,KAAK,qCAAoB,CAAC,IAAI,EAAE;IAChE,+DAA+D;IAC/D,4EAA4E;IAC5E,mBAAA,QAAQ,GAAG,IAAA,uCAAmB,EAAC,UAAU,CAAC,CAAC;CAC5C","sourcesContent":["import Constants, { ExecutionEnvironment } from 'expo-constants';\nimport { requireNativeModule } from 'expo-modules-core';\n\nlet ExpoHead: null | any = null;\n\nif (Constants.executionEnvironment === ExecutionEnvironment.Bare) {\n // Loads the native module object from the JSI or falls back to\n // the bridge module (from NativeModulesProxy) if the remote debugger is on.\n ExpoHead = requireNativeModule('ExpoHead');\n}\n\nexport { ExpoHead };\n"]}