typescript 7.1.0-dev.20260930.4 → 7.1.0-dev.20261002.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/api/async/api.d.ts +32 -24
  2. package/dist/api/async/api.d.ts.map +1 -1
  3. package/dist/api/async/api.js +142 -54
  4. package/dist/api/async/api.js.map +1 -1
  5. package/dist/api/compilerOptions.generated.d.ts +122 -0
  6. package/dist/api/compilerOptions.generated.d.ts.map +1 -0
  7. package/dist/api/compilerOptions.generated.js +8 -0
  8. package/dist/api/compilerOptions.generated.js.map +1 -0
  9. package/dist/api/node/node.d.ts +6 -1
  10. package/dist/api/node/node.d.ts.map +1 -1
  11. package/dist/api/node/node.js +4 -1
  12. package/dist/api/node/node.js.map +1 -1
  13. package/dist/api/path.d.ts.map +1 -1
  14. package/dist/api/path.js +194 -11
  15. package/dist/api/path.js.map +1 -1
  16. package/dist/api/proto.d.ts +1 -0
  17. package/dist/api/proto.d.ts.map +1 -1
  18. package/dist/api/proto.generated.d.ts +44 -153
  19. package/dist/api/proto.generated.d.ts.map +1 -1
  20. package/dist/api/proto.generated.js +1 -10
  21. package/dist/api/proto.generated.js.map +1 -1
  22. package/dist/api/proto.js +1 -0
  23. package/dist/api/proto.js.map +1 -1
  24. package/dist/api/sourceFileCache.d.ts +8 -2
  25. package/dist/api/sourceFileCache.d.ts.map +1 -1
  26. package/dist/api/sourceFileCache.js +30 -12
  27. package/dist/api/sourceFileCache.js.map +1 -1
  28. package/dist/api/sync/api.d.ts +38 -24
  29. package/dist/api/sync/api.d.ts.map +1 -1
  30. package/dist/api/sync/api.js +168 -64
  31. package/dist/api/sync/api.js.map +1 -1
  32. package/dist/api/userPreferences.generated.d.ts +195 -0
  33. package/dist/api/userPreferences.generated.d.ts.map +1 -0
  34. package/dist/api/userPreferences.generated.js +3 -0
  35. package/dist/api/userPreferences.generated.js.map +1 -0
  36. package/dist/enums/jsxEmit.enum.js +1 -1
  37. package/dist/enums/jsxEmit.enum.js.map +1 -1
  38. package/dist/enums/jsxEmit.js +1 -1
  39. package/dist/enums/jsxEmit.js.map +1 -1
  40. package/dist/enums/moduleDetectionKind.enum.js +1 -1
  41. package/dist/enums/moduleDetectionKind.enum.js.map +1 -1
  42. package/dist/enums/moduleDetectionKind.js +1 -1
  43. package/dist/enums/moduleDetectionKind.js.map +1 -1
  44. package/dist/enums/moduleKind.enum.js +1 -1
  45. package/dist/enums/moduleKind.enum.js.map +1 -1
  46. package/dist/enums/moduleKind.js +1 -1
  47. package/dist/enums/moduleKind.js.map +1 -1
  48. package/dist/enums/moduleResolutionKind.enum.js +1 -1
  49. package/dist/enums/moduleResolutionKind.enum.js.map +1 -1
  50. package/dist/enums/moduleResolutionKind.js +1 -1
  51. package/dist/enums/moduleResolutionKind.js.map +1 -1
  52. package/dist/enums/newLineKind.enum.js +1 -1
  53. package/dist/enums/newLineKind.enum.js.map +1 -1
  54. package/dist/enums/newLineKind.js +1 -1
  55. package/dist/enums/newLineKind.js.map +1 -1
  56. package/dist/enums/scriptTarget.d.ts.map +1 -1
  57. package/dist/enums/scriptTarget.enum.d.ts.map +1 -1
  58. package/dist/enums/scriptTarget.enum.js +1 -0
  59. package/dist/enums/scriptTarget.enum.js.map +1 -1
  60. package/dist/enums/scriptTarget.js +1 -0
  61. package/dist/enums/scriptTarget.js.map +1 -1
  62. package/dist/enums/syntaxKind.enum.js +1 -1
  63. package/dist/enums/syntaxKind.enum.js.map +1 -1
  64. package/dist/enums/syntaxKind.js +1 -1
  65. package/dist/enums/syntaxKind.js.map +1 -1
  66. package/package.json +12 -9
  67. package/schemas/jsconfig.schema.json +2205 -0
  68. package/schemas/tsconfig.schema.json +2204 -0
