UNPKG

1.96 kBTypeScriptView Raw
1import type { Deserializer, Serializer } from "../serialization/index.js";
2import type { FileRegistry as JSONFileRegistry } from "../serialization/schema.js";
3import type { ProjectReflection, Reflection } from "./reflections/index.js";
4import type { ReflectionId } from "./reflections/abstract.js";
5export declare class FileRegistry {
6 protected nextId: number;
7 protected mediaToReflection: Map<number, ReflectionId>;
8 protected mediaToPath: Map<number, string>;
9 protected reflectionToPath: Map<ReflectionId, string>;
10 protected pathToMedia: Map<string, number>;
11 protected names: Map<number, string>;
12 protected nameUsage: Map<string, number>;
13 registerAbsolute(absolute: string): {
14 target: number;
15 anchor: string | undefined;
16 };
17 /** Called by {@link ProjectReflection.registerReflection} @internal*/
18 registerReflection(absolute: string, reflection: Reflection): void;
19 getReflectionPath(reflection: Reflection): string | undefined;
20 register(sourcePath: string, relativePath: string): {
21 target: number;
22 anchor: string | undefined;
23 } | undefined;
24 removeReflection(reflection: Reflection): void;
25 resolve(id: number, project: ProjectReflection): string | Reflection | undefined;
26 getName(id: number): string | undefined;
27 getNameToAbsoluteMap(): ReadonlyMap<string, string>;
28 toObject(ser: Serializer): JSONFileRegistry;
29 /**
30 * Revive a file registry from disc.
31 * Note that in the packages context this may be called multiple times on
32 * a single object, and should merge in files from the other registries.
33 */
34 fromObject(de: Deserializer, obj: JSONFileRegistry): void;
35}
36export declare class ValidatingFileRegistry extends FileRegistry {
37 register(sourcePath: string, relativePath: string): {
38 target: number;
39 anchor: string | undefined;
40 } | undefined;
41 fromObject(de: Deserializer, obj: JSONFileRegistry): void;
42}