refactor: 프론트 템플릿 리펙토링
This commit is contained in:
@@ -1,28 +1,38 @@
|
||||
import { PLATFORM_ROUTE_CODECS } from "../presentation/routes/platform-route-codecs.ts";
|
||||
import { PLATFORM_ROUTE_RUNTIME } from "../presentation/routes/route-runtime.tsx";
|
||||
import {
|
||||
REFERENCE_FEATURE_ROUTE_CODECS,
|
||||
REFERENCE_FEATURE_ROUTE_RUNTIME,
|
||||
} from "./reference-feature/presentation/reference-feature-runtime.tsx";
|
||||
import { REFERENCE_FEATURE_ID } from "./reference-feature/contracts/reference-feature-contract.ts";
|
||||
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),
|
||||
);
|
||||
|
||||
/**
|
||||
* §3.5. A feature the manifest did not select contributes no codec and no route
|
||||
* component, so the router has nothing to mount for it. The module is still
|
||||
* linked — a static import cannot be undone by a value — which is why physical
|
||||
* removal is FE-GATE-020's job and this is deselection, not deletion.
|
||||
* 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.
|
||||
*/
|
||||
const referenceSelected = INSTALLED_PRODUCT_FEATURE_IDS.includes(
|
||||
REFERENCE_FEATURE_ID,
|
||||
export const ROUTE_CODECS = Object.freeze(
|
||||
Object.assign(
|
||||
{},
|
||||
PLATFORM_ROUTE_CODECS,
|
||||
...INSTALLED_FEATURE_RUNTIME_CONTRIBUTIONS.map(
|
||||
(contribution) => contribution.routeCodecs,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
export const ROUTE_CODECS = Object.freeze({
|
||||
...PLATFORM_ROUTE_CODECS,
|
||||
...(referenceSelected ? REFERENCE_FEATURE_ROUTE_CODECS : {}),
|
||||
});
|
||||
|
||||
export const ROUTE_RUNTIME = Object.freeze({
|
||||
...PLATFORM_ROUTE_RUNTIME,
|
||||
...(referenceSelected ? REFERENCE_FEATURE_ROUTE_RUNTIME : {}),
|
||||
});
|
||||
export const ROUTE_RUNTIME = Object.freeze(
|
||||
Object.assign(
|
||||
{},
|
||||
PLATFORM_ROUTE_RUNTIME,
|
||||
...INSTALLED_FEATURE_RUNTIME_CONTRIBUTIONS.map(
|
||||
(contribution) => contribution.routeRuntime,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user