@ankhorage/dependency-graph 0.7.2 → 1.0.0
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.
- package/CHANGELOG.md +6 -0
- package/README.md +12 -3
- package/dist/dependencyGraph.d.ts +13 -9
- package/dist/dependencyGraph.d.ts.map +1 -1
- package/dist/dependencyGraph.js +11 -8
- package/dist/dependencyGraph.js.map +1 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/extractCppDependencies.d.ts +2 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/extractCppDependencies.d.ts.map +1 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/extractCppDependencies.js.map +1 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaSourceFacts.d.ts +4 -0
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaSourceFacts.d.ts.map +1 -0
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaSourceFacts.js +201 -0
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaSourceFacts.js.map +1 -0
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptSourceFacts.d.ts +4 -0
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptSourceFacts.d.ts.map +1 -0
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptSourceFacts.js +159 -0
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptSourceFacts.js.map +1 -0
- package/dist/features/dependency-analysis/{application → composition}/createDependencyGraphAsync.d.ts.map +1 -1
- package/dist/features/dependency-analysis/{application → composition}/createDependencyGraphAsync.js +1 -2
- package/dist/features/dependency-analysis/composition/createDependencyGraphAsync.js.map +1 -0
- package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.d.ts.map +1 -0
- package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js +58 -0
- package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js.map +1 -0
- package/dist/features/dependency-analysis/domain/extractCppPackageFromInclude.d.ts.map +1 -0
- package/dist/features/dependency-analysis/domain/extractCppPackageFromInclude.js.map +1 -0
- package/dist/features/dependency-analysis/domain/extractDelphiPackageFromImport.d.ts.map +1 -0
- package/dist/features/dependency-analysis/domain/extractDelphiPackageFromImport.js.map +1 -0
- package/dist/features/dependency-analysis/domain/extractJavaPackageFromImport.d.ts +3 -0
- package/dist/features/dependency-analysis/domain/extractJavaPackageFromImport.d.ts.map +1 -0
- package/dist/features/dependency-analysis/{adapters/outbound/java → domain}/extractJavaPackageFromImport.js +1 -1
- package/dist/features/dependency-analysis/domain/extractJavaPackageFromImport.js.map +1 -0
- package/dist/features/dependency-analysis/domain/extractKotlinPackageFromImport.d.ts.map +1 -0
- package/dist/features/dependency-analysis/domain/extractKotlinPackageFromImport.js.map +1 -0
- package/dist/features/dependency-analysis/domain/extractPythonPackageFromImport.d.ts.map +1 -0
- package/dist/features/dependency-analysis/domain/extractPythonPackageFromImport.js.map +1 -0
- package/dist/features/dependency-analysis/domain/projectDependencyGraphFromSourceGraph.d.ts +5 -0
- package/dist/features/dependency-analysis/domain/projectDependencyGraphFromSourceGraph.d.ts.map +1 -0
- package/dist/features/dependency-analysis/domain/projectDependencyGraphFromSourceGraph.js +144 -0
- package/dist/features/dependency-analysis/domain/projectDependencyGraphFromSourceGraph.js.map +1 -0
- package/dist/features/source-graph/adapters/outbound/extractOtherLanguageFacts.d.ts +4 -0
- package/dist/features/source-graph/adapters/outbound/extractOtherLanguageFacts.d.ts.map +1 -0
- package/dist/features/source-graph/adapters/outbound/extractOtherLanguageFacts.js +36 -0
- package/dist/features/source-graph/adapters/outbound/extractOtherLanguageFacts.js.map +1 -0
- package/dist/features/source-graph/composition/createSourceGraphAsync.d.ts +4 -0
- package/dist/features/source-graph/composition/createSourceGraphAsync.d.ts.map +1 -0
- package/dist/features/source-graph/composition/createSourceGraphAsync.js +16 -0
- package/dist/features/source-graph/composition/createSourceGraphAsync.js.map +1 -0
- package/dist/features/source-graph/composition/createSourceGraphFromInspectionsAsync.d.ts +4 -0
- package/dist/features/source-graph/composition/createSourceGraphFromInspectionsAsync.d.ts.map +1 -0
- package/dist/features/source-graph/composition/createSourceGraphFromInspectionsAsync.js +118 -0
- package/dist/features/source-graph/composition/createSourceGraphFromInspectionsAsync.js.map +1 -0
- package/dist/features/source-graph/domain/createSourceGraph.d.ts +4 -0
- package/dist/features/source-graph/domain/createSourceGraph.d.ts.map +1 -0
- package/dist/features/source-graph/domain/createSourceGraph.js +73 -0
- package/dist/features/source-graph/domain/createSourceGraph.js.map +1 -0
- package/dist/features/source-graph/domain/createSourceGraphIndex.d.ts +4 -0
- package/dist/features/source-graph/domain/createSourceGraphIndex.d.ts.map +1 -0
- package/dist/features/source-graph/domain/createSourceGraphIndex.js +57 -0
- package/dist/features/source-graph/domain/createSourceGraphIndex.js.map +1 -0
- package/dist/features/source-graph/domain/createSourceRelationDraft.d.ts +4 -0
- package/dist/features/source-graph/domain/createSourceRelationDraft.d.ts.map +1 -0
- package/dist/features/source-graph/domain/createSourceRelationDraft.js +119 -0
- package/dist/features/source-graph/domain/createSourceRelationDraft.js.map +1 -0
- package/dist/features/source-graph/domain/createSourceRollupIndex.d.ts +8 -0
- package/dist/features/source-graph/domain/createSourceRollupIndex.d.ts.map +1 -0
- package/dist/features/source-graph/domain/createSourceRollupIndex.js +27 -0
- package/dist/features/source-graph/domain/createSourceRollupIndex.js.map +1 -0
- package/dist/features/source-graph/domain/createSourceStructureDraft.d.ts +11 -0
- package/dist/features/source-graph/domain/createSourceStructureDraft.d.ts.map +1 -0
- package/dist/features/source-graph/domain/createSourceStructureDraft.js +238 -0
- package/dist/features/source-graph/domain/createSourceStructureDraft.js.map +1 -0
- package/dist/features/source-graph/domain/querySourceGraph.d.ts +15 -0
- package/dist/features/source-graph/domain/querySourceGraph.d.ts.map +1 -0
- package/dist/features/source-graph/domain/querySourceGraph.js +40 -0
- package/dist/features/source-graph/domain/querySourceGraph.js.map +1 -0
- package/dist/features/source-graph/domain/resolveSourceImport.d.ts +9 -0
- package/dist/features/source-graph/domain/resolveSourceImport.d.ts.map +1 -0
- package/dist/features/source-graph/domain/resolveSourceImport.js +146 -0
- package/dist/features/source-graph/domain/resolveSourceImport.js.map +1 -0
- package/dist/features/source-graph/domain/rollupSourceRelations.d.ts +4 -0
- package/dist/features/source-graph/domain/rollupSourceRelations.d.ts.map +1 -0
- package/dist/features/source-graph/domain/rollupSourceRelations.js +46 -0
- package/dist/features/source-graph/domain/rollupSourceRelations.js.map +1 -0
- package/dist/features/source-graph/domain/serializeSourceGraph.d.ts +6 -0
- package/dist/features/source-graph/domain/serializeSourceGraph.d.ts.map +1 -0
- package/dist/features/source-graph/domain/serializeSourceGraph.js +64 -0
- package/dist/features/source-graph/domain/serializeSourceGraph.js.map +1 -0
- package/dist/features/source-graph/domain/sourceSemanticPath.d.ts +3 -0
- package/dist/features/source-graph/domain/sourceSemanticPath.d.ts.map +1 -0
- package/dist/features/source-graph/domain/sourceSemanticPath.js +5 -0
- package/dist/features/source-graph/domain/sourceSemanticPath.js.map +1 -0
- package/dist/features/source-graph/domain/summarizeSourceNode.d.ts +4 -0
- package/dist/features/source-graph/domain/summarizeSourceNode.d.ts.map +1 -0
- package/dist/features/source-graph/domain/summarizeSourceNode.js +66 -0
- package/dist/features/source-graph/domain/summarizeSourceNode.js.map +1 -0
- package/dist/types/dependencyGraph.d.ts +2 -23
- package/dist/types/dependencyGraph.d.ts.map +1 -1
- package/dist/types/dependencyGraph.js.map +1 -1
- package/dist/types/sourceGraph.d.ts +173 -0
- package/dist/types/sourceGraph.d.ts.map +1 -0
- package/dist/types/sourceGraph.js +2 -0
- package/dist/types/sourceGraph.js.map +1 -0
- package/package.json +6 -4
- package/dist/features/dependency-analysis/adapters/outbound/cpp/analyzeCppProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/cpp/analyzeCppProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/analyzeCppProjectAsync.js +0 -103
- package/dist/features/dependency-analysis/adapters/outbound/cpp/analyzeCppProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/cppDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/cpp/cppDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/cppDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/cpp/cppDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/extractCppPackageFromInclude.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/extractCppPackageFromInclude.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/analyzeDelphiProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/delphi/analyzeDelphiProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/analyzeDelphiProjectAsync.js +0 -105
- package/dist/features/dependency-analysis/adapters/outbound/delphi/analyzeDelphiProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/delphiDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/delphi/delphiDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/delphiDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/delphi/delphiDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/extractDelphiPackageFromImport.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/extractDelphiPackageFromImport.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/analyzeJavaProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/java/analyzeJavaProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/analyzeJavaProjectAsync.js +0 -103
- package/dist/features/dependency-analysis/adapters/outbound/java/analyzeJavaProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaDependencies.d.ts +0 -7
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaDependencies.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaDependencies.js +0 -7
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaDependencies.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaPackageFromImport.d.ts +0 -3
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaPackageFromImport.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaPackageFromImport.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/javaDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/java/javaDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/javaDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/java/javaDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/analyzeKotlinProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/analyzeKotlinProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/analyzeKotlinProjectAsync.js +0 -103
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/analyzeKotlinProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/extractKotlinPackageFromImport.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/extractKotlinPackageFromImport.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.js +0 -103
- package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/extractPythonPackageFromImport.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/extractPythonPackageFromImport.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/analyzeTypeScriptProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/typescript/analyzeTypeScriptProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/analyzeTypeScriptProjectAsync.js +0 -92
- package/dist/features/dependency-analysis/adapters/outbound/typescript/analyzeTypeScriptProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/createTypeScriptModuleNodes.d.ts +0 -5
- package/dist/features/dependency-analysis/adapters/outbound/typescript/createTypeScriptModuleNodes.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/createTypeScriptModuleNodes.js +0 -29
- package/dist/features/dependency-analysis/adapters/outbound/typescript/createTypeScriptModuleNodes.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.d.ts +0 -3
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.js +0 -9
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.d.ts +0 -3
- package/dist/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.d.ts +0 -11
- package/dist/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.js +0 -85
- package/dist/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/application/createDependencyGraphAsync.js.map +0 -1
- package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.js +0 -111
- package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.js.map +0 -1
- package/dist/features/dependency-analysis/utils/collectInspectedSourceFiles.d.ts +0 -4
- package/dist/features/dependency-analysis/utils/collectInspectedSourceFiles.d.ts.map +0 -1
- package/dist/features/dependency-analysis/utils/collectInspectedSourceFiles.js +0 -36
- package/dist/features/dependency-analysis/utils/collectInspectedSourceFiles.js.map +0 -1
- package/dist/features/dependency-analysis/utils/findIntrinsicPackageForReference.d.ts +0 -3
- package/dist/features/dependency-analysis/utils/findIntrinsicPackageForReference.d.ts.map +0 -1
- package/dist/features/dependency-analysis/utils/findIntrinsicPackageForReference.js +0 -8
- package/dist/features/dependency-analysis/utils/findIntrinsicPackageForReference.js.map +0 -1
- /package/dist/features/dependency-analysis/{application → composition}/createDependencyGraphAsync.d.ts +0 -0
- /package/dist/features/dependency-analysis/{application → composition}/createDependencyGraphFromInspectionsAsync.d.ts +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/cpp → domain}/extractCppPackageFromInclude.d.ts +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/cpp → domain}/extractCppPackageFromInclude.js +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/delphi → domain}/extractDelphiPackageFromImport.d.ts +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/delphi → domain}/extractDelphiPackageFromImport.js +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/kotlin → domain}/extractKotlinPackageFromImport.d.ts +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/kotlin → domain}/extractKotlinPackageFromImport.js +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/python → domain}/extractPythonPackageFromImport.d.ts +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/python → domain}/extractPythonPackageFromImport.js +0 -0
package/dist/features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { analyzeKotlinProjectAsync } from './analyzeKotlinProjectAsync.js';
|
|
2
|
-
/*** Kotlin analyzer adapter selected from project-detector language evidence. */
|
|
3
|
-
export const kotlinDependencyGraphAnalyzer = {
|
|
4
|
-
id: 'kotlin',
|
|
5
|
-
supports: (detection) => detection.languages.some(({ id }) => id === 'kotlin'),
|
|
6
|
-
analyzeAsync: analyzeKotlinProjectAsync,
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=kotlinDependencyGraphAnalyzer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kotlinDependencyGraphAnalyzer.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,iFAAiF;AACjF,MAAM,CAAC,MAAM,6BAA6B,GAA4B;IACpE,EAAE,EAAE,QAAQ;IACZ,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC;IAC9E,YAAY,EAAE,yBAAyB;CACxC,CAAC","sourcesContent":["import type { DependencyGraphAnalyzer } from '../../../../../types/dependencyGraph.js';\nimport { analyzeKotlinProjectAsync } from './analyzeKotlinProjectAsync.js';\n\n/*** Kotlin analyzer adapter selected from project-detector language evidence. */\nexport const kotlinDependencyGraphAnalyzer: DependencyGraphAnalyzer = {\n id: 'kotlin',\n supports: (detection) => detection.languages.some(({ id }) => id === 'kotlin'),\n analyzeAsync: analyzeKotlinProjectAsync,\n};\n"]}
|
package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { DependencyGraphAnalyzerContext, DependencyGraphFragment } from '../../../../../types/dependencyGraph.js';
|
|
2
|
-
/*** Analyze one detected Python package into package/import dependency evidence. */
|
|
3
|
-
export declare function analyzePythonProjectAsync(context: DependencyGraphAnalyzerContext): Promise<DependencyGraphFragment>;
|
|
4
|
-
//# sourceMappingURL=analyzePythonProjectAsync.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzePythonProjectAsync.d.ts","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,8BAA8B,EAE9B,uBAAuB,EAGxB,MAAM,yCAAyC,CAAC;AAMjD,oFAAoF;AACpF,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,uBAAuB,CAAC,CAkClC"}
|
package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { toPortablePath } from '@ankhorage/utility/node/path';
|
|
4
|
-
import { collectInspectedSourceFiles } from '../../../utils/collectInspectedSourceFiles.js';
|
|
5
|
-
import { extractPythonDependencies } from './extractPythonDependencies.js';
|
|
6
|
-
import { extractPythonPackageFromImport } from './extractPythonPackageFromImport.js';
|
|
7
|
-
import { pythonPackageForFile } from './pythonPackageForFile.js';
|
|
8
|
-
/*** Analyze one detected Python package into package/import dependency evidence. */
|
|
9
|
-
export async function analyzePythonProjectAsync(context) {
|
|
10
|
-
const language = context.package.detection.languages.find(({ id }) => id === 'python');
|
|
11
|
-
const sourceRoots = language?.sourceRoots ?? ['src', 'app', '.'];
|
|
12
|
-
const files = collectInspectedSourceFiles(context, sourceRoots, (file) => file.endsWith('.py') || file.endsWith('.pyi'), ['.git', '.mypy_cache', '.pytest_cache', '.venv', '__pycache__', 'build', 'dist', 'venv']);
|
|
13
|
-
const sources = await Promise.all(files.map(async (file) => ({
|
|
14
|
-
file,
|
|
15
|
-
packageName: pythonPackageForFile(context.package.rootPath, sourceRoots, file),
|
|
16
|
-
dependencies: extractPythonDependencies(await readFile(file, 'utf8')),
|
|
17
|
-
})));
|
|
18
|
-
const intrinsicPackages = new Set(sources.map(({ packageName }) => packageName).filter((packageName) => packageName !== ''));
|
|
19
|
-
const topLevelPackages = new Set([...intrinsicPackages].map((packageName) => packageName.split('.')[0] ?? packageName));
|
|
20
|
-
const nodes = new Map();
|
|
21
|
-
for (const packageName of intrinsicPackages)
|
|
22
|
-
addIntrinsicHierarchy(context, packageName, nodes);
|
|
23
|
-
const edges = new Map();
|
|
24
|
-
for (const { file, packageName, dependencies } of sources) {
|
|
25
|
-
context.signal?.throwIfAborted();
|
|
26
|
-
const sourceNodeId = nodeIdForPackage(context, packageName);
|
|
27
|
-
for (const specifier of dependencies.imports) {
|
|
28
|
-
addImport(context, file, sourceNodeId, specifier, topLevelPackages, nodes, edges);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return { nodes: [...nodes.values()], edges: [...edges.values()] };
|
|
32
|
-
}
|
|
33
|
-
/*** Aggregate one Python import into stable target nodes and weighted evidence. */
|
|
34
|
-
function addImport(context, sourceFile, sourceNodeId, specifier, topLevelPackages, nodes, edges) {
|
|
35
|
-
const targetPackage = extractPythonPackageFromImport(specifier);
|
|
36
|
-
if (targetPackage === '')
|
|
37
|
-
return;
|
|
38
|
-
const intrinsic = topLevelPackages.has(targetPackage);
|
|
39
|
-
const targetNodeId = intrinsic
|
|
40
|
-
? nodeIdForPackage(context, targetPackage)
|
|
41
|
-
: `unknown:${targetPackage}`;
|
|
42
|
-
if (targetNodeId === sourceNodeId)
|
|
43
|
-
return;
|
|
44
|
-
if (!intrinsic && !nodes.has(targetNodeId)) {
|
|
45
|
-
nodes.set(targetNodeId, {
|
|
46
|
-
id: targetNodeId,
|
|
47
|
-
data: {
|
|
48
|
-
kind: 'package',
|
|
49
|
-
classification: 'unknown',
|
|
50
|
-
focus: false,
|
|
51
|
-
label: targetPackage,
|
|
52
|
-
packageName: targetPackage,
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
const edgeId = `${sourceNodeId}->${targetNodeId}`;
|
|
57
|
-
const existing = edges.get(edgeId);
|
|
58
|
-
const evidence = {
|
|
59
|
-
sourceFile: toPortablePath(path.relative(context.package.rootPath, sourceFile)),
|
|
60
|
-
specifier,
|
|
61
|
-
classification: intrinsic ? 'intrinsic' : 'unknown',
|
|
62
|
-
declarations: [],
|
|
63
|
-
};
|
|
64
|
-
edges.set(edgeId, {
|
|
65
|
-
id: edgeId,
|
|
66
|
-
source: sourceNodeId,
|
|
67
|
-
target: targetNodeId,
|
|
68
|
-
data: {
|
|
69
|
-
kind: 'import',
|
|
70
|
-
analyzerId: 'python',
|
|
71
|
-
weight: (existing?.data.weight ?? 0) + 1,
|
|
72
|
-
evidence: [...(existing?.data.evidence ?? []), evidence],
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
/*** Materialize a Python package and all ancestor package nodes. */
|
|
77
|
-
function addIntrinsicHierarchy(context, packageName, nodes) {
|
|
78
|
-
const segments = packageName.split('.');
|
|
79
|
-
segments.forEach((_, index) => {
|
|
80
|
-
const current = segments.slice(0, index + 1).join('.');
|
|
81
|
-
const id = nodeIdForPackage(context, current);
|
|
82
|
-
if (nodes.has(id))
|
|
83
|
-
return;
|
|
84
|
-
nodes.set(id, {
|
|
85
|
-
id,
|
|
86
|
-
data: {
|
|
87
|
-
kind: 'module',
|
|
88
|
-
classification: 'intrinsic',
|
|
89
|
-
focus: true,
|
|
90
|
-
label: current.split('.').at(-1) ?? current,
|
|
91
|
-
projectId: context.package.projectId,
|
|
92
|
-
...(context.package.name === undefined ? {} : { packageName: context.package.name }),
|
|
93
|
-
path: current,
|
|
94
|
-
parentPath: current.includes('.') ? current.split('.').slice(0, -1).join('.') : '',
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
/*** Resolve a Python package node inside the current focus package. */
|
|
100
|
-
function nodeIdForPackage(context, packageName) {
|
|
101
|
-
return packageName === '' ? context.package.nodeId : `${context.package.nodeId}#${packageName}`;
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=analyzePythonProjectAsync.js.map
|
package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzePythonProjectAsync.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAS9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,OAAuC;IAEvC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;IACvF,MAAM,WAAW,GAAG,QAAQ,EAAE,WAAW,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,2BAA2B,CACvC,OAAO,EACP,WAAW,EACX,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,C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AAC,GAAG,CAAC,EAAE,EAAE;YACZ,EAAE;YACF,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,cAAc,EAAE,WAAW;gBAC3B,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO;gBAC3C,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS;gBACpC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBACpF,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;aACnF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,uEAAuE;AACvE,SAAS,gBAAgB,CAAC,OAAuC,EAAE,WAAmB;IACpF,OAAO,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,WAAW,EAAE,CAAC;AAClG,CAAC","sourcesContent":["import { readFile } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport type { GraphEdge, GraphNode } from '@ankhorage/graph';\nimport { toPortablePath } from '@ankhorage/utility/node/path';\n\nimport type {\n DependencyGraphAnalyzerContext,\n DependencyGraphEdgeData,\n DependencyGraphFragment,\n DependencyGraphNodeData,\n DependencyImportEvidence,\n} from '../../../../../types/dependencyGraph.js';\nimport { collectInspectedSourceFiles } from '../../../utils/collectInspectedSourceFiles.js';\nimport { extractPythonDependencies } from './extractPythonDependencies.js';\nimport { extractPythonPackageFromImport } from './extractPythonPackageFromImport.js';\nimport { pythonPackageForFile } from './pythonPackageForFile.js';\n\n/*** Analyze one detected Python package into package/import dependency evidence. */\nexport async function analyzePythonProjectAsync(\n context: DependencyGraphAnalyzerContext,\n): Promise<DependencyGraphFragment> {\n const language = context.package.detection.languages.find(({ id }) => id === 'python');\n const sourceRoots = language?.sourceRoots ?? ['src', 'app', '.'];\n const files = collectInspectedSourceFiles(\n context,\n sourceRoots,\n (file) => file.endsWith('.py') || file.endsWith('.pyi'),\n ['.git', '.mypy_cache', '.pytest_cache', '.venv', '__pycache__', 'build', 'dist', 'venv'],\n );\n const sources = await Promise.all(\n files.map(async (file) => ({\n file,\n packageName: pythonPackageForFile(context.package.rootPath, sourceRoots, file),\n dependencies: extractPythonDependencies(await readFile(file, 'utf8')),\n })),\n );\n const intrinsicPackages = new Set(\n sources.map(({ packageName }) => packageName).filter((packageName) => packageName !== ''),\n );\n const topLevelPackages = new Set(\n [...intrinsicPackages].map((packageName) => packageName.split('.')[0] ?? packageName),\n );\n const nodes = new Map<string, GraphNode<DependencyGraphNodeData>>();\n for (const packageName of intrinsicPackages) addIntrinsicHierarchy(context, packageName, nodes);\n const edges = new Map<string, GraphEdge<DependencyGraphEdgeData>>();\n\n for (const { file, packageName, dependencies } of sources) {\n context.signal?.throwIfAborted();\n const sourceNodeId = nodeIdForPackage(context, packageName);\n for (const specifier of dependencies.imports) {\n addImport(context, file, sourceNodeId, specifier, topLevelPackages, nodes, edges);\n }\n }\n return { nodes: [...nodes.values()], edges: [...edges.values()] };\n}\n\n/*** Aggregate one Python import into stable target nodes and weighted evidence. */\nfunction addImport(\n context: DependencyGraphAnalyzerContext,\n sourceFile: string,\n sourceNodeId: string,\n specifier: string,\n topLevelPackages: ReadonlySet<string>,\n nodes: Map<string, GraphNode<DependencyGraphNodeData>>,\n edges: Map<string, GraphEdge<DependencyGraphEdgeData>>,\n): void {\n const targetPackage = extractPythonPackageFromImport(specifier);\n if (targetPackage === '') return;\n const intrinsic = topLevelPackages.has(targetPackage);\n const targetNodeId = intrinsic\n ? nodeIdForPackage(context, targetPackage)\n : `unknown:${targetPackage}`;\n if (targetNodeId === sourceNodeId) return;\n if (!intrinsic && !nodes.has(targetNodeId)) {\n nodes.set(targetNodeId, {\n id: targetNodeId,\n data: {\n kind: 'package',\n classification: 'unknown',\n focus: false,\n label: targetPackage,\n packageName: targetPackage,\n },\n });\n }\n const edgeId = `${sourceNodeId}->${targetNodeId}`;\n const existing = edges.get(edgeId);\n const evidence: DependencyImportEvidence = {\n sourceFile: toPortablePath(path.relative(context.package.rootPath, sourceFile)),\n specifier,\n classification: intrinsic ? 'intrinsic' : 'unknown',\n declarations: [],\n };\n edges.set(edgeId, {\n id: edgeId,\n source: sourceNodeId,\n target: targetNodeId,\n data: {\n kind: 'import',\n analyzerId: 'python',\n weight: (existing?.data.weight ?? 0) + 1,\n evidence: [...(existing?.data.evidence ?? []), evidence],\n },\n });\n}\n\n/*** Materialize a Python package and all ancestor package nodes. */\nfunction addIntrinsicHierarchy(\n context: DependencyGraphAnalyzerContext,\n packageName: string,\n nodes: Map<string, GraphNode<DependencyGraphNodeData>>,\n): void {\n const segments = packageName.split('.');\n segments.forEach((_, index) => {\n const current = segments.slice(0, index + 1).join('.');\n const id = nodeIdForPackage(context, current);\n if (nodes.has(id)) return;\n nodes.set(id, {\n id,\n data: {\n kind: 'module',\n classification: 'intrinsic',\n focus: true,\n label: current.split('.').at(-1) ?? current,\n projectId: context.package.projectId,\n ...(context.package.name === undefined ? {} : { packageName: context.package.name }),\n path: current,\n parentPath: current.includes('.') ? current.split('.').slice(0, -1).join('.') : '',\n },\n });\n });\n}\n\n/*** Resolve a Python package node inside the current focus package. */\nfunction nodeIdForPackage(context: DependencyGraphAnalyzerContext, packageName: string): string {\n return packageName === '' ? context.package.nodeId : `${context.package.nodeId}#${packageName}`;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractPythonPackageFromImport.d.ts","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/python/extractPythonPackageFromImport.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGxE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractPythonPackageFromImport.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/python/extractPythonPackageFromImport.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,UAAU,8BAA8B,CAAC,SAAiB;IAC9D,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACzC,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;AAC9C,CAAC","sourcesContent":["/*** Reduce a Python import specifier to its PKGViz-compatible package target. */\nexport function extractPythonPackageFromImport(specifier: string): string {\n if (specifier.startsWith('.')) return '';\n return specifier.split('.')[0] ?? specifier;\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { DependencyGraphAnalyzer } from '../../../../../types/dependencyGraph.js';
|
|
2
|
-
/*** Python analyzer adapter selected from project-detector language evidence. */
|
|
3
|
-
export declare const pythonDependencyGraphAnalyzer: DependencyGraphAnalyzer;
|
|
4
|
-
//# sourceMappingURL=pythonDependencyGraphAnalyzer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pythonDependencyGraphAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAGvF,iFAAiF;AACjF,eAAO,MAAM,6BAA6B,EAAE,uBAI3C,CAAC"}
|
package/dist/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { analyzePythonProjectAsync } from './analyzePythonProjectAsync.js';
|
|
2
|
-
/*** Python analyzer adapter selected from project-detector language evidence. */
|
|
3
|
-
export const pythonDependencyGraphAnalyzer = {
|
|
4
|
-
id: 'python',
|
|
5
|
-
supports: (detection) => detection.languages.some(({ id }) => id === 'python'),
|
|
6
|
-
analyzeAsync: analyzePythonProjectAsync,
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=pythonDependencyGraphAnalyzer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pythonDependencyGraphAnalyzer.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,iFAAiF;AACjF,MAAM,CAAC,MAAM,6BAA6B,GAA4B;IACpE,EAAE,EAAE,QAAQ;IACZ,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC;IAC9E,YAAY,EAAE,yBAAyB;CACxC,CAAC","sourcesContent":["import type { DependencyGraphAnalyzer } from '../../../../../types/dependencyGraph.js';\nimport { analyzePythonProjectAsync } from './analyzePythonProjectAsync.js';\n\n/*** Python analyzer adapter selected from project-detector language evidence. */\nexport const pythonDependencyGraphAnalyzer: DependencyGraphAnalyzer = {\n id: 'python',\n supports: (detection) => detection.languages.some(({ id }) => id === 'python'),\n analyzeAsync: analyzePythonProjectAsync,\n};\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { DependencyGraphAnalyzerContext, DependencyGraphFragment } from '../../../../../types/dependencyGraph.js';
|
|
2
|
-
/*** Analyze one detected TypeScript package into module/import dependency evidence. */
|
|
3
|
-
export declare function analyzeTypeScriptProjectAsync(context: DependencyGraphAnalyzerContext): Promise<DependencyGraphFragment>;
|
|
4
|
-
//# sourceMappingURL=analyzeTypeScriptProjectAsync.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeTypeScriptProjectAsync.d.ts","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/analyzeTypeScriptProjectAsync.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,8BAA8B,EAE9B,uBAAuB,EAGxB,MAAM,yCAAyC,CAAC;AAOjD,uFAAuF;AACvF,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,uBAAuB,CAAC,CAwBlC"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { toPortablePath } from '@ankhorage/utility/node/path';
|
|
4
|
-
import { collectInspectedSourceFiles } from '../../../utils/collectInspectedSourceFiles.js';
|
|
5
|
-
import { createTypeScriptModuleNodes } from './createTypeScriptModuleNodes.js';
|
|
6
|
-
import { extractTypeScriptImports } from './extractTypeScriptImports.js';
|
|
7
|
-
import { modulePathForFile } from './modulePathForFile.js';
|
|
8
|
-
import { resolveTypeScriptImport } from './resolveTypeScriptImport.js';
|
|
9
|
-
/*** Analyze one detected TypeScript package into module/import dependency evidence. */
|
|
10
|
-
export async function analyzeTypeScriptProjectAsync(context) {
|
|
11
|
-
const language = context.package.detection.languages.find(({ id }) => id === 'typescript');
|
|
12
|
-
const files = collectInspectedSourceFiles(context, language?.sourceRoots ?? ['.'], (file) => ['.ts', '.tsx', '.mts', '.cts'].some((extension) => file.endsWith(extension)), ['.git', '.next', 'build', 'coverage', 'dist', 'node_modules']);
|
|
13
|
-
const sourceFiles = new Set(files);
|
|
14
|
-
const nodes = new Map(createTypeScriptModuleNodes(context.package, files).map((node) => [node.id, node]));
|
|
15
|
-
const edges = new Map();
|
|
16
|
-
for (const file of files) {
|
|
17
|
-
context.signal?.throwIfAborted();
|
|
18
|
-
const sourceNodeId = nodeIdForFile(context, file);
|
|
19
|
-
const imports = extractTypeScriptImports(file, await readFile(file, 'utf8'));
|
|
20
|
-
for (const specifier of imports) {
|
|
21
|
-
addImport(context, file, sourceNodeId, specifier, sourceFiles, nodes, edges);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return { nodes: [...nodes.values()], edges: [...edges.values()] };
|
|
25
|
-
}
|
|
26
|
-
/*** Aggregate one import into stable target nodes and weighted evidence. */
|
|
27
|
-
function addImport(context, sourceFile, sourceNodeId, specifier, sourceFiles, nodes, edges) {
|
|
28
|
-
const resolved = resolveTypeScriptImport(context.package, sourceFile, specifier, sourceFiles, context.focusPackages);
|
|
29
|
-
if (resolved.targetNodeId === sourceNodeId)
|
|
30
|
-
return;
|
|
31
|
-
addTargetNode(context, resolved, nodes);
|
|
32
|
-
const edgeId = `${sourceNodeId}->${resolved.targetNodeId}`;
|
|
33
|
-
const evidence = {
|
|
34
|
-
sourceFile: toPortablePath(path.relative(context.package.rootPath, sourceFile)),
|
|
35
|
-
specifier,
|
|
36
|
-
classification: resolved.classification,
|
|
37
|
-
declarations: resolved.declarations,
|
|
38
|
-
};
|
|
39
|
-
const existing = edges.get(edgeId);
|
|
40
|
-
edges.set(edgeId, {
|
|
41
|
-
id: edgeId,
|
|
42
|
-
source: sourceNodeId,
|
|
43
|
-
target: resolved.targetNodeId,
|
|
44
|
-
data: {
|
|
45
|
-
kind: 'import',
|
|
46
|
-
analyzerId: 'typescript',
|
|
47
|
-
weight: (existing?.data.weight ?? 0) + 1,
|
|
48
|
-
evidence: [...(existing?.data.evidence ?? []), evidence],
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/*** Materialize intrinsic, vendor and unknown targets while focus targets are globally owned. */
|
|
53
|
-
function addTargetNode(context, resolved, nodes) {
|
|
54
|
-
if (resolved.classification === 'focus' || nodes.has(resolved.targetNodeId))
|
|
55
|
-
return;
|
|
56
|
-
if (resolved.classification === 'intrinsic') {
|
|
57
|
-
if (resolved.targetPath === undefined || resolved.targetPath === '')
|
|
58
|
-
return;
|
|
59
|
-
nodes.set(resolved.targetNodeId, {
|
|
60
|
-
id: resolved.targetNodeId,
|
|
61
|
-
data: {
|
|
62
|
-
kind: 'module',
|
|
63
|
-
classification: 'intrinsic',
|
|
64
|
-
focus: true,
|
|
65
|
-
label: resolved.targetPath.split('.').at(-1) ?? resolved.targetPath,
|
|
66
|
-
projectId: context.package.projectId,
|
|
67
|
-
...(context.package.name === undefined ? {} : { packageName: context.package.name }),
|
|
68
|
-
path: resolved.targetPath,
|
|
69
|
-
parentPath: resolved.targetPath.includes('.')
|
|
70
|
-
? resolved.targetPath.split('.').slice(0, -1).join('.')
|
|
71
|
-
: '',
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
nodes.set(resolved.targetNodeId, {
|
|
77
|
-
id: resolved.targetNodeId,
|
|
78
|
-
data: {
|
|
79
|
-
kind: 'package',
|
|
80
|
-
classification: resolved.classification,
|
|
81
|
-
focus: false,
|
|
82
|
-
label: resolved.packageName ?? resolved.targetNodeId.replace(/^unknown:/u, ''),
|
|
83
|
-
...(resolved.packageName === undefined ? {} : { packageName: resolved.packageName }),
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/*** Resolve the source node at package granularity, using the package root for root-level files. */
|
|
88
|
-
function nodeIdForFile(context, file) {
|
|
89
|
-
const modulePath = modulePathForFile(context.package.rootPath, file);
|
|
90
|
-
return modulePath === '' ? context.package.nodeId : `${context.package.nodeId}#${modulePath}`;
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=analyzeTypeScriptProjectAsync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeTypeScriptProjectAsync.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/analyzeTypeScriptProjectAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAS9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAAuC;IAEvC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC;IAC3F,MAAM,KAAK,GAAG,2BAA2B,CACvC,OAAO,EACP,QAAQ,EAAE,WAAW,IAAI,CAAC,GAAG,CAAC,EAC9B,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EACvF,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,CAAC,CAC/D,CAAC;IACF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,K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AAC;AAED,oGAAoG;AACpG,SAAS,aAAa,CAAC,OAAuC,EAAE,IAAY;IAC1E,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACrE,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,UAAU,EAAE,CAAC;AAChG,CAAC","sourcesContent":["import { readFile } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport type { GraphEdge, GraphNode } from '@ankhorage/graph';\nimport { toPortablePath } from '@ankhorage/utility/node/path';\n\nimport type {\n DependencyGraphAnalyzerContext,\n DependencyGraphEdgeData,\n DependencyGraphFragment,\n DependencyGraphNodeData,\n DependencyImportEvidence,\n} from '../../../../../types/dependencyGraph.js';\nimport { collectInspectedSourceFiles } from '../../../utils/collectInspectedSourceFiles.js';\nimport { createTypeScriptModuleNodes } from './createTypeScriptModuleNodes.js';\nimport { extractTypeScriptImports } from './extractTypeScriptImports.js';\nimport { modulePathForFile } from './modulePathForFile.js';\nimport { resolveTypeScriptImport } from './resolveTypeScriptImport.js';\n\n/*** Analyze one detected TypeScript package into module/import dependency evidence. */\nexport async function analyzeTypeScriptProjectAsync(\n context: DependencyGraphAnalyzerContext,\n): Promise<DependencyGraphFragment> {\n const language = context.package.detection.languages.find(({ id }) => id === 'typescript');\n const files = collectInspectedSourceFiles(\n context,\n language?.sourceRoots ?? ['.'],\n (file) => ['.ts', '.tsx', '.mts', '.cts'].some((extension) => file.endsWith(extension)),\n ['.git', '.next', 'build', 'coverage', 'dist', 'node_modules'],\n );\n const sourceFiles = new Set(files);\n const nodes = new Map(\n createTypeScriptModuleNodes(context.package, files).map((node) => [node.id, node] as const),\n );\n const edges = new Map<string, GraphEdge<DependencyGraphEdgeData>>();\n\n for (const file of files) {\n context.signal?.throwIfAborted();\n const sourceNodeId = nodeIdForFile(context, file);\n const imports = extractTypeScriptImports(file, await readFile(file, 'utf8'));\n for (const specifier of imports) {\n addImport(context, file, sourceNodeId, specifier, sourceFiles, nodes, edges);\n }\n }\n\n return { nodes: [...nodes.values()], edges: [...edges.values()] };\n}\n\n/*** Aggregate one import into stable target nodes and weighted evidence. */\nfunction addImport(\n context: DependencyGraphAnalyzerContext,\n sourceFile: string,\n sourceNodeId: string,\n specifier: string,\n sourceFiles: ReadonlySet<string>,\n nodes: Map<string, GraphNode<DependencyGraphNodeData>>,\n edges: Map<string, GraphEdge<DependencyGraphEdgeData>>,\n): void {\n const resolved = resolveTypeScriptImport(\n context.package,\n sourceFile,\n specifier,\n sourceFiles,\n context.focusPackages,\n );\n if (resolved.targetNodeId === sourceNodeId) return;\n addTargetNode(context, resolved, nodes);\n const edgeId = `${sourceNodeId}->${resolved.targetNodeId}`;\n const evidence: DependencyImportEvidence = {\n sourceFile: toPortablePath(path.relative(context.package.rootPath, sourceFile)),\n specifier,\n classification: resolved.classification,\n declarations: resolved.declarations,\n };\n const existing = edges.get(edgeId);\n edges.set(edgeId, {\n id: edgeId,\n source: sourceNodeId,\n target: resolved.targetNodeId,\n data: {\n kind: 'import',\n analyzerId: 'typescript',\n weight: (existing?.data.weight ?? 0) + 1,\n evidence: [...(existing?.data.evidence ?? []), evidence],\n },\n });\n}\n\n/*** Materialize intrinsic, vendor and unknown targets while focus targets are globally owned. */\nfunction addTargetNode(\n context: DependencyGraphAnalyzerContext,\n resolved: ReturnType<typeof resolveTypeScriptImport>,\n nodes: Map<string, GraphNode<DependencyGraphNodeData>>,\n): void {\n if (resolved.classification === 'focus' || nodes.has(resolved.targetNodeId)) return;\n if (resolved.classification === 'intrinsic') {\n if (resolved.targetPath === undefined || resolved.targetPath === '') return;\n nodes.set(resolved.targetNodeId, {\n id: resolved.targetNodeId,\n data: {\n kind: 'module',\n classification: 'intrinsic',\n focus: true,\n label: resolved.targetPath.split('.').at(-1) ?? resolved.targetPath,\n projectId: context.package.projectId,\n ...(context.package.name === undefined ? {} : { packageName: context.package.name }),\n path: resolved.targetPath,\n parentPath: resolved.targetPath.includes('.')\n ? resolved.targetPath.split('.').slice(0, -1).join('.')\n : '',\n },\n });\n return;\n }\n\n nodes.set(resolved.targetNodeId, {\n id: resolved.targetNodeId,\n data: {\n kind: 'package',\n classification: resolved.classification,\n focus: false,\n label: resolved.packageName ?? resolved.targetNodeId.replace(/^unknown:/u, ''),\n ...(resolved.packageName === undefined ? {} : { packageName: resolved.packageName }),\n },\n });\n}\n\n/*** Resolve the source node at package granularity, using the package root for root-level files. */\nfunction nodeIdForFile(context: DependencyGraphAnalyzerContext, file: string): string {\n const modulePath = modulePathForFile(context.package.rootPath, file);\n return modulePath === '' ? context.package.nodeId : `${context.package.nodeId}#${modulePath}`;\n}\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { GraphNode } from '@ankhorage/graph';
|
|
2
|
-
import type { DependencyGraphNodeData, DependencyGraphPackage } from '../../../../../types/dependencyGraph.js';
|
|
3
|
-
/*** Create intrinsic module nodes, including ancestor directories, for TypeScript source files. */
|
|
4
|
-
export declare function createTypeScriptModuleNodes(packageContext: DependencyGraphPackage, files: readonly string[]): readonly GraphNode<DependencyGraphNodeData>[];
|
|
5
|
-
//# sourceMappingURL=createTypeScriptModuleNodes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTypeScriptModuleNodes.d.ts","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/createTypeScriptModuleNodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,yCAAyC,CAAC;AAGjD,mGAAmG;AACnG,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,sBAAsB,EACtC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,SAAS,SAAS,CAAC,uBAAuB,CAAC,EAAE,CAoB/C"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { modulePathForFile } from './modulePathForFile.js';
|
|
2
|
-
/*** Create intrinsic module nodes, including ancestor directories, for TypeScript source files. */
|
|
3
|
-
export function createTypeScriptModuleNodes(packageContext, files) {
|
|
4
|
-
const paths = new Set(files.flatMap((file) => ancestorModulePaths(modulePathForFile(packageContext.rootPath, file))));
|
|
5
|
-
return [...paths]
|
|
6
|
-
.sort()
|
|
7
|
-
.filter((modulePath) => modulePath !== '')
|
|
8
|
-
.map((modulePath) => ({
|
|
9
|
-
id: `${packageContext.nodeId}#${modulePath}`,
|
|
10
|
-
data: {
|
|
11
|
-
kind: 'module',
|
|
12
|
-
classification: 'intrinsic',
|
|
13
|
-
focus: true,
|
|
14
|
-
label: modulePath.split('.').at(-1) ?? modulePath,
|
|
15
|
-
projectId: packageContext.projectId,
|
|
16
|
-
...(packageContext.name === undefined ? {} : { packageName: packageContext.name }),
|
|
17
|
-
path: modulePath,
|
|
18
|
-
parentPath: modulePath.includes('.') ? modulePath.split('.').slice(0, -1).join('.') : '',
|
|
19
|
-
},
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
/*** Expand a module path into the hierarchy required for package-level graph projections. */
|
|
23
|
-
function ancestorModulePaths(modulePath) {
|
|
24
|
-
if (modulePath === '')
|
|
25
|
-
return [''];
|
|
26
|
-
const segments = modulePath.split('.');
|
|
27
|
-
return segments.map((_, index) => segments.slice(0, index + 1).join('.'));
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=createTypeScriptModuleNodes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTypeScriptModuleNodes.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/createTypeScriptModuleNodes.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,mGA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AC,CAAC;IACnC,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import type { GraphNode } from '@ankhorage/graph';\n\nimport type {\n DependencyGraphNodeData,\n DependencyGraphPackage,\n} from '../../../../../types/dependencyGraph.js';\nimport { modulePathForFile } from './modulePathForFile.js';\n\n/*** Create intrinsic module nodes, including ancestor directories, for TypeScript source files. */\nexport function createTypeScriptModuleNodes(\n packageContext: DependencyGraphPackage,\n files: readonly string[],\n): readonly GraphNode<DependencyGraphNodeData>[] {\n const paths = new Set(\n files.flatMap((file) => ancestorModulePaths(modulePathForFile(packageContext.rootPath, file))),\n );\n return [...paths]\n .sort()\n .filter((modulePath) => modulePath !== '')\n .map((modulePath) => ({\n id: `${packageContext.nodeId}#${modulePath}`,\n data: {\n kind: 'module',\n classification: 'intrinsic',\n focus: true,\n label: modulePath.split('.').at(-1) ?? modulePath,\n projectId: packageContext.projectId,\n ...(packageContext.name === undefined ? {} : { packageName: packageContext.name }),\n path: modulePath,\n parentPath: modulePath.includes('.') ? modulePath.split('.').slice(0, -1).join('.') : '',\n },\n }));\n}\n\n/*** Expand a module path into the hierarchy required for package-level graph projections. */\nfunction ancestorModulePaths(modulePath: string): readonly string[] {\n if (modulePath === '') return [''];\n const segments = modulePath.split('.');\n return segments.map((_, index) => segments.slice(0, index + 1).join('.'));\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractTypeScriptImports.d.ts","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAO7F"}
|
package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
2
|
-
/*** Extract static import module specifiers from TypeScript source text. */
|
|
3
|
-
export function extractTypeScriptImports(filePath, content) {
|
|
4
|
-
const source = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
5
|
-
return source.statements.flatMap((statement) => ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier)
|
|
6
|
-
? [statement.moduleSpecifier.text]
|
|
7
|
-
: []);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=extractTypeScriptImports.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractTypeScriptImports.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,4EAA4E;AAC5E,MAAM,UAAU,wBAAwB,CAAC,QAAgB,EAAE,OAAe;IACxE,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACpF,OAAO,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAC7C,EAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,eAAe,CAAC;QAChF,CAAC,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC;QAClC,CAAC,CAAC,EAAE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import ts from 'typescript';\n\n/*** Extract static import module specifiers from TypeScript source text. */\nexport function extractTypeScriptImports(filePath: string, content: string): readonly string[] {\n const source = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n return source.statements.flatMap((statement) =>\n ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier)\n ? [statement.moduleSpecifier.text]\n : [],\n );\n}\n"]}
|
package/dist/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modulePathForFile.d.ts","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.ts"],"names":[],"mappings":"AAIA,oEAAoE;AACpE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGxE"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { toPortablePath } from '@ankhorage/utility/node/path';
|
|
3
|
-
/*** Return the package-level dotted path owning one source file. */
|
|
4
|
-
export function modulePathForFile(rootPath, file) {
|
|
5
|
-
const relativeDirectory = toPortablePath(path.relative(rootPath, path.dirname(file)));
|
|
6
|
-
return relativeDirectory === '.' ? '' : relativeDirectory.split('/').join('.');
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=modulePathForFile.js.map
|
package/dist/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modulePathForFile.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,oEAAoE;AACpE,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,IAAY;IAC9D,MAAM,iBAAiB,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtF,OAAO,iBAAiB,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjF,CAAC","sourcesContent":["import path from 'node:path';\n\nimport { toPortablePath } from '@ankhorage/utility/node/path';\n\n/*** Return the package-level dotted path owning one source file. */\nexport function modulePathForFile(rootPath: string, file: string): string {\n const relativeDirectory = toPortablePath(path.relative(rootPath, path.dirname(file)));\n return relativeDirectory === '.' ? '' : relativeDirectory.split('/').join('.');\n}\n"]}
|
package/dist/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DependencyDeclaration, DependencyGraphPackage, DependencyReferenceClassification } from '../../../../../types/dependencyGraph.js';
|
|
2
|
-
export interface ResolvedTypeScriptImport {
|
|
3
|
-
readonly targetNodeId: string;
|
|
4
|
-
readonly classification: DependencyReferenceClassification;
|
|
5
|
-
readonly targetPath?: string;
|
|
6
|
-
readonly packageName?: string;
|
|
7
|
-
readonly declarations: readonly DependencyDeclaration[];
|
|
8
|
-
}
|
|
9
|
-
/*** Resolve one TypeScript import to an intrinsic module, focus package, vendor or unknown node. */
|
|
10
|
-
export declare function resolveTypeScriptImport(packageContext: DependencyGraphPackage, sourceFile: string, specifier: string, sourceFiles: ReadonlySet<string>, focusPackages: ReadonlyMap<string, string>): ResolvedTypeScriptImport;
|
|
11
|
-
//# sourceMappingURL=resolveTypeScriptImport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveTypeScriptImport.d.ts","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACtB,iCAAiC,EAClC,MAAM,yCAAyC,CAAC;AAEjD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,iCAAiC,CAAC;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACzD;AAED,oGAAoG;AACpG,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,sBAAsB,EACtC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,wBAAwB,CA0C1B"}
|
package/dist/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { toPortablePath } from '@ankhorage/utility/node/path';
|
|
3
|
-
/*** Resolve one TypeScript import to an intrinsic module, focus package, vendor or unknown node. */
|
|
4
|
-
export function resolveTypeScriptImport(packageContext, sourceFile, specifier, sourceFiles, focusPackages) {
|
|
5
|
-
if (specifier.startsWith('./') || specifier.startsWith('../')) {
|
|
6
|
-
return resolveIntrinsic(packageContext, path.resolve(path.dirname(sourceFile), specifier), sourceFiles);
|
|
7
|
-
}
|
|
8
|
-
if (specifier.startsWith('@/')) {
|
|
9
|
-
return resolveIntrinsic(packageContext, path.resolve(packageContext.rootPath, 'src', specifier.slice(2)), sourceFiles);
|
|
10
|
-
}
|
|
11
|
-
const packageName = barePackageName(specifier);
|
|
12
|
-
if (packageName !== undefined) {
|
|
13
|
-
const focusNodeId = focusPackages.get(packageName);
|
|
14
|
-
if (focusNodeId !== undefined) {
|
|
15
|
-
return {
|
|
16
|
-
targetNodeId: focusNodeId,
|
|
17
|
-
classification: 'focus',
|
|
18
|
-
packageName,
|
|
19
|
-
declarations: declarationsFor(packageContext.declarations, packageName),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const declarations = declarationsFor(packageContext.declarations, packageName);
|
|
23
|
-
return {
|
|
24
|
-
targetNodeId: declarations.length > 0 ? `vendor:${packageName}` : `unknown:${packageName}`,
|
|
25
|
-
classification: declarations.length > 0 ? 'vendor' : 'unknown',
|
|
26
|
-
packageName,
|
|
27
|
-
declarations,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
targetNodeId: `unknown:${specifier}`,
|
|
32
|
-
classification: 'unknown',
|
|
33
|
-
declarations: [],
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
/*** Resolve a source-like path to the containing intrinsic package module. */
|
|
37
|
-
function resolveIntrinsic(packageContext, unresolvedPath, sourceFiles) {
|
|
38
|
-
const targetFile = sourceCandidates(unresolvedPath).find((candidate) => sourceFiles.has(candidate));
|
|
39
|
-
const target = targetFile ?? unresolvedPath;
|
|
40
|
-
const relative = toPortablePath(path.relative(packageContext.rootPath, target));
|
|
41
|
-
if (relative === '..' || relative.startsWith('../')) {
|
|
42
|
-
return {
|
|
43
|
-
targetNodeId: `unknown:${relative}`,
|
|
44
|
-
classification: 'unknown',
|
|
45
|
-
declarations: [],
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
const modulePath = toPortablePath(path.dirname(relative));
|
|
49
|
-
const normalizedPath = modulePath === '.' ? '' : modulePath.split('/').join('.');
|
|
50
|
-
return {
|
|
51
|
-
targetNodeId: normalizedPath === '' ? packageContext.nodeId : `${packageContext.nodeId}#${normalizedPath}`,
|
|
52
|
-
classification: 'intrinsic',
|
|
53
|
-
targetPath: normalizedPath,
|
|
54
|
-
declarations: [],
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/*** Read dependency declarations without dynamic object-key access. */
|
|
58
|
-
function declarationsFor(declarations, packageName) {
|
|
59
|
-
const entry = Object.entries(declarations).find(([name]) => name === packageName);
|
|
60
|
-
return entry === undefined ? [] : entry[1];
|
|
61
|
-
}
|
|
62
|
-
/*** Generate deterministic TypeScript module resolution candidates without executing project config. */
|
|
63
|
-
function sourceCandidates(base) {
|
|
64
|
-
const extensions = ['.ts', '.tsx', '.mts', '.cts'];
|
|
65
|
-
return [
|
|
66
|
-
base,
|
|
67
|
-
...extensions.map((extension) => `${base}${extension}`),
|
|
68
|
-
...extensions.map((extension) => path.join(base, `index${extension}`)),
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
/*** Extract the npm package identity from a bare module specifier. */
|
|
72
|
-
function barePackageName(specifier) {
|
|
73
|
-
if (specifier === '' ||
|
|
74
|
-
specifier.startsWith('#') ||
|
|
75
|
-
specifier.startsWith('/') ||
|
|
76
|
-
specifier.startsWith('~')) {
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
const segments = specifier.split('/');
|
|
80
|
-
if (specifier.startsWith('@')) {
|
|
81
|
-
return segments.length >= 2 ? `${segments[0]}/${segments[1]}` : undefined;
|
|
82
|
-
}
|
|
83
|
-
return segments[0];
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=resolveTypeScriptImport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveTypeScriptImport.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAgB9D,oGAAoG;AACpG,MAAM,UAAU,uBAAuB,CACrC,cAAsC,EACtC,UAAkB,EAClB,SAAiB,EACjB,WAAgC,EAChC,aAA0C;IAE1C,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,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CAAC","sourcesContent":["import path from 'node:path';\n\nimport { toPortablePath } from '@ankhorage/utility/node/path';\n\nimport type {\n DependencyDeclaration,\n DependencyGraphPackage,\n DependencyReferenceClassification,\n} from '../../../../../types/dependencyGraph.js';\n\nexport interface ResolvedTypeScriptImport {\n readonly targetNodeId: string;\n readonly classification: DependencyReferenceClassification;\n readonly targetPath?: string;\n readonly packageName?: string;\n readonly declarations: readonly DependencyDeclaration[];\n}\n\n/*** Resolve one TypeScript import to an intrinsic module, focus package, vendor or unknown node. */\nexport function resolveTypeScriptImport(\n packageContext: DependencyGraphPackage,\n sourceFile: string,\n specifier: string,\n sourceFiles: ReadonlySet<string>,\n focusPackages: ReadonlyMap<string, string>,\n): ResolvedTypeScriptImport {\n if (specifier.startsWith('./') || specifier.startsWith('../')) {\n return resolveIntrinsic(\n packageContext,\n path.resolve(path.dirname(sourceFile), specifier),\n sourceFiles,\n );\n }\n if (specifier.startsWith('@/')) {\n return resolveIntrinsic(\n packageContext,\n path.resolve(packageContext.rootPath, 'src', specifier.slice(2)),\n sourceFiles,\n );\n }\n\n const packageName = barePackageName(specifier);\n if (packageName !== undefined) {\n const focusNodeId = focusPackages.get(packageName);\n if (focusNodeId !== undefined) {\n return {\n targetNodeId: focusNodeId,\n classification: 'focus',\n packageName,\n declarations: declarationsFor(packageContext.declarations, packageName),\n };\n }\n\n const declarations = declarationsFor(packageContext.declarations, packageName);\n return {\n targetNodeId: declarations.length > 0 ? `vendor:${packageName}` : `unknown:${packageName}`,\n classification: declarations.length > 0 ? 'vendor' : 'unknown',\n packageName,\n declarations,\n };\n }\n\n return {\n targetNodeId: `unknown:${specifier}`,\n classification: 'unknown',\n declarations: [],\n };\n}\n\n/*** Resolve a source-like path to the containing intrinsic package module. */\nfunction resolveIntrinsic(\n packageContext: DependencyGraphPackage,\n unresolvedPath: string,\n sourceFiles: ReadonlySet<string>,\n): ResolvedTypeScriptImport {\n const targetFile = sourceCandidates(unresolvedPath).find((candidate) =>\n sourceFiles.has(candidate),\n );\n const target = targetFile ?? unresolvedPath;\n const relative = toPortablePath(path.relative(packageContext.rootPath, target));\n if (relative === '..' || relative.startsWith('../')) {\n return {\n targetNodeId: `unknown:${relative}`,\n classification: 'unknown',\n declarations: [],\n };\n }\n\n const modulePath = toPortablePath(path.dirname(relative));\n const normalizedPath = modulePath === '.' ? '' : modulePath.split('/').join('.');\n return {\n targetNodeId:\n normalizedPath === '' ? packageContext.nodeId : `${packageContext.nodeId}#${normalizedPath}`,\n classification: 'intrinsic',\n targetPath: normalizedPath,\n declarations: [],\n };\n}\n\n/*** Read dependency declarations without dynamic object-key access. */\nfunction declarationsFor(\n declarations: Readonly<Record<string, readonly DependencyDeclaration[]>>,\n packageName: string,\n): readonly DependencyDeclaration[] {\n const entry = Object.entries(declarations).find(([name]) => name === packageName);\n return entry === undefined ? [] : entry[1];\n}\n\n/*** Generate deterministic TypeScript module resolution candidates without executing project config. */\nfunction sourceCandidates(base: string): readonly string[] {\n const extensions = ['.ts', '.tsx', '.mts', '.cts'];\n return [\n base,\n ...extensions.map((extension) => `${base}${extension}`),\n ...extensions.map((extension) => path.join(base, `index${extension}`)),\n ];\n}\n\n/*** Extract the npm package identity from a bare module specifier. */\nfunction barePackageName(specifier: string): string | undefined {\n if (\n specifier === '' ||\n specifier.startsWith('#') ||\n specifier.startsWith('/') ||\n specifier.startsWith('~')\n ) {\n return undefined;\n }\n\n const segments = specifier.split('/');\n if (specifier.startsWith('@')) {\n return segments.length >= 2 ? `${segments[0]}/${segments[1]}` : undefined;\n }\n return segments[0];\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { DependencyGraphAnalyzer } from '../../../../../types/dependencyGraph.js';
|
|
2
|
-
/*** TypeScript analyzer adapter selected from project-detector language evidence. */
|
|
3
|
-
export declare const typescriptDependencyGraphAnalyzer: DependencyGraphAnalyzer;
|
|
4
|
-
//# sourceMappingURL=typescriptDependencyGraphAnalyzer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescriptDependencyGraphAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAGvF,qFAAqF;AACrF,eAAO,MAAM,iCAAiC,EAAE,uBAI/C,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { analyzeTypeScriptProjectAsync } from './analyzeTypeScriptProjectAsync.js';
|
|
2
|
-
/*** TypeScript analyzer adapter selected from project-detector language evidence. */
|
|
3
|
-
export const typescriptDependencyGraphAnalyzer = {
|
|
4
|
-
id: 'typescript',
|
|
5
|
-
supports: (detection) => detection.languages.some(({ id }) => id === 'typescript'),
|
|
6
|
-
analyzeAsync: analyzeTypeScriptProjectAsync,
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=typescriptDependencyGraphAnalyzer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescriptDependencyGraphAnalyzer.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF,qFAAqF;AACrF,MAAM,CAAC,MAAM,iCAAiC,GAA4B;IACxE,EAAE,EAAE,YAAY;IAChB,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,YAAY,CAAC;IAClF,YAAY,EAAE,6BAA6B;CAC5C,CAAC","sourcesContent":["import type { DependencyGraphAnalyzer } from '../../../../../types/dependencyGraph.js';\nimport { analyzeTypeScriptProjectAsync } from './analyzeTypeScriptProjectAsync.js';\n\n/*** TypeScript analyzer adapter selected from project-detector language evidence. */\nexport const typescriptDependencyGraphAnalyzer: DependencyGraphAnalyzer = {\n id: 'typescript',\n supports: (detection) => detection.languages.some(({ id }) => id === 'typescript'),\n analyzeAsync: analyzeTypeScriptProjectAsync,\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDependencyGraphAsync.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/createDependencyGraphAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAMvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,yCAAyC,EAAE,MAAM,gDAAgD,CAAC;AAE3G,oGAAoG;AACpG,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,KAAiC;IAEjC,+BAA+B,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QACrC,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,UAAU,EAAE,MAAM,mBAAmB,CAAC,OAAO,CAAC,QAAQ,EAAE;YACtD,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;SAChE,CAAC;KACH,CAAC,CAAC,CACJ,CAAC;IAEF,OAAO,yCAAyC,CAAC;QAC/C,QAAQ;QACR,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;QACxE,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;KAChE,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { inspectProjectAsync } from '@ankhorage/project-detector/node';\n\nimport type {\n CreateDependencyGraphInput,\n DependencyGraph,\n} from '../../../types/dependencyGraph.js';\nimport { assertDependencyGraphProjectIds } from './assertDependencyGraphProjectIds.js';\nimport { createDependencyGraphFromInspectionsAsync } from './createDependencyGraphFromInspectionsAsync.js';\n\n/*** Inspect project roots, then delegate dependency topology construction to the inspection API. */\nexport async function createDependencyGraphAsync(\n input: CreateDependencyGraphInput,\n): Promise<DependencyGraph> {\n assertDependencyGraphProjectIds(input.projects);\n const projects = await Promise.all(\n input.projects.map(async (project) => ({\n id: project.id,\n inspection: await inspectProjectAsync(project.rootPath, {\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n }),\n })),\n );\n\n return createDependencyGraphFromInspectionsAsync({\n projects,\n ...(input.analyzers === undefined ? {} : { analyzers: input.analyzers }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDependencyGraphFromInspectionsAsync.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,yCAAyC,EACzC,eAAe,EAKhB,MAAM,mCAAmC,CAAC;AAW3C;;GAEG;AACH,wBAAsB,yCAAyC,CAC7D,KAAK,EAAE,yCAAyC,GAC/C,OAAO,CAAC,eAAe,CAAC,CA2B1B"}
|