Merge pull request #31166 from schultzp2020/constructor-parameters

refactor: convert constructor parameter properties for erasableSyntaxOnly compatibility
This commit is contained in:
Patrik Oldsberg
2025-10-15 18:56:42 +02:00
committed by GitHub
187 changed files with 1893 additions and 728 deletions
@@ -179,18 +179,31 @@ function resolveBasePath(
}
export class RouteResolver implements RouteResolutionApi {
private readonly routePaths: Map<RouteRef, string>;
private readonly routeParents: Map<RouteRef, RouteRef | undefined>;
private readonly routeObjects: BackstageRouteObject[];
private readonly routeBindings: Map<ExternalRouteRef, RouteRef | SubRouteRef>;
private readonly appBasePath: string; // base path without a trailing slash
private readonly routeAliasResolver: RouteAliasResolver;
private readonly routeRefsById: Map<string, RouteRef | SubRouteRef>;
constructor(
private readonly routePaths: Map<RouteRef, string>,
private readonly routeParents: Map<RouteRef, RouteRef | undefined>,
private readonly routeObjects: BackstageRouteObject[],
private readonly routeBindings: Map<
ExternalRouteRef,
RouteRef | SubRouteRef
>,
private readonly appBasePath: string, // base path without a trailing slash
private readonly routeAliasResolver: RouteAliasResolver,
private readonly routeRefsById: Map<string, RouteRef | SubRouteRef>,
) {}
routePaths: Map<RouteRef, string>,
routeParents: Map<RouteRef, RouteRef | undefined>,
routeObjects: BackstageRouteObject[],
routeBindings: Map<ExternalRouteRef, RouteRef | SubRouteRef>,
appBasePath: string, // base path without a trailing slash
routeAliasResolver: RouteAliasResolver,
routeRefsById: Map<string, RouteRef | SubRouteRef>,
) {
this.routePaths = routePaths;
this.routeParents = routeParents;
this.routeObjects = routeObjects;
this.routeBindings = routeBindings;
this.appBasePath = appBasePath;
this.routeAliasResolver = routeAliasResolver;
this.routeRefsById = routeRefsById;
}
resolve<TParams extends AnyRouteRefParams>(
anyRouteRef:
@@ -115,11 +115,13 @@ function deduplicateFeatures(
// Helps delay callers from reaching out to the API before the app tree has been materialized
class AppTreeApiProxy implements AppTreeApi {
#routeInfo?: RouteInfo;
private readonly tree: AppTree;
private readonly appBasePath: string;
constructor(
private readonly tree: AppTree,
private readonly appBasePath: string,
) {}
constructor(tree: AppTree, appBasePath: string) {
this.tree = tree;
this.appBasePath = appBasePath;
}
private checkIfInitialized() {
if (!this.#routeInfo) {
@@ -163,13 +165,16 @@ class RouteResolutionApiProxy implements RouteResolutionApi {
#delegate: RouteResolutionApi | undefined;
#routeObjects: BackstageRouteObject[] | undefined;
private readonly routeBindings: Map<ExternalRouteRef, RouteRef | SubRouteRef>;
private readonly appBasePath: string;
constructor(
private readonly routeBindings: Map<
ExternalRouteRef,
RouteRef | SubRouteRef
>,
private readonly appBasePath: string,
) {}
routeBindings: Map<ExternalRouteRef, RouteRef | SubRouteRef>,
appBasePath: string,
) {
this.routeBindings = routeBindings;
this.appBasePath = appBasePath;
}
resolve<TParams extends AnyRouteRefParams>(
anyRouteRef: