layermap 0.1.26 → 0.1.28

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 path7 = __importStar(__require("path"));
3455
+ var path8 = __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 path7.join(tmpDir, `lsp-${randomSuffix}.sock`);
3607
+ return path8.join(tmpDir, `lsp-${randomSuffix}.sock`);
3608
3608
  }
3609
3609
  function createClientPipeTransport(pipeName, encoding = "utf-8") {
3610
3610
  let connectResolve;
@@ -4845,6 +4845,9 @@ function isCaseBlock(node) {
4845
4845
  function isCatchClause(node) {
4846
4846
  return node.kind === SyntaxKind.CatchClause;
4847
4847
  }
4848
+ function isExpressionStatement(node) {
4849
+ return node.kind === SyntaxKind.ExpressionStatement;
4850
+ }
4848
4851
  function isBlock(node) {
4849
4852
  return node.kind === SyntaxKind.Block;
4850
4853
  }
@@ -4923,6 +4926,9 @@ function isNewExpression(node) {
4923
4926
  function isObjectLiteralExpression(node) {
4924
4927
  return node.kind === SyntaxKind.ObjectLiteralExpression;
4925
4928
  }
4929
+ function isPropertyAssignment(node) {
4930
+ return node.kind === SyntaxKind.PropertyAssignment;
4931
+ }
4926
4932
  function isShorthandPropertyAssignment(node) {
4927
4933
  return node.kind === SyntaxKind.ShorthandPropertyAssignment;
4928
4934
  }
@@ -7003,10 +7009,10 @@ function createParameterDeclaration(modifiers, dotDotDotToken, name, questionTok
7003
7009
  initializer: initializer3
7004
7010
  });
7005
7011
  }
7006
- function createBindingElement(dotDotDotToken, propertyName, name, initializer3) {
7012
+ function createBindingElement(dotDotDotToken, propertyName2, name, initializer3) {
7007
7013
  return new NodeObject(SyntaxKind.BindingElement, {
7008
7014
  dotDotDotToken,
7009
- propertyName,
7015
+ propertyName: propertyName2,
7010
7016
  name,
7011
7017
  initializer: initializer3
7012
7018
  });
@@ -7133,10 +7139,10 @@ function createNamedExports(elements) {
7133
7139
  elements: createNodeArray(elements)
7134
7140
  });
7135
7141
  }
7136
- function createExportSpecifier(isTypeOnly = false, propertyName, name) {
7142
+ function createExportSpecifier(isTypeOnly = false, propertyName2, name) {
7137
7143
  return new NodeObject(SyntaxKind.ExportSpecifier, {
7138
7144
  isTypeOnly,
7139
- propertyName,
7145
+ propertyName: propertyName2,
7140
7146
  name
7141
7147
  });
7142
7148
  }
@@ -7900,10 +7906,10 @@ function createImportClause(phaseModifier, name, namedBindings) {
7900
7906
  namedBindings
7901
7907
  });
7902
7908
  }
