@cmflow/atlas 3.4.0-beta.22 → 3.4.0-beta.24

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.
@@ -1,7 +1,7 @@
1
1
  import { fileURLToPath as __atlasFileURLToPath } from "node:url";
2
2
  const __filename = __atlasFileURLToPath(import.meta.url);
3
3
  import { n as __require, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-CGR6nZuH.mjs";
4
- import { t as taskProgressService, u as getUserConfig } from "./taskProgressService-CAC_RIoa.mjs";
4
+ import { d as setUserConfig, f as userConfig, t as taskProgressService, u as getUserConfig } from "./taskProgressService-BRoIJQbK.mjs";
5
5
  import { on, once } from "node:events";
6
6
  import { execFile } from "node:child_process";
7
7
  import path from "node:path";
@@ -8078,7 +8078,7 @@ function isExcludedAnalysisFile(repoRoot, filePath, excludedPatterns) {
8078
8078
  //#region src/services/analysisFileService.ts
8079
8079
  function shouldKeepAnalysisFile(filePath) {
8080
8080
  const config = getUserConfig();
8081
- return !isExcludedAnalysisFile(config.repoRoot, filePath, config.analysis.excluded);
8081
+ return !isExcludedAnalysisFile(process.cwd(), filePath, config.analysis.excluded);
8082
8082
  }
8083
8083
  function filterAnalysisFiles(filePaths) {
8084
8084
  return filePaths.filter(shouldKeepAnalysisFile);
@@ -8384,6 +8384,7 @@ function callableFromTopologyNode(cwd, project, node) {
8384
8384
  } : void 0;
8385
8385
  }
8386
8386
  function collectBackendTopologyMappingContext(params) {
8387
+ const workspaceRoot = params.workspaceRoot || params.cwd;
8387
8388
  const handlerDeclaration = findLocalCallable(params.handlerFile, params.handlerName);
8388
8389
  if (!handlerDeclaration) return [];
8389
8390
  const handler = {
@@ -8408,15 +8409,15 @@ function collectBackendTopologyMappingContext(params) {
8408
8409
  layer,
8409
8410
  direction,
8410
8411
  symbol: callable.declaration?.getSymbol()?.getName() || callable.symbol.split(".").at(-1),
8411
- source: normalizeSourcePath(params.cwd, callable.sourceFile.getFilePath()),
8412
+ source: normalizeSourcePath(workspaceRoot, callable.sourceFile.getFilePath()),
8412
8413
  line: callableLine(callable),
8413
8414
  backend_path: backendPath,
8414
8415
  backend_type: backendType
8415
8416
  });
8416
- const expectedLayerPath = layer === "api" ? "app/_api/" : "app/_infra/back/";
8417
+ const expectedLayerPath = layer === "api" ? "_api/" : "_infra/back/";
8417
8418
  for (const call of callableCalls(callable)) {
8418
8419
  const dependency = resolveReference(params.project, callable.sourceFile, call.getExpression(), params.resolvePath);
8419
- if (!dependency?.declaration || !normalizeSourcePath(params.cwd, dependency.sourceFile.getFilePath()).includes(expectedLayerPath)) continue;
8420
+ if (!dependency?.declaration || !normalizeSourcePath(workspaceRoot, dependency.sourceFile.getFilePath()).includes(expectedLayerPath)) continue;
8420
8421
  appendMapper(dependency, layer, direction, backendPath, backendType);
8421
8422
  }
8422
8423
  };
@@ -8432,7 +8433,7 @@ function collectBackendTopologyMappingContext(params) {
8432
8433
  for (const [backendPath, topologyPath] of params.backendPaths.entries()) {
8433
8434
  appendMapperCalls(handler, "api", backendPath, topologyPath.backend_type);
8434
8435
  for (const node of topologyPath.nodes) {
8435
- if (!node.source.includes("app/_infra/back/")) continue;
8436
+ if (!node.source.includes("_infra/back/")) continue;
8436
8437
  const callable = callableFromTopologyNode(params.cwd, params.project, node);
8437
8438
  if (callable) appendMapperCalls(callable, "backend", backendPath, topologyPath.backend_type);
8438
8439
  }
@@ -8448,6 +8449,7 @@ function collectBackendTopologyMappingContext(params) {
8448
8449
  ].join(":"), context])).values()];
8449
8450
  }
