expo-router 3.4.4 → 3.4.6
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/getRoutes.d.ts.map +1 -1
- package/build/getRoutes.js +25 -32
- package/build/getRoutes.js.map +1 -1
- package/package.json +4 -4
package/build/getRoutes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRoutes.d.ts","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAU5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,EAAE,YAAY,GAAG,WAAW,GAAG,UAAU,CAAC,GAAG;IAC5F,yBAAyB;IACzB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,KAAK,qBAAqB,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,qBAAqB,EAAE,CAAC;CACnC,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,8CAA8C;IAC9C,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ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AAiB,GAAG,IAAI,CAejF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAM9E;AA8ND;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,QAoBxD;AAED,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,aAAa,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAiB5F;AA+GD,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,aAAa,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CASjG;AAwDD;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAkB9F"}
|
package/build/getRoutes.js
CHANGED
|
@@ -205,42 +205,35 @@ function contextModuleToFileNodes(contextModule, options = {}, files = contextMo
|
|
|
205
205
|
const nodes = files.map((key) => {
|
|
206
206
|
// In development, check if the file exports a default component
|
|
207
207
|
// this helps keep things snappy when creating files. In production we load all screens lazily.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return null;
|
|
216
|
-
}
|
|
208
|
+
if (process.env.NODE_ENV === 'development') {
|
|
209
|
+
// If the user has set the `EXPO_ROUTER_IMPORT_MODE` to `sync` then we should
|
|
210
|
+
// filter the missing routes.
|
|
211
|
+
if (import_mode_1.default === 'sync') {
|
|
212
|
+
const isApi = key.match(/\+api\.[jt]sx?$/);
|
|
213
|
+
if (!isApi && !contextModule(key)?.default) {
|
|
214
|
+
return null;
|
|
217
215
|
}
|
|
218
216
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
catch {
|
|
226
|
-
return {};
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
217
|
+
}
|
|
218
|
+
const node = {
|
|
219
|
+
loadRoute() {
|
|
220
|
+
if (options.ignoreRequireErrors) {
|
|
221
|
+
try {
|
|
230
222
|
return contextModule(key);
|
|
231
223
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
224
|
+
catch {
|
|
225
|
+
return {};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
return contextModule(key);
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
normalizedName: (0, matchers_1.getNameFromFilePath)(key),
|
|
233
|
+
filePath: key,
|
|
234
|
+
contextKey: key,
|
|
235
|
+
};
|
|
236
|
+
return node;
|
|
244
237
|
});
|
|
245
238
|
return nodes.filter(Boolean);
|
|
246
239
|
}
|
package/build/getRoutes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRoutes.js","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":";;;;;;AACA,gEAAoD;AACpD,yCAOoB;AA4BpB,oEAAoE;AACpE,SAAgB,gBAAgB,CAAC,KAAiB;IAChD,MAAM,IAAI,GAAG;QACX,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,IAAI;KACX,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,wCAAwC;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,WAAW,GAAa,IAAI,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;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sC;IAEtC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE;QACnB,OAAO,IAAI,CAAC;KACb;IAED,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAE;QACnC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;KAClB;IAED,OAAO;QACL,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;YAChB,OAAO,EAAG,OAAO,CAAC,mBAAmB,CAAwC;iBAC1E,gBAAgB;SACpB,CAAC;QACF,QAAQ,EAAE,sCAAsC;QAChD,8CAA8C;QAC9C,UAAU,EAAE,eAAe;QAC3B,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,MAAM;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import type { DynamicConvention, RouteNode } from './Route';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport {\n getNameFromFilePath,\n matchDeepDynamicRouteName,\n matchDynamicName,\n matchGroupName,\n removeSupportedExtensions,\n stripGroupSegmentsFromPath,\n} from './matchers';\nimport type { RequireContext } from './types';\n\nexport type FileNode = Pick<IntermediateRouteNode, 'contextKey' | 'loadRoute' | 'filePath'> & {\n /** Like `(tab)/index` */\n normalizedName: string;\n};\n\ntype IntermediateRouteNode = Omit<RouteNode, 'children'> & {\n filePath: string;\n children: IntermediateRouteNode[];\n};\n\ntype TreeNode = {\n name: string;\n children: TreeNode[];\n parents: string[];\n /** null when there is no file in a folder. */\n node: FileNode | null;\n};\n\ntype Options = {\n ignore?: RegExp[];\n preserveApiRoutes?: boolean;\n ignoreRequireErrors?: boolean;\n ignoreEntryPoints?: boolean;\n};\n\n/** Convert a flat map of file nodes into a nested tree of files. */\nexport function getRecursiveTree(files: FileNode[]): TreeNode {\n const tree = {\n name: '',\n children: [],\n parents: [],\n node: null,\n };\n\n for (const file of files) {\n // ['(tab)', 'settings', '[...another]']\n const parts = file.normalizedName.split('/');\n let currentNode: TreeNode = tree;\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n\n if (i === parts.length - 1 && part === '_layout') {\n if (currentNode.node) {\n const overwritten = currentNode.node.contextKey;\n throw new Error(\n `Higher priority Layout Route \"${file.contextKey}\" overriding redundant Layout Route \"${overwritten}\". Remove the Layout Route \"${overwritten}\" to fix this.`\n );\n }\n continue;\n }\n\n const existing = currentNode.children.find((item) => item.name === part);\n if (existing) {\n currentNode = existing;\n } else {\n const newNode: TreeNode = {\n name: part,\n children: [],\n parents: [...currentNode.parents, currentNode.name],\n node: null,\n };\n currentNode.children.push(newNode);\n currentNode = newNode;\n }\n }\n currentNode.node = file;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n assertDeprecatedFormat(tree);\n }\n\n return tree;\n}\n\nfunction assertDeprecatedFormat(tree: TreeNode) {\n for (const child of tree.children) {\n if (child.node && child.children.length && !child.node.normalizedName.endsWith('_layout')) {\n const ext = child.node.contextKey.split('.').pop();\n throw new Error(\n `Using deprecated Layout Route format: Move \\`./app/${child.node.normalizedName}.${ext}\\` to \\`./app/${child.node.normalizedName}/_layout.${ext}\\``\n );\n }\n assertDeprecatedFormat(child);\n }\n}\n\nfunction getTreeNodesAsRouteNodes(nodes: TreeNode[], options: Options): IntermediateRouteNode[] {\n return nodes\n .map((node) => treeNodeToRouteNode(node, options))\n .flat()\n .filter(Boolean) as IntermediateRouteNode[];\n}\n\nexport function generateDynamicFromSegment(name: string): DynamicConvention | null {\n if (name === '+not-found') {\n return {\n name: '+not-found',\n deep: true,\n notFound: true,\n };\n }\n\n const deepDynamicName = matchDeepDynamicRouteName(name);\n const dynamicName = deepDynamicName ?? matchDynamicName(name);\n if (!dynamicName) {\n return null;\n }\n return { name: dynamicName, deep: !!deepDynamicName };\n}\n\nexport function generateDynamic(name: string): IntermediateRouteNode['dynamic'] {\n const description = name\n .split('/')\n .map((segment) => generateDynamicFromSegment(segment))\n .filter(Boolean) as DynamicConvention[];\n return description.length === 0 ? null : description;\n}\n\nfunction collapseRouteSegments(route: string) {\n return stripGroupSegmentsFromPath(route.replace(/\\/index$/, ''));\n}\n\n/**\n * Given a route node and a name representing the group name,\n * find the nearest child matching the name.\n *\n * Doesn't support slashes in the name.\n * Routes like `explore/(something)/index` will be matched against `explore`.\n *\n */\nfunction getDefaultInitialRoute(node: IntermediateRouteNode, name: string) {\n return node.children.find((node) => collapseRouteSegments(node.route) === name);\n}\n\nfunction applyDefaultInitialRouteName(node: IntermediateRouteNode): IntermediateRouteNode {\n const groupName = matchGroupName(node.route);\n if (!node.children?.length) {\n return node;\n }\n\n // Guess at the initial route based on the group name.\n // TODO(EvanBacon): Perhaps we should attempt to warn when the group doesn't match any child routes.\n let initialRouteName = groupName ? getDefaultInitialRoute(node, groupName)?.route : undefined;\n const loaded = node.loadRoute();\n\n if (loaded?.unstable_settings) {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n initialRouteName = loaded.unstable_settings.initialRouteName ?? initialRouteName;\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName = loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n initialRouteName = groupSpecificInitialRouteName ?? initialRouteName;\n }\n }\n\n return {\n ...node,\n initialRouteName,\n };\n}\n\nfunction folderNodeToRouteNode(\n { name, children }: TreeNode,\n options: Options\n): IntermediateRouteNode[] | null {\n // Empty folder, skip it.\n if (!children.length) {\n return null;\n }\n\n // When there's a directory, but no layout route file (with valid export), the child routes won't be grouped.\n // This pushes all children into the nearest layout route.\n return getTreeNodesAsRouteNodes(\n children.map((child) => {\n return {\n ...child,\n name: [name, child.name].filter(Boolean).join('/'),\n };\n }),\n options\n );\n}\n\nfunction fileNodeToRouteNode(tree: TreeNode, options: Options): IntermediateRouteNode[] | null {\n const { name, node, children } = tree;\n\n if (!node) throw new Error('node must be defined');\n\n const dynamic = generateDynamic(name);\n\n const clones = extrapolateGroupRoutes(name, node.contextKey);\n clones.delete(name);\n\n const output = {\n loadRoute: node.loadRoute,\n route: name,\n contextKey: node.contextKey,\n children: getTreeNodesAsRouteNodes(children, options),\n dynamic,\n filePath: node.filePath,\n entryPoints:\n options.ignoreEntryPoints || isApiRoutePath(node.contextKey) ? undefined : [node.filePath],\n };\n\n if (clones.size) {\n return [...clones].map((clone) =>\n applyDefaultInitialRouteName({\n ...output,\n contextKey: node.contextKey.replace(output.route, clone),\n route: clone,\n })\n );\n }\n\n return [\n applyDefaultInitialRouteName({\n loadRoute: node.loadRoute,\n route: name,\n entryPoints:\n options.ignoreEntryPoints || isApiRoutePath(node.contextKey) ? undefined : [node.filePath],\n filePath: node.filePath,\n contextKey: node.contextKey,\n children: getTreeNodesAsRouteNodes(children, options),\n dynamic,\n }),\n ];\n}\n\nfunction extrapolateGroupRoutes(\n route: string,\n contextKey: string,\n routes: Set<string> = new Set()\n): Set<string> {\n const match = matchGroupName(route);\n\n if (!match) {\n routes.add(route);\n return routes;\n }\n\n const groups = match?.split(',');\n const groupsSet = new Set(groups);\n\n if (groupsSet.size !== groups.length) {\n throw new Error(\n `Array syntax cannot contain duplicate group name \"${groups}\" in \"${contextKey}\".`\n );\n }\n\n if (groups.length === 1) {\n routes.add(route);\n return routes;\n }\n\n for (const group of groups) {\n extrapolateGroupRoutes(route.replace(match, group.trim()), contextKey, routes);\n }\n\n return routes;\n}\n\nfunction treeNodeToRouteNode(tree: TreeNode, options: Options): IntermediateRouteNode[] | null {\n if (tree.node) {\n return fileNodeToRouteNode(tree, options);\n }\n\n return folderNodeToRouteNode(tree, options);\n}\n\nfunction contextModuleToFileNodes(\n contextModule: RequireContext,\n options: Options = {},\n files: string[] = contextModule.keys()\n): FileNode[] {\n const nodes = files.map((key) => {\n // In development, check if the file exports a default component\n // this helps keep things snappy when creating files. In production we load all screens lazily.\n try {\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 (EXPO_ROUTER_IMPORT_MODE === 'sync') {\n const isApi = key.match(/\\+api\\.[jt]sx?$/);\n if (!isApi && !contextModule(key)?.default) {\n return null;\n }\n }\n }\n const node: FileNode = {\n loadRoute() {\n if (options.ignoreRequireErrors) {\n try {\n return contextModule(key);\n } catch {\n return {};\n }\n } else {\n return contextModule(key);\n }\n },\n normalizedName: getNameFromFilePath(key),\n filePath: key,\n contextKey: key,\n };\n\n return node;\n } catch (error) {\n // Probably this won't stop metro from freaking out but it's worth a try.\n console.warn('Error loading route \"' + key + '\"', error);\n }\n return null;\n });\n\n return nodes.filter(Boolean) as FileNode[];\n}\n\nfunction hasCustomRootLayoutNode(routes: IntermediateRouteNode[]) {\n if (routes.length !== 1) {\n return false;\n }\n // This could either be the root _layout or an app with a single file.\n const route = routes[0];\n\n if (route.route === '' && route.contextKey.match(/^\\.\\/_layout\\.([jt]sx?)$/)) {\n return true;\n }\n return false;\n}\n\nfunction treeNodesToRootRoute(treeNode: TreeNode, options: Options): IntermediateRouteNode | null {\n const routes = treeNodeToRouteNode(treeNode, options);\n return withOptionalRootLayout(routes);\n}\n\nfunction processKeys(files: string[], options: Options): string[] {\n const { ignore } = options;\n\n return files.filter((file) => {\n return !ignore?.some((pattern) => pattern.test(file));\n });\n}\n\n/**\n * Asserts if the require.context has files that share the same name but have different extensions. Exposed for testing.\n * @private\n */\nexport function assertDuplicateRoutes(filenames: string[]) {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n const duplicates = filenames\n .map((filename) => removeSupportedExtensions(filename))\n .reduce(\n (acc, filename) => {\n acc[filename] = acc[filename] ? acc[filename] + 1 : 1;\n return acc;\n },\n {} as Record<string, number>\n );\n\n Object.entries(duplicates).forEach(([filename, count]) => {\n if (count > 1) {\n throw new Error(`Multiple files match the route name \"${filename}\".`);\n }\n });\n}\n\n/** Given a Metro context module, return an array of nested routes. */\nexport function getRoutes(contextModule: RequireContext, options?: Options): RouteNode | null {\n const route = getExactRoutesInternal(contextModule, options);\n\n // If there is no route, return an empty route.\n if (!route) {\n return null;\n }\n\n appendSitemapRoute(route);\n\n // Auto add not found route if it doesn't exist\n appendUnmatchedRoute(route);\n\n if (options?.ignoreEntryPoints) {\n return removeFilePath(route);\n }\n return removeFilePath(crawlAndAppendEntryFilesForInitialRoutes(crawlAndAppendEntryFiles(route)));\n}\n\nfunction removeFilePath(route: IntermediateRouteNode | null): RouteNode | null {\n if (!route) return route;\n const { filePath, ...rest } = route;\n\n return {\n ...rest,\n children: route.children.map((child) => removeFilePath(child)).filter(Boolean) as RouteNode[],\n };\n}\n\nfunction unique<T>(array: T[]): T[] {\n return [...new Set(array)];\n}\n\nfunction isLayoutRoute(route: IntermediateRouteNode) {\n return route.contextKey.match(/\\/_layout\\.([jt]sx?)$/);\n}\n\nfunction isViewRoute(route?: IntermediateRouteNode | null): route is IntermediateRouteNode {\n return !!route && !isApiRoute(route);\n}\nfunction isApiRoute(route: IntermediateRouteNode) {\n return isApiRoutePath(route.contextKey);\n}\nfunction isApiRoutePath(route: string): boolean {\n return !!route.match(/\\+api\\.[jt]sx?$/);\n}\n\nfunction crawlAndAppendEntryFiles(\n route: IntermediateRouteNode | null,\n entryPoints: string[] = []\n): IntermediateRouteNode | null {\n if (!isViewRoute(route)) {\n return null;\n }\n const nextEntryPoints = unique([...entryPoints, ...(route.entryPoints ?? []), route.filePath]);\n\n route.children.forEach((child) => {\n crawlAndAppendEntryFiles(child, nextEntryPoints);\n });\n\n // Skip adding entry points for layout routes since we only need them\n // for rendering child nodes.\n if (isLayoutRoute(route)) {\n delete route.entryPoints;\n } else {\n route.entryPoints = nextEntryPoints;\n }\n\n return route;\n}\n\nfunction crawlAndAppendEntryFilesForInitialRoutes(\n route: IntermediateRouteNode | null,\n initialRoutes: IntermediateRouteNode[] = []\n): IntermediateRouteNode | null {\n if (!isViewRoute(route)) {\n return null;\n }\n\n // Skip adding entry points for layout routes since we only need them\n // for rendering child nodes.\n if (isLayoutRoute(route)) {\n if (route.initialRouteName) {\n const initialRoute = route.children.find((child) => child.route === route.initialRouteName);\n if (!initialRoute) {\n throw new Error(\n `Invalid initialRouteName \"${route.initialRouteName}\" defined in ${\n route.filePath\n }. Options are: ${route.children.map((route) => route.route).join(', ')}`\n );\n }\n // Update all children to include the entry points from the initial route...\n\n route.children.forEach((child) => {\n crawlAndAppendEntryFilesForInitialRoutes(child, [...initialRoutes, initialRoute]);\n });\n }\n } else {\n const isInitial = initialRoutes.some(\n (initialRoute) => initialRoute.contextKey === route.contextKey\n );\n if (!isInitial) {\n route.entryPoints = unique([\n ...initialRoutes.map((route) => route.entryPoints ?? []).flat(),\n ...(route.entryPoints ?? []),\n ]);\n }\n }\n\n return route;\n}\n\nfunction 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\nfunction getExactRoutesInternal(\n contextModule: RequireContext,\n options: Options = {}\n): IntermediateRouteNode | null {\n const treeNodes = contextModuleToTree(contextModule, options);\n return treeNodesToRootRoute(treeNodes, options);\n}\n\n/** Get routes without unmatched or sitemap. */\nexport function getExactRoutes(contextModule: RequireContext, options?: Options): RouteNode | null {\n const route = getExactRoutesInternal(contextModule, options);\n if (!options?.ignoreEntryPoints) {\n return removeFilePath(\n crawlAndAppendEntryFilesForInitialRoutes(crawlAndAppendEntryFiles(route))\n );\n }\n\n return removeFilePath(route);\n}\n\nfunction contextModuleToTree(contextModule: RequireContext, options?: Options) {\n const allowed = processKeys(contextModule.keys(), {\n ...options,\n ignore: getIgnoreList(options),\n });\n assertDuplicateRoutes(allowed);\n const files = contextModuleToFileNodes(contextModule, options, allowed);\n return getRecursiveTree(files);\n}\n\nfunction appendSitemapRoute(routes: IntermediateRouteNode) {\n if (\n !routes.children.length ||\n // Allow overriding the sitemap route\n routes.children.some((route) => route.route === '_sitemap')\n ) {\n return routes;\n }\n routes.children.push({\n loadRoute() {\n const { Sitemap, getNavOptions } = require('./views/Sitemap');\n return { default: Sitemap, getNavOptions };\n },\n filePath: 'expo-router/build/views/Sitemap.js',\n route: '_sitemap',\n contextKey: './_sitemap.tsx',\n generated: true,\n internal: true,\n dynamic: null,\n children: [],\n });\n return routes;\n}\n\nfunction appendUnmatchedRoute(routes: IntermediateRouteNode) {\n // Auto add not found route if it doesn't exist\n const userDefinedDynamicRoute = getUserDefinedTopLevelNotFoundRoute(routes);\n if (!userDefinedDynamicRoute) {\n routes.children.push({\n loadRoute() {\n return { default: require('./views/Unmatched').Unmatched };\n },\n filePath: 'expo-router/build/views/Unmatched.js',\n route: '+not-found',\n contextKey: './+not-found.tsx',\n dynamic: [{ name: '+not-found', deep: true, notFound: true }],\n children: [],\n generated: true,\n internal: true,\n });\n }\n return routes;\n}\n\n/**\n * Exposed for testing.\n * @returns a top-level deep dynamic route if it exists, otherwise null.\n */\nexport function getUserDefinedTopLevelNotFoundRoute(routes: RouteNode | null): RouteNode | null {\n // Auto add not found route if it doesn't exist\n for (const route of routes?.children ?? []) {\n if (route.generated) continue;\n const isDeepDynamic =\n stripGroupSegmentsFromPath(route.route) === '+not-found' && route.route.match(/\\+not-found$/);\n if (isDeepDynamic) {\n return route;\n }\n // Recurse through group routes\n if (matchGroupName(route.route)) {\n const child = getUserDefinedTopLevelNotFoundRoute(route);\n if (child) {\n return child;\n }\n }\n }\n return null;\n}\n\nfunction withOptionalRootLayout(\n routes: IntermediateRouteNode[] | null\n): IntermediateRouteNode | null {\n if (!routes?.length) {\n return null;\n }\n\n if (hasCustomRootLayoutNode(routes)) {\n return routes[0];\n }\n\n return {\n loadRoute: () => ({\n default: (require('./views/Navigator') as typeof import('./views/Navigator'))\n .DefaultNavigator,\n }),\n filePath: 'expo-router/build/views/Navigator.js',\n // Generate a fake file name for the directory\n contextKey: './_layout.tsx',\n route: '',\n generated: true,\n dynamic: null,\n children: routes,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"getRoutes.js","sourceRoot":"","sources":["../src/getRoutes.ts"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aAAa,EAAE;YACjB,OAAO,KAAK,CAAC;SACd;QACD,+BAA+B;QAC/B,IAAI,IAAA,yBAAc,EAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC/B,MAAM,KAAK,GAAG,mCAAmC,CAAC,KAAK,CAAC,CAAC;YACzD,IAAI,KAAK,EAAE;gBACT,OAAO,KAAK,CAAC;aACd;SACF;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAlBD,kFAkBC;AAED,SAAS,sBAAsB,CAC7B,MAAsC;IAEtC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE;QACnB,OAAO,IAAI,CAAC;KACb;IAED,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAE;QACnC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;KAClB;IAED,OAAO;QACL,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;YAChB,OAAO,EAAG,OAAO,CAAC,mBAAmB,CAAwC;iBAC1E,gBAAgB;SACpB,CAAC;QACF,QAAQ,EAAE,sCAAsC;QAChD,8CAA8C;QAC9C,UAAU,EAAE,eAAe;QAC3B,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,MAAM;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import type { DynamicConvention, RouteNode } from './Route';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport {\n getNameFromFilePath,\n matchDeepDynamicRouteName,\n matchDynamicName,\n matchGroupName,\n removeSupportedExtensions,\n stripGroupSegmentsFromPath,\n} from './matchers';\nimport type { RequireContext } from './types';\n\nexport type FileNode = Pick<IntermediateRouteNode, 'contextKey' | 'loadRoute' | 'filePath'> & {\n /** Like `(tab)/index` */\n normalizedName: string;\n};\n\ntype IntermediateRouteNode = Omit<RouteNode, 'children'> & {\n filePath: string;\n children: IntermediateRouteNode[];\n};\n\ntype TreeNode = {\n name: string;\n children: TreeNode[];\n parents: string[];\n /** null when there is no file in a folder. */\n node: FileNode | null;\n};\n\ntype Options = {\n ignore?: RegExp[];\n preserveApiRoutes?: boolean;\n ignoreRequireErrors?: boolean;\n ignoreEntryPoints?: boolean;\n};\n\n/** Convert a flat map of file nodes into a nested tree of files. */\nexport function getRecursiveTree(files: FileNode[]): TreeNode {\n const tree = {\n name: '',\n children: [],\n parents: [],\n node: null,\n };\n\n for (const file of files) {\n // ['(tab)', 'settings', '[...another]']\n const parts = file.normalizedName.split('/');\n let currentNode: TreeNode = tree;\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n\n if (i === parts.length - 1 && part === '_layout') {\n if (currentNode.node) {\n const overwritten = currentNode.node.contextKey;\n throw new Error(\n `Higher priority Layout Route \"${file.contextKey}\" overriding redundant Layout Route \"${overwritten}\". Remove the Layout Route \"${overwritten}\" to fix this.`\n );\n }\n continue;\n }\n\n const existing = currentNode.children.find((item) => item.name === part);\n if (existing) {\n currentNode = existing;\n } else {\n const newNode: TreeNode = {\n name: part,\n children: [],\n parents: [...currentNode.parents, currentNode.name],\n node: null,\n };\n currentNode.children.push(newNode);\n currentNode = newNode;\n }\n }\n currentNode.node = file;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n assertDeprecatedFormat(tree);\n }\n\n return tree;\n}\n\nfunction assertDeprecatedFormat(tree: TreeNode) {\n for (const child of tree.children) {\n if (child.node && child.children.length && !child.node.normalizedName.endsWith('_layout')) {\n const ext = child.node.contextKey.split('.').pop();\n throw new Error(\n `Using deprecated Layout Route format: Move \\`./app/${child.node.normalizedName}.${ext}\\` to \\`./app/${child.node.normalizedName}/_layout.${ext}\\``\n );\n }\n assertDeprecatedFormat(child);\n }\n}\n\nfunction getTreeNodesAsRouteNodes(nodes: TreeNode[], options: Options): IntermediateRouteNode[] {\n return nodes\n .map((node) => treeNodeToRouteNode(node, options))\n .flat()\n .filter(Boolean) as IntermediateRouteNode[];\n}\n\nexport function generateDynamicFromSegment(name: string): DynamicConvention | null {\n if (name === '+not-found') {\n return {\n name: '+not-found',\n deep: true,\n notFound: true,\n };\n }\n\n const deepDynamicName = matchDeepDynamicRouteName(name);\n const dynamicName = deepDynamicName ?? matchDynamicName(name);\n if (!dynamicName) {\n return null;\n }\n return { name: dynamicName, deep: !!deepDynamicName };\n}\n\nexport function generateDynamic(name: string): IntermediateRouteNode['dynamic'] {\n const description = name\n .split('/')\n .map((segment) => generateDynamicFromSegment(segment))\n .filter(Boolean) as DynamicConvention[];\n return description.length === 0 ? null : description;\n}\n\nfunction collapseRouteSegments(route: string) {\n return stripGroupSegmentsFromPath(route.replace(/\\/index$/, ''));\n}\n\n/**\n * Given a route node and a name representing the group name,\n * find the nearest child matching the name.\n *\n * Doesn't support slashes in the name.\n * Routes like `explore/(something)/index` will be matched against `explore`.\n *\n */\nfunction getDefaultInitialRoute(node: IntermediateRouteNode, name: string) {\n return node.children.find((node) => collapseRouteSegments(node.route) === name);\n}\n\nfunction applyDefaultInitialRouteName(node: IntermediateRouteNode): IntermediateRouteNode {\n const groupName = matchGroupName(node.route);\n if (!node.children?.length) {\n return node;\n }\n\n // Guess at the initial route based on the group name.\n // TODO(EvanBacon): Perhaps we should attempt to warn when the group doesn't match any child routes.\n let initialRouteName = groupName ? getDefaultInitialRoute(node, groupName)?.route : undefined;\n const loaded = node.loadRoute();\n\n if (loaded?.unstable_settings) {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n initialRouteName = loaded.unstable_settings.initialRouteName ?? initialRouteName;\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName = loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n initialRouteName = groupSpecificInitialRouteName ?? initialRouteName;\n }\n }\n\n return {\n ...node,\n initialRouteName,\n };\n}\n\nfunction folderNodeToRouteNode(\n { name, children }: TreeNode,\n options: Options\n): IntermediateRouteNode[] | null {\n // Empty folder, skip it.\n if (!children.length) {\n return null;\n }\n\n // When there's a directory, but no layout route file (with valid export), the child routes won't be grouped.\n // This pushes all children into the nearest layout route.\n return getTreeNodesAsRouteNodes(\n children.map((child) => {\n return {\n ...child,\n name: [name, child.name].filter(Boolean).join('/'),\n };\n }),\n options\n );\n}\n\nfunction fileNodeToRouteNode(tree: TreeNode, options: Options): IntermediateRouteNode[] | null {\n const { name, node, children } = tree;\n\n if (!node) throw new Error('node must be defined');\n\n const dynamic = generateDynamic(name);\n\n const clones = extrapolateGroupRoutes(name, node.contextKey);\n clones.delete(name);\n\n const output = {\n loadRoute: node.loadRoute,\n route: name,\n contextKey: node.contextKey,\n children: getTreeNodesAsRouteNodes(children, options),\n dynamic,\n filePath: node.filePath,\n entryPoints:\n options.ignoreEntryPoints || isApiRoutePath(node.contextKey) ? undefined : [node.filePath],\n };\n\n if (clones.size) {\n return [...clones].map((clone) =>\n applyDefaultInitialRouteName({\n ...output,\n contextKey: node.contextKey.replace(output.route, clone),\n route: clone,\n })\n );\n }\n\n return [\n applyDefaultInitialRouteName({\n loadRoute: node.loadRoute,\n route: name,\n entryPoints:\n options.ignoreEntryPoints || isApiRoutePath(node.contextKey) ? undefined : [node.filePath],\n filePath: node.filePath,\n contextKey: node.contextKey,\n children: getTreeNodesAsRouteNodes(children, options),\n dynamic,\n }),\n ];\n}\n\nfunction extrapolateGroupRoutes(\n route: string,\n contextKey: string,\n routes: Set<string> = new Set()\n): Set<string> {\n const match = matchGroupName(route);\n\n if (!match) {\n routes.add(route);\n return routes;\n }\n\n const groups = match?.split(',');\n const groupsSet = new Set(groups);\n\n if (groupsSet.size !== groups.length) {\n throw new Error(\n `Array syntax cannot contain duplicate group name \"${groups}\" in \"${contextKey}\".`\n );\n }\n\n if (groups.length === 1) {\n routes.add(route);\n return routes;\n }\n\n for (const group of groups) {\n extrapolateGroupRoutes(route.replace(match, group.trim()), contextKey, routes);\n }\n\n return routes;\n}\n\nfunction treeNodeToRouteNode(tree: TreeNode, options: Options): IntermediateRouteNode[] | null {\n if (tree.node) {\n return fileNodeToRouteNode(tree, options);\n }\n\n return folderNodeToRouteNode(tree, options);\n}\n\nfunction contextModuleToFileNodes(\n contextModule: RequireContext,\n options: Options = {},\n files: string[] = contextModule.keys()\n): FileNode[] {\n const nodes = files.map((key) => {\n // In development, check if the file exports a default component\n // this helps keep things snappy when creating files. In production we load all screens lazily.\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 (EXPO_ROUTER_IMPORT_MODE === 'sync') {\n const isApi = key.match(/\\+api\\.[jt]sx?$/);\n if (!isApi && !contextModule(key)?.default) {\n return null;\n }\n }\n }\n const node: FileNode = {\n loadRoute() {\n if (options.ignoreRequireErrors) {\n try {\n return contextModule(key);\n } catch {\n return {};\n }\n } else {\n return contextModule(key);\n }\n },\n normalizedName: getNameFromFilePath(key),\n filePath: key,\n contextKey: key,\n };\n\n return node;\n });\n\n return nodes.filter(Boolean) as FileNode[];\n}\n\nfunction hasCustomRootLayoutNode(routes: IntermediateRouteNode[]) {\n if (routes.length !== 1) {\n return false;\n }\n // This could either be the root _layout or an app with a single file.\n const route = routes[0];\n\n if (route.route === '' && route.contextKey.match(/^\\.\\/_layout\\.([jt]sx?)$/)) {\n return true;\n }\n return false;\n}\n\nfunction treeNodesToRootRoute(treeNode: TreeNode, options: Options): IntermediateRouteNode | null {\n const routes = treeNodeToRouteNode(treeNode, options);\n return withOptionalRootLayout(routes);\n}\n\nfunction processKeys(files: string[], options: Options): string[] {\n const { ignore } = options;\n\n return files.filter((file) => {\n return !ignore?.some((pattern) => pattern.test(file));\n });\n}\n\n/**\n * Asserts if the require.context has files that share the same name but have different extensions. Exposed for testing.\n * @private\n */\nexport function assertDuplicateRoutes(filenames: string[]) {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n const duplicates = filenames\n .map((filename) => removeSupportedExtensions(filename))\n .reduce(\n (acc, filename) => {\n acc[filename] = acc[filename] ? acc[filename] + 1 : 1;\n return acc;\n },\n {} as Record<string, number>\n );\n\n Object.entries(duplicates).forEach(([filename, count]) => {\n if (count > 1) {\n throw new Error(`Multiple files match the route name \"${filename}\".`);\n }\n });\n}\n\n/** Given a Metro context module, return an array of nested routes. */\nexport function getRoutes(contextModule: RequireContext, options?: Options): RouteNode | null {\n const route = getExactRoutesInternal(contextModule, options);\n\n // If there is no route, return an empty route.\n if (!route) {\n return null;\n }\n\n appendSitemapRoute(route);\n\n // Auto add not found route if it doesn't exist\n appendUnmatchedRoute(route);\n\n if (options?.ignoreEntryPoints) {\n return removeFilePath(route);\n }\n return removeFilePath(crawlAndAppendEntryFilesForInitialRoutes(crawlAndAppendEntryFiles(route)));\n}\n\nfunction removeFilePath(route: IntermediateRouteNode | null): RouteNode | null {\n if (!route) return route;\n const { filePath, ...rest } = route;\n\n return {\n ...rest,\n children: route.children.map((child) => removeFilePath(child)).filter(Boolean) as RouteNode[],\n };\n}\n\nfunction unique<T>(array: T[]): T[] {\n return [...new Set(array)];\n}\n\nfunction isLayoutRoute(route: IntermediateRouteNode) {\n return route.contextKey.match(/\\/_layout\\.([jt]sx?)$/);\n}\n\nfunction isViewRoute(route?: IntermediateRouteNode | null): route is IntermediateRouteNode {\n return !!route && !isApiRoute(route);\n}\nfunction isApiRoute(route: IntermediateRouteNode) {\n return isApiRoutePath(route.contextKey);\n}\nfunction isApiRoutePath(route: string): boolean {\n return !!route.match(/\\+api\\.[jt]sx?$/);\n}\n\nfunction crawlAndAppendEntryFiles(\n route: IntermediateRouteNode | null,\n entryPoints: string[] = []\n): IntermediateRouteNode | null {\n if (!isViewRoute(route)) {\n return null;\n }\n const nextEntryPoints = unique([...entryPoints, ...(route.entryPoints ?? []), route.filePath]);\n\n route.children.forEach((child) => {\n crawlAndAppendEntryFiles(child, nextEntryPoints);\n });\n\n // Skip adding entry points for layout routes since we only need them\n // for rendering child nodes.\n if (isLayoutRoute(route)) {\n delete route.entryPoints;\n } else {\n route.entryPoints = nextEntryPoints;\n }\n\n return route;\n}\n\nfunction crawlAndAppendEntryFilesForInitialRoutes(\n route: IntermediateRouteNode | null,\n initialRoutes: IntermediateRouteNode[] = []\n): IntermediateRouteNode | null {\n if (!isViewRoute(route)) {\n return null;\n }\n\n // Skip adding entry points for layout routes since we only need them\n // for rendering child nodes.\n if (isLayoutRoute(route)) {\n if (route.initialRouteName) {\n const initialRoute = route.children.find((child) => child.route === route.initialRouteName);\n if (!initialRoute) {\n throw new Error(\n `Invalid initialRouteName \"${route.initialRouteName}\" defined in ${\n route.filePath\n }. Options are: ${route.children.map((route) => route.route).join(', ')}`\n );\n }\n // Update all children to include the entry points from the initial route...\n\n route.children.forEach((child) => {\n crawlAndAppendEntryFilesForInitialRoutes(child, [...initialRoutes, initialRoute]);\n });\n }\n } else {\n const isInitial = initialRoutes.some(\n (initialRoute) => initialRoute.contextKey === route.contextKey\n );\n if (!isInitial) {\n route.entryPoints = unique([\n ...initialRoutes.map((route) => route.entryPoints ?? []).flat(),\n ...(route.entryPoints ?? []),\n ]);\n }\n }\n\n return route;\n}\n\nfunction 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\nfunction getExactRoutesInternal(\n contextModule: RequireContext,\n options: Options = {}\n): IntermediateRouteNode | null {\n const treeNodes = contextModuleToTree(contextModule, options);\n return treeNodesToRootRoute(treeNodes, options);\n}\n\n/** Get routes without unmatched or sitemap. */\nexport function getExactRoutes(contextModule: RequireContext, options?: Options): RouteNode | null {\n const route = getExactRoutesInternal(contextModule, options);\n if (!options?.ignoreEntryPoints) {\n return removeFilePath(\n crawlAndAppendEntryFilesForInitialRoutes(crawlAndAppendEntryFiles(route))\n );\n }\n\n return removeFilePath(route);\n}\n\nfunction contextModuleToTree(contextModule: RequireContext, options?: Options) {\n const allowed = processKeys(contextModule.keys(), {\n ...options,\n ignore: getIgnoreList(options),\n });\n assertDuplicateRoutes(allowed);\n const files = contextModuleToFileNodes(contextModule, options, allowed);\n return getRecursiveTree(files);\n}\n\nfunction appendSitemapRoute(routes: IntermediateRouteNode) {\n if (\n !routes.children.length ||\n // Allow overriding the sitemap route\n routes.children.some((route) => route.route === '_sitemap')\n ) {\n return routes;\n }\n routes.children.push({\n loadRoute() {\n const { Sitemap, getNavOptions } = require('./views/Sitemap');\n return { default: Sitemap, getNavOptions };\n },\n filePath: 'expo-router/build/views/Sitemap.js',\n route: '_sitemap',\n contextKey: './_sitemap.tsx',\n generated: true,\n internal: true,\n dynamic: null,\n children: [],\n });\n return routes;\n}\n\nfunction appendUnmatchedRoute(routes: IntermediateRouteNode) {\n // Auto add not found route if it doesn't exist\n const userDefinedDynamicRoute = getUserDefinedTopLevelNotFoundRoute(routes);\n if (!userDefinedDynamicRoute) {\n routes.children.push({\n loadRoute() {\n return { default: require('./views/Unmatched').Unmatched };\n },\n filePath: 'expo-router/build/views/Unmatched.js',\n route: '+not-found',\n contextKey: './+not-found.tsx',\n dynamic: [{ name: '+not-found', deep: true, notFound: true }],\n children: [],\n generated: true,\n internal: true,\n });\n }\n return routes;\n}\n\n/**\n * Exposed for testing.\n * @returns a top-level deep dynamic route if it exists, otherwise null.\n */\nexport function getUserDefinedTopLevelNotFoundRoute(routes: RouteNode | null): RouteNode | null {\n // Auto add not found route if it doesn't exist\n for (const route of routes?.children ?? []) {\n if (route.generated) continue;\n const isDeepDynamic =\n stripGroupSegmentsFromPath(route.route) === '+not-found' && route.route.match(/\\+not-found$/);\n if (isDeepDynamic) {\n return route;\n }\n // Recurse through group routes\n if (matchGroupName(route.route)) {\n const child = getUserDefinedTopLevelNotFoundRoute(route);\n if (child) {\n return child;\n }\n }\n }\n return null;\n}\n\nfunction withOptionalRootLayout(\n routes: IntermediateRouteNode[] | null\n): IntermediateRouteNode | null {\n if (!routes?.length) {\n return null;\n }\n\n if (hasCustomRootLayoutNode(routes)) {\n return routes[0];\n }\n\n return {\n loadRoute: () => ({\n default: (require('./views/Navigator') as typeof import('./views/Navigator'))\n .DefaultNavigator,\n }),\n filePath: 'expo-router/build/views/Navigator.js',\n // Generate a fake file name for the directory\n contextKey: './_layout.tsx',\n route: '',\n generated: true,\n dynamic: null,\n children: routes,\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.6",
|
|
4
4
|
"description": "Expo Router is a file-based router for React Native and web applications.",
|
|
5
5
|
"author": "650 Industries, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -91,15 +91,15 @@
|
|
|
91
91
|
"tsd": "^0.28.1"
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
|
-
"@expo/metro-runtime": "3.1.
|
|
94
|
+
"@expo/metro-runtime": "3.1.2",
|
|
95
95
|
"@expo/server": "^0.3.0",
|
|
96
96
|
"@radix-ui/react-slot": "1.0.1",
|
|
97
97
|
"@react-navigation/bottom-tabs": "~6.5.7",
|
|
98
98
|
"@react-navigation/native": "~6.1.6",
|
|
99
99
|
"@react-navigation/native-stack": "~6.9.12",
|
|
100
|
-
"expo-splash-screen": "0.26.
|
|
100
|
+
"expo-splash-screen": "0.26.4",
|
|
101
101
|
"react-helmet-async": "^1.3.0",
|
|
102
102
|
"schema-utils": "^4.0.1"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "82b69cba5b2e967806ca03413c3277f1d53bff8d"
|
|
105
105
|
}
|