| 1 | |
| 2 | * react-router v8.3.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 |
|
| 12 | function createRSCRouteModules(payload) {
|
| 13 | const routeModules = {};
|
| 14 | for (const match of payload.matches) populateRSCRouteModules(routeModules, match);
|
| 15 | return routeModules;
|
| 16 | }
|
| 17 | function 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 | }
|
| 25 | const noopComponent = () => null;
|
| 26 |
|
| 27 | export { createRSCRouteModules, populateRSCRouteModules };
|