File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
packages/router/src/experimental Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,13 @@ export {
3939
4040export { miss , MatchMiss } from './route-resolver/matchers/errors'
4141
42+ /**
43+ * Internal functions and types for the experimental router.
44+ * They should all be prefixed with `_` to avoid conflicts with the public API.
45+ */
46+
47+ export { mergeRouteRecord as _mergeRouteRecord } from './router'
48+
4249// in the new experimental router, there are only parents
4350// this should create type errors if someone is realying on children
4451declare module 'vue-router' {
Original file line number Diff line number Diff line change @@ -370,6 +370,27 @@ export function normalizeRouteRecord(
370370 | EXPERIMENTAL_RouteRecordNormalized_Group
371371}
372372
373+ /**
374+ * Merges route record objects for the experimental resolver format.
375+ * This function is specifically designed to work with objects that will be passed to normalizeRouteRecord().
376+ *
377+ * @internal
378+ *
379+ * @param main - main route record object
380+ * @param routeRecords - route records to merge (from definePage imports)
381+ * @returns merged route record object
382+ */
383+ export function mergeRouteRecord (
384+ main : EXPERIMENTAL_RouteRecordNormalized ,
385+ // TODO: actual type
386+ ...routeRecords : Partial < EXPERIMENTAL_RouteRecordNormalized > [ ]
387+ ) {
388+ for ( const record of routeRecords ) {
389+ main . meta = { ...main . meta , ...record . meta }
390+ }
391+ return main
392+ }
393+
373394// TODO: probably need some generic types
374395// <TResolver extends NEW_RouterResolver_Base>,
375396/**
You can’t perform that action at this time.
0 commit comments