homegraph 1.5.6 → 1.5.7
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 +32 -0
- package/README.md +10 -4
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +120 -15
- package/dist/context/index.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +25 -3
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +184 -22
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/mcp/evidence-rendering.d.ts +10 -0
- package/dist/mcp/evidence-rendering.d.ts.map +1 -0
- package/dist/mcp/evidence-rendering.js +71 -0
- package/dist/mcp/evidence-rendering.js.map +1 -0
- package/dist/mcp/explore-repeat-guard.d.ts +8 -13
- package/dist/mcp/explore-repeat-guard.d.ts.map +1 -1
- package/dist/mcp/explore-repeat-guard.js +54 -114
- package/dist/mcp/explore-repeat-guard.js.map +1 -1
- package/dist/mcp/explore-session-state.d.ts +26 -4
- package/dist/mcp/explore-session-state.d.ts.map +1 -1
- package/dist/mcp/explore-session-state.js +50 -4
- package/dist/mcp/explore-session-state.js.map +1 -1
- package/dist/mcp/query-cache.d.ts +1 -1
- package/dist/mcp/query-cache.d.ts.map +1 -1
- package/dist/mcp/query-cache.js +86 -3
- package/dist/mcp/query-cache.js.map +1 -1
- package/dist/mcp/server-instructions.d.ts +2 -2
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +34 -21
- package/dist/mcp/server-instructions.js.map +1 -1
- package/dist/mcp/tools.d.ts +19 -3
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +690 -107
- package/dist/mcp/tools.js.map +1 -1
- package/dist/search/literal-evidence.d.ts +44 -0
- package/dist/search/literal-evidence.d.ts.map +1 -0
- package/dist/search/literal-evidence.js +278 -0
- package/dist/search/literal-evidence.js.map +1 -0
- package/dist/search/query-plan-provider.d.ts +6 -0
- package/dist/search/query-plan-provider.d.ts.map +1 -0
- package/dist/search/query-plan-provider.js +289 -0
- package/dist/search/query-plan-provider.js.map +1 -0
- package/dist/search/query-plan.d.ts +98 -0
- package/dist/search/query-plan.d.ts.map +1 -0
- package/dist/search/query-plan.js +334 -0
- package/dist/search/query-plan.js.map +1 -0
- package/dist/search/query-utils.d.ts +6 -1
- package/dist/search/query-utils.d.ts.map +1 -1
- package/dist/search/query-utils.js +64 -5
- package/dist/search/query-utils.js.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arkts.d.ts","sourceRoot":"","sources":["../../../src/extraction/languages/arkts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAQH,OAAO,EAIL,QAAQ,EACR,OAAO,EACP,SAAS,EAiBT,cAAc,EACd,eAAe,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAA0B,YAAY,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAEL,eAAe,EACf,gBAAgB,
|
|
1
|
+
{"version":3,"file":"arkts.d.ts","sourceRoot":"","sources":["../../../src/extraction/languages/arkts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAQH,OAAO,EAIL,QAAQ,EACR,OAAO,EACP,SAAS,EAiBT,cAAc,EACd,eAAe,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAA0B,YAAY,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAEL,eAAe,EACf,gBAAgB,EAEhB,QAAQ,EAGT,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMrD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAiC3D,+FAA+F;AAC/F,wBAAgB,kBA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C,CAiHrD;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,YAAY,EACrB,SAAS,CAAC,EAAE,MAAM,EAAE,GACnB,gBAAgB,GAAG,uBAAuB,GAAG,IAAI,CAenD;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,YAAY,EACrB,SAAS,CAAC,EAAE,MAAM,EAAE,EACpB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,gBAAgB,GAAG,uBAAuB,GAAG,IAAI,CAAC,CAkB5D;AAED,uEAAuE;AACvE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,gBAAgB,GAAG,IAAI,CAerF"}
|
|
@@ -69,8 +69,12 @@ exports.buildArkMethodSignatureFields = buildArkMethodSignatureFields;
|
|
|
69
69
|
exports.shouldUseIsolatedArkTSBuild = shouldUseIsolatedArkTSBuild;
|
|
70
70
|
exports.normalizeHarmonyModuleSrcPath = normalizeHarmonyModuleSrcPath;
|
|
71
71
|
exports.listHarmonyProjectModules = listHarmonyProjectModules;
|
|
72
|
+
exports.findSyntheticArkModuleRoot = findSyntheticArkModuleRoot;
|
|
73
|
+
exports.listOrphanArkAnalyzerSources = listOrphanArkAnalyzerSources;
|
|
74
|
+
exports.listSyntheticArkModuleRoots = listSyntheticArkModuleRoots;
|
|
72
75
|
exports.resolveDirtyHarmonyModules = resolveDirtyHarmonyModules;
|
|
73
76
|
exports.isArkAnalyzerSourcePath = isArkAnalyzerSourcePath;
|
|
77
|
+
exports.languageForArkAnalyzerPath = languageForArkAnalyzerPath;
|
|
74
78
|
exports.scanEtsFiles = scanEtsFiles;
|
|
75
79
|
exports.runIsolatedArkTSBatchEntry = runIsolatedArkTSBatchEntry;
|
|
76
80
|
exports.primeArkTSBatch = primeArkTSBatch;
|
|
@@ -353,6 +357,121 @@ function listHarmonyProjectModules(rootDir) {
|
|
|
353
357
|
}
|
|
354
358
|
return out;
|
|
355
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* Absolute path for ArkAnalyzer module registration (realpath when available).
|
|
362
|
+
* Must match how incremental target matching resolves `srcPath`.
|
|
363
|
+
*/
|
|
364
|
+
function resolveArkModuleAbsPath(rootDir, relSrcPath) {
|
|
365
|
+
const resolved = path.resolve(rootDir, relSrcPath);
|
|
366
|
+
try {
|
|
367
|
+
return fs.realpathSync(resolved);
|
|
368
|
+
}
|
|
369
|
+
catch {
|
|
370
|
+
return resolved;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Nearest package-like directory for an orphan Ark source, or the first path
|
|
375
|
+
* segment. Never returns the project root (registering `.` would re-scan every
|
|
376
|
+
* Harmony module). Lone files directly under the root return null.
|
|
377
|
+
*/
|
|
378
|
+
function findSyntheticArkModuleRoot(rootDir, relFile) {
|
|
379
|
+
const file = normIndexPath(relFile);
|
|
380
|
+
if (!file || file.startsWith('@'))
|
|
381
|
+
return null;
|
|
382
|
+
let dir = path.posix.dirname(file);
|
|
383
|
+
if (dir === '.' || dir === '')
|
|
384
|
+
return null;
|
|
385
|
+
const rootAbs = path.resolve(rootDir);
|
|
386
|
+
let curAbs = path.resolve(rootDir, dir);
|
|
387
|
+
for (;;) {
|
|
388
|
+
const relFromRoot = path.relative(rootAbs, curAbs);
|
|
389
|
+
if (!relFromRoot || relFromRoot.startsWith('..') || path.isAbsolute(relFromRoot))
|
|
390
|
+
break;
|
|
391
|
+
const rel = relFromRoot.replace(/\\/g, '/');
|
|
392
|
+
if (fs.existsSync(path.join(curAbs, 'package.json')) ||
|
|
393
|
+
fs.existsSync(path.join(curAbs, 'oh-package.json5'))) {
|
|
394
|
+
return normalizeHarmonyModuleSrcPath(rel);
|
|
395
|
+
}
|
|
396
|
+
const parent = path.dirname(curAbs);
|
|
397
|
+
if (parent === curAbs)
|
|
398
|
+
break;
|
|
399
|
+
curAbs = parent;
|
|
400
|
+
}
|
|
401
|
+
const first = file.split('/')[0];
|
|
402
|
+
if (!first || first === file)
|
|
403
|
+
return null;
|
|
404
|
+
return normalizeHarmonyModuleSrcPath(first);
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* ArkAnalyzer sources under `scannedFiles` that are not inside any
|
|
408
|
+
* build-profile PROJECT module `srcPath`.
|
|
409
|
+
*/
|
|
410
|
+
function listOrphanArkAnalyzerSources(scannedFiles, harmonyModules) {
|
|
411
|
+
const orphans = [];
|
|
412
|
+
for (const raw of scannedFiles) {
|
|
413
|
+
const f = normIndexPath(raw);
|
|
414
|
+
if (!f || !isArkAnalyzerSourcePath(f) || f.startsWith('@'))
|
|
415
|
+
continue;
|
|
416
|
+
if (findLongestHarmonyModule(f, harmonyModules))
|
|
417
|
+
continue;
|
|
418
|
+
orphans.push(f);
|
|
419
|
+
}
|
|
420
|
+
orphans.sort();
|
|
421
|
+
return orphans;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Cluster orphan `.ets`/`.ts`/`.d.ts` into synthetic PROJECT module roots
|
|
425
|
+
* (e.g. `HMRouterPlugin` for a Node hvigor plugin living beside HAP modules).
|
|
426
|
+
*/
|
|
427
|
+
function listSyntheticArkModuleRoots(rootDir, scannedFiles, harmonyModules) {
|
|
428
|
+
const modules = harmonyModules ?? listHarmonyProjectModules(rootDir);
|
|
429
|
+
const orphans = listOrphanArkAnalyzerSources(scannedFiles, modules);
|
|
430
|
+
const bySrc = new Map();
|
|
431
|
+
for (const f of orphans) {
|
|
432
|
+
const srcPath = findSyntheticArkModuleRoot(rootDir, f);
|
|
433
|
+
if (!srcPath)
|
|
434
|
+
continue;
|
|
435
|
+
// Never shadow a real Harmony module path.
|
|
436
|
+
if (modules.some((m) => m.srcPath === srcPath))
|
|
437
|
+
continue;
|
|
438
|
+
if (bySrc.has(srcPath))
|
|
439
|
+
continue;
|
|
440
|
+
const abs = path.resolve(rootDir, srcPath);
|
|
441
|
+
if (!fs.existsSync(abs) || !fs.statSync(abs).isDirectory())
|
|
442
|
+
continue;
|
|
443
|
+
bySrc.set(srcPath, {
|
|
444
|
+
name: `synthetic:${path.basename(srcPath)}`,
|
|
445
|
+
srcPath,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
return [...bySrc.values()].sort((a, b) => a.srcPath.localeCompare(b.srcPath));
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Register orphan trees as PROJECT modules before dependency analysis so they
|
|
452
|
+
* enter `analyseByModule` topo order. No `oh-package.json5` → empty dep edges
|
|
453
|
+
* (npm-only deps stay unresolved); that is expected for Node plugins.
|
|
454
|
+
*/
|
|
455
|
+
function registerSyntheticArkModules(builder, rootDir, scannedFiles, harmonyModules) {
|
|
456
|
+
const synthetics = listSyntheticArkModuleRoots(rootDir, scannedFiles, harmonyModules);
|
|
457
|
+
for (const syn of synthetics) {
|
|
458
|
+
const abs = resolveArkModuleAbsPath(rootDir, syn.srcPath);
|
|
459
|
+
builder.registerModule(abs, syn.name);
|
|
460
|
+
}
|
|
461
|
+
return synthetics;
|
|
462
|
+
}
|
|
463
|
+
/** Prep PROJECT + oh_modules, inject synthetic orphan modules, then build the dep graph. */
|
|
464
|
+
function prepareArkModulesWithSynthetics(scene, rootDir, scannedFiles) {
|
|
465
|
+
if (scene.isModulesRegistered())
|
|
466
|
+
return [];
|
|
467
|
+
const builder = new arkanalyzer_1.ModuleBuilder(scene);
|
|
468
|
+
builder.prepareModules();
|
|
469
|
+
const harmonyModules = listHarmonyProjectModules(rootDir);
|
|
470
|
+
const synthetics = registerSyntheticArkModules(builder, rootDir, scannedFiles, harmonyModules);
|
|
471
|
+
builder.analyzeModuleDependencies();
|
|
472
|
+
scene.setModulesRegistered(true);
|
|
473
|
+
return synthetics;
|
|
474
|
+
}
|
|
356
475
|
function findLongestHarmonyModule(fileRel, modules) {
|
|
357
476
|
const file = normIndexPath(fileRel);
|
|
358
477
|
let best = null;
|
|
@@ -367,8 +486,9 @@ function findLongestHarmonyModule(fileRel, modules) {
|
|
|
367
486
|
}
|
|
368
487
|
/**
|
|
369
488
|
* Map changed/removed paths to Harmony modules for incremental ArkTS sync.
|
|
370
|
-
* Structural project files (`build-profile.json5`, root `oh-package.json5`)
|
|
371
|
-
*
|
|
489
|
+
* Structural project files (`build-profile.json5`, root `oh-package.json5`)
|
|
490
|
+
* force a full rebuild. Orphan trees covered by synthetic PROJECT modules
|
|
491
|
+
* (e.g. `HMRouterPlugin`) map to those module srcPaths instead of full rebuild.
|
|
372
492
|
*/
|
|
373
493
|
function resolveDirtyHarmonyModules(rootDir, changedFiles) {
|
|
374
494
|
if (!shouldUseModularArkTSBuild(rootDir)) {
|
|
@@ -389,17 +509,22 @@ function resolveDirtyHarmonyModules(rootDir, changedFiles) {
|
|
|
389
509
|
return { mode: 'full', reason: 'root oh-package.json5 changed' };
|
|
390
510
|
}
|
|
391
511
|
}
|
|
512
|
+
// Synthetic roots for orphans among the changed set (cheap; no full scan).
|
|
513
|
+
const synthetics = listSyntheticArkModuleRoots(rootDir, changed, modules);
|
|
514
|
+
const allModules = [...modules, ...synthetics];
|
|
392
515
|
const dirty = new Set();
|
|
393
516
|
const unmatched = [];
|
|
394
517
|
for (const f of changed) {
|
|
395
518
|
// Virtual ArkAnalyzer paths are batch artifacts, not Harmony module sources.
|
|
396
519
|
if (f.startsWith('@'))
|
|
397
520
|
continue;
|
|
398
|
-
const isModuleMeta = f.endsWith('/module.json5') ||
|
|
521
|
+
const isModuleMeta = f.endsWith('/module.json5') ||
|
|
522
|
+
f.endsWith('/oh-package.json5') ||
|
|
523
|
+
f.endsWith('/package.json');
|
|
399
524
|
const isArkSrc = isArkAnalyzerSourcePath(f);
|
|
400
525
|
if (!isArkSrc && !isModuleMeta)
|
|
401
526
|
continue;
|
|
402
|
-
const match = findLongestHarmonyModule(f,
|
|
527
|
+
const match = findLongestHarmonyModule(f, allModules);
|
|
403
528
|
if (match)
|
|
404
529
|
dirty.add(match.srcPath);
|
|
405
530
|
else if (isArkSrc)
|
|
@@ -430,6 +555,21 @@ function isArkAnalyzerSourcePath(filePath) {
|
|
|
430
555
|
// `.d.ts` ends with `.ts` (Node extname) — one `.ts` suffix covers both.
|
|
431
556
|
return base.endsWith('.ets') || base.endsWith('.ts');
|
|
432
557
|
}
|
|
558
|
+
/**
|
|
559
|
+
* Graph `language` tag for an ArkAnalyzer-indexed path. Extraction still uses AA;
|
|
560
|
+
* the tag must match the source kind so status / language filters stay truthful.
|
|
561
|
+
*/
|
|
562
|
+
function languageForArkAnalyzerPath(filePath) {
|
|
563
|
+
const base = path.basename(filePath).toLowerCase();
|
|
564
|
+
if (base.endsWith('.d.ets') || base.endsWith('.ets'))
|
|
565
|
+
return 'arkts';
|
|
566
|
+
if (base.endsWith('.d.ts') || base.endsWith('.ts') || base.endsWith('.mts') || base.endsWith('.cts')) {
|
|
567
|
+
return 'typescript';
|
|
568
|
+
}
|
|
569
|
+
if (base.endsWith('.js') || base.endsWith('.mjs') || base.endsWith('.cjs'))
|
|
570
|
+
return 'javascript';
|
|
571
|
+
return 'arkts';
|
|
572
|
+
}
|
|
433
573
|
function isEtsFileName(name) {
|
|
434
574
|
return name.endsWith('.ets');
|
|
435
575
|
}
|
|
@@ -634,7 +774,7 @@ function persistFileResult(queries, filePath, content, stats, result, options) {
|
|
|
634
774
|
.map((ref) => ({
|
|
635
775
|
...ref,
|
|
636
776
|
filePath: ref.filePath ?? filePath,
|
|
637
|
-
language: ref.language ??
|
|
777
|
+
language: ref.language ?? languageForArkAnalyzerPath(filePath),
|
|
638
778
|
}));
|
|
639
779
|
if (refsWithContext.length > 0) {
|
|
640
780
|
queries.insertUnresolvedRefsBatch(refsWithContext);
|
|
@@ -643,7 +783,7 @@ function persistFileResult(queries, filePath, content, stats, result, options) {
|
|
|
643
783
|
const fileRecord = {
|
|
644
784
|
path: filePath,
|
|
645
785
|
contentHash,
|
|
646
|
-
language:
|
|
786
|
+
language: languageForArkAnalyzerPath(filePath),
|
|
647
787
|
size: stats.size,
|
|
648
788
|
modifiedAt: stats.mtimeMs,
|
|
649
789
|
indexedAt: Date.now(),
|
|
@@ -1197,12 +1337,27 @@ class ArkTSExtractor {
|
|
|
1197
1337
|
}
|
|
1198
1338
|
}
|
|
1199
1339
|
exports.ArkTSExtractor = ArkTSExtractor;
|
|
1340
|
+
/** ArkAnalyzer {@link ClassCategory} (not re-exported from the npm entry). */
|
|
1200
1341
|
const CLASS_CATEGORY = {
|
|
1201
1342
|
CLASS: 0,
|
|
1202
1343
|
STRUCT: 1,
|
|
1203
1344
|
INTERFACE: 2,
|
|
1204
1345
|
ENUM: 3,
|
|
1346
|
+
TYPE_LITERAL: 4,
|
|
1347
|
+
OBJECT: 5,
|
|
1348
|
+
/** C++ frontend only; never map to HomeGraph `class`. */
|
|
1349
|
+
UNION: 6,
|
|
1205
1350
|
};
|
|
1351
|
+
/**
|
|
1352
|
+
* IR shapes that are `ArkClass` in ArkAnalyzer but are not declaration-level
|
|
1353
|
+
* types in HomeGraph's symbol graph. Indexing them as `class` inflates
|
|
1354
|
+
* `graph_class` and orphans them under the file node.
|
|
1355
|
+
*/
|
|
1356
|
+
function isNonDeclarationArkClassCategory(category) {
|
|
1357
|
+
return (category === CLASS_CATEGORY.TYPE_LITERAL ||
|
|
1358
|
+
category === CLASS_CATEGORY.OBJECT ||
|
|
1359
|
+
category === CLASS_CATEGORY.UNION);
|
|
1360
|
+
}
|
|
1206
1361
|
/** ArkAnalyzer {@link FieldCategory} values (not re-exported from the npm entry). */
|
|
1207
1362
|
const FIELD_CATEGORY = {
|
|
1208
1363
|
PROPERTY_DECLARATION: 0,
|
|
@@ -1382,7 +1537,10 @@ function classNodeKind(cls) {
|
|
|
1382
1537
|
return 'enum';
|
|
1383
1538
|
case CLASS_CATEGORY.STRUCT:
|
|
1384
1539
|
return 'struct';
|
|
1540
|
+
case CLASS_CATEGORY.CLASS:
|
|
1541
|
+
return 'class';
|
|
1385
1542
|
default:
|
|
1543
|
+
// TYPE_LITERAL / OBJECT / UNION must be filtered before indexClass.
|
|
1386
1544
|
return 'class';
|
|
1387
1545
|
}
|
|
1388
1546
|
}
|
|
@@ -3048,7 +3206,7 @@ class ArkTSAdapter {
|
|
|
3048
3206
|
let result = this.fileResults.get(relativePath);
|
|
3049
3207
|
if (!result) {
|
|
3050
3208
|
result = {
|
|
3051
|
-
nodes: [makeFileNode(relativePath,
|
|
3209
|
+
nodes: [makeFileNode(relativePath, languageForArkAnalyzerPath(relativePath), lineCount)],
|
|
3052
3210
|
edges: [],
|
|
3053
3211
|
unresolvedReferences: [],
|
|
3054
3212
|
errors: [],
|
|
@@ -3067,7 +3225,7 @@ class ArkTSAdapter {
|
|
|
3067
3225
|
}
|
|
3068
3226
|
indexFile(arkFile) {
|
|
3069
3227
|
const relativePath = this.normalizeRelPath(arkFile.getFilePath());
|
|
3070
|
-
const language =
|
|
3228
|
+
const language = languageForArkAnalyzerPath(relativePath);
|
|
3071
3229
|
let lineCount = 1;
|
|
3072
3230
|
try {
|
|
3073
3231
|
lineCount = arkFile.getCode()?.split('\n').length ?? 1;
|
|
@@ -3160,6 +3318,7 @@ class ArkTSAdapter {
|
|
|
3160
3318
|
const localNode = makeNode(relativePath, language, kind, name, qn, line, endLine, col, {
|
|
3161
3319
|
signature: local.getType()?.toString(),
|
|
3162
3320
|
...modelModifiersToNodeExtras(local),
|
|
3321
|
+
// Local's public TS surface doesn't declare getMetadata; runtime may still carry it.
|
|
3163
3322
|
...docstringExtras(local),
|
|
3164
3323
|
});
|
|
3165
3324
|
this.addNode(result, localNode);
|
|
@@ -3179,6 +3338,7 @@ class ArkTSAdapter {
|
|
|
3179
3338
|
const aliasNode = makeNode(relativePath, language, 'type_alias', name, qn, line, endLine, col, {
|
|
3180
3339
|
signature: aliasType.getOriginalType()?.toString(),
|
|
3181
3340
|
...modelModifiersToNodeExtras(aliasType),
|
|
3341
|
+
// AliasType's public TS surface doesn't declare getMetadata; runtime may still carry it.
|
|
3182
3342
|
...docstringExtras(aliasType),
|
|
3183
3343
|
});
|
|
3184
3344
|
this.addNode(result, aliasNode);
|
|
@@ -3232,6 +3392,10 @@ class ArkTSAdapter {
|
|
|
3232
3392
|
indexClass(relativePath, language, result, cls, parentId) {
|
|
3233
3393
|
if (cls.isDefaultArkClass())
|
|
3234
3394
|
return;
|
|
3395
|
+
// Object / type literals (and C++ unions) are ArkAnalyzer IR classes, not
|
|
3396
|
+
// HomeGraph declaration nodes — skip the shell and its nested fields.
|
|
3397
|
+
if (isNonDeclarationArkClassCategory(cls.getCategory()))
|
|
3398
|
+
return;
|
|
3235
3399
|
const displayName = classDisplayName(cls);
|
|
3236
3400
|
const qn = buildClassQualifiedName(cls);
|
|
3237
3401
|
const kind = classNodeKind(cls);
|
|
@@ -3581,7 +3745,7 @@ class ArkTSAdapter {
|
|
|
3581
3745
|
if (classId)
|
|
3582
3746
|
return classId;
|
|
3583
3747
|
const fileId = `file:${relativePath}`;
|
|
3584
|
-
this.indexClass(relativePath,
|
|
3748
|
+
this.indexClass(relativePath, languageForArkAnalyzerPath(relativePath), result, cls, fileId);
|
|
3585
3749
|
return this.resolveClassNodeId(cls) ?? fileId;
|
|
3586
3750
|
}
|
|
3587
3751
|
/**
|
|
@@ -3622,7 +3786,7 @@ class ArkTSAdapter {
|
|
|
3622
3786
|
const parentId = this.resolveMethodParentId(method, relativePath, result);
|
|
3623
3787
|
const cls = method.getDeclaringArkClass();
|
|
3624
3788
|
const kind = cls.isDefaultArkClass() ? 'function' : 'method';
|
|
3625
|
-
this.indexMethod(relativePath,
|
|
3789
|
+
this.indexMethod(relativePath, languageForArkAnalyzerPath(relativePath), result, method, parentId, kind, displayName);
|
|
3626
3790
|
return this.methodToId.get(method) ?? null;
|
|
3627
3791
|
}
|
|
3628
3792
|
addViewTreeEdge(result, source, target, kind, callerFile, via, line, extraMeta) {
|
|
@@ -3666,7 +3830,7 @@ class ArkTSAdapter {
|
|
|
3666
3830
|
return null;
|
|
3667
3831
|
const cls = method.getDeclaringArkClass();
|
|
3668
3832
|
const kind = cls.isDefaultArkClass() ? 'function' : 'method';
|
|
3669
|
-
this.indexMethod(relativePath,
|
|
3833
|
+
this.indexMethod(relativePath, languageForArkAnalyzerPath(relativePath), result, method, parentId, kind, displayName);
|
|
3670
3834
|
return this.methodToId.get(method) ?? null;
|
|
3671
3835
|
}
|
|
3672
3836
|
indexMethod(relativePath, language, result, method, parentId, forcedKind, forcedDisplayName) {
|
|
@@ -3871,23 +4035,21 @@ function buildArkTSIndexByModuleInner(rootDir, scannedFiles, options) {
|
|
|
3871
4035
|
};
|
|
3872
4036
|
try {
|
|
3873
4037
|
scene.config(sceneConfig);
|
|
4038
|
+
// Register build-profile modules + orphan trees (no oh-package) before the
|
|
4039
|
+
// dep graph is frozen — otherwise analyseByModule never sees HMRouterPlugin-style .ts.
|
|
4040
|
+
const synthetics = prepareArkModulesWithSynthetics(scene, rootDir, scannedList);
|
|
4041
|
+
if (synthetics.length > 0) {
|
|
4042
|
+
process.stderr.write(`\n\x1b[33m ArkTS: synthetic PROJECT modules (${synthetics.length}, no oh-package deps): ${synthetics
|
|
4043
|
+
.map((s) => s.srcPath)
|
|
4044
|
+
.join(', ')}...\x1b[0m\n`);
|
|
4045
|
+
}
|
|
3874
4046
|
const config = new arkanalyzer_1.ModuleAnalysisConfig();
|
|
3875
4047
|
config.setLoadLevel(arkanalyzer_1.ModuleDepthLevel.BODIES);
|
|
3876
4048
|
// SIGNATURES is enough for ViewTree stubs / types; BODIES on deps caused
|
|
3877
4049
|
// each module's RTA to re-walk shared library CFGs (multi-hour indexes).
|
|
3878
4050
|
config.setDependencyLoadLevel(arkanalyzer_1.ModuleDepthLevel.SIGNATURES);
|
|
3879
4051
|
if (targetSrcSet) {
|
|
3880
|
-
|
|
3881
|
-
scene.analyseByModule(() => { }, new arkanalyzer_1.ModuleAnalysisConfig());
|
|
3882
|
-
const wantAbs = new Set([...targetSrcSet].map((src) => {
|
|
3883
|
-
const resolved = path.resolve(rootDir, src);
|
|
3884
|
-
try {
|
|
3885
|
-
return fs.realpathSync(resolved).toLowerCase();
|
|
3886
|
-
}
|
|
3887
|
-
catch {
|
|
3888
|
-
return resolved.toLowerCase();
|
|
3889
|
-
}
|
|
3890
|
-
}));
|
|
4052
|
+
const wantAbs = new Set([...targetSrcSet].map((src) => resolveArkModuleAbsPath(rootDir, src).toLowerCase()));
|
|
3891
4053
|
const ids = [];
|
|
3892
4054
|
for (const mod of scene.getModules()) {
|
|
3893
4055
|
if (mod.getModuleType() !== arkanalyzer_1.ModuleType.PROJECT)
|