@@ -21,7 +21,7 @@ import { TypePredicateKind } from "#enums/typePredicateKind";
21
21
  import { ModifierFlags, unescapeLeadingUnderscores, } from "../../ast/index.js";
22
22
  import { assertNever } from "../../internal/utils.js";
23
23
  import { encodeNode, uint8ArrayToBase64, } from "../node/encoder.js";
24
- import { decodeNode, getNodeId, parseNodeHandle, readSourceFileLease, RemoteSourceFile, } from "../node/node.js";
24
+ import { decodeNode, getNodeId, parseNodeHandle, readSourceFileLease, RemoteNode, RemoteSourceFile, } from "../node/node.js";
25
25
  import { Wtf8Decoder } from "../node/wtf8.js";
26
26
  import { createGetCanonicalFileName, toPath, } from "../path.js";
27
27
  import { resolveFileName, toCreateSnapshotRequest, validateSymbolResponse, } from "../proto.js";
@@ -52,7 +52,9 @@ function registerModuleResolutionCallback(client, callback, getSnapshot) {
52
52
  // import { sourceFileResponseToUint8Array } from "../node/encoder.ts";
53
53
  // @sync-only-end
54
54
  export class API {
55
+ /** @internal */
55
56
  client;
57
+ /** @internal */
56
58
  sourceFileCache;
57
59
  toPath;
58
60
  currentDirectory;
@@ -71,6 +73,52 @@ export class API {
71
73
  this.printer = new Printer(this.client);
72
74
  this.internal = new InternalAPI(this.client, () => this.ensureInitialized()); // @sync: this.internal = new InternalAPI(this.client, this.ensureInitialized);
73
75
  }
76
+ /**
77
+ * Looks up a remote declaration's binder symbol. Throws for synthesized or configuration ASTs.
78
+ */
79
+ async getSymbol(declaration) {
80
+ const file = getRemoteSourceFile(declaration);
81
+ if (!file)
82
+ throw new Error(`Source file not found for declaration`);
83
+ const record = file.symbolCache;
84
+ if (!record)
85
+ throw new Error(`Cached source file not found for declaration`);
86
+ const index = parseNodeHandle(getNodeId(declaration)).index;
87
+ const cached = record.symbolsByDeclarationNodeIndex.get(index);
88
+ if (cached)
89
+ return cached;
90
+ // @sync-only-start
91
+ // return this.fetchDeclarationSymbol(record, index);
92
+ // @sync-only-end
93
+ // @sync-skip-block-start
94
+ let request = record.declarationSymbolRequests.get(index);
95
+ if (!request) {
96
+ request = this.fetchDeclarationSymbol(record, index);
97
+ record.declarationSymbolRequests.set(index, request);
98
+ }
99
+ try {
100
+ return await request;
101
+ }
102
+ finally {
103
+ record.declarationSymbolRequests.delete(index);
104
+ }
105
+ // @sync-skip-block-end
106
+ }
107
+ async fetchDeclarationSymbol(record, index) {
108
+ const data = await this.client.apiRequest("getSymbolOfDeclaration", {
109
+ file: record.descriptor,
110
+ index,
111
+ });
112
+ validateSymbolResponse(data);
113
+ const reference = data.reference;
114
+ if (reference.kind !== SymbolOwnerKind.File) {
115
+ throw new Error(`Symbol ${reference.id} is not file-owned`);
116
+ }
117
+ const fileOwner = { record, api: this };
118
+ const symbol = this.sourceFileCache.getOrCreateSymbol(record, reference.file, reference.id, () => new Symbol(data, { kind: SymbolOwnerKind.File, owner: fileOwner }));
119
+ record.symbolsByDeclarationNodeIndex.set(index, symbol);
120
+ return symbol;
121
+ }
74
122
  /**
75
123
  * Create an API instance from an existing LSP connection's API session.
76
124
  * Use this when connecting to an API pipe provided by an LSP server via custom/initializeAPISession.
@@ -102,7 +150,7 @@ export class API {
102
150
  const currentDirectory = response.currentDirectory;
103
151
  this.getCanonicalFileNameWorker = getCanonicalFileName;
104
152
  this.currentDirectory = currentDirectory;
105
- this.toPath = (fileName) => toPath(fileName, currentDirectory, getCanonicalFileName);
153
+ this.toPath = (fileName, basePath = currentDirectory) => toPath(fileName, basePath, getCanonicalFileName);
106
154
  this.initialized = true;
107
155
  }
108
156
  catch (error) {
@@ -197,7 +245,7 @@ export class API {
197
245
  const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
198
246
  const lease = readSourceFileLease(view);
199
247
  try {
200
- const decoded = new RemoteSourceFile(data, this.decoder, this.client.getTimingCollector());
248
+ const decoded = new RemoteSourceFile(data, this.decoder, this.client.getTimingCollector(), this);
201
249
  return this.addSourceFileLease(decoded, lease);
202
250
  }
203
251
  catch (error) {
@@ -215,7 +263,7 @@ export class API {
215
263
  }
216
264
  addSourceFileLease(sourceFile, lease) {
217
265
  const cached = this.sourceFileCache.setForLease(sourceFile, lease);
218
- const retained = new RetainedSourceFile(cached, lease, this.client, () => {
266
+ const retained = new RetainedSourceFile(cached, lease, () => {
219
267
  this.activeSourceFileLeases.delete(lease);
220
268
  this.sourceFileCache.releaseLease(lease);
221
269
  });
@@ -242,7 +290,7 @@ export class API {
242
290
  await this.ensureInitialized();
243
291
  const requestParams = toCreateSnapshotRequest(this.prepareCreateSnapshotParams(params));
244
292
  const data = await this.client.apiRequest("createSnapshot", requestParams);
245
- const snapshot = new Snapshot(data, this.client, this.sourceFileCache, this.toPath, this, () => {
293
+ const snapshot = new Snapshot(data, this.toPath, this, () => {
246
294
  this.activeSnapshots.delete(snapshot.id);
247
295
  this.sourceFileCache.releaseSnapshot(snapshot.id);
248
296
  }, this.createSnapshotUpdater(() => snapshot), undefined);
@@ -263,7 +311,7 @@ export class API {
263
311
  return baseSnapshot;
264
312
  }
265
313
  this.sourceFileCache.retainForSnapshot(data.snapshot, baseSnapshot.id, data.changes);
266
- const snapshot = new Snapshot(data, this.client, this.sourceFileCache, this.toPath, this, () => {
314
+ const snapshot = new Snapshot(data, this.toPath, this, () => {
267
315
  this.activeSnapshots.delete(snapshot.id);
268
316
  this.sourceFileCache.releaseSnapshot(snapshot.id);
269
317
  }, this.createSnapshotUpdater(() => snapshot), baseSnapshot);
@@ -317,7 +365,7 @@ export class API {
317
365
  if (baseSnapshot) {
318
366
  this.sourceFileCache.retainForSnapshot(data.snapshot, baseSnapshot.id, data.changes);
319
367
  }
320
- const snapshot = new Snapshot(data, this.client, this.sourceFileCache, this.toPath, this, () => {
368
+ const snapshot = new Snapshot(data, this.toPath, this, () => {
321
369
  this.activeSnapshots.delete(snapshot.id);
322
370
  this.sourceFileCache.releaseSnapshot(snapshot.id);
323
371
  }, this.createSnapshotUpdater(() => snapshot), baseSnapshot);
@@ -432,18 +480,47 @@ function sourceFileDescriptor(sourceFile) {
432
480
  nodeId: sourceFile.nodeId,
433
481
  };
434
482
  }
483
+ function getRemoteSourceFile(node) {
484
+ if (!(node instanceof RemoteNode))
485
+ return undefined;
486
+ const file = node.getSourceFile();
487
+ return file instanceof RemoteSourceFile && file.api ? file : undefined;
488
+ }
489
+ function getNodeAPI(node) {
490
+ const api = getRemoteSourceFile(node)?.api;
491
+ if (!api)
492
+ return undefined;
493
+ if (!(api instanceof API))
494
+ throw new Error("Source file does not belong to the async API"); // @sync: if (!(api instanceof API)) throw new Error("Source file does not belong to the sync API");
495
+ return api;
496
+ }
497
+ /** Looks up a remote declaration's binder symbol through its API. Throws for non-remote declarations. */
498
+ export async function getSymbol(declaration) {
499
+ const api = getNodeAPI(declaration);
500
+ if (!api)
501
+ throw new Error("Source file not found for declaration");
502
+ return api.getSymbol(declaration);
503
+ }
504
+ // @sync-only-start
505
+ // export declare namespace getSymbol {
506
+ // function gen(declaration: Declaration): Generator<ProtocolRequest, Symbol, ProtocolResponse["result"]>;
507
+ // }
508
+ // getSymbol.gen = function* (declaration: Declaration): Generator<ProtocolRequest, Symbol, ProtocolResponse["result"]> {
509
+ // const api = getNodeAPI(declaration);
510
+ // if (!api) throw new Error("Source file not found for declaration");
511
+ // return yield* api.getSymbol.gen(declaration);
512
+ // };
513
+ // @sync-only-end
435
514
  /** An independently retained source file and its disposable remote-lifetime lease. */
436
515
  export class RetainedSourceFile {
437
516
  sourceFile;
438
517
  lease;
439
- client;
440
518
  onDispose;
441
519
  disposed = false;
442
520
  disposePromise;
443
- constructor(sourceFile, lease, client, onDispose) {
521
+ constructor(sourceFile, lease, onDispose) {
444
522
  this.sourceFile = sourceFile;
445
523
  this.lease = lease;
446
- this.client = client;
447
524
  this.onDispose = onDispose;
448
525
  }
449
526
  [globalThis.Symbol.asyncDispose]() {
@@ -455,9 +532,12 @@ export class RetainedSourceFile {
455
532
  async disposeWorker() {
456
533
  if (this.disposed)
457
534
  return;
535
+ const api = getNodeAPI(this.sourceFile);
536
+ if (!api)
537
+ throw new Error("Retained source file has no owning API");
458
538
  this.disposed = true;
459
539
  try {
460
- await this.client.apiRequest("releaseSourceFile", { lease: this.lease });
540
+ await api.client.apiRequest("releaseSourceFile", { lease: this.lease });
461
541
  }
462
542
  finally {
463
543
  this.onDispose();
@@ -492,7 +572,7 @@ export class Snapshot {
492
572
  operation;
493
573
  projectMap;
494
574
  toPath;
495
- client;
575
+ api;
496
576
  disposed = false;
497
577
  disposePromise;
498
578
  onDispose;
@@ -500,9 +580,12 @@ export class Snapshot {
500
580
  projectDataMap;
501
581
  updateSnapshot;
502
582
  internal;
503
- constructor(data, client, sourceFileCache, toPath, formatDiagnosticsHost, onDispose, updateSnapshot, baseSnapshot) {
583
+ get client() {
584
+ return this.api.client;
585
+ }
586
+ constructor(data, toPath, api, onDispose, updateSnapshot, baseSnapshot) {
504
587
  this.id = data.snapshot;
505
- this.client = client;
588
+ this.api = api;
506
589
  this.toPath = toPath;
507
590
  this.onDispose = onDispose;
508
591
  this.updateSnapshot = updateSnapshot;
@@ -517,14 +600,14 @@ export class Snapshot {
517
600
  this.projectDataMap = new Map([...projectDataMap].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
518
601
  this.snapshotRegistry = new SnapshotObjectRegistry(this.id);
519
602
  for (const projData of this.projectDataMap.values()) {
520
- const project = new Project(projData, this.id, client, sourceFileCache, toPath, formatDiagnosticsHost, this.snapshotRegistry);
603
+ const project = new Project(projData, this.id, toPath, api, this.snapshotRegistry);
521
604
  this.projectMap.set(projData.id, project);
522
605
  }
523
606
  this.operation = {
524
607
  createdPrograms: data.operation.createdPrograms?.map(projectId => this.requireProject(projectId).program),
525
608
  openedFiles: data.operation.openedFiles?.map(result => ({ project: this.requireProject(result.project) })),
526
609
  };
527
- this.internal = new SnapshotInternalAPI(this.id, client);
610
+ this.internal = new SnapshotInternalAPI(this.id, api.client);
528
611
  }
529
612
  getProjects() {
530
613
  this.ensureNotDisposed();
@@ -674,20 +757,22 @@ class SnapshotObjectRegistry {
674
757
  }
675
758
  }
676
759
  class ProjectObjectRegistry {
677
- client;
678
760
  snapshotId;
679
761
  project;
680
762
  snapshotRegistry;
681
- sourceFileCache;
682
763
  types = new Map();
683
764
  signatures = new Map();
684
765
  disposed = false;
685
- constructor(client, snapshotId, project, snapshotRegistry, sourceFileCache) {
686
- this.client = client;
766
+ get client() {
767
+ return this.project.api.client;
768
+ }
769
+ get sourceFileCache() {
770
+ return this.project.api.sourceFileCache;
771
+ }
772
+ constructor(snapshotId, project, snapshotRegistry) {
687
773
  this.snapshotId = snapshotId;
688
774
  this.project = project;
689
775
  this.snapshotRegistry = snapshotRegistry;
690
- this.sourceFileCache = sourceFileCache;
691
776
  snapshotRegistry.addProjectRegistry(this);
692
777
  }
693
778
  getOrCreateSymbol(data) {
@@ -700,7 +785,7 @@ class ProjectObjectRegistry {
700
785
  const record = this.sourceFileCache.getOrCreateRecord(reference.file, this.snapshotId, this.project.id);
701
786
  return this.sourceFileCache.getOrCreateSymbol(record, reference.file, reference.id, () => new Symbol(data, {
702
787
  kind: SymbolOwnerKind.File,
703
- owner: { record, cache: this.sourceFileCache, client: this.client },
788
+ owner: { record, api: this.project.api },
704
789
  }));
705
790
  }
706
791
  /** Find an already-interned symbol and retain its file record for this registry. */
@@ -710,7 +795,7 @@ class ProjectObjectRegistry {
710
795
  return this.snapshotRegistry.getSymbol(reference.id);
711
796
  }
712
797
  const record = this.sourceFileCache.findRecord(reference.file);
713
- const symbol = record?.symbols.get(reference.id);
798
+ const symbol = record?.symbolsById.get(reference.id);
714
799
  if (record && symbol) {
715
800
  this.sourceFileCache.retainRecord(record, this.snapshotId, this.project.id);
716
801
  }
@@ -926,6 +1011,8 @@ class ProjectObjectRegistry {
926
1011
  }
927
1012
  }
928
1013
  export class Project {
1014
+ /** @internal */
1015
+ api;
929
1016
  id;
930
1017
  configFileName;
931
1018
  currentDirectory;
@@ -938,10 +1025,10 @@ export class Project {
938
1025
  program;
939
1026
  checker;
940
1027
  languageService;
941
- client;
942
1028
  snapshotId;
943
- constructor(data, snapshotId, client, sourceFileCache, toPath, formatDiagnosticsHost, snapshotRegistry) {
1029
+ constructor(data, snapshotId, toPath, api, snapshotRegistry) {
944
1030
  this.id = data.id;
1031
+ this.api = api;
945
1032
  this.configFileName = data.configFileName;
946
1033
  this.currentDirectory = data.currentDirectory;
947
1034
  this.dirty = data.dirty;
@@ -951,12 +1038,11 @@ export class Project {
951
1038
  this.parsedCommandLine = data.parsedCommandLine;
952
1039
  this.compilerOptions = this.parsedCommandLine.options;
953
1040
  this.rootFiles = this.parsedCommandLine.fileNames;
954
- this.client = client;
955
1041
  this.snapshotId = snapshotId;
956
- this.program = new Program(snapshotId, this, client, sourceFileCache, toPath, formatDiagnosticsHost);
957
- const objectRegistry = new ProjectObjectRegistry(client, snapshotId, this, snapshotRegistry, sourceFileCache);
958
- this.checker = new Checker(snapshotId, this, client, objectRegistry);
959
- this.languageService = new LanguageService(snapshotId, this, client, objectRegistry);
1042
+ this.program = new Program(snapshotId, this, toPath);
1043
+ const objectRegistry = new ProjectObjectRegistry(snapshotId, this, snapshotRegistry);
1044
+ this.checker = new Checker(snapshotId, this, objectRegistry);
1045
+ this.languageService = new LanguageService(snapshotId, this, objectRegistry);
960
1046
  }
961
1047
  /** @deprecated Use `languageService.getImportAdderEdits`. */
962
1048
  getImportAdderEdits(file, actions) {
@@ -973,12 +1059,13 @@ export class Project {
973
1059
  export class LanguageService {
974
1060
  snapshotId;
975
1061
  project;
976
- client;
977
1062
  objectRegistry;
978
- constructor(snapshotId, project, client, objectRegistry) {
1063
+ get client() {
1064
+ return this.project.api.client;
1065
+ }
1066
+ constructor(snapshotId, project, objectRegistry) {
979
1067
  this.snapshotId = snapshotId;
980
1068
  this.project = project;
981
- this.client = client;
982
1069
  this.objectRegistry = objectRegistry;
983
1070
  }
984
1071
  async getImportAdderEdits(file, actions) {
@@ -1069,28 +1156,28 @@ export class Program {
1069
1156
  snapshotId;
1070
1157
  id;
1071
1158
  project;
1072
- client;
1073
- sourceFileCache;
1074
1159
  toPath;
1075
- formatDiagnosticsHost;
1076
1160
  decoder = new Wtf8Decoder();
1077
1161
  sourceFileMetadataCache = new Map();
1078
1162
  ownedSnapshot;
1079
1163
  disposePromise;
1080
- constructor(snapshotId, project, client, sourceFileCache, toPath, formatDiagnosticsHost) {
1164
+ get client() {
1165
+ return this.project.api.client;
1166
+ }
1167
+ get sourceFileCache() {
1168
+ return this.project.api.sourceFileCache;
1169
+ }
1170
+ constructor(snapshotId, project, toPath) {
1081
1171
  this.snapshotId = snapshotId;
1082
1172
  this.id = project.id;
1083
1173
  this.project = project;
1084
- this.client = client;
1085
- this.sourceFileCache = sourceFileCache;
1086
1174
  this.toPath = toPath;
1087
- this.formatDiagnosticsHost = formatDiagnosticsHost;
1088
1175
  }
1089
1176
  getCurrentDirectory() {
1090
1177
  return this.project.currentDirectory;
1091
1178
  }
1092
1179
  getCanonicalFileName(fileName) {
1093
- return this.formatDiagnosticsHost.getCanonicalFileName(fileName);
1180
+ return this.project.api.getCanonicalFileName(fileName);
1094
1181
  }
1095
1182
  getNewLine() {
1096
1183
  return this.project.compilerOptions.newLine === NewLineKind.CRLF ? "\r\n" : "\n";
@@ -1116,7 +1203,7 @@ export class Program {
1116
1203
  }
1117
1204
  async getSourceFile(file) {
1118
1205
  const fileName = resolveFileName(file);
1119
- const path = this.toPath(fileName);
1206
+ const path = this.toPath(fileName, this.project.currentDirectory);
1120
1207
  // Check if we already have a retained cache entry for this (snapshot, project) pair
1121
1208
  const retained = this.sourceFileCache.getRetained(path, this.snapshotId, this.project.id);
1122
1209
  if (retained) {
@@ -1132,7 +1219,7 @@ export class Program {
1132
1219
  return undefined;
1133
1220
  }
1134
1221
  // Create a new RemoteSourceFile and cache it (set returns existing if hash matches)
1135
- const decoded = new RemoteSourceFile(binaryData, this.decoder, this.client.getTimingCollector());
1222
+ const decoded = new RemoteSourceFile(binaryData, this.decoder, this.client.getTimingCollector(), this.project.api);
1136
1223
  return this.sourceFileCache.set(decoded, this.snapshotId, this.project.id);
1137
1224
  }
1138
1225
  async getResolvedModule(file, moduleName, mode) {
@@ -1203,7 +1290,7 @@ export class Program {
1203
1290
  * `Program` instance.
1204
1291
  */
1205
1292
  getSourceFileMetadata(file) {
1206
- return this.getSourceFileMetadataByPath(this.toPath(resolveFileName(file)));
1293
+ return this.getSourceFileMetadataByPath(this.toPath(resolveFileName(file), this.project.currentDirectory));
1207
1294
  }
1208
1295
  /**
1209
1296
  * Returns program-stored metadata for the source file at the given path, or `undefined`
@@ -1269,7 +1356,7 @@ export class Program {
1269
1356
  if (!binaryData) {
1270
1357
  return undefined;
1271
1358
  }
1272
- return new RemoteSourceFile(binaryData, this.decoder);
1359
+ return new RemoteSourceFile(binaryData, this.decoder, undefined, this.project.api);
1273
1360
  }
1274
1361
  /**
1275
1362
  * Get syntactic (parse) diagnostics for specific files or all files.
@@ -1522,14 +1609,15 @@ function toEmitOutput(response) {
1522
1609
  export class Checker {
1523
1610
  snapshotId;
1524
1611
  project;
1525
- client;
1526
1612
  objectRegistry;
1527
1613
  wellKnownSymbols;
1528
1614
  wellKnownSignatures;
1529
- constructor(snapshotId, project, client, objectRegistry) {
1615
+ get client() {
1616
+ return this.project.api.client;
1617
+ }
1618
+ constructor(snapshotId, project, objectRegistry) {
1530
1619
  this.snapshotId = snapshotId;
1531
1620
  this.project = project;
1532
- this.client = client;
1533
1621
  this.objectRegistry = objectRegistry;
1534
1622
  }
1535
1623
  dispose() {
@@ -2353,10 +2441,10 @@ export class NodeHandle {
2353
2441
  return sourceFile.getOrCreateNodeAtIndex(this.index);
2354
2442
  }
2355
2443
  async fetchOwnerFile(fileOwner) {
2356
- const data = await fileOwner.client.apiRequestBinary("getCachedSourceFile", { file: fileOwner.record.descriptor });
2444
+ const data = await fileOwner.api.client.apiRequestBinary("getCachedSourceFile", { file: fileOwner.record.descriptor });
2357
2445
  if (!data)
2358
2446
  throw new Error(`Source file '${fileOwner.record.descriptor.fileName}' is not available`);
2359
- return fileOwner.cache.attachFile(fileOwner.record, new RemoteSourceFile(data, new Wtf8Decoder(), fileOwner.client.getTimingCollector()));
2447
+ return fileOwner.api.sourceFileCache.attachFile(fileOwner.record, new RemoteSourceFile(data, new Wtf8Decoder(), fileOwner.api.client.getTimingCollector(), fileOwner.api));
2360
2448
  }
2361
2449
  }
2362
2450
  export class Symbol {
@@ -2443,10 +2531,10 @@ export class Symbol {
2443
2531
  }
2444
2532
  const fileOwner = this.storage.owner;
2445
2533
  // A file-owned symbol's relationships are always owned by the same file.
2446
- const cached = reference.file === fileOwner.record.descriptor.nodeId ? fileOwner.record.symbols.get(reference.id) : undefined;
2534
+ const cached = reference.file === fileOwner.record.descriptor.nodeId ? fileOwner.record.symbolsById.get(reference.id) : undefined;
2447
2535
  if (cached)
2448
2536
  return cached;
2449
- const data = await fileOwner.client.apiRequest(method, { symbol: this.reference });
2537
+ const data = await fileOwner.api.client.apiRequest(method, { symbol: this.reference });
2450
2538
  if (!data)
2451
2539
  throw new Error(`${method} returned null symbol for Symbol ${this.id}`);
2452
2540
  return this.internFileSymbol(fileOwner, data);
@@ -2456,7 +2544,7 @@ export class Symbol {
2456
2544
  return this.storage.registry.fetchSymbols(this, method);
2457
2545
  }
2458
2546
  const fileOwner = this.storage.owner;
2459
- const data = await fileOwner.client.apiRequest(method, { symbol: this.reference });
2547
+ const data = await fileOwner.api.client.apiRequest(method, { symbol: this.reference });
2460
2548
  return data?.map(symbol => this.internFileSymbol(fileOwner, symbol)) ?? [];
2461
2549
  }
2462
2550
  internFileSymbol(fileOwner, data) {
@@ -2464,7 +2552,7 @@ export class Symbol {
2464
2552
  const reference = data.reference;
2465
2553
  if (reference.kind !== SymbolOwnerKind.File)
2466
2554
  throw new Error(`Symbol ${reference.id} is not file-owned`);
2467
- return fileOwner.cache.getOrCreateSymbol(fileOwner.record, reference.file, reference.id, () => new Symbol(data, { kind: SymbolOwnerKind.File, owner: fileOwner }));
2555
+ return fileOwner.api.sourceFileCache.getOrCreateSymbol(fileOwner.record, reference.file, reference.id, () => new Symbol(data, { kind: SymbolOwnerKind.File, owner: fileOwner }));
2468
2556
  }
2469
2557
  }
2470
2558
  class TypeObject {