layermap 0.1.50 → 0.1.52

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.
@@ -3452,7 +3452,7 @@ var require_main = __commonJS({
3452
3452
  exports.createMessageConnection = createMessageConnection2;
3453
3453
  var ril_1 = __importDefault(require_ril());
3454
3454
  ril_1.default.install();
3455
- var path10 = __importStar(__require("path"));
3455
+ var path9 = __importStar(__require("path"));
3456
3456
  var os = __importStar(__require("os"));
3457
3457
  var fs2 = __importStar(__require("fs"));
3458
3458
  var crypto_1 = __require("crypto");
@@ -3604,7 +3604,7 @@ var require_main = __commonJS({
3604
3604
  throw new Error(`Unable to generate a random pipe name with ${randomLength} characters.`);
3605
3605
  }
3606
3606
  const randomSuffix = (0, crypto_1.randomBytes)(Math.floor(randomLength / 2)).toString("hex");
3607
- return path10.join(tmpDir, `lsp-${randomSuffix}.sock`);
3607
+ return path9.join(tmpDir, `lsp-${randomSuffix}.sock`);
3608
3608
  }
3609
3609
  function createClientPipeTransport(pipeName, encoding = "utf-8") {
3610
3610
  let connectResolve;
@@ -3690,9 +3690,6 @@ var require_main = __commonJS({
3690
3690
  }
3691
3691
  });
3692
3692
 
3693
- // src/project-map-worker.ts
3694
- import path9 from "node:path";
3695
-
3696
3693
  // src/platform.ts
3697
3694
  import { spawnSync } from "node:child_process";
3698
3695
  import path from "node:path";
@@ -4863,6 +4860,9 @@ function isVariableDeclaration(node) {
4863
4860
  function isVariableDeclarationList(node) {
4864
4861
  return node.kind === SyntaxKind.VariableDeclarationList;
4865
4862
  }
4863
+ function isBindingElement(node) {
4864
+ return node.kind === SyntaxKind.BindingElement;
4865
+ }
4866
4866
  function isFunctionDeclaration(node) {
4867
4867
  return node.kind === SyntaxKind.FunctionDeclaration;
4868
4868
  }
@@ -13065,116 +13065,116 @@ function getFileUrlVolumeSeparatorEnd(url2, start) {
13065
13065
  }
13066
13066
  return -1;
13067
13067
  }
13068
- function getRootLength(path10) {
13069
- const rootLength = getEncodedRootLength(path10);
13068
+ function getRootLength(path9) {
13069
+ const rootLength = getEncodedRootLength(path9);
13070
13070
  return rootLength < 0 ? ~rootLength : rootLength;
13071
13071
  }
13072
- function getEncodedRootLength(path10) {
13073
- if (!path10)
13072
+ function getEncodedRootLength(path9) {
13073
+ if (!path9)
13074
13074
  return 0;
13075
- const ch0 = path10.charCodeAt(0);
13075
+ const ch0 = path9.charCodeAt(0);
13076
13076
  if (ch0 === CharacterCodesSlash || ch0 === CharacterCodesBackslash) {
13077
- if (path10.charCodeAt(1) !== ch0)
13077
+ if (path9.charCodeAt(1) !== ch0)
13078
13078
  return 1;
13079
- const p1 = path10.indexOf(ch0 === CharacterCodesSlash ? directorySeparator : altDirectorySeparator, 2);
13079
+ const p1 = path9.indexOf(ch0 === CharacterCodesSlash ? directorySeparator : altDirectorySeparator, 2);
13080
13080
  if (p1 < 0)
13081
- return path10.length;
13081
+ return path9.length;
13082
13082
  return p1 + 1;
13083
13083
  }
13084
- if (isVolumeCharacter(ch0) && path10.charCodeAt(1) === CharacterCodesColon) {
13085
- const ch2 = path10.charCodeAt(2);
13084
+ if (isVolumeCharacter(ch0) && path9.charCodeAt(1) === CharacterCodesColon) {
13085
+ const ch2 = path9.charCodeAt(2);
13086
13086
  if (ch2 === CharacterCodesSlash || ch2 === CharacterCodesBackslash)
13087
13087
  return 3;
13088
- if (path10.length === 2)
13088
+ if (path9.length === 2)
13089
13089
  return 2;
13090
13090
  }
13091
- const schemeEnd = path10.indexOf(urlSchemeSeparator);
13091
+ const schemeEnd = path9.indexOf(urlSchemeSeparator);
13092
13092
  if (schemeEnd !== -1) {
13093
13093
  const authorityStart = schemeEnd + urlSchemeSeparator.length;
13094
- const authorityEnd = path10.indexOf(directorySeparator, authorityStart);
13094
+ const authorityEnd = path9.indexOf(directorySeparator, authorityStart);
13095
13095
  if (authorityEnd !== -1) {
13096
- const scheme = path10.slice(0, schemeEnd);
13097
- const authority = path10.slice(authorityStart, authorityEnd);
13098
- if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path10.charCodeAt(authorityEnd + 1))) {
13099
- const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path10, authorityEnd + 2);
13096
+ const scheme = path9.slice(0, schemeEnd);
13097
+ const authority = path9.slice(authorityStart, authorityEnd);
13098
+ if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path9.charCodeAt(authorityEnd + 1))) {
13099
+ const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path9, authorityEnd + 2);
13100
13100
  if (volumeSeparatorEnd !== -1) {
13101
- if (path10.charCodeAt(volumeSeparatorEnd) === CharacterCodesSlash) {
13101
+ if (path9.charCodeAt(volumeSeparatorEnd) === CharacterCodesSlash) {
13102
13102
  return ~(volumeSeparatorEnd + 1);
13103
13103
  }
13104
- if (volumeSeparatorEnd === path10.length) {
13104
+ if (volumeSeparatorEnd === path9.length) {
13105
13105
  return ~volumeSeparatorEnd;
13106
13106
  }
13107
13107
  }
13108
13108
  }
13109
13109
  return ~(authorityEnd + 1);
13110
13110
  }
13111
- return ~path10.length;
13111
+ return ~path9.length;
13112
13112
  }
13113
13113
  return 0;
13114
13114
  }
13115
- function hasTrailingDirectorySeparator(path10) {
13116
- return path10.length > 0 && isAnyDirectorySeparator(path10.charCodeAt(path10.length - 1));
13115
+ function hasTrailingDirectorySeparator(path9) {
13116
+ return path9.length > 0 && isAnyDirectorySeparator(path9.charCodeAt(path9.length - 1));
13117
13117
  }
13118
- function removeTrailingDirectorySeparator(path10) {
13119
- if (hasTrailingDirectorySeparator(path10)) {
13120
- return path10.substr(0, path10.length - 1);
13118
+ function removeTrailingDirectorySeparator(path9) {
13119
+ if (hasTrailingDirectorySeparator(path9)) {
13120
+ return path9.substr(0, path9.length - 1);
13121
13121
  }
13122
- return path10;
13122
+ return path9;
13123
13123
  }
13124
- function ensureTrailingDirectorySeparator(path10) {
13125
- if (!hasTrailingDirectorySeparator(path10)) {
13126
- return path10 + directorySeparator;
13124
+ function ensureTrailingDirectorySeparator(path9) {
13125
+ if (!hasTrailingDirectorySeparator(path9)) {
13126
+ return path9 + directorySeparator;
13127
13127
  }
13128
- return path10;
13128
+ return path9;
13129
13129
  }
13130
- function normalizeSlashes(path10) {
13131
- return path10.includes("\\") ? path10.replace(backslashRegExp, directorySeparator) : path10;
13130
+ function normalizeSlashes(path9) {
13131
+ return path9.includes("\\") ? path9.replace(backslashRegExp, directorySeparator) : path9;
13132
13132
  }
13133
- function combinePaths(path10, ...paths) {
13134
- if (path10)
13135
- path10 = normalizeSlashes(path10);
13133
+ function combinePaths(path9, ...paths) {
13134
+ if (path9)
13135
+ path9 = normalizeSlashes(path9);
13136
13136
  for (let relativePath of paths) {
13137
13137
  if (!relativePath)
13138
13138
  continue;
13139
13139
  relativePath = normalizeSlashes(relativePath);
13140
- if (!path10 || getRootLength(relativePath) !== 0) {
13141
- path10 = relativePath;
13140
+ if (!path9 || getRootLength(relativePath) !== 0) {
13141
+ path9 = relativePath;
13142
13142
  } else {
13143
- path10 = ensureTrailingDirectorySeparator(path10) + relativePath;
13143
+ path9 = ensureTrailingDirectorySeparator(path9) + relativePath;
13144
13144
  }
13145
13145
  }
13146
- return path10;
13146
+ return path9;
13147
13147
  }
13148
- function simpleNormalizePath(path10) {
13149
- if (!relativePathSegmentRegExp.test(path10)) {
13150
- return path10;
13148
+ function simpleNormalizePath(path9) {
13149
+ if (!relativePathSegmentRegExp.test(path9)) {
13150
+ return path9;
13151
13151
  }
13152
- let simplified = path10.replace(/\/\.\//g, "/");
13152
+ let simplified = path9.replace(/\/\.\//g, "/");
13153
13153
  if (simplified.startsWith("./")) {
13154
13154
  simplified = simplified.slice(2);
13155
13155
  }
13156
- if (simplified !== path10) {
13157
- path10 = simplified;
13158
- if (!relativePathSegmentRegExp.test(path10)) {
13159
- return path10;
13156
+ if (simplified !== path9) {
13157
+ path9 = simplified;
13158
+ if (!relativePathSegmentRegExp.test(path9)) {
13159
+ return path9;
13160
13160
  }
13161
13161
  }
13162
13162
  return void 0;
13163
13163
  }
13164
- function getNormalizedAbsolutePath(path10, currentDirectory) {
13165
- let rootLength = getRootLength(path10);
13164
+ function getNormalizedAbsolutePath(path9, currentDirectory) {
13165
+ let rootLength = getRootLength(path9);
13166
13166
  if (rootLength === 0 && currentDirectory) {
13167
- path10 = combinePaths(currentDirectory, path10);
13168
- rootLength = getRootLength(path10);
13167
+ path9 = combinePaths(currentDirectory, path9);
13168
+ rootLength = getRootLength(path9);
13169
13169
  } else {
13170
- path10 = normalizeSlashes(path10);
13170
+ path9 = normalizeSlashes(path9);
13171
13171
  }
13172
- const simpleNormalized = simpleNormalizePath(path10);
13172
+ const simpleNormalized = simpleNormalizePath(path9);
13173
13173
  if (simpleNormalized !== void 0) {
13174
13174
  return simpleNormalized.length > rootLength ? removeTrailingDirectorySeparator(simpleNormalized) : simpleNormalized;
13175
13175
  }
13176
- const length = path10.length;
13177
- const root = path10.substring(0, rootLength);
13176
+ const length = path9.length;
13177
+ const root = path9.substring(0, rootLength);
13178
13178
  let normalized;
13179
13179
  let index = rootLength;
13180
13180
  let segmentStart = index;
@@ -13182,23 +13182,23 @@ function getNormalizedAbsolutePath(path10, currentDirectory) {
13182
13182
  let seenNonDotDotSegment = rootLength !== 0;
13183
13183
  while (index < length) {
13184
13184
  segmentStart = index;
13185
- let ch = path10.charCodeAt(index);
13185
+ let ch = path9.charCodeAt(index);
13186
13186
  while (ch === CharacterCodesSlash && index + 1 < length) {
13187
13187
  index++;
13188
- ch = path10.charCodeAt(index);
13188
+ ch = path9.charCodeAt(index);
13189
13189
  }
13190
13190
  if (index > segmentStart) {
13191
- normalized ??= path10.substring(0, segmentStart - 1);
13191
+ normalized ??= path9.substring(0, segmentStart - 1);
13192
13192
  segmentStart = index;
13193
13193
  }
13194
- let segmentEnd = path10.indexOf(directorySeparator, index + 1);
13194
+ let segmentEnd = path9.indexOf(directorySeparator, index + 1);
13195
13195
  if (segmentEnd === -1) {
13196
13196
  segmentEnd = length;
13197
13197
  }
13198
13198
  const segmentLength = segmentEnd - segmentStart;
13199
- if (segmentLength === 1 && path10.charCodeAt(index) === CharacterCodesDot) {
13200
- normalized ??= path10.substring(0, normalizedUpTo);
13201
- } else if (segmentLength === 2 && path10.charCodeAt(index) === CharacterCodesDot && path10.charCodeAt(index + 1) === CharacterCodesDot) {
13199
+ if (segmentLength === 1 && path9.charCodeAt(index) === CharacterCodesDot) {
13200
+ normalized ??= path9.substring(0, normalizedUpTo);
13201
+ } else if (segmentLength === 2 && path9.charCodeAt(index) === CharacterCodesDot && path9.charCodeAt(index + 1) === CharacterCodesDot) {
13202
13202
  if (!seenNonDotDotSegment) {
13203
13203
  if (normalized !== void 0) {
13204
13204
  normalized += normalized.length === rootLength ? ".." : "/..";
@@ -13207,9 +13207,9 @@ function getNormalizedAbsolutePath(path10, currentDirectory) {
13207
13207
  }
13208
13208
  } else if (normalized === void 0) {
13209
13209
  if (normalizedUpTo - 2 >= 0) {
13210
- normalized = path10.substring(0, Math.max(rootLength, path10.lastIndexOf(directorySeparator, normalizedUpTo - 2)));
13210
+ normalized = path9.substring(0, Math.max(rootLength, path9.lastIndexOf(directorySeparator, normalizedUpTo - 2)));
13211
13211
  } else {
13212
- normalized = path10.substring(0, normalizedUpTo);
13212
+ normalized = path9.substring(0, normalizedUpTo);
13213
13213
  }
13214
13214
  } else {
13215
13215
  const lastSlash = normalized.lastIndexOf(directorySeparator);
@@ -13227,26 +13227,26 @@ function getNormalizedAbsolutePath(path10, currentDirectory) {
13227
13227
  normalized += directorySeparator;
13228
13228
  }
13229
13229
  seenNonDotDotSegment = true;
13230
- normalized += path10.substring(segmentStart, segmentEnd);
13230
+ normalized += path9.substring(segmentStart, segmentEnd);
13231
13231
  } else {
13232
13232
  seenNonDotDotSegment = true;
13233
13233
  normalizedUpTo = segmentEnd;
13234
13234
  }
13235
13235
  index = segmentEnd + 1;
13236
13236
  }
13237
- return normalized ?? (length > rootLength ? removeTrailingDirectorySeparator(path10) : path10);
13237
+ return normalized ?? (length > rootLength ? removeTrailingDirectorySeparator(path9) : path9);
13238
13238
  }
13239
- function normalizePath(path10) {
13240
- path10 = normalizeSlashes(path10);
13241
- let normalized = simpleNormalizePath(path10);
13239
+ function normalizePath(path9) {
13240
+ path9 = normalizeSlashes(path9);
13241
+ let normalized = simpleNormalizePath(path9);
13242
13242
  if (normalized !== void 0) {
13243
13243
  return normalized;
13244
13244
  }
13245
- normalized = getNormalizedAbsolutePath(path10, "");
13246
- return normalized && hasTrailingDirectorySeparator(path10) ? ensureTrailingDirectorySeparator(normalized) : normalized;
13245
+ normalized = getNormalizedAbsolutePath(path9, "");
13246
+ return normalized && hasTrailingDirectorySeparator(path9) ? ensureTrailingDirectorySeparator(normalized) : normalized;
13247
13247
  }
13248
- function isRootedDiskPath(path10) {
13249
- return getEncodedRootLength(path10) > 0;
13248
+ function isRootedDiskPath(path9) {
13249
+ return getEncodedRootLength(path9) > 0;
13250
13250
  }
13251
13251
  function toPath(fileName, basePath, getCanonicalFileName) {
13252
13252
  const nonCanonicalizedPath = isRootedDiskPath(fileName) ? normalizePath(fileName) : getNormalizedAbsolutePath(fileName, basePath);
@@ -13262,14 +13262,14 @@ function toLowerCase(s) {
13262
13262
  return s.toLowerCase();
13263
13263
  }
13264
13264
  var bundledScheme = "bundled:///";
13265
- function isBundled(path10) {
13266
- return path10.startsWith(bundledScheme);
13265
+ function isBundled(path9) {
13266
+ return path9.startsWith(bundledScheme);
13267
13267
  }
13268
- function splitVolumePath(path10) {
13269
- if (path10.length >= 2 && isVolumeCharacter(path10.charCodeAt(0)) && path10.charCodeAt(1) === CharacterCodesColon) {
13270
- return [path10.substring(0, 2).toLowerCase(), path10.substring(2), true];
13268
+ function splitVolumePath(path9) {
13269
+ if (path9.length >= 2 && isVolumeCharacter(path9.charCodeAt(0)) && path9.charCodeAt(1) === CharacterCodesColon) {
13270
+ return [path9.substring(0, 2).toLowerCase(), path9.substring(2), true];
13271
13271
  }
13272
- return ["", path10, false];
13272
+ return ["", path9, false];
13273
13273
  }
13274
13274
  function documentURIToFileName(uri) {
13275
13275
  if (isBundled(uri)) {
@@ -13285,32 +13285,32 @@ function documentURIToFileName(uri) {
13285
13285
  if (parsed.host !== "") {
13286
13286
  return "//" + parsed.host + parsed.pathname;
13287
13287
  }
13288
- const path11 = decodeURIComponent(parsed.pathname);
13289
- if (path11.length >= 3 && path11.charCodeAt(0) === CharacterCodesSlash) {
13290
- const [volume, rest, ok] = splitVolumePath(path11.substring(1));
13288
+ const path10 = decodeURIComponent(parsed.pathname);
13289
+ if (path10.length >= 3 && path10.charCodeAt(0) === CharacterCodesSlash) {
13290
+ const [volume, rest, ok] = splitVolumePath(path10.substring(1));
13291
13291
  if (ok) {
13292
13292
  return volume + rest;
13293
13293
  }
13294
13294
  }
13295
- return path11;
13295
+ return path10;
13296
13296
  }
13297
13297
  const colonIndex = uri.indexOf(":");
13298
13298
  if (colonIndex === -1) {
13299
13299
  throw new Error("invalid URI: " + uri);
13300
13300
  }
13301
13301
  const scheme = uri.substring(0, colonIndex);
13302
- let path10 = uri.substring(colonIndex + 1);
13302
+ let path9 = uri.substring(colonIndex + 1);
13303
13303
  let authority = "ts-nul-authority";
13304
- if (path10.startsWith("//")) {
13305
- const rest = path10.substring(2);
13304
+ if (path9.startsWith("//")) {
13305
+ const rest = path9.substring(2);
13306
13306
  const slashIndex = rest.indexOf("/");
13307
13307
  if (slashIndex === -1) {
13308
13308
  throw new Error("invalid URI: " + uri);
13309
13309
  }
13310
13310
  authority = rest.substring(0, slashIndex);
13311
- path10 = rest.substring(slashIndex + 1);
13311
+ path9 = rest.substring(slashIndex + 1);
13312
13312
  }
13313
- return "^/" + scheme + "/" + authority + "/" + path10;
13313
+ return "^/" + scheme + "/" + authority + "/" + path9;
13314
13314
  }
13315
13315
 
13316
13316
  // node_modules/.pnpm/typescript@7.0.2/node_modules/typescript/dist/api/proto.js
@@ -13347,8 +13347,8 @@ var SourceFileCache = class {
13347
13347
  * A given (snapshot, project) pair always parses a file the same way, so there is
13348
13348
  * at most one matching entry per ref.
13349
13349
  */
13350
- getRetained(path10, snapshotId, projectId) {
13351
- const entries = this.cache.get(path10);
13350
+ getRetained(path9, snapshotId, projectId) {
13351
+ const entries = this.cache.get(path9);
13352
13352
  if (!entries)
13353
13353
  return void 0;
13354
13354
  const key2 = refKey(snapshotId, projectId);
@@ -13359,21 +13359,21 @@ var SourceFileCache = class {
13359
13359
  * Store a source file in the cache and retain it for the given (snapshot, project) pair.
13360
13360
  * Returns the cached file — which may be an existing entry if the hash matches.
13361
13361
  */
13362
- set(path10, file2, parseOptionsKey, contentHash, snapshotId, projectId) {
13363
- let entries = this.cache.get(path10);
13362
+ set(path9, file2, parseOptionsKey, contentHash, snapshotId, projectId) {
13363
+ let entries = this.cache.get(path9);
13364
13364
  if (!entries) {
13365
13365
  entries = [];
13366
- this.cache.set(path10, entries);
13366
+ this.cache.set(path9, entries);
13367
13367
  }
13368
13368
  const ref = refKey(snapshotId, projectId);
13369
13369
  const existing = entries.find((e) => e.parseOptionsKey === parseOptionsKey && e.contentHash === contentHash);
13370
13370
  if (existing) {
13371
13371
  existing.refs.add(ref);
13372
- this.trackPath(snapshotId, projectId, path10);
13372
+ this.trackPath(snapshotId, projectId, path9);
13373
13373
  return existing.file;
13374
13374
  }
13375
13375
  entries.push({ file: file2, contentHash, parseOptionsKey, refs: /* @__PURE__ */ new Set([ref]) });
13376
- this.trackPath(snapshotId, projectId, path10);
13376
+ this.trackPath(snapshotId, projectId, path9);
13377
13377
  return file2;
13378
13378
  }
13379
13379
  /**
@@ -13403,16 +13403,16 @@ var SourceFileCache = class {
13403
13403
  }
13404
13404
  const prevRef = refKey(previousSnapshotId, projectId);
13405
13405
  const newRef = refKey(newSnapshotId, projectId);
13406
- for (const path10 of paths) {
13407
- if (invalidPaths?.has(path10))
13406
+ for (const path9 of paths) {
13407
+ if (invalidPaths?.has(path9))
13408
13408
  continue;
13409
- const entries = this.cache.get(path10);
13409
+ const entries = this.cache.get(path9);
13410
13410
  if (!entries)
13411
13411
  continue;
13412
13412
  for (const entry of entries) {
13413
13413
  if (entry.refs.has(prevRef)) {
13414
13414
  entry.refs.add(newRef);
13415
- this.trackPath(newSnapshotId, projectId, path10);
13415
+ this.trackPath(newSnapshotId, projectId, path9);
13416
13416
  }
13417
13417
  }
13418
13418
  }
@@ -13429,8 +13429,8 @@ var SourceFileCache = class {
13429
13429
  return;
13430
13430
  for (const [projectId, paths] of projectMap) {
13431
13431
  const key2 = refKey(snapshotId, projectId);
13432
- for (const path10 of paths) {
13433
- const entries = this.cache.get(path10);
13432
+ for (const path9 of paths) {
13433
+ const entries = this.cache.get(path9);
13434
13434
  if (!entries)
13435
13435
  continue;
13436
13436
  for (let i = entries.length - 1; i >= 0; i--) {
@@ -13440,13 +13440,13 @@ var SourceFileCache = class {
13440
13440
  }
13441
13441
  }
13442
13442
  if (entries.length === 0) {
13443
- this.cache.delete(path10);
13443
+ this.cache.delete(path9);
13444
13444
  }
13445
13445
  }
13446
13446
  }
13447
13447
  this.snapshotProjectPaths.delete(snapshotId);
13448
13448
  }
13449
- trackPath(snapshotId, projectId, path10) {
13449
+ trackPath(snapshotId, projectId, path9) {
13450
13450
  let projectMap = this.snapshotProjectPaths.get(snapshotId);
13451
13451
  if (!projectMap) {
13452
13452
  projectMap = /* @__PURE__ */ new Map();
@@ -13457,7 +13457,7 @@ var SourceFileCache = class {
13457
13457
  paths = /* @__PURE__ */ new Set();
13458
13458
  projectMap.set(projectId, paths);
13459
13459
  }
13460
- paths.add(path10);
13460
+ paths.add(path9);
13461
13461
  }
13462
13462
  /**
13463
13463
  * Clear all entries from the cache.
@@ -13475,8 +13475,8 @@ var SourceFileCache = class {
13475
13475
  /**
13476
13476
  * Check if a path is in the cache.
13477
13477
  */
13478
- has(path10) {
13479
- return this.cache.has(path10);
13478
+ has(path9) {
13479
+ return this.cache.has(path9);
13480
13480
  }
13481
13481
  };
13482
13482
 
@@ -14259,8 +14259,8 @@ var Program = class {
14259
14259
  }
14260
14260
  async getSourceFile(file2) {
14261
14261
  const fileName = resolveFileName(file2);
14262
- const path10 = this.toPath(fileName);
14263
- const retained = this.sourceFileCache.getRetained(path10, this.snapshotId, this.project.id);
14262
+ const path9 = this.toPath(fileName);
14263
+ const retained = this.sourceFileCache.getRetained(path9, this.snapshotId, this.project.id);
14264
14264
  if (retained) {
14265
14265
  return retained;
14266
14266
  }
@@ -14276,7 +14276,7 @@ var Program = class {
14276
14276
  const contentHash = readSourceFileHash(view);
14277
14277
  const parseOptionsKey = readParseOptionsKey(view);
14278
14278
  const sourceFile = new RemoteSourceFile(binaryData, this.decoder, this.client.getTimingCollector());
14279
- return this.sourceFileCache.set(path10, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.project.id);
14279
+ return this.sourceFileCache.set(path9, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.project.id);
14280
14280
  }
14281
14281
  async getSourceFileNames() {
14282
14282
  const data = await this.client.apiRequest("getSourceFileNames", {
@@ -14299,19 +14299,19 @@ var Program = class {
14299
14299
  * the file name to path conversion. Metadata is fetched lazily per file and cached on
14300
14300
  * this `Program` instance.
14301
14301
  */
14302
- getSourceFileMetadataByPath(path10) {
14303
- let metadata = this.sourceFileMetadataCache.get(path10);
14302
+ getSourceFileMetadataByPath(path9) {
14303
+ let metadata = this.sourceFileMetadataCache.get(path9);
14304
14304
  if (metadata === void 0) {
14305
- metadata = this.fetchSourceFileMetadata(path10);
14306
- this.sourceFileMetadataCache.set(path10, metadata);
14305
+ metadata = this.fetchSourceFileMetadata(path9);
14306
+ this.sourceFileMetadataCache.set(path9, metadata);
14307
14307
  }
14308
14308
  return metadata;
14309
14309
  }
14310
- async fetchSourceFileMetadata(path10) {
14310
+ async fetchSourceFileMetadata(path9) {
14311
14311
  const data = await this.client.apiRequest("getSourceFileMetadata", {
14312
14312
  snapshot: this.snapshotId,
14313
14313
  project: this.project.id,
14314
- file: path10
14314
+ file: path9
14315
14315
  });
14316
14316
  return data ?? void 0;
14317
14317
  }
@@ -16304,10 +16304,10 @@ function mergeDefs(...defs) {
16304
16304
  function cloneDef(schema) {
16305
16305
  return mergeDefs(schema._zod.def);
16306
16306
  }
16307
- function getElementAtPath(obj, path10) {
16308
- if (!path10)
16307
+ function getElementAtPath(obj, path9) {
16308
+ if (!path9)
16309
16309
  return obj;
16310
- return path10.reduce((acc, key2) => acc?.[key2], obj);
16310
+ return path9.reduce((acc, key2) => acc?.[key2], obj);
16311
16311
  }
16312
16312
  function promiseAllObject(promisesObj) {
16313
16313
  const keys = Object.keys(promisesObj);
@@ -16716,11 +16716,11 @@ function explicitlyAborted(x, startIndex = 0) {
16716
16716
  }
16717
16717
  return false;
16718
16718
  }
16719
- function prefixIssues(path10, issues) {
16719
+ function prefixIssues(path9, issues) {
16720
16720
  return issues.map((iss) => {
16721
16721
  var _a3;
16722
16722
  (_a3 = iss).path ?? (_a3.path = []);
16723
- iss.path.unshift(path10);
16723
+ iss.path.unshift(path9);
16724
16724
  return iss;
16725
16725
  });
16726
16726
  }
@@ -16867,16 +16867,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
16867
16867
  }
16868
16868
  function formatError(error51, mapper = (issue2) => issue2.message) {
16869
16869
  const fieldErrors = { _errors: [] };
16870
- const processError = (error52, path10 = []) => {
16870
+ const processError = (error52, path9 = []) => {
16871
16871
  for (const issue2 of error52.issues) {
16872
16872
  if (issue2.code === "invalid_union" && issue2.errors.length) {
16873
- issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
16873
+ issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
16874
16874
  } else if (issue2.code === "invalid_key") {
16875
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
16875
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
16876
16876
  } else if (issue2.code === "invalid_element") {
16877
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
16877
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
16878
16878
  } else {
16879
- const fullpath = [...path10, ...issue2.path];
16879
+ const fullpath = [...path9, ...issue2.path];
16880
16880
  if (fullpath.length === 0) {
16881
16881
  fieldErrors._errors.push(mapper(issue2));
16882
16882
  } else {
@@ -16903,17 +16903,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
16903
16903
  }
16904
16904
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
16905
16905
  const result = { errors: [] };
16906
- const processError = (error52, path10 = []) => {
16906
+ const processError = (error52, path9 = []) => {
16907
16907
  var _a3, _b;
16908
16908
  for (const issue2 of error52.issues) {
16909
16909
  if (issue2.code === "invalid_union" && issue2.errors.length) {
16910
- issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
16910
+ issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
16911
16911
  } else if (issue2.code === "invalid_key") {
16912
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
16912
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
16913
16913
  } else if (issue2.code === "invalid_element") {
16914
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
16914
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
16915
16915
  } else {
16916
- const fullpath = [...path10, ...issue2.path];
16916
+ const fullpath = [...path9, ...issue2.path];
16917
16917
  if (fullpath.length === 0) {
16918
16918
  result.errors.push(mapper(issue2));
16919
16919
  continue;
@@ -16945,8 +16945,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
16945
16945
  }
16946
16946
  function toDotPath(_path) {
16947
16947
  const segs = [];
16948
- const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16949
- for (const seg of path10) {
16948
+ const path9 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16949
+ for (const seg of path9) {
16950
16950
  if (typeof seg === "number")
16951
16951
  segs.push(`[${seg}]`);
16952
16952
  else if (typeof seg === "symbol")
@@ -29638,13 +29638,13 @@ function resolveRef(ref, ctx) {
29638
29638
  if (!ref.startsWith("#")) {
29639
29639
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
29640
29640
  }
29641
- const path10 = ref.slice(1).split("/").filter(Boolean);
29642
- if (path10.length === 0) {
29641
+ const path9 = ref.slice(1).split("/").filter(Boolean);
29642
+ if (path9.length === 0) {
29643
29643
  return ctx.rootSchema;
29644
29644
  }
29645
29645
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
29646
- if (path10[0] === defsKey) {
29647
- const key2 = path10[1];
29646
+ if (path9[0] === defsKey) {
29647
+ const key2 = path9[1];
29648
29648
  if (!key2 || !ctx.defs[key2]) {
29649
29649
  throw new Error(`Reference not found: ${ref}`);
29650
29650
  }
@@ -30258,8 +30258,8 @@ var MapAnalysisSchema = external_exports.object({
30258
30258
  parsedFiles: external_exports.array(external_exports.string()),
30259
30259
  requiredFiles: external_exports.array(external_exports.string())
30260
30260
  }).strict();
30261
- var mapTestPath = (path10) => /(?:^|\/)(?:__tests__|tests?|fixtures?|testFixtures|e2e|testdata)(?:\/|$)|\.(?:spec|test)\.|_test\.(?:go|py)$|(?:^|\/)(?:test_[^/]*\.py|conftest\.py)$/iu.test(
30262
- path10
30261
+ var mapTestPath = (path9) => /(?:^|\/)(?:__tests__|tests?|fixtures?|testFixtures|e2e|testdata)(?:\/|$)|\.(?:spec|test)\.|_test\.(?:go|py)$|(?:^|\/)(?:test_[^/]*\.py|conftest\.py)$/iu.test(
30262
+ path9
30263
30263
  );
30264
30264
 
30265
30265
  // src/project-map-virtual-files.ts
@@ -30317,10 +30317,50 @@ function mapPackageOf(specifier) {
30317
30317
  if (isBuiltin(specifier)) return void 0;
30318
30318
  return /^(?:@[a-z0-9~][\w.~-]*\/)?[a-z0-9~][\w.~-]*(?=\/|$)/iu.exec(specifier)?.[0];
30319
30319
  }
30320
- function mapMissingPackage(code, text2) {
30320
+ var DEPENDENCY_FIELDS = [
30321
+ "dependencies",
30322
+ "devDependencies",
30323
+ "peerDependencies",
30324
+ "optionalDependencies"
30325
+ ];
30326
+ function directoriesAbove(file2) {
30327
+ const directories = [path3.posix.dirname(file2)];
30328
+ while (directories.at(-1) !== ".")
30329
+ directories.push(path3.posix.dirname(directories.at(-1) ?? "."));
30330
+ return directories;
30331
+ }
30332
+ var within = (directory, name) => directory === "." ? name : `${directory}/${name}`;
30333
+ function dependsOn(manifest, name) {
30334
+ try {
30335
+ const value = JSON.parse(manifest);
30336
+ return DEPENDENCY_FIELDS.some((field) => {
30337
+ const dependencies = value?.[field];
30338
+ return typeof dependencies === "object" && dependencies !== null ? Object.hasOwn(dependencies, name) : false;
30339
+ });
30340
+ } catch {
30341
+ return false;
30342
+ }
30343
+ }
30344
+ function mapPackages(files, directoryExists) {
30345
+ return {
30346
+ installed: (file2, name) => directoriesAbove(file2).some((at) => directoryExists(within(at, `node_modules/${name}`))),
30347
+ declared: (file2, name) => directoriesAbove(file2).some((at) => {
30348
+ const manifest = within(at, "package.json");
30349
+ return Object.hasOwn(files, manifest) && dependsOn(files[manifest] ?? "", name);
30350
+ })
30351
+ };
30352
+ }
30353
+ var SUGGESTING_TYPES = /* @__PURE__ */ new Set([2580, 2581, 2582, 2591, 2592, 2593, 2867, 2868]);
30354
+ function mapMissingPackage(code, text2, file2, packages) {
30355
+ if (SUGGESTING_TYPES.has(code)) {
30356
+ const [suggested, other] = new Set(text2.match(/@types\/[\w-]+(?:\.[\w-]+)*/gu));
30357
+ return suggested && !other && !packages.installed(file2, suggested) ? suggested : void 0;
30358
+ }
30321
30359
  if (code !== 2307 && code !== 2792 && code !== 2688) return void 0;
30322
30360
  const named = /'([^']+)'/u.exec(text2)?.[1];
30323
- return named ? mapPackageOf(named) : void 0;
30361
+ const name = named ? mapPackageOf(named) : void 0;
30362
+ if (code !== 2688 || !name || name !== named || name.startsWith("@")) return name;
30363
+ return packages.declared(file2, name) && !packages.declared(file2, `@types/${name}`) ? name : `@types/${name}`;
30324
30364
  }
30325
30365
  function mapInstalledPath(realRoot, relative) {
30326
30366
  try {
@@ -30707,7 +30747,7 @@ var directoryOf = (file2) => {
30707
30747
  const directory = path6.posix.dirname(file2);
30708
30748
  return directory === "." ? "" : directory;
30709
30749
  };
30710
- var within = (directory, file2) => !directory || inside(directory, file2);
30750
+ var within2 = (directory, file2) => !directory || inside(directory, file2);
30711
30751
  var TEST_CONFIG = /(?:test|spec|vitest|jest)[^/]*$/iu;
30712
30752
  function holders(members, selected) {
30713
30753
  const governing = /* @__PURE__ */ new Set();
@@ -30718,7 +30758,7 @@ function holders(members, selected) {
30718
30758
  const candidates = /* @__PURE__ */ new Map();
30719
30759
  for (const [configPath, sources] of members) {
30720
30760
  const directory = directoryOf(configPath);
30721
- const deeper = [...governing].filter((own) => own !== directory && within(directory, own));
30761
+ const deeper = [...governing].filter((own) => own !== directory && within2(directory, own));
30722
30762
  const spans = deeper.length > 0 && [...sources].some((source) => {
30723
30763
  const owner = governed.get(source);
30724
30764
  return owner !== void 0 && deeper.includes(directoryOf(owner));
@@ -31364,8 +31404,7 @@ var MapTargetResolver = class {
31364
31404
  const cached2 = this.cache.get(symbol2.id);
31365
31405
  if (cached2) return cached2;
31366
31406
  const original = symbol2.id;
31367
- if (symbol2.flags & SymbolFlags.Alias)
31368
- symbol2 = await this.project.checker.getAliasedSymbol(symbol2);
31407
+ symbol2 = await mapSymbolTarget(this.project, symbol2);
31369
31408
  const objects = [];
31370
31409
  const reasons = /* @__PURE__ */ new Set();
31371
31410
  const nodes = /* @__PURE__ */ new Map();
@@ -31407,7 +31446,7 @@ var MapTargetResolver = class {
31407
31446
  if (this.input.syntaxOnly || !symbol2) return [];
31408
31447
  const cached2 = this.mappedCache.get(symbol2.id);
31409
31448
  if (cached2) return cached2;
31410
- const target = symbol2.flags & SymbolFlags.Alias ? await this.project.checker.getAliasedSymbol(symbol2) : symbol2;
31449
+ const target = await mapSymbolTarget(this.project, symbol2);
31411
31450
  const objects = [];
31412
31451
  if (target.flags & SymbolFlags.Variable)
31413
31452
  for (const handle of target.declarations) {
@@ -31423,7 +31462,7 @@ var MapTargetResolver = class {
31423
31462
  // Other values stay unlinked, so resolving them never materializes locals.
31424
31463
  async resolveCallable(symbol2, depth = 0) {
31425
31464
  if (this.input.syntaxOnly || !symbol2) return void 0;
31426
- const target = symbol2.flags & SymbolFlags.Alias ? await this.project.checker.getAliasedSymbol(symbol2) : symbol2;
31465
+ const target = await mapSymbolTarget(this.project, symbol2);
31427
31466
  let callable = (target.flags & (SymbolFlags.Function | SymbolFlags.Method)) !== 0;
31428
31467
  if (!callable && target.flags & (SymbolFlags.Variable | SymbolFlags.Property))
31429
31468
  for (const handle of target.declarations) {
@@ -31444,6 +31483,11 @@ var MapTargetResolver = class {
31444
31483
  const resolved = await this.resolve(target);
31445
31484
  return resolved.objects.length ? resolved : void 0;
31446
31485
  }
31486
+ /**
31487
+ * What a symbol stands for: an alias's target, and for a binding taken apart from a module's
31488
+ * namespace, the export it takes: const { f } = await import("./m"), import("./m").then(({ f }) =>
31489
+ * ...), const { f } = ns. A binding taken apart from any other object stays the binding.
31490
+ */
31447
31491
  callableType(symbol2) {
31448
31492
  const known = this.callableTypes.get(symbol2.id);
31449
31493
  if (known) return known;
@@ -31473,6 +31517,25 @@ var MapTargetResolver = class {
31473
31517
  return [...objects.values()];
31474
31518
  }
31475
31519
  };
31520
+ async function mapSymbolTarget(project, symbol2) {
31521
+ const { checker } = project;
31522
+ if (symbol2.flags & SymbolFlags.Alias) return checker.getAliasedSymbol(symbol2);
31523
+ const [handle, other] = symbol2.declarations;
31524
+ if (!(symbol2.flags & SymbolFlags.Variable) || handle?.kind !== SyntaxKind.BindingElement || other)
31525
+ return symbol2;
31526
+ if (mapRelativePath(handle.path) === void 0) return symbol2;
31527
+ const node = await handle.resolve(project);
31528
+ if (!node || !isBindingElement(node) || node.dotDotDotToken) return symbol2;
31529
+ if (!isObjectBindingPattern(node.parent)) return symbol2;
31530
+ const key2 = node.propertyName ?? node.name;
31531
+ if (!key2 || !isIdentifier(key2) && !isStringLiteral(key2)) return symbol2;
31532
+ const type = await checker.getTypeAtLocation(node.parent);
31533
+ const namespace = type && await type.getSymbol();
31534
+ if (!type || !namespace || !(namespace.flags & SymbolFlags.ValueModule)) return symbol2;
31535
+ const taken = await checker.getPropertyOfType(type, key2.text);
31536
+ if (!taken) return symbol2;
31537
+ return taken.flags & SymbolFlags.Alias ? checker.getAliasedSymbol(taken) : taken;
31538
+ }
31476
31539
 
31477
31540
  // src/project-map-routes.ts
31478
31541
  var HTTP_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "TRACE"]);
@@ -31485,8 +31548,8 @@ var pathText = (node, computed2 = NONE) => {
31485
31548
  };
31486
31549
  var isFunction = (node) => node.kind === SyntaxKind.ArrowFunction || node.kind === SyntaxKind.FunctionExpression;
31487
31550
  var isDeclaration = (node) => node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.SourceFile;
31488
- function joinRoute(prefix, path10) {
31489
- const joined = !prefix ? path10 : !path10 ? prefix : `${prefix.replace(/\/+$/u, "")}/${path10.replace(/^\/+/u, "")}`;
31551
+ function joinRoute(prefix, path9) {
31552
+ const joined = !prefix ? path9 : !path9 ? prefix : `${prefix.replace(/\/+$/u, "")}/${path9.replace(/^\/+/u, "")}`;
31490
31553
  return joined.startsWith("/") || joined.startsWith("$") ? joined : `/${joined}`;
31491
31554
  }
31492
31555
  var httpMethod = (name) => HTTP_METHODS.has(name.toUpperCase()) ? name.toUpperCase() : void 0;
@@ -31504,25 +31567,25 @@ function registeredRoute(node, kind, computed2 = NONE) {
31504
31567
  function routeOf(call, index, computed2) {
31505
31568
  const callee = call.expression;
31506
31569
  const name = isPropertyAccessExpression(callee) ? callee.name.text : void 0;
31507
- let path10;
31570
+ let path9;
31508
31571
  let receiver = isPropertyAccessExpression(callee) ? callee.expression : void 0;
31509
31572
  const at = call.arguments.findIndex((argument) => pathText(argument, computed2) !== void 0);
31510
31573
  if (at >= 0) {
31511
31574
  if (index <= at) return void 0;
31512
- path10 = pathText(call.arguments[at], computed2);
31575
+ path9 = pathText(call.arguments[at], computed2);
31513
31576
  } else if (name && httpMethod(name) && receiver && isCallExpression(receiver) && isPropertyAccessExpression(receiver.expression) && receiver.arguments.length === 1) {
31514
- path10 = pathText(receiver.arguments[0], computed2);
31577
+ path9 = pathText(receiver.arguments[0], computed2);
31515
31578
  receiver = receiver.expression.expression;
31516
31579
  }
31517
- if (path10 === void 0) return void 0;
31580
+ if (path9 === void 0) return void 0;
31518
31581
  let method;
31519
- const space = path10.indexOf(" ");
31520
- if (space > 0) [method, path10] = [path10.slice(0, space), path10.slice(space).trimStart()];
31582
+ const space = path9.indexOf(" ");
31583
+ if (space > 0) [method, path9] = [path9.slice(0, space), path9.slice(space).trimStart()];
31521
31584
  method ??= name ? httpMethod(name) : void 0;
31522
- if (path10 === "/" && !method) return void 0;
31523
- const full = joinRoute(receiver ? routerPrefix(receiver, 0) : "", path10);
31585
+ if (path9 === "/" && !method) return void 0;
31586
+ const full = joinRoute(receiver ? routerPrefix(receiver, 0) : "", path9);
31524
31587
  const label = method ? `${method} ${full}` : full;
31525
- return label.length <= 256 ? { label, ...method ? { method } : {} } : { label: path10 };
31588
+ return label.length <= 256 ? { label, ...method ? { method } : {} } : { label: path9 };
31526
31589
  }
31527
31590
  function routerPrefix(expression, depth) {
31528
31591
  if (depth > 8) return "";
@@ -31530,8 +31593,8 @@ function routerPrefix(expression, depth) {
31530
31593
  const callee = expression.expression;
31531
31594
  if (!isPropertyAccessExpression(callee)) return "";
31532
31595
  const base = routerPrefix(callee.expression, depth + 1);
31533
- const path10 = expression.arguments.length === 1 ? pathText(expression.arguments[0]) : void 0;
31534
- return path10 === void 0 || path10.includes(" ") ? base : joinRoute(base, path10);
31596
+ const path9 = expression.arguments.length === 1 ? pathText(expression.arguments[0]) : void 0;
31597
+ return path9 === void 0 || path9.includes(" ") ? base : joinRoute(base, path9);
31535
31598
  }
31536
31599
  if (isIdentifier(expression)) {
31537
31600
  const declaration = constDeclaration(expression);
@@ -31573,8 +31636,8 @@ function decoratorRoute(decorator, argument) {
31573
31636
  break;
31574
31637
  }
31575
31638
  }
31576
- const path10 = argument ?? (call && text(call.arguments[0])) ?? "";
31577
- const route = `${method} ${joinRoute(prefix, path10)}`;
31639
+ const path9 = argument ?? (call && text(call.arguments[0])) ?? "";
31640
+ const route = `${method} ${joinRoute(prefix, path9)}`;
31578
31641
  return route.length <= 256 ? route : void 0;
31579
31642
  }
31580
31643
 
@@ -31667,7 +31730,7 @@ var MapPathFolder = class {
31667
31730
  }
31668
31731
  const values = /* @__PURE__ */ new Map();
31669
31732
  for (const request of requests) values.set(request, await this.fold(request.node, true, 0));
31670
- const path10 = (request) => {
31733
+ const path9 = (request) => {
31671
31734
  const value = values.get(request);
31672
31735
  return value && requestPath(value);
31673
31736
  };
@@ -31675,7 +31738,7 @@ var MapPathFolder = class {
31675
31738
  const clients = [];
31676
31739
  for (const request of requests) {
31677
31740
  const { makes } = request;
31678
- if (!makes || path10(request)) continue;
31741
+ if (!makes || path9(request)) continue;
31679
31742
  if (makes === true) makers.add(request);
31680
31743
  else if (receivers.some((receiver) => binds(makes, receiver))) {
31681
31744
  makers.add(request);
@@ -31683,7 +31746,7 @@ var MapPathFolder = class {
31683
31746
  }
31684
31747
  }
31685
31748
  const sent = requests.filter((request) => !makers.has(request));
31686
- const unsure = sent.filter((request) => request.get && !path10(request));
31749
+ const unsure = sent.filter((request) => request.get && !path9(request));
31687
31750
  const objects = new Map(
31688
31751
  (await this.mayBe(
31689
31752
  unsure.map(({ node }) => node),
@@ -31697,8 +31760,8 @@ var MapPathFolder = class {
31697
31760
  const { receiver } = request;
31698
31761
  const sure = request.sure || receiver !== void 0 && (client(receiver) || isIdentifier(receiver) && clients.some((binding) => binds(binding, receiver)));
31699
31762
  const value = values.get(request);
31700
- const found = path10(request);
31701
- const text2 = (path11) => method ? `${method} ${path11}` : path11;
31763
+ const found = path9(request);
31764
+ const text2 = (path10) => method ? `${method} ${path10}` : path10;
31702
31765
  if (found) requested.set(request.node, text2(found));
31703
31766
  else if (value === void 0 || value.includes(MAP_PATH_PARAMETER))
31704
31767
  unknown2.push({ node: request.node, method, sure, call: request.call });
@@ -31760,8 +31823,7 @@ var MapPathFolder = class {
31760
31823
  const callee = unwrap2(call.expression);
31761
31824
  const name = isPropertyAccessExpression(callee) ? callee.name : isIdentifier(callee) ? callee : void 0;
31762
31825
  const symbol2 = project && name && await project.checker.getSymbolAtLocation(name);
31763
- if (!project || !symbol2) return void 0;
31764
- return symbol2.flags & SymbolFlags.Alias ? await project.checker.getAliasedSymbol(symbol2) : symbol2;
31826
+ return project && symbol2 ? mapSymbolTarget(project, symbol2) : void 0;
31765
31827
  })
31766
31828
  );
31767
31829
  }
@@ -31773,8 +31835,8 @@ var MapPathFolder = class {
31773
31835
  const project = this.project;
31774
31836
  if (!project || !symbol2?.declarations.length || depth > 4) return false;
31775
31837
  for (const handle of symbol2.declarations) {
31776
- const path10 = mapRelativePath(handle.path);
31777
- if (path10 === void 0 || mapInNodeModules(path10) || /\.d\.[cm]?ts$/u.test(path10) || !mapTestPath(path10))
31838
+ const path9 = mapRelativePath(handle.path);
31839
+ if (path9 === void 0 || mapInNodeModules(path9) || /\.d\.[cm]?ts$/u.test(path9) || !mapTestPath(path9))
31778
31840
  return false;
31779
31841
  const node = await handle.resolve(project);
31780
31842
  if (node && isShorthandPropertyAssignment(node) ? !await helper(
@@ -31845,10 +31907,9 @@ var MapPathFolder = class {
31845
31907
  const local = constDeclaration(name);
31846
31908
  if (local) return this.fold(local, false, depth + 1);
31847
31909
  if (!this.project) return void 0;
31848
- let symbol2 = await this.project.checker.getSymbolAtLocation(name);
31849
- if (!symbol2) return void 0;
31850
- if (symbol2.flags & SymbolFlags.Alias)
31851
- symbol2 = await this.project.checker.getAliasedSymbol(symbol2);
31910
+ const named = await this.project.checker.getSymbolAtLocation(name);
31911
+ if (!named) return void 0;
31912
+ const symbol2 = await mapSymbolTarget(this.project, named);
31852
31913
  const id = symbol2.id;
31853
31914
  if (this.folding.has(id)) return void 0;
31854
31915
  const known = this.symbols.get(id);
@@ -31881,9 +31942,9 @@ function implemented(node) {
31881
31942
  return false;
31882
31943
  }
31883
31944
  function requestPath(value) {
31884
- const path10 = /^(?:https?:\/\/[^/\s]+|(?:\{\})+)?(\/[^\s?#]*)/u.exec(value)?.[1];
31885
- if (!path10 || path10.startsWith("//")) return void 0;
31886
- return path10.split("/").some((segment) => segment.length >= 2 && !segment.includes(MAP_PATH_PARAMETER)) ? path10 : void 0;
31945
+ const path9 = /^(?:https?:\/\/[^/\s]+|(?:\{\})+)?(\/[^\s?#]*)/u.exec(value)?.[1];
31946
+ if (!path9 || path9.startsWith("//")) return void 0;
31947
+ return path9.split("/").some((segment) => segment.length >= 2 && !segment.includes(MAP_PATH_PARAMETER)) ? path9 : void 0;
31887
31948
  }
31888
31949
  async function mayBe(type, strings, names, depth = 0) {
31889
31950
  if (!type || type.isErrorType() || type.isTypeParameter() || depth > 4) return true;
@@ -32038,7 +32099,7 @@ function moduleStateNames(file2) {
32038
32099
  }
32039
32100
  return { names, namespaces };
32040
32101
  }
32041
- async function extractProjectMap(project, input, trace, read, installed) {
32102
+ async function extractProjectMap(project, input, trace, read, packages) {
32042
32103
  const output = {
32043
32104
  contexts: [],
32044
32105
  objects: [],
@@ -32109,8 +32170,8 @@ async function extractProjectMap(project, input, trace, read, installed) {
32109
32170
  identities.set(key(node), value);
32110
32171
  return value;
32111
32172
  };
32112
- const gap = (code, path10) => {
32113
- output.gaps.push({ code, ...path10 ? { path: path10 } : {} });
32173
+ const gap = (code, path9) => {
32174
+ output.gaps.push({ code, ...path9 ? { path: path9 } : {} });
32114
32175
  };
32115
32176
  const addObject = (node, file2, kind, name) => {
32116
32177
  const location = anchor(node, file2);
@@ -32141,24 +32202,24 @@ async function extractProjectMap(project, input, trace, read, installed) {
32141
32202
  };
32142
32203
  const folder = new MapPathFolder(input.syntaxOnly ? void 0 : project);
32143
32204
  trace.phase = "SOURCE_FILES";
32144
- for await (const { file: file2, path: path10, syntaxErrors, exports } of mapSourceFiles(project, input, trace)) {
32205
+ for await (const { file: file2, path: path9, syntaxErrors, exports } of mapSourceFiles(project, input, trace)) {
32145
32206
  if (!file2) {
32146
- gap("SOURCE_NOT_PARSED", path10);
32207
+ gap("SOURCE_NOT_PARSED", path9);
32147
32208
  continue;
32148
32209
  }
32149
32210
  if (syntaxErrors) {
32150
- gap("SYNTAX_ERROR", path10);
32211
+ gap("SYNTAX_ERROR", path9);
32151
32212
  continue;
32152
32213
  }
32153
- output.parsedFiles.push(path10);
32154
- const fileObject = addObject(file2, file2, "FILE", path10);
32155
- if (!owned.has(path10)) continue;
32156
- const template = miniprogramTemplateOf(path10, inventory);
32214
+ output.parsedFiles.push(path9);
32215
+ const fileObject = addObject(file2, file2, "FILE", path9);
32216
+ if (!owned.has(path9)) continue;
32217
+ const template = miniprogramTemplateOf(path9, inventory);
32157
32218
  if (template) pages.push({ file: file2, template });
32158
32219
  exportedSymbols.set(file2.fileName, exports);
32159
32220
  const state = moduleStateNames(file2);
32160
32221
  trace.phase = "COMPUTED_PATHS";
32161
- const paths = await folder.file(file2, mapTestPath(path10));
32222
+ const paths = await folder.file(file2, mapTestPath(path9));
32162
32223
  trace.phase = "TRAVERSAL";
32163
32224
  const stack = [
32164
32225
  { node: file2, owner: fileObject, execution: fileObject, declarationExecution: fileObject }
@@ -32183,7 +32244,7 @@ async function extractProjectMap(project, input, trace, read, installed) {
32183
32244
  executionDeclaration?.kind ?? kind,
32184
32245
  executionDeclaration?.name ?? mapNodeLabel(name)
32185
32246
  );
32186
- if (owned.has(path10))
32247
+ if (owned.has(path9))
32187
32248
  collect.relation({
32188
32249
  from: owner.id,
32189
32250
  to: object2.id,
@@ -32192,11 +32253,11 @@ async function extractProjectMap(project, input, trace, read, installed) {
32192
32253
  target: object2.name,
32193
32254
  basis: "SYNTAX_DECLARED"
32194
32255
  });
32195
- if (owned.has(path10) && name) declarations.push({ object: object2, name, node, file: file2 });
32256
+ if (owned.has(path9) && name) declarations.push({ object: object2, name, node, file: file2 });
32196
32257
  if (object2.kind === "VARIABLE" && !object2.execution && item.owner.kind === "FILE")
32197
32258
  moduleVariables.add(object2.id);
32198
32259
  owner = object2;
32199
- if (kind === "INTERFACE" && owned.has(path10)) {
32260
+ if (kind === "INTERFACE" && owned.has(path9)) {
32200
32261
  const note = {
32201
32262
  entityRef: object2.id,
32202
32263
  kind: "CONTRACT_DECLARATION",
@@ -32334,7 +32395,7 @@ async function extractProjectMap(project, input, trace, read, installed) {
32334
32395
  if (element.name && isIdentifier(element.name)) valueNames.add(element.name.text);
32335
32396
  }
32336
32397
  }
32337
- if (reference && owned.has(path10)) {
32398
+ if (reference && owned.has(path9)) {
32338
32399
  pending.push({
32339
32400
  ...reference,
32340
32401
  owner: ["CALLS", "WRITES"].includes(reference.kind) ? item.execution.id : owner.id,
@@ -32402,8 +32463,8 @@ async function extractProjectMap(project, input, trace, read, installed) {
32402
32463
  const kind = mapDeclarationKind(node, true);
32403
32464
  const executionDeclaration = mapExecutionDeclaration(node);
32404
32465
  const file2 = node.getSourceFile();
32405
- const path10 = mapRelativePath(file2.fileName);
32406
- if (!executionDeclaration && (!name || !kind) || !path10 || !Object.hasOwn(input.files, path10))
32466
+ const path9 = mapRelativePath(file2.fileName);
32467
+ if (!executionDeclaration && (!name || !kind) || !path9 || !Object.hasOwn(input.files, path9))
32407
32468
  return void 0;
32408
32469
  const object2 = addObject(
32409
32470
  node,
@@ -32415,7 +32476,7 @@ async function extractProjectMap(project, input, trace, read, installed) {
32415
32476
  while (parent && !declared.has(key(parent)) && !(mapDeclarationKind(parent) && mapDeclarationName(parent)) && !mapExecutionDeclaration(parent))
32416
32477
  parent = parent.parent;
32417
32478
  const owner = parent ? materialize(parent) : void 0;
32418
- if (owner && owned.has(path10))
32479
+ if (owner && owned.has(path9))
32419
32480
  collect.relation({
32420
32481
  from: owner.id,
32421
32482
  to: object2.id,
@@ -32480,7 +32541,7 @@ async function extractProjectMap(project, input, trace, read, installed) {
32480
32541
  contextRef: input.contextRef,
32481
32542
  inventory,
32482
32543
  read,
32483
- span: (path10, start, end) => positions.span(path10, start, end),
32544
+ span: (path9, start, end) => positions.span(path9, start, end),
32484
32545
  materialize,
32485
32546
  composed
32486
32547
  });
@@ -32660,14 +32721,19 @@ async function extractProjectMap(project, input, trace, read, installed) {
32660
32721
  const notInstalled = /* @__PURE__ */ new Set();
32661
32722
  for (const diagnostic of await project.program.getProgramDiagnostics()) {
32662
32723
  gap(`TSC_PROGRAM_${diagnostic.code}`, input.configPath);
32663
- const name = mapMissingPackage(diagnostic.code, diagnostic.text);
32724
+ const name = mapMissingPackage(
32725
+ diagnostic.code,
32726
+ diagnostic.text,
32727
+ input.configPath ?? ".",
32728
+ packages
32729
+ );
32664
32730
  if (name) notInstalled.add(name);
32665
32731
  }
32666
32732
  for (const relation of output.relations) {
32667
32733
  if (relation.kind !== "IMPORTS" || relation.unresolvedReason !== "SYMBOL_NOT_RESOLVED")
32668
32734
  continue;
32669
32735
  const name = mapPackageOf(relation.target);
32670
- if (name && !installed(relation.anchor.path, name)) notInstalled.add(name);
32736
+ if (name && !packages.installed(relation.anchor.path, name)) notInstalled.add(name);
32671
32737
  }
32672
32738
  for (const name of [...notInstalled].sort())
32673
32739
  output.gaps.push({ code: MAP_DEPENDENCY_NOT_INSTALLED, package: name });
@@ -32819,11 +32885,11 @@ function mapWorkerFailure(error51, trace, workerUrl) {
32819
32885
  }
32820
32886
 
32821
32887
  // src/project-map-reference-diagnostics.ts
32822
- async function extractMapDiagnostics(project, input, programFiles) {
32888
+ async function extractMapDiagnostics(project, input, programFiles, packages) {
32823
32889
  const diagnostics = [];
32824
32890
  const missing = /* @__PURE__ */ new Set();
32825
32891
  for (const item of await project.program.getProgramDiagnostics()) {
32826
- const name = mapMissingPackage(item.code, item.text);
32892
+ const name = mapMissingPackage(item.code, item.text, input.configPath ?? ".", packages);
32827
32893
  if (name) missing.add(name);
32828
32894
  }
32829
32895
  for (const name of programFiles) {
@@ -32832,7 +32898,7 @@ async function extractMapDiagnostics(project, input, programFiles) {
32832
32898
  if (relative === void 0 || text2 === void 0) continue;
32833
32899
  for (const item of await project.program.getSemanticDiagnostics(name)) {
32834
32900
  if (item.category !== DiagnosticCategory.Error) continue;
32835
- const missed = mapMissingPackage(item.code, item.text);
32901
+ const missed = mapMissingPackage(item.code, item.text, relative, packages);
32836
32902
  if (missed) missing.add(missed);
32837
32903
  let line = 1;
32838
32904
  for (let at = text2.indexOf("\n"); at >= 0 && at < item.pos; at = text2.indexOf("\n", at + 1))
@@ -32850,7 +32916,7 @@ async function extractMapDiagnostics(project, input, programFiles) {
32850
32916
  }
32851
32917
 
32852
32918
  // src/project-map-query-selection.ts
32853
- var mapQueryPathMatches = (path10, prefix) => prefix === "." || path10 === prefix || path10.startsWith(`${prefix}/`);
32919
+ var mapQueryPathMatches = (path9, prefix) => prefix === "." || path9 === prefix || path9.startsWith(`${prefix}/`);
32854
32920
 
32855
32921
  // src/project-map-reference-extract.ts
32856
32922
  function referenceKind(node) {
@@ -32883,9 +32949,9 @@ async function indexedAccesses(project, input, token) {
32883
32949
  "gu"
32884
32950
  );
32885
32951
  const literals = [];
32886
- for (const [path10, text2] of Object.entries(input.files)) {
32952
+ for (const [path9, text2] of Object.entries(input.files)) {
32887
32953
  const matches = [...text2.matchAll(index)];
32888
- const file2 = matches.length && await project.program.getSourceFile(mapVirtualPath(path10));
32954
+ const file2 = matches.length && await project.program.getSourceFile(mapVirtualPath(path9));
32889
32955
  if (!file2) continue;
32890
32956
  for (const match of matches) {
32891
32957
  const literal3 = getTokenAtPosition(file2, match.index + match[0].length - name.length - 2);
@@ -33055,8 +33121,12 @@ process.once(
33055
33121
  await timing?.checkpoint(api, "OPEN_PROJECT");
33056
33122
  trace.phase = message.operation === "REFERENCES" ? "REFERENCES" : "SOURCE_FILES";
33057
33123
  const programFiles = await project.program.getSourceFileNames();
33124
+ const packages = mapPackages(
33125
+ message.files,
33126
+ (relative) => files.fs.directoryExists?.(mapVirtualPath(relative)) ?? false
33127
+ );
33058
33128
  if (message.operation === "DIAGNOSTICS") {
33059
- const result3 = await extractMapDiagnostics(project, message, programFiles);
33129
+ const result3 = await extractMapDiagnostics(project, message, programFiles, packages);
33060
33130
  result3.requiredFiles = [...files.required].sort();
33061
33131
  await snapshot.dispose();
33062
33132
  return result3;
@@ -33077,14 +33147,7 @@ process.once(
33077
33147
  const text2 = files.fs.readFile?.(mapVirtualPath(file2));
33078
33148
  return typeof text2 === "string" && Object.hasOwn(message.files, file2) ? text2 : void 0;
33079
33149
  },
33080
- (file2, name) => {
33081
- for (let at = path9.posix.dirname(file2); ; at = path9.posix.dirname(at)) {
33082
- const modules = at === "." ? "node_modules" : `${at}/node_modules`;
33083
- if (files.fs.directoryExists?.(mapVirtualPath(`${modules}/${name}`)))
33084
- return true;
33085
- if (at === ".") return false;
33086
- }
33087
- }
33150
+ packages
33088
33151
  );
33089
33152
  result2.requiredFiles = [...files.required].sort();
33090
33153
  if ("contexts" in result2) {