@component-compass/cli 0.1.25 → 0.1.26
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/dist/cli.js +720 -768
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -40398,7 +40398,7 @@ var require_pattern2 = __commonJS({
|
|
|
40398
40398
|
const absolute = [];
|
|
40399
40399
|
const relative7 = [];
|
|
40400
40400
|
for (const pattern of patterns) {
|
|
40401
|
-
if (
|
|
40401
|
+
if (isAbsolute14(pattern)) {
|
|
40402
40402
|
absolute.push(pattern);
|
|
40403
40403
|
} else {
|
|
40404
40404
|
relative7.push(pattern);
|
|
@@ -40407,10 +40407,10 @@ var require_pattern2 = __commonJS({
|
|
|
40407
40407
|
return [absolute, relative7];
|
|
40408
40408
|
}
|
|
40409
40409
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
40410
|
-
function
|
|
40410
|
+
function isAbsolute14(pattern) {
|
|
40411
40411
|
return path5.isAbsolute(pattern);
|
|
40412
40412
|
}
|
|
40413
|
-
exports.isAbsolute =
|
|
40413
|
+
exports.isAbsolute = isAbsolute14;
|
|
40414
40414
|
}
|
|
40415
40415
|
});
|
|
40416
40416
|
|
|
@@ -45430,7 +45430,7 @@ var init_auth = __esm({
|
|
|
45430
45430
|
|
|
45431
45431
|
// src/commands/scan.ts
|
|
45432
45432
|
import { performance as performance3 } from "node:perf_hooks";
|
|
45433
|
-
import { isAbsolute as
|
|
45433
|
+
import { isAbsolute as isAbsolute12, relative as relative6, resolve as resolve11 } from "node:path";
|
|
45434
45434
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
45435
45435
|
|
|
45436
45436
|
// src/config/loader.ts
|
|
@@ -67480,7 +67480,7 @@ function requireUtil$2() {
|
|
|
67480
67480
|
}
|
|
67481
67481
|
path5 = url.path;
|
|
67482
67482
|
}
|
|
67483
|
-
var
|
|
67483
|
+
var isAbsolute14 = exports$1.isAbsolute(path5);
|
|
67484
67484
|
var parts = [];
|
|
67485
67485
|
var start = 0;
|
|
67486
67486
|
var i2 = 0;
|
|
@@ -67515,7 +67515,7 @@ function requireUtil$2() {
|
|
|
67515
67515
|
}
|
|
67516
67516
|
path5 = parts.join("/");
|
|
67517
67517
|
if (path5 === "") {
|
|
67518
|
-
path5 =
|
|
67518
|
+
path5 = isAbsolute14 ? "/" : ".";
|
|
67519
67519
|
}
|
|
67520
67520
|
if (url) {
|
|
67521
67521
|
url.path = path5;
|
|
@@ -75347,9 +75347,9 @@ Url.prototype.resolveObject = function(relative7) {
|
|
|
75347
75347
|
if (hasTrailingSlash && srcPath.join("/").substr(-1) !== "/") {
|
|
75348
75348
|
srcPath.push("");
|
|
75349
75349
|
}
|
|
75350
|
-
var
|
|
75350
|
+
var isAbsolute14 = srcPath[0] === "" || srcPath[0] && srcPath[0].charAt(0) === "/";
|
|
75351
75351
|
if (psychotic) {
|
|
75352
|
-
result2.hostname = result2.host =
|
|
75352
|
+
result2.hostname = result2.host = isAbsolute14 ? "" : srcPath.length ? srcPath.shift() : "";
|
|
75353
75353
|
authInHost = result2.host && result2.host.indexOf("@") > 0 ? result2.host.split("@") : false;
|
|
75354
75354
|
if (authInHost) {
|
|
75355
75355
|
result2.auth = authInHost.shift();
|
|
@@ -75357,7 +75357,7 @@ Url.prototype.resolveObject = function(relative7) {
|
|
|
75357
75357
|
}
|
|
75358
75358
|
}
|
|
75359
75359
|
mustEndAbs = mustEndAbs || result2.host && srcPath.length;
|
|
75360
|
-
if (mustEndAbs && !
|
|
75360
|
+
if (mustEndAbs && !isAbsolute14) {
|
|
75361
75361
|
srcPath.unshift("");
|
|
75362
75362
|
}
|
|
75363
75363
|
if (!srcPath.length) {
|
|
@@ -77311,7 +77311,7 @@ function requireInput() {
|
|
|
77311
77311
|
if (hasRequiredInput) return input;
|
|
77312
77312
|
hasRequiredInput = 1;
|
|
77313
77313
|
let { nanoid } = /* @__PURE__ */ requireNonSecure();
|
|
77314
|
-
let { isAbsolute:
|
|
77314
|
+
let { isAbsolute: isAbsolute14, resolve: resolve14 } = require$$1;
|
|
77315
77315
|
let { SourceMapConsumer, SourceMapGenerator } = /* @__PURE__ */ requireSourceMap$1();
|
|
77316
77316
|
let { fileURLToPath: fileURLToPath3, pathToFileURL } = require$$2;
|
|
77317
77317
|
let CssSyntaxError = /* @__PURE__ */ requireCssSyntaxError();
|
|
@@ -77319,7 +77319,7 @@ function requireInput() {
|
|
|
77319
77319
|
let terminalHighlight = /* @__PURE__ */ requireTerminalHighlight();
|
|
77320
77320
|
let lineToIndexCache = /* @__PURE__ */ Symbol("lineToIndexCache");
|
|
77321
77321
|
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
77322
|
-
let pathAvailable = Boolean(resolve14 &&
|
|
77322
|
+
let pathAvailable = Boolean(resolve14 && isAbsolute14);
|
|
77323
77323
|
function getLineToIndex(input2) {
|
|
77324
77324
|
if (input2[lineToIndexCache]) return input2[lineToIndexCache];
|
|
77325
77325
|
let lines = input2.css.split("\n");
|
|
@@ -77350,7 +77350,7 @@ function requireInput() {
|
|
|
77350
77350
|
this.document = this.css;
|
|
77351
77351
|
if (opts.document) this.document = opts.document.toString();
|
|
77352
77352
|
if (opts.from) {
|
|
77353
|
-
if (!pathAvailable || /^\w+:\/\//.test(opts.from) ||
|
|
77353
|
+
if (!pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute14(opts.from)) {
|
|
77354
77354
|
this.file = opts.from;
|
|
77355
77355
|
} else {
|
|
77356
77356
|
this.file = resolve14(opts.from);
|
|
@@ -77486,7 +77486,7 @@ function requireInput() {
|
|
|
77486
77486
|
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
77487
77487
|
}
|
|
77488
77488
|
let fromUrl;
|
|
77489
|
-
if (
|
|
77489
|
+
if (isAbsolute14(from2.source)) {
|
|
77490
77490
|
fromUrl = pathToFileURL(from2.source);
|
|
77491
77491
|
} else {
|
|
77492
77492
|
fromUrl = new URL(
|
|
@@ -94466,6 +94466,9 @@ function createArgumentMap() {
|
|
|
94466
94466
|
};
|
|
94467
94467
|
}
|
|
94468
94468
|
|
|
94469
|
+
// ../reference-graph/dist/engine/binding.js
|
|
94470
|
+
import { isAbsolute as isAbsolute8 } from "node:path";
|
|
94471
|
+
|
|
94469
94472
|
// ../reference-graph/dist/engine/cycle-detection.js
|
|
94470
94473
|
var MAX_REFERENCE_DEPTH = 32;
|
|
94471
94474
|
function createCycleGuard() {
|
|
@@ -94528,130 +94531,25 @@ function libraryStubFor(imp, ref) {
|
|
|
94528
94531
|
return libraryExportFor(imp, ref)?.kind === "identity-preserving" ? { kind: "Function", returns: [{ kind: "ParameterOf", fn: ref, index: 0 }] } : null;
|
|
94529
94532
|
}
|
|
94530
94533
|
|
|
94531
|
-
// ../reference-graph/dist/engine/
|
|
94532
|
-
function
|
|
94533
|
-
const
|
|
94534
|
-
|
|
94535
|
-
while (true) {
|
|
94536
|
-
const decl = lookupGraph.declarations.get(`${scope}::${ref.symbol}`);
|
|
94537
|
-
if (decl) {
|
|
94538
|
-
return wrapWithMemberChain(decl.value, ref.memberChain);
|
|
94539
|
-
}
|
|
94540
|
-
if (scope === MODULE_SCOPE)
|
|
94541
|
-
break;
|
|
94542
|
-
const parent = lookupGraph.scopes.get(scope)?.parent;
|
|
94543
|
-
if (parent === null || parent === void 0)
|
|
94544
|
-
break;
|
|
94545
|
-
scope = parent;
|
|
94546
|
-
}
|
|
94547
|
-
const imp = lookupGraph.importsByLocal.get(ref.symbol);
|
|
94548
|
-
if (!imp)
|
|
94549
|
-
return { kind: "Unknown" };
|
|
94550
|
-
const stub = libraryStubFor(imp, ref);
|
|
94551
|
-
if (stub)
|
|
94552
|
-
return stub;
|
|
94553
|
-
const resolvedFile = graph.moduleResolver(lookupGraph.filePath, imp.specifier);
|
|
94554
|
-
if (!resolvedFile)
|
|
94555
|
-
return { kind: "Unknown" };
|
|
94556
|
-
const targetFile = graph.resolveToGraphKey ? graph.resolveToGraphKey(resolvedFile) ?? resolvedFile : resolvedFile;
|
|
94557
|
-
const found = findExport(graph, targetFile, imp.imported, /* @__PURE__ */ new Set());
|
|
94558
|
-
if (!found)
|
|
94559
|
-
return { kind: "Unknown" };
|
|
94560
|
-
const { record: exp, fileGraph: expFileGraph } = found;
|
|
94561
|
-
return resolveExport(graph, expFileGraph, exp, ref.memberChain, guard);
|
|
94534
|
+
// ../reference-graph/dist/engine/member-identity.js
|
|
94535
|
+
function effectiveExportName(imported, memberChain) {
|
|
94536
|
+
const first = memberChain[0];
|
|
94537
|
+
return imported === "*" && first !== void 0 ? first : imported;
|
|
94562
94538
|
}
|
|
94563
|
-
function
|
|
94564
|
-
|
|
94565
|
-
if (seen2.has(seenKey))
|
|
94566
|
-
return null;
|
|
94567
|
-
seen2.add(seenKey);
|
|
94568
|
-
const target = graph.files.get(file);
|
|
94569
|
-
if (!target)
|
|
94570
|
-
return null;
|
|
94571
|
-
for (const exp of target.exports) {
|
|
94572
|
-
if (exp.kind === "named" && exp.exportedAs === imported)
|
|
94573
|
-
return { record: exp, fileGraph: target };
|
|
94574
|
-
if (exp.kind === "default" && imported === "default")
|
|
94575
|
-
return { record: exp, fileGraph: target };
|
|
94576
|
-
}
|
|
94577
|
-
for (const exp of target.exports) {
|
|
94578
|
-
if (exp.kind !== "star")
|
|
94579
|
-
continue;
|
|
94580
|
-
const resolvedFrom = graph.moduleResolver(file, exp.from);
|
|
94581
|
-
if (!resolvedFrom)
|
|
94582
|
-
continue;
|
|
94583
|
-
const nextFile = graph.resolveToGraphKey ? graph.resolveToGraphKey(resolvedFrom) ?? resolvedFrom : resolvedFrom;
|
|
94584
|
-
const result2 = findExport(graph, nextFile, imported, seen2);
|
|
94585
|
-
if (result2)
|
|
94586
|
-
return result2;
|
|
94587
|
-
}
|
|
94588
|
-
return null;
|
|
94539
|
+
function residualMemberChain(imported, memberChain) {
|
|
94540
|
+
return imported === "*" && memberChain.length > 0 ? memberChain.slice(1) : memberChain;
|
|
94589
94541
|
}
|
|
94590
|
-
function
|
|
94591
|
-
|
|
94592
|
-
const guardResult = guard.push(fileGraph.filePath, exp.local);
|
|
94593
|
-
if (guardResult !== "ok")
|
|
94594
|
-
return { kind: "Unknown" };
|
|
94595
|
-
try {
|
|
94596
|
-
const localRef = {
|
|
94597
|
-
symbol: exp.local,
|
|
94598
|
-
scope: MODULE_SCOPE,
|
|
94599
|
-
memberChain,
|
|
94600
|
-
loc: { line: 0, column: 0 }
|
|
94601
|
-
};
|
|
94602
|
-
return resolveReference(graph, fileGraph, localRef, guard);
|
|
94603
|
-
} finally {
|
|
94604
|
-
guard.pop(fileGraph.filePath, exp.local);
|
|
94605
|
-
}
|
|
94606
|
-
}
|
|
94607
|
-
if (exp.kind === "named" && "from" in exp) {
|
|
94608
|
-
const resolvedFrom = graph.moduleResolver(fileGraph.filePath, exp.from);
|
|
94609
|
-
if (!resolvedFrom)
|
|
94610
|
-
return { kind: "Unknown" };
|
|
94611
|
-
const targetFile = graph.resolveToGraphKey ? graph.resolveToGraphKey(resolvedFrom) ?? resolvedFrom : resolvedFrom;
|
|
94612
|
-
const innerFound = findExport(graph, targetFile, exp.fromImported, /* @__PURE__ */ new Set());
|
|
94613
|
-
if (!innerFound)
|
|
94614
|
-
return { kind: "Unknown" };
|
|
94615
|
-
const guardResult = guard.push(fileGraph.filePath, exp.exportedAs);
|
|
94616
|
-
if (guardResult !== "ok")
|
|
94617
|
-
return { kind: "Unknown" };
|
|
94618
|
-
try {
|
|
94619
|
-
return resolveExport(graph, innerFound.fileGraph, innerFound.record, memberChain, guard);
|
|
94620
|
-
} finally {
|
|
94621
|
-
guard.pop(fileGraph.filePath, exp.exportedAs);
|
|
94622
|
-
}
|
|
94623
|
-
}
|
|
94624
|
-
if (exp.kind === "default" && "local" in exp) {
|
|
94625
|
-
const guardResult = guard.push(fileGraph.filePath, exp.local);
|
|
94626
|
-
if (guardResult !== "ok")
|
|
94627
|
-
return { kind: "Unknown" };
|
|
94628
|
-
try {
|
|
94629
|
-
const localRef = {
|
|
94630
|
-
symbol: exp.local,
|
|
94631
|
-
scope: MODULE_SCOPE,
|
|
94632
|
-
memberChain,
|
|
94633
|
-
loc: { line: 0, column: 0 }
|
|
94634
|
-
};
|
|
94635
|
-
return resolveReference(graph, fileGraph, localRef, guard);
|
|
94636
|
-
} finally {
|
|
94637
|
-
guard.pop(fileGraph.filePath, exp.local);
|
|
94638
|
-
}
|
|
94639
|
-
}
|
|
94640
|
-
return { kind: "Unknown" };
|
|
94542
|
+
function compoundExportName(root2, residual) {
|
|
94543
|
+
return residual.length === 0 ? root2 : `${root2}.${residual.join(".")}`;
|
|
94641
94544
|
}
|
|
94642
|
-
function
|
|
94643
|
-
let
|
|
94644
|
-
for (const
|
|
94645
|
-
|
|
94545
|
+
function memberOfObjectPath(holder, path5) {
|
|
94546
|
+
let cur = holder;
|
|
94547
|
+
for (const segment of path5) {
|
|
94548
|
+
if (cur?.kind !== "Object")
|
|
94549
|
+
return void 0;
|
|
94550
|
+
cur = cur.props[segment];
|
|
94646
94551
|
}
|
|
94647
|
-
return
|
|
94648
|
-
}
|
|
94649
|
-
function fileGraphForRef(graph, ref, fallback) {
|
|
94650
|
-
if (!ref.originFile)
|
|
94651
|
-
return fallback;
|
|
94652
|
-
if (ref.originFile === fallback.filePath)
|
|
94653
|
-
return fallback;
|
|
94654
|
-
return graph.files.get(ref.originFile) ?? fallback;
|
|
94552
|
+
return cur;
|
|
94655
94553
|
}
|
|
94656
94554
|
|
|
94657
94555
|
// ../reference-graph/dist/engine/specifier.js
|
|
@@ -94681,67 +94579,9 @@ function externalSubpath(pkg, specifier) {
|
|
|
94681
94579
|
return void 0;
|
|
94682
94580
|
}
|
|
94683
94581
|
|
|
94684
|
-
// ../reference-graph/dist/engine/
|
|
94685
|
-
|
|
94686
|
-
|
|
94687
|
-
}
|
|
94688
|
-
function walk2(graph, file, imported, seen2) {
|
|
94689
|
-
const seenKey = `${file}::${imported}`;
|
|
94690
|
-
if (seen2.has(seenKey))
|
|
94691
|
-
return null;
|
|
94692
|
-
seen2.add(seenKey);
|
|
94693
|
-
const target = graph.files.get(file);
|
|
94694
|
-
if (!target)
|
|
94695
|
-
return null;
|
|
94696
|
-
const exp = target.exports.find((e) => e.kind === "named" && "exportedAs" in e && e.exportedAs === imported || e.kind === "default" && imported === "default");
|
|
94697
|
-
if (exp) {
|
|
94698
|
-
if (exp.kind === "named" && "from" in exp) {
|
|
94699
|
-
const nextAbs = graph.moduleResolver(file, exp.from);
|
|
94700
|
-
if (!nextAbs)
|
|
94701
|
-
return { file, localExport: imported };
|
|
94702
|
-
const nextKey = graph.resolveToGraphKey ? graph.resolveToGraphKey(nextAbs) : nextAbs;
|
|
94703
|
-
if (!nextKey)
|
|
94704
|
-
return { file, localExport: imported };
|
|
94705
|
-
return walk2(graph, nextKey, exp.fromImported, seen2) ?? {
|
|
94706
|
-
file: nextKey,
|
|
94707
|
-
localExport: exp.fromImported
|
|
94708
|
-
};
|
|
94709
|
-
}
|
|
94710
|
-
if ("local" in exp) {
|
|
94711
|
-
const imp = target.importsByLocal.get(exp.local);
|
|
94712
|
-
if (imp && imp.imported !== "*" && !packageNameFromSpecifier(imp.specifier)) {
|
|
94713
|
-
const nextAbs = graph.moduleResolver(file, imp.specifier);
|
|
94714
|
-
const nextKey = nextAbs && (graph.resolveToGraphKey ? graph.resolveToGraphKey(nextAbs) : nextAbs);
|
|
94715
|
-
if (nextKey) {
|
|
94716
|
-
const leaf = walk2(graph, nextKey, imp.imported, seen2);
|
|
94717
|
-
if (leaf)
|
|
94718
|
-
return leaf;
|
|
94719
|
-
if (graph.lazyReExportResolution && !graph.files.has(nextKey)) {
|
|
94720
|
-
return { file: nextKey, localExport: imp.imported };
|
|
94721
|
-
}
|
|
94722
|
-
}
|
|
94723
|
-
}
|
|
94724
|
-
return { file, localExport: exp.local };
|
|
94725
|
-
}
|
|
94726
|
-
return { file, localExport: imported };
|
|
94727
|
-
}
|
|
94728
|
-
for (const starExp of target.exports) {
|
|
94729
|
-
if (starExp.kind !== "star")
|
|
94730
|
-
continue;
|
|
94731
|
-
const nextAbs = graph.moduleResolver(file, starExp.from);
|
|
94732
|
-
if (!nextAbs)
|
|
94733
|
-
continue;
|
|
94734
|
-
const nextKey = graph.resolveToGraphKey ? graph.resolveToGraphKey(nextAbs) : nextAbs;
|
|
94735
|
-
if (!nextKey)
|
|
94736
|
-
continue;
|
|
94737
|
-
const result2 = walk2(graph, nextKey, imported, seen2);
|
|
94738
|
-
if (result2)
|
|
94739
|
-
return result2;
|
|
94740
|
-
}
|
|
94741
|
-
return null;
|
|
94742
|
-
}
|
|
94743
|
-
|
|
94744
|
-
// ../reference-graph/dist/engine/helper-callers.js
|
|
94582
|
+
// ../reference-graph/dist/engine/binding.js
|
|
94583
|
+
var NO_EXPORT = { kind: "no-export" };
|
|
94584
|
+
var UNBOUND = { kind: "unbound" };
|
|
94745
94585
|
function findLocalDeclaration(fileGraph, ref) {
|
|
94746
94586
|
let scope = ref.scope;
|
|
94747
94587
|
while (true) {
|
|
@@ -94756,246 +94596,316 @@ function findLocalDeclaration(fileGraph, ref) {
|
|
|
94756
94596
|
scope = parent;
|
|
94757
94597
|
}
|
|
94758
94598
|
}
|
|
94759
|
-
function
|
|
94760
|
-
if (
|
|
94761
|
-
return
|
|
94762
|
-
|
|
94763
|
-
return "component";
|
|
94764
|
-
return registry.hasLocal(fileGraph.filePath, decl.symbol) ? "component" : "helper";
|
|
94599
|
+
function fileGraphForRef(graph, ref, fallback) {
|
|
94600
|
+
if (!ref.originFile || ref.originFile === fallback.filePath)
|
|
94601
|
+
return fallback;
|
|
94602
|
+
return graph.files.get(ref.originFile) ?? fallback;
|
|
94765
94603
|
}
|
|
94766
|
-
|
|
94767
|
-
|
|
94768
|
-
|
|
94769
|
-
|
|
94770
|
-
|
|
94771
|
-
|
|
94772
|
-
|
|
94773
|
-
|
|
94774
|
-
|
|
94775
|
-
|
|
94776
|
-
|
|
94777
|
-
|
|
94778
|
-
|
|
94779
|
-
|
|
94780
|
-
|
|
94781
|
-
const
|
|
94782
|
-
|
|
94783
|
-
|
|
94784
|
-
if (decl.scope !== MODULE_SCOPE)
|
|
94785
|
-
continue;
|
|
94786
|
-
const refs = [];
|
|
94787
|
-
if (decl.value.kind === "Function") {
|
|
94788
|
-
for (const r2 of decl.value.returns)
|
|
94789
|
-
collectRefsInType(r2, refs);
|
|
94790
|
-
} else if (decl.value.kind === "ReturnTypeOf") {
|
|
94791
|
-
collectCalleeRefs(decl.value, refs);
|
|
94792
|
-
}
|
|
94793
|
-
for (const bc of fileGraph.bodyCalls) {
|
|
94794
|
-
if (bc.ownerSymbol === decl.symbol)
|
|
94795
|
-
refs.push(bc.callee);
|
|
94796
|
-
}
|
|
94797
|
-
const callerKey = { file, symbol: decl.symbol };
|
|
94798
|
-
for (const ref of refs) {
|
|
94799
|
-
const target = resolveRefCached(ref, file, fileGraph);
|
|
94800
|
-
if (!target)
|
|
94801
|
-
continue;
|
|
94802
|
-
pendingValueRefs.push({ target, caller: callerKey });
|
|
94803
|
-
}
|
|
94804
|
-
}
|
|
94805
|
-
}
|
|
94806
|
-
const pendingJsxCalls = [];
|
|
94807
|
-
for (const [file, fileGraph] of graph.files) {
|
|
94808
|
-
for (let i2 = 0; i2 < fileGraph.jsxUsages.length; i2++) {
|
|
94809
|
-
const usage = fileGraph.jsxUsages[i2];
|
|
94810
|
-
if (!usage)
|
|
94811
|
-
continue;
|
|
94812
|
-
const target = resolveRefCached(usage.ref, file, fileGraph);
|
|
94813
|
-
if (!target)
|
|
94814
|
-
continue;
|
|
94815
|
-
const ownership = fileGraph.ownership[i2];
|
|
94816
|
-
if (!ownership?.ownerSymbolRef)
|
|
94817
|
-
continue;
|
|
94818
|
-
const callerTarget = resolveRefCached(ownership.ownerSymbolRef, file, fileGraph);
|
|
94819
|
-
if (!callerTarget)
|
|
94820
|
-
continue;
|
|
94821
|
-
if (callerTarget.decl.scope !== MODULE_SCOPE)
|
|
94822
|
-
continue;
|
|
94823
|
-
pendingJsxCalls.push({
|
|
94824
|
-
target,
|
|
94825
|
-
caller: { file: callerTarget.file, symbol: callerTarget.decl.symbol }
|
|
94826
|
-
});
|
|
94827
|
-
}
|
|
94828
|
-
}
|
|
94829
|
-
function classifyKey(file, decl) {
|
|
94830
|
-
const key = `${file}::${decl.symbol}`;
|
|
94831
|
-
const hit = classificationCache.get(key);
|
|
94832
|
-
if (hit !== void 0)
|
|
94833
|
-
return hit;
|
|
94834
|
-
const fileGraph = graph.files.get(file);
|
|
94835
|
-
const result2 = fileGraph ? classifyDeclaration(decl, registry, fileGraph) : "unknown";
|
|
94836
|
-
classificationCache.set(key, result2);
|
|
94837
|
-
return result2;
|
|
94838
|
-
}
|
|
94839
|
-
for (const [file, fileGraph] of graph.files) {
|
|
94840
|
-
for (const decl of fileGraph.declarations.values()) {
|
|
94841
|
-
if (decl.scope !== MODULE_SCOPE)
|
|
94842
|
-
continue;
|
|
94843
|
-
if (decl.value.kind !== "Function" && decl.value.kind !== "ReturnTypeOf")
|
|
94844
|
-
continue;
|
|
94845
|
-
classifyKey(file, decl);
|
|
94846
|
-
}
|
|
94847
|
-
}
|
|
94848
|
-
function recordCallerEdge(target, callerKey) {
|
|
94849
|
-
const keyStr = `${target.file}::${target.decl.symbol}`;
|
|
94850
|
-
const callerKeyStr = `${callerKey.file}::${callerKey.symbol}`;
|
|
94851
|
-
let seen2 = callerKeysByHelper.get(keyStr);
|
|
94852
|
-
if (!seen2) {
|
|
94853
|
-
seen2 = /* @__PURE__ */ new Set();
|
|
94854
|
-
callerKeysByHelper.set(keyStr, seen2);
|
|
94855
|
-
}
|
|
94856
|
-
if (seen2.has(callerKeyStr))
|
|
94857
|
-
return;
|
|
94858
|
-
seen2.add(callerKeyStr);
|
|
94859
|
-
let callers = index.get(keyStr);
|
|
94860
|
-
if (!callers) {
|
|
94861
|
-
callers = /* @__PURE__ */ new Set();
|
|
94862
|
-
index.set(keyStr, callers);
|
|
94863
|
-
}
|
|
94864
|
-
callers.add(callerKey);
|
|
94604
|
+
function graphKeyFor(graph, abs) {
|
|
94605
|
+
return graph.resolveToGraphKey ? graph.resolveToGraphKey(abs) : abs;
|
|
94606
|
+
}
|
|
94607
|
+
function exportRecordFor(fileGraph, name) {
|
|
94608
|
+
return fileGraph.exports.find((e) => e.kind === "named" && e.exportedAs === name || e.kind === "default" && name === "default");
|
|
94609
|
+
}
|
|
94610
|
+
function resolveBinding(graph, fileGraph, ref, guard = createCycleGuard()) {
|
|
94611
|
+
const found = bindingIn(graph, fileGraphForRef(graph, ref, fileGraph), ref, guard, /* @__PURE__ */ new Set());
|
|
94612
|
+
return withWalkIdentity(graph, found, ref.memberChain);
|
|
94613
|
+
}
|
|
94614
|
+
function resolveModuleExport(graph, fromFile, specifier, imported, memberChain, guard = createCycleGuard()) {
|
|
94615
|
+
const found = moduleExport(graph, fromFile, specifier, imported, memberChain, guard, /* @__PURE__ */ new Set());
|
|
94616
|
+
return withWalkIdentity(graph, { ...found, module: { specifier, imported, target: found.target } }, memberChain);
|
|
94617
|
+
}
|
|
94618
|
+
function bindingIn(graph, fileGraph, ref, guard, chain) {
|
|
94619
|
+
const decl = findLocalDeclaration(fileGraph, ref);
|
|
94620
|
+
if (decl) {
|
|
94621
|
+
return { binding: { kind: "declaration", file: fileGraph.filePath, decl, path: ref.memberChain, inScope: true }, end: null };
|
|
94865
94622
|
}
|
|
94866
|
-
|
|
94867
|
-
|
|
94623
|
+
const imp = fileGraph.importsByLocal.get(ref.symbol);
|
|
94624
|
+
if (!imp)
|
|
94625
|
+
return { binding: UNBOUND, end: null };
|
|
94626
|
+
const stub = libraryStubFor(imp, ref);
|
|
94627
|
+
if (stub) {
|
|
94628
|
+
const binding2 = {
|
|
94629
|
+
kind: "package-export",
|
|
94630
|
+
specifier: imp.specifier,
|
|
94631
|
+
exportName: effectiveExportName(imp.imported, ref.memberChain),
|
|
94632
|
+
path: residualMemberChain(imp.imported, ref.memberChain),
|
|
94633
|
+
stub
|
|
94634
|
+
};
|
|
94635
|
+
return { binding: binding2, end: null };
|
|
94636
|
+
}
|
|
94637
|
+
const found = moduleExport(graph, fileGraph.filePath, imp.specifier, imp.imported, ref.memberChain, guard, chain);
|
|
94638
|
+
return { ...found, module: { specifier: imp.specifier, imported: imp.imported, target: found.target } };
|
|
94639
|
+
}
|
|
94640
|
+
function moduleExport(graph, fromFile, specifier, imported, memberChain, guard, chain) {
|
|
94641
|
+
const exportName = effectiveExportName(imported, memberChain);
|
|
94642
|
+
const path5 = residualMemberChain(imported, memberChain);
|
|
94643
|
+
const target = moduleTarget(graph, fromFile, specifier, exportName, path5);
|
|
94644
|
+
if (target.kind === "outside")
|
|
94645
|
+
return { binding: target.binding, end: null, target };
|
|
94646
|
+
if (imported === "*" && memberChain.length === 0)
|
|
94647
|
+
return { binding: NO_EXPORT, end: null, target };
|
|
94648
|
+
const found = exportIn(graph, target.key, exportName, path5, guard, chain);
|
|
94649
|
+
const b = found.binding;
|
|
94650
|
+
if (imported === "*" && (b.kind === "declaration" || b.kind === "package-export")) {
|
|
94651
|
+
return { binding: { ...b, mainGap: "namespace-member" }, end: found.end, target };
|
|
94652
|
+
}
|
|
94653
|
+
return { binding: b, end: found.end, target };
|
|
94654
|
+
}
|
|
94655
|
+
function moduleTarget(graph, fromFile, specifier, exportName, path5) {
|
|
94656
|
+
const isPackage = packageNameFromSpecifier(specifier) !== null;
|
|
94657
|
+
const abs = graph.moduleResolver(fromFile, specifier);
|
|
94658
|
+
if (!abs) {
|
|
94659
|
+
const binding3 = isPackage ? { kind: "package-export", specifier, exportName, path: path5, stub: null } : { kind: "import-failed", specifier, exportName, path: path5 };
|
|
94660
|
+
return { kind: "outside", binding: binding3, graphKey: null, member: false };
|
|
94661
|
+
}
|
|
94662
|
+
const graphKey = graphKeyFor(graph, abs);
|
|
94663
|
+
const key = graphKey ?? abs;
|
|
94664
|
+
if (graph.files.has(key))
|
|
94665
|
+
return { kind: "parsed", key };
|
|
94666
|
+
if (graph.workspaceMembership?.(abs) === true) {
|
|
94667
|
+
return { kind: "outside", binding: { kind: "unparsed", file: abs, exportName, path: path5 }, graphKey, member: true };
|
|
94668
|
+
}
|
|
94669
|
+
const binding2 = isPackage ? { kind: "package-export", specifier, exportName, path: path5, stub: null } : { kind: "unparsed", file: key, exportName, path: path5 };
|
|
94670
|
+
return { kind: "outside", binding: binding2, graphKey, member: false };
|
|
94671
|
+
}
|
|
94672
|
+
function exportIn(graph, file, name, path5, guard, chain) {
|
|
94673
|
+
const again = soughtAgain(chain, file, name);
|
|
94674
|
+
const found = findExportRecord(graph, file, name, /* @__PURE__ */ new Set());
|
|
94675
|
+
if (!found)
|
|
94676
|
+
return { binding: packageStarExport(graph, file, name, path5, /* @__PURE__ */ new Set()) ?? NO_EXPORT, end: null };
|
|
94677
|
+
const inner = followRecord(graph, found, file, name, path5, guard, chain);
|
|
94678
|
+
return again ? { binding: inner.binding, end: null } : inner;
|
|
94679
|
+
}
|
|
94680
|
+
function followRecord(graph, found, file, name, path5, guard, chain) {
|
|
94681
|
+
const onChain = recordOnChain(graph, file, name, chain);
|
|
94682
|
+
if (onChain?.record === found.record)
|
|
94683
|
+
return bindingForRecord(graph, found.fileGraph, found.record, name, path5, guard, chain);
|
|
94684
|
+
const { binding: binding2 } = bindingForRecord(graph, found.fileGraph, found.record, name, path5, guard, new Set(chain));
|
|
94685
|
+
const end = onChain ? bindingForRecord(graph, onChain.fileGraph, onChain.record, name, path5, guard, chain).end : null;
|
|
94686
|
+
return { binding: binding2, end };
|
|
94687
|
+
}
|
|
94688
|
+
function soughtAgain(chain, file, name) {
|
|
94689
|
+
const key = `${file}::${name}`;
|
|
94690
|
+
if (chain.has(key))
|
|
94691
|
+
return true;
|
|
94692
|
+
chain.add(key);
|
|
94693
|
+
return false;
|
|
94694
|
+
}
|
|
94695
|
+
function findExportRecord(graph, file, name, seen2) {
|
|
94696
|
+
const seenKey = `${file}::${name}`;
|
|
94697
|
+
if (seen2.has(seenKey))
|
|
94698
|
+
return null;
|
|
94699
|
+
seen2.add(seenKey);
|
|
94700
|
+
const fileGraph = graph.files.get(file);
|
|
94701
|
+
if (!fileGraph)
|
|
94702
|
+
return null;
|
|
94703
|
+
const record = exportRecordFor(fileGraph, name);
|
|
94704
|
+
if (record)
|
|
94705
|
+
return { record, fileGraph };
|
|
94706
|
+
for (const star of fileGraph.exports) {
|
|
94707
|
+
if (star.kind !== "star")
|
|
94868
94708
|
continue;
|
|
94869
|
-
|
|
94870
|
-
|
|
94871
|
-
for (const { target, caller } of pendingJsxCalls) {
|
|
94872
|
-
if (classifyKey(target.file, target.decl) !== "helper")
|
|
94709
|
+
const abs = graph.moduleResolver(file, star.from);
|
|
94710
|
+
if (!abs)
|
|
94873
94711
|
continue;
|
|
94874
|
-
|
|
94712
|
+
const found = findExportRecord(graph, graphKeyFor(graph, abs) ?? abs, name, seen2);
|
|
94713
|
+
if (found)
|
|
94714
|
+
return found;
|
|
94875
94715
|
}
|
|
94876
|
-
return
|
|
94877
|
-
get(key) {
|
|
94878
|
-
return index.get(`${key.file}::${key.symbol}`);
|
|
94879
|
-
},
|
|
94880
|
-
classification(file, symbol2) {
|
|
94881
|
-
return classificationCache.get(`${file}::${symbol2}`) ?? "unknown";
|
|
94882
|
-
}
|
|
94883
|
-
};
|
|
94716
|
+
return null;
|
|
94884
94717
|
}
|
|
94885
|
-
function
|
|
94886
|
-
|
|
94887
|
-
|
|
94888
|
-
|
|
94889
|
-
|
|
94890
|
-
|
|
94891
|
-
collectCalleeRefs(t3.obj, out2);
|
|
94892
|
-
return;
|
|
94893
|
-
case "TypeOf":
|
|
94894
|
-
out2.push(t3.ref);
|
|
94718
|
+
function packageStarExport(graph, file, name, path5, seen2) {
|
|
94719
|
+
if (name === "default")
|
|
94720
|
+
return null;
|
|
94721
|
+
const outside = [];
|
|
94722
|
+
const visit2 = (f) => {
|
|
94723
|
+
if (seen2.has(f))
|
|
94895
94724
|
return;
|
|
94896
|
-
|
|
94725
|
+
seen2.add(f);
|
|
94726
|
+
const fileGraph = graph.files.get(f);
|
|
94727
|
+
if (!fileGraph)
|
|
94897
94728
|
return;
|
|
94898
|
-
|
|
94729
|
+
for (const star of fileGraph.exports) {
|
|
94730
|
+
if (star.kind !== "star")
|
|
94731
|
+
continue;
|
|
94732
|
+
const target = moduleTarget(graph, f, star.from, name, path5);
|
|
94733
|
+
if (target.kind === "parsed")
|
|
94734
|
+
visit2(target.key);
|
|
94735
|
+
else
|
|
94736
|
+
outside.push(target.binding);
|
|
94737
|
+
}
|
|
94738
|
+
};
|
|
94739
|
+
visit2(file);
|
|
94740
|
+
return outside.length === 1 && outside[0]?.kind === "package-export" ? outside[0] : null;
|
|
94899
94741
|
}
|
|
94900
|
-
function
|
|
94901
|
-
|
|
94902
|
-
|
|
94903
|
-
|
|
94904
|
-
|
|
94905
|
-
|
|
94906
|
-
|
|
94907
|
-
|
|
94908
|
-
|
|
94909
|
-
|
|
94910
|
-
|
|
94911
|
-
|
|
94912
|
-
|
|
94913
|
-
|
|
94914
|
-
|
|
94915
|
-
|
|
94916
|
-
|
|
94917
|
-
|
|
94918
|
-
|
|
94919
|
-
for (const v of Object.values(t3.props))
|
|
94920
|
-
collectRefsInType(v, out2);
|
|
94921
|
-
return;
|
|
94922
|
-
case "Array":
|
|
94923
|
-
for (const e of t3.elements)
|
|
94924
|
-
collectRefsInType(e, out2);
|
|
94925
|
-
return;
|
|
94926
|
-
case "MemberOf":
|
|
94927
|
-
collectRefsInType(t3.obj, out2);
|
|
94928
|
-
return;
|
|
94929
|
-
case "ParameterOf":
|
|
94930
|
-
return;
|
|
94931
|
-
default:
|
|
94932
|
-
return;
|
|
94742
|
+
function recordOnChain(graph, file, name, chain) {
|
|
94743
|
+
const fileGraph = graph.files.get(file);
|
|
94744
|
+
if (!fileGraph)
|
|
94745
|
+
return null;
|
|
94746
|
+
const record = exportRecordFor(fileGraph, name);
|
|
94747
|
+
if (record)
|
|
94748
|
+
return { record, fileGraph };
|
|
94749
|
+
for (const star of fileGraph.exports) {
|
|
94750
|
+
if (star.kind !== "star")
|
|
94751
|
+
continue;
|
|
94752
|
+
const abs = graph.moduleResolver(file, star.from);
|
|
94753
|
+
if (!abs)
|
|
94754
|
+
continue;
|
|
94755
|
+
const next = graphKeyFor(graph, abs);
|
|
94756
|
+
if (next === null || soughtAgain(chain, next, name))
|
|
94757
|
+
continue;
|
|
94758
|
+
const found = recordOnChain(graph, next, name, chain);
|
|
94759
|
+
if (found)
|
|
94760
|
+
return found;
|
|
94933
94761
|
}
|
|
94762
|
+
return null;
|
|
94934
94763
|
}
|
|
94935
|
-
function
|
|
94936
|
-
|
|
94937
|
-
|
|
94938
|
-
if (
|
|
94939
|
-
|
|
94940
|
-
|
|
94941
|
-
|
|
94942
|
-
|
|
94943
|
-
|
|
94944
|
-
|
|
94945
|
-
|
|
94946
|
-
|
|
94947
|
-
|
|
94948
|
-
|
|
94949
|
-
|
|
94950
|
-
|
|
94951
|
-
|
|
94952
|
-
|
|
94953
|
-
if (chainedGraph) {
|
|
94954
|
-
const decl = chainedGraph.declarations.get(`${MODULE_SCOPE}::${chained.localExport}`);
|
|
94955
|
-
if (decl)
|
|
94956
|
-
return { file: chained.file, decl };
|
|
94764
|
+
function bindingForRecord(graph, fg, exp, name, path5, guard, chain) {
|
|
94765
|
+
if (exp.kind === "star")
|
|
94766
|
+
return { binding: NO_EXPORT, end: null };
|
|
94767
|
+
if ("local" in exp) {
|
|
94768
|
+
const here = { file: fg.filePath, name: exp.local };
|
|
94769
|
+
if (guard.push(fg.filePath, exp.local) !== "ok")
|
|
94770
|
+
return { binding: NO_EXPORT, end: here };
|
|
94771
|
+
try {
|
|
94772
|
+
const ref = { symbol: exp.local, scope: MODULE_SCOPE, memberChain: [...path5], loc: { line: 0, column: 0 } };
|
|
94773
|
+
const found2 = bindingIn(graph, fg, ref, guard, chain);
|
|
94774
|
+
const b = found2.binding;
|
|
94775
|
+
const followed = found2.module !== void 0 && found2.module.imported !== "*" && packageNameFromSpecifier(found2.module.specifier) === null && found2.module.target.kind === "parsed";
|
|
94776
|
+
return {
|
|
94777
|
+
binding: b.kind === "declaration" ? { ...b, inScope: false } : leftGraphThrough(b, fg.filePath),
|
|
94778
|
+
end: (followed ? found2.end : null) ?? here
|
|
94779
|
+
};
|
|
94780
|
+
} finally {
|
|
94781
|
+
guard.pop(fg.filePath, exp.local);
|
|
94957
94782
|
}
|
|
94958
94783
|
}
|
|
94959
|
-
|
|
94960
|
-
|
|
94961
|
-
|
|
94962
|
-
|
|
94963
|
-
return { file: targetFile, decl };
|
|
94964
|
-
}
|
|
94965
|
-
if (exp.kind === "default" && "local" in exp && imp.imported === "default") {
|
|
94966
|
-
const decl = targetGraph.declarations.get(`${MODULE_SCOPE}::${exp.local}`);
|
|
94967
|
-
if (decl)
|
|
94968
|
-
return { file: targetFile, decl };
|
|
94969
|
-
}
|
|
94784
|
+
const target = moduleTarget(graph, fg.filePath, exp.from, exp.fromImported, path5);
|
|
94785
|
+
if (target.kind === "outside") {
|
|
94786
|
+
const end = target.graphKey === null ? { file: fg.filePath, name } : { file: target.graphKey, name: exp.fromImported };
|
|
94787
|
+
return { binding: leftGraphThrough(target.binding, null), end };
|
|
94970
94788
|
}
|
|
94971
|
-
|
|
94789
|
+
const next = { file: target.key, name: exp.fromImported };
|
|
94790
|
+
const again = soughtAgain(chain, target.key, exp.fromImported);
|
|
94791
|
+
const found = findExportRecord(graph, target.key, exp.fromImported, /* @__PURE__ */ new Set());
|
|
94792
|
+
if (!found)
|
|
94793
|
+
return { binding: packageStarExport(graph, target.key, exp.fromImported, path5, /* @__PURE__ */ new Set()) ?? NO_EXPORT, end: next };
|
|
94794
|
+
if (guard.push(fg.filePath, exp.exportedAs) !== "ok")
|
|
94795
|
+
return { binding: NO_EXPORT, end: next };
|
|
94796
|
+
try {
|
|
94797
|
+
const inner = followRecord(graph, found, target.key, exp.fromImported, path5, guard, chain);
|
|
94798
|
+
return { binding: inner.binding, end: (again ? null : inner.end) ?? next };
|
|
94799
|
+
} finally {
|
|
94800
|
+
guard.pop(fg.filePath, exp.exportedAs);
|
|
94801
|
+
}
|
|
94802
|
+
}
|
|
94803
|
+
function leftGraphThrough(b, barrel) {
|
|
94804
|
+
if (b.kind === "unparsed" && b.mainGap === void 0) {
|
|
94805
|
+
return { ...b, mainGap: { kind: "through-parsed-barrel", barrel } };
|
|
94806
|
+
}
|
|
94807
|
+
return b;
|
|
94808
|
+
}
|
|
94809
|
+
function withWalkIdentity(graph, found, memberChain) {
|
|
94810
|
+
const { binding: binding2, module } = found;
|
|
94811
|
+
if (module === void 0)
|
|
94812
|
+
return binding2;
|
|
94813
|
+
if (binding2.kind === "package-export" && binding2.mainGap === void 0)
|
|
94814
|
+
return binding2;
|
|
94815
|
+
const { specifier, imported, target } = module;
|
|
94816
|
+
const name = effectiveExportName(imported, memberChain);
|
|
94817
|
+
const residual = residualMemberChain(imported, memberChain);
|
|
94818
|
+
const isPackage = packageNameFromSpecifier(specifier) !== null;
|
|
94819
|
+
const asWritten = (resolvedFile) => ({
|
|
94820
|
+
kind: "imported",
|
|
94821
|
+
specifier,
|
|
94822
|
+
imported: compoundExportName(name, residual),
|
|
94823
|
+
resolvedFile
|
|
94824
|
+
});
|
|
94825
|
+
const local = (file, exportName) => ({
|
|
94826
|
+
kind: "local",
|
|
94827
|
+
filePath: file,
|
|
94828
|
+
export: compoundExportName(exportName, residual)
|
|
94829
|
+
});
|
|
94830
|
+
let walked;
|
|
94831
|
+
if (target.kind === "outside") {
|
|
94832
|
+
if (isPackage || target.member || binding2.kind !== "unparsed")
|
|
94833
|
+
return binding2;
|
|
94834
|
+
walked = asWritten(target.graphKey);
|
|
94835
|
+
} else if (isPackage) {
|
|
94836
|
+
const file = found.end?.file ?? target.key;
|
|
94837
|
+
walked = graph.files.has(file) ? local(file, found.end?.name ?? name) : asWritten(null);
|
|
94838
|
+
} else {
|
|
94839
|
+
walked = found.end ? local(found.end.file, found.end.name) : asWritten(target.key);
|
|
94840
|
+
}
|
|
94841
|
+
return sameIdentity(walked, naturalIdentity(binding2)) ? binding2 : { ...binding2, walkIdentity: walked };
|
|
94972
94842
|
}
|
|
94973
|
-
|
|
94974
|
-
|
|
94975
|
-
|
|
94976
|
-
|
|
94977
|
-
|
|
94843
|
+
function sameIdentity(a3, b) {
|
|
94844
|
+
if (b === null || a3.kind !== b.kind)
|
|
94845
|
+
return false;
|
|
94846
|
+
if (a3.kind === "local" && b.kind === "local")
|
|
94847
|
+
return a3.filePath === b.filePath && a3.export === b.export;
|
|
94848
|
+
if (a3.kind === "imported" && b.kind === "imported") {
|
|
94849
|
+
return a3.specifier === b.specifier && a3.imported === b.imported && a3.resolvedFile === b.resolvedFile;
|
|
94850
|
+
}
|
|
94851
|
+
return false;
|
|
94978
94852
|
}
|
|
94979
|
-
function
|
|
94980
|
-
|
|
94853
|
+
function bindingValue(binding2) {
|
|
94854
|
+
switch (binding2.kind) {
|
|
94855
|
+
case "declaration": {
|
|
94856
|
+
if (binding2.mainGap === "namespace-member")
|
|
94857
|
+
return { kind: "Unknown" };
|
|
94858
|
+
let value = binding2.decl.value;
|
|
94859
|
+
for (const member of binding2.path)
|
|
94860
|
+
value = { kind: "MemberOf", obj: value, member };
|
|
94861
|
+
return value;
|
|
94862
|
+
}
|
|
94863
|
+
case "package-export":
|
|
94864
|
+
return binding2.mainGap === "namespace-member" ? { kind: "Unknown" } : binding2.stub ?? { kind: "Unknown" };
|
|
94865
|
+
default:
|
|
94866
|
+
return { kind: "Unknown" };
|
|
94867
|
+
}
|
|
94981
94868
|
}
|
|
94982
|
-
function
|
|
94983
|
-
|
|
94869
|
+
function bindingIdentity(binding2) {
|
|
94870
|
+
if (binding2.walkIdentity !== void 0)
|
|
94871
|
+
return binding2.walkIdentity;
|
|
94872
|
+
return naturalIdentity(binding2);
|
|
94984
94873
|
}
|
|
94985
|
-
function
|
|
94986
|
-
|
|
94987
|
-
|
|
94988
|
-
|
|
94989
|
-
|
|
94990
|
-
|
|
94874
|
+
function naturalIdentity(binding2) {
|
|
94875
|
+
switch (binding2.kind) {
|
|
94876
|
+
case "declaration":
|
|
94877
|
+
return {
|
|
94878
|
+
kind: "local",
|
|
94879
|
+
filePath: binding2.file,
|
|
94880
|
+
export: compoundExportName(binding2.decl.symbol, binding2.path),
|
|
94881
|
+
...binding2.path.length === 0 ? { declaration: binding2.decl } : {}
|
|
94882
|
+
};
|
|
94883
|
+
case "unparsed":
|
|
94884
|
+
return { kind: "local", filePath: binding2.file, export: compoundExportName(binding2.exportName, binding2.path) };
|
|
94885
|
+
case "package-export":
|
|
94886
|
+
case "import-failed":
|
|
94887
|
+
return {
|
|
94888
|
+
kind: "imported",
|
|
94889
|
+
specifier: binding2.specifier,
|
|
94890
|
+
imported: compoundExportName(binding2.exportName, binding2.path),
|
|
94891
|
+
resolvedFile: null
|
|
94892
|
+
};
|
|
94893
|
+
default:
|
|
94894
|
+
return null;
|
|
94991
94895
|
}
|
|
94992
|
-
return cur;
|
|
94993
94896
|
}
|
|
94994
|
-
function
|
|
94995
|
-
if (
|
|
94996
|
-
return
|
|
94997
|
-
|
|
94998
|
-
|
|
94897
|
+
function pinUnparsed(graph, binding2) {
|
|
94898
|
+
if (binding2.kind !== "unparsed" || binding2.mainGap !== void 0 || !isAbsolute8(binding2.file))
|
|
94899
|
+
return binding2;
|
|
94900
|
+
if (graph.workspaceMembership?.(binding2.file) !== true)
|
|
94901
|
+
return binding2;
|
|
94902
|
+
const def = graph.resolveLocalDefinition?.(binding2.file, binding2.exportName) ?? null;
|
|
94903
|
+
return def === null ? binding2 : { ...binding2, file: def.absFile, exportName: def.exportName };
|
|
94904
|
+
}
|
|
94905
|
+
|
|
94906
|
+
// ../reference-graph/dist/engine/resolve-reference.js
|
|
94907
|
+
function resolveReference(graph, fileGraph, ref, guard = createCycleGuard()) {
|
|
94908
|
+
return bindingValue(resolveBinding(graph, fileGraph, ref, guard));
|
|
94999
94909
|
}
|
|
95000
94910
|
|
|
95001
94911
|
// ../reference-graph/dist/engine/assert-never.js
|
|
@@ -95419,13 +95329,13 @@ function foldToWrappedArg(inner, via) {
|
|
|
95419
95329
|
}
|
|
95420
95330
|
return [indeterminateTerminal()];
|
|
95421
95331
|
}
|
|
95422
|
-
function argumentProvenance(type, arg, fileGraph) {
|
|
95423
|
-
const importRecord = findImportForLastArg(arg, fileGraph);
|
|
95332
|
+
function argumentProvenance(graph, type, arg, fileGraph) {
|
|
95333
|
+
const importRecord = findImportForLastArg(graph, arg, fileGraph);
|
|
95424
95334
|
const resolved = importRecord ? { specifier: importRecord.specifier, import: importRecord.imported } : resolveAnonymousLastArg(arg, fileGraph);
|
|
95425
95335
|
return { callee: deriveHocCallee(type.callee), specifier: resolved.specifier, import: resolved.import };
|
|
95426
95336
|
}
|
|
95427
|
-
function buildHocVia(type, lastArg, fileGraph) {
|
|
95428
|
-
const { callee, specifier, import: imported } = argumentProvenance(type, lastArg, fileGraph);
|
|
95337
|
+
function buildHocVia(graph, type, lastArg, fileGraph) {
|
|
95338
|
+
const { callee, specifier, import: imported } = argumentProvenance(graph, type, lastArg, fileGraph);
|
|
95429
95339
|
return { kind: "hoc-wrapper", hocCallee: callee, specifier, import: imported };
|
|
95430
95340
|
}
|
|
95431
95341
|
function foldedArgument(graph, fileGraph, call, jsx, argMap) {
|
|
@@ -95433,7 +95343,7 @@ function foldedArgument(graph, fileGraph, call, jsx, argMap) {
|
|
|
95433
95343
|
const arg = call.args[index];
|
|
95434
95344
|
if (arg === void 0 || jsx.length === 0)
|
|
95435
95345
|
return null;
|
|
95436
|
-
const via = buildHocVia(call, arg, fileGraph);
|
|
95346
|
+
const via = buildHocVia(graph, call, arg, fileGraph);
|
|
95437
95347
|
return jsx.every((t3) => t3.viaTrail[0] !== void 0 && sameHocVia(t3.viaTrail[0], via)) ? { arg, via } : null;
|
|
95438
95348
|
}
|
|
95439
95349
|
function sameHocVia(a3, b) {
|
|
@@ -95505,14 +95415,8 @@ function fileGraphForDynamicImport(graph, di, fallback) {
|
|
|
95505
95415
|
}
|
|
95506
95416
|
function dynamicImportIdentity(graph, fileGraph, di) {
|
|
95507
95417
|
const origin = fileGraphForDynamicImport(graph, di, fileGraph);
|
|
95508
|
-
const
|
|
95509
|
-
|
|
95510
|
-
return workspaceSiblingIdentity(graph, origin, di.specifier, importedName) ?? relativeChainLocalIdentity(graph, origin, di.specifier, importedName) ?? memberLocalIdentity(graph, origin, di.specifier, importedName) ?? {
|
|
95511
|
-
kind: "imported",
|
|
95512
|
-
specifier: di.specifier,
|
|
95513
|
-
imported: importedName,
|
|
95514
|
-
resolvedFile
|
|
95515
|
-
};
|
|
95418
|
+
const binding2 = resolveModuleExport(graph, origin.filePath, di.specifier, di.projection[0] ?? "default", []);
|
|
95419
|
+
return bindingIdentity(pinUnparsed(graph, binding2));
|
|
95516
95420
|
}
|
|
95517
95421
|
function walkTypeOf(graph, fileGraph, type, argMap, guard, fallback, position) {
|
|
95518
95422
|
if (guard.pushNode(type) === "cycle") {
|
|
@@ -95529,22 +95433,12 @@ function walkTypeOf(graph, fileGraph, type, argMap, guard, fallback, position) {
|
|
|
95529
95433
|
if (inner.every((t3) => t3.identity !== null))
|
|
95530
95434
|
return inner;
|
|
95531
95435
|
const derived = position === "tag" && inner.some((t3) => t3.identity === null && isCallable(t3)) || resolved.kind !== "ParameterOf" && evalKind(resolved, graph, innerGraph, argMap) === "component" ? deriveIdentity(type, fileGraph, graph) : null;
|
|
95532
|
-
const
|
|
95533
|
-
const stamp = self2 ?? deriveIdentity(fallback, fileGraph, graph);
|
|
95436
|
+
const stamp = derived ?? deriveIdentity(fallback, fileGraph, graph);
|
|
95534
95437
|
return inner.map((t3) => t3.identity === null ? { denotation: t3.denotation, viaTrail: t3.viaTrail, identity: stamp, semantics: t3.semantics } : t3);
|
|
95535
95438
|
} finally {
|
|
95536
95439
|
guard.popNode(type);
|
|
95537
95440
|
}
|
|
95538
95441
|
}
|
|
95539
|
-
function withOwnDeclaration(identity, graph, fileGraph, ref) {
|
|
95540
|
-
if (identity === null || identity.kind !== "local" || ref.memberChain.length > 0)
|
|
95541
|
-
return identity;
|
|
95542
|
-
const lookup2 = fileGraphForRef(graph, ref, fileGraph);
|
|
95543
|
-
if (identity.filePath !== lookup2.filePath || lookup2.importsByLocal.has(ref.symbol))
|
|
95544
|
-
return identity;
|
|
95545
|
-
const declaration2 = findLocalDeclaration(lookup2, ref);
|
|
95546
|
-
return declaration2 === null ? identity : { ...identity, declaration: declaration2 };
|
|
95547
|
-
}
|
|
95548
95442
|
function walkStaticMember(graph, fileGraph, type, argMap, guard, fallback, position) {
|
|
95549
95443
|
if (guard.pushNode(type) === "cycle") {
|
|
95550
95444
|
return [indeterminateTerminal()];
|
|
@@ -95599,7 +95493,7 @@ function foldCall(graph, fileGraph, type, argMap, guard, position) {
|
|
|
95599
95493
|
}
|
|
95600
95494
|
let inner2;
|
|
95601
95495
|
try {
|
|
95602
|
-
const target = resolveDynamicImportTarget(graph, fileGraph, syntheticDI
|
|
95496
|
+
const target = resolveDynamicImportTarget(graph, fileGraph, syntheticDI);
|
|
95603
95497
|
inner2 = target ? walkInner(graph, target.targetFileGraph, target.value, argMap, guard, void 0, position) : walkInner(graph, fileGraph, syntheticDI, argMap, guard, void 0, position);
|
|
95604
95498
|
} finally {
|
|
95605
95499
|
guard.pop(syntheticDI.originFile, guardKey);
|
|
@@ -95631,7 +95525,7 @@ function foldCall(graph, fileGraph, type, argMap, guard, position) {
|
|
|
95631
95525
|
const wrapped = type.args[passThroughIndex];
|
|
95632
95526
|
if (wrapped !== void 0) {
|
|
95633
95527
|
const inner2 = walkInner(graph, fileGraph, wrapped, argMap, guard, void 0, position);
|
|
95634
|
-
return foldToWrappedArg(inner2, buildHocVia(type, wrapped, fileGraph));
|
|
95528
|
+
return foldToWrappedArg(inner2, buildHocVia(graph, type, wrapped, fileGraph));
|
|
95635
95529
|
}
|
|
95636
95530
|
}
|
|
95637
95531
|
const algResult = foldTerminals(graph, fileGraph, resolveType(graph, fileGraph, type, argMap, guard), type);
|
|
@@ -95641,7 +95535,7 @@ function foldCall(graph, fileGraph, type, argMap, guard, position) {
|
|
|
95641
95535
|
if (lastArg2 !== void 0) {
|
|
95642
95536
|
const inner2 = walkInner(graph, fileGraph, lastArg2, argMap, guard, void 0, position);
|
|
95643
95537
|
if (isPassThroughWrapper(algResult, inner2)) {
|
|
95644
|
-
const via = buildHocVia(type, lastArg2, fileGraph);
|
|
95538
|
+
const via = buildHocVia(graph, type, lastArg2, fileGraph);
|
|
95645
95539
|
return inner2.filter((t3) => !cameToNothing(t3)).map((t3) => ({ denotation: t3.denotation, viaTrail: [via, ...t3.viaTrail], identity: t3.identity }));
|
|
95646
95540
|
}
|
|
95647
95541
|
}
|
|
@@ -95661,7 +95555,7 @@ function foldCall(graph, fileGraph, type, argMap, guard, position) {
|
|
|
95661
95555
|
}
|
|
95662
95556
|
return [indeterminateTerminal()];
|
|
95663
95557
|
}
|
|
95664
|
-
return foldToWrappedArg(inner, buildHocVia(type, lastArg, fileGraph));
|
|
95558
|
+
return foldToWrappedArg(inner, buildHocVia(graph, type, lastArg, fileGraph));
|
|
95665
95559
|
}
|
|
95666
95560
|
function passThroughParameterIndex(graph, fileGraph, type, argMap, guard) {
|
|
95667
95561
|
const calleeFns = resolveToFunctions(graph, fileGraph, type.callee, argMap, guard);
|
|
@@ -95821,14 +95715,19 @@ function deriveHocCallee(callee) {
|
|
|
95821
95715
|
return "unknown";
|
|
95822
95716
|
}
|
|
95823
95717
|
}
|
|
95824
|
-
function findImportForLastArg(lastArg, fileGraph) {
|
|
95718
|
+
function findImportForLastArg(graph, lastArg, fileGraph) {
|
|
95825
95719
|
let cur = lastArg;
|
|
95826
95720
|
while (cur.kind === "ReturnTypeOf")
|
|
95827
95721
|
cur = cur.callee;
|
|
95828
95722
|
if (cur.kind !== "TypeOf")
|
|
95829
95723
|
return null;
|
|
95830
95724
|
const imp = fileGraph.importsByLocal.get(cur.ref.symbol);
|
|
95831
|
-
|
|
95725
|
+
if (!imp)
|
|
95726
|
+
return null;
|
|
95727
|
+
const binding2 = resolveBinding(graph, fileGraph, cur.ref);
|
|
95728
|
+
if (binding2.kind === "declaration" && binding2.inScope && binding2.file === fileGraph.filePath)
|
|
95729
|
+
return null;
|
|
95730
|
+
return { specifier: imp.specifier, imported: imp.imported };
|
|
95832
95731
|
}
|
|
95833
95732
|
function resolveAnonymousLastArg(lastArg, fileGraph) {
|
|
95834
95733
|
let cur = lastArg;
|
|
@@ -95872,104 +95771,11 @@ function typeContainsRef(haystack, needle) {
|
|
|
95872
95771
|
return false;
|
|
95873
95772
|
}
|
|
95874
95773
|
}
|
|
95875
|
-
function resolveImportedFile(graph, fileGraph, specifier, imported) {
|
|
95876
|
-
const abs = graph.moduleResolver(fileGraph.filePath, specifier);
|
|
95877
|
-
if (!abs)
|
|
95878
|
-
return null;
|
|
95879
|
-
const key = graph.resolveToGraphKey ? graph.resolveToGraphKey(abs) : abs;
|
|
95880
|
-
if (!key || !imported)
|
|
95881
|
-
return key;
|
|
95882
|
-
return followReExportChain(graph, key, imported)?.file ?? key;
|
|
95883
|
-
}
|
|
95884
|
-
function relativeChainLocalIdentity(graph, fileGraph, specifier, imported) {
|
|
95885
|
-
if (!graph)
|
|
95886
|
-
return null;
|
|
95887
|
-
if (packageNameFromSpecifier(specifier))
|
|
95888
|
-
return null;
|
|
95889
|
-
const abs = graph.moduleResolver(fileGraph.filePath, specifier);
|
|
95890
|
-
if (!abs)
|
|
95891
|
-
return null;
|
|
95892
|
-
const key = graph.resolveToGraphKey ? graph.resolveToGraphKey(abs) : abs;
|
|
95893
|
-
if (!key || !graph.files.has(key))
|
|
95894
|
-
return null;
|
|
95895
|
-
const chained = followReExportChain(graph, key, imported);
|
|
95896
|
-
if (!chained)
|
|
95897
|
-
return null;
|
|
95898
|
-
return { kind: "local", filePath: chained.file, export: chained.localExport };
|
|
95899
|
-
}
|
|
95900
|
-
function workspaceSiblingIdentity(graph, fileGraph, specifier, imported) {
|
|
95901
|
-
if (!graph)
|
|
95902
|
-
return null;
|
|
95903
|
-
if (!packageNameFromSpecifier(specifier))
|
|
95904
|
-
return null;
|
|
95905
|
-
const abs = graph.moduleResolver(fileGraph.filePath, specifier);
|
|
95906
|
-
const key = abs && (graph.resolveToGraphKey ? graph.resolveToGraphKey(abs) : abs);
|
|
95907
|
-
if (!key)
|
|
95908
|
-
return null;
|
|
95909
|
-
const chained = followReExportChain(graph, key, imported);
|
|
95910
|
-
const file = chained?.file ?? key;
|
|
95911
|
-
if (!graph.files.has(file))
|
|
95912
|
-
return null;
|
|
95913
|
-
return { kind: "local", filePath: file, export: chained?.localExport ?? imported };
|
|
95914
|
-
}
|
|
95915
|
-
function memberLocalIdentity(graph, fileGraph, specifier, imported) {
|
|
95916
|
-
if (graph?.workspaceMembership === void 0)
|
|
95917
|
-
return null;
|
|
95918
|
-
const abs = graph.moduleResolver(fileGraph.filePath, specifier);
|
|
95919
|
-
if (!abs)
|
|
95920
|
-
return null;
|
|
95921
|
-
const key = graph.resolveToGraphKey ? graph.resolveToGraphKey(abs) : abs;
|
|
95922
|
-
if (key !== null && graph.files.has(key))
|
|
95923
|
-
return null;
|
|
95924
|
-
const member = unparsedMemberDefinition(graph, abs, imported);
|
|
95925
|
-
if (member === null)
|
|
95926
|
-
return null;
|
|
95927
|
-
return { kind: "local", filePath: member.absFile, export: member.exportName };
|
|
95928
|
-
}
|
|
95929
|
-
function withResidual(identity, residual) {
|
|
95930
|
-
if (identity === null || residual.length === 0)
|
|
95931
|
-
return identity;
|
|
95932
|
-
return identity.kind === "local" ? { ...identity, export: compoundExportName(identity.export, residual) } : { ...identity, imported: compoundExportName(identity.imported, residual) };
|
|
95933
|
-
}
|
|
95934
95774
|
function deriveIdentity(type, fileGraph, graph) {
|
|
95935
|
-
|
|
95936
|
-
|
|
95937
|
-
|
|
95938
|
-
|
|
95939
|
-
if (cur.kind === "TypeOf") {
|
|
95940
|
-
const symbol2 = cur.ref.symbol;
|
|
95941
|
-
const lookup2 = graph ? fileGraphForRef(graph, cur.ref, fileGraph) : fileGraph;
|
|
95942
|
-
const imp = lookup2.importsByLocal.get(symbol2);
|
|
95943
|
-
if (imp) {
|
|
95944
|
-
const imported = effectiveExportName(imp.imported, cur.ref.memberChain);
|
|
95945
|
-
const residual = residualMemberChain(imp.imported, cur.ref.memberChain);
|
|
95946
|
-
const resolvedFile = graph ? resolveImportedFile(graph, lookup2, imp.specifier, imported) : null;
|
|
95947
|
-
const workspaceLocal = workspaceSiblingIdentity(graph, lookup2, imp.specifier, imported);
|
|
95948
|
-
if (workspaceLocal)
|
|
95949
|
-
return withResidual(workspaceLocal, residual);
|
|
95950
|
-
const relativeLocal = relativeChainLocalIdentity(graph, lookup2, imp.specifier, imported);
|
|
95951
|
-
if (relativeLocal)
|
|
95952
|
-
return withResidual(relativeLocal, residual);
|
|
95953
|
-
const memberLocal = memberLocalIdentity(graph, lookup2, imp.specifier, imported);
|
|
95954
|
-
if (memberLocal)
|
|
95955
|
-
return withResidual(memberLocal, residual);
|
|
95956
|
-
return withResidual({
|
|
95957
|
-
kind: "imported",
|
|
95958
|
-
specifier: imp.specifier,
|
|
95959
|
-
imported,
|
|
95960
|
-
resolvedFile
|
|
95961
|
-
}, residual);
|
|
95962
|
-
}
|
|
95963
|
-
for (const [, decl] of lookup2.declarations) {
|
|
95964
|
-
if (decl && decl.symbol === symbol2) {
|
|
95965
|
-
return withResidual({
|
|
95966
|
-
kind: "local",
|
|
95967
|
-
filePath: lookup2.filePath,
|
|
95968
|
-
export: decl.exportedAs ?? symbol2
|
|
95969
|
-
}, cur.ref.memberChain);
|
|
95970
|
-
}
|
|
95971
|
-
}
|
|
95972
|
-
}
|
|
95775
|
+
if (type.kind === "DynamicImport")
|
|
95776
|
+
return dynamicImportIdentity(graph, fileGraph, type);
|
|
95777
|
+
if (type.kind === "TypeOf")
|
|
95778
|
+
return bindingIdentity(pinUnparsed(graph, resolveBinding(graph, fileGraph, type.ref)));
|
|
95973
95779
|
return null;
|
|
95974
95780
|
}
|
|
95975
95781
|
|
|
@@ -96075,7 +95881,7 @@ function resolveTypeInner(graph, fileGraph, type, argMap, guard) {
|
|
|
96075
95881
|
case "Array":
|
|
96076
95882
|
return [{ type, source: null }];
|
|
96077
95883
|
case "DynamicImport": {
|
|
96078
|
-
const target = resolveDynamicImportTarget(graph, fileGraph, type
|
|
95884
|
+
const target = resolveDynamicImportTarget(graph, fileGraph, type);
|
|
96079
95885
|
if (!target)
|
|
96080
95886
|
return [{ type, source: type }];
|
|
96081
95887
|
return resolveType(graph, target.targetFileGraph, target.value, argMap, guard);
|
|
@@ -96084,29 +95890,17 @@ function resolveTypeInner(graph, fileGraph, type, argMap, guard) {
|
|
|
96084
95890
|
return assertNever(type);
|
|
96085
95891
|
}
|
|
96086
95892
|
}
|
|
96087
|
-
function resolveDynamicImportTarget(graph, fileGraph, di
|
|
95893
|
+
function resolveDynamicImportTarget(graph, fileGraph, di) {
|
|
96088
95894
|
const origin = fileGraphForDynamicImport(graph, di, fileGraph);
|
|
96089
|
-
const
|
|
96090
|
-
|
|
96091
|
-
|
|
96092
|
-
|
|
96093
|
-
const chained = followReExportChain(graph, key, di.projection[0] ?? "default");
|
|
96094
|
-
const targetFile = chained ? graph.files.get(chained.file) : void 0;
|
|
96095
|
-
if (!chained || !targetFile)
|
|
96096
|
-
return null;
|
|
96097
|
-
const local = chained.localExport;
|
|
96098
|
-
if (!targetFile.declarations.has(`${MODULE_SCOPE}::${local}`) && !targetFile.importsByLocal.has(local))
|
|
95895
|
+
const b = resolveModuleExport(graph, origin.filePath, di.specifier, di.projection[0] ?? "default", []);
|
|
95896
|
+
const targetFile = b.kind === "declaration" ? b.file : b.kind === "unparsed" && b.mainGap !== void 0 ? b.mainGap.barrel : null;
|
|
95897
|
+
const targetFileGraph = targetFile === null ? void 0 : graph.files.get(targetFile);
|
|
95898
|
+
if (!targetFileGraph)
|
|
96099
95899
|
return null;
|
|
96100
|
-
|
|
96101
|
-
symbol: local,
|
|
96102
|
-
scope: MODULE_SCOPE,
|
|
96103
|
-
memberChain: [],
|
|
96104
|
-
loc: { line: 0, column: 0 }
|
|
96105
|
-
};
|
|
96106
|
-
let value = resolveReference(graph, targetFile, localRef, guard);
|
|
95900
|
+
let value = bindingValue(b);
|
|
96107
95901
|
for (const member of di.projection.slice(1))
|
|
96108
95902
|
value = { kind: "MemberOf", obj: value, member };
|
|
96109
|
-
return { targetFileGraph
|
|
95903
|
+
return { targetFileGraph, value };
|
|
96110
95904
|
}
|
|
96111
95905
|
function resolveToFunctions(graph, fileGraph, type, argMap, guard) {
|
|
96112
95906
|
if (guard.pushNode(type) === "cycle") {
|
|
@@ -96203,6 +95997,282 @@ function resolveToFunctionsInner(graph, fileGraph, type, argMap, guard) {
|
|
|
96203
95997
|
// ../reference-graph/dist/engine/index.js
|
|
96204
95998
|
import { asTagName, computeOccurrenceId, serialiseComponentId, projectPropUsages, parseCompoundExport as parseCompoundExport2 } from "@component-compass/plugin-core";
|
|
96205
95999
|
|
|
96000
|
+
// ../reference-graph/dist/engine/re-export-chain.js
|
|
96001
|
+
function followReExportChain(graph, file, imported) {
|
|
96002
|
+
return walk2(graph, file, imported, /* @__PURE__ */ new Set());
|
|
96003
|
+
}
|
|
96004
|
+
function walk2(graph, file, imported, seen2) {
|
|
96005
|
+
const seenKey = `${file}::${imported}`;
|
|
96006
|
+
if (seen2.has(seenKey))
|
|
96007
|
+
return null;
|
|
96008
|
+
seen2.add(seenKey);
|
|
96009
|
+
const target = graph.files.get(file);
|
|
96010
|
+
if (!target)
|
|
96011
|
+
return null;
|
|
96012
|
+
const exp = exportRecordFor(target, imported);
|
|
96013
|
+
if (exp) {
|
|
96014
|
+
if (exp.kind === "named" && "from" in exp) {
|
|
96015
|
+
const nextAbs = graph.moduleResolver(file, exp.from);
|
|
96016
|
+
if (!nextAbs)
|
|
96017
|
+
return { file, localExport: imported };
|
|
96018
|
+
const nextKey = graphKeyFor(graph, nextAbs);
|
|
96019
|
+
if (!nextKey)
|
|
96020
|
+
return { file, localExport: imported };
|
|
96021
|
+
return walk2(graph, nextKey, exp.fromImported, seen2) ?? {
|
|
96022
|
+
file: nextKey,
|
|
96023
|
+
localExport: exp.fromImported
|
|
96024
|
+
};
|
|
96025
|
+
}
|
|
96026
|
+
if ("local" in exp) {
|
|
96027
|
+
const imp = target.importsByLocal.get(exp.local);
|
|
96028
|
+
if (imp && imp.imported !== "*" && !packageNameFromSpecifier(imp.specifier)) {
|
|
96029
|
+
const nextAbs = graph.moduleResolver(file, imp.specifier);
|
|
96030
|
+
const nextKey = nextAbs ? graphKeyFor(graph, nextAbs) : null;
|
|
96031
|
+
if (nextKey) {
|
|
96032
|
+
const leaf = walk2(graph, nextKey, imp.imported, seen2);
|
|
96033
|
+
if (leaf)
|
|
96034
|
+
return leaf;
|
|
96035
|
+
if (graph.lazyReExportResolution && !graph.files.has(nextKey)) {
|
|
96036
|
+
return { file: nextKey, localExport: imp.imported };
|
|
96037
|
+
}
|
|
96038
|
+
}
|
|
96039
|
+
}
|
|
96040
|
+
return { file, localExport: exp.local };
|
|
96041
|
+
}
|
|
96042
|
+
return { file, localExport: imported };
|
|
96043
|
+
}
|
|
96044
|
+
for (const starExp of target.exports) {
|
|
96045
|
+
if (starExp.kind !== "star")
|
|
96046
|
+
continue;
|
|
96047
|
+
const nextAbs = graph.moduleResolver(file, starExp.from);
|
|
96048
|
+
if (!nextAbs)
|
|
96049
|
+
continue;
|
|
96050
|
+
const nextKey = graphKeyFor(graph, nextAbs);
|
|
96051
|
+
if (!nextKey)
|
|
96052
|
+
continue;
|
|
96053
|
+
const result2 = walk2(graph, nextKey, imported, seen2);
|
|
96054
|
+
if (result2)
|
|
96055
|
+
return result2;
|
|
96056
|
+
}
|
|
96057
|
+
return null;
|
|
96058
|
+
}
|
|
96059
|
+
|
|
96060
|
+
// ../reference-graph/dist/engine/helper-callers.js
|
|
96061
|
+
function classifyDeclaration(decl, registry, fileGraph) {
|
|
96062
|
+
if (decl.value.kind !== "Function" && decl.value.kind !== "ReturnTypeOf")
|
|
96063
|
+
return "unknown";
|
|
96064
|
+
if (fileGraph.dialect === "vue" && isSfcDeclaration(fileGraph, decl))
|
|
96065
|
+
return "component";
|
|
96066
|
+
return registry.hasLocal(fileGraph.filePath, decl.symbol) ? "component" : "helper";
|
|
96067
|
+
}
|
|
96068
|
+
var isSfcDeclaration = (fileGraph, decl) => fileGraph.exports.some((e) => e.kind === "default" && "local" in e && e.local === decl.symbol);
|
|
96069
|
+
function buildHelperCallers(graph, registry) {
|
|
96070
|
+
const index = /* @__PURE__ */ new Map();
|
|
96071
|
+
const callerKeysByHelper = /* @__PURE__ */ new Map();
|
|
96072
|
+
const classificationCache = /* @__PURE__ */ new Map();
|
|
96073
|
+
const refResolutionCache = /* @__PURE__ */ new Map();
|
|
96074
|
+
function resolveRefCached(ref, callerFile, callerGraph) {
|
|
96075
|
+
const key = `${callerFile}::${ref.symbol}`;
|
|
96076
|
+
if (refResolutionCache.has(key)) {
|
|
96077
|
+
return refResolutionCache.get(key) ?? null;
|
|
96078
|
+
}
|
|
96079
|
+
const result2 = resolveRefToDecl(ref, callerFile, callerGraph, graph);
|
|
96080
|
+
refResolutionCache.set(key, result2);
|
|
96081
|
+
return result2;
|
|
96082
|
+
}
|
|
96083
|
+
const pendingValueRefs = [];
|
|
96084
|
+
for (const [file, fileGraph] of graph.files) {
|
|
96085
|
+
for (const decl of fileGraph.declarations.values()) {
|
|
96086
|
+
if (decl.scope !== MODULE_SCOPE)
|
|
96087
|
+
continue;
|
|
96088
|
+
const refs = [];
|
|
96089
|
+
if (decl.value.kind === "Function") {
|
|
96090
|
+
for (const r2 of decl.value.returns)
|
|
96091
|
+
collectRefsInType(r2, refs);
|
|
96092
|
+
} else if (decl.value.kind === "ReturnTypeOf") {
|
|
96093
|
+
collectCalleeRefs(decl.value, refs);
|
|
96094
|
+
}
|
|
96095
|
+
for (const bc of fileGraph.bodyCalls) {
|
|
96096
|
+
if (bc.ownerSymbol === decl.symbol)
|
|
96097
|
+
refs.push(bc.callee);
|
|
96098
|
+
}
|
|
96099
|
+
const callerKey = { file, symbol: decl.symbol };
|
|
96100
|
+
for (const ref of refs) {
|
|
96101
|
+
const target = resolveRefCached(ref, file, fileGraph);
|
|
96102
|
+
if (!target)
|
|
96103
|
+
continue;
|
|
96104
|
+
pendingValueRefs.push({ target, caller: callerKey });
|
|
96105
|
+
}
|
|
96106
|
+
}
|
|
96107
|
+
}
|
|
96108
|
+
const pendingJsxCalls = [];
|
|
96109
|
+
for (const [file, fileGraph] of graph.files) {
|
|
96110
|
+
for (let i2 = 0; i2 < fileGraph.jsxUsages.length; i2++) {
|
|
96111
|
+
const usage = fileGraph.jsxUsages[i2];
|
|
96112
|
+
if (!usage)
|
|
96113
|
+
continue;
|
|
96114
|
+
const target = resolveRefCached(usage.ref, file, fileGraph);
|
|
96115
|
+
if (!target)
|
|
96116
|
+
continue;
|
|
96117
|
+
const ownership = fileGraph.ownership[i2];
|
|
96118
|
+
if (!ownership?.ownerSymbolRef)
|
|
96119
|
+
continue;
|
|
96120
|
+
const callerTarget = resolveRefCached(ownership.ownerSymbolRef, file, fileGraph);
|
|
96121
|
+
if (!callerTarget)
|
|
96122
|
+
continue;
|
|
96123
|
+
if (callerTarget.decl.scope !== MODULE_SCOPE)
|
|
96124
|
+
continue;
|
|
96125
|
+
pendingJsxCalls.push({
|
|
96126
|
+
target,
|
|
96127
|
+
caller: { file: callerTarget.file, symbol: callerTarget.decl.symbol }
|
|
96128
|
+
});
|
|
96129
|
+
}
|
|
96130
|
+
}
|
|
96131
|
+
function classifyKey(file, decl) {
|
|
96132
|
+
const key = `${file}::${decl.symbol}`;
|
|
96133
|
+
const hit = classificationCache.get(key);
|
|
96134
|
+
if (hit !== void 0)
|
|
96135
|
+
return hit;
|
|
96136
|
+
const fileGraph = graph.files.get(file);
|
|
96137
|
+
const result2 = fileGraph ? classifyDeclaration(decl, registry, fileGraph) : "unknown";
|
|
96138
|
+
classificationCache.set(key, result2);
|
|
96139
|
+
return result2;
|
|
96140
|
+
}
|
|
96141
|
+
for (const [file, fileGraph] of graph.files) {
|
|
96142
|
+
for (const decl of fileGraph.declarations.values()) {
|
|
96143
|
+
if (decl.scope !== MODULE_SCOPE)
|
|
96144
|
+
continue;
|
|
96145
|
+
if (decl.value.kind !== "Function" && decl.value.kind !== "ReturnTypeOf")
|
|
96146
|
+
continue;
|
|
96147
|
+
classifyKey(file, decl);
|
|
96148
|
+
}
|
|
96149
|
+
}
|
|
96150
|
+
function recordCallerEdge(target, callerKey) {
|
|
96151
|
+
const keyStr = `${target.file}::${target.decl.symbol}`;
|
|
96152
|
+
const callerKeyStr = `${callerKey.file}::${callerKey.symbol}`;
|
|
96153
|
+
let seen2 = callerKeysByHelper.get(keyStr);
|
|
96154
|
+
if (!seen2) {
|
|
96155
|
+
seen2 = /* @__PURE__ */ new Set();
|
|
96156
|
+
callerKeysByHelper.set(keyStr, seen2);
|
|
96157
|
+
}
|
|
96158
|
+
if (seen2.has(callerKeyStr))
|
|
96159
|
+
return;
|
|
96160
|
+
seen2.add(callerKeyStr);
|
|
96161
|
+
let callers = index.get(keyStr);
|
|
96162
|
+
if (!callers) {
|
|
96163
|
+
callers = /* @__PURE__ */ new Set();
|
|
96164
|
+
index.set(keyStr, callers);
|
|
96165
|
+
}
|
|
96166
|
+
callers.add(callerKey);
|
|
96167
|
+
}
|
|
96168
|
+
for (const { target, caller } of pendingValueRefs) {
|
|
96169
|
+
if (classifyKey(target.file, target.decl) !== "helper")
|
|
96170
|
+
continue;
|
|
96171
|
+
recordCallerEdge(target, caller);
|
|
96172
|
+
}
|
|
96173
|
+
for (const { target, caller } of pendingJsxCalls) {
|
|
96174
|
+
if (classifyKey(target.file, target.decl) !== "helper")
|
|
96175
|
+
continue;
|
|
96176
|
+
recordCallerEdge(target, caller);
|
|
96177
|
+
}
|
|
96178
|
+
return {
|
|
96179
|
+
get(key) {
|
|
96180
|
+
return index.get(`${key.file}::${key.symbol}`);
|
|
96181
|
+
},
|
|
96182
|
+
classification(file, symbol2) {
|
|
96183
|
+
return classificationCache.get(`${file}::${symbol2}`) ?? "unknown";
|
|
96184
|
+
}
|
|
96185
|
+
};
|
|
96186
|
+
}
|
|
96187
|
+
function collectCalleeRefs(t3, out2) {
|
|
96188
|
+
switch (t3.kind) {
|
|
96189
|
+
case "ReturnTypeOf":
|
|
96190
|
+
collectCalleeRefs(t3.callee, out2);
|
|
96191
|
+
return;
|
|
96192
|
+
case "MemberOf":
|
|
96193
|
+
collectCalleeRefs(t3.obj, out2);
|
|
96194
|
+
return;
|
|
96195
|
+
case "TypeOf":
|
|
96196
|
+
out2.push(t3.ref);
|
|
96197
|
+
return;
|
|
96198
|
+
default:
|
|
96199
|
+
return;
|
|
96200
|
+
}
|
|
96201
|
+
}
|
|
96202
|
+
function collectRefsInType(t3, out2) {
|
|
96203
|
+
switch (t3.kind) {
|
|
96204
|
+
case "TypeOf":
|
|
96205
|
+
out2.push(t3.ref);
|
|
96206
|
+
return;
|
|
96207
|
+
case "Union":
|
|
96208
|
+
for (const u3 of t3.types)
|
|
96209
|
+
collectRefsInType(u3, out2);
|
|
96210
|
+
return;
|
|
96211
|
+
case "ReturnTypeOf":
|
|
96212
|
+
collectRefsInType(t3.callee, out2);
|
|
96213
|
+
for (const a3 of t3.args)
|
|
96214
|
+
collectRefsInType(a3, out2);
|
|
96215
|
+
return;
|
|
96216
|
+
case "Function":
|
|
96217
|
+
for (const r2 of t3.returns)
|
|
96218
|
+
collectRefsInType(r2, out2);
|
|
96219
|
+
return;
|
|
96220
|
+
case "Object":
|
|
96221
|
+
for (const v of Object.values(t3.props))
|
|
96222
|
+
collectRefsInType(v, out2);
|
|
96223
|
+
return;
|
|
96224
|
+
case "Array":
|
|
96225
|
+
for (const e of t3.elements)
|
|
96226
|
+
collectRefsInType(e, out2);
|
|
96227
|
+
return;
|
|
96228
|
+
case "MemberOf":
|
|
96229
|
+
collectRefsInType(t3.obj, out2);
|
|
96230
|
+
return;
|
|
96231
|
+
case "ParameterOf":
|
|
96232
|
+
return;
|
|
96233
|
+
default:
|
|
96234
|
+
return;
|
|
96235
|
+
}
|
|
96236
|
+
}
|
|
96237
|
+
function resolveRefToDecl(ref, callerFile, callerGraph, graph) {
|
|
96238
|
+
const localKey = `${MODULE_SCOPE}::${ref.symbol}`;
|
|
96239
|
+
const localDecl = callerGraph.declarations.get(localKey);
|
|
96240
|
+
if (localDecl)
|
|
96241
|
+
return { file: callerFile, decl: localDecl };
|
|
96242
|
+
const imp = callerGraph.importsByLocal.get(ref.symbol);
|
|
96243
|
+
if (!imp)
|
|
96244
|
+
return null;
|
|
96245
|
+
const resolvedAbs = graph.moduleResolver(callerFile, imp.specifier);
|
|
96246
|
+
if (!resolvedAbs)
|
|
96247
|
+
return null;
|
|
96248
|
+
const targetFile = graphKeyFor(graph, resolvedAbs) ?? resolvedAbs;
|
|
96249
|
+
const targetGraph = graph.files.get(targetFile);
|
|
96250
|
+
if (!targetGraph)
|
|
96251
|
+
return null;
|
|
96252
|
+
const chained = followReExportChain(graph, targetFile, imp.imported);
|
|
96253
|
+
if (chained) {
|
|
96254
|
+
const chainedGraph = graph.files.get(chained.file);
|
|
96255
|
+
if (chainedGraph) {
|
|
96256
|
+
const decl = chainedGraph.declarations.get(`${MODULE_SCOPE}::${chained.localExport}`);
|
|
96257
|
+
if (decl)
|
|
96258
|
+
return { file: chained.file, decl };
|
|
96259
|
+
}
|
|
96260
|
+
}
|
|
96261
|
+
for (const exp of targetGraph.exports) {
|
|
96262
|
+
if (exp.kind === "named" && "local" in exp && exp.exportedAs === imp.imported) {
|
|
96263
|
+
const decl = targetGraph.declarations.get(`${MODULE_SCOPE}::${exp.local}`);
|
|
96264
|
+
if (decl)
|
|
96265
|
+
return { file: targetFile, decl };
|
|
96266
|
+
}
|
|
96267
|
+
if (exp.kind === "default" && "local" in exp && imp.imported === "default") {
|
|
96268
|
+
const decl = targetGraph.declarations.get(`${MODULE_SCOPE}::${exp.local}`);
|
|
96269
|
+
if (decl)
|
|
96270
|
+
return { file: targetFile, decl };
|
|
96271
|
+
}
|
|
96272
|
+
}
|
|
96273
|
+
return null;
|
|
96274
|
+
}
|
|
96275
|
+
|
|
96206
96276
|
// ../reference-graph/dist/engine/owner-resolution.js
|
|
96207
96277
|
function resolveOwnerChain(ownerRef, graph, helperIndex, guard) {
|
|
96208
96278
|
if (!ownerRef)
|
|
@@ -96264,24 +96334,10 @@ function narrowTo(registry, entries) {
|
|
|
96264
96334
|
isComponent: (filePath, name, declaration2) => registry.isComponent(filePath, name, declaration2),
|
|
96265
96335
|
declarationOf: (filePath, exportName) => registry.declarationOf(filePath, exportName),
|
|
96266
96336
|
isRenderedAsTag: (entry) => registry.isRenderedAsTag(entry),
|
|
96267
|
-
isTagged: (
|
|
96337
|
+
isTagged: (declaration2) => registry.isTagged(declaration2),
|
|
96268
96338
|
localEntries: () => entries
|
|
96269
96339
|
};
|
|
96270
96340
|
}
|
|
96271
|
-
var CAN_HOLD_A_FUNCTION = {
|
|
96272
|
-
TypeOf: true,
|
|
96273
|
-
Function: true,
|
|
96274
|
-
ReturnTypeOf: true,
|
|
96275
|
-
ParameterOf: false,
|
|
96276
|
-
MemberOf: true,
|
|
96277
|
-
Union: true,
|
|
96278
|
-
Object: false,
|
|
96279
|
-
Array: false,
|
|
96280
|
-
JSX: false,
|
|
96281
|
-
Str: false,
|
|
96282
|
-
Unknown: false,
|
|
96283
|
-
DynamicImport: true
|
|
96284
|
-
};
|
|
96285
96341
|
function buildComponentRegistry(graph, tagged = []) {
|
|
96286
96342
|
const consumed = /* @__PURE__ */ new Set();
|
|
96287
96343
|
for (const [file, fg] of graph.files) {
|
|
@@ -96304,25 +96360,8 @@ function buildComponentRegistry(graph, tagged = []) {
|
|
|
96304
96360
|
consumed.add(entryKey(target.file, target.symbol));
|
|
96305
96361
|
}
|
|
96306
96362
|
}
|
|
96307
|
-
const
|
|
96308
|
-
|
|
96309
|
-
if (fg === void 0)
|
|
96310
|
-
return void 0;
|
|
96311
|
-
if (declaration2 !== void 0)
|
|
96312
|
-
return declaration2;
|
|
96313
|
-
const named = findDeclaration(fg, name);
|
|
96314
|
-
return named !== void 0 && CAN_HOLD_A_FUNCTION[named.value.kind] ? named : void 0;
|
|
96315
|
-
};
|
|
96316
|
-
const renderedAsTag = /* @__PURE__ */ new Set();
|
|
96317
|
-
for (const { filePath, exportName, declaration: declaration2 } of tagged) {
|
|
96318
|
-
const marked = taggedDeclaration(filePath, exportName, declaration2);
|
|
96319
|
-
if (marked !== void 0)
|
|
96320
|
-
renderedAsTag.add(marked);
|
|
96321
|
-
}
|
|
96322
|
-
const isTagged = (filePath, name, declaration2) => {
|
|
96323
|
-
const marked = taggedDeclaration(filePath, name, declaration2);
|
|
96324
|
-
return marked !== void 0 && renderedAsTag.has(marked);
|
|
96325
|
-
};
|
|
96363
|
+
const renderedAsTag = new Set(tagged);
|
|
96364
|
+
const isTagged = (declaration2) => declaration2 !== void 0 && renderedAsTag.has(declaration2);
|
|
96326
96365
|
const byKey = /* @__PURE__ */ new Map();
|
|
96327
96366
|
const entryIndex = /* @__PURE__ */ new Map();
|
|
96328
96367
|
const entries = [];
|
|
@@ -96473,7 +96512,7 @@ function resolve5(graph, opts) {
|
|
|
96473
96512
|
const argMap = createArgumentMap();
|
|
96474
96513
|
const tagEvaluations = /* @__PURE__ */ new Map();
|
|
96475
96514
|
for (const [filePath, fileGraph] of graph.files) {
|
|
96476
|
-
tagEvaluations.set(filePath, fileGraph.jsxUsages.map((usage) => evaluateJsxUsage(graph,
|
|
96515
|
+
tagEvaluations.set(filePath, fileGraph.jsxUsages.map((usage) => evaluateJsxUsage(graph, fileGraph, usage, argMap)));
|
|
96477
96516
|
}
|
|
96478
96517
|
const registry = buildComponentRegistry(graph, taggedDeclarations(graph, tagEvaluations));
|
|
96479
96518
|
const helperIndex = buildHelperCallers(graph, excludeHostElementNames(registry, graph));
|
|
@@ -96715,32 +96754,6 @@ function relabelExternalLeaf(rawComponentId, filePath, specifier, resolveExterna
|
|
|
96715
96754
|
source: externalSource(hit.leafPackage, `${hit.leafPackage}/${hit.modulePath}`)
|
|
96716
96755
|
};
|
|
96717
96756
|
}
|
|
96718
|
-
function workspaceSiblingFallback(graph, resolvedTarget, matchedImport, effectiveImported, consumerDialect) {
|
|
96719
|
-
if (!resolvedTarget)
|
|
96720
|
-
return void 0;
|
|
96721
|
-
const chained = followReExportChain(graph, resolvedTarget, effectiveImported);
|
|
96722
|
-
const canonicalFile = chained?.file ?? resolvedTarget;
|
|
96723
|
-
let exportName = chained?.localExport ?? effectiveImported;
|
|
96724
|
-
if (!chained) {
|
|
96725
|
-
const target = graph.files.get(resolvedTarget);
|
|
96726
|
-
if (!target)
|
|
96727
|
-
return void 0;
|
|
96728
|
-
if (effectiveImported === "default") {
|
|
96729
|
-
const def = target.exports.find((e) => e.kind === "default");
|
|
96730
|
-
if (def && "local" in def)
|
|
96731
|
-
exportName = def.local;
|
|
96732
|
-
} else {
|
|
96733
|
-
const named = target.exports.find((e) => e.kind === "named" && "exportedAs" in e && e.exportedAs === effectiveImported && "local" in e);
|
|
96734
|
-
if (named && "local" in named)
|
|
96735
|
-
exportName = named.local;
|
|
96736
|
-
}
|
|
96737
|
-
}
|
|
96738
|
-
return {
|
|
96739
|
-
kind: componentKindFor(consumerDialect),
|
|
96740
|
-
export: exportName,
|
|
96741
|
-
source: { type: "local", filePath: canonicalFile }
|
|
96742
|
-
};
|
|
96743
|
-
}
|
|
96744
96757
|
function emitOccurrence(occurrences, site, rawComponentId, owners, chain, definition) {
|
|
96745
96758
|
const provisionalId = serialiseComponentId(rawComponentId);
|
|
96746
96759
|
for (const { rawOwnerComponentId, viaPrefix } of owners) {
|
|
@@ -96785,136 +96798,74 @@ function usageOwners(graph, helperIndex, ownerRef, viaOverride, fallbackFile) {
|
|
|
96785
96798
|
function namesObjectMember(holder, path5) {
|
|
96786
96799
|
return path5.length === 0 || memberOfObjectPath(holder, path5) !== void 0;
|
|
96787
96800
|
}
|
|
96788
|
-
function evaluateJsxUsage(graph,
|
|
96801
|
+
function evaluateJsxUsage(graph, fileGraph, usage, argMap) {
|
|
96789
96802
|
if (fileGraph.dialect === "react" && isHostElementRoot(usage.ref))
|
|
96790
96803
|
return { kind: "host-element" };
|
|
96791
|
-
const
|
|
96792
|
-
|
|
96793
|
-
|
|
96794
|
-
|
|
96795
|
-
|
|
96796
|
-
|
|
96797
|
-
const evaluation = walkWithFolding(graph, fileGraph, value, argMap, createCycleGuard(), void 0, "tag");
|
|
96798
|
-
const fallback2 = {
|
|
96799
|
-
kind: componentKindFor(fileGraph.dialect),
|
|
96800
|
-
export: compoundExportName(usage.ref.symbol, usage.ref.memberChain),
|
|
96801
|
-
source: { type: "local", filePath }
|
|
96802
|
-
};
|
|
96803
|
-
const definition = { line: decl.loc.line, column: decl.loc.column };
|
|
96804
|
-
const outerVia2 = { kind: "local-component" };
|
|
96805
|
-
const rendered = usage.ref.memberChain.length === 0 ? { declaration: decl } : {};
|
|
96806
|
-
const named = namesObjectMember(decl.value, usage.ref.memberChain);
|
|
96807
|
-
const credits = creditedTerminals(evaluation).filter((t3) => t3.identity !== null || named).map((terminal) => ({
|
|
96808
|
-
terminal,
|
|
96809
|
-
fallback: fallback2,
|
|
96810
|
-
outerVia: outerVia2,
|
|
96811
|
-
...terminal.identity === null ? { definition, ...rendered } : {}
|
|
96812
|
-
}));
|
|
96813
|
-
return { kind: "evaluated", evaluation, value, credits };
|
|
96814
|
-
}
|
|
96815
|
-
const packageName = packageNameFromSpecifier(matchedImport.specifier);
|
|
96816
|
-
const effectiveImported = effectiveExportName(matchedImport.imported, usage.ref.memberChain);
|
|
96817
|
-
const residual = residualMemberChain(matchedImport.imported, usage.ref.memberChain);
|
|
96818
|
-
const holderDecl = (file, exportName) => {
|
|
96819
|
-
const holderFile = graph.files.get(file);
|
|
96820
|
-
return holderFile === void 0 ? void 0 : findDeclaration(holderFile, exportName);
|
|
96821
|
-
};
|
|
96822
|
-
const holderDefinition = (file, exportName) => {
|
|
96823
|
-
if (residual.length === 0)
|
|
96824
|
-
return void 0;
|
|
96825
|
-
const loc = holderDecl(file, exportName)?.loc;
|
|
96826
|
-
return loc === void 0 ? void 0 : { line: loc.line, column: loc.column };
|
|
96804
|
+
const binding2 = resolveBinding(graph, fileGraph, usage.ref);
|
|
96805
|
+
const imp = fileGraph.importsByLocal.get(usage.ref.symbol);
|
|
96806
|
+
const walkTag = (value) => walkWithFolding(graph, fileGraph, value, argMap, createCycleGuard(), void 0, "tag");
|
|
96807
|
+
const walked = () => {
|
|
96808
|
+
const value = bindingValue(binding2);
|
|
96809
|
+
return { kind: "evaluated", evaluation: walkTag(value), value, credits: [] };
|
|
96827
96810
|
};
|
|
96828
|
-
|
|
96829
|
-
|
|
96830
|
-
|
|
96831
|
-
|
|
96832
|
-
|
|
96833
|
-
|
|
96834
|
-
|
|
96835
|
-
|
|
96836
|
-
|
|
96837
|
-
|
|
96838
|
-
|
|
96839
|
-
|
|
96840
|
-
|
|
96841
|
-
|
|
96842
|
-
|
|
96843
|
-
|
|
96844
|
-
|
|
96845
|
-
|
|
96846
|
-
|
|
96847
|
-
|
|
96848
|
-
const
|
|
96849
|
-
|
|
96850
|
-
|
|
96851
|
-
|
|
96852
|
-
|
|
96853
|
-
}
|
|
96854
|
-
}
|
|
96855
|
-
|
|
96856
|
-
|
|
96857
|
-
|
|
96858
|
-
|
|
96859
|
-
|
|
96860
|
-
|
|
96861
|
-
|
|
96862
|
-
kind
|
|
96863
|
-
|
|
96864
|
-
|
|
96865
|
-
|
|
96866
|
-
|
|
96867
|
-
|
|
96868
|
-
|
|
96869
|
-
|
|
96870
|
-
|
|
96871
|
-
|
|
96872
|
-
|
|
96873
|
-
|
|
96874
|
-
|
|
96811
|
+
switch (binding2.kind) {
|
|
96812
|
+
// Transitional: these two arms read `walkIdentity`, which only a name or
|
|
96813
|
+
// import that fails inside a parsed file carries, to tell that failure
|
|
96814
|
+
// from the usage's own. They change when those failures stop naming the
|
|
96815
|
+
// parsed file in walks.
|
|
96816
|
+
case "unbound":
|
|
96817
|
+
return binding2.walkIdentity === void 0 ? { kind: "unbound" } : walked();
|
|
96818
|
+
case "import-failed":
|
|
96819
|
+
return binding2.walkIdentity === void 0 ? { kind: "import-failed", specifier: binding2.specifier } : walked();
|
|
96820
|
+
case "no-export":
|
|
96821
|
+
return walked();
|
|
96822
|
+
case "declaration": {
|
|
96823
|
+
const value = bindingValue(binding2);
|
|
96824
|
+
const evaluation = walkTag(value);
|
|
96825
|
+
const declared = makeLocalComponentId(binding2.file, compoundExportName(binding2.decl.symbol, binding2.path), fileGraph.dialect);
|
|
96826
|
+
const fallback = buildComponentId(bindingIdentity(binding2), declared, fileGraph.dialect);
|
|
96827
|
+
const holder = binding2.walkIdentity === void 0 ? binding2.decl : void 0;
|
|
96828
|
+
const definition = holder !== void 0 && (binding2.inScope || binding2.path.length > 0) ? { line: holder.loc.line, column: holder.loc.column } : void 0;
|
|
96829
|
+
const rendered = holder !== void 0 && binding2.path.length === 0 ? { declaration: holder } : {};
|
|
96830
|
+
const namesMember = namesObjectMember(holder?.value, binding2.path);
|
|
96831
|
+
const outerVia = binding2.inScope || imp === void 0 ? { kind: "local-component" } : { kind: "direct-import", specifier: imp.specifier, import: imp.imported };
|
|
96832
|
+
const credits = creditedTerminals(evaluation).filter((terminal) => terminal.identity !== null || namesMember).map((terminal) => ({
|
|
96833
|
+
terminal,
|
|
96834
|
+
fallback,
|
|
96835
|
+
outerVia,
|
|
96836
|
+
...terminal.identity === null ? { ...definition !== void 0 ? { definition } : {}, ...rendered } : {}
|
|
96837
|
+
}));
|
|
96838
|
+
return { kind: "evaluated", evaluation, value, credits };
|
|
96839
|
+
}
|
|
96840
|
+
case "package-export":
|
|
96841
|
+
case "unparsed": {
|
|
96842
|
+
if (binding2.mainGap !== void 0 || imp === void 0 || binding2.kind === "unparsed" && packageNameFromSpecifier(imp.specifier) === null) {
|
|
96843
|
+
return walked();
|
|
96844
|
+
}
|
|
96845
|
+
const pinned = binding2.kind === "unparsed" ? pinUnparsed(graph, binding2) : binding2;
|
|
96846
|
+
const sentinel = { denotation: { kind: "foreign" }, viaTrail: [], identity: null };
|
|
96847
|
+
const fallback = {
|
|
96848
|
+
kind: componentKindFor(fileGraph.dialect),
|
|
96849
|
+
export: compoundExportName(pinned.exportName, pinned.path),
|
|
96850
|
+
source: pinned.kind === "unparsed" ? { type: "local", filePath: pinned.file } : externalSource(packageNameFromSpecifier(pinned.specifier) ?? pinned.specifier, pinned.specifier)
|
|
96851
|
+
};
|
|
96852
|
+
return {
|
|
96853
|
+
kind: "evaluated",
|
|
96854
|
+
evaluation: [sentinel],
|
|
96855
|
+
value: null,
|
|
96856
|
+
credits: [
|
|
96857
|
+
{
|
|
96858
|
+
terminal: sentinel,
|
|
96859
|
+
fallback,
|
|
96860
|
+
fallbackSpecifier: pinned.kind === "package-export" ? pinned.specifier : imp.specifier,
|
|
96861
|
+
outerVia: { kind: "direct-import", specifier: imp.specifier, import: imp.imported }
|
|
96862
|
+
}
|
|
96863
|
+
]
|
|
96864
|
+
};
|
|
96865
|
+
}
|
|
96866
|
+
default:
|
|
96867
|
+
return assertNever(binding2);
|
|
96875
96868
|
}
|
|
96876
|
-
const externalFallback = {
|
|
96877
|
-
kind: componentKindFor(fileGraph.dialect),
|
|
96878
|
-
export: compoundExportName(effectiveImported, residual),
|
|
96879
|
-
source: externalSource(packageName, matchedImport.specifier)
|
|
96880
|
-
};
|
|
96881
|
-
const resolvedAbsTarget = graph.moduleResolver(filePath, matchedImport.specifier);
|
|
96882
|
-
const resolvedNormTarget = resolvedAbsTarget !== null && graph.resolveToGraphKey ? graph.resolveToGraphKey(resolvedAbsTarget) ?? resolvedAbsTarget : resolvedAbsTarget;
|
|
96883
|
-
const targetInGraph = resolvedNormTarget !== null && graph.files.has(resolvedNormTarget);
|
|
96884
|
-
if (targetInGraph) {
|
|
96885
|
-
const refType = resolveReference(graph, fileGraph, usage.ref);
|
|
96886
|
-
const evaluation = walkWithFolding(graph, fileGraph, refType, argMap, createCycleGuard(), void 0, "tag");
|
|
96887
|
-
const jsxTerminals = creditedTerminals(evaluation);
|
|
96888
|
-
if (jsxTerminals.length === 0)
|
|
96889
|
-
return { kind: "evaluated", evaluation, value: refType, credits: [] };
|
|
96890
|
-
const siblingFallback = workspaceSiblingFallback(graph, resolvedNormTarget, matchedImport, effectiveImported, fileGraph.dialect);
|
|
96891
|
-
const localFallback = siblingFallback !== void 0 && siblingFallback.kind !== "custom-element" ? { ...siblingFallback, export: compoundExportName(siblingFallback.export, residual) } : siblingFallback;
|
|
96892
|
-
const localHolder = siblingFallback !== void 0 && siblingFallback.kind !== "custom-element" && siblingFallback.source.type === "local" ? { filePath: siblingFallback.source.filePath, exportName: siblingFallback.export } : void 0;
|
|
96893
|
-
const definition = localHolder === void 0 ? void 0 : holderDefinition(localHolder.filePath, localHolder.exportName);
|
|
96894
|
-
const named = localHolder === void 0 || namesHolderMember(localHolder.filePath, localHolder.exportName);
|
|
96895
|
-
const fallback2 = localFallback ?? externalFallback;
|
|
96896
|
-
const credits = jsxTerminals.filter((t3) => t3.identity !== null || named).map((terminal) => ({
|
|
96897
|
-
terminal,
|
|
96898
|
-
fallback: fallback2,
|
|
96899
|
-
fallbackSpecifier: matchedImport.specifier,
|
|
96900
|
-
outerVia,
|
|
96901
|
-
...terminal.identity === null && definition !== void 0 ? { definition } : {}
|
|
96902
|
-
}));
|
|
96903
|
-
return { kind: "evaluated", evaluation, value: refType, credits };
|
|
96904
|
-
}
|
|
96905
|
-
const member = resolvedAbsTarget !== null ? unparsedMemberDefinition(graph, resolvedAbsTarget, effectiveImported) : null;
|
|
96906
|
-
const sentinel = { denotation: { kind: "foreign" }, viaTrail: [], identity: null };
|
|
96907
|
-
const fallback = member !== null ? {
|
|
96908
|
-
kind: componentKindFor(fileGraph.dialect),
|
|
96909
|
-
export: compoundExportName(member.exportName, residual),
|
|
96910
|
-
source: { type: "local", filePath: member.absFile }
|
|
96911
|
-
} : externalFallback;
|
|
96912
|
-
return {
|
|
96913
|
-
kind: "evaluated",
|
|
96914
|
-
evaluation: [sentinel],
|
|
96915
|
-
value: null,
|
|
96916
|
-
credits: [{ terminal: sentinel, fallback, fallbackSpecifier: matchedImport.specifier, outerVia }]
|
|
96917
|
-
};
|
|
96918
96869
|
}
|
|
96919
96870
|
function carriedDeclaration(credit) {
|
|
96920
96871
|
const { identity } = credit.terminal;
|
|
@@ -96936,7 +96887,8 @@ function taggedDeclarations(graph, tagEvaluations) {
|
|
|
96936
96887
|
const id2 = buildComponentId(identity, credit.fallback, dialect);
|
|
96937
96888
|
if (id2.kind === "react-component" && id2.source.type === "local") {
|
|
96938
96889
|
const declaration2 = carriedDeclaration(credit);
|
|
96939
|
-
|
|
96890
|
+
if (declaration2 !== void 0)
|
|
96891
|
+
tagged.push(declaration2);
|
|
96940
96892
|
}
|
|
96941
96893
|
}
|
|
96942
96894
|
}
|
|
@@ -97054,14 +97006,14 @@ function registryTagged(registry, graph, id2, declaration2) {
|
|
|
97054
97006
|
return true;
|
|
97055
97007
|
if (parseCompoundExport2(id2.export).isCompound)
|
|
97056
97008
|
return true;
|
|
97057
|
-
return registry.isTagged(
|
|
97009
|
+
return registry.isTagged(declaration2);
|
|
97058
97010
|
}
|
|
97059
97011
|
function pushCallArgumentOccurrences(occurrences, filePath, call, owners, graph, fileGraph, argMap, registry, opts, depth = 0) {
|
|
97060
97012
|
let resolvedOwners;
|
|
97061
97013
|
const seedIdentifier = (site, index, arg, hops) => {
|
|
97062
97014
|
if (isHostElementName(arg.ref.symbol))
|
|
97063
97015
|
return;
|
|
97064
|
-
const outerVia = { kind: "passed-as-argument", index, ...argumentProvenance(site, arg, fileGraph) };
|
|
97016
|
+
const outerVia = { kind: "passed-as-argument", index, ...argumentProvenance(graph, site, arg, fileGraph) };
|
|
97065
97017
|
const argDecl = findLocalDeclaration(fileGraph, arg.ref);
|
|
97066
97018
|
const unusedFallback = makeLocalComponentId(filePath, arg.ref.symbol, fileGraph.dialect);
|
|
97067
97019
|
for (const ft of creditedTerminals(walkWithFolding(graph, fileGraph, arg, argMap))) {
|
|
@@ -97071,7 +97023,7 @@ function pushCallArgumentOccurrences(occurrences, filePath, call, owners, graph,
|
|
|
97071
97023
|
filePath,
|
|
97072
97024
|
resolveExternalLeaf: opts?.resolveExternalLeaf
|
|
97073
97025
|
});
|
|
97074
|
-
if (!registryHolds(registry, graph, rawComponentId))
|
|
97026
|
+
if (!registryHolds(registry, graph, rawComponentId, ft.identity.kind === "local" ? ft.identity.declaration : void 0))
|
|
97075
97027
|
continue;
|
|
97076
97028
|
resolvedOwners ??= owners();
|
|
97077
97029
|
emitOccurrence(occurrences, { filePath, line: arg.ref.loc.line, column: arg.ref.loc.column, props: {}, events: [] }, rawComponentId, resolvedOwners, [outerVia, ...hops, ...ft.viaTrail], argDecl !== null ? { line: argDecl.loc.line, column: argDecl.loc.column } : void 0);
|
|
@@ -102177,7 +102129,7 @@ init_upload();
|
|
|
102177
102129
|
import { errorMessage as errorMessage2 } from "@component-compass/ast-utils";
|
|
102178
102130
|
|
|
102179
102131
|
// src/seeds.ts
|
|
102180
|
-
import { relative as relative4, isAbsolute as
|
|
102132
|
+
import { relative as relative4, isAbsolute as isAbsolute9 } from "node:path";
|
|
102181
102133
|
import { posixPath as posixPath6 } from "@component-compass/plugin-core";
|
|
102182
102134
|
|
|
102183
102135
|
// src/composition-rollup.ts
|
|
@@ -102540,7 +102492,7 @@ function buildComponentSeeds(parseResults, localIndex, repoRoot, workspaceGraph,
|
|
|
102540
102492
|
const seedsById = /* @__PURE__ */ new Map();
|
|
102541
102493
|
for (const result2 of parseResults) {
|
|
102542
102494
|
for (const occ of result2.occurrences) {
|
|
102543
|
-
const componentId = repoRoot && occ.componentId.source.type === "local" &&
|
|
102495
|
+
const componentId = repoRoot && occ.componentId.source.type === "local" && isAbsolute9(occ.componentId.source.filePath) ? {
|
|
102544
102496
|
...occ.componentId,
|
|
102545
102497
|
source: {
|
|
102546
102498
|
type: "local",
|
|
@@ -102685,7 +102637,7 @@ function indexedToComponentId(c2) {
|
|
|
102685
102637
|
}
|
|
102686
102638
|
|
|
102687
102639
|
// src/occurrences.ts
|
|
102688
|
-
import { relative as relative5, isAbsolute as
|
|
102640
|
+
import { relative as relative5, isAbsolute as isAbsolute10 } from "node:path";
|
|
102689
102641
|
import { posixPath as posixPath7 } from "@component-compass/plugin-core";
|
|
102690
102642
|
import {
|
|
102691
102643
|
computeOccurrenceId as computeOccurrenceId2,
|
|
@@ -102694,14 +102646,14 @@ import {
|
|
|
102694
102646
|
function normaliseLocalFilePath(c2, repoRoot) {
|
|
102695
102647
|
if (c2.source.type !== "local") return c2;
|
|
102696
102648
|
const fp = c2.source.filePath;
|
|
102697
|
-
if (!
|
|
102649
|
+
if (!isAbsolute10(fp)) return c2;
|
|
102698
102650
|
return {
|
|
102699
102651
|
...c2,
|
|
102700
102652
|
source: { type: "local", filePath: posixPath7(relative5(repoRoot, fp)) }
|
|
102701
102653
|
};
|
|
102702
102654
|
}
|
|
102703
102655
|
function toRelativePath2(absPath, repoRoot) {
|
|
102704
|
-
if (!repoRoot || !
|
|
102656
|
+
if (!repoRoot || !isAbsolute10(absPath)) return absPath;
|
|
102705
102657
|
return posixPath7(relative5(repoRoot, absPath));
|
|
102706
102658
|
}
|
|
102707
102659
|
function parseResultsToOccurrences(results, repoRoot = "") {
|
|
@@ -102901,7 +102853,7 @@ function createBoundedDefinitionResolver(opts) {
|
|
|
102901
102853
|
|
|
102902
102854
|
// src/scan/global-components.ts
|
|
102903
102855
|
import { existsSync as existsSync7, readFileSync as readFileSync11 } from "node:fs";
|
|
102904
|
-
import { dirname as dirname11, isAbsolute as
|
|
102856
|
+
import { dirname as dirname11, isAbsolute as isAbsolute11, join as join14, resolve as resolve10 } from "node:path";
|
|
102905
102857
|
var CANDIDATE_PATHS = [join14(".nuxt", "components.d.ts"), join14(".nuxt", "types", "components.d.ts")];
|
|
102906
102858
|
var AUGMENTED_MODULE = /declare\s+module\s+["'](?:vue|@vue\/runtime-core)["']\s*\{/g;
|
|
102907
102859
|
var INTERFACE_DECL = /(?:^|[\s;}])(?:export\s+)?(?:declare\s+)?interface\s+([A-Za-z_$][\w$]*)\s*(?:extends\s+([^{]*?))?\s*\{/g;
|
|
@@ -102995,7 +102947,7 @@ function loadGlobalComponents(scanRoot) {
|
|
|
102995
102947
|
return null;
|
|
102996
102948
|
}
|
|
102997
102949
|
function isBareSpecifier(importPath) {
|
|
102998
|
-
if (
|
|
102950
|
+
if (isAbsolute11(importPath)) return false;
|
|
102999
102951
|
return !/^[.#~\\/]/.test(importPath) && !importPath.startsWith("@/");
|
|
103000
102952
|
}
|
|
103001
102953
|
function parseMembers(baseDir, members) {
|
|
@@ -103011,7 +102963,7 @@ function parseMembers(baseDir, members) {
|
|
|
103011
102963
|
if (isBareSpecifier(importPath)) {
|
|
103012
102964
|
specifier = importPath;
|
|
103013
102965
|
} else {
|
|
103014
|
-
const abs =
|
|
102966
|
+
const abs = isAbsolute11(importPath) ? importPath : resolve10(baseDir, importPath);
|
|
103015
102967
|
const posixAbs = abs.replaceAll("\\", "/");
|
|
103016
102968
|
const nmIdx = posixAbs.lastIndexOf("node_modules/");
|
|
103017
102969
|
if (nmIdx >= 0) {
|
|
@@ -103077,7 +103029,7 @@ async function runScan(opts) {
|
|
|
103077
103029
|
if (repoIdOverride !== void 0) metaOpts.repoIdOverride = repoIdOverride;
|
|
103078
103030
|
const meta = await stampMeta(metaOpts);
|
|
103079
103031
|
const gitToplevel = await readGitToplevel(cfg.configDir);
|
|
103080
|
-
const outputRoot = opts.repoRoot ?
|
|
103032
|
+
const outputRoot = opts.repoRoot ? isAbsolute12(opts.repoRoot) ? opts.repoRoot : resolve11(opts.cwd ?? process.cwd(), opts.repoRoot) : gitToplevel && !relative6(gitToplevel, cfg.configDir).startsWith("..") ? gitToplevel : cfg.configDir;
|
|
103081
103033
|
const rebase = (scanRel) => outputRoot === cfg.configDir ? scanRel : posixPath8(relative6(outputRoot, resolve11(cfg.configDir, scanRel)));
|
|
103082
103034
|
if (opts.outputOverride) cfg.output = opts.outputOverride;
|
|
103083
103035
|
const writer = opts.quiet ? () => {
|
|
@@ -103344,7 +103296,7 @@ async function runScan(opts) {
|
|
|
103344
103296
|
// `snapshotManifestRefs()` — otherwise an undeclared package's full CEM
|
|
103345
103297
|
// catalog gets broadcast as zero-occurrence components.
|
|
103346
103298
|
resolveExternalLeaf: (fromFile, specifier, exportName) => {
|
|
103347
|
-
const absFrom =
|
|
103299
|
+
const absFrom = isAbsolute12(fromFile) ? fromFile : resolve11(cfg.configDir, fromFile);
|
|
103348
103300
|
const hit = warmedResolver.lookupExternalLeaf(absFrom, specifier, exportName);
|
|
103349
103301
|
if (!hit) return null;
|
|
103350
103302
|
return { leafPackage: hit.leafPackage, modulePath: hit.modulePath, exportName: hit.exportName };
|
|
@@ -103364,7 +103316,7 @@ async function runScan(opts) {
|
|
|
103364
103316
|
}
|
|
103365
103317
|
const diagnostics = rawDiagnostics.map((d2) => ({
|
|
103366
103318
|
...d2,
|
|
103367
|
-
filePath:
|
|
103319
|
+
filePath: isAbsolute12(d2.filePath) ? posixPath8(relative6(outputRoot, d2.filePath)) : d2.filePath
|
|
103368
103320
|
}));
|
|
103369
103321
|
const snapshot = warmedResolver.snapshotComponents().map((c2) => ({ component: c2 }));
|
|
103370
103322
|
const manifests = warmedResolver.snapshotManifestRefs();
|
|
@@ -103468,7 +103420,7 @@ async function runScan(opts) {
|
|
|
103468
103420
|
};
|
|
103469
103421
|
await stampGitMTime(outputRoot, scanOutput.components);
|
|
103470
103422
|
await stampVersion(outputRoot, scanOutput.components, scanOutput.occurrences);
|
|
103471
|
-
const outputPath =
|
|
103423
|
+
const outputPath = isAbsolute12(cfg.output) ? cfg.output : resolve11(cfg.configDir, cfg.output);
|
|
103472
103424
|
await writeJson(scanOutput, outputPath);
|
|
103473
103425
|
if (!opts.quiet) {
|
|
103474
103426
|
printSummary(scanOutput, outputPath);
|
|
@@ -103516,14 +103468,14 @@ function countFilesWithUsage(occurrences) {
|
|
|
103516
103468
|
function normaliseEngineLocalId(c2, configDir2, rebase) {
|
|
103517
103469
|
if (c2.source.type !== "local") return c2;
|
|
103518
103470
|
const fp = c2.source.filePath;
|
|
103519
|
-
const scanRel =
|
|
103471
|
+
const scanRel = isAbsolute12(fp) ? posixPath8(relative6(configDir2, fp)) : fp;
|
|
103520
103472
|
return {
|
|
103521
103473
|
...c2,
|
|
103522
103474
|
source: { type: "local", filePath: rebase(scanRel) }
|
|
103523
103475
|
};
|
|
103524
103476
|
}
|
|
103525
103477
|
function normaliseVia(v, configDir2, rebase) {
|
|
103526
|
-
if (!("specifier" in v) || v.specifier === void 0 || !
|
|
103478
|
+
if (!("specifier" in v) || v.specifier === void 0 || !isAbsolute12(v.specifier)) return v;
|
|
103527
103479
|
const scanRel = posixPath8(relative6(configDir2, v.specifier));
|
|
103528
103480
|
return { ...v, specifier: rebase(scanRel) };
|
|
103529
103481
|
}
|
|
@@ -103531,7 +103483,7 @@ function normaliseVia(v, configDir2, rebase) {
|
|
|
103531
103483
|
// src/commands/init.ts
|
|
103532
103484
|
init_adapter();
|
|
103533
103485
|
import { writeFile as writeFile3, stat as stat2, readFile as readFile6 } from "node:fs/promises";
|
|
103534
|
-
import { basename as basename5, isAbsolute as
|
|
103486
|
+
import { basename as basename5, isAbsolute as isAbsolute13, resolve as resolve12 } from "node:path";
|
|
103535
103487
|
var DEFAULT_INCLUDE = "src/**/*.{ts,tsx,jsx,js,vue,html}";
|
|
103536
103488
|
var FRAMEWORK_EXTS = {
|
|
103537
103489
|
react: ["ts", "tsx", "js", "jsx"],
|
|
@@ -103563,7 +103515,7 @@ function buildConfig(o2) {
|
|
|
103563
103515
|
};
|
|
103564
103516
|
}
|
|
103565
103517
|
async function runInit(opts) {
|
|
103566
|
-
const cwd2 =
|
|
103518
|
+
const cwd2 = isAbsolute13(opts.cwd) ? opts.cwd : resolve12(opts.cwd);
|
|
103567
103519
|
const out2 = opts.outputPath ?? resolve12(cwd2, "component-compass.config.json");
|
|
103568
103520
|
await assertNoExistingConfig(out2);
|
|
103569
103521
|
const repoId = opts.repoId ?? await deriveRepoId(cwd2);
|