nx
Version:
51 lines (50 loc) • 2.31 kB
TypeScript
import { ProjectConfiguration } from '../../../config/workspace-json-project-json';
/**
* Sentinel placed in `inputs` / `dependsOn` for a pending project-name
* reference. `RootRef` carries the referenced project's root (resolved
* via nameMap lookup); `UsageRef` carries the raw written name (for
* forward refs, promoted to `RootRef` in place when the name is
* identified). `parent` + `key` let the final pass write the resolved
* name back; `targetPart` preserves the `:target` suffix from
* `dependsOn` strings.
*/
export declare abstract class NameRef {
value: string;
parent: unknown;
key: string | undefined;
targetPart: string | undefined;
constructor(value: string, parent: unknown, key: string | undefined, targetPart: string | undefined);
}
export declare class RootRef extends NameRef {
}
export declare class UsageRef extends NameRef {
}
export declare function isNameRef(value: unknown): value is NameRef;
export declare function isRootRef(value: unknown): value is RootRef;
export declare function isUsageRef(value: unknown): value is UsageRef;
/**
* Replaces project-name refs in plugin results with in-place sentinels,
* then resolves them after all merging is done.
*
* Tracking by array position breaks once `'...'` spreads shuffle indices,
* so each ref becomes a sentinel object. Arrays spread-merge by pushing
* element references, so sentinel identity survives any downstream
* merges — the final pass walks a flat registry and writes the resolved
* name back through each sentinel's `parent` back-reference. Orphaned
* sentinels (from arrays dropped by a full-replace) write harmlessly.
*/
export declare class ProjectNameInNodePropsManager {
private getNameMap;
private allRefs;
private pendingByName;
constructor(getNameMap?: () => Record<string, ProjectConfiguration>);
registerNameRefs(pluginResultProjects?: Record<string, Omit<ProjectConfiguration, 'root'> & Partial<ProjectConfiguration>>): void;
private processInputs;
private processDependsOn;
private processProjectsArray;
private createRef;
identifyProjectWithRoot(root: string, name: string): void;
applySubstitutions(rootMap: Record<string, ProjectConfiguration>): void;
private resolveFinalName;
private writeReplacement;
}