Skip to content

Commit 6011f3b

Browse files
committed
Rename memory/cache to full/layer
1 parent 17e9e55 commit 6011f3b

14 files changed

Lines changed: 217 additions & 215 deletions

File tree

packages/typescript/src/api/async/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,8 +1439,8 @@ export class Program implements FormatDiagnosticsHost {
14391439
}
14401440

14411441
/**
1442-
* Emits files to the configured filesystem. Cache and host filesystems are
1443-
* written through; memory filesystems remain immutable and return emitted
1442+
* Emits files to the configured filesystem. Layer and host filesystems are
1443+
* written through; full filesystems remain immutable and return emitted
14441444
* files in {@link EmitResult.fileSystem}.
14451445
*/
14461446
async emit(emitOnly?: EmitOnly): Promise<EmitResult> {
@@ -1451,7 +1451,7 @@ export class Program implements FormatDiagnosticsHost {
14511451
});
14521452
const fileSystem = response.emittedFilesContents.length
14531453
? {
1454-
kind: "cache" as const,
1454+
kind: "layer" as const,
14551455
files: Object.fromEntries(response.emittedFiles.map((fileName, index) => [fileName, response.emittedFilesContents[index]])),
14561456
}
14571457
: undefined;

packages/typescript/src/api/async/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ export interface EmitResult {
404404
readonly emitSkipped: boolean;
405405
readonly diagnostics: readonly Diagnostic[];
406406
readonly emittedFiles: readonly string[];
407-
/** Emitted files captured as a cache layer suitable for {@link Snapshot.update}. */
407+
/** Emitted files captured as a filesystem layer suitable for {@link Snapshot.update}. */
408408
readonly fileSystem?: RequestFileSystem | undefined;
409409
}
410410

packages/typescript/src/api/fs.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ export interface FileSystem {
3838
/** The callback names supported by the Go server for virtual FS delegation. */
3939
export const fsCallbackNames = ["readFile", "fileExists", "directoryExists", "getAccessibleEntries", "realpath", "writeFile"] as const;
4040

41-
export interface CreateRequestFileSystemOptions {
42-
/** Complete directory listings. Memory filesystems derive these from `files` when omitted. */
41+
export interface CreateFileSystemOptions {
42+
/** Complete directory listings. Full filesystems derive these from `files` when omitted. */
4343
directories?: Record<string, RequestDirectoryEntries>;
4444
symlinks?: Record<string, RequestSymlink>;
4545
/** Files or directory trees hidden from an underlying snapshot or host filesystem. */
4646
removedPaths?: readonly string[];
4747
}
4848

49-
export interface CreateMemoryFileSystemWithLibOptions extends CreateRequestFileSystemOptions {
49+
export interface CreateFileSystemWithLibOptions extends CreateFileSystemOptions {
5050
/** Default library directory used by a custom or non-embedded compiler executable. */
5151
defaultLibraryPath?: string;
5252
}
@@ -57,21 +57,21 @@ export interface CreateMemoryFileSystemWithLibOptions extends CreateRequestFileS
5757
*/
5858
export type RequestFileEntries = readonly (readonly [id: DocumentIdentifier, content: string])[];
5959

60-
/** Creates a total memory request filesystem, deriving directory listings when omitted. */
61-
export function createMemoryFileSystem(
60+
/** Creates a full request filesystem, deriving directory listings when omitted. */
61+
export function createFileSystem(
6262
files: RequestFileEntries,
63-
options: CreateRequestFileSystemOptions = {},
63+
options: CreateFileSystemOptions = {},
6464
): RequestFileSystem {
65-
return createRequestFileSystem("memory", files, options);
65+
return createRequestFileSystem("full", files, options);
6666
}
6767

6868
/**
69-
* Creates a total memory request filesystem with the compiler's default library
69+
* Creates a full request filesystem with the compiler's default library
7070
* directory mounted read-only through the host filesystem.
7171
*/
72-
export function createMemoryFileSystemWithLib(
72+
export function createFileSystemWithLib(
7373
files: RequestFileEntries,
74-
options: CreateMemoryFileSystemWithLibOptions = {},
74+
options: CreateFileSystemWithLibOptions = {},
7575
): RequestFileSystem {
7676
const defaultLibraryPaths = options.defaultLibraryPath
7777
? [normalizePath(options.defaultLibraryPath)]
@@ -89,25 +89,25 @@ export function createMemoryFileSystemWithLib(
8989
for (const defaultLibraryPath of defaultLibraryPaths) {
9090
symlinks[defaultLibraryPath] ??= { target: defaultLibraryPath, host: true };
9191
}
92-
return createRequestFileSystem("memory", files, {
92+
return createRequestFileSystem("full", files, {
9393
symlinks,
9494
...(options.directories ? { directories: options.directories } : {}),
9595
...(options.removedPaths?.length ? { removedPaths: options.removedPaths } : {}),
9696
});
9797
}
9898

99-
/** Creates a read-through cache request filesystem, merging host directory listings when omitted. */
100-
export function createCacheFileSystem(
99+
/** Creates a request filesystem layer, merging base directory listings when omitted. */
100+
export function createFileSystemLayer(
101101
files: RequestFileEntries,
102-
options: CreateRequestFileSystemOptions = {},
102+
options: CreateFileSystemOptions = {},
103103
): RequestFileSystem {
104-
return createRequestFileSystem("cache", files, options);
104+
return createRequestFileSystem("layer", files, options);
105105
}
106106

107107
function createRequestFileSystem(
108108
kind: RequestFileSystem["kind"],
109109
files: RequestFileEntries,
110-
options: CreateRequestFileSystemOptions,
110+
options: CreateFileSystemOptions,
111111
): RequestFileSystem {
112112
const normalizedFiles = new Map<string, string>();
113113
for (const [id, content] of files) {
@@ -118,7 +118,7 @@ function createRequestFileSystem(
118118
normalizedFiles.set(fileName, content);
119119
}
120120
const fileRecord = Object.fromEntries(normalizedFiles);
121-
const directories = options.directories ?? (kind === "memory" ? deriveDirectoryListings(fileRecord) : undefined);
121+
const directories = options.directories ?? (kind === "full" ? deriveDirectoryListings(fileRecord) : undefined);
122122
return {
123123
kind,
124124
files: fileRecord,

packages/typescript/src/api/proto.generated.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export interface UpdateSnapshotParams {
208208
fileChanges?: APIFileChanges;
209209
/**
210210
* FileSystem supplies file contents and directory listings for the new snapshot.
211-
* A memory filesystem is canonical and total. A cache filesystem is checked
211+
* A full filesystem is canonical and total. A filesystem layer is checked
212212
* before falling back to the host filesystem.
213213
*/
214214
fileSystem?: RequestFileSystem;
@@ -865,7 +865,7 @@ export interface EmitResponse {
865865
emittedFiles: string[];
866866
/**
867867
* EmittedFilesContents contains contents parallel to EmittedFiles when the
868-
* source snapshot uses a memory filesystem. It is empty for write-through emits.
868+
* source snapshot uses a full filesystem. It is empty for write-through emits.
869869
*/
870870
emittedFilesContents: string[];
871871
}
@@ -1228,7 +1228,7 @@ export interface APIFileChanges {
12281228
* for a request that creates a snapshot.
12291229
*/
12301230
export interface RequestFileSystem {
1231-
kind: "cache" | "memory";
1231+
kind: "full" | "layer";
12321232
/** Files maps file names to their complete contents. */
12331233
files: Record<string, string>;
12341234
/** Directories maps directory names to complete listing results. */
@@ -1451,7 +1451,7 @@ export interface RequestSymlink {
14511451
target: string;
14521452
/**
14531453
* Host routes the target through the host filesystem. This is the only way a
1454-
* memory filesystem can access paths not supplied in the request filesystem.
1454+
* full filesystem can access paths not supplied in the request filesystem.
14551455
*/
14561456
host?: boolean;
14571457
}

packages/typescript/src/api/sync/api.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,8 +2794,8 @@ export class Program implements FormatDiagnosticsHost {
27942794
}
27952795

27962796
/**
2797-
* Emits files to the configured filesystem. Cache and host filesystems are
2798-
* written through; memory filesystems remain immutable and return emitted
2797+
* Emits files to the configured filesystem. Layer and host filesystems are
2798+
* written through; full filesystems remain immutable and return emitted
27992799
* files in {@link EmitResult.fileSystem}.
28002800
*/
28012801
get emit(): {
@@ -2814,7 +2814,7 @@ export class Program implements FormatDiagnosticsHost {
28142814
});
28152815
const fileSystem = response.emittedFilesContents.length
28162816
? {
2817-
kind: "cache" as const,
2817+
kind: "layer" as const,
28182818
files: Object.fromEntries(response.emittedFiles.map((fileName, index) => [fileName, response.emittedFilesContents[index]])),
28192819
}
28202820
: undefined;
@@ -2833,7 +2833,7 @@ export class Program implements FormatDiagnosticsHost {
28332833
});
28342834
const fileSystem = response.emittedFilesContents.length
28352835
? {
2836-
kind: "cache" as const,
2836+
kind: "layer" as const,
28372837
files: Object.fromEntries(response.emittedFiles.map((fileName, index) => [fileName, response.emittedFilesContents[index]])),
28382838
}
28392839
: undefined;

packages/typescript/src/api/sync/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ export interface EmitResult {
528528
readonly emitSkipped: boolean;
529529
readonly diagnostics: readonly Diagnostic[];
530530
readonly emittedFiles: readonly string[];
531-
/** Emitted files captured as a cache layer suitable for {@link Snapshot.update}. */
531+
/** Emitted files captured as a filesystem layer suitable for {@link Snapshot.update}. */
532532
readonly fileSystem?: RequestFileSystem | undefined;
533533
}
534534

0 commit comments

Comments
 (0)