@component-compass/cli 0.1.24 → 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 +1022 -691
- 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
|
|
|
@@ -43170,6 +43170,207 @@ var require_ignore = __commonJS({
|
|
|
43170
43170
|
}
|
|
43171
43171
|
});
|
|
43172
43172
|
|
|
43173
|
+
// src/upload.ts
|
|
43174
|
+
import { gzipSync } from "node:zlib";
|
|
43175
|
+
function statusUrl(host, receipt) {
|
|
43176
|
+
const base2 = new URL(host);
|
|
43177
|
+
const url = new URL(receipt.statusUrl, base2);
|
|
43178
|
+
if (url.origin !== base2.origin || url.username || url.password) {
|
|
43179
|
+
throw new Error("Upload status URL must have the same origin as the upload host");
|
|
43180
|
+
}
|
|
43181
|
+
return url.href;
|
|
43182
|
+
}
|
|
43183
|
+
async function getUploadStatus(opts) {
|
|
43184
|
+
const url = statusUrl(opts.host, opts.receipt);
|
|
43185
|
+
opts.signal?.throwIfAborted();
|
|
43186
|
+
const response = await fetch(url, {
|
|
43187
|
+
method: "GET",
|
|
43188
|
+
redirect: "error",
|
|
43189
|
+
headers: { Authorization: `Bearer ${opts.token}` },
|
|
43190
|
+
...opts.signal ? { signal: opts.signal } : {}
|
|
43191
|
+
});
|
|
43192
|
+
const retryAfterSeconds = parseRetryAfter(response.headers.get("Retry-After"));
|
|
43193
|
+
if (!response.ok) {
|
|
43194
|
+
await response.body?.cancel();
|
|
43195
|
+
throw new UploadError(response.status, `Upload status failed (${response.status})`, retryAfterSeconds);
|
|
43196
|
+
}
|
|
43197
|
+
const status = await response.json();
|
|
43198
|
+
if (retryAfterSeconds !== void 0) status.retryAfterSeconds = retryAfterSeconds;
|
|
43199
|
+
return status;
|
|
43200
|
+
}
|
|
43201
|
+
function parseRetryAfter(retryAfter) {
|
|
43202
|
+
if (retryAfter === null) return void 0;
|
|
43203
|
+
const seconds = /^\d+(?:\.\d+)?$/.test(retryAfter.trim()) ? Number(retryAfter) : (Date.parse(retryAfter) - Date.now()) / 1e3;
|
|
43204
|
+
return Number.isFinite(seconds) ? Math.max(0, seconds) : void 0;
|
|
43205
|
+
}
|
|
43206
|
+
function transientReason(err2) {
|
|
43207
|
+
if (err2 instanceof UploadError) return TRANSIENT_STATUSES.has(err2.code) ? err2.message : void 0;
|
|
43208
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
43209
|
+
for (let current = err2; typeof current === "object" && current !== null && !seen2.has(current); current = current.cause) {
|
|
43210
|
+
seen2.add(current);
|
|
43211
|
+
const { code } = current;
|
|
43212
|
+
if (typeof code === "string" && TRANSIENT_CODES.has(code)) {
|
|
43213
|
+
return err2 instanceof Error ? `${err2.message} (${code})` : code;
|
|
43214
|
+
}
|
|
43215
|
+
}
|
|
43216
|
+
return void 0;
|
|
43217
|
+
}
|
|
43218
|
+
function backoffDelay(attempt) {
|
|
43219
|
+
return Math.min(3e4, 1e3 * 2 ** attempt);
|
|
43220
|
+
}
|
|
43221
|
+
async function pollUpload(opts) {
|
|
43222
|
+
const url = statusUrl(opts.host, opts.receipt);
|
|
43223
|
+
const controller = new AbortController();
|
|
43224
|
+
const signal = controller.signal;
|
|
43225
|
+
const abort = () => controller.abort(opts.signal?.reason);
|
|
43226
|
+
opts.signal?.addEventListener("abort", abort, { once: true });
|
|
43227
|
+
let lastFailure;
|
|
43228
|
+
const timer = setTimeout(() => controller.abort(new UploadPendingError(opts.receipt, url, lastFailure)), opts.timeoutMs);
|
|
43229
|
+
const cancelled = new Promise((_resolve, reject) => {
|
|
43230
|
+
signal.addEventListener("abort", () => reject(signal.reason), { once: true });
|
|
43231
|
+
});
|
|
43232
|
+
async function run() {
|
|
43233
|
+
opts.signal?.throwIfAborted();
|
|
43234
|
+
let token = await opts.getToken();
|
|
43235
|
+
for (let attempt = 0; ; attempt++) {
|
|
43236
|
+
signal.throwIfAborted();
|
|
43237
|
+
const inspect3 = () => getUploadStatus({ host: opts.host, receipt: opts.receipt, token, signal });
|
|
43238
|
+
let status;
|
|
43239
|
+
let hint;
|
|
43240
|
+
try {
|
|
43241
|
+
status = await inspect3().catch(async (err2) => {
|
|
43242
|
+
if (!(err2 instanceof UploadError) || err2.code !== 401) throw err2;
|
|
43243
|
+
signal.throwIfAborted();
|
|
43244
|
+
token = await opts.refreshToken();
|
|
43245
|
+
return await inspect3();
|
|
43246
|
+
});
|
|
43247
|
+
} catch (err2) {
|
|
43248
|
+
const reason = transientReason(err2);
|
|
43249
|
+
if (reason === void 0) throw err2;
|
|
43250
|
+
lastFailure = { reason, error: err2 };
|
|
43251
|
+
hint = err2 instanceof UploadError ? err2.retryAfterSeconds : void 0;
|
|
43252
|
+
}
|
|
43253
|
+
signal.throwIfAborted();
|
|
43254
|
+
if (status) {
|
|
43255
|
+
lastFailure = void 0;
|
|
43256
|
+
opts.onStatus?.(status);
|
|
43257
|
+
if (status.state === "failed") {
|
|
43258
|
+
throw new UploadPollingError(
|
|
43259
|
+
opts.receipt,
|
|
43260
|
+
url,
|
|
43261
|
+
"failed",
|
|
43262
|
+
new Error(`Upload ${opts.receipt.uploadId} failed: ${status.error?.code ?? "processing_failed"}: ${status.error?.message ?? "Processing failed"}`)
|
|
43263
|
+
);
|
|
43264
|
+
}
|
|
43265
|
+
if (status.readable && (status.state === "ready" || status.state === "duplicate")) {
|
|
43266
|
+
return { status: status.state === "ready" ? "inserted" : "exists", scanId: status.scanId, url: status.url };
|
|
43267
|
+
}
|
|
43268
|
+
hint = status.retryAfterSeconds;
|
|
43269
|
+
}
|
|
43270
|
+
const delay = hint !== void 0 ? hint * 1e3 : backoffDelay(attempt);
|
|
43271
|
+
await wait(Math.min(2147483647, Math.max(1e3, delay)), signal);
|
|
43272
|
+
}
|
|
43273
|
+
}
|
|
43274
|
+
try {
|
|
43275
|
+
return await Promise.race([run(), cancelled]);
|
|
43276
|
+
} catch (err2) {
|
|
43277
|
+
if (err2 instanceof UploadPendingError || err2 instanceof UploadPollingError) throw err2;
|
|
43278
|
+
throw new UploadPollingError(opts.receipt, url, "unknown", err2);
|
|
43279
|
+
} finally {
|
|
43280
|
+
clearTimeout(timer);
|
|
43281
|
+
opts.signal?.removeEventListener("abort", abort);
|
|
43282
|
+
controller.abort();
|
|
43283
|
+
}
|
|
43284
|
+
}
|
|
43285
|
+
function wait(delay, signal) {
|
|
43286
|
+
return new Promise((resolve14, reject) => {
|
|
43287
|
+
signal?.throwIfAborted();
|
|
43288
|
+
const abort = () => {
|
|
43289
|
+
clearTimeout(timer);
|
|
43290
|
+
reject(signal?.reason);
|
|
43291
|
+
};
|
|
43292
|
+
const timer = setTimeout(() => {
|
|
43293
|
+
signal?.removeEventListener("abort", abort);
|
|
43294
|
+
resolve14();
|
|
43295
|
+
}, delay);
|
|
43296
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
43297
|
+
});
|
|
43298
|
+
}
|
|
43299
|
+
async function submitArtifact(opts) {
|
|
43300
|
+
const url = `${opts.host.replace(/\/$/, "")}/api/scans`;
|
|
43301
|
+
const useGzip = opts.artifactJson.length > GZIP_THRESHOLD;
|
|
43302
|
+
const body = useGzip ? gzipSync(Buffer.from(opts.artifactJson, "utf8")) : opts.artifactJson;
|
|
43303
|
+
const headers = {
|
|
43304
|
+
"Content-Type": "application/json",
|
|
43305
|
+
Authorization: `Bearer ${opts.token}`
|
|
43306
|
+
};
|
|
43307
|
+
if (useGzip) headers["Content-Encoding"] = "gzip";
|
|
43308
|
+
for (let attempt = 1; ; attempt++) {
|
|
43309
|
+
try {
|
|
43310
|
+
return await postArtifact(url, headers, body);
|
|
43311
|
+
} catch (err2) {
|
|
43312
|
+
if (attempt >= SUBMIT_ATTEMPTS || transientReason(err2) === void 0) throw err2;
|
|
43313
|
+
const hint = err2 instanceof UploadError ? err2.retryAfterSeconds : void 0;
|
|
43314
|
+
const backoff = backoffDelay(attempt - 1);
|
|
43315
|
+
await wait(hint === void 0 ? backoff : Math.max(backoff, Math.min(hint * 1e3, 3e4)));
|
|
43316
|
+
}
|
|
43317
|
+
}
|
|
43318
|
+
}
|
|
43319
|
+
async function postArtifact(url, headers, body) {
|
|
43320
|
+
const res = await fetch(url, { method: "POST", headers, body, redirect: "error" });
|
|
43321
|
+
if (res.status === 202) {
|
|
43322
|
+
return await res.json();
|
|
43323
|
+
}
|
|
43324
|
+
const text2 = await res.text().catch(() => "");
|
|
43325
|
+
throw new UploadError(res.status, `Upload failed (${res.status}): ${text2 || res.statusText}`, parseRetryAfter(res.headers.get("Retry-After")));
|
|
43326
|
+
}
|
|
43327
|
+
var UploadPendingError, UploadPollingError, TRANSIENT_STATUSES, TRANSIENT_CODES, UploadError, GZIP_THRESHOLD, SUBMIT_ATTEMPTS;
|
|
43328
|
+
var init_upload = __esm({
|
|
43329
|
+
"src/upload.ts"() {
|
|
43330
|
+
"use strict";
|
|
43331
|
+
UploadPendingError = class extends Error {
|
|
43332
|
+
constructor(receipt, statusUrl2, lastFailure) {
|
|
43333
|
+
const failure = lastFailure ? ` The last status check failed: ${lastFailure.reason}.` : "";
|
|
43334
|
+
super(
|
|
43335
|
+
`Upload ${receipt.uploadId} is still pending. Check ${statusUrl2}; the server job continues.${failure}`,
|
|
43336
|
+
lastFailure ? { cause: lastFailure.error } : void 0
|
|
43337
|
+
);
|
|
43338
|
+
this.receipt = receipt;
|
|
43339
|
+
this.statusUrl = statusUrl2;
|
|
43340
|
+
}
|
|
43341
|
+
receipt;
|
|
43342
|
+
statusUrl;
|
|
43343
|
+
};
|
|
43344
|
+
UploadPollingError = class extends Error {
|
|
43345
|
+
constructor(receipt, statusUrl2, outcome, cause) {
|
|
43346
|
+
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
43347
|
+
this.receipt = receipt;
|
|
43348
|
+
this.statusUrl = statusUrl2;
|
|
43349
|
+
this.outcome = outcome;
|
|
43350
|
+
}
|
|
43351
|
+
receipt;
|
|
43352
|
+
statusUrl;
|
|
43353
|
+
outcome;
|
|
43354
|
+
get code() {
|
|
43355
|
+
return this.cause instanceof UploadError ? this.cause.code : void 0;
|
|
43356
|
+
}
|
|
43357
|
+
};
|
|
43358
|
+
TRANSIENT_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
43359
|
+
TRANSIENT_CODES = /* @__PURE__ */ new Set(["ECONNRESET", "ECONNREFUSED", "EPIPE", "EAI_AGAIN", "UND_ERR_SOCKET"]);
|
|
43360
|
+
UploadError = class extends Error {
|
|
43361
|
+
constructor(code, message, retryAfterSeconds) {
|
|
43362
|
+
super(message);
|
|
43363
|
+
this.code = code;
|
|
43364
|
+
this.retryAfterSeconds = retryAfterSeconds;
|
|
43365
|
+
}
|
|
43366
|
+
code;
|
|
43367
|
+
retryAfterSeconds;
|
|
43368
|
+
};
|
|
43369
|
+
GZIP_THRESHOLD = 1024 * 1024;
|
|
43370
|
+
SUBMIT_ATTEMPTS = 3;
|
|
43371
|
+
}
|
|
43372
|
+
});
|
|
43373
|
+
|
|
43173
43374
|
// src/auth/paths.ts
|
|
43174
43375
|
import { homedir } from "node:os";
|
|
43175
43376
|
import { join as join15 } from "node:path";
|
|
@@ -43407,44 +43608,6 @@ var init_session = __esm({
|
|
|
43407
43608
|
}
|
|
43408
43609
|
});
|
|
43409
43610
|
|
|
43410
|
-
// src/upload.ts
|
|
43411
|
-
import { gzipSync } from "node:zlib";
|
|
43412
|
-
async function uploadArtifact(opts) {
|
|
43413
|
-
const url = `${opts.host.replace(/\/$/, "")}/api/scans`;
|
|
43414
|
-
const useGzip = opts.artifactJson.length > GZIP_THRESHOLD;
|
|
43415
|
-
const body = useGzip ? gzipSync(Buffer.from(opts.artifactJson, "utf8")) : opts.artifactJson;
|
|
43416
|
-
const headers = {
|
|
43417
|
-
"Content-Type": "application/json",
|
|
43418
|
-
Authorization: `Bearer ${opts.token}`
|
|
43419
|
-
};
|
|
43420
|
-
if (useGzip) headers["Content-Encoding"] = "gzip";
|
|
43421
|
-
const res = await fetch(url, { method: "POST", headers, body });
|
|
43422
|
-
if (res.status === 201 || res.status === 200) {
|
|
43423
|
-
const json = await res.json();
|
|
43424
|
-
return {
|
|
43425
|
-
status: res.status === 201 ? "inserted" : "exists",
|
|
43426
|
-
scanId: json.scanId,
|
|
43427
|
-
url: json.url
|
|
43428
|
-
};
|
|
43429
|
-
}
|
|
43430
|
-
const text2 = await res.text().catch(() => "");
|
|
43431
|
-
throw new UploadError(res.status, `Upload failed (${res.status}): ${text2 || res.statusText}`);
|
|
43432
|
-
}
|
|
43433
|
-
var UploadError, GZIP_THRESHOLD;
|
|
43434
|
-
var init_upload = __esm({
|
|
43435
|
-
"src/upload.ts"() {
|
|
43436
|
-
"use strict";
|
|
43437
|
-
UploadError = class extends Error {
|
|
43438
|
-
constructor(code, message) {
|
|
43439
|
-
super(message);
|
|
43440
|
-
this.code = code;
|
|
43441
|
-
}
|
|
43442
|
-
code;
|
|
43443
|
-
};
|
|
43444
|
-
GZIP_THRESHOLD = 1024 * 1024;
|
|
43445
|
-
}
|
|
43446
|
-
});
|
|
43447
|
-
|
|
43448
43611
|
// src/auth/upload-auth.ts
|
|
43449
43612
|
var upload_auth_exports = {};
|
|
43450
43613
|
__export(upload_auth_exports, {
|
|
@@ -43458,28 +43621,33 @@ async function createAuthedUploader(opts) {
|
|
|
43458
43621
|
...opts.configHost !== void 0 ? { configHost: opts.configHost } : {},
|
|
43459
43622
|
store
|
|
43460
43623
|
});
|
|
43461
|
-
const ciToken = process.env
|
|
43462
|
-
|
|
43463
|
-
|
|
43464
|
-
|
|
43465
|
-
|
|
43466
|
-
|
|
43467
|
-
|
|
43468
|
-
};
|
|
43624
|
+
const { COMPONENT_COMPASS_TOKEN: ciToken } = process.env;
|
|
43625
|
+
const session = filePath !== void 0 ? { filePath } : {};
|
|
43626
|
+
let token = ciToken || (await getAccessToken(base2, session)).accessToken;
|
|
43627
|
+
async function refreshToken() {
|
|
43628
|
+
if (ciToken) {
|
|
43629
|
+
throw new UploadError(401, "COMPONENT_COMPASS_TOKEN was rejected (401); interactive login and token refresh are disabled. Supply a valid token.");
|
|
43630
|
+
}
|
|
43631
|
+
token = (await getAccessToken(base2, { ...session, force: true })).accessToken;
|
|
43632
|
+
return token;
|
|
43469
43633
|
}
|
|
43470
|
-
let token = (await getAccessToken(base2, filePath !== void 0 ? { filePath } : {})).accessToken;
|
|
43471
43634
|
return {
|
|
43472
43635
|
base: base2,
|
|
43473
43636
|
async upload(artifactJson) {
|
|
43474
|
-
|
|
43475
|
-
|
|
43476
|
-
|
|
43477
|
-
|
|
43478
|
-
|
|
43479
|
-
|
|
43480
|
-
|
|
43481
|
-
|
|
43482
|
-
|
|
43637
|
+
const submit = () => submitArtifact({ host: base2, token, artifactJson });
|
|
43638
|
+
const receipt = await submit().catch(async (err2) => {
|
|
43639
|
+
if (!(err2 instanceof UploadError) || err2.code !== 401) throw err2;
|
|
43640
|
+
await refreshToken();
|
|
43641
|
+
return await submit();
|
|
43642
|
+
});
|
|
43643
|
+
return await pollUpload({
|
|
43644
|
+
host: base2,
|
|
43645
|
+
receipt,
|
|
43646
|
+
getToken: async () => token,
|
|
43647
|
+
refreshToken,
|
|
43648
|
+
timeoutMs: 3e5,
|
|
43649
|
+
...opts.onStatus ? { onStatus: opts.onStatus } : {}
|
|
43650
|
+
});
|
|
43483
43651
|
}
|
|
43484
43652
|
};
|
|
43485
43653
|
}
|
|
@@ -45262,7 +45430,7 @@ var init_auth = __esm({
|
|
|
45262
45430
|
|
|
45263
45431
|
// src/commands/scan.ts
|
|
45264
45432
|
import { performance as performance3 } from "node:perf_hooks";
|
|
45265
|
-
import { isAbsolute as
|
|
45433
|
+
import { isAbsolute as isAbsolute12, relative as relative6, resolve as resolve11 } from "node:path";
|
|
45266
45434
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
45267
45435
|
|
|
45268
45436
|
// src/config/loader.ts
|
|
@@ -67312,7 +67480,7 @@ function requireUtil$2() {
|
|
|
67312
67480
|
}
|
|
67313
67481
|
path5 = url.path;
|
|
67314
67482
|
}
|
|
67315
|
-
var
|
|
67483
|
+
var isAbsolute14 = exports$1.isAbsolute(path5);
|
|
67316
67484
|
var parts = [];
|
|
67317
67485
|
var start = 0;
|
|
67318
67486
|
var i2 = 0;
|
|
@@ -67347,7 +67515,7 @@ function requireUtil$2() {
|
|
|
67347
67515
|
}
|
|
67348
67516
|
path5 = parts.join("/");
|
|
67349
67517
|
if (path5 === "") {
|
|
67350
|
-
path5 =
|
|
67518
|
+
path5 = isAbsolute14 ? "/" : ".";
|
|
67351
67519
|
}
|
|
67352
67520
|
if (url) {
|
|
67353
67521
|
url.path = path5;
|
|
@@ -75179,9 +75347,9 @@ Url.prototype.resolveObject = function(relative7) {
|
|
|
75179
75347
|
if (hasTrailingSlash && srcPath.join("/").substr(-1) !== "/") {
|
|
75180
75348
|
srcPath.push("");
|
|
75181
75349
|
}
|
|
75182
|
-
var
|
|
75350
|
+
var isAbsolute14 = srcPath[0] === "" || srcPath[0] && srcPath[0].charAt(0) === "/";
|
|
75183
75351
|
if (psychotic) {
|
|
75184
|
-
result2.hostname = result2.host =
|
|
75352
|
+
result2.hostname = result2.host = isAbsolute14 ? "" : srcPath.length ? srcPath.shift() : "";
|
|
75185
75353
|
authInHost = result2.host && result2.host.indexOf("@") > 0 ? result2.host.split("@") : false;
|
|
75186
75354
|
if (authInHost) {
|
|
75187
75355
|
result2.auth = authInHost.shift();
|
|
@@ -75189,7 +75357,7 @@ Url.prototype.resolveObject = function(relative7) {
|
|
|
75189
75357
|
}
|
|
75190
75358
|
}
|
|
75191
75359
|
mustEndAbs = mustEndAbs || result2.host && srcPath.length;
|
|
75192
|
-
if (mustEndAbs && !
|
|
75360
|
+
if (mustEndAbs && !isAbsolute14) {
|
|
75193
75361
|
srcPath.unshift("");
|
|
75194
75362
|
}
|
|
75195
75363
|
if (!srcPath.length) {
|
|
@@ -77143,7 +77311,7 @@ function requireInput() {
|
|
|
77143
77311
|
if (hasRequiredInput) return input;
|
|
77144
77312
|
hasRequiredInput = 1;
|
|
77145
77313
|
let { nanoid } = /* @__PURE__ */ requireNonSecure();
|
|
77146
|
-
let { isAbsolute:
|
|
77314
|
+
let { isAbsolute: isAbsolute14, resolve: resolve14 } = require$$1;
|
|
77147
77315
|
let { SourceMapConsumer, SourceMapGenerator } = /* @__PURE__ */ requireSourceMap$1();
|
|
77148
77316
|
let { fileURLToPath: fileURLToPath3, pathToFileURL } = require$$2;
|
|
77149
77317
|
let CssSyntaxError = /* @__PURE__ */ requireCssSyntaxError();
|
|
@@ -77151,7 +77319,7 @@ function requireInput() {
|
|
|
77151
77319
|
let terminalHighlight = /* @__PURE__ */ requireTerminalHighlight();
|
|
77152
77320
|
let lineToIndexCache = /* @__PURE__ */ Symbol("lineToIndexCache");
|
|
77153
77321
|
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
77154
|
-
let pathAvailable = Boolean(resolve14 &&
|
|
77322
|
+
let pathAvailable = Boolean(resolve14 && isAbsolute14);
|
|
77155
77323
|
function getLineToIndex(input2) {
|
|
77156
77324
|
if (input2[lineToIndexCache]) return input2[lineToIndexCache];
|
|
77157
77325
|
let lines = input2.css.split("\n");
|
|
@@ -77182,7 +77350,7 @@ function requireInput() {
|
|
|
77182
77350
|
this.document = this.css;
|
|
77183
77351
|
if (opts.document) this.document = opts.document.toString();
|
|
77184
77352
|
if (opts.from) {
|
|
77185
|
-
if (!pathAvailable || /^\w+:\/\//.test(opts.from) ||
|
|
77353
|
+
if (!pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute14(opts.from)) {
|
|
77186
77354
|
this.file = opts.from;
|
|
77187
77355
|
} else {
|
|
77188
77356
|
this.file = resolve14(opts.from);
|
|
@@ -77318,7 +77486,7 @@ function requireInput() {
|
|
|
77318
77486
|
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
77319
77487
|
}
|
|
77320
77488
|
let fromUrl;
|
|
77321
|
-
if (
|
|
77489
|
+
if (isAbsolute14(from2.source)) {
|
|
77322
77490
|
fromUrl = pathToFileURL(from2.source);
|
|
77323
77491
|
} else {
|
|
77324
77492
|
fromUrl = new URL(
|
|
@@ -94298,6 +94466,9 @@ function createArgumentMap() {
|
|
|
94298
94466
|
};
|
|
94299
94467
|
}
|
|
94300
94468
|
|
|
94469
|
+
// ../reference-graph/dist/engine/binding.js
|
|
94470
|
+
import { isAbsolute as isAbsolute8 } from "node:path";
|
|
94471
|
+
|
|
94301
94472
|
// ../reference-graph/dist/engine/cycle-detection.js
|
|
94302
94473
|
var MAX_REFERENCE_DEPTH = 32;
|
|
94303
94474
|
function createCycleGuard() {
|
|
@@ -94360,130 +94531,25 @@ function libraryStubFor(imp, ref) {
|
|
|
94360
94531
|
return libraryExportFor(imp, ref)?.kind === "identity-preserving" ? { kind: "Function", returns: [{ kind: "ParameterOf", fn: ref, index: 0 }] } : null;
|
|
94361
94532
|
}
|
|
94362
94533
|
|
|
94363
|
-
// ../reference-graph/dist/engine/
|
|
94364
|
-
function
|
|
94365
|
-
const
|
|
94366
|
-
|
|
94367
|
-
while (true) {
|
|
94368
|
-
const decl = lookupGraph.declarations.get(`${scope}::${ref.symbol}`);
|
|
94369
|
-
if (decl) {
|
|
94370
|
-
return wrapWithMemberChain(decl.value, ref.memberChain);
|
|
94371
|
-
}
|
|
94372
|
-
if (scope === MODULE_SCOPE)
|
|
94373
|
-
break;
|
|
94374
|
-
const parent = lookupGraph.scopes.get(scope)?.parent;
|
|
94375
|
-
if (parent === null || parent === void 0)
|
|
94376
|
-
break;
|
|
94377
|
-
scope = parent;
|
|
94378
|
-
}
|
|
94379
|
-
const imp = lookupGraph.importsByLocal.get(ref.symbol);
|
|
94380
|
-
if (!imp)
|
|
94381
|
-
return { kind: "Unknown" };
|
|
94382
|
-
const stub = libraryStubFor(imp, ref);
|
|
94383
|
-
if (stub)
|
|
94384
|
-
return stub;
|
|
94385
|
-
const resolvedFile = graph.moduleResolver(lookupGraph.filePath, imp.specifier);
|
|
94386
|
-
if (!resolvedFile)
|
|
94387
|
-
return { kind: "Unknown" };
|
|
94388
|
-
const targetFile = graph.resolveToGraphKey ? graph.resolveToGraphKey(resolvedFile) ?? resolvedFile : resolvedFile;
|
|
94389
|
-
const found = findExport(graph, targetFile, imp.imported, /* @__PURE__ */ new Set());
|
|
94390
|
-
if (!found)
|
|
94391
|
-
return { kind: "Unknown" };
|
|
94392
|
-
const { record: exp, fileGraph: expFileGraph } = found;
|
|
94393
|
-
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;
|
|
94394
94538
|
}
|
|
94395
|
-
function
|
|
94396
|
-
|
|
94397
|
-
if (seen2.has(seenKey))
|
|
94398
|
-
return null;
|
|
94399
|
-
seen2.add(seenKey);
|
|
94400
|
-
const target = graph.files.get(file);
|
|
94401
|
-
if (!target)
|
|
94402
|
-
return null;
|
|
94403
|
-
for (const exp of target.exports) {
|
|
94404
|
-
if (exp.kind === "named" && exp.exportedAs === imported)
|
|
94405
|
-
return { record: exp, fileGraph: target };
|
|
94406
|
-
if (exp.kind === "default" && imported === "default")
|
|
94407
|
-
return { record: exp, fileGraph: target };
|
|
94408
|
-
}
|
|
94409
|
-
for (const exp of target.exports) {
|
|
94410
|
-
if (exp.kind !== "star")
|
|
94411
|
-
continue;
|
|
94412
|
-
const resolvedFrom = graph.moduleResolver(file, exp.from);
|
|
94413
|
-
if (!resolvedFrom)
|
|
94414
|
-
continue;
|
|
94415
|
-
const nextFile = graph.resolveToGraphKey ? graph.resolveToGraphKey(resolvedFrom) ?? resolvedFrom : resolvedFrom;
|
|
94416
|
-
const result2 = findExport(graph, nextFile, imported, seen2);
|
|
94417
|
-
if (result2)
|
|
94418
|
-
return result2;
|
|
94419
|
-
}
|
|
94420
|
-
return null;
|
|
94539
|
+
function residualMemberChain(imported, memberChain) {
|
|
94540
|
+
return imported === "*" && memberChain.length > 0 ? memberChain.slice(1) : memberChain;
|
|
94421
94541
|
}
|
|
94422
|
-
function
|
|
94423
|
-
|
|
94424
|
-
const guardResult = guard.push(fileGraph.filePath, exp.local);
|
|
94425
|
-
if (guardResult !== "ok")
|
|
94426
|
-
return { kind: "Unknown" };
|
|
94427
|
-
try {
|
|
94428
|
-
const localRef = {
|
|
94429
|
-
symbol: exp.local,
|
|
94430
|
-
scope: MODULE_SCOPE,
|
|
94431
|
-
memberChain,
|
|
94432
|
-
loc: { line: 0, column: 0 }
|
|
94433
|
-
};
|
|
94434
|
-
return resolveReference(graph, fileGraph, localRef, guard);
|
|
94435
|
-
} finally {
|
|
94436
|
-
guard.pop(fileGraph.filePath, exp.local);
|
|
94437
|
-
}
|
|
94438
|
-
}
|
|
94439
|
-
if (exp.kind === "named" && "from" in exp) {
|
|
94440
|
-
const resolvedFrom = graph.moduleResolver(fileGraph.filePath, exp.from);
|
|
94441
|
-
if (!resolvedFrom)
|
|
94442
|
-
return { kind: "Unknown" };
|
|
94443
|
-
const targetFile = graph.resolveToGraphKey ? graph.resolveToGraphKey(resolvedFrom) ?? resolvedFrom : resolvedFrom;
|
|
94444
|
-
const innerFound = findExport(graph, targetFile, exp.fromImported, /* @__PURE__ */ new Set());
|
|
94445
|
-
if (!innerFound)
|
|
94446
|
-
return { kind: "Unknown" };
|
|
94447
|
-
const guardResult = guard.push(fileGraph.filePath, exp.exportedAs);
|
|
94448
|
-
if (guardResult !== "ok")
|
|
94449
|
-
return { kind: "Unknown" };
|
|
94450
|
-
try {
|
|
94451
|
-
return resolveExport(graph, innerFound.fileGraph, innerFound.record, memberChain, guard);
|
|
94452
|
-
} finally {
|
|
94453
|
-
guard.pop(fileGraph.filePath, exp.exportedAs);
|
|
94454
|
-
}
|
|
94455
|
-
}
|
|
94456
|
-
if (exp.kind === "default" && "local" in exp) {
|
|
94457
|
-
const guardResult = guard.push(fileGraph.filePath, exp.local);
|
|
94458
|
-
if (guardResult !== "ok")
|
|
94459
|
-
return { kind: "Unknown" };
|
|
94460
|
-
try {
|
|
94461
|
-
const localRef = {
|
|
94462
|
-
symbol: exp.local,
|
|
94463
|
-
scope: MODULE_SCOPE,
|
|
94464
|
-
memberChain,
|
|
94465
|
-
loc: { line: 0, column: 0 }
|
|
94466
|
-
};
|
|
94467
|
-
return resolveReference(graph, fileGraph, localRef, guard);
|
|
94468
|
-
} finally {
|
|
94469
|
-
guard.pop(fileGraph.filePath, exp.local);
|
|
94470
|
-
}
|
|
94471
|
-
}
|
|
94472
|
-
return { kind: "Unknown" };
|
|
94542
|
+
function compoundExportName(root2, residual) {
|
|
94543
|
+
return residual.length === 0 ? root2 : `${root2}.${residual.join(".")}`;
|
|
94473
94544
|
}
|
|
94474
|
-
function
|
|
94475
|
-
let
|
|
94476
|
-
for (const
|
|
94477
|
-
|
|
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];
|
|
94478
94551
|
}
|
|
94479
|
-
return
|
|
94480
|
-
}
|
|
94481
|
-
function fileGraphForRef(graph, ref, fallback) {
|
|
94482
|
-
if (!ref.originFile)
|
|
94483
|
-
return fallback;
|
|
94484
|
-
if (ref.originFile === fallback.filePath)
|
|
94485
|
-
return fallback;
|
|
94486
|
-
return graph.files.get(ref.originFile) ?? fallback;
|
|
94552
|
+
return cur;
|
|
94487
94553
|
}
|
|
94488
94554
|
|
|
94489
94555
|
// ../reference-graph/dist/engine/specifier.js
|
|
@@ -94513,82 +94579,333 @@ function externalSubpath(pkg, specifier) {
|
|
|
94513
94579
|
return void 0;
|
|
94514
94580
|
}
|
|
94515
94581
|
|
|
94516
|
-
// ../reference-graph/dist/engine/
|
|
94517
|
-
|
|
94518
|
-
|
|
94582
|
+
// ../reference-graph/dist/engine/binding.js
|
|
94583
|
+
var NO_EXPORT = { kind: "no-export" };
|
|
94584
|
+
var UNBOUND = { kind: "unbound" };
|
|
94585
|
+
function findLocalDeclaration(fileGraph, ref) {
|
|
94586
|
+
let scope = ref.scope;
|
|
94587
|
+
while (true) {
|
|
94588
|
+
const decl = fileGraph.declarations.get(`${scope}::${ref.symbol}`);
|
|
94589
|
+
if (decl)
|
|
94590
|
+
return decl;
|
|
94591
|
+
if (scope === MODULE_SCOPE)
|
|
94592
|
+
return null;
|
|
94593
|
+
const parent = fileGraph.scopes.get(scope)?.parent;
|
|
94594
|
+
if (parent === null || parent === void 0)
|
|
94595
|
+
return null;
|
|
94596
|
+
scope = parent;
|
|
94597
|
+
}
|
|
94519
94598
|
}
|
|
94520
|
-
function
|
|
94521
|
-
|
|
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;
|
|
94603
|
+
}
|
|
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 };
|
|
94622
|
+
}
|
|
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}`;
|
|
94522
94697
|
if (seen2.has(seenKey))
|
|
94523
94698
|
return null;
|
|
94524
94699
|
seen2.add(seenKey);
|
|
94525
|
-
const
|
|
94526
|
-
if (!
|
|
94700
|
+
const fileGraph = graph.files.get(file);
|
|
94701
|
+
if (!fileGraph)
|
|
94527
94702
|
return null;
|
|
94528
|
-
const
|
|
94529
|
-
if (
|
|
94530
|
-
|
|
94531
|
-
|
|
94532
|
-
|
|
94533
|
-
|
|
94534
|
-
|
|
94535
|
-
|
|
94536
|
-
|
|
94537
|
-
|
|
94538
|
-
|
|
94539
|
-
|
|
94540
|
-
};
|
|
94541
|
-
}
|
|
94542
|
-
if ("local" in exp) {
|
|
94543
|
-
const imp = target.importsByLocal.get(exp.local);
|
|
94544
|
-
if (imp && imp.imported !== "*" && !packageNameFromSpecifier(imp.specifier)) {
|
|
94545
|
-
const nextAbs = graph.moduleResolver(file, imp.specifier);
|
|
94546
|
-
const nextKey = nextAbs && (graph.resolveToGraphKey ? graph.resolveToGraphKey(nextAbs) : nextAbs);
|
|
94547
|
-
if (nextKey) {
|
|
94548
|
-
const leaf = walk2(graph, nextKey, imp.imported, seen2);
|
|
94549
|
-
if (leaf)
|
|
94550
|
-
return leaf;
|
|
94551
|
-
if (graph.lazyReExportResolution && !graph.files.has(nextKey)) {
|
|
94552
|
-
return { file: nextKey, localExport: imp.imported };
|
|
94553
|
-
}
|
|
94554
|
-
}
|
|
94555
|
-
}
|
|
94556
|
-
return { file, localExport: exp.local };
|
|
94557
|
-
}
|
|
94558
|
-
return { file, localExport: imported };
|
|
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")
|
|
94708
|
+
continue;
|
|
94709
|
+
const abs = graph.moduleResolver(file, star.from);
|
|
94710
|
+
if (!abs)
|
|
94711
|
+
continue;
|
|
94712
|
+
const found = findExportRecord(graph, graphKeyFor(graph, abs) ?? abs, name, seen2);
|
|
94713
|
+
if (found)
|
|
94714
|
+
return found;
|
|
94559
94715
|
}
|
|
94560
|
-
|
|
94561
|
-
|
|
94716
|
+
return null;
|
|
94717
|
+
}
|
|
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))
|
|
94724
|
+
return;
|
|
94725
|
+
seen2.add(f);
|
|
94726
|
+
const fileGraph = graph.files.get(f);
|
|
94727
|
+
if (!fileGraph)
|
|
94728
|
+
return;
|
|
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;
|
|
94741
|
+
}
|
|
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")
|
|
94562
94751
|
continue;
|
|
94563
|
-
const
|
|
94564
|
-
if (!
|
|
94752
|
+
const abs = graph.moduleResolver(file, star.from);
|
|
94753
|
+
if (!abs)
|
|
94565
94754
|
continue;
|
|
94566
|
-
const
|
|
94567
|
-
if (
|
|
94755
|
+
const next = graphKeyFor(graph, abs);
|
|
94756
|
+
if (next === null || soughtAgain(chain, next, name))
|
|
94568
94757
|
continue;
|
|
94569
|
-
const
|
|
94570
|
-
if (
|
|
94571
|
-
return
|
|
94758
|
+
const found = recordOnChain(graph, next, name, chain);
|
|
94759
|
+
if (found)
|
|
94760
|
+
return found;
|
|
94572
94761
|
}
|
|
94573
94762
|
return null;
|
|
94574
94763
|
}
|
|
94575
|
-
|
|
94576
|
-
|
|
94577
|
-
|
|
94578
|
-
|
|
94579
|
-
|
|
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);
|
|
94782
|
+
}
|
|
94783
|
+
}
|
|
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 };
|
|
94788
|
+
}
|
|
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 };
|
|
94580
94842
|
}
|
|
94581
|
-
function
|
|
94582
|
-
|
|
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;
|
|
94583
94852
|
}
|
|
94584
|
-
function
|
|
94585
|
-
|
|
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
|
+
}
|
|
94586
94868
|
}
|
|
94587
|
-
function
|
|
94588
|
-
if (
|
|
94589
|
-
return
|
|
94590
|
-
|
|
94591
|
-
|
|
94869
|
+
function bindingIdentity(binding2) {
|
|
94870
|
+
if (binding2.walkIdentity !== void 0)
|
|
94871
|
+
return binding2.walkIdentity;
|
|
94872
|
+
return naturalIdentity(binding2);
|
|
94873
|
+
}
|
|
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;
|
|
94895
|
+
}
|
|
94896
|
+
}
|
|
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));
|
|
94592
94909
|
}
|
|
94593
94910
|
|
|
94594
94911
|
// ../reference-graph/dist/engine/assert-never.js
|
|
@@ -94663,7 +94980,9 @@ function evalInner(t3, ctx) {
|
|
|
94663
94980
|
}
|
|
94664
94981
|
}
|
|
94665
94982
|
function evalCall(t3, ctx) {
|
|
94666
|
-
if (t3.
|
|
94983
|
+
if (nonComponentProduct(ctx.graph, ctx.fileGraph, t3.callee, ctx.guard) !== null)
|
|
94984
|
+
return "other";
|
|
94985
|
+
if (t3.args.some((a3) => containsDynamicImport(a3)))
|
|
94667
94986
|
return "component";
|
|
94668
94987
|
const fns = resolveToFunctions(ctx.graph, ctx.fileGraph, t3.callee, ctx.argMap, ctx.guard);
|
|
94669
94988
|
const resolvable = [];
|
|
@@ -94672,7 +94991,8 @@ function evalCall(t3, ctx) {
|
|
|
94672
94991
|
resolvable.push(f);
|
|
94673
94992
|
}
|
|
94674
94993
|
if (resolvable.length === 0) {
|
|
94675
|
-
const
|
|
94994
|
+
const isProductCall = (a3) => a3.kind === "ReturnTypeOf" && nonComponentProduct(ctx.graph, ctx.fileGraph, a3.callee, ctx.guard) !== null;
|
|
94995
|
+
const carries = t3.args.some((a3) => evalInner(a3, ctx) === "component" || isImportBackedLeaf(a3, ctx.graph, ctx.fileGraph, ctx.guard) && !isProductCall(a3));
|
|
94676
94996
|
if (!carries)
|
|
94677
94997
|
return "unresolved";
|
|
94678
94998
|
if (t3.callee.kind === "MemberOf" && !isImportBackedLeaf(t3.callee, ctx.graph, ctx.fileGraph, ctx.guard))
|
|
@@ -94709,43 +95029,75 @@ function isImportBackedLeaf(t3, graph, fileGraph, guard) {
|
|
|
94709
95029
|
return false;
|
|
94710
95030
|
return resolveReference(graph, fileGraph, cur.ref, guard).kind === "Unknown";
|
|
94711
95031
|
}
|
|
95032
|
+
function nonComponentProduct(graph, fileGraph, callee, guard) {
|
|
95033
|
+
const ref = callee.kind === "TypeOf" ? callee.ref : callee.kind === "MemberOf" && callee.obj.kind === "TypeOf" ? { ...callee.obj.ref, memberChain: [callee.member] } : null;
|
|
95034
|
+
if (ref === null)
|
|
95035
|
+
return null;
|
|
95036
|
+
const imp = fileGraphForRef(graph, ref, fileGraph).importsByLocal.get(ref.symbol);
|
|
95037
|
+
const entry = imp === void 0 ? null : libraryExportFor(imp, ref);
|
|
95038
|
+
if (entry === null || entry.kind !== "non-component-product")
|
|
95039
|
+
return null;
|
|
95040
|
+
return isImportBackedLeaf(callee, graph, fileGraph, guard) ? entry.semantics : null;
|
|
95041
|
+
}
|
|
94712
95042
|
function firstDynamicImport(t3) {
|
|
95043
|
+
return searchDynamicImport(t3, null);
|
|
95044
|
+
}
|
|
95045
|
+
function searchDynamicImport(t3, peek) {
|
|
94713
95046
|
switch (t3.kind) {
|
|
94714
95047
|
case "DynamicImport":
|
|
94715
95048
|
return t3;
|
|
94716
95049
|
case "Function":
|
|
94717
95050
|
for (const r2 of t3.returns) {
|
|
94718
|
-
const hit =
|
|
95051
|
+
const hit = searchDynamicImport(r2, peek);
|
|
94719
95052
|
if (hit)
|
|
94720
95053
|
return hit;
|
|
94721
95054
|
}
|
|
94722
95055
|
return null;
|
|
94723
95056
|
case "ReturnTypeOf": {
|
|
94724
|
-
const inCallee =
|
|
95057
|
+
const inCallee = searchDynamicImport(t3.callee, peek);
|
|
94725
95058
|
if (inCallee)
|
|
94726
95059
|
return inCallee;
|
|
94727
95060
|
for (const a3 of t3.args) {
|
|
94728
|
-
const hit =
|
|
95061
|
+
const hit = searchDynamicImport(a3, peek);
|
|
94729
95062
|
if (hit)
|
|
94730
95063
|
return hit;
|
|
94731
95064
|
}
|
|
94732
95065
|
return null;
|
|
94733
95066
|
}
|
|
94734
95067
|
case "MemberOf":
|
|
94735
|
-
return
|
|
95068
|
+
return searchDynamicImport(t3.obj, peek);
|
|
94736
95069
|
case "Union":
|
|
94737
95070
|
for (const u3 of t3.types) {
|
|
94738
|
-
const hit =
|
|
95071
|
+
const hit = searchDynamicImport(u3, peek);
|
|
95072
|
+
if (hit)
|
|
95073
|
+
return hit;
|
|
95074
|
+
}
|
|
95075
|
+
return null;
|
|
95076
|
+
case "Object":
|
|
95077
|
+
for (const v of Object.values(t3.props)) {
|
|
95078
|
+
const hit = searchDynamicImport(v, peek);
|
|
95079
|
+
if (hit)
|
|
95080
|
+
return hit;
|
|
95081
|
+
}
|
|
95082
|
+
return null;
|
|
95083
|
+
case "Array":
|
|
95084
|
+
for (const e of t3.elements) {
|
|
95085
|
+
const hit = searchDynamicImport(e, peek);
|
|
94739
95086
|
if (hit)
|
|
94740
95087
|
return hit;
|
|
94741
95088
|
}
|
|
94742
95089
|
return null;
|
|
95090
|
+
case "TypeOf": {
|
|
95091
|
+
const bound = peek?.(t3) ?? null;
|
|
95092
|
+
return bound === null ? null : searchDynamicImport(bound, null);
|
|
95093
|
+
}
|
|
94743
95094
|
default:
|
|
94744
95095
|
return null;
|
|
94745
95096
|
}
|
|
94746
95097
|
}
|
|
94747
|
-
function containsDynamicImport(t3) {
|
|
94748
|
-
|
|
95098
|
+
function containsDynamicImport(t3, at) {
|
|
95099
|
+
const peek = at === void 0 ? null : (ref) => findLocalDeclaration(fileGraphForRef(at.graph, ref.ref, at.fileGraph), ref.ref)?.value ?? null;
|
|
95100
|
+
return searchDynamicImport(t3, peek) !== null;
|
|
94749
95101
|
}
|
|
94750
95102
|
|
|
94751
95103
|
// ../reference-graph/dist/engine/host-element.js
|
|
@@ -94783,12 +95135,26 @@ var RENDER_VERDICT = {
|
|
|
94783
95135
|
opaque: () => "silent",
|
|
94784
95136
|
"late-bound": () => "late-bound",
|
|
94785
95137
|
data: () => "unresolved",
|
|
94786
|
-
indeterminate: () => "unresolved"
|
|
95138
|
+
indeterminate: () => "unresolved",
|
|
95139
|
+
callable: () => "credit"
|
|
94787
95140
|
};
|
|
94788
95141
|
var VERDICT_ORDER = ["credit", "silent", "late-bound", "unresolved"];
|
|
94789
95142
|
function creditedTerminals(e) {
|
|
94790
95143
|
return e.filter((t3) => matchDenotation(t3, RENDER_VERDICT) === "credit");
|
|
94791
95144
|
}
|
|
95145
|
+
var IS_CALLABLE = {
|
|
95146
|
+
element: () => false,
|
|
95147
|
+
foreign: () => false,
|
|
95148
|
+
"host-string": () => false,
|
|
95149
|
+
opaque: () => false,
|
|
95150
|
+
"late-bound": () => false,
|
|
95151
|
+
data: () => false,
|
|
95152
|
+
indeterminate: () => false,
|
|
95153
|
+
callable: () => true
|
|
95154
|
+
};
|
|
95155
|
+
function isCallable(t3) {
|
|
95156
|
+
return matchDenotation(t3, IS_CALLABLE);
|
|
95157
|
+
}
|
|
94792
95158
|
function renderOutcome(e) {
|
|
94793
95159
|
const verdicts = e.map((t3) => matchDenotation(t3, RENDER_VERDICT));
|
|
94794
95160
|
const winner = VERDICT_ORDER.find((v) => verdicts.includes(v)) ?? "unresolved";
|
|
@@ -94809,6 +95175,40 @@ function renderOutcome(e) {
|
|
|
94809
95175
|
function isDataMethodRenderCall(type, graph, fileGraph, guard) {
|
|
94810
95176
|
return type.callee.kind === "MemberOf" && !isImportBackedLeaf(type.callee, graph, fileGraph, guard);
|
|
94811
95177
|
}
|
|
95178
|
+
function isLoader(value, graph, fileGraph, guard) {
|
|
95179
|
+
if (value.kind === "Function")
|
|
95180
|
+
return containsDynamicImport(value, { graph, fileGraph });
|
|
95181
|
+
if (value.kind !== "TypeOf" && value.kind !== "MemberOf")
|
|
95182
|
+
return false;
|
|
95183
|
+
if (guard.pushNode(value) === "cycle")
|
|
95184
|
+
return false;
|
|
95185
|
+
try {
|
|
95186
|
+
if (value.kind === "TypeOf")
|
|
95187
|
+
return isLoader(resolveReference(graph, fileGraph, value.ref, guard), graph, fileGraph, guard);
|
|
95188
|
+
const holder = objectLiteralOf(value.obj, graph, fileGraph, guard);
|
|
95189
|
+
if (holder === null)
|
|
95190
|
+
return false;
|
|
95191
|
+
if (value.member !== DYNAMIC_MEMBER_KEY) {
|
|
95192
|
+
const held = holder.props[value.member];
|
|
95193
|
+
return held !== void 0 && isLoader(held, graph, fileGraph, guard);
|
|
95194
|
+
}
|
|
95195
|
+
const all = Object.values(holder.props);
|
|
95196
|
+
return all.length > 0 && all.every((v) => isLoader(v, graph, fileGraph, guard));
|
|
95197
|
+
} finally {
|
|
95198
|
+
guard.popNode(value);
|
|
95199
|
+
}
|
|
95200
|
+
}
|
|
95201
|
+
function objectLiteralOf(value, graph, fileGraph, guard) {
|
|
95202
|
+
if (value.kind === "Object")
|
|
95203
|
+
return value;
|
|
95204
|
+
if (value.kind !== "TypeOf" || guard.pushNode(value) === "cycle")
|
|
95205
|
+
return null;
|
|
95206
|
+
try {
|
|
95207
|
+
return objectLiteralOf(resolveReference(graph, fileGraph, value.ref, guard), graph, fileGraph, guard);
|
|
95208
|
+
} finally {
|
|
95209
|
+
guard.popNode(value);
|
|
95210
|
+
}
|
|
95211
|
+
}
|
|
94812
95212
|
var INDETERMINATE = { kind: "indeterminate" };
|
|
94813
95213
|
function withSemantics(t3, semantics) {
|
|
94814
95214
|
return { denotation: t3.denotation, viaTrail: t3.viaTrail, identity: t3.identity, semantics };
|
|
@@ -94826,7 +95226,8 @@ var CAME_TO_NOTHING = {
|
|
|
94826
95226
|
opaque: () => true,
|
|
94827
95227
|
"late-bound": () => true,
|
|
94828
95228
|
data: () => false,
|
|
94829
|
-
indeterminate: () => true
|
|
95229
|
+
indeterminate: () => true,
|
|
95230
|
+
callable: () => false
|
|
94830
95231
|
};
|
|
94831
95232
|
function cameToNothing(t3) {
|
|
94832
95233
|
return matchDenotation(t3, CAME_TO_NOTHING);
|
|
@@ -94838,7 +95239,8 @@ var IS_LATE_BOUND = {
|
|
|
94838
95239
|
opaque: () => false,
|
|
94839
95240
|
"late-bound": () => true,
|
|
94840
95241
|
data: () => false,
|
|
94841
|
-
indeterminate: () => false
|
|
95242
|
+
indeterminate: () => false,
|
|
95243
|
+
callable: () => false
|
|
94842
95244
|
};
|
|
94843
95245
|
function relabel(denotation) {
|
|
94844
95246
|
return (t3) => cameToNothing(t3) ? { denotation, viaTrail: t3.viaTrail, identity: t3.identity } : t3;
|
|
@@ -94856,7 +95258,8 @@ var AS_RETURNED_VALUE = {
|
|
|
94856
95258
|
opaque: () => INDETERMINATE,
|
|
94857
95259
|
"late-bound": () => INDETERMINATE,
|
|
94858
95260
|
data: (d2) => d2,
|
|
94859
|
-
indeterminate: (d2) => d2
|
|
95261
|
+
indeterminate: (d2) => d2,
|
|
95262
|
+
callable: (d2) => d2
|
|
94860
95263
|
};
|
|
94861
95264
|
function returnedValue(t3) {
|
|
94862
95265
|
const denotation = matchDenotation(t3, AS_RETURNED_VALUE);
|
|
@@ -94926,13 +95329,13 @@ function foldToWrappedArg(inner, via) {
|
|
|
94926
95329
|
}
|
|
94927
95330
|
return [indeterminateTerminal()];
|
|
94928
95331
|
}
|
|
94929
|
-
function argumentProvenance(type, arg, fileGraph) {
|
|
94930
|
-
const importRecord = findImportForLastArg(arg, fileGraph);
|
|
95332
|
+
function argumentProvenance(graph, type, arg, fileGraph) {
|
|
95333
|
+
const importRecord = findImportForLastArg(graph, arg, fileGraph);
|
|
94931
95334
|
const resolved = importRecord ? { specifier: importRecord.specifier, import: importRecord.imported } : resolveAnonymousLastArg(arg, fileGraph);
|
|
94932
95335
|
return { callee: deriveHocCallee(type.callee), specifier: resolved.specifier, import: resolved.import };
|
|
94933
95336
|
}
|
|
94934
|
-
function buildHocVia(type, lastArg, fileGraph) {
|
|
94935
|
-
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);
|
|
94936
95339
|
return { kind: "hoc-wrapper", hocCallee: callee, specifier, import: imported };
|
|
94937
95340
|
}
|
|
94938
95341
|
function foldedArgument(graph, fileGraph, call, jsx, argMap) {
|
|
@@ -94940,7 +95343,7 @@ function foldedArgument(graph, fileGraph, call, jsx, argMap) {
|
|
|
94940
95343
|
const arg = call.args[index];
|
|
94941
95344
|
if (arg === void 0 || jsx.length === 0)
|
|
94942
95345
|
return null;
|
|
94943
|
-
const via = buildHocVia(call, arg, fileGraph);
|
|
95346
|
+
const via = buildHocVia(graph, call, arg, fileGraph);
|
|
94944
95347
|
return jsx.every((t3) => t3.viaTrail[0] !== void 0 && sameHocVia(t3.viaTrail[0], via)) ? { arg, via } : null;
|
|
94945
95348
|
}
|
|
94946
95349
|
function sameHocVia(a3, b) {
|
|
@@ -94959,25 +95362,27 @@ function isPassThroughWrapper(algResult, inner) {
|
|
|
94959
95362
|
const algKeys = algResult.filter((t3) => !cameToNothing(t3));
|
|
94960
95363
|
return algKeys.length > 0 && algKeys.every((t3) => t3.identity !== null && innerKeys.has(identityKey(t3.identity)));
|
|
94961
95364
|
}
|
|
94962
|
-
function walkWithFolding(graph, fileGraph, type, argMap, guard = createCycleGuard(), identityFallback) {
|
|
94963
|
-
return atLeastOne(walkInner(graph, fileGraph, type, argMap, guard, identityFallback).map(published));
|
|
95365
|
+
function walkWithFolding(graph, fileGraph, type, argMap, guard = createCycleGuard(), identityFallback, position = "value") {
|
|
95366
|
+
return atLeastOne(walkInner(graph, fileGraph, type, argMap, guard, identityFallback, position).map(published));
|
|
94964
95367
|
}
|
|
94965
|
-
function walkInner(graph, fileGraph, type, argMap, guard, identityFallback) {
|
|
95368
|
+
function walkInner(graph, fileGraph, type, argMap, guard, identityFallback, position) {
|
|
94966
95369
|
const fallback = identityFallback ?? type;
|
|
94967
95370
|
switch (type.kind) {
|
|
94968
95371
|
case "ReturnTypeOf":
|
|
94969
|
-
return walkReturnTypeOf(graph, fileGraph, type, argMap, guard);
|
|
95372
|
+
return walkReturnTypeOf(graph, fileGraph, type, argMap, guard, position);
|
|
94970
95373
|
case "MemberOf":
|
|
94971
95374
|
if (type.member === DYNAMIC_MEMBER_KEY) {
|
|
94972
|
-
return walkDynamicMember(graph, fileGraph, type, argMap, guard);
|
|
95375
|
+
return walkDynamicMember(graph, fileGraph, type, argMap, guard, position);
|
|
94973
95376
|
}
|
|
94974
|
-
return walkStaticMember(graph, fileGraph, type, argMap, guard, fallback);
|
|
95377
|
+
return walkStaticMember(graph, fileGraph, type, argMap, guard, fallback, position);
|
|
94975
95378
|
case "Function":
|
|
94976
|
-
|
|
95379
|
+
if (position === "tag")
|
|
95380
|
+
return [{ denotation: { kind: "callable" }, identity: null, viaTrail: [] }];
|
|
95381
|
+
return type.returns.flatMap((r2) => walkInner(graph, fileGraph, r2, argMap, guard, type, "value")).map(returnedValue);
|
|
94977
95382
|
case "TypeOf":
|
|
94978
|
-
return walkTypeOf(graph, fileGraph, type, argMap, guard, fallback);
|
|
95383
|
+
return walkTypeOf(graph, fileGraph, type, argMap, guard, fallback, position);
|
|
94979
95384
|
case "Union":
|
|
94980
|
-
return type.types.flatMap((branch) => walkInner(graph, fileGraph, branch, argMap, guard, fallback));
|
|
95385
|
+
return type.types.flatMap((branch) => walkInner(graph, fileGraph, branch, argMap, guard, fallback, position));
|
|
94981
95386
|
case "ParameterOf":
|
|
94982
95387
|
return walkParameter(graph, fileGraph, type, argMap, guard, fallback);
|
|
94983
95388
|
case "DynamicImport":
|
|
@@ -95010,16 +95415,10 @@ function fileGraphForDynamicImport(graph, di, fallback) {
|
|
|
95010
95415
|
}
|
|
95011
95416
|
function dynamicImportIdentity(graph, fileGraph, di) {
|
|
95012
95417
|
const origin = fileGraphForDynamicImport(graph, di, fileGraph);
|
|
95013
|
-
const
|
|
95014
|
-
|
|
95015
|
-
return workspaceSiblingIdentity(graph, origin, di.specifier, importedName) ?? relativeChainLocalIdentity(graph, origin, di.specifier, importedName) ?? memberLocalIdentity(graph, origin, di.specifier, importedName) ?? {
|
|
95016
|
-
kind: "imported",
|
|
95017
|
-
specifier: di.specifier,
|
|
95018
|
-
imported: importedName,
|
|
95019
|
-
resolvedFile
|
|
95020
|
-
};
|
|
95418
|
+
const binding2 = resolveModuleExport(graph, origin.filePath, di.specifier, di.projection[0] ?? "default", []);
|
|
95419
|
+
return bindingIdentity(pinUnparsed(graph, binding2));
|
|
95021
95420
|
}
|
|
95022
|
-
function walkTypeOf(graph, fileGraph, type, argMap, guard, fallback) {
|
|
95421
|
+
function walkTypeOf(graph, fileGraph, type, argMap, guard, fallback, position) {
|
|
95023
95422
|
if (guard.pushNode(type) === "cycle") {
|
|
95024
95423
|
return [indeterminateTerminal()];
|
|
95025
95424
|
}
|
|
@@ -95030,17 +95429,17 @@ function walkTypeOf(graph, fileGraph, type, argMap, guard, fallback) {
|
|
|
95030
95429
|
return foldLeaf(graph, fileGraph, type, argMap, guard, fallback);
|
|
95031
95430
|
}
|
|
95032
95431
|
const innerGraph = resolved.kind === "Function" ? fileGraphForFunction(graph, fileGraph, resolved) : fileGraph;
|
|
95033
|
-
const inner = walkInner(graph, innerGraph, resolved, argMap, guard, fallback);
|
|
95432
|
+
const inner = walkInner(graph, innerGraph, resolved, argMap, guard, fallback, position);
|
|
95034
95433
|
if (inner.every((t3) => t3.identity !== null))
|
|
95035
95434
|
return inner;
|
|
95036
|
-
const
|
|
95037
|
-
const stamp =
|
|
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;
|
|
95436
|
+
const stamp = derived ?? deriveIdentity(fallback, fileGraph, graph);
|
|
95038
95437
|
return inner.map((t3) => t3.identity === null ? { denotation: t3.denotation, viaTrail: t3.viaTrail, identity: stamp, semantics: t3.semantics } : t3);
|
|
95039
95438
|
} finally {
|
|
95040
95439
|
guard.popNode(type);
|
|
95041
95440
|
}
|
|
95042
95441
|
}
|
|
95043
|
-
function walkStaticMember(graph, fileGraph, type, argMap, guard, fallback) {
|
|
95442
|
+
function walkStaticMember(graph, fileGraph, type, argMap, guard, fallback, position) {
|
|
95044
95443
|
if (guard.pushNode(type) === "cycle") {
|
|
95045
95444
|
return [indeterminateTerminal()];
|
|
95046
95445
|
}
|
|
@@ -95051,7 +95450,7 @@ function walkStaticMember(graph, fileGraph, type, argMap, guard, fallback) {
|
|
|
95051
95450
|
const leaf = foldLeaf(graph, fileGraph, type, argMap, guard, fallback);
|
|
95052
95451
|
if (!(leaf.length > 0 && leaf.every(cameToNothing)))
|
|
95053
95452
|
return leaf;
|
|
95054
|
-
const object = walkInner(graph, fileGraph, type.obj, argMap, guard);
|
|
95453
|
+
const object = walkInner(graph, fileGraph, type.obj, argMap, guard, void 0, "value");
|
|
95055
95454
|
const semantics = markedProduct(object);
|
|
95056
95455
|
if (semantics !== null)
|
|
95057
95456
|
return leaf.map((t3) => withSemantics(t3, semantics));
|
|
@@ -95062,36 +95461,24 @@ function walkStaticMember(graph, fileGraph, type, argMap, guard, fallback) {
|
|
|
95062
95461
|
const value = obj.props[type.member];
|
|
95063
95462
|
if (value === void 0)
|
|
95064
95463
|
continue;
|
|
95065
|
-
out2.push(...walkInner(graph, fileGraph, value, argMap, guard, fallback));
|
|
95464
|
+
out2.push(...walkInner(graph, fileGraph, value, argMap, guard, fallback, position));
|
|
95066
95465
|
}
|
|
95067
95466
|
return out2.length > 0 ? out2 : [indeterminateTerminal()];
|
|
95068
95467
|
} finally {
|
|
95069
95468
|
guard.popNode(type);
|
|
95070
95469
|
}
|
|
95071
95470
|
}
|
|
95072
|
-
function walkReturnTypeOf(graph, fileGraph, type, argMap, guard) {
|
|
95073
|
-
const
|
|
95074
|
-
if (
|
|
95075
|
-
|
|
95076
|
-
|
|
95077
|
-
return returns.map((t3) => withSemantics(t3, semantics));
|
|
95078
|
-
}
|
|
95471
|
+
function walkReturnTypeOf(graph, fileGraph, type, argMap, guard, position) {
|
|
95472
|
+
const semantics = nonComponentProduct(graph, fileGraph, type.callee, guard);
|
|
95473
|
+
if (semantics !== null)
|
|
95474
|
+
return [withSemantics(indeterminateTerminal(), semantics)];
|
|
95475
|
+
const returns = foldCall(graph, fileGraph, type, argMap, guard, position).map(returnedValue);
|
|
95079
95476
|
if (!(returns.length > 0 && returns.every(cameToNothing)))
|
|
95080
95477
|
return returns;
|
|
95081
95478
|
const unseenHook = HOOK_NAME.test(deriveHocCallee(type.callee)) && isImportBackedLeaf(type.callee, graph, fileGraph, guard);
|
|
95082
95479
|
return unseenHook ? returns.map(asLateBound("hook-result")) : returns;
|
|
95083
95480
|
}
|
|
95084
|
-
function
|
|
95085
|
-
const ref = callee.kind === "TypeOf" ? callee.ref : callee.kind === "MemberOf" && callee.obj.kind === "TypeOf" ? { ...callee.obj.ref, memberChain: [callee.member] } : null;
|
|
95086
|
-
if (ref === null)
|
|
95087
|
-
return null;
|
|
95088
|
-
const imp = fileGraphForRef(graph, ref, fileGraph).importsByLocal.get(ref.symbol);
|
|
95089
|
-
const entry = imp === void 0 ? null : libraryExportFor(imp, ref);
|
|
95090
|
-
if (entry === null || entry.kind !== "non-component-product")
|
|
95091
|
-
return null;
|
|
95092
|
-
return isImportBackedLeaf(callee, graph, fileGraph, guard) ? entry.semantics : null;
|
|
95093
|
-
}
|
|
95094
|
-
function foldCall(graph, fileGraph, type, argMap, guard) {
|
|
95481
|
+
function foldCall(graph, fileGraph, type, argMap, guard, position) {
|
|
95095
95482
|
const lazyShape = findLazyImportArg(type.args, fileGraph);
|
|
95096
95483
|
if (lazyShape) {
|
|
95097
95484
|
const syntheticDI = {
|
|
@@ -95106,8 +95493,8 @@ function foldCall(graph, fileGraph, type, argMap, guard) {
|
|
|
95106
95493
|
}
|
|
95107
95494
|
let inner2;
|
|
95108
95495
|
try {
|
|
95109
|
-
const target = resolveDynamicImportTarget(graph, fileGraph, syntheticDI
|
|
95110
|
-
inner2 = target ? walkInner(graph, target.targetFileGraph, target.value, argMap, guard) : walkInner(graph, fileGraph, syntheticDI, argMap, guard);
|
|
95496
|
+
const target = resolveDynamicImportTarget(graph, fileGraph, syntheticDI);
|
|
95497
|
+
inner2 = target ? walkInner(graph, target.targetFileGraph, target.value, argMap, guard, void 0, position) : walkInner(graph, fileGraph, syntheticDI, argMap, guard, void 0, position);
|
|
95111
95498
|
} finally {
|
|
95112
95499
|
guard.pop(syntheticDI.originFile, guardKey);
|
|
95113
95500
|
}
|
|
@@ -95130,15 +95517,15 @@ function foldCall(graph, fileGraph, type, argMap, guard) {
|
|
|
95130
95517
|
}
|
|
95131
95518
|
return [{ denotation: { kind: "foreign" }, viaTrail: [via], identity }];
|
|
95132
95519
|
}
|
|
95133
|
-
const dispatcherResult = walkDispatcherReturns(graph, fileGraph, type, argMap, guard);
|
|
95520
|
+
const dispatcherResult = walkDispatcherReturns(graph, fileGraph, type, argMap, guard, position);
|
|
95134
95521
|
if (dispatcherResult)
|
|
95135
95522
|
return dispatcherResult;
|
|
95136
95523
|
const passThroughIndex = passThroughParameterIndex(graph, fileGraph, type, argMap, guard);
|
|
95137
95524
|
if (passThroughIndex !== null) {
|
|
95138
95525
|
const wrapped = type.args[passThroughIndex];
|
|
95139
95526
|
if (wrapped !== void 0) {
|
|
95140
|
-
const inner2 = walkInner(graph, fileGraph, wrapped, argMap, guard);
|
|
95141
|
-
return foldToWrappedArg(inner2, buildHocVia(type, wrapped, fileGraph));
|
|
95527
|
+
const inner2 = walkInner(graph, fileGraph, wrapped, argMap, guard, void 0, position);
|
|
95528
|
+
return foldToWrappedArg(inner2, buildHocVia(graph, type, wrapped, fileGraph));
|
|
95142
95529
|
}
|
|
95143
95530
|
}
|
|
95144
95531
|
const algResult = foldTerminals(graph, fileGraph, resolveType(graph, fileGraph, type, argMap, guard), type);
|
|
@@ -95146,9 +95533,9 @@ function foldCall(graph, fileGraph, type, argMap, guard) {
|
|
|
95146
95533
|
if (algHasNonUnknown) {
|
|
95147
95534
|
const lastArg2 = type.args.at(-1);
|
|
95148
95535
|
if (lastArg2 !== void 0) {
|
|
95149
|
-
const inner2 = walkInner(graph, fileGraph, lastArg2, argMap, guard);
|
|
95536
|
+
const inner2 = walkInner(graph, fileGraph, lastArg2, argMap, guard, void 0, position);
|
|
95150
95537
|
if (isPassThroughWrapper(algResult, inner2)) {
|
|
95151
|
-
const via = buildHocVia(type, lastArg2, fileGraph);
|
|
95538
|
+
const via = buildHocVia(graph, type, lastArg2, fileGraph);
|
|
95152
95539
|
return inner2.filter((t3) => !cameToNothing(t3)).map((t3) => ({ denotation: t3.denotation, viaTrail: [via, ...t3.viaTrail], identity: t3.identity }));
|
|
95153
95540
|
}
|
|
95154
95541
|
}
|
|
@@ -95158,15 +95545,17 @@ function foldCall(graph, fileGraph, type, argMap, guard) {
|
|
|
95158
95545
|
if (lastArg === void 0) {
|
|
95159
95546
|
return [indeterminateTerminal()];
|
|
95160
95547
|
}
|
|
95161
|
-
const
|
|
95162
|
-
|
|
95548
|
+
const dataMethod = isDataMethodRenderCall(type, graph, fileGraph, guard);
|
|
95549
|
+
const called = dataMethod || isLoader(lastArg, graph, fileGraph, guard);
|
|
95550
|
+
const inner = walkInner(graph, fileGraph, lastArg, argMap, guard, void 0, called ? "value" : position);
|
|
95551
|
+
if (dataMethod) {
|
|
95163
95552
|
const nonUnknown = inner.filter((t3) => !cameToNothing(t3));
|
|
95164
95553
|
if (nonUnknown.length > 0) {
|
|
95165
95554
|
return nonUnknown.map((t3) => ({ denotation: t3.denotation, viaTrail: t3.viaTrail, identity: null }));
|
|
95166
95555
|
}
|
|
95167
95556
|
return [indeterminateTerminal()];
|
|
95168
95557
|
}
|
|
95169
|
-
return foldToWrappedArg(inner, buildHocVia(type, lastArg, fileGraph));
|
|
95558
|
+
return foldToWrappedArg(inner, buildHocVia(graph, type, lastArg, fileGraph));
|
|
95170
95559
|
}
|
|
95171
95560
|
function passThroughParameterIndex(graph, fileGraph, type, argMap, guard) {
|
|
95172
95561
|
const calleeFns = resolveToFunctions(graph, fileGraph, type.callee, argMap, guard);
|
|
@@ -95190,7 +95579,7 @@ function passThroughParameterIndex(graph, fileGraph, type, argMap, guard) {
|
|
|
95190
95579
|
}
|
|
95191
95580
|
return index;
|
|
95192
95581
|
}
|
|
95193
|
-
function walkDispatcherReturns(graph, fileGraph, type, argMap, guard) {
|
|
95582
|
+
function walkDispatcherReturns(graph, fileGraph, type, argMap, guard, position) {
|
|
95194
95583
|
const calleeFns = resolveToFunctions(graph, fileGraph, type.callee, argMap, guard);
|
|
95195
95584
|
const hasDispatcher = calleeFns.some(({ fn }) => fn.kind === "Function" && fn.returns.some(isDynamicMemberReturn));
|
|
95196
95585
|
if (!hasDispatcher)
|
|
@@ -95204,7 +95593,7 @@ function walkDispatcherReturns(graph, fileGraph, type, argMap, guard) {
|
|
|
95204
95593
|
argMap.bind(bindingRef, type.args);
|
|
95205
95594
|
try {
|
|
95206
95595
|
for (const ret of fn.returns) {
|
|
95207
|
-
folded.push(...walkInner(graph, fnFileGraph, ret, argMap, guard));
|
|
95596
|
+
folded.push(...walkInner(graph, fnFileGraph, ret, argMap, guard, void 0, position));
|
|
95208
95597
|
}
|
|
95209
95598
|
} finally {
|
|
95210
95599
|
if (bindingRef)
|
|
@@ -95267,7 +95656,7 @@ function findFirstDynamicImport(t3, fileGraph, depthBudget) {
|
|
|
95267
95656
|
}
|
|
95268
95657
|
return null;
|
|
95269
95658
|
}
|
|
95270
|
-
function walkDynamicMember(graph, fileGraph, type, argMap, guard) {
|
|
95659
|
+
function walkDynamicMember(graph, fileGraph, type, argMap, guard, position) {
|
|
95271
95660
|
if (guard.pushNode(type) === "cycle") {
|
|
95272
95661
|
return [indeterminateTerminal()];
|
|
95273
95662
|
}
|
|
@@ -95285,7 +95674,7 @@ function walkDynamicMember(graph, fileGraph, type, argMap, guard) {
|
|
|
95285
95674
|
column: mapBinding?.loc.column ?? 0
|
|
95286
95675
|
};
|
|
95287
95676
|
for (const propValue of Object.values(obj.props)) {
|
|
95288
|
-
const inner = walkInner(graph, fileGraph, propValue, argMap, guard);
|
|
95677
|
+
const inner = walkInner(graph, fileGraph, propValue, argMap, guard, void 0, position);
|
|
95289
95678
|
const via = { kind: "dynamic-map", mapName, mapLoc };
|
|
95290
95679
|
for (const t3 of inner) {
|
|
95291
95680
|
if (cameToNothing(t3))
|
|
@@ -95326,14 +95715,19 @@ function deriveHocCallee(callee) {
|
|
|
95326
95715
|
return "unknown";
|
|
95327
95716
|
}
|
|
95328
95717
|
}
|
|
95329
|
-
function findImportForLastArg(lastArg, fileGraph) {
|
|
95718
|
+
function findImportForLastArg(graph, lastArg, fileGraph) {
|
|
95330
95719
|
let cur = lastArg;
|
|
95331
95720
|
while (cur.kind === "ReturnTypeOf")
|
|
95332
95721
|
cur = cur.callee;
|
|
95333
95722
|
if (cur.kind !== "TypeOf")
|
|
95334
95723
|
return null;
|
|
95335
95724
|
const imp = fileGraph.importsByLocal.get(cur.ref.symbol);
|
|
95336
|
-
|
|
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 };
|
|
95337
95731
|
}
|
|
95338
95732
|
function resolveAnonymousLastArg(lastArg, fileGraph) {
|
|
95339
95733
|
let cur = lastArg;
|
|
@@ -95377,104 +95771,11 @@ function typeContainsRef(haystack, needle) {
|
|
|
95377
95771
|
return false;
|
|
95378
95772
|
}
|
|
95379
95773
|
}
|
|
95380
|
-
function resolveImportedFile(graph, fileGraph, specifier, imported) {
|
|
95381
|
-
const abs = graph.moduleResolver(fileGraph.filePath, specifier);
|
|
95382
|
-
if (!abs)
|
|
95383
|
-
return null;
|
|
95384
|
-
const key = graph.resolveToGraphKey ? graph.resolveToGraphKey(abs) : abs;
|
|
95385
|
-
if (!key || !imported)
|
|
95386
|
-
return key;
|
|
95387
|
-
return followReExportChain(graph, key, imported)?.file ?? key;
|
|
95388
|
-
}
|
|
95389
|
-
function relativeChainLocalIdentity(graph, fileGraph, specifier, imported) {
|
|
95390
|
-
if (!graph)
|
|
95391
|
-
return null;
|
|
95392
|
-
if (packageNameFromSpecifier(specifier))
|
|
95393
|
-
return null;
|
|
95394
|
-
const abs = graph.moduleResolver(fileGraph.filePath, specifier);
|
|
95395
|
-
if (!abs)
|
|
95396
|
-
return null;
|
|
95397
|
-
const key = graph.resolveToGraphKey ? graph.resolveToGraphKey(abs) : abs;
|
|
95398
|
-
if (!key || !graph.files.has(key))
|
|
95399
|
-
return null;
|
|
95400
|
-
const chained = followReExportChain(graph, key, imported);
|
|
95401
|
-
if (!chained)
|
|
95402
|
-
return null;
|
|
95403
|
-
return { kind: "local", filePath: chained.file, export: chained.localExport };
|
|
95404
|
-
}
|
|
95405
|
-
function workspaceSiblingIdentity(graph, fileGraph, specifier, imported) {
|
|
95406
|
-
if (!graph)
|
|
95407
|
-
return null;
|
|
95408
|
-
if (!packageNameFromSpecifier(specifier))
|
|
95409
|
-
return null;
|
|
95410
|
-
const abs = graph.moduleResolver(fileGraph.filePath, specifier);
|
|
95411
|
-
const key = abs && (graph.resolveToGraphKey ? graph.resolveToGraphKey(abs) : abs);
|
|
95412
|
-
if (!key)
|
|
95413
|
-
return null;
|
|
95414
|
-
const chained = followReExportChain(graph, key, imported);
|
|
95415
|
-
const file = chained?.file ?? key;
|
|
95416
|
-
if (!graph.files.has(file))
|
|
95417
|
-
return null;
|
|
95418
|
-
return { kind: "local", filePath: file, export: chained?.localExport ?? imported };
|
|
95419
|
-
}
|
|
95420
|
-
function memberLocalIdentity(graph, fileGraph, specifier, imported) {
|
|
95421
|
-
if (graph?.workspaceMembership === void 0)
|
|
95422
|
-
return null;
|
|
95423
|
-
const abs = graph.moduleResolver(fileGraph.filePath, specifier);
|
|
95424
|
-
if (!abs)
|
|
95425
|
-
return null;
|
|
95426
|
-
const key = graph.resolveToGraphKey ? graph.resolveToGraphKey(abs) : abs;
|
|
95427
|
-
if (key !== null && graph.files.has(key))
|
|
95428
|
-
return null;
|
|
95429
|
-
const member = unparsedMemberDefinition(graph, abs, imported);
|
|
95430
|
-
if (member === null)
|
|
95431
|
-
return null;
|
|
95432
|
-
return { kind: "local", filePath: member.absFile, export: member.exportName };
|
|
95433
|
-
}
|
|
95434
|
-
function withResidual(identity, residual) {
|
|
95435
|
-
if (identity === null || residual.length === 0)
|
|
95436
|
-
return identity;
|
|
95437
|
-
return identity.kind === "local" ? { ...identity, export: compoundExportName(identity.export, residual) } : { ...identity, imported: compoundExportName(identity.imported, residual) };
|
|
95438
|
-
}
|
|
95439
95774
|
function deriveIdentity(type, fileGraph, graph) {
|
|
95440
|
-
|
|
95441
|
-
|
|
95442
|
-
|
|
95443
|
-
|
|
95444
|
-
if (cur.kind === "TypeOf") {
|
|
95445
|
-
const symbol2 = cur.ref.symbol;
|
|
95446
|
-
const lookup2 = graph ? fileGraphForRef(graph, cur.ref, fileGraph) : fileGraph;
|
|
95447
|
-
const imp = lookup2.importsByLocal.get(symbol2);
|
|
95448
|
-
if (imp) {
|
|
95449
|
-
const imported = effectiveExportName(imp.imported, cur.ref.memberChain);
|
|
95450
|
-
const residual = residualMemberChain(imp.imported, cur.ref.memberChain);
|
|
95451
|
-
const resolvedFile = graph ? resolveImportedFile(graph, lookup2, imp.specifier, imported) : null;
|
|
95452
|
-
const workspaceLocal = workspaceSiblingIdentity(graph, lookup2, imp.specifier, imported);
|
|
95453
|
-
if (workspaceLocal)
|
|
95454
|
-
return withResidual(workspaceLocal, residual);
|
|
95455
|
-
const relativeLocal = relativeChainLocalIdentity(graph, lookup2, imp.specifier, imported);
|
|
95456
|
-
if (relativeLocal)
|
|
95457
|
-
return withResidual(relativeLocal, residual);
|
|
95458
|
-
const memberLocal = memberLocalIdentity(graph, lookup2, imp.specifier, imported);
|
|
95459
|
-
if (memberLocal)
|
|
95460
|
-
return withResidual(memberLocal, residual);
|
|
95461
|
-
return withResidual({
|
|
95462
|
-
kind: "imported",
|
|
95463
|
-
specifier: imp.specifier,
|
|
95464
|
-
imported,
|
|
95465
|
-
resolvedFile
|
|
95466
|
-
}, residual);
|
|
95467
|
-
}
|
|
95468
|
-
for (const [, decl] of lookup2.declarations) {
|
|
95469
|
-
if (decl && decl.symbol === symbol2) {
|
|
95470
|
-
return withResidual({
|
|
95471
|
-
kind: "local",
|
|
95472
|
-
filePath: lookup2.filePath,
|
|
95473
|
-
export: decl.exportedAs ?? symbol2
|
|
95474
|
-
}, cur.ref.memberChain);
|
|
95475
|
-
}
|
|
95476
|
-
}
|
|
95477
|
-
}
|
|
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)));
|
|
95478
95779
|
return null;
|
|
95479
95780
|
}
|
|
95480
95781
|
|
|
@@ -95580,7 +95881,7 @@ function resolveTypeInner(graph, fileGraph, type, argMap, guard) {
|
|
|
95580
95881
|
case "Array":
|
|
95581
95882
|
return [{ type, source: null }];
|
|
95582
95883
|
case "DynamicImport": {
|
|
95583
|
-
const target = resolveDynamicImportTarget(graph, fileGraph, type
|
|
95884
|
+
const target = resolveDynamicImportTarget(graph, fileGraph, type);
|
|
95584
95885
|
if (!target)
|
|
95585
95886
|
return [{ type, source: type }];
|
|
95586
95887
|
return resolveType(graph, target.targetFileGraph, target.value, argMap, guard);
|
|
@@ -95589,29 +95890,17 @@ function resolveTypeInner(graph, fileGraph, type, argMap, guard) {
|
|
|
95589
95890
|
return assertNever(type);
|
|
95590
95891
|
}
|
|
95591
95892
|
}
|
|
95592
|
-
function resolveDynamicImportTarget(graph, fileGraph, di
|
|
95893
|
+
function resolveDynamicImportTarget(graph, fileGraph, di) {
|
|
95593
95894
|
const origin = fileGraphForDynamicImport(graph, di, fileGraph);
|
|
95594
|
-
const
|
|
95595
|
-
|
|
95596
|
-
|
|
95597
|
-
|
|
95598
|
-
const chained = followReExportChain(graph, key, di.projection[0] ?? "default");
|
|
95599
|
-
const targetFile = chained ? graph.files.get(chained.file) : void 0;
|
|
95600
|
-
if (!chained || !targetFile)
|
|
95601
|
-
return null;
|
|
95602
|
-
const local = chained.localExport;
|
|
95603
|
-
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)
|
|
95604
95899
|
return null;
|
|
95605
|
-
|
|
95606
|
-
symbol: local,
|
|
95607
|
-
scope: MODULE_SCOPE,
|
|
95608
|
-
memberChain: [],
|
|
95609
|
-
loc: { line: 0, column: 0 }
|
|
95610
|
-
};
|
|
95611
|
-
let value = resolveReference(graph, targetFile, localRef, guard);
|
|
95900
|
+
let value = bindingValue(b);
|
|
95612
95901
|
for (const member of di.projection.slice(1))
|
|
95613
95902
|
value = { kind: "MemberOf", obj: value, member };
|
|
95614
|
-
return { targetFileGraph
|
|
95903
|
+
return { targetFileGraph, value };
|
|
95615
95904
|
}
|
|
95616
95905
|
function resolveToFunctions(graph, fileGraph, type, argMap, guard) {
|
|
95617
95906
|
if (guard.pushNode(type) === "cycle") {
|
|
@@ -95708,21 +95997,67 @@ function resolveToFunctionsInner(graph, fileGraph, type, argMap, guard) {
|
|
|
95708
95997
|
// ../reference-graph/dist/engine/index.js
|
|
95709
95998
|
import { asTagName, computeOccurrenceId, serialiseComponentId, projectPropUsages, parseCompoundExport as parseCompoundExport2 } from "@component-compass/plugin-core";
|
|
95710
95999
|
|
|
95711
|
-
// ../reference-graph/dist/engine/
|
|
95712
|
-
function
|
|
95713
|
-
|
|
95714
|
-
|
|
95715
|
-
|
|
95716
|
-
|
|
95717
|
-
|
|
95718
|
-
|
|
95719
|
-
|
|
95720
|
-
|
|
95721
|
-
|
|
95722
|
-
|
|
95723
|
-
|
|
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;
|
|
95724
96056
|
}
|
|
96057
|
+
return null;
|
|
95725
96058
|
}
|
|
96059
|
+
|
|
96060
|
+
// ../reference-graph/dist/engine/helper-callers.js
|
|
95726
96061
|
function classifyDeclaration(decl, registry, fileGraph) {
|
|
95727
96062
|
if (decl.value.kind !== "Function" && decl.value.kind !== "ReturnTypeOf")
|
|
95728
96063
|
return "unknown";
|
|
@@ -95910,7 +96245,7 @@ function resolveRefToDecl(ref, callerFile, callerGraph, graph) {
|
|
|
95910
96245
|
const resolvedAbs = graph.moduleResolver(callerFile, imp.specifier);
|
|
95911
96246
|
if (!resolvedAbs)
|
|
95912
96247
|
return null;
|
|
95913
|
-
const targetFile = graph
|
|
96248
|
+
const targetFile = graphKeyFor(graph, resolvedAbs) ?? resolvedAbs;
|
|
95914
96249
|
const targetGraph = graph.files.get(targetFile);
|
|
95915
96250
|
if (!targetGraph)
|
|
95916
96251
|
return null;
|
|
@@ -95996,12 +96331,14 @@ function narrowTo(registry, entries) {
|
|
|
95996
96331
|
}
|
|
95997
96332
|
return {
|
|
95998
96333
|
hasLocal: (filePath, exportName) => survivingNames.has(entryKey(filePath, exportName)),
|
|
95999
|
-
|
|
96334
|
+
isComponent: (filePath, name, declaration2) => registry.isComponent(filePath, name, declaration2),
|
|
96000
96335
|
declarationOf: (filePath, exportName) => registry.declarationOf(filePath, exportName),
|
|
96336
|
+
isRenderedAsTag: (entry) => registry.isRenderedAsTag(entry),
|
|
96337
|
+
isTagged: (declaration2) => registry.isTagged(declaration2),
|
|
96001
96338
|
localEntries: () => entries
|
|
96002
96339
|
};
|
|
96003
96340
|
}
|
|
96004
|
-
function buildComponentRegistry(graph) {
|
|
96341
|
+
function buildComponentRegistry(graph, tagged = []) {
|
|
96005
96342
|
const consumed = /* @__PURE__ */ new Set();
|
|
96006
96343
|
for (const [file, fg] of graph.files) {
|
|
96007
96344
|
for (const exp of fg.exports) {
|
|
@@ -96023,16 +96360,18 @@ function buildComponentRegistry(graph) {
|
|
|
96023
96360
|
consumed.add(entryKey(target.file, target.symbol));
|
|
96024
96361
|
}
|
|
96025
96362
|
}
|
|
96363
|
+
const renderedAsTag = new Set(tagged);
|
|
96364
|
+
const isTagged = (declaration2) => declaration2 !== void 0 && renderedAsTag.has(declaration2);
|
|
96026
96365
|
const byKey = /* @__PURE__ */ new Map();
|
|
96027
96366
|
const entryIndex = /* @__PURE__ */ new Map();
|
|
96028
96367
|
const entries = [];
|
|
96368
|
+
const taggedEntries = /* @__PURE__ */ new Set();
|
|
96029
96369
|
for (const [file, fg] of graph.files) {
|
|
96030
96370
|
if (fg.dialect === "vue")
|
|
96031
96371
|
continue;
|
|
96032
96372
|
for (const decl of fg.declarations.values()) {
|
|
96033
|
-
|
|
96034
|
-
|
|
96035
|
-
if (!isAdmittedShape(decl.value, graph, fg))
|
|
96373
|
+
const symbolKey = entryKey(file, decl.symbol);
|
|
96374
|
+
if (!renderedAsTag.has(decl) && !(consumed.has(symbolKey) && isAdmittedShape(decl.value, graph, fg)))
|
|
96036
96375
|
continue;
|
|
96037
96376
|
const exportName = decl.exportedAs ?? decl.symbol;
|
|
96038
96377
|
const entry = {
|
|
@@ -96043,6 +96382,8 @@ function buildComponentRegistry(graph) {
|
|
|
96043
96382
|
loc: decl.loc,
|
|
96044
96383
|
isDefault: decl.symbol === "default" || fg.exports.some((e) => e.kind === "default" && "local" in e && e.local === decl.symbol)
|
|
96045
96384
|
};
|
|
96385
|
+
if (renderedAsTag.has(decl))
|
|
96386
|
+
taggedEntries.add(declarationKey(entry));
|
|
96046
96387
|
const key = entryKey(file, exportName);
|
|
96047
96388
|
if (!byKey.has(key)) {
|
|
96048
96389
|
entryIndex.set(key, entries.length);
|
|
@@ -96056,20 +96397,28 @@ function buildComponentRegistry(graph) {
|
|
|
96056
96397
|
byKey.set(key, entry);
|
|
96057
96398
|
}
|
|
96058
96399
|
}
|
|
96059
|
-
const
|
|
96060
|
-
|
|
96061
|
-
const
|
|
96062
|
-
|
|
96400
|
+
const judge = (fg, name, declaration2) => {
|
|
96401
|
+
const { root: root2, path: path5 } = parseCompoundExport(name);
|
|
96402
|
+
const decl = declaration2 ?? findDeclaration(fg, root2);
|
|
96403
|
+
if (decl === void 0)
|
|
96404
|
+
return false;
|
|
96405
|
+
if (path5.length > 0)
|
|
96406
|
+
return isAdmittedMember(decl.value, path5, graph, fg);
|
|
96407
|
+
return isAdmittedShape(decl.value, graph, fg) || renderedAsTag.has(decl);
|
|
96408
|
+
};
|
|
96409
|
+
const judgedByName = /* @__PURE__ */ new Map();
|
|
96410
|
+
const isComponent2 = (filePath, name, declaration2) => {
|
|
96411
|
+
const fg = graph.files.get(filePath);
|
|
96412
|
+
if (fg === void 0 || fg.dialect === "vue")
|
|
96413
|
+
return false;
|
|
96414
|
+
if (declaration2 !== void 0)
|
|
96415
|
+
return judge(fg, name, declaration2);
|
|
96416
|
+
const cacheKey = entryKey(filePath, name);
|
|
96417
|
+
const cached = judgedByName.get(cacheKey);
|
|
96063
96418
|
if (cached !== void 0)
|
|
96064
96419
|
return cached;
|
|
96065
|
-
const
|
|
96066
|
-
|
|
96067
|
-
if (fg && fg.dialect !== "vue") {
|
|
96068
|
-
const { root: root2, path: path5 } = parseCompoundExport(exportName);
|
|
96069
|
-
const decl = findDeclaration(fg, root2);
|
|
96070
|
-
result2 = decl !== void 0 && (path5.length === 0 ? isAdmittedShape(decl.value, graph, fg) : isAdmittedMember(decl.value, path5, graph, fg));
|
|
96071
|
-
}
|
|
96072
|
-
shapeCache.set(cacheKey, result2);
|
|
96420
|
+
const result2 = judge(fg, name, void 0);
|
|
96421
|
+
judgedByName.set(cacheKey, result2);
|
|
96073
96422
|
return result2;
|
|
96074
96423
|
};
|
|
96075
96424
|
const declarationOf = (filePath, exportName) => {
|
|
@@ -96086,11 +96435,16 @@ function buildComponentRegistry(graph) {
|
|
|
96086
96435
|
};
|
|
96087
96436
|
return {
|
|
96088
96437
|
hasLocal: (filePath, exportName) => byKey.has(entryKey(filePath, exportName)),
|
|
96089
|
-
|
|
96438
|
+
isComponent: isComponent2,
|
|
96090
96439
|
declarationOf,
|
|
96440
|
+
isRenderedAsTag: (entry) => taggedEntries.has(declarationKey(entry)),
|
|
96441
|
+
isTagged,
|
|
96091
96442
|
localEntries: () => entries
|
|
96092
96443
|
};
|
|
96093
96444
|
}
|
|
96445
|
+
function declarationKey(entry) {
|
|
96446
|
+
return `${entryKey(entry.filePath, entry.symbol)}@${entry.loc.line}:${entry.loc.column}`;
|
|
96447
|
+
}
|
|
96094
96448
|
function excludeFoldedHolders(registry, folded) {
|
|
96095
96449
|
if (folded.size === 0)
|
|
96096
96450
|
return registry;
|
|
@@ -96098,7 +96452,7 @@ function excludeFoldedHolders(registry, folded) {
|
|
|
96098
96452
|
const survivors = [];
|
|
96099
96453
|
for (const entry of registry.localEntries()) {
|
|
96100
96454
|
const holder = folded.get(entryKey(entry.filePath, entry.symbol));
|
|
96101
|
-
if (holder === void 0) {
|
|
96455
|
+
if (holder === void 0 || registry.isRenderedAsTag(entry)) {
|
|
96102
96456
|
survivors.push(entry);
|
|
96103
96457
|
continue;
|
|
96104
96458
|
}
|
|
@@ -96124,16 +96478,8 @@ function isAdmittedShape(value, graph, fg) {
|
|
|
96124
96478
|
return Object.values(value.props).some((prop) => evalKind(prop, graph, fg) === "component");
|
|
96125
96479
|
}
|
|
96126
96480
|
function isAdmittedMember(holder, path5, graph, fg) {
|
|
96127
|
-
|
|
96128
|
-
|
|
96129
|
-
if (cur.kind !== "Object")
|
|
96130
|
-
return false;
|
|
96131
|
-
const next = cur.props[segment];
|
|
96132
|
-
if (next === void 0)
|
|
96133
|
-
return false;
|
|
96134
|
-
cur = next;
|
|
96135
|
-
}
|
|
96136
|
-
return isAdmittedShape(cur, graph, fg);
|
|
96481
|
+
const member = memberOfObjectPath(holder, path5);
|
|
96482
|
+
return member !== void 0 && isAdmittedShape(member, graph, fg);
|
|
96137
96483
|
}
|
|
96138
96484
|
function findDeclaration(fg, name) {
|
|
96139
96485
|
const atModuleScope = fg.declarations.get(`${MODULE_SCOPE}::${name}`);
|
|
@@ -96164,7 +96510,11 @@ function isHostElementRoot(ref) {
|
|
|
96164
96510
|
function resolve5(graph, opts) {
|
|
96165
96511
|
const occurrences = [];
|
|
96166
96512
|
const argMap = createArgumentMap();
|
|
96167
|
-
const
|
|
96513
|
+
const tagEvaluations = /* @__PURE__ */ new Map();
|
|
96514
|
+
for (const [filePath, fileGraph] of graph.files) {
|
|
96515
|
+
tagEvaluations.set(filePath, fileGraph.jsxUsages.map((usage) => evaluateJsxUsage(graph, fileGraph, usage, argMap)));
|
|
96516
|
+
}
|
|
96517
|
+
const registry = buildComponentRegistry(graph, taggedDeclarations(graph, tagEvaluations));
|
|
96168
96518
|
const helperIndex = buildHelperCallers(graph, excludeHostElementNames(registry, graph));
|
|
96169
96519
|
const CODE_EXT = /\.(?:[cm]?[jt]sx?|vue)$/i;
|
|
96170
96520
|
const HAS_EXT = /\.[^./\\]+$/;
|
|
@@ -96172,12 +96522,9 @@ function resolve5(graph, opts) {
|
|
|
96172
96522
|
if (id2.kind !== "react-component" || id2.source.type !== "local")
|
|
96173
96523
|
return true;
|
|
96174
96524
|
const { filePath } = id2.source;
|
|
96175
|
-
|
|
96176
|
-
if (declaring === void 0)
|
|
96177
|
-
return !HAS_EXT.test(filePath) || CODE_EXT.test(filePath);
|
|
96178
|
-
if (declaring.dialect === "vue")
|
|
96525
|
+
if (graph.files.has(filePath))
|
|
96179
96526
|
return true;
|
|
96180
|
-
return
|
|
96527
|
+
return !HAS_EXT.test(filePath) || CODE_EXT.test(filePath);
|
|
96181
96528
|
};
|
|
96182
96529
|
const composition = [];
|
|
96183
96530
|
const compactSlice = (lengthBefore) => {
|
|
@@ -96207,119 +96554,21 @@ function resolve5(graph, opts) {
|
|
|
96207
96554
|
}
|
|
96208
96555
|
return occurrences.length - lengthBefore;
|
|
96209
96556
|
};
|
|
96210
|
-
const pushJsxUsageOccurrences = (filePath, fileGraph, usage, ownership) => {
|
|
96211
|
-
const ownerRef = ownership?.ownerSymbolRef ?? null;
|
|
96212
|
-
const viaOverride = ownership?.viaOverride;
|
|
96213
|
-
const matchedImport = fileGraph.importsByLocal.get(usage.ref.symbol);
|
|
96214
|
-
if (!matchedImport) {
|
|
96215
|
-
const decl = findLocalDeclaration(fileGraph, usage.ref);
|
|
96216
|
-
if (!decl)
|
|
96217
|
-
return { kind: "unbound" };
|
|
96218
|
-
return {
|
|
96219
|
-
kind: "evaluated",
|
|
96220
|
-
...pushLocalOccurrence(occurrences, filePath, usage, decl, graph, fileGraph, argMap, ownerRef, helperIndex, opts, viaOverride)
|
|
96221
|
-
};
|
|
96222
|
-
}
|
|
96223
|
-
const packageName = packageNameFromSpecifier(matchedImport.specifier);
|
|
96224
|
-
const effectiveImported = effectiveExportName(matchedImport.imported, usage.ref.memberChain);
|
|
96225
|
-
const residual = residualMemberChain(matchedImport.imported, usage.ref.memberChain);
|
|
96226
|
-
const holderDefinition = (file, exportName) => {
|
|
96227
|
-
if (residual.length === 0)
|
|
96228
|
-
return void 0;
|
|
96229
|
-
const loc = graph.files.get(file)?.declarations.get(`${MODULE_SCOPE}::${exportName}`)?.loc;
|
|
96230
|
-
return loc === void 0 ? void 0 : { line: loc.line, column: loc.column };
|
|
96231
|
-
};
|
|
96232
|
-
if (!packageName) {
|
|
96233
|
-
const resolvedAbsTarget2 = graph.moduleResolver(filePath, matchedImport.specifier);
|
|
96234
|
-
if (!resolvedAbsTarget2)
|
|
96235
|
-
return { kind: "import-failed", specifier: matchedImport.specifier };
|
|
96236
|
-
const resolvedTarget = graph.resolveToGraphKey ? graph.resolveToGraphKey(resolvedAbsTarget2) ?? resolvedAbsTarget2 : resolvedAbsTarget2;
|
|
96237
|
-
const refType = resolveReference(graph, fileGraph, usage.ref);
|
|
96238
|
-
const evaluation = walkWithFolding(graph, fileGraph, refType, argMap);
|
|
96239
|
-
const jsxTerminals = creditedTerminals(evaluation);
|
|
96240
|
-
if (jsxTerminals.length === 0)
|
|
96241
|
-
return { kind: "evaluated", evaluation, value: refType };
|
|
96242
|
-
const chained = followReExportChain(graph, resolvedTarget, effectiveImported);
|
|
96243
|
-
const canonicalFile = chained?.file ?? resolvedTarget;
|
|
96244
|
-
let exportName = chained?.localExport ?? effectiveImported;
|
|
96245
|
-
if (!chained) {
|
|
96246
|
-
const targetGraph = graph.files.get(resolvedTarget);
|
|
96247
|
-
if (targetGraph && effectiveImported === "default") {
|
|
96248
|
-
const defaultExp = targetGraph.exports.find((e) => e.kind === "default");
|
|
96249
|
-
if (defaultExp && "local" in defaultExp) {
|
|
96250
|
-
exportName = defaultExp.local;
|
|
96251
|
-
}
|
|
96252
|
-
} else if (targetGraph) {
|
|
96253
|
-
const namedExp = targetGraph.exports.find((e) => e.kind === "named" && "exportedAs" in e && e.exportedAs === effectiveImported && "local" in e);
|
|
96254
|
-
if (namedExp && "local" in namedExp) {
|
|
96255
|
-
exportName = namedExp.local;
|
|
96256
|
-
}
|
|
96257
|
-
}
|
|
96258
|
-
}
|
|
96259
|
-
const outerVia = viaOverride ?? {
|
|
96260
|
-
kind: "direct-import",
|
|
96261
|
-
specifier: matchedImport.specifier,
|
|
96262
|
-
import: matchedImport.imported
|
|
96263
|
-
};
|
|
96264
|
-
const fallbackComponentId = {
|
|
96265
|
-
kind: componentKindFor(fileGraph.dialect),
|
|
96266
|
-
export: compoundExportName(exportName, residual),
|
|
96267
|
-
source: { type: "local", filePath: canonicalFile }
|
|
96268
|
-
};
|
|
96269
|
-
const site = usageSite(filePath, usage);
|
|
96270
|
-
const owners = usageOwners(graph, helperIndex, ownerRef, viaOverride, fileGraph.filePath);
|
|
96271
|
-
const definition = holderDefinition(canonicalFile, exportName);
|
|
96272
|
-
for (const ft of jsxTerminals) {
|
|
96273
|
-
const rawComponentId = componentIdFromIdentity(ft.identity, fallbackComponentId, fileGraph.dialect, {
|
|
96274
|
-
filePath,
|
|
96275
|
-
resolveExternalLeaf: opts?.resolveExternalLeaf
|
|
96276
|
-
});
|
|
96277
|
-
emitOccurrence(occurrences, site, rawComponentId, owners, viaOverride !== void 0 ? [viaOverride] : [outerVia, ...ft.viaTrail], ft.identity === null ? definition : void 0);
|
|
96278
|
-
}
|
|
96279
|
-
return { kind: "evaluated", evaluation, value: refType };
|
|
96280
|
-
}
|
|
96281
|
-
const resolvedAbsTarget = graph.moduleResolver(filePath, matchedImport.specifier);
|
|
96282
|
-
const resolvedNormTarget = resolvedAbsTarget !== null && graph.resolveToGraphKey ? graph.resolveToGraphKey(resolvedAbsTarget) ?? resolvedAbsTarget : resolvedAbsTarget;
|
|
96283
|
-
const targetInGraph = resolvedNormTarget !== null && graph.files.has(resolvedNormTarget);
|
|
96284
|
-
if (targetInGraph) {
|
|
96285
|
-
const refType = resolveReference(graph, fileGraph, usage.ref);
|
|
96286
|
-
const evaluation = walkWithFolding(graph, fileGraph, refType, argMap);
|
|
96287
|
-
const jsxTerminals = creditedTerminals(evaluation);
|
|
96288
|
-
if (jsxTerminals.length === 0)
|
|
96289
|
-
return { kind: "evaluated", evaluation, value: refType };
|
|
96290
|
-
const siblingFallback = workspaceSiblingFallback(graph, resolvedNormTarget, matchedImport, effectiveImported, fileGraph.dialect);
|
|
96291
|
-
const localFallback = siblingFallback !== void 0 && siblingFallback.kind !== "custom-element" ? { ...siblingFallback, export: compoundExportName(siblingFallback.export, residual) } : siblingFallback;
|
|
96292
|
-
const definition = siblingFallback !== void 0 && siblingFallback.kind !== "custom-element" && siblingFallback.source.type === "local" ? holderDefinition(siblingFallback.source.filePath, siblingFallback.export) : void 0;
|
|
96293
|
-
for (const ft of jsxTerminals) {
|
|
96294
|
-
pushOccurrence(occurrences, filePath, usage, matchedImport, compoundExportName(effectiveImported, residual), packageName, graph, fileGraph, ft, ownerRef, helperIndex, opts, localFallback, viaOverride, ft.identity === null ? definition : void 0);
|
|
96295
|
-
}
|
|
96296
|
-
return { kind: "evaluated", evaluation, value: refType };
|
|
96297
|
-
}
|
|
96298
|
-
const member = resolvedAbsTarget !== null ? unparsedMemberDefinition(graph, resolvedAbsTarget, effectiveImported) : null;
|
|
96299
|
-
const sentinelFt = { denotation: { kind: "foreign" }, viaTrail: [], identity: null };
|
|
96300
|
-
if (member !== null) {
|
|
96301
|
-
const localFallback = {
|
|
96302
|
-
kind: componentKindFor(fileGraph.dialect),
|
|
96303
|
-
export: compoundExportName(member.exportName, residual),
|
|
96304
|
-
source: { type: "local", filePath: member.absFile }
|
|
96305
|
-
};
|
|
96306
|
-
pushOccurrence(occurrences, filePath, usage, matchedImport, compoundExportName(effectiveImported, residual), packageName, graph, fileGraph, sentinelFt, ownerRef, helperIndex, opts, localFallback, viaOverride);
|
|
96307
|
-
} else {
|
|
96308
|
-
pushOccurrence(occurrences, filePath, usage, matchedImport, compoundExportName(effectiveImported, residual), packageName, graph, fileGraph, sentinelFt, ownerRef, helperIndex, opts, void 0, viaOverride);
|
|
96309
|
-
}
|
|
96310
|
-
return { kind: "evaluated", evaluation: [sentinelFt], value: null };
|
|
96311
|
-
};
|
|
96312
96557
|
for (const [filePath, fileGraph] of graph.files) {
|
|
96558
|
+
const evaluations = tagEvaluations.get(filePath) ?? [];
|
|
96313
96559
|
for (let usageIdx = 0; usageIdx < fileGraph.jsxUsages.length; usageIdx++) {
|
|
96314
96560
|
const usage = fileGraph.jsxUsages[usageIdx];
|
|
96315
|
-
|
|
96561
|
+
const evaluated = evaluations[usageIdx];
|
|
96562
|
+
if (!usage || !evaluated)
|
|
96316
96563
|
continue;
|
|
96317
96564
|
const ownership = fileGraph.ownership[usageIdx];
|
|
96318
96565
|
const lengthBefore = occurrences.length;
|
|
96319
|
-
|
|
96566
|
+
if (evaluated.kind === "evaluated") {
|
|
96567
|
+
emitTagCredits(occurrences, graph, filePath, fileGraph, usage, ownership, evaluated.credits, helperIndex, registry, opts);
|
|
96568
|
+
}
|
|
96320
96569
|
const admitted = stampComposition(lengthBefore, "jsx", usageIdx, ownership?.depth ?? 0, ownership?.parentUsageIdx);
|
|
96321
96570
|
if (admitted === 0)
|
|
96322
|
-
reportDroppedRender(opts, filePath, fileGraph.dialect, usage,
|
|
96571
|
+
reportDroppedRender(opts, filePath, fileGraph.dialect, usage, evaluated);
|
|
96323
96572
|
}
|
|
96324
96573
|
for (let i2 = 0; i2 < fileGraph.tagUsages.length; i2++) {
|
|
96325
96574
|
const usage = fileGraph.tagUsages[i2];
|
|
@@ -96384,7 +96633,7 @@ function resolve5(graph, opts) {
|
|
|
96384
96633
|
if (foldedAway !== null)
|
|
96385
96634
|
folded.set(entryKey(filePath, decl.symbol), foldedAway);
|
|
96386
96635
|
const lengthBefore = occurrences.length;
|
|
96387
|
-
pushArgumentSiteOccurrences(occurrences, filePath, decl, decl.value, holderJsx, graph, fileGraph, argMap, opts);
|
|
96636
|
+
pushArgumentSiteOccurrences(occurrences, filePath, decl, decl.value, holderJsx, graph, fileGraph, argMap, registry, opts);
|
|
96388
96637
|
compactSlice(lengthBefore);
|
|
96389
96638
|
}
|
|
96390
96639
|
}
|
|
@@ -96408,7 +96657,7 @@ function resolve5(graph, opts) {
|
|
|
96408
96657
|
};
|
|
96409
96658
|
const owners = () => chainOwners(graph, helperIndex, ownerRef);
|
|
96410
96659
|
const lengthBefore = occurrences.length;
|
|
96411
|
-
pushCallArgumentOccurrences(occurrences, filePath, call, owners, graph, fileGraph, argMap, opts);
|
|
96660
|
+
pushCallArgumentOccurrences(occurrences, filePath, call, owners, graph, fileGraph, argMap, registry, opts);
|
|
96412
96661
|
compactSlice(lengthBefore);
|
|
96413
96662
|
}
|
|
96414
96663
|
}
|
|
@@ -96505,32 +96754,6 @@ function relabelExternalLeaf(rawComponentId, filePath, specifier, resolveExterna
|
|
|
96505
96754
|
source: externalSource(hit.leafPackage, `${hit.leafPackage}/${hit.modulePath}`)
|
|
96506
96755
|
};
|
|
96507
96756
|
}
|
|
96508
|
-
function workspaceSiblingFallback(graph, resolvedTarget, matchedImport, effectiveImported, consumerDialect) {
|
|
96509
|
-
if (!resolvedTarget)
|
|
96510
|
-
return void 0;
|
|
96511
|
-
const chained = followReExportChain(graph, resolvedTarget, effectiveImported);
|
|
96512
|
-
const canonicalFile = chained?.file ?? resolvedTarget;
|
|
96513
|
-
let exportName = chained?.localExport ?? effectiveImported;
|
|
96514
|
-
if (!chained) {
|
|
96515
|
-
const target = graph.files.get(resolvedTarget);
|
|
96516
|
-
if (!target)
|
|
96517
|
-
return void 0;
|
|
96518
|
-
if (effectiveImported === "default") {
|
|
96519
|
-
const def = target.exports.find((e) => e.kind === "default");
|
|
96520
|
-
if (def && "local" in def)
|
|
96521
|
-
exportName = def.local;
|
|
96522
|
-
} else {
|
|
96523
|
-
const named = target.exports.find((e) => e.kind === "named" && "exportedAs" in e && e.exportedAs === effectiveImported && "local" in e);
|
|
96524
|
-
if (named && "local" in named)
|
|
96525
|
-
exportName = named.local;
|
|
96526
|
-
}
|
|
96527
|
-
}
|
|
96528
|
-
return {
|
|
96529
|
-
kind: componentKindFor(consumerDialect),
|
|
96530
|
-
export: exportName,
|
|
96531
|
-
source: { type: "local", filePath: canonicalFile }
|
|
96532
|
-
};
|
|
96533
|
-
}
|
|
96534
96757
|
function emitOccurrence(occurrences, site, rawComponentId, owners, chain, definition) {
|
|
96535
96758
|
const provisionalId = serialiseComponentId(rawComponentId);
|
|
96536
96759
|
for (const { rawOwnerComponentId, viaPrefix } of owners) {
|
|
@@ -96572,29 +96795,130 @@ function usageOwners(graph, helperIndex, ownerRef, viaOverride, fallbackFile) {
|
|
|
96572
96795
|
}
|
|
96573
96796
|
return chainOwners(graph, helperIndex, ownerRef);
|
|
96574
96797
|
}
|
|
96575
|
-
function
|
|
96576
|
-
|
|
96577
|
-
|
|
96578
|
-
|
|
96579
|
-
|
|
96798
|
+
function namesObjectMember(holder, path5) {
|
|
96799
|
+
return path5.length === 0 || memberOfObjectPath(holder, path5) !== void 0;
|
|
96800
|
+
}
|
|
96801
|
+
function evaluateJsxUsage(graph, fileGraph, usage, argMap) {
|
|
96802
|
+
if (fileGraph.dialect === "react" && isHostElementRoot(usage.ref))
|
|
96803
|
+
return { kind: "host-element" };
|
|
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: [] };
|
|
96580
96810
|
};
|
|
96581
|
-
|
|
96582
|
-
|
|
96583
|
-
|
|
96584
|
-
|
|
96585
|
-
|
|
96586
|
-
|
|
96587
|
-
|
|
96588
|
-
|
|
96589
|
-
|
|
96590
|
-
|
|
96591
|
-
|
|
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);
|
|
96868
|
+
}
|
|
96869
|
+
}
|
|
96870
|
+
function carriedDeclaration(credit) {
|
|
96871
|
+
const { identity } = credit.terminal;
|
|
96872
|
+
if (identity === null)
|
|
96873
|
+
return credit.declaration;
|
|
96874
|
+
return identity.kind === "local" ? identity.declaration : void 0;
|
|
96875
|
+
}
|
|
96876
|
+
function taggedDeclarations(graph, tagEvaluations) {
|
|
96877
|
+
const tagged = [];
|
|
96878
|
+
for (const [filePath, evaluations] of tagEvaluations) {
|
|
96879
|
+
const dialect = dialectForFile(graph, filePath);
|
|
96880
|
+
for (const evaluated of evaluations) {
|
|
96881
|
+
if (evaluated.kind !== "evaluated")
|
|
96882
|
+
continue;
|
|
96883
|
+
for (const credit of evaluated.credits) {
|
|
96884
|
+
if (!isCallable(credit.terminal))
|
|
96885
|
+
continue;
|
|
96886
|
+
const { identity } = credit.terminal;
|
|
96887
|
+
const id2 = buildComponentId(identity, credit.fallback, dialect);
|
|
96888
|
+
if (id2.kind === "react-component" && id2.source.type === "local") {
|
|
96889
|
+
const declaration2 = carriedDeclaration(credit);
|
|
96890
|
+
if (declaration2 !== void 0)
|
|
96891
|
+
tagged.push(declaration2);
|
|
96892
|
+
}
|
|
96893
|
+
}
|
|
96894
|
+
}
|
|
96895
|
+
}
|
|
96896
|
+
return tagged;
|
|
96897
|
+
}
|
|
96898
|
+
function emitTagCredits(occurrences, graph, filePath, fileGraph, usage, ownership, credits, helperIndex, registry, opts) {
|
|
96899
|
+
if (credits.length === 0)
|
|
96900
|
+
return;
|
|
96901
|
+
const viaOverride = ownership?.viaOverride;
|
|
96902
|
+
const site = usageSite(filePath, usage);
|
|
96903
|
+
const owners = usageOwners(graph, helperIndex, ownership?.ownerSymbolRef ?? null, viaOverride, filePath);
|
|
96904
|
+
for (const credit of credits) {
|
|
96905
|
+
const rawComponentId = componentIdFromIdentity(credit.terminal.identity, credit.fallback, fileGraph.dialect, {
|
|
96906
|
+
filePath,
|
|
96907
|
+
...credit.fallbackSpecifier !== void 0 ? { fallbackSpecifier: credit.fallbackSpecifier } : {},
|
|
96908
|
+
resolveExternalLeaf: opts?.resolveExternalLeaf
|
|
96909
|
+
});
|
|
96910
|
+
const declaration2 = carriedDeclaration(credit);
|
|
96911
|
+
const stands = isCallable(credit.terminal) ? registryTagged(registry, graph, rawComponentId, declaration2) : registryHolds(registry, graph, rawComponentId, declaration2);
|
|
96912
|
+
if (!stands)
|
|
96913
|
+
continue;
|
|
96914
|
+
emitOccurrence(occurrences, site, rawComponentId, owners, viaOverride !== void 0 ? [viaOverride] : [credit.outerVia, ...credit.terminal.viaTrail], credit.definition);
|
|
96915
|
+
}
|
|
96592
96916
|
}
|
|
96593
96917
|
function reportDroppedRender(opts, filePath, dialect, usage, outcome) {
|
|
96594
96918
|
const collector = opts?.collector;
|
|
96595
96919
|
if (collector === void 0)
|
|
96596
96920
|
return;
|
|
96597
|
-
if (
|
|
96921
|
+
if (outcome.kind === "host-element")
|
|
96598
96922
|
return;
|
|
96599
96923
|
const at = { filePath, line: usage.loc.line, column: usage.loc.column };
|
|
96600
96924
|
const positional = { ...at, symbol: usage.ref.symbol, memberChain: [...usage.ref.memberChain] };
|
|
@@ -96628,30 +96952,6 @@ function reportDroppedRender(opts, filePath, dialect, usage, outcome) {
|
|
|
96628
96952
|
}
|
|
96629
96953
|
collector.emit({ code: decided.code, severity: "info", ...positional });
|
|
96630
96954
|
}
|
|
96631
|
-
function pushLocalOccurrence(occurrences, filePath, usage, decl, graph, fileGraph, argMap, ownerRef, helperIndex, opts, viaOverride) {
|
|
96632
|
-
const value = usage.ref.memberChain.length > 0 ? resolveReference(graph, fileGraph, usage.ref) : decl.value;
|
|
96633
|
-
const evaluation = walkWithFolding(graph, fileGraph, value, argMap);
|
|
96634
|
-
const jsxTerminals = creditedTerminals(evaluation);
|
|
96635
|
-
if (jsxTerminals.length === 0)
|
|
96636
|
-
return { evaluation, value };
|
|
96637
|
-
const outerVia = viaOverride ?? { kind: "local-component" };
|
|
96638
|
-
const site = usageSite(filePath, usage);
|
|
96639
|
-
const owners = usageOwners(graph, helperIndex, ownerRef, viaOverride, fileGraph.filePath);
|
|
96640
|
-
const fallback = {
|
|
96641
|
-
kind: componentKindFor(fileGraph.dialect),
|
|
96642
|
-
export: compoundExportName(usage.ref.symbol, usage.ref.memberChain),
|
|
96643
|
-
source: { type: "local", filePath }
|
|
96644
|
-
};
|
|
96645
|
-
const definition = { line: decl.loc.line, column: decl.loc.column };
|
|
96646
|
-
for (const ft of jsxTerminals) {
|
|
96647
|
-
const rawComponentId = componentIdFromIdentity(ft.identity, fallback, fileGraph.dialect, {
|
|
96648
|
-
filePath,
|
|
96649
|
-
resolveExternalLeaf: opts?.resolveExternalLeaf
|
|
96650
|
-
});
|
|
96651
|
-
emitOccurrence(occurrences, site, rawComponentId, owners, viaOverride !== void 0 ? [viaOverride] : [outerVia, ...ft.viaTrail], ft.identity === null ? definition : void 0);
|
|
96652
|
-
}
|
|
96653
|
-
return { evaluation, value };
|
|
96654
|
-
}
|
|
96655
96955
|
function foldedHolder(holderJsx, filePath) {
|
|
96656
96956
|
if (holderJsx.length === 0 || holderJsx.some((t3) => t3.identity === null))
|
|
96657
96957
|
return null;
|
|
@@ -96659,7 +96959,7 @@ function foldedHolder(holderJsx, filePath) {
|
|
|
96659
96959
|
const sameFileSingle = first !== void 0 && first !== null && first.kind === "local" && first.filePath === filePath && holderJsx.every((t3) => t3.identity !== null && t3.identity.kind === "local" && t3.identity.filePath === filePath && t3.identity.export === first.export);
|
|
96660
96960
|
return { target: sameFileSingle ? { filePath, export: first.export } : null };
|
|
96661
96961
|
}
|
|
96662
|
-
function pushArgumentSiteOccurrences(occurrences, filePath, holder, call, holderJsx, graph, fileGraph, argMap, opts, depth = 0) {
|
|
96962
|
+
function pushArgumentSiteOccurrences(occurrences, filePath, holder, call, holderJsx, graph, fileGraph, argMap, registry, opts, depth = 0) {
|
|
96663
96963
|
const shape = callFoldShape(holderJsx);
|
|
96664
96964
|
if (shape === "wrapper") {
|
|
96665
96965
|
if (depth >= MAX_ARGUMENT_CALL_DEPTH || !call.args.some((a3) => a3.kind === "ReturnTypeOf"))
|
|
@@ -96668,7 +96968,7 @@ function pushArgumentSiteOccurrences(occurrences, filePath, holder, call, holder
|
|
|
96668
96968
|
if (folded?.arg.kind !== "ReturnTypeOf")
|
|
96669
96969
|
return;
|
|
96670
96970
|
const innerJsx = creditedTerminals(walkWithFolding(graph, fileGraph, folded.arg, argMap));
|
|
96671
|
-
pushArgumentSiteOccurrences(occurrences, filePath, holder, folded.arg, innerJsx, graph, fileGraph, argMap, opts, depth + 1);
|
|
96971
|
+
pushArgumentSiteOccurrences(occurrences, filePath, holder, folded.arg, innerJsx, graph, fileGraph, argMap, registry, opts, depth + 1);
|
|
96672
96972
|
return;
|
|
96673
96973
|
}
|
|
96674
96974
|
if (shape !== "product")
|
|
@@ -96681,7 +96981,7 @@ function pushArgumentSiteOccurrences(occurrences, filePath, holder, call, holder
|
|
|
96681
96981
|
originFile: filePath
|
|
96682
96982
|
};
|
|
96683
96983
|
const rawOwnerComponentId = hasOnlyHostElementNames(holder.symbol, fileGraph) ? void 0 : ownerIdFromRef(graph, holderRef, filePath);
|
|
96684
|
-
pushCallArgumentOccurrences(occurrences, filePath, call, () => [{ rawOwnerComponentId, viaPrefix: [] }], graph, fileGraph, argMap, opts, depth);
|
|
96984
|
+
pushCallArgumentOccurrences(occurrences, filePath, call, () => [{ rawOwnerComponentId, viaPrefix: [] }], graph, fileGraph, argMap, registry, opts, depth);
|
|
96685
96985
|
}
|
|
96686
96986
|
var MAX_ARGUMENT_CALL_DEPTH = 2;
|
|
96687
96987
|
function callFoldShape(jsx) {
|
|
@@ -96692,12 +96992,28 @@ function callFoldShape(jsx) {
|
|
|
96692
96992
|
return "product";
|
|
96693
96993
|
return credited === jsx.length ? "wrapper" : null;
|
|
96694
96994
|
}
|
|
96695
|
-
function
|
|
96995
|
+
function registryHolds(registry, graph, id2, declaration2) {
|
|
96996
|
+
if (id2.kind === "custom-element" || id2.source.type !== "local")
|
|
96997
|
+
return true;
|
|
96998
|
+
if (graph.files.get(id2.source.filePath)?.dialect !== "react")
|
|
96999
|
+
return true;
|
|
97000
|
+
return registry.isComponent(id2.source.filePath, id2.export, declaration2);
|
|
97001
|
+
}
|
|
97002
|
+
function registryTagged(registry, graph, id2, declaration2) {
|
|
97003
|
+
if (id2.kind !== "react-component" || id2.source.type !== "local")
|
|
97004
|
+
return true;
|
|
97005
|
+
if (graph.files.get(id2.source.filePath)?.dialect !== "react")
|
|
97006
|
+
return true;
|
|
97007
|
+
if (parseCompoundExport2(id2.export).isCompound)
|
|
97008
|
+
return true;
|
|
97009
|
+
return registry.isTagged(declaration2);
|
|
97010
|
+
}
|
|
97011
|
+
function pushCallArgumentOccurrences(occurrences, filePath, call, owners, graph, fileGraph, argMap, registry, opts, depth = 0) {
|
|
96696
97012
|
let resolvedOwners;
|
|
96697
97013
|
const seedIdentifier = (site, index, arg, hops) => {
|
|
96698
97014
|
if (isHostElementName(arg.ref.symbol))
|
|
96699
97015
|
return;
|
|
96700
|
-
const outerVia = { kind: "passed-as-argument", index, ...argumentProvenance(site, arg, fileGraph) };
|
|
97016
|
+
const outerVia = { kind: "passed-as-argument", index, ...argumentProvenance(graph, site, arg, fileGraph) };
|
|
96701
97017
|
const argDecl = findLocalDeclaration(fileGraph, arg.ref);
|
|
96702
97018
|
const unusedFallback = makeLocalComponentId(filePath, arg.ref.symbol, fileGraph.dialect);
|
|
96703
97019
|
for (const ft of creditedTerminals(walkWithFolding(graph, fileGraph, arg, argMap))) {
|
|
@@ -96707,6 +97023,8 @@ function pushCallArgumentOccurrences(occurrences, filePath, call, owners, graph,
|
|
|
96707
97023
|
filePath,
|
|
96708
97024
|
resolveExternalLeaf: opts?.resolveExternalLeaf
|
|
96709
97025
|
});
|
|
97026
|
+
if (!registryHolds(registry, graph, rawComponentId, ft.identity.kind === "local" ? ft.identity.declaration : void 0))
|
|
97027
|
+
continue;
|
|
96710
97028
|
resolvedOwners ??= owners();
|
|
96711
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);
|
|
96712
97030
|
}
|
|
@@ -101807,10 +102125,11 @@ var Logger = class {
|
|
|
101807
102125
|
};
|
|
101808
102126
|
|
|
101809
102127
|
// src/commands/scan.ts
|
|
102128
|
+
init_upload();
|
|
101810
102129
|
import { errorMessage as errorMessage2 } from "@component-compass/ast-utils";
|
|
101811
102130
|
|
|
101812
102131
|
// src/seeds.ts
|
|
101813
|
-
import { relative as relative4, isAbsolute as
|
|
102132
|
+
import { relative as relative4, isAbsolute as isAbsolute9 } from "node:path";
|
|
101814
102133
|
import { posixPath as posixPath6 } from "@component-compass/plugin-core";
|
|
101815
102134
|
|
|
101816
102135
|
// src/composition-rollup.ts
|
|
@@ -102173,7 +102492,7 @@ function buildComponentSeeds(parseResults, localIndex, repoRoot, workspaceGraph,
|
|
|
102173
102492
|
const seedsById = /* @__PURE__ */ new Map();
|
|
102174
102493
|
for (const result2 of parseResults) {
|
|
102175
102494
|
for (const occ of result2.occurrences) {
|
|
102176
|
-
const componentId = repoRoot && occ.componentId.source.type === "local" &&
|
|
102495
|
+
const componentId = repoRoot && occ.componentId.source.type === "local" && isAbsolute9(occ.componentId.source.filePath) ? {
|
|
102177
102496
|
...occ.componentId,
|
|
102178
102497
|
source: {
|
|
102179
102498
|
type: "local",
|
|
@@ -102318,7 +102637,7 @@ function indexedToComponentId(c2) {
|
|
|
102318
102637
|
}
|
|
102319
102638
|
|
|
102320
102639
|
// src/occurrences.ts
|
|
102321
|
-
import { relative as relative5, isAbsolute as
|
|
102640
|
+
import { relative as relative5, isAbsolute as isAbsolute10 } from "node:path";
|
|
102322
102641
|
import { posixPath as posixPath7 } from "@component-compass/plugin-core";
|
|
102323
102642
|
import {
|
|
102324
102643
|
computeOccurrenceId as computeOccurrenceId2,
|
|
@@ -102327,14 +102646,14 @@ import {
|
|
|
102327
102646
|
function normaliseLocalFilePath(c2, repoRoot) {
|
|
102328
102647
|
if (c2.source.type !== "local") return c2;
|
|
102329
102648
|
const fp = c2.source.filePath;
|
|
102330
|
-
if (!
|
|
102649
|
+
if (!isAbsolute10(fp)) return c2;
|
|
102331
102650
|
return {
|
|
102332
102651
|
...c2,
|
|
102333
102652
|
source: { type: "local", filePath: posixPath7(relative5(repoRoot, fp)) }
|
|
102334
102653
|
};
|
|
102335
102654
|
}
|
|
102336
102655
|
function toRelativePath2(absPath, repoRoot) {
|
|
102337
|
-
if (!repoRoot || !
|
|
102656
|
+
if (!repoRoot || !isAbsolute10(absPath)) return absPath;
|
|
102338
102657
|
return posixPath7(relative5(repoRoot, absPath));
|
|
102339
102658
|
}
|
|
102340
102659
|
function parseResultsToOccurrences(results, repoRoot = "") {
|
|
@@ -102534,7 +102853,7 @@ function createBoundedDefinitionResolver(opts) {
|
|
|
102534
102853
|
|
|
102535
102854
|
// src/scan/global-components.ts
|
|
102536
102855
|
import { existsSync as existsSync7, readFileSync as readFileSync11 } from "node:fs";
|
|
102537
|
-
import { dirname as dirname11, isAbsolute as
|
|
102856
|
+
import { dirname as dirname11, isAbsolute as isAbsolute11, join as join14, resolve as resolve10 } from "node:path";
|
|
102538
102857
|
var CANDIDATE_PATHS = [join14(".nuxt", "components.d.ts"), join14(".nuxt", "types", "components.d.ts")];
|
|
102539
102858
|
var AUGMENTED_MODULE = /declare\s+module\s+["'](?:vue|@vue\/runtime-core)["']\s*\{/g;
|
|
102540
102859
|
var INTERFACE_DECL = /(?:^|[\s;}])(?:export\s+)?(?:declare\s+)?interface\s+([A-Za-z_$][\w$]*)\s*(?:extends\s+([^{]*?))?\s*\{/g;
|
|
@@ -102628,7 +102947,7 @@ function loadGlobalComponents(scanRoot) {
|
|
|
102628
102947
|
return null;
|
|
102629
102948
|
}
|
|
102630
102949
|
function isBareSpecifier(importPath) {
|
|
102631
|
-
if (
|
|
102950
|
+
if (isAbsolute11(importPath)) return false;
|
|
102632
102951
|
return !/^[.#~\\/]/.test(importPath) && !importPath.startsWith("@/");
|
|
102633
102952
|
}
|
|
102634
102953
|
function parseMembers(baseDir, members) {
|
|
@@ -102644,7 +102963,7 @@ function parseMembers(baseDir, members) {
|
|
|
102644
102963
|
if (isBareSpecifier(importPath)) {
|
|
102645
102964
|
specifier = importPath;
|
|
102646
102965
|
} else {
|
|
102647
|
-
const abs =
|
|
102966
|
+
const abs = isAbsolute11(importPath) ? importPath : resolve10(baseDir, importPath);
|
|
102648
102967
|
const posixAbs = abs.replaceAll("\\", "/");
|
|
102649
102968
|
const nmIdx = posixAbs.lastIndexOf("node_modules/");
|
|
102650
102969
|
if (nmIdx >= 0) {
|
|
@@ -102710,7 +103029,7 @@ async function runScan(opts) {
|
|
|
102710
103029
|
if (repoIdOverride !== void 0) metaOpts.repoIdOverride = repoIdOverride;
|
|
102711
103030
|
const meta = await stampMeta(metaOpts);
|
|
102712
103031
|
const gitToplevel = await readGitToplevel(cfg.configDir);
|
|
102713
|
-
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;
|
|
102714
103033
|
const rebase = (scanRel) => outputRoot === cfg.configDir ? scanRel : posixPath8(relative6(outputRoot, resolve11(cfg.configDir, scanRel)));
|
|
102715
103034
|
if (opts.outputOverride) cfg.output = opts.outputOverride;
|
|
102716
103035
|
const writer = opts.quiet ? () => {
|
|
@@ -102977,7 +103296,7 @@ async function runScan(opts) {
|
|
|
102977
103296
|
// `snapshotManifestRefs()` — otherwise an undeclared package's full CEM
|
|
102978
103297
|
// catalog gets broadcast as zero-occurrence components.
|
|
102979
103298
|
resolveExternalLeaf: (fromFile, specifier, exportName) => {
|
|
102980
|
-
const absFrom =
|
|
103299
|
+
const absFrom = isAbsolute12(fromFile) ? fromFile : resolve11(cfg.configDir, fromFile);
|
|
102981
103300
|
const hit = warmedResolver.lookupExternalLeaf(absFrom, specifier, exportName);
|
|
102982
103301
|
if (!hit) return null;
|
|
102983
103302
|
return { leafPackage: hit.leafPackage, modulePath: hit.modulePath, exportName: hit.exportName };
|
|
@@ -102997,7 +103316,7 @@ async function runScan(opts) {
|
|
|
102997
103316
|
}
|
|
102998
103317
|
const diagnostics = rawDiagnostics.map((d2) => ({
|
|
102999
103318
|
...d2,
|
|
103000
|
-
filePath:
|
|
103319
|
+
filePath: isAbsolute12(d2.filePath) ? posixPath8(relative6(outputRoot, d2.filePath)) : d2.filePath
|
|
103001
103320
|
}));
|
|
103002
103321
|
const snapshot = warmedResolver.snapshotComponents().map((c2) => ({ component: c2 }));
|
|
103003
103322
|
const manifests = warmedResolver.snapshotManifestRefs();
|
|
@@ -103101,7 +103420,7 @@ async function runScan(opts) {
|
|
|
103101
103420
|
};
|
|
103102
103421
|
await stampGitMTime(outputRoot, scanOutput.components);
|
|
103103
103422
|
await stampVersion(outputRoot, scanOutput.components, scanOutput.occurrences);
|
|
103104
|
-
const outputPath =
|
|
103423
|
+
const outputPath = isAbsolute12(cfg.output) ? cfg.output : resolve11(cfg.configDir, cfg.output);
|
|
103105
103424
|
await writeJson(scanOutput, outputPath);
|
|
103106
103425
|
if (!opts.quiet) {
|
|
103107
103426
|
printSummary(scanOutput, outputPath);
|
|
@@ -103112,19 +103431,31 @@ async function runScan(opts) {
|
|
|
103112
103431
|
const { createAuthedUploader: createAuthedUploader2 } = await Promise.resolve().then(() => (init_upload_auth(), upload_auth_exports));
|
|
103113
103432
|
const uploader = await createAuthedUploader2({
|
|
103114
103433
|
...opts.hostOverride !== void 0 ? { flagHost: opts.hostOverride } : {},
|
|
103115
|
-
...cfg.host !== void 0 ? { configHost: cfg.host } : {}
|
|
103434
|
+
...cfg.host !== void 0 ? { configHost: cfg.host } : {},
|
|
103435
|
+
onStatus: (status) => {
|
|
103436
|
+
if (status.state === "queued" || status.state === "processing" || !status.readable && status.state === "duplicate") {
|
|
103437
|
+
log2.info(`Upload ${status.state}${status.stage ? ` (${status.stage})` : ""}; waiting for publication.`);
|
|
103438
|
+
}
|
|
103439
|
+
}
|
|
103116
103440
|
});
|
|
103117
103441
|
const result2 = await uploader.upload(JSON.stringify(scanOutput));
|
|
103118
103442
|
upload = result2.status === "inserted" ? "ok" : "exists";
|
|
103443
|
+
const scanUrl = new URL(result2.url, uploader.base).href;
|
|
103119
103444
|
log2.info(
|
|
103120
|
-
result2.status === "inserted" ? `Uploaded scan ${result2.scanId} \u2192 ${
|
|
103445
|
+
result2.status === "inserted" ? `Uploaded scan ${result2.scanId} \u2192 ${scanUrl}` : `Scan ${result2.scanId} already exists at ${scanUrl}; no changes.`
|
|
103121
103446
|
);
|
|
103122
103447
|
} catch (err2) {
|
|
103123
103448
|
upload = "failed";
|
|
103124
103449
|
const { formatAuthError: formatAuthError2 } = await Promise.resolve().then(() => (init_session(), session_exports));
|
|
103125
|
-
const authMsg = formatAuthError2(err2);
|
|
103450
|
+
const authMsg = formatAuthError2(err2 instanceof UploadPollingError ? err2.cause : err2);
|
|
103126
103451
|
const msg = authMsg ?? (err2 instanceof Error ? err2.message : String(err2));
|
|
103127
|
-
|
|
103452
|
+
if (err2 instanceof UploadPollingError) {
|
|
103453
|
+
const outcome = err2.outcome === "unknown" ? "outcome unknown" : "failed";
|
|
103454
|
+
const continuation = err2.outcome === "unknown" ? " The server job may still be processing or may have completed." : "";
|
|
103455
|
+
log2.error(`Upload ${outcome}: ${msg}. Check upload ${err2.receipt.uploadId} at ${err2.statusUrl}.${continuation}`);
|
|
103456
|
+
} else {
|
|
103457
|
+
log2.error(`Upload ${err2 instanceof UploadPendingError ? "pending" : "failed"}: ${msg}`);
|
|
103458
|
+
}
|
|
103128
103459
|
}
|
|
103129
103460
|
}
|
|
103130
103461
|
return { output: scanOutput, upload };
|
|
@@ -103137,14 +103468,14 @@ function countFilesWithUsage(occurrences) {
|
|
|
103137
103468
|
function normaliseEngineLocalId(c2, configDir2, rebase) {
|
|
103138
103469
|
if (c2.source.type !== "local") return c2;
|
|
103139
103470
|
const fp = c2.source.filePath;
|
|
103140
|
-
const scanRel =
|
|
103471
|
+
const scanRel = isAbsolute12(fp) ? posixPath8(relative6(configDir2, fp)) : fp;
|
|
103141
103472
|
return {
|
|
103142
103473
|
...c2,
|
|
103143
103474
|
source: { type: "local", filePath: rebase(scanRel) }
|
|
103144
103475
|
};
|
|
103145
103476
|
}
|
|
103146
103477
|
function normaliseVia(v, configDir2, rebase) {
|
|
103147
|
-
if (!("specifier" in v) || v.specifier === void 0 || !
|
|
103478
|
+
if (!("specifier" in v) || v.specifier === void 0 || !isAbsolute12(v.specifier)) return v;
|
|
103148
103479
|
const scanRel = posixPath8(relative6(configDir2, v.specifier));
|
|
103149
103480
|
return { ...v, specifier: rebase(scanRel) };
|
|
103150
103481
|
}
|
|
@@ -103152,7 +103483,7 @@ function normaliseVia(v, configDir2, rebase) {
|
|
|
103152
103483
|
// src/commands/init.ts
|
|
103153
103484
|
init_adapter();
|
|
103154
103485
|
import { writeFile as writeFile3, stat as stat2, readFile as readFile6 } from "node:fs/promises";
|
|
103155
|
-
import { basename as basename5, isAbsolute as
|
|
103486
|
+
import { basename as basename5, isAbsolute as isAbsolute13, resolve as resolve12 } from "node:path";
|
|
103156
103487
|
var DEFAULT_INCLUDE = "src/**/*.{ts,tsx,jsx,js,vue,html}";
|
|
103157
103488
|
var FRAMEWORK_EXTS = {
|
|
103158
103489
|
react: ["ts", "tsx", "js", "jsx"],
|
|
@@ -103184,7 +103515,7 @@ function buildConfig(o2) {
|
|
|
103184
103515
|
};
|
|
103185
103516
|
}
|
|
103186
103517
|
async function runInit(opts) {
|
|
103187
|
-
const cwd2 =
|
|
103518
|
+
const cwd2 = isAbsolute13(opts.cwd) ? opts.cwd : resolve12(opts.cwd);
|
|
103188
103519
|
const out2 = opts.outputPath ?? resolve12(cwd2, "component-compass.config.json");
|
|
103189
103520
|
await assertNoExistingConfig(out2);
|
|
103190
103521
|
const repoId = opts.repoId ?? await deriveRepoId(cwd2);
|