expo-router 5.1.3 → 5.2.0-canary-20250612-338ef55

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.
Files changed (57) hide show
  1. package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
  2. package/build/fork/getStateFromPath-forks.js +1 -4
  3. package/build/fork/getStateFromPath-forks.js.map +1 -1
  4. package/build/fork/useLinking.d.ts.map +1 -1
  5. package/build/fork/useLinking.js +3 -7
  6. package/build/fork/useLinking.js.map +1 -1
  7. package/build/getRoutes.d.ts +1 -1
  8. package/build/getRoutes.d.ts.map +1 -1
  9. package/build/getRoutes.js +6 -14
  10. package/build/getRoutes.js.map +1 -1
  11. package/build/getRoutesCore.d.ts +2 -7
  12. package/build/getRoutesCore.d.ts.map +1 -1
  13. package/build/getRoutesCore.js +58 -86
  14. package/build/getRoutesCore.js.map +1 -1
  15. package/build/getRoutesRedirects.d.ts +2 -2
  16. package/build/getRoutesRedirects.d.ts.map +1 -1
  17. package/build/getRoutesRedirects.js +24 -18
  18. package/build/getRoutesRedirects.js.map +1 -1
  19. package/build/getRoutesSSR.d.ts +1 -1
  20. package/build/getRoutesSSR.d.ts.map +1 -1
  21. package/build/getRoutesSSR.js +3 -2
  22. package/build/getRoutesSSR.js.map +1 -1
  23. package/build/global-state/router-store.d.ts.map +1 -1
  24. package/build/global-state/router-store.js +0 -1
  25. package/build/global-state/router-store.js.map +1 -1
  26. package/build/link/Link.d.ts +56 -1
  27. package/build/link/Link.d.ts.map +1 -1
  28. package/build/link/Link.js +39 -3
  29. package/build/link/Link.js.map +1 -1
  30. package/build/typed-routes/generate.js +1 -1
  31. package/build/typed-routes/generate.js.map +1 -1
  32. package/build/useFocusEffect.d.ts.map +1 -1
  33. package/build/useFocusEffect.js +3 -5
  34. package/build/useFocusEffect.js.map +1 -1
  35. package/build/useScreens.js +1 -1
  36. package/build/useScreens.js.map +1 -1
  37. package/build/views/Screen.d.ts.map +1 -1
  38. package/build/views/Screen.js +40 -13
  39. package/build/views/Screen.js.map +1 -1
  40. package/build/views/Unmatched.d.ts.map +1 -1
  41. package/build/views/Unmatched.js +3 -9
  42. package/build/views/Unmatched.js.map +1 -1
  43. package/package.json +8 -9
  44. package/plugin/options.json +1 -29
  45. package/build/link/Redirect.d.ts +0 -59
  46. package/build/link/Redirect.d.ts.map +0 -1
  47. package/build/link/Redirect.js +0 -43
  48. package/build/link/Redirect.js.map +0 -1
  49. package/build/utils/stack.d.ts +0 -5
  50. package/build/utils/stack.d.ts.map +0 -1
  51. package/build/utils/stack.js +0 -10
  52. package/build/utils/stack.js.map +0 -1
  53. package/build/views/useSafeLayoutEffect.d.ts +0 -3
  54. package/build/views/useSafeLayoutEffect.d.ts.map +0 -1
  55. package/build/views/useSafeLayoutEffect.js +0 -6
  56. package/build/views/useSafeLayoutEffect.js.map +0 -1
  57. package/plugin/tsconfig.tsbuildinfo +0 -1
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRoutes = getRoutes;
4
+ exports.getIgnoreList = getIgnoreList;
4
5
  exports.extrapolateGroups = extrapolateGroups;
5
6
  exports.generateDynamic = generateDynamic;
6
7
  const matchers_1 = require("./matchers");