8450
8451
  function traceBackendPaths(params) {
8452
+ const workspaceRoot = params.workspaceRoot || params.cwd;
8451
8453
  const handlerDeclaration = findLocalCallable(params.handlerFile, params.handlerName);
8452
8454
  if (!handlerDeclaration) throw new Error(`Handler declaration not found: ${params.handlerName} in ${params.handlerFile.getFilePath()}`);
8453
8455
  const handler = {
@@ -8461,7 +8463,7 @@ function traceBackendPaths(params) {
8461
8463
  weight: 0,
8462
8464
  nodes: [{
8463
8465
  symbol: handler.symbol,
8464
- source: normalizeSourcePath(params.cwd, handler.sourceFile.getFilePath()),
8466
+ source: normalizeSourcePath(workspaceRoot, handler.sourceFile.getFilePath()),
8465
8467
  line: callableLine(handler),
8466
8468
  depth: 0
8467
8469
  }],
@@ -8484,7 +8486,7 @@ function traceBackendPaths(params) {
8484
8486
  const backendType = inferBackendNameFromFile(resolved.sourceFile) || void 0;
8485
8487
  const node = {
8486
8488
  symbol: resolved.symbol,
8487
- source: normalizeSourcePath(params.cwd, resolved.sourceFile.getFilePath()),
8489
+ source: normalizeSourcePath(workspaceRoot, resolved.sourceFile.getFilePath()),
8488
8490
  line: callableLine(resolved),
8489
8491
  depth: totalWeight,
8490
8492
  backend_type: backendType
@@ -8493,7 +8495,7 @@ function traceBackendPaths(params) {
8493
8495
  type: reference.type,
8494
8496
  from: current.callable.symbol,
8495
8497
  to: resolved.symbol,
8496
- source: normalizeSourcePath(params.cwd, current.callable.sourceFile.getFilePath()),
8498
+ source: normalizeSourcePath(workspaceRoot, current.callable.sourceFile.getFilePath()),
8497
8499
  line: call.getStartLineNumber(),
8498
8500
  weight
8499
8501
  };
@@ -8597,7 +8599,8 @@ async function collectBackendTopologyDependencyFiles(project, entryFilePath, res
8597
8599
  return [...visited];
8598
8600
  }
8599
8601
  async function generateBackendTopologyArtifacts(params) {
8600
- const resolvePath = (sourceFilePath, moduleSpecifier) => resolveModulePath(sourceFilePath, moduleSpecifier, getUserConfig().resolver.alias, params.cwd);
8602
+ const workspaceRoot = process.cwd();
8603
+ const resolvePath = (sourceFilePath, moduleSpecifier) => resolveModulePath(sourceFilePath, moduleSpecifier, getUserConfig().resolver.alias, process.cwd());
8601
8604
  const project = new Project({
8602
8605
  skipAddingFilesFromTsConfig: true,
8603
8606
  compilerOptions: {
@@ -8608,7 +8611,7 @@ async function generateBackendTopologyArtifacts(params) {
8608
8611
  }
8609
8612
  });
8610
8613
  taskProgressService.report("Discovering route files");
8611
- const routeFiles = await globby(["app/_api/**/routes.@(js|ts)", "app/legacy/**/routes.@(js|ts)"], {
8614
+ const routeFiles = await globby(["_api/**/routes.@(js|ts)", "legacy/**/routes.@(js|ts)"], {
8612
8615
  cwd: params.cwd,
8613
8616
  absolute: true
8614
8617
  });
@@ -8649,6 +8652,7 @@ async function generateBackendTopologyArtifacts(params) {
8649
8652
  if (!params.onRouteProgress) taskProgressService.log(`${route.method} ${route.path} ... Tracing callable paths`);
8650
8653
  const backendPaths = traceBackendPaths({
8651
8654
  cwd: params.cwd,
8655
+ workspaceRoot,
8652
8656
  project,
8653
8657
  handlerFile: handler.sourceFile,
8654
8658
  handlerName: handler.symbol,
@@ -8656,6 +8660,7 @@ async function generateBackendTopologyArtifacts(params) {
8656
8660
  });
8657
8661
  const mappingContext = collectBackendTopologyMappingContext({
8658
8662
  cwd: params.cwd,
8663
+ workspaceRoot,
8659
8664
  project,
8660
8665
  handlerFile: handler.sourceFile,
8661
8666
  handlerName: handler.symbol,
@@ -8669,14 +8674,14 @@ async function generateBackendTopologyArtifacts(params) {
8669
8674
  route: {
8670
8675
  method: route.method,
8671
8676
  path: route.path,
8672
- source: normalizeSourcePath(params.cwd, route.sourceFile.getFilePath()),
8677
+ source: normalizeSourcePath(workspaceRoot, route.sourceFile.getFilePath()),
8673
8678
  handler: {
8674
8679
  symbol: handler.symbol,
8675
- source: normalizeSourcePath(params.cwd, handler.sourceFile.getFilePath()),
8680
+ source: normalizeSourcePath(workspaceRoot, handler.sourceFile.getFilePath()),
8676
8681
  line: callableLine(handler)
8677
8682
  }
8678
8683
  },
8679
- analysis_files: [.../* @__PURE__ */ new Set([...dependencyFiles.map((filePath) => normalizeSourcePath(params.cwd, filePath)), ...backendPaths.flatMap((backendPath) => backendPath.nodes.map((node) => node.source))])].sort(),
8684
+ analysis_files: [.../* @__PURE__ */ new Set([...dependencyFiles.map((filePath) => normalizeSourcePath(workspaceRoot, filePath)), ...backendPaths.flatMap((backendPath) => backendPath.nodes.map((node) => node.source))])].sort(),
8680
8685
  mapping_context: mappingContext,
8681
8686
  weights: backendTopologyWeights,
8682
8687
  backend_paths: backendPaths
@@ -8695,7 +8700,7 @@ async function discoverBackendTopologyRouteSelectors(cwd) {
8695
8700
  checkJs: false
8696
8701
  }
8697
8702
  });
8698
- return (await globby(["app/_api/**/routes.@(js|ts)", "app/legacy/**/routes.@(js|ts)"], {
8703
+ return (await globby(["_api/**/routes.@(js|ts)", "legacy/**/routes.@(js|ts)"], {
8699
8704
  cwd,
8700
8705
  absolute: true
8701
8706
  })).flatMap((routeFile) => extractRouteDeclarations(project.addSourceFileAtPath(routeFile))).map((route) => ({
@@ -8703,6 +8708,9 @@ async function discoverBackendTopologyRouteSelectors(cwd) {
8703
8708
  path: route.path
8704
8709
  }));
8705
8710
  }
8711
+ async function initializeTopologyWorkerConfig(configPath, cwd) {
8712
+ setUserConfig(await userConfig(configPath, cwd));
8713
+ }
8706
8714
  async function generateBackendTopologyArtifactsInWorkers(params) {
8707
8715
  const selectors = params.routeSelector ? [params.routeSelector] : await discoverBackendTopologyRouteSelectors(params.cwd);
8708
8716
  params.onRoutesDiscovered?.(selectors.length);
@@ -8719,7 +8727,8 @@ async function generateBackendTopologyArtifactsInWorkers(params) {
8719
8727
  const worker = new Worker(new URL(workerFile, import.meta.url), {
8720
8728
  workerData: {
8721
8729
  cwd: params.cwd,
8722
- routeSelectors
8730
+ routeSelectors,
8731
+ configPath: getUserConfig().configPath
8723
8732
  },
8724
8733
  execArgv: process.execArgv
8725
8734
  });
@@ -8756,5 +8765,5 @@ async function generateBackendTopologyArtifactsInWorkers(params) {
8756
8765
  }
8757
8766
 
8758
8767
  //#endregion
8759
- export { inferBackendNameFromFile as a, shouldKeepAnalysisFile as c, resolveModulePath as i, normalizeFilePath as l, generateBackendTopologyArtifactsInWorkers as n, isKnownBackendType as o, matchesRouteSelector as r, filterAnalysisFiles as s, generateBackendTopologyArtifacts as t, globby as u };
8760
- //# sourceMappingURL=routeBackendTopologyService-CQyRyoSN.mjs.map
8768
+ export { resolveModulePath as a, filterAnalysisFiles as c, globby as d, matchesRouteSelector as i, shouldKeepAnalysisFile as l, generateBackendTopologyArtifactsInWorkers as n, inferBackendNameFromFile as o, initializeTopologyWorkerConfig as r, isKnownBackendType as s, generateBackendTopologyArtifacts as t, normalizeFilePath as u };
8769
+ //# sourceMappingURL=routeBackendTopologyService-NPO-ZHyY.mjs.map