7903
- function createImportSpecifier(isTypeOnly = false, propertyName, name) {
7909
+ function createImportSpecifier(isTypeOnly = false, propertyName2, name) {
7904
7910
  return new NodeObject(SyntaxKind.ImportSpecifier, {
7905
7911
  isTypeOnly,
7906
- propertyName,
7912
+ propertyName: propertyName2,
7907
7913
  name
7908
7914
  });
7909
7915
  }
@@ -8073,8 +8079,8 @@ function updateVariableDeclarationList(node, declarations) {
8073
8079
  function updateParameterDeclaration(node, modifiers, dotDotDotToken, name, questionToken, type, initializer3) {
8074
8080
  return node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.questionToken !== questionToken || node.type !== type || node.initializer !== initializer3 ? createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer3) : node;
8075
8081
  }
8076
- function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer3) {
8077
- return node.dotDotDotToken !== dotDotDotToken || node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer3 ? createBindingElement(dotDotDotToken, propertyName, name, initializer3) : node;
8082
+ function updateBindingElement(node, dotDotDotToken, propertyName2, name, initializer3) {
8083
+ return node.dotDotDotToken !== dotDotDotToken || node.propertyName !== propertyName2 || node.name !== name || node.initializer !== initializer3 ? createBindingElement(dotDotDotToken, propertyName2, name, initializer3) : node;
8078
8084
  }
8079
8085
  function updateMissingDeclaration(node, modifiers) {
8080
8086
  return node.modifiers !== modifiers ? createMissingDeclaration(modifiers) : node;
@@ -8130,8 +8136,8 @@ function updateNamespaceExport(node, name) {
8130
8136
  function updateNamedExports(node, elements) {
8131
8137
  return node.elements !== elements ? createNamedExports(elements) : node;
8132
8138
  }
8133
- function updateExportSpecifier(node, propertyName, name) {
8134
- return node.propertyName !== propertyName || node.name !== name ? createExportSpecifier(node.isTypeOnly, propertyName, name) : node;
8139
+ function updateExportSpecifier(node, propertyName2, name) {
8140
+ return node.propertyName !== propertyName2 || node.name !== name ? createExportSpecifier(node.isTypeOnly, propertyName2, name) : node;
8135
8141
  }
8136
8142
  function updateCallSignatureDeclaration(node, typeParameters, parameters, type) {
8137
8143
  return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? createCallSignatureDeclaration(typeParameters, parameters, type) : node;
@@ -8469,8 +8475,8 @@ function updateImportTypeNode(node, argument, attributes, qualifier, typeArgumen
8469
8475
  function updateImportClause(node, name, namedBindings) {
8470
8476
  return node.name !== name || node.namedBindings !== namedBindings ? createImportClause(node.phaseModifier, name, namedBindings) : node;
8471
8477
  }
8472
- function updateImportSpecifier(node, propertyName, name) {
8473
- return node.propertyName !== propertyName || node.name !== name ? createImportSpecifier(node.isTypeOnly, propertyName, name) : node;
8478
+ function updateImportSpecifier(node, propertyName2, name) {
8479
+ return node.propertyName !== propertyName2 || node.name !== name ? createImportSpecifier(node.isTypeOnly, propertyName2, name) : node;
8474
8480
  }
8475
8481
  function updateJSDocLink(node, name) {
8476
8482
  return node.name !== name ? createJSDocLink(name, node.text) : node;
@@ -12225,13 +12231,13 @@ var RemoteNode = class _RemoteNode extends RemoteNodeBase {
12225
12231
  const nextNodeParent = this.view.getUint32(this.sourceFile._offsetNodes + (this.index + 1) * NODE_LEN + NODE_OFFSET_PARENT, true);
12226
12232
  return nextNodeParent === this.index;
12227
12233
  }
12228
- getNamedChild(propertyName) {
12234
+ getNamedChild(propertyName2) {
12229
12235
  const kind = this.kind;
12230
12236
  const propertyNames = childProperties[kind];
12231
12237
  if (!propertyNames) {
12232
12238
  return void 0;
12233
12239
  }
12234
- const order = propertyNames.indexOf(propertyName);
12240
+ const order = propertyNames.indexOf(propertyName2);
12235
12241
  if (order === -1) {
12236
12242
  return void 0;
12237
12243
  }
@@ -13008,116 +13014,116 @@ function getFileUrlVolumeSeparatorEnd(url2, start) {
13008
13014
  }
13009
13015
  return -1;
13010
13016
  }
13011
- function getRootLength(path7) {
13012
- const rootLength = getEncodedRootLength(path7);
13017
+ function getRootLength(path8) {
13018
+ const rootLength = getEncodedRootLength(path8);
13013
13019
  return rootLength < 0 ? ~rootLength : rootLength;
13014
13020
  }
13015
- function getEncodedRootLength(path7) {
13016
- if (!path7)
13021
+ function getEncodedRootLength(path8) {
13022
+ if (!path8)
13017
13023
  return 0;
13018
- const ch0 = path7.charCodeAt(0);
13024
+ const ch0 = path8.charCodeAt(0);
13019
13025
  if (ch0 === CharacterCodesSlash || ch0 === CharacterCodesBackslash) {
13020
- if (path7.charCodeAt(1) !== ch0)
13026
+ if (path8.charCodeAt(1) !== ch0)
13021
13027
  return 1;
13022
- const p1 = path7.indexOf(ch0 === CharacterCodesSlash ? directorySeparator : altDirectorySeparator, 2);
13028
+ const p1 = path8.indexOf(ch0 === CharacterCodesSlash ? directorySeparator : altDirectorySeparator, 2);
13023
13029
  if (p1 < 0)
13024
- return path7.length;
13030
+ return path8.length;
13025
13031
  return p1 + 1;
13026
13032
  }
13027
- if (isVolumeCharacter(ch0) && path7.charCodeAt(1) === CharacterCodesColon) {
13028
- const ch2 = path7.charCodeAt(2);
13033
+ if (isVolumeCharacter(ch0) && path8.charCodeAt(1) === CharacterCodesColon) {
13034
+ const ch2 = path8.charCodeAt(2);
13029
13035
  if (ch2 === CharacterCodesSlash || ch2 === CharacterCodesBackslash)
13030
13036
  return 3;
13031
- if (path7.length === 2)
13037
+ if (path8.length === 2)
13032
13038
  return 2;
13033
13039
  }
13034
- const schemeEnd = path7.indexOf(urlSchemeSeparator);
13040
+ const schemeEnd = path8.indexOf(urlSchemeSeparator);
13035
13041
  if (schemeEnd !== -1) {
13036
13042
  const authorityStart = schemeEnd + urlSchemeSeparator.length;
13037
- const authorityEnd = path7.indexOf(directorySeparator, authorityStart);
13043
+ const authorityEnd = path8.indexOf(directorySeparator, authorityStart);
13038
13044
  if (authorityEnd !== -1) {
13039
- const scheme = path7.slice(0, schemeEnd);
13040
- const authority = path7.slice(authorityStart, authorityEnd);
13041
- if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path7.charCodeAt(authorityEnd + 1))) {
13042
- const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path7, authorityEnd + 2);
13045
+ const scheme = path8.slice(0, schemeEnd);
13046
+ const authority = path8.slice(authorityStart, authorityEnd);
13047
+ if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path8.charCodeAt(authorityEnd + 1))) {
13048
+ const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path8, authorityEnd + 2);
13043
13049
  if (volumeSeparatorEnd !== -1) {
13044
- if (path7.charCodeAt(volumeSeparatorEnd) === CharacterCodesSlash) {
13050
+ if (path8.charCodeAt(volumeSeparatorEnd) === CharacterCodesSlash) {
13045
13051
  return ~(volumeSeparatorEnd + 1);
13046
13052
  }
13047
- if (volumeSeparatorEnd === path7.length) {
13053
+ if (volumeSeparatorEnd === path8.length) {
13048
13054
  return ~volumeSeparatorEnd;
13049
13055
  }
13050
13056
  }
13051
13057
  }
13052
13058
  return ~(authorityEnd + 1);
13053
13059
  }
13054
- return ~path7.length;
13060
+ return ~path8.length;
13055
13061
  }
13056
13062
  return 0;
13057
13063
  }
13058
- function hasTrailingDirectorySeparator(path7) {
13059
- return path7.length > 0 && isAnyDirectorySeparator(path7.charCodeAt(path7.length - 1));
13064
+ function hasTrailingDirectorySeparator(path8) {
13065
+ return path8.length > 0 && isAnyDirectorySeparator(path8.charCodeAt(path8.length - 1));
13060
13066
  }
13061
- function removeTrailingDirectorySeparator(path7) {
13062
- if (hasTrailingDirectorySeparator(path7)) {
13063
- return path7.substr(0, path7.length - 1);
13067
+ function removeTrailingDirectorySeparator(path8) {
13068
+ if (hasTrailingDirectorySeparator(path8)) {
13069
+ return path8.substr(0, path8.length - 1);
13064
13070
  }
13065
- return path7;
13071
+ return path8;
13066
13072
  }
13067
- function ensureTrailingDirectorySeparator(path7) {
13068
- if (!hasTrailingDirectorySeparator(path7)) {
13069
- return path7 + directorySeparator;
13073
+ function ensureTrailingDirectorySeparator(path8) {
13074
+ if (!hasTrailingDirectorySeparator(path8)) {
13075
+ return path8 + directorySeparator;
13070
13076
  }
13071
- return path7;
13077
+ return path8;
13072
13078
  }
13073
- function normalizeSlashes(path7) {
13074
- return path7.includes("\\") ? path7.replace(backslashRegExp, directorySeparator) : path7;
13079
+ function normalizeSlashes(path8) {
13080
+ return path8.includes("\\") ? path8.replace(backslashRegExp, directorySeparator) : path8;
13075
13081
  }
13076
- function combinePaths(path7, ...paths) {
13077
- if (path7)
13078
- path7 = normalizeSlashes(path7);
13082
+ function combinePaths(path8, ...paths) {
13083
+ if (path8)
13084
+ path8 = normalizeSlashes(path8);
13079
13085
  for (let relativePath of paths) {
13080
13086
  if (!relativePath)
13081
13087
  continue;
13082
13088
  relativePath = normalizeSlashes(relativePath);
13083
- if (!path7 || getRootLength(relativePath) !== 0) {
13084
- path7 = relativePath;
13089
+ if (!path8 || getRootLength(relativePath) !== 0) {
13090
+ path8 = relativePath;
13085
13091
  } else {
13086
- path7 = ensureTrailingDirectorySeparator(path7) + relativePath;
13092
+ path8 = ensureTrailingDirectorySeparator(path8) + relativePath;
13087
13093
  }
13088
13094
  }
13089
- return path7;
13095
+ return path8;
13090
13096
  }
13091
- function simpleNormalizePath(path7) {
13092
- if (!relativePathSegmentRegExp.test(path7)) {
13093
- return path7;
13097
+ function simpleNormalizePath(path8) {
13098
+ if (!relativePathSegmentRegExp.test(path8)) {
13099
+ return path8;
13094
13100
  }
13095
- let simplified = path7.replace(/\/\.\//g, "/");
13101
+ let simplified = path8.replace(/\/\.\//g, "/");
13096
13102
  if (simplified.startsWith("./")) {
13097
13103
  simplified = simplified.slice(2);
13098
13104
  }
13099
- if (simplified !== path7) {
13100
- path7 = simplified;
13101
- if (!relativePathSegmentRegExp.test(path7)) {
13102
- return path7;
13105
+ if (simplified !== path8) {
13106
+ path8 = simplified;
13107
+ if (!relativePathSegmentRegExp.test(path8)) {
13108
+ return path8;
13103
13109
  }
13104
13110
  }
13105
13111
  return void 0;
13106
13112
  }
13107
- function getNormalizedAbsolutePath(path7, currentDirectory) {
13108
- let rootLength = getRootLength(path7);
13113
+ function getNormalizedAbsolutePath(path8, currentDirectory) {
13114
+ let rootLength = getRootLength(path8);
13109
13115
  if (rootLength === 0 && currentDirectory) {
13110
- path7 = combinePaths(currentDirectory, path7);
13111
- rootLength = getRootLength(path7);
13116
+ path8 = combinePaths(currentDirectory, path8);
13117
+ rootLength = getRootLength(path8);
13112
13118
  } else {
13113
- path7 = normalizeSlashes(path7);
13119
+ path8 = normalizeSlashes(path8);
13114
13120
  }
13115
- const simpleNormalized = simpleNormalizePath(path7);
13121
+ const simpleNormalized = simpleNormalizePath(path8);
13116
13122
  if (simpleNormalized !== void 0) {
13117
13123
  return simpleNormalized.length > rootLength ? removeTrailingDirectorySeparator(simpleNormalized) : simpleNormalized;
13118
13124
  }
13119
- const length = path7.length;
13120
- const root = path7.substring(0, rootLength);
13125
+ const length = path8.length;
13126
+ const root = path8.substring(0, rootLength);
13121
13127
  let normalized;
13122
13128
  let index = rootLength;
13123
13129
  let segmentStart = index;
@@ -13125,23 +13131,23 @@ function getNormalizedAbsolutePath(path7, currentDirectory) {
13125
13131
  let seenNonDotDotSegment = rootLength !== 0;
13126
13132
  while (index < length) {
13127
13133
  segmentStart = index;
13128
- let ch = path7.charCodeAt(index);
13134
+ let ch = path8.charCodeAt(index);
13129
13135
  while (ch === CharacterCodesSlash && index + 1 < length) {
13130
13136
  index++;
13131
- ch = path7.charCodeAt(index);
13137
+ ch = path8.charCodeAt(index);
13132
13138
  }
13133
13139
  if (index > segmentStart) {
13134
- normalized ??= path7.substring(0, segmentStart - 1);
13140
+ normalized ??= path8.substring(0, segmentStart - 1);
13135
13141
  segmentStart = index;
13136
13142
  }
13137
- let segmentEnd = path7.indexOf(directorySeparator, index + 1);
13143
+ let segmentEnd = path8.indexOf(directorySeparator, index + 1);
13138
13144
  if (segmentEnd === -1) {
13139
13145
  segmentEnd = length;
13140
13146
  }
13141
13147
  const segmentLength = segmentEnd - segmentStart;
13142
- if (segmentLength === 1 && path7.charCodeAt(index) === CharacterCodesDot) {
13143
- normalized ??= path7.substring(0, normalizedUpTo);
13144
- } else if (segmentLength === 2 && path7.charCodeAt(index) === CharacterCodesDot && path7.charCodeAt(index + 1) === CharacterCodesDot) {
13148
+ if (segmentLength === 1 && path8.charCodeAt(index) === CharacterCodesDot) {
13149
+ normalized ??= path8.substring(0, normalizedUpTo);
13150
+ } else if (segmentLength === 2 && path8.charCodeAt(index) === CharacterCodesDot && path8.charCodeAt(index + 1) === CharacterCodesDot) {
13145
13151
  if (!seenNonDotDotSegment) {
13146
13152
  if (normalized !== void 0) {
13147
13153
  normalized += normalized.length === rootLength ? ".." : "/..";
@@ -13150,9 +13156,9 @@ function getNormalizedAbsolutePath(path7, currentDirectory) {
13150
13156
  }
13151
13157
  } else if (normalized === void 0) {
13152
13158
  if (normalizedUpTo - 2 >= 0) {
13153
- normalized = path7.substring(0, Math.max(rootLength, path7.lastIndexOf(directorySeparator, normalizedUpTo - 2)));
13159
+ normalized = path8.substring(0, Math.max(rootLength, path8.lastIndexOf(directorySeparator, normalizedUpTo - 2)));
13154
13160
  } else {
13155
- normalized = path7.substring(0, normalizedUpTo);
13161
+ normalized = path8.substring(0, normalizedUpTo);
13156
13162
  }
13157
13163
  } else {
13158
13164
  const lastSlash = normalized.lastIndexOf(directorySeparator);
@@ -13170,26 +13176,26 @@ function getNormalizedAbsolutePath(path7, currentDirectory) {
13170
13176
  normalized += directorySeparator;
13171
13177
  }
13172
13178
  seenNonDotDotSegment = true;
13173
- normalized += path7.substring(segmentStart, segmentEnd);
13179
+ normalized += path8.substring(segmentStart, segmentEnd);
13174
13180
  } else {
13175
13181
  seenNonDotDotSegment = true;
13176
13182
  normalizedUpTo = segmentEnd;
13177
13183
  }
13178
13184
  index = segmentEnd + 1;
13179
13185
  }
13180
- return normalized ?? (length > rootLength ? removeTrailingDirectorySeparator(path7) : path7);
13186
+ return normalized ?? (length > rootLength ? removeTrailingDirectorySeparator(path8) : path8);
13181
13187
  }
13182
- function normalizePath(path7) {
13183
- path7 = normalizeSlashes(path7);
13184
- let normalized = simpleNormalizePath(path7);
13188
+ function normalizePath(path8) {
13189
+ path8 = normalizeSlashes(path8);
13190
+ let normalized = simpleNormalizePath(path8);
13185
13191
  if (normalized !== void 0) {
13186
13192
  return normalized;
13187
13193
  }
13188
- normalized = getNormalizedAbsolutePath(path7, "");
13189
- return normalized && hasTrailingDirectorySeparator(path7) ? ensureTrailingDirectorySeparator(normalized) : normalized;
13194
+ normalized = getNormalizedAbsolutePath(path8, "");
13195
+ return normalized && hasTrailingDirectorySeparator(path8) ? ensureTrailingDirectorySeparator(normalized) : normalized;
13190
13196
  }
13191
- function isRootedDiskPath(path7) {
13192
- return getEncodedRootLength(path7) > 0;
13197
+ function isRootedDiskPath(path8) {
13198
+ return getEncodedRootLength(path8) > 0;
13193
13199
  }
13194
13200
  function toPath(fileName, basePath, getCanonicalFileName) {
13195
13201
  const nonCanonicalizedPath = isRootedDiskPath(fileName) ? normalizePath(fileName) : getNormalizedAbsolutePath(fileName, basePath);
@@ -13205,14 +13211,14 @@ function toLowerCase(s) {
13205
13211
  return s.toLowerCase();
13206
13212
  }
13207
13213
  var bundledScheme = "bundled:///";
13208
- function isBundled(path7) {
13209
- return path7.startsWith(bundledScheme);
13214
+ function isBundled(path8) {
13215
+ return path8.startsWith(bundledScheme);
13210
13216
  }
13211
- function splitVolumePath(path7) {
13212
- if (path7.length >= 2 && isVolumeCharacter(path7.charCodeAt(0)) && path7.charCodeAt(1) === CharacterCodesColon) {
13213
- return [path7.substring(0, 2).toLowerCase(), path7.substring(2), true];
13217
+ function splitVolumePath(path8) {
13218
+ if (path8.length >= 2 && isVolumeCharacter(path8.charCodeAt(0)) && path8.charCodeAt(1) === CharacterCodesColon) {
13219
+ return [path8.substring(0, 2).toLowerCase(), path8.substring(2), true];
13214
13220
  }
13215
- return ["", path7, false];
13221
+ return ["", path8, false];
13216
13222
  }
13217
13223
  function documentURIToFileName(uri) {
13218
13224
  if (isBundled(uri)) {
@@ -13228,32 +13234,32 @@ function documentURIToFileName(uri) {
13228
13234
  if (parsed.host !== "") {
13229
13235
  return "//" + parsed.host + parsed.pathname;
13230
13236
  }
13231
- const path8 = decodeURIComponent(parsed.pathname);
13232
- if (path8.length >= 3 && path8.charCodeAt(0) === CharacterCodesSlash) {
13233
- const [volume, rest, ok] = splitVolumePath(path8.substring(1));
13237
+ const path9 = decodeURIComponent(parsed.pathname);
13238
+ if (path9.length >= 3 && path9.charCodeAt(0) === CharacterCodesSlash) {
13239
+ const [volume, rest, ok] = splitVolumePath(path9.substring(1));
13234
13240
  if (ok) {
13235
13241
  return volume + rest;
13236
13242
  }
13237
13243
  }
13238
- return path8;
13244
+ return path9;
13239
13245
  }
13240
13246
  const colonIndex = uri.indexOf(":");
13241
13247
  if (colonIndex === -1) {
13242
13248
  throw new Error("invalid URI: " + uri);
13243
13249
  }
13244
13250
  const scheme = uri.substring(0, colonIndex);
13245
- let path7 = uri.substring(colonIndex + 1);
13251
+ let path8 = uri.substring(colonIndex + 1);
13246
13252
  let authority = "ts-nul-authority";
13247
- if (path7.startsWith("//")) {
13248
- const rest = path7.substring(2);
13253
+ if (path8.startsWith("//")) {
13254
+ const rest = path8.substring(2);
13249
13255
  const slashIndex = rest.indexOf("/");
13250
13256
  if (slashIndex === -1) {
13251
13257
  throw new Error("invalid URI: " + uri);
13252
13258
  }
13253
13259
  authority = rest.substring(0, slashIndex);
13254
- path7 = rest.substring(slashIndex + 1);
13260
+ path8 = rest.substring(slashIndex + 1);
13255
13261
  }
13256
- return "^/" + scheme + "/" + authority + "/" + path7;
13262
+ return "^/" + scheme + "/" + authority + "/" + path8;
13257
13263
  }
13258
13264
 
13259
13265
  // node_modules/.pnpm/typescript@7.0.2/node_modules/typescript/dist/api/proto.js
@@ -13290,8 +13296,8 @@ var SourceFileCache = class {
13290
13296
  * A given (snapshot, project) pair always parses a file the same way, so there is
13291
13297
  * at most one matching entry per ref.
13292
13298
  */
13293
- getRetained(path7, snapshotId, projectId) {
13294
- const entries = this.cache.get(path7);
13299
+ getRetained(path8, snapshotId, projectId) {
13300
+ const entries = this.cache.get(path8);
13295
13301
  if (!entries)
13296
13302
  return void 0;
13297
13303
  const key2 = refKey(snapshotId, projectId);
@@ -13302,21 +13308,21 @@ var SourceFileCache = class {
13302
13308
  * Store a source file in the cache and retain it for the given (snapshot, project) pair.
13303
13309
  * Returns the cached file — which may be an existing entry if the hash matches.
13304
13310
  */
13305
- set(path7, file2, parseOptionsKey, contentHash, snapshotId, projectId) {
13306
- let entries = this.cache.get(path7);
13311
+ set(path8, file2, parseOptionsKey, contentHash, snapshotId, projectId) {
13312
+ let entries = this.cache.get(path8);
13307
13313
  if (!entries) {
13308
13314
  entries = [];
13309
- this.cache.set(path7, entries);
13315
+ this.cache.set(path8, entries);
13310
13316
  }
13311
13317
  const ref = refKey(snapshotId, projectId);
13312
13318
  const existing = entries.find((e) => e.parseOptionsKey === parseOptionsKey && e.contentHash === contentHash);
13313
13319
  if (existing) {
13314
13320
  existing.refs.add(ref);
13315
- this.trackPath(snapshotId, projectId, path7);
13321
+ this.trackPath(snapshotId, projectId, path8);
13316
13322
  return existing.file;
13317
13323
  }
13318
13324
  entries.push({ file: file2, contentHash, parseOptionsKey, refs: /* @__PURE__ */ new Set([ref]) });
13319
- this.trackPath(snapshotId, projectId, path7);
13325
+ this.trackPath(snapshotId, projectId, path8);
13320
13326
  return file2;
13321
13327
  }
13322
13328
  /**
@@ -13346,16 +13352,16 @@ var SourceFileCache = class {
13346
13352
  }
13347
13353
  const prevRef = refKey(previousSnapshotId, projectId);
13348
13354
  const newRef = refKey(newSnapshotId, projectId);
13349
- for (const path7 of paths) {
13350
- if (invalidPaths?.has(path7))
13355
+ for (const path8 of paths) {
13356
+ if (invalidPaths?.has(path8))
13351
13357
  continue;
13352
- const entries = this.cache.get(path7);
13358
+ const entries = this.cache.get(path8);
13353
13359
  if (!entries)
13354
13360
  continue;
13355
13361
  for (const entry of entries) {
13356
13362
  if (entry.refs.has(prevRef)) {
13357
13363
  entry.refs.add(newRef);
13358
- this.trackPath(newSnapshotId, projectId, path7);
13364
+ this.trackPath(newSnapshotId, projectId, path8);
13359
13365
  }
13360
13366
  }
13361
13367
  }
@@ -13372,8 +13378,8 @@ var SourceFileCache = class {
13372
13378
  return;
13373
13379
  for (const [projectId, paths] of projectMap) {
13374
13380
  const key2 = refKey(snapshotId, projectId);
13375
- for (const path7 of paths) {
13376
- const entries = this.cache.get(path7);
13381
+ for (const path8 of paths) {
13382
+ const entries = this.cache.get(path8);
13377
13383
  if (!entries)
13378
13384
  continue;
13379
13385
  for (let i = entries.length - 1; i >= 0; i--) {
@@ -13383,13 +13389,13 @@ var SourceFileCache = class {
13383
13389
  }
13384
13390
  }
13385
13391
  if (entries.length === 0) {
13386
- this.cache.delete(path7);
13392
+ this.cache.delete(path8);
13387
13393
  }
13388
13394
  }
13389
13395
  }
13390
13396
  this.snapshotProjectPaths.delete(snapshotId);
13391
13397
  }
13392
- trackPath(snapshotId, projectId, path7) {
13398
+ trackPath(snapshotId, projectId, path8) {
13393
13399
  let projectMap = this.snapshotProjectPaths.get(snapshotId);
13394
13400
  if (!projectMap) {
13395
13401
  projectMap = /* @__PURE__ */ new Map();
@@ -13400,7 +13406,7 @@ var SourceFileCache = class {
13400
13406
  paths = /* @__PURE__ */ new Set();
13401
13407
  projectMap.set(projectId, paths);
13402
13408
  }
13403
- paths.add(path7);
13409
+ paths.add(path8);
13404
13410
  }
13405
13411
  /**
13406
13412
  * Clear all entries from the cache.
@@ -13418,8 +13424,8 @@ var SourceFileCache = class {
13418
13424
  /**
13419
13425
  * Check if a path is in the cache.
13420
13426
  */
13421
- has(path7) {
13422
- return this.cache.has(path7);
13427
+ has(path8) {
13428
+ return this.cache.has(path8);
13423
13429
  }
13424
13430
  };
13425
13431
 
@@ -14202,8 +14208,8 @@ var Program = class {
14202
14208
  }
14203
14209
  async getSourceFile(file2) {
14204
14210
  const fileName = resolveFileName(file2);
14205
- const path7 = this.toPath(fileName);
14206
- const retained = this.sourceFileCache.getRetained(path7, this.snapshotId, this.project.id);
14211
+ const path8 = this.toPath(fileName);
14212
+ const retained = this.sourceFileCache.getRetained(path8, this.snapshotId, this.project.id);
14207
14213
  if (retained) {
14208
14214
  return retained;
14209
14215
  }
@@ -14219,7 +14225,7 @@ var Program = class {
14219
14225
  const contentHash = readSourceFileHash(view);
14220
14226
  const parseOptionsKey = readParseOptionsKey(view);
14221
14227
  const sourceFile = new RemoteSourceFile(binaryData, this.decoder, this.client.getTimingCollector());
14222
- return this.sourceFileCache.set(path7, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.project.id);
14228
+ return this.sourceFileCache.set(path8, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.project.id);
14223
14229
  }
14224
14230
  async getSourceFileNames() {
14225
14231
  const data = await this.client.apiRequest("getSourceFileNames", {
@@ -14242,19 +14248,19 @@ var Program = class {
14242
14248
  * the file name to path conversion. Metadata is fetched lazily per file and cached on
14243
14249
  * this `Program` instance.
14244
14250
  */
14245
- getSourceFileMetadataByPath(path7) {
14246
- let metadata = this.sourceFileMetadataCache.get(path7);
14251
+ getSourceFileMetadataByPath(path8) {
14252
+ let metadata = this.sourceFileMetadataCache.get(path8);
14247
14253
  if (metadata === void 0) {
14248
- metadata = this.fetchSourceFileMetadata(path7);
14249
- this.sourceFileMetadataCache.set(path7, metadata);
14254
+ metadata = this.fetchSourceFileMetadata(path8);
14255
+ this.sourceFileMetadataCache.set(path8, metadata);
14250
14256
  }
14251
14257
  return metadata;
14252
14258
  }
14253
- async fetchSourceFileMetadata(path7) {
14259
+ async fetchSourceFileMetadata(path8) {
14254
14260
  const data = await this.client.apiRequest("getSourceFileMetadata", {
14255
14261
  snapshot: this.snapshotId,
14256
14262
  project: this.project.id,
14257
- file: path7
14263
+ file: path8
14258
14264
  });
14259
14265
  return data ?? void 0;
14260
14266
  }
@@ -16045,6 +16051,210 @@ function mapChildExecutionOwner(node, child, scope, enclosing, declarationExecut
16045
16051
  return enclosing;
16046
16052
  }
16047
16053
 
16054
+ // src/project-map-miniprogram.ts
16055
+ import path6 from "node:path";
16056
+ var templateOf = (script) => script.replace(/\.[cm]?[jt]sx?$/u, ".wxml");
16057
+ var miniprogramTemplateOf = (script, inventory) => /\.[cm]?[jt]sx?$/u.test(script) && inventory.has(templateOf(script)) ? templateOf(script) : void 0;
16058
+ function miniprogramConfiguration(template, inventory) {
16059
+ const own = template.replace(/\.wxml$/u, ".json");
16060
+ const configuration2 = inventory.has(own) ? { own } : {};
16061
+ for (let directory = path6.posix.dirname(template); ; directory = path6.posix.dirname(directory)) {
16062
+ const root = directory === "." ? "" : directory;
16063
+ const app = path6.posix.join(root, "app.json");
16064
+ if (inventory.has(app)) return { ...configuration2, app, root };
16065
+ if (!root) return configuration2;
16066
+ }
16067
+ }
16068
+ var propertyName = (member) => {
16069
+ const name = member.name;
16070
+ return name && (isIdentifier(name) || isStringLiteral(name)) ? name.text : void 0;
16071
+ };
16072
+ function miniprogramMethods(file2) {
16073
+ for (const statement of file2.statements) {
16074
+ if (!isExpressionStatement(statement)) continue;
16075
+ const call = statement.expression;
16076
+ if (!isCallExpression(call) || !isIdentifier(call.expression)) continue;
16077
+ const registration = call.expression.text;
16078
+ const options = call.arguments[0];
16079
+ if (registration !== "Page" && registration !== "Component" || !options) continue;
16080
+ if (!isObjectLiteralExpression(options)) continue;
16081
+ let members = options.properties;
16082
+ if (registration === "Component") {
16083
+ const methods = options.properties.find((member) => propertyName(member) === "methods");
16084
+ const value = methods && isPropertyAssignment(methods) ? methods.initializer : void 0;
16085
+ members = value && isObjectLiteralExpression(value) ? value.properties : [];
16086
+ }
16087
+ const found = /* @__PURE__ */ new Map();
16088
+ for (const member of members) {
16089
+ const name = propertyName(member);
16090
+ if (name !== void 0 && (isMethodDeclaration(member) || isPropertyAssignment(member)))
16091
+ found.set(name, member);
16092
+ }
16093
+ return found;
16094
+ }
16095
+ return void 0;
16096
+ }
16097
+ var BINDING = /^(?:(?:capture-)?(?:bind|catch)|mut-bind):?[a-z][\w-]*$/iu;
16098
+ var METHOD = /^[A-Za-z_$][\w$]*$/u;
16099
+ var TAG = /<([A-Za-z][\w.:-]*)/uy;
16100
+ var ATTRIBUTE = /\s*([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/uy;
16101
+ function parseMiniprogramTemplate(text2) {
16102
+ const bindings = [];
16103
+ const tags = [];
16104
+ const skip = (from, end) => {
16105
+ const at = text2.indexOf(end, from);
16106
+ return at < 0 ? text2.length : at + end.length;
16107
+ };
16108
+ for (let index = 0; index < text2.length; ) {
16109
+ const open = text2.indexOf("<", index);
16110
+ const expression = text2.indexOf("{{", index);
16111
+ if (expression >= 0 && (open < 0 || expression < open)) {
16112
+ index = skip(expression + 2, "}}");
16113
+ continue;
16114
+ }
16115
+ if (open < 0) break;
16116
+ if (text2.startsWith("<!--", open)) {
16117
+ index = skip(open + 4, "-->");
16118
+ continue;
16119
+ }
16120
+ TAG.lastIndex = open;
16121
+ const tag = TAG.exec(text2);
16122
+ if (!tag?.[1]) {
16123
+ index = open + 1;
16124
+ continue;
16125
+ }
16126
+ const name = tag[1];
16127
+ tags.push({ name, start: open + 1, end: open + 1 + name.length });
16128
+ let at = TAG.lastIndex;
16129
+ for (; ; ) {
16130
+ while (at < text2.length && /\s/u.test(text2[at])) at++;
16131
+ if (at >= text2.length || text2[at] === ">" || text2.startsWith("/>", at)) break;
16132
+ ATTRIBUTE.lastIndex = at;
16133
+ const attribute = ATTRIBUTE.exec(text2);
16134
+ if (!attribute) {
16135
+ at++;
16136
+ continue;
16137
+ }
16138
+ at = ATTRIBUTE.lastIndex;
16139
+ const value = attribute[2] ?? attribute[3] ?? attribute[4];
16140
+ if (value === void 0 || !BINDING.test(attribute[1] ?? "")) continue;
16141
+ const end = at - (attribute[4] === void 0 ? 1 : 0);
16142
+ const start = end - value.length;
16143
+ const method = value.trim();
16144
+ if (METHOD.test(method)) bindings.push({ method, start, end });
16145
+ else if (method.includes("{{")) bindings.push({ start, end });
16146
+ }
16147
+ index = text2[at] === ">" ? at + 1 : at + 2;
16148
+ if (name === "wxs" && text2[at] === ">") index = skip(index, "</wxs>");
16149
+ }
16150
+ return { bindings, tags };
16151
+ }
16152
+ var usingComponents = (text2) => {
16153
+ if (!text2) return {};
16154
+ try {
16155
+ const using = JSON.parse(text2).usingComponents;
16156
+ if (!using || typeof using !== "object") return {};
16157
+ return Object.fromEntries(
16158
+ Object.entries(using).filter(
16159
+ (entry) => typeof entry[1] === "string"
16160
+ )
16161
+ );
16162
+ } catch {
16163
+ return {};
16164
+ }
16165
+ };
16166
+ function componentTemplate(value, registeredIn, root, inventory) {
16167
+ if (/^plugin(?:-private)?:\/\//u.test(value)) return void 0;
16168
+ const from = (base) => path6.posix.normalize(path6.posix.join(base || ".", value));
16169
+ const bases = value.startsWith("/") ? root !== void 0 ? [from(root)] : [] : [
16170
+ from(path6.posix.dirname(registeredIn)),
16171
+ ...root !== void 0 ? [from(root), from(path6.posix.join(root, "miniprogram_npm"))] : []
16172
+ ];
16173
+ for (const base of bases)
16174
+ for (const candidate of [`${base}.wxml`, `${base}/index.wxml`])
16175
+ if (!candidate.startsWith("../") && inventory.has(candidate)) return candidate;
16176
+ return void 0;
16177
+ }
16178
+ var fileId = (file2) => digestValue({ path: file2, kind: "FILE", identity: "" });
16179
+ function linkMiniprogramTemplates(scripts, context) {
16180
+ const links = { objects: [], relations: [], gaps: [], parsedFiles: [] };
16181
+ const modules = /* @__PURE__ */ new Map();
16182
+ const module2 = (template, role) => {
16183
+ const known = modules.get(template);
16184
+ if (known) return known;
16185
+ const text2 = context.read(template);
16186
+ if (text2 === void 0) return void 0;
16187
+ const object2 = {
16188
+ id: fileId(template),
16189
+ contextRef: context.contextRef,
16190
+ kind: "FILE",
16191
+ name: template,
16192
+ anchor: context.span(template, 0, text2.length),
16193
+ exported: false,
16194
+ execution: "MODULE",
16195
+ contextRole: role,
16196
+ language: "wxml",
16197
+ parsing: "PARSED"
16198
+ };
16199
+ modules.set(template, object2);
16200
+ links.objects.push(object2);
16201
+ return object2;
16202
+ };
16203
+ const owned = scripts.flatMap(({ template, methods }) => {
16204
+ const object2 = module2(template, "DEFAULT");
16205
+ return object2 ? [{ template, methods, object: object2 }] : [];
16206
+ });
16207
+ for (const { template, methods, object: object2 } of owned) {
16208
+ links.parsedFiles.push(template);
16209
+ const parsed = parseMiniprogramTemplate(context.read(template) ?? "");
16210
+ let computed = 0;
16211
+ for (const binding of parsed.bindings) {
16212
+ if (binding.method === void 0) {
16213
+ computed++;
16214
+ continue;
16215
+ }
16216
+ const method = methods.get(binding.method);
16217
+ const target = method && context.materialize(method);
16218
+ links.relations.push({
16219
+ from: object2.id,
16220
+ kind: "CALLS",
16221
+ anchor: context.span(template, binding.start, binding.end),
16222
+ target: binding.method,
16223
+ ...target ? { to: target.id, basis: "SYNTAX_DECLARED" } : { basis: "UNRESOLVED", unresolvedReason: "SYMBOL_NOT_RESOLVED" }
16224
+ });
16225
+ }
16226
+ if (computed)
16227
+ links.gaps.push({
16228
+ code: "MINIPROGRAM_COMPUTED_EVENT_HANDLERS",
16229
+ path: template,
16230
+ count: computed
16231
+ });
16232
+ if (!parsed.tags.length) continue;
16233
+ const { own, app, root } = miniprogramConfiguration(template, context.inventory);
16234
+ const registered = /* @__PURE__ */ new Map();
16235
+ for (const file2 of [app, own])
16236
+ if (file2 !== void 0)
16237
+ for (const [tag, value] of Object.entries(usingComponents(context.read(file2))))
16238
+ registered.set(tag, componentTemplate(value, file2, root, context.inventory));
16239
+ for (const tag of parsed.tags) {
16240
+ if (!registered.has(tag.name)) continue;
16241
+ const component = registered.get(tag.name);
16242
+ const target = component === void 0 ? void 0 : module2(component, "DEPENDENCY");
16243
+ links.relations.push({
16244
+ from: object2.id,
16245
+ kind: "REFERENCES",
16246
+ anchor: context.span(template, tag.start, tag.end),
16247
+ target: tag.name,
16248
+ ...target ? { to: target.id, basis: "SYNTAX_DECLARED" } : {
16249
+ basis: "UNRESOLVED",
16250
+ unresolvedReason: "DECLARATION_NOT_AVAILABLE"
16251
+ }
16252
+ });
16253
+ }
16254
+ }
16255
+ return links;
16256
+ }
16257
+
16048
16258
  // src/project-map-output.ts
16049
16259
  var MapOutputCollector = class {
16050
16260
  constructor(output) {
@@ -16186,8 +16396,8 @@ var pathText = (node) => {
16186
16396
  };
16187
16397
  var isFunction = (node) => node.kind === SyntaxKind.ArrowFunction || node.kind === SyntaxKind.FunctionExpression;
16188
16398
  var isDeclaration = (node) => node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.SourceFile;
16189
- function joinRoute(prefix, path7) {
16190
- const joined = !prefix ? path7 : !path7 ? prefix : `${prefix.replace(/\/+$/u, "")}/${path7.replace(/^\/+/u, "")}`;
16399
+ function joinRoute(prefix, path8) {
16400
+ const joined = !prefix ? path8 : !path8 ? prefix : `${prefix.replace(/\/+$/u, "")}/${path8.replace(/^\/+/u, "")}`;
16191
16401
  return joined.startsWith("/") || joined.startsWith("$") ? joined : `/${joined}`;
16192
16402
  }
16193
16403
  var httpMethod = (name) => HTTP_METHODS.has(name.toUpperCase()) ? name.toUpperCase() : void 0;
@@ -16205,25 +16415,25 @@ function registeredRoute(node, kind) {
16205
16415
  function routeOf(call, index) {
16206
16416
  const callee = call.expression;
16207
16417
  const name = isPropertyAccessExpression(callee) ? callee.name.text : void 0;
16208
- let path7;
16418
+ let path8;
16209
16419
  let receiver = isPropertyAccessExpression(callee) ? callee.expression : void 0;
16210
16420
  const at = call.arguments.findIndex((argument) => pathText(argument) !== void 0);
16211
16421
  if (at >= 0) {
16212
16422
  if (index <= at) return void 0;
16213
- path7 = pathText(call.arguments[at]);
16423
+ path8 = pathText(call.arguments[at]);
16214
16424
  } else if (name && httpMethod(name) && receiver && isCallExpression(receiver) && isPropertyAccessExpression(receiver.expression) && receiver.arguments.length === 1) {
16215
- path7 = pathText(receiver.arguments[0]);
16425
+ path8 = pathText(receiver.arguments[0]);
16216
16426
  receiver = receiver.expression.expression;
16217
16427
  }
16218
- if (path7 === void 0) return void 0;
16428
+ if (path8 === void 0) return void 0;
16219
16429
  let method;
16220
- const space = path7.indexOf(" ");
16221
- if (space > 0) [method, path7] = [path7.slice(0, space), path7.slice(space).trimStart()];
16430
+ const space = path8.indexOf(" ");
16431
+ if (space > 0) [method, path8] = [path8.slice(0, space), path8.slice(space).trimStart()];
16222
16432
  method ??= name ? httpMethod(name) : void 0;
16223
- if (path7 === "/" && !method) return void 0;
16224
- const full = joinRoute(receiver ? routerPrefix(receiver, 0) : "", path7);
16433
+ if (path8 === "/" && !method) return void 0;
16434
+ const full = joinRoute(receiver ? routerPrefix(receiver, 0) : "", path8);
16225
16435
  const label = method ? `${method} ${full}` : full;
16226
- return label.length <= 256 ? { label, ...method ? { method } : {} } : { label: path7 };
16436
+ return label.length <= 256 ? { label, ...method ? { method } : {} } : { label: path8 };
16227
16437
  }
16228
16438
  function routerPrefix(expression, depth) {
16229
16439
  if (depth > 8) return "";
@@ -16231,8 +16441,8 @@ function routerPrefix(expression, depth) {
16231
16441
  const callee = expression.expression;
16232
16442
  if (!isPropertyAccessExpression(callee)) return "";
16233
16443
  const base = routerPrefix(callee.expression, depth + 1);
16234
- const path7 = expression.arguments.length === 1 ? pathText(expression.arguments[0]) : void 0;
16235
- return path7 === void 0 || path7.includes(" ") ? base : joinRoute(base, path7);
16444
+ const path8 = expression.arguments.length === 1 ? pathText(expression.arguments[0]) : void 0;
16445
+ return path8 === void 0 || path8.includes(" ") ? base : joinRoute(base, path8);
16236
16446
  }
16237
16447
  if (isIdentifier(expression)) {
16238
16448
  const declaration = constDeclaration(expression);
@@ -16274,8 +16484,8 @@ function decoratorRoute(decorator, argument) {
16274
16484
  break;
16275
16485
  }
16276
16486
  }
16277
- const path7 = argument ?? (call && text(call.arguments[0])) ?? "";
16278
- const route = `${method} ${joinRoute(prefix, path7)}`;
16487
+ const path8 = argument ?? (call && text(call.arguments[0])) ?? "";
16488
+ const route = `${method} ${joinRoute(prefix, path8)}`;
16279
16489
  return route.length <= 256 ? route : void 0;
16280
16490
  }
16281
16491
 
@@ -17116,10 +17326,10 @@ function mergeDefs(...defs) {
17116
17326
  function cloneDef(schema) {
17117
17327
  return mergeDefs(schema._zod.def);
17118
17328
  }
17119
- function getElementAtPath(obj, path7) {
17120
- if (!path7)
17329
+ function getElementAtPath(obj, path8) {
17330
+ if (!path8)
17121
17331
  return obj;
17122
- return path7.reduce((acc, key2) => acc?.[key2], obj);
17332
+ return path8.reduce((acc, key2) => acc?.[key2], obj);
17123
17333
  }
17124
17334
  function promiseAllObject(promisesObj) {
17125
17335
  const keys = Object.keys(promisesObj);
@@ -17528,11 +17738,11 @@ function explicitlyAborted(x, startIndex = 0) {
17528
17738
  }
17529
17739
  return false;
17530
17740
  }
17531
- function prefixIssues(path7, issues) {
17741
+ function prefixIssues(path8, issues) {
17532
17742
  return issues.map((iss) => {
17533
17743
  var _a3;
17534
17744
  (_a3 = iss).path ?? (_a3.path = []);
17535
- iss.path.unshift(path7);
17745
+ iss.path.unshift(path8);
17536
17746
  return iss;
17537
17747
  });
17538
17748
  }
@@ -17679,16 +17889,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
17679
17889
  }
17680
17890
  function formatError(error51, mapper = (issue2) => issue2.message) {
17681
17891
  const fieldErrors = { _errors: [] };
17682
- const processError = (error52, path7 = []) => {
17892
+ const processError = (error52, path8 = []) => {
17683
17893
  for (const issue2 of error52.issues) {
17684
17894
  if (issue2.code === "invalid_union" && issue2.errors.length) {
17685
- issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
17895
+ issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
17686
17896
  } else if (issue2.code === "invalid_key") {
17687
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
17897
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
17688
17898
  } else if (issue2.code === "invalid_element") {
17689
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
17899
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
17690
17900
  } else {
17691
- const fullpath = [...path7, ...issue2.path];
17901
+ const fullpath = [...path8, ...issue2.path];
17692
17902
  if (fullpath.length === 0) {
17693
17903
  fieldErrors._errors.push(mapper(issue2));
17694
17904
  } else {
@@ -17715,17 +17925,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
17715
17925
  }
17716
17926
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
17717
17927
  const result = { errors: [] };
17718
- const processError = (error52, path7 = []) => {
17928
+ const processError = (error52, path8 = []) => {
17719
17929
  var _a3, _b;
17720
17930
  for (const issue2 of error52.issues) {
17721
17931
  if (issue2.code === "invalid_union" && issue2.errors.length) {
17722
- issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
17932
+ issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
17723
17933
  } else if (issue2.code === "invalid_key") {
17724
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
17934
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
17725
17935
  } else if (issue2.code === "invalid_element") {
17726
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
17936
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
17727
17937
  } else {
17728
- const fullpath = [...path7, ...issue2.path];
17938
+ const fullpath = [...path8, ...issue2.path];
17729
17939
  if (fullpath.length === 0) {
17730
17940
  result.errors.push(mapper(issue2));
17731
17941
  continue;
@@ -17757,8 +17967,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
17757
17967
  }
17758
17968
  function toDotPath(_path) {
17759
17969
  const segs = [];
17760
- const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
17761
- for (const seg of path7) {
17970
+ const path8 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
17971
+ for (const seg of path8) {
17762
17972
  if (typeof seg === "number")
17763
17973
  segs.push(`[${seg}]`);
17764
17974
  else if (typeof seg === "symbol")
@@ -30450,13 +30660,13 @@ function resolveRef(ref, ctx) {
30450
30660
  if (!ref.startsWith("#")) {
30451
30661
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
30452
30662
  }
30453
- const path7 = ref.slice(1).split("/").filter(Boolean);
30454
- if (path7.length === 0) {
30663
+ const path8 = ref.slice(1).split("/").filter(Boolean);
30664
+ if (path8.length === 0) {
30455
30665
  return ctx.rootSchema;
30456
30666
  }
30457
30667
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
30458
- if (path7[0] === defsKey) {
30459
- const key2 = path7[1];
30668
+ if (path8[0] === defsKey) {
30669
+ const key2 = path8[1];
30460
30670
  if (!key2 || !ctx.defs[key2]) {
30461
30671
  throw new Error(`Reference not found: ${ref}`);
30462
30672
  }
@@ -31115,7 +31325,7 @@ function moduleStateNames(file2) {
31115
31325
  }
31116
31326
  return { names, namespaces };
31117
31327
  }
31118
- async function extractProjectMap(project, input, trace) {
31328
+ async function extractProjectMap(project, input, trace, read) {
31119
31329
  const output = {
31120
31330
  contexts: [],
31121
31331
  objects: [],
@@ -31150,6 +31360,8 @@ async function extractProjectMap(project, input, trace) {
31150
31360
  const valueNames = /* @__PURE__ */ new Set();
31151
31361
  const namespaces = /* @__PURE__ */ new Set();
31152
31362
  const collect = new MapOutputCollector(output);
31363
+ const inventory = new Set(input.inventory);
31364
+ const pages = [];
31153
31365
  const scopes = /* @__PURE__ */ new Map();
31154
31366
  const declaredIn = (scope) => {
31155
31367
  const found = scopes.get(key(scope));
@@ -31185,8 +31397,8 @@ async function extractProjectMap(project, input, trace) {
31185
31397
  identities.set(key(node), value);
31186
31398
  return value;
31187
31399
  };
31188
- const gap = (code, path7) => {
31189
- output.gaps.push({ code, ...path7 ? { path: path7 } : {} });
31400
+ const gap = (code, path8) => {
31401
+ output.gaps.push({ code, ...path8 ? { path: path8 } : {} });
31190
31402
  };
31191
31403
  const addObject = (node, file2, kind, name) => {
31192
31404
  const location = anchor(node, file2);
@@ -31214,18 +31426,20 @@ async function extractProjectMap(project, input, trace) {
31214
31426
  return object2;
31215
31427
  };
31216
31428
  trace.phase = "SOURCE_FILES";
31217
- for await (const { file: file2, path: path7, syntaxErrors, exports } of mapSourceFiles(project, input, trace)) {
31429
+ for await (const { file: file2, path: path8, syntaxErrors, exports } of mapSourceFiles(project, input, trace)) {
31218
31430
  if (!file2) {
31219
- gap("SOURCE_NOT_PARSED", path7);
31431
+ gap("SOURCE_NOT_PARSED", path8);
31220
31432
  continue;
31221
31433
  }
31222
31434
  if (syntaxErrors) {
31223
- gap("SYNTAX_ERROR", path7);
31435
+ gap("SYNTAX_ERROR", path8);
31224
31436
  continue;
31225
31437
  }
31226
- output.parsedFiles.push(path7);
31227
- const fileObject = addObject(file2, file2, "FILE", path7);
31228
- if (!owned.has(path7)) continue;
31438
+ output.parsedFiles.push(path8);
31439
+ const fileObject = addObject(file2, file2, "FILE", path8);
31440
+ if (!owned.has(path8)) continue;
31441
+ const template = miniprogramTemplateOf(path8, inventory);
31442
+ if (template) pages.push({ file: file2, template });
31229
31443
  exportedSymbols.set(file2.fileName, exports);
31230
31444
  const state = moduleStateNames(file2);
31231
31445
  trace.phase = "TRAVERSAL";
@@ -31252,7 +31466,7 @@ async function extractProjectMap(project, input, trace) {
31252
31466
  executionDeclaration?.kind ?? kind,
31253
31467
  executionDeclaration?.name ?? mapNodeLabel(name)
31254
31468
  );
31255
- if (owned.has(path7))
31469
+ if (owned.has(path8))
31256
31470
  collect.relation({
31257
31471
  from: owner.id,
31258
31472
  to: object2.id,
@@ -31261,11 +31475,11 @@ async function extractProjectMap(project, input, trace) {
31261
31475
  target: object2.name,
31262
31476
  basis: "SYNTAX_DECLARED"
31263
31477
  });
31264
- if (owned.has(path7) && name) declarations.push({ object: object2, name, node, file: file2 });
31478
+ if (owned.has(path8) && name) declarations.push({ object: object2, name, node, file: file2 });
31265
31479
  if (object2.kind === "VARIABLE" && !object2.execution && item.owner.kind === "FILE")
31266
31480
  moduleVariables.add(object2.id);
31267
31481
  owner = object2;
31268
- if (kind === "INTERFACE" && owned.has(path7)) {
31482
+ if (kind === "INTERFACE" && owned.has(path8)) {
31269
31483
  const note = {
31270
31484
  entityRef: object2.id,
31271
31485
  kind: "CONTRACT_DECLARATION",
@@ -31282,7 +31496,7 @@ async function extractProjectMap(project, input, trace) {
31282
31496
  reference = {
31283
31497
  node,
31284
31498
  lookup: moduleSpecifier,
31285
- kind: /(?:^|[/.])(?:test|spec|tests)(?:[/.]|$)/u.test(path7) ? "TEST_IMPORTS" : "IMPORTS",
31499
+ kind: /(?:^|[/.])(?:test|spec|tests)(?:[/.]|$)/u.test(path8) ? "TEST_IMPORTS" : "IMPORTS",
31286
31500
  target: moduleSpecifier.text
31287
31501
  };
31288
31502
  } else if (isCallExpression(node) || isNewExpression(node)) {
@@ -31385,7 +31599,7 @@ async function extractProjectMap(project, input, trace) {
31385
31599
  }
31386
31600
  if (isObjectLiteralExpression(node) || (isClassDeclaration(node) || node.kind === SyntaxKind.ClassExpression || isInterfaceDeclaration(node)) && node.heritageClauses?.length)
31387
31601
  contracts.push(node);
31388
- if (reference && owned.has(path7)) {
31602
+ if (reference && owned.has(path8)) {
31389
31603
  pending.push({
31390
31604
  ...reference,
31391
31605
  owner: ["CALLS", "WRITES"].includes(reference.kind) ? item.execution.id : owner.id,
@@ -31453,8 +31667,8 @@ async function extractProjectMap(project, input, trace) {
31453
31667
  const kind = mapDeclarationKind(node, true);
31454
31668
  const executionDeclaration = mapExecutionDeclaration(node);
31455
31669
  const file2 = node.getSourceFile();
31456
- const path7 = mapRelativePath(file2.fileName);
31457
- if (!executionDeclaration && (!name || !kind) || !path7 || !Object.hasOwn(input.files, path7))
31670
+ const path8 = mapRelativePath(file2.fileName);
31671
+ if (!executionDeclaration && (!name || !kind) || !path8 || !Object.hasOwn(input.files, path8))
31458
31672
  return void 0;
31459
31673
  const object2 = addObject(
31460
31674
  node,
@@ -31466,7 +31680,7 @@ async function extractProjectMap(project, input, trace) {
31466
31680
  while (parent && !declared.has(key(parent)) && !(mapDeclarationKind(parent) && mapDeclarationName(parent)) && !mapExecutionDeclaration(parent))
31467
31681
  parent = parent.parent;
31468
31682
  const owner = parent ? materialize(parent) : void 0;
31469
- if (owner && owned.has(path7))
31683
+ if (owner && owned.has(path8))
31470
31684
  collect.relation({
31471
31685
  from: owner.id,
31472
31686
  to: object2.id,
@@ -31477,6 +31691,24 @@ async function extractProjectMap(project, input, trace) {
31477
31691
  });
31478
31692
  return object2;
31479
31693
  };
31694
+ trace.phase = "MINIPROGRAM_TEMPLATES";
31695
+ const templates = linkMiniprogramTemplates(
31696
+ pages.flatMap(({ file: file2, template }) => {
31697
+ const methods = miniprogramMethods(file2);
31698
+ return methods ? [{ template, methods }] : [];
31699
+ }),
31700
+ {
31701
+ contextRef: input.contextRef,
31702
+ inventory,
31703
+ read,
31704
+ span: (path8, start, end) => positions.span(path8, start, end),
31705
+ materialize
31706
+ }
31707
+ );
31708
+ for (const object2 of templates.objects) collect.object(object2);
31709
+ for (const relation of templates.relations) collect.relation(relation);
31710
+ output.gaps.push(...templates.gaps);
31711
+ output.parsedFiles.push(...templates.parsedFiles);
31480
31712
  const targets = new MapTargetResolver(project, input, materialize);
31481
31713
  const moduleVariable = (node) => {
31482
31714
  const object2 = declared.get(key(node));
@@ -31495,9 +31727,9 @@ async function extractProjectMap(project, input, trace) {
31495
31727
  for (const [index, item] of batch.entries()) {
31496
31728
  const readState = async () => {
31497
31729
  for (const destination of await targets.resolveMapped(symbols[index], moduleVariable)) {
31498
- const read = `${item.owner}\0${destination.id}`;
31499
- if (stateReads.has(read)) continue;
31500
- stateReads.add(read);
31730
+ const read2 = `${item.owner}\0${destination.id}`;
31731
+ if (stateReads.has(read2)) continue;
31732
+ stateReads.add(read2);
31501
31733
  collect.relation({
31502
31734
  from: item.owner,
31503
31735
  to: destination.id,
@@ -31654,7 +31886,7 @@ async function extractProjectMap(project, input, trace) {
31654
31886
  }
31655
31887
 
31656
31888
  // src/core.ts
31657
- import path6 from "node:path";
31889
+ import path7 from "node:path";
31658
31890
  var ProjectEvidencePathError = class extends Error {
31659
31891
  constructor(code) {
31660
31892
  super(code);
@@ -31664,14 +31896,14 @@ var ProjectEvidencePathError = class extends Error {
31664
31896
  code;
31665
31897
  };
31666
31898
  var normalizeProjectEvidencePath = (value, allowRoot = false) => {
31667
- if (value.includes("\0") || path6.isAbsolute(value) || value.includes("\\")) {
31899
+ if (value.includes("\0") || path7.isAbsolute(value) || value.includes("\\")) {
31668
31900
  throw new ProjectEvidencePathError("PROJECT_PATH_INVALID");
31669
31901
  }
31670
31902
  if (value === ".") {
31671
31903
  if (allowRoot) return "";
31672
31904
  throw new ProjectEvidencePathError("PROJECT_PATH_INVALID");
31673
31905
  }
31674
- const normalized = path6.posix.normalize(value);
31906
+ const normalized = path7.posix.normalize(value);
31675
31907
  if (normalized.length === 0 || normalized !== value || normalized === ".." || normalized.startsWith("../") || value.split("/").some((segment) => segment.length === 0 || segment === "." || segment === "..")) {
31676
31908
  throw new ProjectEvidencePathError("PROJECT_PATH_INVALID");
31677
31909
  }
@@ -31704,6 +31936,7 @@ var PhaseSchema = external_exports.enum([
31704
31936
  "RELATION_SYMBOLS",
31705
31937
  "RELATION_TARGETS",
31706
31938
  "IMPLEMENTATIONS",
31939
+ "MINIPROGRAM_TEMPLATES",
31707
31940
  "DECLARATION_SYMBOLS",
31708
31941
  "DOCUMENTATION",
31709
31942
  "CONFIG_DIAGNOSTICS",
@@ -31794,7 +32027,7 @@ function mapWorkerFailure(error51, trace, workerUrl) {
31794
32027
  }
31795
32028
 
31796
32029
  // src/project-map-query-selection.ts
31797
- var mapQueryPathMatches = (path7, prefix) => prefix === "." || path7 === prefix || path7.startsWith(`${prefix}/`);
32030
+ var mapQueryPathMatches = (path8, prefix) => prefix === "." || path8 === prefix || path8.startsWith(`${prefix}/`);
31798
32031
 
31799
32032
  // src/project-map-reference-extract.ts
31800
32033
  function referenceKind(node) {
@@ -31969,7 +32202,10 @@ process.once(
31969
32202
  gaps: [],
31970
32203
  parsedFiles: [],
31971
32204
  requiredFiles: []
31972
- } : await extractProjectMap(project, message, trace);
32205
+ } : await extractProjectMap(project, message, trace, (file2) => {
32206
+ const text2 = files.fs.readFile?.(mapVirtualPath(file2));
32207
+ return typeof text2 === "string" && Object.hasOwn(message.files, file2) ? text2 : void 0;
32208
+ });
31973
32209
  result2.requiredFiles = [...files.required].sort();
31974
32210
  if ("contexts" in result2)
31975
32211
  for (const context of result2.contexts) {