layermap 0.1.45 → 0.1.46

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.
@@ -4896,6 +4896,9 @@ function isImportDeclaration(node) {
4896
4896
  return false;
4897
4897
  }
4898
4898
  }
4899
+ function isExternalModuleReference(node) {
4900
+ return node.kind === SyntaxKind.ExternalModuleReference;
4901
+ }
4899
4902
  function isNamespaceImport(node) {
4900
4903
  return node.kind === SyntaxKind.NamespaceImport;
4901
4904
  }
@@ -4995,6 +4998,12 @@ function isJsxClosingElement(node) {
4995
4998
  function isSourceFile(node) {
4996
4999
  return node.kind === SyntaxKind.SourceFile;
4997
5000
  }
5001
+ function isImportEqualsDeclaration(node) {
5002
+ return node.kind === SyntaxKind.ImportEqualsDeclaration;
5003
+ }
5004
+ function isExportDeclaration(node) {
5005
+ return node.kind === SyntaxKind.ExportDeclaration;
5006
+ }
4998
5007
  function isImportClause(node) {
4999
5008
  return node.kind === SyntaxKind.ImportClause;
5000
5009
  }
@@ -30827,7 +30836,13 @@ function mapRequireBinding(node) {
30827
30836
  if (!isVariableDeclaration(node) || !node.initializer) return false;
30828
30837
  let value = unwrap(node.initializer);
30829
30838
  while (isPropertyAccessExpression(value)) value = unwrap(value.expression);
30830
- return isCallExpression(value) && isIdentifier(value.expression) && value.expression.text === "require" && value.arguments.length === 1 && isStringLiteral(value.arguments[0]);
30839
+ return mapRequiredModule(value) !== void 0;
30840
+ }
30841
+ function mapRequiredModule(node) {
30842
+ if (!isCallExpression(node) || !isIdentifier(node.expression) || node.expression.text !== "require" || node.arguments.length !== 1)
30843
+ return void 0;
30844
+ const name = node.arguments[0];
30845
+ return isStringLiteral(name) ? name : void 0;
30831
30846
  }
30832
30847
  var unwrap = (node) => isParenthesizedExpression(node) || isAsExpression(node) ? unwrap(node.expression) : node;
30833
30848
  var isExports = (node) => isIdentifier(node) && node.text === "exports" || isPropertyAccessExpression(node) && isIdentifier(node.expression) && node.expression.text === "module" && node.name.text === "exports";
@@ -31994,6 +32009,14 @@ var NOT_STATE_READS = /* @__PURE__ */ new Set([
31994
32009
  SyntaxKind.JsxSelfClosingElement,
31995
32010
  SyntaxKind.JsxClosingElement
31996
32011
  ]);
32012
+ function importedModule(node) {
32013
+ if (isImportDeclaration(node) || isExportDeclaration(node)) return node.moduleSpecifier;
32014
+ if (isImportEqualsDeclaration(node))
32015
+ return isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : void 0;
32016
+ if (isCallExpression(node) && node.expression.kind === SyntaxKind.ImportKeyword)
32017
+ return node.arguments[0];
32018
+ return mapRequiredModule(node);
32019
+ }
31997
32020
  function moduleStateNames(file2) {
31998
32021
  const names = /* @__PURE__ */ new Set();
31999
32022
  const namespaces = /* @__PURE__ */ new Set();
@@ -32197,7 +32220,7 @@ async function extractProjectMap(project, input, trace, read, installed) {
32197
32220
  truncated: false
32198
32221
  });
32199
32222
  let reference;
32200
- const moduleSpecifier = isImportDeclaration(node) ? node.moduleSpecifier : isCallExpression(node) && node.expression.kind === SyntaxKind.ImportKeyword ? node.arguments[0] : void 0;
32223
+ const moduleSpecifier = importedModule(node);
32201
32224
  if (moduleSpecifier && (isStringLiteral(moduleSpecifier) || isNoSubstitutionTemplateLiteral(moduleSpecifier))) {
32202
32225
  reference = {
32203
32226
  node,
package/dist/cli.mjs CHANGED
@@ -19071,7 +19071,7 @@ var miniprogramEventOf = (target) => {
19071
19071
 
19072
19072
  // src/project-map-language-typescript.ts
19073
19073
  var TYPESCRIPT_MAP_LANGUAGE = Object.freeze({
19074
- id: "typescript-7.0.2-map-v31",
19074
+ id: "typescript-7.0.2-map-v32",
19075
19075
  claims: (path19) => /\.[cm]?[jt]sx?$/u.test(path19),
19076
19076
  readsRequests: true,
19077
19077
  reads: (path19) => path19.endsWith(".json") || path19.endsWith(".wxml") || path19 === "pnpm-workspace.yaml",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "layermap",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "mcpName": "io.github.coffeecoproject/layermap",
5
5
  "description": "A layered map of a codebase for coding agents: directories, modules and call chains across TypeScript, JavaScript, Go, Python and Java.",
6
6
  "license": "Apache-2.0",
package/pi/layermap.mjs CHANGED
@@ -293,7 +293,7 @@ function layermap(pi) {
293
293
  if (server && !server.dead) return server;
294
294
  starting ??= (async () => {
295
295
  const next = new MapServer(cwd);
296
- const tools = await next.start("0.1.45");
296
+ const tools = await next.start("0.1.46");
297
297
  for (const tool of tools) {
298
298
  if (registered.has(tool.name)) continue;
299
299
  registered.add(tool.name);