Files
clean-architecture-frontend…/src/features/installed-feature-runtimes.tsx
T

39 lines
1.3 KiB
TypeScript

import { PLATFORM_ROUTE_CODECS } from "../presentation/routes/platform-route-codecs.ts";
import { PLATFORM_ROUTE_RUNTIME } from "../presentation/routes/route-runtime.tsx";
import { REFERENCE_FEATURE_RUNTIME_CONTRIBUTION } from "./reference-feature/presentation/reference-feature-runtime.tsx";
import { INSTALLED_PRODUCT_FEATURE_IDS } from "./installed-product-manifest.ts";
const COMPILED_FEATURE_RUNTIME_CONTRIBUTIONS = Object.freeze([
REFERENCE_FEATURE_RUNTIME_CONTRIBUTION,
] as const);
const INSTALLED_FEATURE_RUNTIME_CONTRIBUTIONS =
COMPILED_FEATURE_RUNTIME_CONTRIBUTIONS.filter((contribution) =>
INSTALLED_PRODUCT_FEATURE_IDS.includes(contribution.featureId),
);
/**
* Central runtime catalogs only aggregate feature-owned contributions.
* Adding route codecs/components to a feature no longer requires duplicating
* reference-specific selection logic in this composition file.
*/
export const ROUTE_CODECS = Object.freeze(
Object.assign(
{},
PLATFORM_ROUTE_CODECS,
...INSTALLED_FEATURE_RUNTIME_CONTRIBUTIONS.map(
(contribution) => contribution.routeCodecs,
),
),
);
export const ROUTE_RUNTIME = Object.freeze(
Object.assign(
{},
PLATFORM_ROUTE_RUNTIME,
...INSTALLED_FEATURE_RUNTIME_CONTRIBUTIONS.map(
(contribution) => contribution.routeRuntime,
),
),
);