@@ -52,40 +53,32 @@ function getDirectoryTree(contextModule, options) {
52
53
  const redirects = {};
53
54
  const rewrites = {};
54
55
  let validRedirectDestinations;
55
- const getValidDestinations = () => {
56
- // Loop over contexts once and cache the valid destinations
57
- validRedirectDestinations ??= contextKeys.map((key) => {
58
- return {
59
- contextKey: key,
60
- nameWithoutInvisible: getNameWithoutInvisibleSegmentsFromRedirectPath((0, matchers_1.removeSupportedExtensions)(key)),
61
- };
62
- });
63
- return validRedirectDestinations;
64
- };
65
56
  // If we are keeping redirects as valid routes, then we need to add them to the contextKeys
66
57
  // This is useful for generating a sitemap with redirects, or static site generation that includes redirects
67
58
  if (options.preserveRedirectAndRewrites) {
68
59
  if (options.redirects) {
69
60
  for (const redirect of options.redirects) {
70
- const sourceContextKey = getSourceContextKeyFromRedirectSource(redirect.source);
71
- const sourceName = getNameFromRedirectPath(redirect.source);
61
+ // Remove the leading `./` or `/`
62
+ const source = redirect.source.replace(/^\.?\//, '');
72
63
  const isExternalRedirect = (0, url_1.shouldLinkExternally)(redirect.destination);
73
- const targetDestinationName = isExternalRedirect
64
+ const targetDestination = isExternalRedirect
74
65
  ? redirect.destination
75
- : getNameWithoutInvisibleSegmentsFromRedirectPath(redirect.destination);
76
- if (ignoreList.some((regex) => regex.test(sourceContextKey))) {
66
+ : (0, matchers_1.stripInvisibleSegmentsFromPath)((0, matchers_1.removeFileSystemDots)((0, matchers_1.removeFileSystemExtensions)(redirect.destination.replace(/^\.?\/?/, ''))));
67
+ const normalizedSource = (0, matchers_1.removeFileSystemDots)((0, matchers_1.removeSupportedExtensions)(source));
68
+ if (ignoreList.some((regex) => regex.test(normalizedSource))) {
77
69
  continue;
78
70
  }
79
- const validDestination = isExternalRedirect
80
- ? undefined
81
- : getValidDestinations().find((key) => key.nameWithoutInvisible === targetDestinationName);
71
+ // Loop over this once and cache the valid destinations
72
+ validRedirectDestinations ??= contextKeys.map((key) => {
73
+ return [
74
+ (0, matchers_1.stripInvisibleSegmentsFromPath)((0, matchers_1.removeFileSystemDots)((0, matchers_1.removeSupportedExtensions)(key))),
75
+ key,
76
+ ];
77
+ });
82
78
  const destination = isExternalRedirect
83
- ? targetDestinationName
84
- : validDestination?.nameWithoutInvisible;
85
- const destinationContextKey = isExternalRedirect
86
- ? targetDestinationName
87
- : validDestination?.contextKey;
88
- if (!destinationContextKey || destination === undefined) {
79
+ ? targetDestination
80
+ : validRedirectDestinations.find((key) => key[0] === targetDestination)?.[1];
81
+ if (!destination) {
89
82
  /*
90
83
  * Only throw the error when we are preserving the api routes
91
84
  * When doing a static export, API routes will not exist so the redirect destination may not exist.
@@ -97,11 +90,11 @@ function getDirectoryTree(contextModule, options) {
97
90
  }
98
91
  continue;
99
92
  }
100
- contextKeys.push(sourceContextKey);
101
- redirects[sourceName] = {
102
- source: sourceName,
93
+ const fakeContextKey = (0, matchers_1.removeFileSystemDots)((0, matchers_1.removeSupportedExtensions)(source));
94
+ contextKeys.push(fakeContextKey);
95
+ redirects[fakeContextKey] = {
96
+ source,
103
97
  destination,
104
- destinationContextKey,
105
98
  permanent: Boolean(redirect.permanent),
106
99
  external: isExternalRedirect,
107
100
  methods: redirect.methods,
@@ -110,16 +103,22 @@ function getDirectoryTree(contextModule, options) {
110
103
  }
111
104
  if (options.rewrites) {
112
105
  for (const rewrite of options.rewrites) {
113
- const sourceContextKey = getSourceContextKeyFromRedirectSource(rewrite.source);
114
- const sourceName = getNameFromRedirectPath(rewrite.source);
115
- const targetDestinationName = getNameFromRedirectPath(rewrite.destination);
116
- if (ignoreList.some((regex) => regex.test(sourceContextKey))) {
106
+ // Remove the leading `./` or `/`
107
+ const source = rewrite.source.replace(/^\.?\//, '');
108
+ const targetDestination = (0, matchers_1.stripInvisibleSegmentsFromPath)((0, matchers_1.removeFileSystemDots)((0, matchers_1.removeSupportedExtensions)(rewrite.destination)));
109
+ const normalizedSource = (0, matchers_1.removeFileSystemDots)((0, matchers_1.removeSupportedExtensions)(source));
110
+ if (ignoreList.some((regex) => regex.test(normalizedSource))) {
117
111
  continue;
118
112
  }
119
- const validDestination = getValidDestinations().find((key) => key.nameWithoutInvisible === targetDestinationName);
120
- const destination = validDestination?.nameWithoutInvisible;
121
- const destinationContextKey = validDestination?.contextKey;
122
- if (!destinationContextKey || destination === undefined) {
113
+ // Loop over this once and cache the valid destinations
114
+ validRedirectDestinations ??= contextKeys.map((key) => {
115
+ return [
116
+ (0, matchers_1.stripInvisibleSegmentsFromPath)((0, matchers_1.removeFileSystemDots)((0, matchers_1.removeSupportedExtensions)(key))),
117
+ key,
118
+ ];
119
+ });
120
+ const destination = validRedirectDestinations.find((key) => key[0] === targetDestination)?.[1];
121
+ if (!destination) {
123
122
  /*
124
123
  * Only throw the error when we are preserving the api routes
125
124
  * When doing a static export, API routes will not exist so the redirect destination may not exist.
@@ -127,21 +126,17 @@ function getDirectoryTree(contextModule, options) {
127
126
  * `expo export` swallows this error.
128
127
  */
129
128
  if (options.preserveApiRoutes) {
130
- throw new Error(`Rewrite destination "${rewrite.destination}" does not exist.`);
129
+ throw new Error(`Redirect destination "${rewrite.destination}" does not exist.`);
131
130
  }
132
131
  continue;
133
132
  }
134
- contextKeys.push(sourceContextKey);
135
- rewrites[sourceName] = {
136
- source: sourceName,
137
- destination,
138
- destinationContextKey,
139
- methods: rewrite.methods,
140
- };
133
+ // Add a fake context key
134
+ const fakeContextKey = `./${source}.tsx`;
135
+ contextKeys.push(fakeContextKey);
136
+ rewrites[fakeContextKey] = { source, destination, methods: rewrite.methods };
141
137
  }
142
138
  }
143
139
  }
144
- const processedRedirectsRewrites = new Set();
145
140
  for (const filePath of contextKeys) {
146
141
  if (ignoreList.some((regex) => regex.test(filePath))) {
147
142
  continue;
@@ -192,47 +187,33 @@ function getDirectoryTree(contextModule, options) {
192
187
  children: [], // While we are building the directory tree, we don't know the node's children just yet. This is added during hoisting
193
188
  };
194
189
  if (meta.isRedirect) {
195
- if (processedRedirectsRewrites.has(meta.route)) {
196
- continue;
197
- }
198
- const redirect = redirects[meta.route];
199
- node.destinationContextKey = redirect.destinationContextKey;
200
- node.permanent = redirect.permanent;
190
+ node.destinationContextKey = redirects[filePath].destination;
191
+ node.permanent = redirects[filePath].permanent;
201
192
  node.generated = true;
202
193
  if (node.type === 'route') {
203
194
  node = options.getSystemRoute({
204
195
  type: 'redirect',
205
- route: redirect.destination,
206
- defaults: node,
207
- redirectConfig: redirect,
208
- });
196
+ route: (0, matchers_1.removeFileSystemDots)((0, matchers_1.removeSupportedExtensions)(node.destinationContextKey)),
197
+ }, node);
209
198
  }
210
- if (redirect.methods) {
211
- node.methods = redirect.methods;
199
+ if (redirects[filePath].methods) {
200
+ node.methods = redirects[filePath].methods;
212
201
  }
213
202
  node.type = 'redirect';
214
- processedRedirectsRewrites.add(meta.route);
215
203
  }
216
204
  if (meta.isRewrite) {
217
- if (processedRedirectsRewrites.has(meta.route)) {
218
- continue;
219
- }
220
- const rewrite = rewrites[meta.route];
221
- node.destinationContextKey = rewrite.destinationContextKey;
205
+ node.destinationContextKey = rewrites[filePath].destination;
222
206
  node.generated = true;
223
207
  if (node.type === 'route') {
224
208
  node = options.getSystemRoute({
225
209
  type: 'rewrite',
226
- route: rewrite.destination,
227
- defaults: node,
228
- rewriteConfig: rewrite,
229
- });
210
+ route: (0, matchers_1.removeFileSystemDots)((0, matchers_1.removeSupportedExtensions)(node.destinationContextKey)),
211
+ }, node);
230
212
  }
231
- if (rewrite.methods) {
232
- node.methods = rewrite.methods;
213
+ if (redirects[filePath].methods) {
214
+ node.methods = redirects[filePath].methods;
233
215
  }
234
216
  node.type = 'rewrite';
235
- processedRedirectsRewrites.add(meta.route);
236
217
  }
237
218
  if (process.env.NODE_ENV === 'development') {
238
219
  // If the user has set the `EXPO_ROUTER_IMPORT_MODE` to `sync` then we should
@@ -360,22 +341,6 @@ function getDirectoryTree(contextModule, options) {
360
341
  }
361
342
  return rootDirectory;
362
343
  }
363
- function getNameFromRedirectPath(path) {
364
- // Removing only the filesystem extensions, to be able to handle +api, +html
365
- return ((0, matchers_1.removeFileSystemExtensions)((0, matchers_1.removeFileSystemDots)(path))
366
- // Remove the leading `/`
367
- .replace(/^\//, ''));
368
- }
369
- function getNameWithoutInvisibleSegmentsFromRedirectPath(path) {
370
- return (0, matchers_1.stripInvisibleSegmentsFromPath)(getNameFromRedirectPath(path));
371
- }
372
- // Creates fake context key for redirects and rewrites
373
- function getSourceContextKeyFromRedirectSource(source) {
374
- const name = getNameFromRedirectPath(source);
375
- const prefix = './';
376
- const suffix = /\.[tj]sx?$/.test(name) ? '' : '.js'; // Ensure it has a file extension
377
- return `${prefix}${name}${suffix}`;
378
- }
379
344
  /**
380
345
  * Flatten the directory tree into routes, hoisting routes to the nearest _layout.
381
346
  */
@@ -480,6 +445,13 @@ function getFileMeta(originalKey, options, redirects, rewrites) {
480
445
  isRewrite: key in rewrites,
481
446
  };
482
447
  }
448
+ function getIgnoreList(options) {
449
+ const ignore = [/^\.\/\+html\.[tj]sx?$/, ...(options?.ignore ?? [])];
450
+ if (options?.preserveApiRoutes !== true) {
451
+ ignore.push(/\+api\.[tj]sx?$/);
452
+ }
453
+ return ignore;
454
+ }
483
455
  /**
484
456
  * Generates a set of strings which have the router array syntax extrapolated.
485
457
  *
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutesCore.js","sourceRoot":"","sources":["../src/getRoutesCore.ts"],"names":[],"mappings":";;AAgFA,8BAeC;AAmjBD,8CAwBC;AAED,0CAgBC;AA3rBD,yCASoB;AAEpB,qCAAmD;AAsDnD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,aAA6B,EAAE,OAAgB;IACvE,MAAM,aAAa,GAAG,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAE/D,yBAAyB;IACzB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,4BAA4B,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAEtE,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;QAC/B,wCAAwC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,aAA6B,EAAE,OAAgB;IACvE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;IAE7E,MAAM,UAAU,GAAa,CAAC,uCAAuC,CAAC,CAAC,CAAC,oCAAoC;IAE5G,IAAI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,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC;QAED,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,wCAAwC,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,MAAmB;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,YAAY,KAAK,CAAC,UAAU,sEAAsE,CACnG,CAAC;IACJ,CAAC;IAED,wFAAwF;IACxF,4CAA4C;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import type { DynamicConvention, RouteNode } from './Route';\nimport {\n matchArrayGroupName,\n matchDynamicName,\n matchGroupName,\n matchLastGroupName,\n removeFileSystemDots,\n removeFileSystemExtensions,\n removeSupportedExtensions,\n stripInvisibleSegmentsFromPath,\n} from './matchers';\nimport type { RequireContext } from './types';\nimport { shouldLinkExternally } from './utils/url';\n\nexport type Options = {\n ignore?: RegExp[];\n preserveApiRoutes?: boolean;\n ignoreRequireErrors?: boolean;\n ignoreEntryPoints?: boolean;\n /* Used to simplify testing for toEqual() comparison */\n internal_stripLoadRoute?: boolean;\n /* Used to simplify by skipping the generated routes */\n skipGenerated?: boolean;\n /* Skip the generated not found route */\n notFound?: boolean;\n importMode?: string;\n platformRoutes?: boolean;\n sitemap?: boolean;\n platform?: string;\n redirects?: RedirectConfig[];\n rewrites?: RewriteConfig[];\n /* Keep redirects as valid routes within the RouteConfig tree */\n preserveRedirectAndRewrites?: boolean;\n\n /** Get the system route for a location. Useful for shimming React Native imports in SSR environments. */\n getSystemRoute: (\n route: Pick<RouteNode, 'route' | 'type'> & {\n defaults?: RouteNode;\n redirectConfig?: RedirectConfig;\n rewriteConfig?: RewriteConfig;\n }\n ) => RouteNode;\n};\n\ntype DirectoryNode = {\n layout?: RouteNode[];\n files: Map<string, RouteNode[]>;\n subdirectories: Map<string, DirectoryNode>;\n};\n\nexport type RedirectConfig = {\n source: string;\n destination: string;\n destinationContextKey: string;\n permanent?: boolean;\n methods?: string[];\n external?: boolean;\n};\n\nexport type RewriteConfig = {\n source: string;\n destination: string;\n destinationContextKey: string;\n methods?: string[];\n};\n\nconst validPlatforms = new Set(['android', 'ios', 'native', 'web']);\n\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options): RouteNode | null {\n const directoryTree = getDirectoryTree(contextModule, options);\n\n // If there are no routes\n if (!directoryTree) {\n return null;\n }\n\n const rootNode = flattenDirectoryTreeToRoutes(directoryTree, options);\n\n if (!options.ignoreEntryPoints) {\n crawlAndAppendInitialRoutesAndEntryFiles(rootNode, options);\n }\n\n return rootNode;\n}\n\n/**\n * Converts the RequireContext keys (file paths) into a directory tree.\n */\nfunction getDirectoryTree(contextModule: RequireContext, options: Options) {\n const importMode = options.importMode || process.env.EXPO_ROUTER_IMPORT_MODE;\n\n const ignoreList: RegExp[] = [/^\\.\\/\\+(html|native-intent)\\.[tj]sx?$/]; // Ignore the top level ./+html file\n\n if (options.ignore) {\n ignoreList.push(...options.ignore);\n }\n if (!options.preserveApiRoutes) {\n ignoreList.push(/\\+api$/, /\\+api\\.[tj]sx?$/);\n }\n\n const rootDirectory: DirectoryNode = {\n files: new Map(),\n subdirectories: new Map(),\n };\n\n let hasRoutes = false;\n let isValid = false;\n\n const contextKeys = contextModule.keys();\n const redirects: Record<string, RedirectConfig> = {};\n const rewrites: Record<string, RewriteConfig> = {};\n\n let validRedirectDestinations: { contextKey: string; nameWithoutInvisible: string }[] | undefined;\n\n const getValidDestinations = () => {\n // Loop over contexts once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return {\n contextKey: key,\n nameWithoutInvisible: getNameWithoutInvisibleSegmentsFromRedirectPath(\n removeSupportedExtensions(key)\n ),\n };\n });\n return validRedirectDestinations;\n };\n\n // If we are keeping redirects as valid routes, then we need to add them to the contextKeys\n // This is useful for generating a sitemap with redirects, or static site generation that includes redirects\n if (options.preserveRedirectAndRewrites) {\n if (options.redirects) {\n for (const redirect of options.redirects) {\n const sourceContextKey = getSourceContextKeyFromRedirectSource(redirect.source);\n const sourceName = getNameFromRedirectPath(redirect.source);\n\n const isExternalRedirect = shouldLinkExternally(redirect.destination);\n\n const targetDestinationName = isExternalRedirect\n ? redirect.destination\n : getNameWithoutInvisibleSegmentsFromRedirectPath(redirect.destination);\n\n if (ignoreList.some((regex) => regex.test(sourceContextKey))) {\n continue;\n }\n\n const validDestination = isExternalRedirect\n ? undefined\n : getValidDestinations().find(\n (key) => key.nameWithoutInvisible === targetDestinationName\n );\n const destination = isExternalRedirect\n ? targetDestinationName\n : validDestination?.nameWithoutInvisible;\n const destinationContextKey = isExternalRedirect\n ? targetDestinationName\n : validDestination?.contextKey;\n\n if (!destinationContextKey || destination === undefined) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${redirect.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n contextKeys.push(sourceContextKey);\n redirects[sourceName] = {\n source: sourceName,\n destination,\n destinationContextKey,\n permanent: Boolean(redirect.permanent),\n external: isExternalRedirect,\n methods: redirect.methods,\n };\n }\n }\n\n if (options.rewrites) {\n for (const rewrite of options.rewrites) {\n const sourceContextKey = getSourceContextKeyFromRedirectSource(rewrite.source);\n const sourceName = getNameFromRedirectPath(rewrite.source);\n\n const targetDestinationName = getNameFromRedirectPath(rewrite.destination);\n\n if (ignoreList.some((regex) => regex.test(sourceContextKey))) {\n continue;\n }\n\n const validDestination = getValidDestinations().find(\n (key) => key.nameWithoutInvisible === targetDestinationName\n );\n const destination = validDestination?.nameWithoutInvisible;\n const destinationContextKey = validDestination?.contextKey;\n\n if (!destinationContextKey || destination === undefined) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Rewrite destination \"${rewrite.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n contextKeys.push(sourceContextKey);\n rewrites[sourceName] = {\n source: sourceName,\n destination,\n destinationContextKey,\n methods: rewrite.methods,\n };\n }\n }\n }\n\n const processedRedirectsRewrites = new Set<string>();\n\n for (const filePath of contextKeys) {\n if (ignoreList.some((regex) => regex.test(filePath))) {\n continue;\n }\n\n isValid = true;\n\n const meta = getFileMeta(filePath, options, redirects, rewrites);\n\n // This is a file that should be ignored. e.g maybe it has an invalid platform?\n if (meta.specificity < 0) {\n continue;\n }\n\n let node: RouteNode = {\n type: meta.isApi ? 'api' : meta.isLayout ? 'layout' : 'route',\n loadRoute() {\n let routeModule: any;\n\n if (options.ignoreRequireErrors) {\n try {\n routeModule = contextModule(filePath);\n } catch {\n routeModule = {};\n }\n } else {\n routeModule = contextModule(filePath);\n }\n\n if (process.env.NODE_ENV === 'development' && importMode === 'sync') {\n // In development mode, when async routes are disabled, add some extra error handling to improve the developer experience.\n // This can be useful when you accidentally use an async function in a route file for the default export.\n if (routeModule instanceof Promise) {\n throw new Error(\n `Route \"${filePath}\" cannot be a promise when async routes is disabled.`\n );\n }\n\n const defaultExport = routeModule?.default;\n if (defaultExport instanceof Promise) {\n throw new Error(\n `The default export from route \"${filePath}\" is a promise. Ensure the React Component does not use async or promises.`\n );\n }\n\n // check if default is an async function without invoking it\n if (\n defaultExport instanceof Function &&\n // This only works on web because Hermes support async functions so we have to transform them out.\n defaultExport.constructor.name === 'AsyncFunction'\n ) {\n throw new Error(\n `The default export from route \"${filePath}\" is an async function. Ensure the React Component does not use async or promises.`\n );\n }\n }\n\n return routeModule;\n },\n contextKey: filePath,\n route: '', // This is overwritten during hoisting based upon the _layout\n dynamic: null,\n children: [], // While we are building the directory tree, we don't know the node's children just yet. This is added during hoisting\n };\n\n if (meta.isRedirect) {\n if (processedRedirectsRewrites.has(meta.route)) {\n continue;\n }\n\n const redirect = redirects[meta.route];\n node.destinationContextKey = redirect.destinationContextKey;\n node.permanent = redirect.permanent;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute({\n type: 'redirect',\n route: redirect.destination,\n defaults: node,\n redirectConfig: redirect,\n });\n }\n if (redirect.methods) {\n node.methods = redirect.methods;\n }\n node.type = 'redirect';\n processedRedirectsRewrites.add(meta.route);\n }\n\n if (meta.isRewrite) {\n if (processedRedirectsRewrites.has(meta.route)) {\n continue;\n }\n\n const rewrite = rewrites[meta.route];\n node.destinationContextKey = rewrite.destinationContextKey;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute({\n type: 'rewrite',\n route: rewrite.destination,\n defaults: node,\n rewriteConfig: rewrite,\n });\n }\n if (rewrite.methods) {\n node.methods = rewrite.methods;\n }\n node.type = 'rewrite';\n processedRedirectsRewrites.add(meta.route);\n }\n\n if (process.env.NODE_ENV === 'development') {\n // If the user has set the `EXPO_ROUTER_IMPORT_MODE` to `sync` then we should\n // filter the missing routes.\n if (node.type !== 'api' && importMode === 'sync') {\n const routeItem = node.loadRoute();\n // Have a warning for nullish ex\n const route = routeItem?.default;\n if (route == null) {\n // Do not throw an error since a user may just be creating a new route.\n console.warn(\n `Route \"${filePath}\" is missing the required default export. Ensure a React component is exported as default.`\n );\n continue;\n }\n if (['boolean', 'number', 'string'].includes(typeof route)) {\n throw new Error(\n `The default export from route \"${filePath}\" is an unsupported type: \"${typeof route}\". Only React Components are supported as default exports from route files.`\n );\n }\n }\n }\n\n /**\n * A single filepath may be extrapolated into multiple routes if it contains array syntax.\n * Another way to thinking about is that a filepath node is present in multiple leaves of the directory tree.\n */\n for (const route of extrapolateGroups(meta.route)) {\n // Traverse the directory tree to its leaf node, creating any missing directories along the way\n const subdirectoryParts = route.split('/').slice(0, -1);\n\n // Start at the root directory and traverse the path to the leaf directory\n let directory = rootDirectory;\n\n for (const part of subdirectoryParts) {\n let subDirectory = directory.subdirectories.get(part);\n\n // Create any missing subdirectories\n if (!subDirectory) {\n subDirectory = {\n files: new Map(),\n subdirectories: new Map(),\n };\n directory.subdirectories.set(part, subDirectory);\n }\n\n directory = subDirectory;\n }\n\n // Clone the node for this route\n node = { ...node, route };\n\n if (meta.isLayout) {\n directory.layout ??= [];\n const existing = directory.layout[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The layouts \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n node = getLayoutNode(node, options);\n directory.layout[meta.specificity] = node;\n }\n } else if (meta.isApi) {\n const fileKey = `${route}+api`;\n let nodes = directory.files.get(fileKey);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(fileKey, nodes);\n }\n\n // API Routes have no specificity, they are always the first node\n const existing = nodes[0];\n\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The API route file \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n nodes[0] = node;\n }\n } else {\n let nodes = directory.files.get(route);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(route, nodes);\n }\n\n /**\n * If there is an existing node with the same specificity, then we have a conflict.\n * NOTE(Platform Routes):\n * We cannot check for specificity conflicts here, as we haven't processed all the context keys yet!\n * This will be checked during hoisting, as well as enforcing that all routes have a non-platform route.\n */\n const existing = nodes[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The route files \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n hasRoutes ||= true;\n nodes[meta.specificity] = node;\n }\n }\n }\n }\n\n // If there are no routes/layouts then we should display the tutorial.\n if (!isValid) {\n return null;\n }\n\n /**\n * If there are no top-level _layout, add a default _layout\n * While this is a generated route, it will still be generated even if skipGenerated is true.\n */\n if (!rootDirectory.layout) {\n rootDirectory.layout = [\n options.getSystemRoute({\n type: 'layout',\n route: '',\n }),\n ];\n }\n\n // Only include the sitemap if there are routes.\n if (!options.skipGenerated) {\n if (hasRoutes && options.sitemap !== false) {\n appendSitemapRoute(rootDirectory, options);\n }\n if (options.notFound !== false) {\n appendNotFoundRoute(rootDirectory, options);\n }\n }\n return rootDirectory;\n}\n\nfunction getNameFromRedirectPath(path: string): string {\n // Removing only the filesystem extensions, to be able to handle +api, +html\n return (\n removeFileSystemExtensions(removeFileSystemDots(path))\n // Remove the leading `/`\n .replace(/^\\//, '')\n );\n}\n\nfunction getNameWithoutInvisibleSegmentsFromRedirectPath(path: string): string {\n return stripInvisibleSegmentsFromPath(getNameFromRedirectPath(path));\n}\n\n// Creates fake context key for redirects and rewrites\nfunction getSourceContextKeyFromRedirectSource(source: string): string {\n const name = getNameFromRedirectPath(source);\n const prefix = './';\n const suffix = /\\.[tj]sx?$/.test(name) ? '' : '.js'; // Ensure it has a file extension\n return `${prefix}${name}${suffix}`;\n}\n\n/**\n * Flatten the directory tree into routes, hoisting routes to the nearest _layout.\n */\nfunction flattenDirectoryTreeToRoutes(\n directory: DirectoryNode,\n options: Options,\n /* The nearest _layout file in the directory tree */\n layout?: RouteNode,\n /* Route names are relative to their layout */\n pathToRemove = ''\n) {\n /**\n * This directory has a _layout file so it becomes the new target for hoisting routes.\n */\n if (directory.layout) {\n const previousLayout = layout;\n layout = getMostSpecific(directory.layout);\n\n // Add the new layout as a child of its parent\n if (previousLayout) {\n previousLayout.children.push(layout);\n }\n\n if (options.internal_stripLoadRoute) {\n delete (layout as any).loadRoute;\n }\n\n // `route` is the absolute pathname. We need to make this relative to the last _layout\n const newRoute = layout.route.replace(pathToRemove, '');\n pathToRemove = layout.route ? `${layout.route}/` : '';\n\n // Now update this layout with the new relative route and dynamic conventions\n layout.route = newRoute;\n layout.dynamic = generateDynamic(layout.contextKey.slice(0));\n }\n\n // This should never occur as there will always be a root layout, but it makes the type system happy\n if (!layout) throw new Error('Expo Router Internal Error: No nearest layout');\n\n for (const routes of directory.files.values()) {\n const routeNode = getMostSpecific(routes);\n\n // `route` is the absolute pathname. We need to make this relative to the nearest layout\n routeNode.route = routeNode.route.replace(pathToRemove, '');\n routeNode.dynamic = generateDynamic(routeNode.route);\n\n if (options.internal_stripLoadRoute) {\n delete (routeNode as any).loadRoute;\n }\n\n layout.children.push(routeNode);\n }\n\n // Recursively flatten the subdirectories\n for (const child of directory.subdirectories.values()) {\n flattenDirectoryTreeToRoutes(child, options, layout, pathToRemove);\n }\n\n return layout;\n}\n\nfunction getFileMeta(\n originalKey: string,\n options: Options,\n redirects: Record<string, RedirectConfig>,\n rewrites: Record<string, RewriteConfig>\n) {\n // Remove the leading `./`\n const key = removeSupportedExtensions(removeFileSystemDots(originalKey));\n let route = key;\n\n const parts = removeFileSystemDots(originalKey).split('/');\n const filename = parts[parts.length - 1];\n const [filenameWithoutExtensions, platformExtension] =\n removeSupportedExtensions(filename).split('.');\n\n const isLayout = filenameWithoutExtensions === '_layout';\n const isApi = originalKey.match(/\\+api\\.(\\w+\\.)?[jt]sx?$/);\n\n if (filenameWithoutExtensions.startsWith('(') && filenameWithoutExtensions.endsWith(')')) {\n throw new Error(`Invalid route ${originalKey}. Routes cannot end with '(group)' syntax`);\n }\n\n // Nested routes cannot start with the '+' character, except for the '+not-found' route\n if (!isApi && filename.startsWith('+') && filenameWithoutExtensions !== '+not-found') {\n const renamedRoute = [...parts.slice(0, -1), filename.slice(1)].join('/');\n throw new Error(\n `Invalid route ${originalKey}. Route nodes cannot start with the '+' character. \"Rename it to ${renamedRoute}\"`\n );\n }\n let specificity = 0;\n\n const hasPlatformExtension = validPlatforms.has(platformExtension);\n const usePlatformRoutes = options.platformRoutes ?? true;\n\n if (hasPlatformExtension) {\n if (!usePlatformRoutes) {\n // If the user has disabled platform routes, then we should ignore this file\n specificity = -1;\n } else if (!options.platform) {\n // If we don't have a platform, then we should ignore this file\n // This used by typed routes, sitemap, etc\n specificity = -1;\n } else if (platformExtension === options.platform) {\n // If the platform extension is the same as the options.platform, then it is the most specific\n specificity = 2;\n } else if (platformExtension === 'native' && options.platform !== 'web') {\n // `native` is allow but isn't as specific as the platform\n specificity = 1;\n } else if (platformExtension !== options.platform) {\n // Somehow we have a platform extension that doesn't match the options.platform and it isn't native\n // This is an invalid file and we will ignore it\n specificity = -1;\n }\n\n if (isApi && specificity !== 0) {\n throw new Error(\n `API routes cannot have platform extensions. Remove '.${platformExtension}' from '${originalKey}'`\n );\n }\n\n route = route.replace(new RegExp(`.${platformExtension}$`), '');\n }\n\n return {\n route,\n specificity,\n isLayout,\n isApi,\n isRedirect: key in redirects,\n isRewrite: key in rewrites,\n };\n}\n\n/**\n * Generates a set of strings which have the router array syntax extrapolated.\n *\n * /(a,b)/(c,d)/e.tsx => new Set(['a/c/e.tsx', 'a/d/e.tsx', 'b/c/e.tsx', 'b/d/e.tsx'])\n */\nexport function extrapolateGroups(key: string, keys: Set<string> = new Set()): Set<string> {\n const match = matchArrayGroupName(key);\n\n if (!match) {\n keys.add(key);\n return keys;\n }\n const groups = match.split(',');\n const groupsSet = new Set(groups);\n\n if (groupsSet.size !== groups.length) {\n throw new Error(`Array syntax cannot contain duplicate group name \"${groups}\" in \"${key}\".`);\n }\n\n if (groups.length === 1) {\n keys.add(key);\n return keys;\n }\n\n for (const group of groups) {\n extrapolateGroups(key.replace(match, group.trim()), keys);\n }\n\n return keys;\n}\n\nexport function generateDynamic(path: string): DynamicConvention[] | null {\n const dynamic = path\n .split('/')\n .map((part): DynamicConvention | null => {\n if (part === '+not-found') {\n return {\n name: '+not-found',\n deep: true,\n notFound: true,\n };\n }\n return matchDynamicName(part) ?? null;\n })\n .filter((part): part is DynamicConvention => !!part);\n\n return dynamic.length === 0 ? null : dynamic;\n}\n\nfunction appendSitemapRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('_sitemap') && options.getSystemRoute) {\n directory.files.set('_sitemap', [\n options.getSystemRoute({\n type: 'route',\n route: '_sitemap',\n }),\n ]);\n }\n}\n\nfunction appendNotFoundRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('+not-found') && options.getSystemRoute) {\n directory.files.set('+not-found', [\n options.getSystemRoute({\n type: 'route',\n route: '+not-found',\n }),\n ]);\n }\n}\n\nfunction getLayoutNode(node: RouteNode, options: Options) {\n /**\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group name.\n */\n // We may strip loadRoute during testing\n const groupName = matchLastGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n\n return {\n ...node,\n route: node.route.replace(/\\/?_layout$/, ''),\n children: [], // Each layout should have its own children\n initialRouteName: anchor,\n };\n}\n\nfunction crawlAndAppendInitialRoutesAndEntryFiles(\n node: RouteNode,\n options: Options,\n entryPoints: string[] = []\n) {\n if (node.type === 'route') {\n node.entryPoints = [...new Set([...entryPoints, node.contextKey])];\n } else if (node.type === 'redirect') {\n node.entryPoints = [...new Set([...entryPoints, node.destinationContextKey!])];\n } else if (node.type === 'layout') {\n if (!node.children) {\n throw new Error(`Layout \"${node.contextKey}\" does not contain any child routes`);\n }\n\n // Every node below this layout will have it as an entryPoint\n entryPoints = [...entryPoints, node.contextKey];\n\n /**\n * Calculate the initialRouteNode\n *\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group.\n */\n const groupName = matchGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n // We may strip loadRoute during testing\n if (!options.internal_stripLoadRoute) {\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n }\n\n if (anchor) {\n const anchorRoute = node.children.find((child) => child.route === anchor);\n if (!anchorRoute) {\n const validAnchorRoutes = node.children\n .filter((child) => !child.generated)\n .map((child) => `'${child.route}'`)\n .join(', ');\n\n if (groupName) {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}' for group '(${groupName})'. Valid options are: ${validAnchorRoutes}`\n );\n } else {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}'. Valid options are: ${validAnchorRoutes}`\n );\n }\n }\n\n // Navigators can add initialsRoutes into the history, so they need to be to be included in the entryPoints\n node.initialRouteName = anchor;\n entryPoints.push(anchorRoute.contextKey);\n }\n\n for (const child of node.children) {\n crawlAndAppendInitialRoutesAndEntryFiles(child, options, entryPoints);\n }\n }\n}\n\nfunction getMostSpecific(routes: RouteNode[]) {\n const route = routes[routes.length - 1];\n\n if (!routes[0]) {\n throw new Error(\n `The file ${route.contextKey} does not have a fallback sibling file without a platform extension.`\n );\n }\n\n // This works even tho routes is holey array (e.g it might have index 0 and 2 but not 1)\n // `.length` includes the holes in its count\n return routes[routes.length - 1];\n}\n"]}
1
+ {"version":3,"file":"getRoutesCore.js","sourceRoot":"","sources":["../src/getRoutesCore.ts"],"names":[],"mappings":";;AAwEA,8BAeC;AA2gBD,sCAMC;AAOD,8CAwBC;AAED,0CAgBC;AAxpBD,yCASoB;AAEpB,qCAAmD;AA8CnD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,aAA6B,EAAE,OAAgB;IACvE,MAAM,aAAa,GAAG,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAE/D,yBAAyB;IACzB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,4BAA4B,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IA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,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,MAAmB;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,YAAY,KAAK,CAAC,UAAU,sEAAsE,CACnG,CAAC;IACJ,CAAC;IAED,wFAAwF;IACxF,4CAA4C;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import type { DynamicConvention, RouteNode } from './Route';\nimport {\n matchArrayGroupName,\n matchDynamicName,\n matchGroupName,\n matchLastGroupName,\n removeFileSystemDots,\n removeFileSystemExtensions,\n removeSupportedExtensions,\n stripInvisibleSegmentsFromPath,\n} from './matchers';\nimport type { RequireContext } from './types';\nimport { shouldLinkExternally } from './utils/url';\n\nexport type Options = {\n ignore?: RegExp[];\n preserveApiRoutes?: boolean;\n ignoreRequireErrors?: boolean;\n ignoreEntryPoints?: boolean;\n /* Used to simplify testing for toEqual() comparison */\n internal_stripLoadRoute?: boolean;\n /* Used to simplify by skipping the generated routes */\n skipGenerated?: boolean;\n /* Skip the generated not found route */\n notFound?: boolean;\n importMode?: string;\n platformRoutes?: boolean;\n sitemap?: boolean;\n platform?: string;\n redirects?: RedirectConfig[];\n rewrites?: RewriteConfig[];\n /* Keep redirects as valid routes within the RouteConfig tree */\n preserveRedirectAndRewrites?: boolean;\n\n /** Get the system route for a location. Useful for shimming React Native imports in SSR environments. */\n getSystemRoute: (route: Pick<RouteNode, 'route' | 'type'>, defaults?: RouteNode) => RouteNode;\n};\n\ntype DirectoryNode = {\n layout?: RouteNode[];\n files: Map<string, RouteNode[]>;\n subdirectories: Map<string, DirectoryNode>;\n};\n\nexport type RedirectConfig = {\n source: string;\n destination: string;\n permanent?: boolean;\n methods?: string[];\n external?: boolean;\n};\n\nexport type RewriteConfig = {\n source: string;\n destination: string;\n methods?: string[];\n};\n\nconst validPlatforms = new Set(['android', 'ios', 'native', 'web']);\n\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options): RouteNode | null {\n const directoryTree = getDirectoryTree(contextModule, options);\n\n // If there are no routes\n if (!directoryTree) {\n return null;\n }\n\n const rootNode = flattenDirectoryTreeToRoutes(directoryTree, options);\n\n if (!options.ignoreEntryPoints) {\n crawlAndAppendInitialRoutesAndEntryFiles(rootNode, options);\n }\n\n return rootNode;\n}\n\n/**\n * Converts the RequireContext keys (file paths) into a directory tree.\n */\nfunction getDirectoryTree(contextModule: RequireContext, options: Options) {\n const importMode = options.importMode || process.env.EXPO_ROUTER_IMPORT_MODE;\n\n const ignoreList: RegExp[] = [/^\\.\\/\\+(html|native-intent)\\.[tj]sx?$/]; // Ignore the top level ./+html file\n\n if (options.ignore) {\n ignoreList.push(...options.ignore);\n }\n if (!options.preserveApiRoutes) {\n ignoreList.push(/\\+api$/, /\\+api\\.[tj]sx?$/);\n }\n\n const rootDirectory: DirectoryNode = {\n files: new Map(),\n subdirectories: new Map(),\n };\n\n let hasRoutes = false;\n let isValid = false;\n\n const contextKeys = contextModule.keys();\n const redirects: Record<string, RedirectConfig> = {};\n const rewrites: Record<string, RewriteConfig> = {};\n\n let validRedirectDestinations: [string, string][] | undefined;\n\n // If we are keeping redirects as valid routes, then we need to add them to the contextKeys\n // This is useful for generating a sitemap with redirects, or static site generation that includes redirects\n if (options.preserveRedirectAndRewrites) {\n if (options.redirects) {\n for (const redirect of options.redirects) {\n // Remove the leading `./` or `/`\n const source = redirect.source.replace(/^\\.?\\//, '');\n\n const isExternalRedirect = shouldLinkExternally(redirect.destination);\n\n const targetDestination = isExternalRedirect\n ? redirect.destination\n : stripInvisibleSegmentsFromPath(\n removeFileSystemDots(\n removeFileSystemExtensions(redirect.destination.replace(/^\\.?\\/?/, ''))\n )\n );\n\n const normalizedSource = removeFileSystemDots(removeSupportedExtensions(source));\n\n if (ignoreList.some((regex) => regex.test(normalizedSource))) {\n continue;\n }\n\n // Loop over this once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return [\n stripInvisibleSegmentsFromPath(removeFileSystemDots(removeSupportedExtensions(key))),\n key,\n ];\n });\n\n const destination = isExternalRedirect\n ? targetDestination\n : validRedirectDestinations.find((key) => key[0] === targetDestination)?.[1];\n\n if (!destination) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${redirect.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n const fakeContextKey = removeFileSystemDots(removeSupportedExtensions(source));\n contextKeys.push(fakeContextKey);\n redirects[fakeContextKey] = {\n source,\n destination,\n permanent: Boolean(redirect.permanent),\n external: isExternalRedirect,\n methods: redirect.methods,\n };\n }\n }\n\n if (options.rewrites) {\n for (const rewrite of options.rewrites) {\n // Remove the leading `./` or `/`\n const source = rewrite.source.replace(/^\\.?\\//, '');\n const targetDestination = stripInvisibleSegmentsFromPath(\n removeFileSystemDots(removeSupportedExtensions(rewrite.destination))\n );\n\n const normalizedSource = removeFileSystemDots(removeSupportedExtensions(source));\n\n if (ignoreList.some((regex) => regex.test(normalizedSource))) {\n continue;\n }\n\n // Loop over this once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return [\n stripInvisibleSegmentsFromPath(removeFileSystemDots(removeSupportedExtensions(key))),\n key,\n ];\n });\n\n const destination = validRedirectDestinations.find(\n (key) => key[0] === targetDestination\n )?.[1];\n\n if (!destination) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${rewrite.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n // Add a fake context key\n const fakeContextKey = `./${source}.tsx`;\n contextKeys.push(fakeContextKey);\n rewrites[fakeContextKey] = { source, destination, methods: rewrite.methods };\n }\n }\n }\n\n for (const filePath of contextKeys) {\n if (ignoreList.some((regex) => regex.test(filePath))) {\n continue;\n }\n\n isValid = true;\n\n const meta = getFileMeta(filePath, options, redirects, rewrites);\n\n // This is a file that should be ignored. e.g maybe it has an invalid platform?\n if (meta.specificity < 0) {\n continue;\n }\n\n let node: RouteNode = {\n type: meta.isApi ? 'api' : meta.isLayout ? 'layout' : 'route',\n loadRoute() {\n let routeModule: any;\n if (options.ignoreRequireErrors) {\n try {\n routeModule = contextModule(filePath);\n } catch {\n routeModule = {};\n }\n } else {\n routeModule = contextModule(filePath);\n }\n\n if (process.env.NODE_ENV === 'development' && importMode === 'sync') {\n // In development mode, when async routes are disabled, add some extra error handling to improve the developer experience.\n // This can be useful when you accidentally use an async function in a route file for the default export.\n if (routeModule instanceof Promise) {\n throw new Error(\n `Route \"${filePath}\" cannot be a promise when async routes is disabled.`\n );\n }\n\n const defaultExport = routeModule?.default;\n if (defaultExport instanceof Promise) {\n throw new Error(\n `The default export from route \"${filePath}\" is a promise. Ensure the React Component does not use async or promises.`\n );\n }\n\n // check if default is an async function without invoking it\n if (\n defaultExport instanceof Function &&\n // This only works on web because Hermes support async functions so we have to transform them out.\n defaultExport.constructor.name === 'AsyncFunction'\n ) {\n throw new Error(\n `The default export from route \"${filePath}\" is an async function. Ensure the React Component does not use async or promises.`\n );\n }\n }\n\n return routeModule;\n },\n contextKey: filePath,\n route: '', // This is overwritten during hoisting based upon the _layout\n dynamic: null,\n children: [], // While we are building the directory tree, we don't know the node's children just yet. This is added during hoisting\n };\n\n if (meta.isRedirect) {\n node.destinationContextKey = redirects[filePath].destination;\n node.permanent = redirects[filePath].permanent;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute(\n {\n type: 'redirect',\n route: removeFileSystemDots(removeSupportedExtensions(node.destinationContextKey)),\n },\n node\n );\n }\n if (redirects[filePath].methods) {\n node.methods = redirects[filePath].methods;\n }\n node.type = 'redirect';\n }\n\n if (meta.isRewrite) {\n node.destinationContextKey = rewrites[filePath].destination;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute(\n {\n type: 'rewrite',\n route: removeFileSystemDots(removeSupportedExtensions(node.destinationContextKey)),\n },\n node\n );\n }\n if (redirects[filePath].methods) {\n node.methods = redirects[filePath].methods;\n }\n node.type = 'rewrite';\n }\n\n if (process.env.NODE_ENV === 'development') {\n // If the user has set the `EXPO_ROUTER_IMPORT_MODE` to `sync` then we should\n // filter the missing routes.\n if (node.type !== 'api' && importMode === 'sync') {\n const routeItem = node.loadRoute();\n // Have a warning for nullish ex\n const route = routeItem?.default;\n if (route == null) {\n // Do not throw an error since a user may just be creating a new route.\n console.warn(\n `Route \"${filePath}\" is missing the required default export. Ensure a React component is exported as default.`\n );\n continue;\n }\n if (['boolean', 'number', 'string'].includes(typeof route)) {\n throw new Error(\n `The default export from route \"${filePath}\" is an unsupported type: \"${typeof route}\". Only React Components are supported as default exports from route files.`\n );\n }\n }\n }\n\n /**\n * A single filepath may be extrapolated into multiple routes if it contains array syntax.\n * Another way to thinking about is that a filepath node is present in multiple leaves of the directory tree.\n */\n for (const route of extrapolateGroups(meta.route)) {\n // Traverse the directory tree to its leaf node, creating any missing directories along the way\n const subdirectoryParts = route.split('/').slice(0, -1);\n\n // Start at the root directory and traverse the path to the leaf directory\n let directory = rootDirectory;\n\n for (const part of subdirectoryParts) {\n let subDirectory = directory.subdirectories.get(part);\n\n // Create any missing subdirectories\n if (!subDirectory) {\n subDirectory = {\n files: new Map(),\n subdirectories: new Map(),\n };\n directory.subdirectories.set(part, subDirectory);\n }\n\n directory = subDirectory;\n }\n\n // Clone the node for this route\n node = { ...node, route };\n\n if (meta.isLayout) {\n directory.layout ??= [];\n const existing = directory.layout[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The layouts \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n node = getLayoutNode(node, options);\n directory.layout[meta.specificity] = node;\n }\n } else if (meta.isApi) {\n const fileKey = `${route}+api`;\n let nodes = directory.files.get(fileKey);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(fileKey, nodes);\n }\n\n // API Routes have no specificity, they are always the first node\n const existing = nodes[0];\n\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The API route file \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n nodes[0] = node;\n }\n } else {\n let nodes = directory.files.get(route);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(route, nodes);\n }\n\n /**\n * If there is an existing node with the same specificity, then we have a conflict.\n * NOTE(Platform Routes):\n * We cannot check for specificity conflicts here, as we haven't processed all the context keys yet!\n * This will be checked during hoisting, as well as enforcing that all routes have a non-platform route.\n */\n const existing = nodes[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The route files \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n hasRoutes ||= true;\n nodes[meta.specificity] = node;\n }\n }\n }\n }\n\n // If there are no routes/layouts then we should display the tutorial.\n if (!isValid) {\n return null;\n }\n\n /**\n * If there are no top-level _layout, add a default _layout\n * While this is a generated route, it will still be generated even if skipGenerated is true.\n */\n if (!rootDirectory.layout) {\n rootDirectory.layout = [\n options.getSystemRoute({\n type: 'layout',\n route: '',\n }),\n ];\n }\n\n // Only include the sitemap if there are routes.\n if (!options.skipGenerated) {\n if (hasRoutes && options.sitemap !== false) {\n appendSitemapRoute(rootDirectory, options);\n }\n if (options.notFound !== false) {\n appendNotFoundRoute(rootDirectory, options);\n }\n }\n return rootDirectory;\n}\n\n/**\n * Flatten the directory tree into routes, hoisting routes to the nearest _layout.\n */\nfunction flattenDirectoryTreeToRoutes(\n directory: DirectoryNode,\n options: Options,\n /* The nearest _layout file in the directory tree */\n layout?: RouteNode,\n /* Route names are relative to their layout */\n pathToRemove = ''\n) {\n /**\n * This directory has a _layout file so it becomes the new target for hoisting routes.\n */\n if (directory.layout) {\n const previousLayout = layout;\n layout = getMostSpecific(directory.layout);\n\n // Add the new layout as a child of its parent\n if (previousLayout) {\n previousLayout.children.push(layout);\n }\n\n if (options.internal_stripLoadRoute) {\n delete (layout as any).loadRoute;\n }\n\n // `route` is the absolute pathname. We need to make this relative to the last _layout\n const newRoute = layout.route.replace(pathToRemove, '');\n pathToRemove = layout.route ? `${layout.route}/` : '';\n\n // Now update this layout with the new relative route and dynamic conventions\n layout.route = newRoute;\n layout.dynamic = generateDynamic(layout.contextKey.slice(0));\n }\n\n // This should never occur as there will always be a root layout, but it makes the type system happy\n if (!layout) throw new Error('Expo Router Internal Error: No nearest layout');\n\n for (const routes of directory.files.values()) {\n const routeNode = getMostSpecific(routes);\n\n // `route` is the absolute pathname. We need to make this relative to the nearest layout\n routeNode.route = routeNode.route.replace(pathToRemove, '');\n routeNode.dynamic = generateDynamic(routeNode.route);\n\n if (options.internal_stripLoadRoute) {\n delete (routeNode as any).loadRoute;\n }\n\n layout.children.push(routeNode);\n }\n\n // Recursively flatten the subdirectories\n for (const child of directory.subdirectories.values()) {\n flattenDirectoryTreeToRoutes(child, options, layout, pathToRemove);\n }\n\n return layout;\n}\n\nfunction getFileMeta(\n originalKey: string,\n options: Options,\n redirects: Record<string, RedirectConfig>,\n rewrites: Record<string, RedirectConfig>\n) {\n // Remove the leading `./`\n const key = removeSupportedExtensions(removeFileSystemDots(originalKey));\n let route = key;\n\n const parts = removeFileSystemDots(originalKey).split('/');\n const filename = parts[parts.length - 1];\n const [filenameWithoutExtensions, platformExtension] =\n removeSupportedExtensions(filename).split('.');\n\n const isLayout = filenameWithoutExtensions === '_layout';\n const isApi = originalKey.match(/\\+api\\.(\\w+\\.)?[jt]sx?$/);\n\n if (filenameWithoutExtensions.startsWith('(') && filenameWithoutExtensions.endsWith(')')) {\n throw new Error(`Invalid route ${originalKey}. Routes cannot end with '(group)' syntax`);\n }\n\n // Nested routes cannot start with the '+' character, except for the '+not-found' route\n if (!isApi && filename.startsWith('+') && filenameWithoutExtensions !== '+not-found') {\n const renamedRoute = [...parts.slice(0, -1), filename.slice(1)].join('/');\n throw new Error(\n `Invalid route ${originalKey}. Route nodes cannot start with the '+' character. \"Rename it to ${renamedRoute}\"`\n );\n }\n let specificity = 0;\n\n const hasPlatformExtension = validPlatforms.has(platformExtension);\n const usePlatformRoutes = options.platformRoutes ?? true;\n\n if (hasPlatformExtension) {\n if (!usePlatformRoutes) {\n // If the user has disabled platform routes, then we should ignore this file\n specificity = -1;\n } else if (!options.platform) {\n // If we don't have a platform, then we should ignore this file\n // This used by typed routes, sitemap, etc\n specificity = -1;\n } else if (platformExtension === options.platform) {\n // If the platform extension is the same as the options.platform, then it is the most specific\n specificity = 2;\n } else if (platformExtension === 'native' && options.platform !== 'web') {\n // `native` is allow but isn't as specific as the platform\n specificity = 1;\n } else if (platformExtension !== options.platform) {\n // Somehow we have a platform extension that doesn't match the options.platform and it isn't native\n // This is an invalid file and we will ignore it\n specificity = -1;\n }\n\n if (isApi && specificity !== 0) {\n throw new Error(\n `API routes cannot have platform extensions. Remove '.${platformExtension}' from '${originalKey}'`\n );\n }\n\n route = route.replace(new RegExp(`.${platformExtension}$`), '');\n }\n\n return {\n route,\n specificity,\n isLayout,\n isApi,\n isRedirect: key in redirects,\n isRewrite: key in rewrites,\n };\n}\n\nexport function getIgnoreList(options?: Options) {\n const ignore: RegExp[] = [/^\\.\\/\\+html\\.[tj]sx?$/, ...(options?.ignore ?? [])];\n if (options?.preserveApiRoutes !== true) {\n ignore.push(/\\+api\\.[tj]sx?$/);\n }\n return ignore;\n}\n\n/**\n * Generates a set of strings which have the router array syntax extrapolated.\n *\n * /(a,b)/(c,d)/e.tsx => new Set(['a/c/e.tsx', 'a/d/e.tsx', 'b/c/e.tsx', 'b/d/e.tsx'])\n */\nexport function extrapolateGroups(key: string, keys: Set<string> = new Set()): Set<string> {\n const match = matchArrayGroupName(key);\n\n if (!match) {\n keys.add(key);\n return keys;\n }\n const groups = match.split(',');\n const groupsSet = new Set(groups);\n\n if (groupsSet.size !== groups.length) {\n throw new Error(`Array syntax cannot contain duplicate group name \"${groups}\" in \"${key}\".`);\n }\n\n if (groups.length === 1) {\n keys.add(key);\n return keys;\n }\n\n for (const group of groups) {\n extrapolateGroups(key.replace(match, group.trim()), keys);\n }\n\n return keys;\n}\n\nexport function generateDynamic(path: string): DynamicConvention[] | null {\n const dynamic = path\n .split('/')\n .map((part): DynamicConvention | null => {\n if (part === '+not-found') {\n return {\n name: '+not-found',\n deep: true,\n notFound: true,\n };\n }\n return matchDynamicName(part) ?? null;\n })\n .filter((part): part is DynamicConvention => !!part);\n\n return dynamic.length === 0 ? null : dynamic;\n}\n\nfunction appendSitemapRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('_sitemap') && options.getSystemRoute) {\n directory.files.set('_sitemap', [\n options.getSystemRoute({\n type: 'route',\n route: '_sitemap',\n }),\n ]);\n }\n}\n\nfunction appendNotFoundRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('+not-found') && options.getSystemRoute) {\n directory.files.set('+not-found', [\n options.getSystemRoute({\n type: 'route',\n route: '+not-found',\n }),\n ]);\n }\n}\n\nfunction getLayoutNode(node: RouteNode, options: Options) {\n /**\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group name.\n */\n // We may strip loadRoute during testing\n const groupName = matchLastGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n\n return {\n ...node,\n route: node.route.replace(/\\/?_layout$/, ''),\n children: [], // Each layout should have its own children\n initialRouteName: anchor,\n };\n}\n\nfunction crawlAndAppendInitialRoutesAndEntryFiles(\n node: RouteNode,\n options: Options,\n entryPoints: string[] = []\n) {\n if (node.type === 'route') {\n node.entryPoints = [...new Set([...entryPoints, node.contextKey])];\n } else if (node.type === 'redirect') {\n node.entryPoints = [...new Set([...entryPoints, node.destinationContextKey!])];\n } else if (node.type === 'layout') {\n if (!node.children) {\n throw new Error(`Layout \"${node.contextKey}\" does not contain any child routes`);\n }\n\n // Every node below this layout will have it as an entryPoint\n entryPoints = [...entryPoints, node.contextKey];\n\n /**\n * Calculate the initialRouteNode\n *\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group.\n */\n const groupName = matchGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n // We may strip loadRoute during testing\n if (!options.internal_stripLoadRoute) {\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n }\n\n if (anchor) {\n const anchorRoute = node.children.find((child) => child.route === anchor);\n if (!anchorRoute) {\n const validAnchorRoutes = node.children\n .filter((child) => !child.generated)\n .map((child) => `'${child.route}'`)\n .join(', ');\n\n if (groupName) {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}' for group '(${groupName})'. Valid options are: ${validAnchorRoutes}`\n );\n } else {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}'. Valid options are: ${validAnchorRoutes}`\n );\n }\n }\n\n // Navigators can add initialsRoutes into the history, so they need to be to be included in the entryPoints\n node.initialRouteName = anchor;\n entryPoints.push(anchorRoute.contextKey);\n }\n\n for (const child of node.children) {\n crawlAndAppendInitialRoutesAndEntryFiles(child, options, entryPoints);\n }\n }\n}\n\nfunction getMostSpecific(routes: RouteNode[]) {\n const route = routes[routes.length - 1];\n\n if (!routes[0]) {\n throw new Error(\n `The file ${route.contextKey} does not have a fallback sibling file without a platform extension.`\n );\n }\n\n // This works even tho routes is holey array (e.g it might have index 0 and 2 but not 1)\n // `.length` includes the holes in its count\n return routes[routes.length - 1];\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  import { RedirectConfig } from './getRoutesCore';
2
2
  import type { StoreRedirects } from './global-state/router-store';
3
3
  export declare function applyRedirects(url: string | null | undefined, redirects: StoreRedirects[] | undefined): string | undefined | null;
4
- export declare function getRedirectModule(redirectConfig: RedirectConfig): {
4
+ export declare function getRedirectModule(route: string): {
5
5
  default: () => import("react").CElement<{
6
6
  href: string;
7
7
  }, import("react").Component<{
8
8
  href: string;
9
- }, any, any>> | null;
9
+ }, any, any>>;
10
10
  };
11
11
  export declare function convertRedirect(path: string, config: RedirectConfig): string;
12
12
  export declare function mergeVariablesWithPath(path: string, params: Record<string, string | string[]>): string;
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutesRedirects.d.ts","sourceRoot":"","sources":["../src/getRoutesRedirects.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAIlE,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,SAAS,EAAE,cAAc,EAAE,GAAG,SAAS,GACtC,MAAM,GAAG,SAAS,GAAG,IAAI,CAyB3B;AAED,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,cAAc;;;;;;EA6B/D;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,UAoBnE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,UAe7F"}
1
+ {"version":3,"file":"getRoutesRedirects.d.ts","sourceRoot":"","sources":["../src/getRoutesRedirects.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,SAAS,EAAE,cAAc,EAAE,GAAG,SAAS,GACtC,MAAM,GAAG,SAAS,GAAG,IAAI,CAwB3B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM;;;;;;EAiC9C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,UAoBnE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,UAe7F"}
@@ -41,7 +41,6 @@ const Linking = __importStar(require("expo-linking"));
41
41
  const react_1 = require("react");
42
42
  const getStateFromPath_forks_1 = require("./fork/getStateFromPath-forks");
43
43
  const matchers_1 = require("./matchers");
44
- const url_1 = require("./utils/url");
45
44
  function applyRedirects(url, redirects) {
46
45
  if (typeof url !== 'string' || !redirects) {
47
46
  return url;
@@ -62,27 +61,34 @@ function applyRedirects(url, redirects) {
62
61
  }
63
62
  return applyRedirects(convertRedirect(url, redirect[1]), redirects);
64
63
  }
65
- function getRedirectModule(redirectConfig) {
64
+ function getRedirectModule(route) {
66
65
  return {
67
66
  default: function RedirectComponent() {
68
- const pathname = require('./hooks').usePathname();
69
- const isExternal = (0, url_1.shouldLinkExternally)(redirectConfig.destination);
70
- (0, react_1.useEffect)(() => {
71
- if (isExternal) {
72
- let href = redirectConfig.destination;
73
- if (href.startsWith('//') && process.env.EXPO_OS !== 'web') {
74
- href = `https:${href}`;
75
- }
76
- Linking.openURL(href);
67
+ // Use the store directly instead of useGlobalSearchParams.
68
+ // Importing the hooks directly causes build errors on the server
69
+ const params = require('./hooks').useGlobalSearchParams();
70
+ // Replace dynamic parts of the route with the actual values from the params
71
+ let href = route
72
+ .split('/')
73
+ .map((part) => {
74
+ const dynamicName = (0, matchers_1.matchDynamicName)(part);
75
+ if (!dynamicName) {
76
+ return part;
77
77
  }
78
- }, []);
79
- if (isExternal) {
80
- return null;
78
+ else {
79
+ const param = params[dynamicName.name];
80
+ delete params[dynamicName.name];
81
+ return param;
82
+ }
83
+ })
84
+ .filter(Boolean)
85
+ .join('/');
86
+ // Add any remaining params as query string
87
+ const queryString = new URLSearchParams(params).toString();
88
+ if (queryString) {
89
+ href += `?${queryString}`;
81
90
  }
82
- const href = convertRedirect(pathname, redirectConfig);
83
- return (0, react_1.createElement)(require('./link/Link').Redirect, {
84
- href,
85
- });
91
+ return (0, react_1.createElement)(require('./link/Link').Redirect, { href });
86
92
  },
87
93
  };
88
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutesRedirects.js","sourceRoot":"","sources":["../src/getRoutesRedirects.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,wCA4BC;AAED,8CA6BC;AAED,0CAoBC;AAED,wDAeC;AA3GD,sDAAwC;AACxC,iCAAiD;AAEjD,0EAA0D;AAG1D,yCAA8C;AAC9C,qCAAmD;AAEnD,SAAgB,cAAc,CAC5B,GAA8B,EAC9B,SAAuC;IAEvC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,kCAAS,EAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAElE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,CAAC;IACb,CAAC;IAED,4CAA4C;IAC5C,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,IAAI,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;QAE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;QACf,CAAC;IACH,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["import * as Linking from 'expo-linking';\nimport { createElement, useEffect } from 'react';\n\nimport { cleanPath } from './fork/getStateFromPath-forks';\nimport { RedirectConfig } from './getRoutesCore';\nimport type { StoreRedirects } from './global-state/router-store';\nimport { matchDynamicName } from './matchers';\nimport { shouldLinkExternally } from './utils/url';\n\nexport function applyRedirects(\n url: string | null | undefined,\n redirects: StoreRedirects[] | undefined\n): string | undefined | null {\n if (typeof url !== 'string' || !redirects) {\n return url;\n }\n\n const nextUrl = cleanPath(url);\n const redirect = redirects.find(([regex]) => regex.test(nextUrl));\n\n if (!redirect) {\n return url;\n }\n\n // If the redirect is external, open the URL\n if (redirect[2]) {\n let href = redirect[1].destination;\n\n if (href.startsWith('//') && process.env.EXPO_OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n return href;\n }\n\n return applyRedirects(convertRedirect(url, redirect[1]), redirects);\n}\n\nexport function getRedirectModule(redirectConfig: RedirectConfig) {\n return {\n default: function RedirectComponent() {\n const pathname = require('./hooks').usePathname();\n\n const isExternal = shouldLinkExternally(redirectConfig.destination);\n\n useEffect(() => {\n if (isExternal) {\n let href = redirectConfig.destination;\n if (href.startsWith('//') && process.env.EXPO_OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n }\n }, []);\n\n if (isExternal) {\n return null;\n }\n\n const href = convertRedirect(pathname, redirectConfig);\n\n return createElement(require('./link/Link').Redirect, {\n href,\n });\n },\n };\n}\n\nexport function convertRedirect(path: string, config: RedirectConfig) {\n const params: Record<string, string | string[]> = {};\n\n const parts = path.split('/');\n const sourceParts = config.source.split('/');\n\n for (const [index, sourcePart] of sourceParts.entries()) {\n const dynamicName = matchDynamicName(sourcePart);\n if (!dynamicName) {\n continue;\n } else if (!dynamicName.deep) {\n params[dynamicName.name] = parts[index];\n continue;\n } else {\n params[dynamicName.name] = parts.slice(index);\n break;\n }\n }\n\n return mergeVariablesWithPath(config.destination, params);\n}\n\nexport function mergeVariablesWithPath(path: string, params: Record<string, string | string[]>) {\n return path\n .split('/')\n .map((part) => {\n const dynamicName = matchDynamicName(part);\n if (!dynamicName) {\n return part;\n } else {\n const param = params[dynamicName.name];\n delete params[dynamicName.name];\n return param;\n }\n })\n .filter(Boolean)\n .join('/');\n}\n"]}
1
+ {"version":3,"file":"getRoutesRedirects.js","sourceRoot":"","sources":["../src/getRoutesRedirects.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,wCA2BC;AAED,8CAiCC;AAED,0CAoBC;AAED,wDAeC;AA7GD,sDAAwC;AACxC,iCAAsC;AAEtC,0EAA0D;AAG1D,yCAA8C;AAE9C,SAAgB,cAAc,CAC5B,GAA8B,EAC9B,SAAuC;IAEvC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,kCAAS,EAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAElE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,CAAC;IACb,CAAC;IAED,4CAA4C;IAC5C,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,IAAI,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;QACnC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YAC3D,IAAI,GAAG,SAAS,IAAI,EAAE,CAAC;QACzB,CAAC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C,CAAC;SACD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["import * as Linking from 'expo-linking';\nimport { createElement } from 'react';\n\nimport { cleanPath } from './fork/getStateFromPath-forks';\nimport { RedirectConfig } from './getRoutesCore';\nimport type { StoreRedirects } from './global-state/router-store';\nimport { matchDynamicName } from './matchers';\n\nexport function applyRedirects(\n url: string | null | undefined,\n redirects: StoreRedirects[] | undefined\n): string | undefined | null {\n if (typeof url !== 'string' || !redirects) {\n return url;\n }\n\n const nextUrl = cleanPath(url);\n const redirect = redirects.find(([regex]) => regex.test(nextUrl));\n\n if (!redirect) {\n return url;\n }\n\n // If the redirect is external, open the URL\n if (redirect[2]) {\n let href = redirect[1].destination;\n if (href.startsWith('//') && process.env.EXPO_OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n return href;\n }\n\n return applyRedirects(convertRedirect(url, redirect[1]), redirects);\n}\n\nexport function getRedirectModule(route: string) {\n return {\n default: function RedirectComponent() {\n // Use the store directly instead of useGlobalSearchParams.\n // Importing the hooks directly causes build errors on the server\n const params = require('./hooks').useGlobalSearchParams();\n\n // Replace dynamic parts of the route with the actual values from the params\n let href = route\n .split('/')\n .map((part) => {\n const dynamicName = matchDynamicName(part);\n if (!dynamicName) {\n return part;\n } else {\n const param = params[dynamicName.name];\n delete params[dynamicName.name];\n return param;\n }\n })\n .filter(Boolean)\n .join('/');\n\n // Add any remaining params as query string\n const queryString = new URLSearchParams(params as Record<string, any>).toString();\n\n if (queryString) {\n href += `?${queryString}`;\n }\n\n return createElement(require('./link/Link').Redirect, { href });\n },\n };\n}\n\nexport function convertRedirect(path: string, config: RedirectConfig) {\n const params: Record<string, string | string[]> = {};\n\n const parts = path.split('/');\n const sourceParts = config.source.split('/');\n\n for (const [index, sourcePart] of sourceParts.entries()) {\n const dynamicName = matchDynamicName(sourcePart);\n if (!dynamicName) {\n continue;\n } else if (!dynamicName.deep) {\n params[dynamicName.name] = parts[index];\n continue;\n } else {\n params[dynamicName.name] = parts.slice(index);\n break;\n }\n }\n\n return mergeVariablesWithPath(config.destination, params);\n}\n\nexport function mergeVariablesWithPath(path: string, params: Record<string, string | string[]>) {\n return path\n .split('/')\n .map((part) => {\n const dynamicName = matchDynamicName(part);\n if (!dynamicName) {\n return part;\n } else {\n const param = params[dynamicName.name];\n delete params[dynamicName.name];\n return param;\n }\n })\n .filter(Boolean)\n .join('/');\n}\n"]}
@@ -16,5 +16,5 @@ export type Options = Omit<OptionsCore, 'getSystemRoute'>;
16
16
  */
17
17
  export declare function getRoutes(contextModule: RequireContext, options?: Options): RouteNode | null;
18
18
  export declare function getExactRoutes(contextModule: RequireContext, options?: Options): RouteNode | null;
19
- export { generateDynamic, extrapolateGroups } from './getRoutesCore';
19
+ export { generateDynamic, extrapolateGroups, getIgnoreList } from './getRoutesCore';
20
20
  //# sourceMappingURL=getRoutesSSR.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutesSSR.d.ts","sourceRoot":"","sources":["../src/getRoutesSSR.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAA8B,KAAK,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAC1D;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,aAAa,EAAE,cAAc,EAAE,OAAO,GAAE,OAAY,GAAG,SAAS,GAAG,IAAI,CAuDhG;AAED,wBAAgB,cAAc,CAC5B,aAAa,EAAE,cAAc,EAC7B,OAAO,GAAE,OAAY,GACpB,SAAS,GAAG,IAAI,CAKlB;AAED,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
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