UNPKG

784 BJavaScriptView Raw
1/**
2 * react-router v8.0.0
3 *
4 * Copyright (c) Remix Software Inc.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE.md file in the root directory of this source tree.
8 *
9 * @license MIT
10 */
11//#region lib/rsc/route-modules.ts
12function createRSCRouteModules(payload) {
13 const routeModules = {};
14 for (const match of payload.matches) populateRSCRouteModules(routeModules, match);
15 return routeModules;
16}
17function populateRSCRouteModules(routeModules, matches) {
18 matches = Array.isArray(matches) ? matches : [matches];
19 for (const match of matches) routeModules[match.id] = {
20 links: match.links,
21 meta: match.meta,
22 default: noopComponent
23 };
24}
25const noopComponent = () => null;
26//#endregion
27export { createRSCRouteModules, populateRSCRouteModules };