expo-router 6.0.0-preview.12 → 6.0.0-preview.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/getServerManifest.d.ts +0 -6
- package/build/getServerManifest.d.ts.map +1 -1
- package/build/getServerManifest.js +0 -1
- package/build/getServerManifest.js.map +1 -1
- package/build/link/LinkWithPreview.d.ts.map +1 -1
- package/build/link/LinkWithPreview.js +1 -1
- package/build/link/LinkWithPreview.js.map +1 -1
- package/build/link/preview/native.d.ts +1 -0
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js +2 -0
- package/build/link/preview/native.js.map +1 -1
- package/build/link/preview/utils.d.ts.map +1 -1
- package/build/link/preview/utils.js +9 -0
- package/build/link/preview/utils.js.map +1 -1
- package/build/routes-manifest.d.ts +0 -33
- package/build/routes-manifest.d.ts.map +1 -1
- package/build/routes-manifest.js.map +1 -1
- package/ios/ExpoHeadModule.swift +3 -3
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +4 -0
- package/ios/LinkPreview/LinkPreviewNativeView.swift +37 -13
- package/package.json +6 -6
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* Based on https://github.com/vercel/next.js/blob/1df2686bc9964f1a86c444701fa5cbf178669833/packages/next/src/shared/lib/router/utils/route-regex.ts
|
|
9
9
|
*/
|
|
10
10
|
import type { RouteNode } from './Route';
|
|
11
|
-
import type { MiddlewareMatcher } from './routes-manifest';
|
|
12
11
|
export type ExpoRouterServerManifestV1Route<TRegex = string> = {
|
|
13
12
|
file: string;
|
|
14
13
|
page: string;
|
|
@@ -36,11 +35,6 @@ export type ExpoRouterServerManifestV1Middleware = {
|
|
|
36
35
|
* @example _expo/functions/+middleware.js
|
|
37
36
|
*/
|
|
38
37
|
file: string;
|
|
39
|
-
/**
|
|
40
|
-
* Optional matcher configuration for conditional middleware execution.
|
|
41
|
-
* When undefined, middleware runs on all requests.
|
|
42
|
-
*/
|
|
43
|
-
matcher?: MiddlewareMatcher;
|
|
44
38
|
};
|
|
45
39
|
export type ExpoRouterServerManifestV1<TRegex = string> = {
|
|
46
40
|
/**
|
|
@@ -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;
|
|
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,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,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AAI,GAAG,KAAK,CAAC;IAEjB,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,QAAQ,GAAG,IAAI,CAAC;QAChB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,GAAG,IAAI,CAAC;QACd,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;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, matchGroupName } from './matchers';\nimport type { MiddlewareMatcher } from './routes-manifest';\nimport { sortRoutes } from './sortRoutes';\nimport { shouldLinkExternally } from './utils/url';\n\n// TODO: Share these types across cli, server, router, etc.\nexport type ExpoRouterServerManifestV1Route<TRegex = string> = {\n file: string;\n page: string;\n /**\n * Keys are route param names that have been normalized for a regex named-matcher, values are the original route param names.\n */\n routeKeys: Record<string, string>;\n /**\n * Regex for matching a path against the route.\n * The regex is normalized for named matchers so keys must be looked up against the `routeKeys` object to collect the original route param names.\n * Regex matching alone cannot accurately route to a file, the order in which routes are matched is equally important to ensure correct priority.\n */\n namedRegex: TRegex;\n /** Indicates that the route was generated and does not map to any file in the project's routes directory. */\n generated?: boolean;\n /** Indicates that this is a redirect that should use 301 instead of 307 */\n permanent?: boolean;\n /** If a redirect, which methods are allowed. Undefined represents all methods */\n methods?: string[];\n};\n\nexport type ExpoRouterServerManifestV1Middleware = {\n /**\n * Path to the module that contains the middleware function as a default export.\n *\n * @example _expo/functions/+middleware.js\n */\n file: string;\n /**\n * Optional matcher configuration for conditional middleware execution.\n * When undefined, middleware runs on all requests.\n */\n matcher?: MiddlewareMatcher;\n};\n\nexport type ExpoRouterServerManifestV1<TRegex = string> = {\n /**\n * Middleware function that runs before any route matching.\n * Only allowed at the root level and requires web.output: \"server\".\n */\n middleware?: ExpoRouterServerManifestV1Middleware;\n /**\n * Rewrites. After middleware has processed and regular routing resumes, these occur first.\n */\n rewrites: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * List of routes that match second. Returns 301 and redirects to another path.\n */\n redirects: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * Routes that return static HTML files for a given path.\n * These are only matched against requests with method `GET` and `HEAD`.\n */\n htmlRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * Routes that are matched after HTML routes and invoke WinterCG-compliant functions.\n */\n apiRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n /** List of routes that are matched last and return with status code 404. */\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: Record<string, Group>;\n re: RegExp;\n}\n\nfunction isNotFoundRoute(route: RouteNode) {\n return route.dynamic && route.dynamic[route.dynamic.length - 1].notFound;\n}\n\nfunction uniqueBy<T>(arr: T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n return arr.filter((item) => {\n const id = key(item);\n if (seen.has(id)) {\n return false;\n }\n seen.add(id);\n return true;\n });\n}\n\n// TODO(@hassankhan): ENG-16575\ntype FlatNodeTuple = [contextKey: string, absoluteRoute: string, node: RouteNode];\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, parentRoute: string = ''): FlatNodeTuple[] {\n // Use a recreated route instead of contextKey because we duplicate nodes to support array syntax.\n const absoluteRoute = [parentRoute, route.route].filter(Boolean).join('/');\n\n if (route.children.length) {\n return route.children.map((child) => getFlatNodes(child, absoluteRoute)).flat();\n }\n\n // API Routes are handled differently to HTML routes because they have no nested behavior.\n // An HTML route can be different based on parent segments due to layout routes, therefore multiple\n // copies should be rendered. However, an API route is always the same regardless of parent segments.\n let key: string;\n if (route.type.includes('api')) {\n key = getContextKey(route.contextKey).replace(/\\/index$/, '') ?? '/';\n } else {\n key = getContextKey(absoluteRoute).replace(/\\/index$/, '') ?? '/';\n }\n return [[key, '/' + absoluteRoute, route]];\n }\n\n // Remove duplicates from the runtime manifest which expands array syntax.\n const flat = getFlatNodes(route)\n .sort(([, , a], [, , b]) => sortRoutes(b, a))\n .reverse();\n\n const apiRoutes = uniqueBy(\n flat.filter(([, , route]) => route.type === 'api'),\n ([path]) => path\n );\n\n const otherRoutes = uniqueBy(\n flat.filter(\n ([, , route]) =>\n route.type === 'route' ||\n (route.type === 'rewrite' && (route.methods === undefined || route.methods.includes('GET')))\n ),\n ([path]) => path\n );\n\n const redirects = uniqueBy(\n flat.filter(([, , route]) => route.type === 'redirect'),\n ([path]) => path\n )\n .map((redirect) => {\n // TODO(@hassankhan): ENG-16577\n // For external redirects, use `destinationContextKey` as the destination URL\n if (shouldLinkExternally(redirect[2].destinationContextKey!)) {\n redirect[1] = redirect[2].destinationContextKey!;\n } else {\n redirect[1] =\n flat.find(([, , route]) => route.contextKey === redirect[2].destinationContextKey)?.[0] ??\n '/';\n }\n\n return redirect;\n })\n .reverse();\n\n const rewrites = uniqueBy(\n flat.filter(([, , route]) => route.type === 'rewrite'),\n ([path]) => path\n )\n .map((rewrite) => {\n rewrite[1] =\n flat.find(([, , route]) => route.contextKey === rewrite[2].destinationContextKey)?.[0] ??\n '/';\n\n return rewrite;\n })\n .reverse();\n\n const standardRoutes = otherRoutes.filter(([, , route]) => !isNotFoundRoute(route));\n const notFoundRoutes = otherRoutes.filter(([, , route]) => isNotFoundRoute(route));\n\n const manifest: ExpoRouterServerManifestV1 = {\n apiRoutes: getMatchableManifestForPaths(apiRoutes),\n htmlRoutes: getMatchableManifestForPaths(standardRoutes),\n notFoundRoutes: getMatchableManifestForPaths(notFoundRoutes),\n redirects: getMatchableManifestForPaths(redirects),\n rewrites: getMatchableManifestForPaths(rewrites),\n };\n\n if (route.middleware) {\n manifest.middleware = {\n file: route.middleware.contextKey,\n matcher: route.middleware.loadRoute().unstable_settings?.matcher ?? undefined,\n };\n }\n\n return manifest;\n}\n\nfunction getMatchableManifestForPaths(\n paths: [string, string, RouteNode][]\n): ExpoRouterServerManifestV1Route[] {\n return paths.map(([normalizedRoutePath, absoluteRoute, node]) => {\n const matcher: ExpoRouterServerManifestV1Route = getNamedRouteRegex(\n normalizedRoutePath,\n absoluteRoute,\n node.contextKey\n );\n if (node.generated) {\n matcher.generated = true;\n }\n\n if (node.permanent) {\n matcher.permanent = true;\n }\n\n if (node.methods) {\n matcher.methods = node.methods;\n }\n\n return matcher;\n });\n}\n\nfunction getNamedRouteRegex(\n normalizedRoute: string,\n page: string,\n file: string\n): ExpoRouterServerManifestV1Route {\n const result = getNamedParametrizedRoute(normalizedRoute);\n return {\n file,\n page,\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: Record<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 const groupName = matchGroupName(segment)!\n .split(',')\n .map((group) => group.trim())\n .filter(Boolean);\n if (groupName.length > 1) {\n const optionalSegment = `\\\\((?:${groupName.map(escapeStringRegexp).join('|')})\\\\)`;\n // Make section optional\n return `(?:/${optionalSegment})?`;\n } else {\n // Use simpler regex for single groups\n return `(?:/${escapeStringRegexp(segment)})?`;\n }\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"]}
|
|
1
|
+
{"version":3,"file":"getServerManifest.js","sourceRoot":"","sources":["../src/getServerManifest.ts"],"names":[],"mappings":";;AAuGA,8CA0FC;AA4JD,wCAgBC;AAnWD,yCAA2D;AAC3D,6CAA0C;AAC1C,qCAAmD;AAuEnD,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,SAAS,QAAQ,CAAI,GAAQ,EAAE,GAAwB;IACrD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACjB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAKD,yFAAyF;AACzF,SAAgB,iBAAiB,CAAC,KAAgB;IAChD,SAAS,YAAY,CAAC,KAAgB,EAAE,cAAsB,EAAE;QAC9D,k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;QACzB,MAAM,GAAG,IAAI,CAAC;QACd,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;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, matchGroupName } from './matchers';\nimport { sortRoutes } from './sortRoutes';\nimport { shouldLinkExternally } from './utils/url';\n\n// TODO: Share these types across cli, server, router, etc.\nexport type ExpoRouterServerManifestV1Route<TRegex = string> = {\n file: string;\n page: string;\n /**\n * Keys are route param names that have been normalized for a regex named-matcher, values are the original route param names.\n */\n routeKeys: Record<string, string>;\n /**\n * Regex for matching a path against the route.\n * The regex is normalized for named matchers so keys must be looked up against the `routeKeys` object to collect the original route param names.\n * Regex matching alone cannot accurately route to a file, the order in which routes are matched is equally important to ensure correct priority.\n */\n namedRegex: TRegex;\n /** Indicates that the route was generated and does not map to any file in the project's routes directory. */\n generated?: boolean;\n /** Indicates that this is a redirect that should use 301 instead of 307 */\n permanent?: boolean;\n /** If a redirect, which methods are allowed. Undefined represents all methods */\n methods?: string[];\n};\n\nexport type ExpoRouterServerManifestV1Middleware = {\n /**\n * Path to the module that contains the middleware function as a default export.\n *\n * @example _expo/functions/+middleware.js\n */\n file: string;\n};\n\nexport type ExpoRouterServerManifestV1<TRegex = string> = {\n /**\n * Middleware function that runs before any route matching.\n * Only allowed at the root level and requires web.output: \"server\".\n */\n middleware?: ExpoRouterServerManifestV1Middleware;\n /**\n * Rewrites. After middleware has processed and regular routing resumes, these occur first.\n */\n rewrites: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * List of routes that match second. Returns 301 and redirects to another path.\n */\n redirects: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * Routes that return static HTML files for a given path.\n * These are only matched against requests with method `GET` and `HEAD`.\n */\n htmlRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * Routes that are matched after HTML routes and invoke WinterCG-compliant functions.\n */\n apiRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n /** List of routes that are matched last and return with status code 404. */\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: Record<string, Group>;\n re: RegExp;\n}\n\nfunction isNotFoundRoute(route: RouteNode) {\n return route.dynamic && route.dynamic[route.dynamic.length - 1].notFound;\n}\n\nfunction uniqueBy<T>(arr: T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n return arr.filter((item) => {\n const id = key(item);\n if (seen.has(id)) {\n return false;\n }\n seen.add(id);\n return true;\n });\n}\n\n// TODO(@hassankhan): ENG-16575\ntype FlatNodeTuple = [contextKey: string, absoluteRoute: string, node: RouteNode];\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, parentRoute: string = ''): FlatNodeTuple[] {\n // Use a recreated route instead of contextKey because we duplicate nodes to support array syntax.\n const absoluteRoute = [parentRoute, route.route].filter(Boolean).join('/');\n\n if (route.children.length) {\n return route.children.map((child) => getFlatNodes(child, absoluteRoute)).flat();\n }\n\n // API Routes are handled differently to HTML routes because they have no nested behavior.\n // An HTML route can be different based on parent segments due to layout routes, therefore multiple\n // copies should be rendered. However, an API route is always the same regardless of parent segments.\n let key: string;\n if (route.type.includes('api')) {\n key = getContextKey(route.contextKey).replace(/\\/index$/, '') ?? '/';\n } else {\n key = getContextKey(absoluteRoute).replace(/\\/index$/, '') ?? '/';\n }\n return [[key, '/' + absoluteRoute, route]];\n }\n\n // Remove duplicates from the runtime manifest which expands array syntax.\n const flat = getFlatNodes(route)\n .sort(([, , a], [, , b]) => sortRoutes(b, a))\n .reverse();\n\n const apiRoutes = uniqueBy(\n flat.filter(([, , route]) => route.type === 'api'),\n ([path]) => path\n );\n\n const otherRoutes = uniqueBy(\n flat.filter(\n ([, , route]) =>\n route.type === 'route' ||\n (route.type === 'rewrite' && (route.methods === undefined || route.methods.includes('GET')))\n ),\n ([path]) => path\n );\n\n const redirects = uniqueBy(\n flat.filter(([, , route]) => route.type === 'redirect'),\n ([path]) => path\n )\n .map((redirect) => {\n // TODO(@hassankhan): ENG-16577\n // For external redirects, use `destinationContextKey` as the destination URL\n if (shouldLinkExternally(redirect[2].destinationContextKey!)) {\n redirect[1] = redirect[2].destinationContextKey!;\n } else {\n redirect[1] =\n flat.find(([, , route]) => route.contextKey === redirect[2].destinationContextKey)?.[0] ??\n '/';\n }\n\n return redirect;\n })\n .reverse();\n\n const rewrites = uniqueBy(\n flat.filter(([, , route]) => route.type === 'rewrite'),\n ([path]) => path\n )\n .map((rewrite) => {\n rewrite[1] =\n flat.find(([, , route]) => route.contextKey === rewrite[2].destinationContextKey)?.[0] ??\n '/';\n\n return rewrite;\n })\n .reverse();\n\n const standardRoutes = otherRoutes.filter(([, , route]) => !isNotFoundRoute(route));\n const notFoundRoutes = otherRoutes.filter(([, , route]) => isNotFoundRoute(route));\n\n const manifest: ExpoRouterServerManifestV1 = {\n apiRoutes: getMatchableManifestForPaths(apiRoutes),\n htmlRoutes: getMatchableManifestForPaths(standardRoutes),\n notFoundRoutes: getMatchableManifestForPaths(notFoundRoutes),\n redirects: getMatchableManifestForPaths(redirects),\n rewrites: getMatchableManifestForPaths(rewrites),\n };\n\n if (route.middleware) {\n manifest.middleware = {\n file: route.middleware.contextKey,\n };\n }\n\n return manifest;\n}\n\nfunction getMatchableManifestForPaths(\n paths: [string, string, RouteNode][]\n): ExpoRouterServerManifestV1Route[] {\n return paths.map(([normalizedRoutePath, absoluteRoute, node]) => {\n const matcher: ExpoRouterServerManifestV1Route = getNamedRouteRegex(\n normalizedRoutePath,\n absoluteRoute,\n node.contextKey\n );\n if (node.generated) {\n matcher.generated = true;\n }\n\n if (node.permanent) {\n matcher.permanent = true;\n }\n\n if (node.methods) {\n matcher.methods = node.methods;\n }\n\n return matcher;\n });\n}\n\nfunction getNamedRouteRegex(\n normalizedRoute: string,\n page: string,\n file: string\n): ExpoRouterServerManifestV1Route {\n const result = getNamedParametrizedRoute(normalizedRoute);\n return {\n file,\n page,\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: Record<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 const groupName = matchGroupName(segment)!\n .split(',')\n .map((group) => group.trim())\n .filter(Boolean);\n if (groupName.length > 1) {\n const optionalSegment = `\\\\((?:${groupName.map(escapeStringRegexp).join('|')})\\\\)`;\n // Make section optional\n return `(?:/${optionalSegment})?`;\n } else {\n // Use simpler regex for single groups\n return `(?:/${escapeStringRegexp(segment)})?`;\n }\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkWithPreview.d.ts","sourceRoot":"","sources":["../../src/link/LinkWithPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;AAUf,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"LinkWithPreview.d.ts","sourceRoot":"","sources":["../../src/link/LinkWithPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;AAUf,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,qBA0H/D"}
|
|
@@ -119,7 +119,7 @@ function LinkWithPreview({ children, ...rest }) {
|
|
|
119
119
|
if (!isPad) {
|
|
120
120
|
router.navigate(rest.href, { __internal__PreviewKey: nextScreenId });
|
|
121
121
|
}
|
|
122
|
-
}} style={{ borderRadius: highlightBorderRadius }}>
|
|
122
|
+
}} style={react_native_1.StyleSheet.flatten([{ display: 'contents', borderRadius: highlightBorderRadius }])} disableForceFlatten>
|
|
123
123
|
<InternalLinkPreviewContext_1.InternalLinkPreviewContext value={{ isVisible: isCurrentPreviewOpen, href: rest.href }}>
|
|
124
124
|
<BaseExpoRouterLink_1.BaseExpoRouterLink {...rest} children={trigger} ref={rest.ref}/>
|
|
125
125
|
{preview}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkWithPreview.js","sourceRoot":"","sources":["../../src/link/LinkWithPreview.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBb,
|
|
1
|
+
{"version":3,"file":"LinkWithPreview.js","sourceRoot":"","sources":["../../src/link/LinkWithPreview.tsx"],"names":[],"mappings":";AAAA,YAAY,CAA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C,WAAW,CACd;MAAA,EAAE,uDAA0B,CAC9B;IAAA,EAAE,0BAAiB,CAAC,CACrB,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,QAA6C,EAC7C,IAAgC;IAEhC,OAAO,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAC1C,CAAC,KAAK,EAAiC,EAAE,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CACvF,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport React, {\n isValidElement,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n} from 'react';\nimport { Platform, StyleSheet } from 'react-native';\n\nimport { useRouter } from '../hooks';\nimport { BaseExpoRouterLink } from './BaseExpoRouterLink';\nimport { InternalLinkPreviewContext } from './InternalLinkPreviewContext';\nimport { LinkMenu, LinkPreview, LinkTrigger } from './elements';\nimport { useLinkPreviewContext } from './preview/LinkPreviewContext';\nimport { NativeLinkPreview } from './preview/native';\nimport { useNextScreenId } from './preview/useNextScreenId';\nimport { LinkProps } from './useLinkHooks';\nimport { shouldLinkExternally } from '../utils/url';\n\nconst isPad = Platform.OS === 'ios' && Platform.isPad;\n\nexport function LinkWithPreview({ children, ...rest }: LinkProps) {\n const router = useRouter();\n const { setOpenPreviewKey } = useLinkPreviewContext();\n const [isCurrentPreviewOpen, setIsCurrenPreviewOpen] = useState(false);\n\n const hrefWithoutQuery = String(rest.href).split('?')[0];\n const prevHrefWithoutQuery = useRef(hrefWithoutQuery);\n\n useEffect(() => {\n if (isCurrentPreviewOpen) {\n if (prevHrefWithoutQuery.current !== hrefWithoutQuery) {\n throw new Error(\n 'Link does not support changing the href prop after the preview has been opened. Please ensure that the href prop is stable and does not change between renders.'\n );\n }\n } else {\n prevHrefWithoutQuery.current = hrefWithoutQuery;\n }\n }, [hrefWithoutQuery]);\n\n const [{ nextScreenId, tabPath }, prefetch] = useNextScreenId();\n\n useEffect(() => {\n if (rest.replace) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Using replace links with preview is not supported');\n } else {\n console.warn('Using replace links with preview is not supported');\n }\n }\n }, [rest.href, rest.replace]);\n\n const triggerElement = React.useMemo(\n () => getFirstChildOfType(children, LinkTrigger),\n [children]\n );\n const menuElement = React.useMemo(() => getFirstChildOfType(children, LinkMenu), [children]);\n const previewElement = React.useMemo(\n () => getFirstChildOfType(children, LinkPreview),\n [children]\n );\n\n if ((previewElement || menuElement) && !triggerElement) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n 'When you use Link.Preview, you must use Link.Trigger to specify the trigger element.'\n );\n } else {\n console.warn(\n 'When you use Link.Preview, you must use Link.Trigger to specify the trigger element.'\n );\n }\n }\n\n const trigger = React.useMemo(\n () => triggerElement ?? <LinkTrigger>{children}</LinkTrigger>,\n [triggerElement, children]\n );\n const highlightBorderRadius =\n rest.style && 'borderRadius' in rest.style ? rest.style.borderRadius : undefined;\n\n const preview = React.useMemo(\n () => (shouldLinkExternally(String(rest.href)) || !previewElement ? null : previewElement),\n [previewElement, rest.href]\n );\n\n const isPreviewTapped = useRef(false);\n\n const tabPathValue = useMemo(\n () => ({\n path: tabPath,\n }),\n [tabPath]\n );\n\n const hasPreview = !!previewElement;\n\n if (rest.replace) {\n return <BaseExpoRouterLink children={children} {...rest} />;\n }\n\n return (\n <NativeLinkPreview\n nextScreenId={isPad ? undefined : nextScreenId}\n tabPath={isPad ? undefined : tabPathValue}\n onWillPreviewOpen={() => {\n if (hasPreview) {\n isPreviewTapped.current = false;\n prefetch(rest.href);\n setIsCurrenPreviewOpen(true);\n }\n }}\n onPreviewWillClose={() => {\n if (hasPreview) {\n setIsCurrenPreviewOpen(false);\n // When preview was not tapped, then we need to enable the screen stack animation\n // Otherwise this will happen in StackNavigator, when new screen is opened\n if (!isPreviewTapped.current || isPad) {\n setOpenPreviewKey(undefined);\n }\n }\n }}\n onPreviewDidClose={() => {\n if (hasPreview && isPreviewTapped.current && isPad) {\n router.navigate(rest.href, { __internal__PreviewKey: nextScreenId });\n }\n }}\n onPreviewTapped={() => {\n isPreviewTapped.current = true;\n if (!isPad) {\n router.navigate(rest.href, { __internal__PreviewKey: nextScreenId });\n }\n }}\n style={StyleSheet.flatten([{ display: 'contents', borderRadius: highlightBorderRadius }])}\n disableForceFlatten>\n <InternalLinkPreviewContext value={{ isVisible: isCurrentPreviewOpen, href: rest.href }}>\n <BaseExpoRouterLink {...rest} children={trigger} ref={rest.ref} />\n {preview}\n {menuElement}\n </InternalLinkPreviewContext>\n </NativeLinkPreview>\n );\n}\n\nfunction getFirstChildOfType<PropsT>(\n children: React.ReactNode | React.ReactNode[],\n type: (props: PropsT) => unknown\n) {\n return React.Children.toArray(children).find(\n (child): child is ReactElement<PropsT> => isValidElement(child) && child.type === type\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAMpE,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IAItB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IAKf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAKD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,sCAK1E;AAID,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MA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E,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAKD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,sCAK1E;AAID,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,OAAO,EACH;QACE,IAAI,EAAE,OAAO,EAAE,CAAC;KACjB,GACD,SAAS,CAAC;IACd,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,iCAAiC,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAKD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,sCAK9D;AAID,MAAM,WAAW,6BAA8B,SAAQ,SAAS;IAC9D,oBAAoB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1D;AAMD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,sCAa5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAgCb,0DAKC;
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAgCb,0DAKC;AA4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ACX,CAAC,CAAC;IACH,OAAO,CAAC,4BAA4B,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;AACnE,CAAC;AACD,aAAa","sourcesContent":["'use client';\n\nimport { requireNativeView } from 'expo';\nimport { Platform, StyleSheet, type ViewProps } from 'react-native';\n\nconst areNativeViewsAvailable =\n process.env.EXPO_OS === 'ios' && !Platform.isTV && global.RN$Bridgeless === true;\n\n// #region Action View\nexport interface NativeLinkPreviewActionProps {\n title: string;\n icon?: string;\n children?: React.ReactNode;\n disabled?: boolean;\n destructive?: boolean;\n // This may lead to race conditions, when two menu actions are on at the same time.\n // The logic should be enforced in the JS code, rather than in the native code.\n // singleSelection?: boolean;\n displayAsPalette?: boolean;\n displayInline?: boolean;\n isOn?: boolean;\n // There are issues with menu state updates when keep presented is set to true.\n // When updating the context menu state, it will either not update or it will recreate the menu. The latter is a problem,\n // because it will close all opened submenus and reset the scroll position.\n // TODO: (@ubax) find a way to fix this.\n keepPresented?: boolean;\n onSelected: () => void;\n}\nconst LinkPreviewNativeActionView: React.ComponentType<NativeLinkPreviewActionProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkPreviewNativeActionView')\n : null;\nexport function NativeLinkPreviewAction(props: NativeLinkPreviewActionProps) {\n if (!LinkPreviewNativeActionView) {\n return null;\n }\n return <LinkPreviewNativeActionView {...props} />;\n}\n// #endregion\n\n// #region Preview View\nexport interface TabPath {\n oldTabKey: string;\n newTabKey: string;\n}\nexport interface NativeLinkPreviewProps extends ViewProps {\n nextScreenId: string | undefined;\n tabPath:\n | {\n path: TabPath[];\n }\n | undefined;\n disableForceFlatten?: boolean;\n onWillPreviewOpen?: () => void;\n onDidPreviewOpen?: () => void;\n onPreviewWillClose?: () => void;\n onPreviewDidClose?: () => void;\n onPreviewTapped?: () => void;\n onPreviewTappedAnimationCompleted?: () => void;\n children: React.ReactNode;\n}\nconst NativeLinkPreviewView: React.ComponentType<NativeLinkPreviewProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewView')\n : null;\nexport function NativeLinkPreview(props: NativeLinkPreviewProps) {\n if (!NativeLinkPreviewView) {\n return null;\n }\n return <NativeLinkPreviewView {...props} />;\n}\n// #endregion\n\n// #region Preview Content View\nexport interface NativeLinkPreviewContentProps extends ViewProps {\n preferredContentSize?: { width: number; height: number };\n}\nconst NativeLinkPreviewContentView: React.ComponentType<NativeLinkPreviewContentProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewContentView')\n : null;\n\nexport function NativeLinkPreviewContent(props: NativeLinkPreviewContentProps) {\n if (!NativeLinkPreviewContentView) {\n return null;\n }\n const style = StyleSheet.flatten([\n props.style,\n {\n position: 'absolute',\n top: 0,\n left: 0,\n } as const,\n ]);\n return <NativeLinkPreviewContentView {...props} style={style} />;\n}\n// #endregion\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/link/preview/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,KAAK,eAAe,EAGrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAS,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEnF,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,oBAAoB,GAC9B,OAAO,EAAE,CA6BX;AAED,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,oBAAoB,GAC9B,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/link/preview/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,KAAK,eAAe,EAGrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAS,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEnF,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,oBAAoB,GAC9B,OAAO,EAAE,CA6BX;AAED,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,oBAAoB,GAC9B,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,SAAS,CAgDpD;AAED,wBAAgB,SAAS,CACvB,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,SAAS,EACrC,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,SAAS,GACpC,OAAO,CAYT"}
|
|
@@ -49,6 +49,15 @@ function getPreloadedRouteFromRootStateByHref(href, rootState) {
|
|
|
49
49
|
const payload = (0, routing_1.getPayloadFromStateRoute)(actionStateRoute);
|
|
50
50
|
const preloadedRoute = stackState.preloadedRoutes.find((route) => route.name === actionStateRoute.name &&
|
|
51
51
|
deepEqual((0, navigationParams_1.removeInternalExpoRouterParams)(route.params), (0, navigationParams_1.removeInternalExpoRouterParams)(payload.params)));
|
|
52
|
+
const activeRoute = stackState.routes[stackState.index];
|
|
53
|
+
// When the active route is the same as the preloaded route,
|
|
54
|
+
// then we should not navigate. It aligns with base link behavior.
|
|
55
|
+
if (activeRoute.name === preloadedRoute?.name &&
|
|
56
|
+
deepEqual(
|
|
57
|
+
// using ?? {}, because from our perspective undefined === {}, as both mean no params
|
|
58
|
+
(0, navigationParams_1.removeInternalExpoRouterParams)(activeRoute.params ?? {}), (0, navigationParams_1.removeInternalExpoRouterParams)(payload.params ?? {}))) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
52
61
|
return preloadedRoute;
|
|
53
62
|
}
|
|
54
63
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/link/preview/utils.ts"],"names":[],"mappings":";;AAeA,sEAgCC;AAED,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/link/preview/utils.ts"],"names":[],"mappings":";;AAeA,sEAgCC;AAED,oFAmDC;AAED,8BAeC;AA7GD,kEAAmF;AACnF,wDAA0F;AAE1F,kCAAsC;AAEtC,6DAAwE;AAExE,SAAgB,6BAA6B,CAC3C,IAAU,EACV,SAA+B;IAE/B,MAAM,SAAS,GAAG,oBAAK,CAAC,eAAe,CAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAqC,SAAS,CAAC;IAC1D,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,sCAAsC;IACtC,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,4BAAkB,EAAC,SAAS,EAAE,KAAwB,EAAE,IAAI,CAAC,CAAC;IAE3F,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,OAAO,GAAc,EAAE,CAAC;IAC9B,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE;QACzC,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;YAChC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAA0C,CAAC;YAClE,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAA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avigationState,\n} from '@react-navigation/native';\n\nimport { store, type ReactNavigationState } from '../../global-state/router-store';\nimport { findDivergentState, getPayloadFromStateRoute } from '../../global-state/routing';\nimport { Href } from '../../types';\nimport { resolveHref } from '../href';\nimport { TabPath } from './native';\nimport { removeInternalExpoRouterParams } from '../../navigationParams';\n\nexport function getTabPathFromRootStateByHref(\n href: Href,\n rootState: ReactNavigationState\n): TabPath[] {\n const hrefState = store.getStateForHref(resolveHref(href));\n const state: ReactNavigationState | undefined = rootState;\n if (!hrefState || !state) {\n return [];\n }\n // Replicating the logic from `linkTo`\n const { navigationRoutes } = findDivergentState(hrefState, state as NavigationState, true);\n\n if (!navigationRoutes.length) {\n return [];\n }\n\n const tabPath: TabPath[] = [];\n navigationRoutes.forEach((route, i, arr) => {\n if (route.state?.type === 'tab') {\n const tabState = route.state as TabNavigationState<ParamListBase>;\n const oldTabKey = tabState.routes[tabState.index].key;\n // The next route will be either stack inside a tab or a new tab key\n if (!arr[i + 1]) {\n throw new Error(\n `New tab route is missing for ${route.key}. This is likely an internal Expo Router bug.`\n );\n }\n const newTabKey = arr[i + 1].key;\n tabPath.push({ oldTabKey, newTabKey });\n }\n });\n return tabPath;\n}\n\nexport function getPreloadedRouteFromRootStateByHref(\n href: Href,\n rootState: ReactNavigationState\n): NavigationRoute<ParamListBase, string> | undefined {\n const hrefState = store.getStateForHref(resolveHref(href));\n const state: ReactNavigationState | undefined = rootState;\n if (!hrefState || !state) {\n return undefined;\n }\n // Replicating the logic from `linkTo`\n const { navigationState, actionStateRoute } = findDivergentState(\n hrefState,\n state as NavigationState,\n true\n );\n\n if (!navigationState || !actionStateRoute) {\n return undefined;\n }\n\n if (navigationState.type === 'stack') {\n const stackState = navigationState as StackNavigationState<ParamListBase>;\n const payload = getPayloadFromStateRoute(actionStateRoute);\n\n const preloadedRoute = stackState.preloadedRoutes.find(\n (route) =>\n route.name === actionStateRoute.name &&\n deepEqual(\n removeInternalExpoRouterParams(route.params),\n removeInternalExpoRouterParams(payload.params)\n )\n );\n\n const activeRoute = stackState.routes[stackState.index];\n // When the active route is the same as the preloaded route,\n // then we should not navigate. It aligns with base link behavior.\n if (\n activeRoute.name === preloadedRoute?.name &&\n deepEqual(\n // using ?? {}, because from our perspective undefined === {}, as both mean no params\n removeInternalExpoRouterParams(activeRoute.params ?? {}),\n removeInternalExpoRouterParams(payload.params ?? {})\n )\n ) {\n return undefined;\n }\n\n return preloadedRoute;\n }\n\n return undefined;\n}\n\nexport function deepEqual(\n a: { [key: string]: any } | undefined,\n b: { [key: string]: any } | undefined\n): boolean {\n if (a === b) {\n return true;\n }\n if (a == null || b == null) {\n return false;\n }\n if (typeof a !== 'object' || typeof b !== 'object') {\n return false;\n }\n const keys = Object.keys(a);\n return keys.length === Object.keys(b).length && keys.every((key) => deepEqual(a[key], b[key]));\n}\n"]}
|
|
@@ -8,23 +8,6 @@ export type RouteInfo<TRegex = string> = {
|
|
|
8
8
|
permanent?: boolean;
|
|
9
9
|
methods?: string[];
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
12
|
-
* Middleware pattern type that can be a string (including globs) or a regular expression.
|
|
13
|
-
*/
|
|
14
|
-
export type MiddlewarePattern = string | RegExp;
|
|
15
|
-
export type MiddlewareMatcher = {
|
|
16
|
-
/**
|
|
17
|
-
* Array of path patterns to match against.
|
|
18
|
-
* Supports string literals, glob patterns, and regex.
|
|
19
|
-
* @example ['/api/*', '/admin/*', { pattern: '^/(auth)/(login|logout)$', regex: true }]
|
|
20
|
-
*/
|
|
21
|
-
patterns: MiddlewarePattern[];
|
|
22
|
-
/**
|
|
23
|
-
* HTTP methods to match (undefined = all methods)
|
|
24
|
-
* @example ['POST', 'PUT', 'DELETE']
|
|
25
|
-
*/
|
|
26
|
-
methods?: string[];
|
|
27
|
-
};
|
|
28
11
|
export type MiddlewareInfo = {
|
|
29
12
|
/**
|
|
30
13
|
* Path to the module that contains the middleware function as a default export.
|
|
@@ -32,22 +15,6 @@ export type MiddlewareInfo = {
|
|
|
32
15
|
* @example _expo/functions/+middleware.js
|
|
33
16
|
*/
|
|
34
17
|
file: string;
|
|
35
|
-
/**
|
|
36
|
-
* Optional matcher configuration for conditional middleware execution.
|
|
37
|
-
* When undefined, middleware runs on all requests.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* // In +middleware.ts
|
|
42
|
-
* export const settings = {
|
|
43
|
-
* matcher: {
|
|
44
|
-
* patterns: ['/api/*', '/(auth)/*'],
|
|
45
|
-
* methods: ['POST', 'PUT', 'DELETE']
|
|
46
|
-
* }
|
|
47
|
-
* };
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
matcher?: MiddlewareMatcher;
|
|
51
18
|
};
|
|
52
19
|
export type ExpoRoutesManifestV1<TRegex = string> = {
|
|
53
20
|
middleware?: MiddlewareInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-manifest.d.ts","sourceRoot":"","sources":["../src/routes-manifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,gBAAgB,CAAC;AAIzD,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,MAAM,MAAM,SAAS,CAAC,MAAM,GAAG,MAAM,IAAI;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"routes-manifest.d.ts","sourceRoot":"","sources":["../src/routes-manifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,gBAAgB,CAAC;AAIzD,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,MAAM,MAAM,SAAS,CAAC,MAAM,GAAG,MAAM,IAAI;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,MAAM,GAAG,MAAM,IAAI;IAClD,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/B,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IAChC,cAAc,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IACpC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/B,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;CAC/B,CAAC;AAYF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,OAAO,GACf,oBAAoB,GAAG,IAAI,CAe7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-manifest.js","sourceRoot":"","sources":["../src/routes-manifest.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"routes-manifest.js","sourceRoot":"","sources":["../src/routes-manifest.ts"],"names":[],"mappings":";;AA6CA,oDAkBC;AA/DD,0CAA0C;AAC1C,sBAAsB;AACtB,iDAAyD;AACzD,2DAAwD;AAgCxD,SAAS,uBAAuB,CAAC,MAAgB,EAAE;IACjD,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,KAAI,CAAC,EAAE,CAAC,CAAC;IAE3D,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE;QAC3C,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG;KACjB,CAAC,CAAC;IAEH,OAAO,aAA+B,CAAC;AACzC,CAAC;AAED,SAAgB,oBAAoB,CAClC,KAAe,EACf,OAAgB;IAEhB,mCAAmC;IACnC,MAAM,SAAS,GAAG,IAAA,wBAAS,EAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE;QAC1D,GAAG,OAAO;QACV,iBAAiB,EAAE,IAAI;QACvB,2BAA2B,EAAE,IAAI;QACjC,mBAAmB,EAAE,IAAI;QACzB,iBAAiB,EAAE,IAAI;QACvB,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAA,qCAAiB,EAAC,SAAS,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// This file runs in Node.js environments.\n// no relative imports\nimport { type Options, getRoutes } from './getRoutesSSR';\nimport { getServerManifest } from './getServerManifest';\nimport { type RequireContext } from './types';\n\nexport { Options };\n\nexport type RouteInfo<TRegex = string> = {\n file: string;\n page: string;\n namedRegex: TRegex;\n routeKeys: Record<string, string>;\n permanent?: boolean;\n methods?: string[];\n};\n\nexport type MiddlewareInfo = {\n /**\n * Path to the module that contains the middleware function as a default export.\n *\n * @example _expo/functions/+middleware.js\n */\n file: string;\n};\n\nexport type ExpoRoutesManifestV1<TRegex = string> = {\n middleware?: MiddlewareInfo;\n apiRoutes: RouteInfo<TRegex>[];\n htmlRoutes: RouteInfo<TRegex>[];\n notFoundRoutes: RouteInfo<TRegex>[];\n redirects: RouteInfo<TRegex>[];\n rewrites: RouteInfo<TRegex>[];\n};\n\nfunction createMockContextModule(map: string[] = []) {\n const contextModule = (_key: string) => ({ default() {} });\n\n Object.defineProperty(contextModule, 'keys', {\n value: () => map,\n });\n\n return contextModule as RequireContext;\n}\n\nexport function createRoutesManifest(\n paths: string[],\n options: Options\n): ExpoRoutesManifestV1 | null {\n // TODO: Drop this part for Node.js\n const routeTree = getRoutes(createMockContextModule(paths), {\n ...options,\n preserveApiRoutes: true,\n preserveRedirectAndRewrites: true,\n ignoreRequireErrors: true,\n ignoreEntryPoints: true,\n platform: 'web',\n });\n\n if (!routeTree) {\n return null;\n }\n return getServerManifest(routeTree);\n}\n"]}
|
package/ios/ExpoHeadModule.swift
CHANGED
|
@@ -61,11 +61,11 @@ public class ExpoHeadModule: Module {
|
|
|
61
61
|
// The module will be accessible from `requireNativeModule('ExpoHead')` in JavaScript.
|
|
62
62
|
Name("ExpoHead")
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
Constant("activities") {
|
|
65
|
+
[
|
|
66
66
|
"INDEXED_ROUTE": indexRouteTag
|
|
67
67
|
]
|
|
68
|
-
|
|
68
|
+
}
|
|
69
69
|
|
|
70
70
|
Function("getLaunchActivity") { () -> [String: Any]? in
|
|
71
71
|
if let activity = launchedActivity {
|
|
@@ -19,6 +19,10 @@ public class LinkPreviewNativeModule: Module {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
Prop("disableForceFlatten") { (_: NativeLinkPreviewView, _: Bool) in
|
|
23
|
+
// This prop is used in ExpoShadowNode in order to disable force flattening, when display: contents is used
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
Events(
|
|
23
27
|
"onPreviewTapped",
|
|
24
28
|
"onPreviewTappedAnimationCompleted",
|
|
@@ -5,6 +5,7 @@ class NativeLinkPreviewView: ExpoView, UIContextMenuInteractionDelegate,
|
|
|
5
5
|
var triggerBorderRadius: Double = 0
|
|
6
6
|
private var preview: NativeLinkPreviewContentView?
|
|
7
7
|
private var interaction: UIContextMenuInteraction?
|
|
8
|
+
private var directChild: UIView?
|
|
8
9
|
var nextScreenId: String? {
|
|
9
10
|
didSet {
|
|
10
11
|
performUpdateOfPreloadedView()
|
|
@@ -54,13 +55,20 @@ class NativeLinkPreviewView: ExpoView, UIContextMenuInteractionDelegate,
|
|
|
54
55
|
override func mountChildComponentView(_ childComponentView: UIView, index: Int) {
|
|
55
56
|
if let previewView = childComponentView as? NativeLinkPreviewContentView {
|
|
56
57
|
preview = previewView
|
|
57
|
-
if let interaction = self.interaction {
|
|
58
|
-
self.addInteraction(interaction)
|
|
59
|
-
}
|
|
60
58
|
} else if let actionView = childComponentView as? LinkPreviewNativeActionView {
|
|
61
59
|
actionView.parentMenuUpdatable = self
|
|
62
60
|
actions.append(actionView)
|
|
63
61
|
} else {
|
|
62
|
+
if directChild != nil {
|
|
63
|
+
print(
|
|
64
|
+
"[expo-router] Found a second child of <Link.Trigger>. Only one is allowed. This is most likely a bug in expo-router."
|
|
65
|
+
)
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
directChild = childComponentView
|
|
69
|
+
if let interaction = self.interaction {
|
|
70
|
+
childComponentView.addInteraction(interaction)
|
|
71
|
+
}
|
|
64
72
|
super.mountChildComponentView(childComponentView, index: index)
|
|
65
73
|
}
|
|
66
74
|
}
|
|
@@ -68,15 +76,28 @@ class NativeLinkPreviewView: ExpoView, UIContextMenuInteractionDelegate,
|
|
|
68
76
|
override func unmountChildComponentView(_ child: UIView, index: Int) {
|
|
69
77
|
if child is NativeLinkPreviewContentView {
|
|
70
78
|
preview = nil
|
|
71
|
-
if let interaction = self.interaction {
|
|
72
|
-
self.removeInteraction(interaction)
|
|
73
|
-
}
|
|
74
79
|
} else if let actionView = child as? LinkPreviewNativeActionView {
|
|
75
80
|
actions.removeAll(where: {
|
|
76
81
|
$0 == actionView
|
|
77
82
|
})
|
|
78
83
|
} else {
|
|
79
|
-
|
|
84
|
+
if let directChild = directChild {
|
|
85
|
+
if directChild != child {
|
|
86
|
+
print(
|
|
87
|
+
"[expo-router] Unmounting unexpected child from <Link.Trigger>. This is most likely a bug in expo-router."
|
|
88
|
+
)
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
if let interaction = self.interaction {
|
|
92
|
+
directChild.removeInteraction(interaction)
|
|
93
|
+
}
|
|
94
|
+
super.unmountChildComponentView(child, index: index)
|
|
95
|
+
} else {
|
|
96
|
+
print(
|
|
97
|
+
"[expo-router] No link child found to unmount. This is most likely a bug in expo-router."
|
|
98
|
+
)
|
|
99
|
+
return
|
|
100
|
+
}
|
|
80
101
|
}
|
|
81
102
|
}
|
|
82
103
|
#endif
|
|
@@ -104,14 +125,17 @@ class NativeLinkPreviewView: ExpoView, UIContextMenuInteractionDelegate,
|
|
|
104
125
|
highlightPreviewForItemWithIdentifier identifier: any NSCopying
|
|
105
126
|
) -> UITargetedPreview? {
|
|
106
127
|
if let superview = self.superview {
|
|
107
|
-
let
|
|
128
|
+
if let directChild = self.directChild {
|
|
129
|
+
let target = UIPreviewTarget(
|
|
130
|
+
container: superview, center: self.convert(directChild.center, to: superview))
|
|
108
131
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
132
|
+
let parameters = UIPreviewParameters()
|
|
133
|
+
parameters.backgroundColor = .clear
|
|
134
|
+
parameters.shadowPath = UIBezierPath(
|
|
135
|
+
roundedRect: directChild.bounds, cornerRadius: self.triggerBorderRadius)
|
|
113
136
|
|
|
114
|
-
|
|
137
|
+
return UITargetedPreview(view: directChild, parameters: parameters, target: target)
|
|
138
|
+
}
|
|
115
139
|
}
|
|
116
140
|
return nil
|
|
117
141
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "6.0.0-preview.
|
|
3
|
+
"version": "6.0.0-preview.14",
|
|
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",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"@react-navigation/drawer": "^7.5.0",
|
|
81
81
|
"@testing-library/react-native": ">= 12.0.0",
|
|
82
82
|
"expo": "*",
|
|
83
|
-
"expo-constants": "^18.0.
|
|
84
|
-
"expo-linking": "^8.0.
|
|
83
|
+
"expo-constants": "^18.0.7",
|
|
84
|
+
"expo-linking": "^8.0.7",
|
|
85
85
|
"react": "*",
|
|
86
86
|
"react-dom": "*",
|
|
87
87
|
"react-native": "*",
|
|
@@ -128,8 +128,8 @@
|
|
|
128
128
|
},
|
|
129
129
|
"dependencies": {
|
|
130
130
|
"@expo/metro-runtime": "6.1.1",
|
|
131
|
-
"@expo/schema-utils": "^0.1.
|
|
132
|
-
"@expo/server": "^0.7.
|
|
131
|
+
"@expo/schema-utils": "^0.1.6",
|
|
132
|
+
"@expo/server": "^0.7.3",
|
|
133
133
|
"@radix-ui/react-slot": "1.2.0",
|
|
134
134
|
"@radix-ui/react-tabs": "^1.1.12",
|
|
135
135
|
"@react-navigation/bottom-tabs": "^7.4.0",
|
|
@@ -151,5 +151,5 @@
|
|
|
151
151
|
"use-latest-callback": "^0.2.1",
|
|
152
152
|
"vaul": "^1.1.2"
|
|
153
153
|
},
|
|
154
|
-
"gitHead": "
|
|
154
|
+
"gitHead": "f97e6d1cae0cb14d5eed1b08fad6d12a7144af3a"
|
|
155
155
|
}
|