headlamp 0.1.24 → 0.1.25
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.cjs +88 -35
- package/dist/cli.cjs.map +3 -3
- package/dist/index.js +88 -35
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -4016,7 +4016,7 @@ var require_jiti = __commonJS({
|
|
|
4016
4016
|
}, pathe_M_eThtNZ_dirname = function(p3) {
|
|
4017
4017
|
const segments = pathe_M_eThtNZ_normalizeWindowsPath(p3).replace(/\/$/, "").split("/").slice(0, -1);
|
|
4018
4018
|
return 1 === segments.length && _DRIVE_LETTER_RE2.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute8(p3) ? "/" : ".");
|
|
4019
|
-
},
|
|
4019
|
+
}, basename7 = function(p3, extension) {
|
|
4020
4020
|
const segments = pathe_M_eThtNZ_normalizeWindowsPath(p3).split("/");
|
|
4021
4021
|
let lastSegment = "";
|
|
4022
4022
|
for (let i3 = segments.length - 1; i3 >= 0; i3--) {
|
|
@@ -4722,7 +4722,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
4722
4722
|
if (!ctx.opts.fsCache || !topts.filename) return get();
|
|
4723
4723
|
const sourceHash = ` /* v${CACHE_VERSION}-${hash2(topts.source, 16)} */
|
|
4724
4724
|
`;
|
|
4725
|
-
let cacheName = `${
|
|
4725
|
+
let cacheName = `${basename7(pathe_M_eThtNZ_dirname(topts.filename))}-${function(path16) {
|
|
4726
4726
|
const base = path16.split(utils_SLASH_RE).pop();
|
|
4727
4727
|
if (!base) return;
|
|
4728
4728
|
const separatorIndex = base.lastIndexOf(".");
|
|
@@ -4768,7 +4768,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
4768
4768
|
return code.startsWith("#!") && (code = "// " + code), code;
|
|
4769
4769
|
}
|
|
4770
4770
|
function eval_evalModule(ctx, source, evalOptions = {}) {
|
|
4771
|
-
const id = evalOptions.id || (evalOptions.filename ?
|
|
4771
|
+
const id = evalOptions.id || (evalOptions.filename ? basename7(evalOptions.filename) : `_jitiEval.${evalOptions.ext || (evalOptions.async ? "mjs" : "js")}`), filename = evalOptions.filename || jitiResolve(ctx, id, { async: evalOptions.async }), ext = evalOptions.ext || extname5(filename), cache3 = evalOptions.cache || ctx.parentCache || {}, isTypescript = /\.[cm]?tsx?$/.test(ext), isESM = ".mjs" === ext || ".js" === ext && "module" === function(path16) {
|
|
4772
4772
|
for (; path16 && "." !== path16 && "/" !== path16; ) {
|
|
4773
4773
|
path16 = pathe_M_eThtNZ_join(path16, "..");
|
|
4774
4774
|
try {
|
|
@@ -6223,10 +6223,10 @@ One of the following config files must be in the directory tree: "${_index.ROOT_
|
|
|
6223
6223
|
const parts = _path().resolve(dirname7, pattern).split(_path().sep);
|
|
6224
6224
|
return new RegExp(["^", ...parts.map((part, i2) => {
|
|
6225
6225
|
const last = i2 === parts.length - 1;
|
|
6226
|
-
return "**" === part ? last ? starStarPatLast : starStarPat : "*" === part ? last ? starPatLast : starPat : 0 === part.indexOf("*.") ? substitution + escapeRegExp(part.slice(1)) + (last ? endSep :
|
|
6226
|
+
return "**" === part ? last ? starStarPatLast : starStarPat : "*" === part ? last ? starPatLast : starPat : 0 === part.indexOf("*.") ? substitution + escapeRegExp(part.slice(1)) + (last ? endSep : sep3) : escapeRegExp(part) + (last ? endSep : sep3);
|
|
6227
6227
|
})].join(""));
|
|
6228
6228
|
};
|
|
6229
|
-
const
|
|
6229
|
+
const sep3 = `\\${_path().sep}`, endSep = `(?:${sep3}|$)`, substitution = `[^${sep3}]+`, starPat = `(?:${substitution}${sep3})`, starPatLast = `(?:${substitution}${endSep})`, starStarPat = `${starPat}*?`, starStarPatLast = `${starPat}*?${starPatLast}?`;
|
|
6230
6230
|
function escapeRegExp(string) {
|
|
6231
6231
|
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
|
6232
6232
|
}
|
|
@@ -9137,11 +9137,11 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
9137
9137
|
function maybePrintTrailingCommaOrSemicolon(printer, node) {
|
|
9138
9138
|
printer.tokenMap && node.start && node.end ? printer.tokenMap.endMatches(node, ",") ? printer.token(",") : printer.tokenMap.endMatches(node, ";") && printer.semicolon() : printer.semicolon();
|
|
9139
9139
|
}
|
|
9140
|
-
function tsPrintUnionOrIntersectionType(printer, node,
|
|
9140
|
+
function tsPrintUnionOrIntersectionType(printer, node, sep3) {
|
|
9141
9141
|
var _printer$tokenMap;
|
|
9142
9142
|
let hasLeadingToken = 0;
|
|
9143
|
-
null != (_printer$tokenMap = printer.tokenMap) && _printer$tokenMap.startMatches(node,
|
|
9144
|
-
this.space(), this.token(
|
|
9143
|
+
null != (_printer$tokenMap = printer.tokenMap) && _printer$tokenMap.startMatches(node, sep3) && (hasLeadingToken = 1, printer.token(sep3)), printer.printJoin(node.types, void 0, void 0, function(i2) {
|
|
9144
|
+
this.space(), this.token(sep3, null, i2 + hasLeadingToken), this.space();
|
|
9145
9145
|
});
|
|
9146
9146
|
}
|
|
9147
9147
|
function tokenIfPlusMinus(self2, tok) {
|
|
@@ -23153,8 +23153,8 @@ ${str}
|
|
|
23153
23153
|
}
|
|
23154
23154
|
}
|
|
23155
23155
|
dump() {
|
|
23156
|
-
const
|
|
23157
|
-
console.log(
|
|
23156
|
+
const sep3 = "-".repeat(60);
|
|
23157
|
+
console.log(sep3);
|
|
23158
23158
|
let scope = this;
|
|
23159
23159
|
do {
|
|
23160
23160
|
console.log("#", scope.block.type);
|
|
@@ -23163,7 +23163,7 @@ ${str}
|
|
|
23163
23163
|
console.log(" -", name, { constant: binding.constant, references: binding.references, violations: binding.constantViolations.length, kind: binding.kind });
|
|
23164
23164
|
}
|
|
23165
23165
|
} while (scope = scope.parent);
|
|
23166
|
-
console.log(
|
|
23166
|
+
console.log(sep3);
|
|
23167
23167
|
}
|
|
23168
23168
|
hasLabel(name) {
|
|
23169
23169
|
return !!this.getLabel(name);
|
|
@@ -56235,7 +56235,6 @@ var filterCandidatesForProject = async (cfgPath, jestArgs, candidates, cwd2) =>
|
|
|
56235
56235
|
}
|
|
56236
56236
|
const toPosixNormalized = (inputPath) => inputPath.replace(/\\/g, "/");
|
|
56237
56237
|
const relativePatterns = candidates.map((absOrRel) => path6.isAbsolute(absOrRel) ? path6.relative(cwd2, absOrRel) : absOrRel).map(toPosixNormalized);
|
|
56238
|
-
console.log("relativePatterns:", relativePatterns);
|
|
56239
56238
|
let attemptPatterns = [];
|
|
56240
56239
|
try {
|
|
56241
56240
|
attemptPatterns = await discoverJest([...jestArgs, "--config", cfgPath], {
|
|
@@ -56249,11 +56248,35 @@ var filterCandidatesForProject = async (cfgPath, jestArgs, candidates, cwd2) =>
|
|
|
56249
56248
|
(candidatePath) => toPosixNormalized(candidatePath)
|
|
56250
56249
|
);
|
|
56251
56250
|
if (normalizedAttemptPatterns.length > 0) {
|
|
56251
|
+
console.info(`Selected files \u2192 count=${normalizedAttemptPatterns.length}`);
|
|
56252
|
+
console.info("Selected files \u2192");
|
|
56253
|
+
normalizedAttemptPatterns.forEach((pattern) => console.info(` - ${pattern}`));
|
|
56252
56254
|
return normalizedAttemptPatterns;
|
|
56253
56255
|
}
|
|
56256
|
+
try {
|
|
56257
|
+
const allInProject = await discoverJestResilient([...jestArgs, "--config", cfgPath], {
|
|
56258
|
+
cwd: cwd2
|
|
56259
|
+
});
|
|
56260
|
+
const normalizedAll = allInProject.map((p3) => toPosixNormalized(p3));
|
|
56261
|
+
const bySuffix = normalizedAll.filter(
|
|
56262
|
+
(abs) => relativePatterns.some(
|
|
56263
|
+
(rel) => abs.endsWith(`/${rel}`) || abs.endsWith(rel) || abs.endsWith(`/${rel.split("/").pop()}`)
|
|
56264
|
+
)
|
|
56265
|
+
);
|
|
56266
|
+
if (bySuffix.length > 0) {
|
|
56267
|
+
console.info(`Selected files \u2192 count=${bySuffix.length}`);
|
|
56268
|
+
console.info("Selected files \u2192");
|
|
56269
|
+
bySuffix.forEach((p3) => console.info(` - ${p3}`));
|
|
56270
|
+
return bySuffix;
|
|
56271
|
+
}
|
|
56272
|
+
} catch {
|
|
56273
|
+
}
|
|
56254
56274
|
const absoluteFromRelative = relativePatterns.map(
|
|
56255
56275
|
(rel) => toPosixNormalized(path6.join(cwd2, rel))
|
|
56256
56276
|
);
|
|
56277
|
+
console.info(`Selected files \u2192 count=${absoluteFromRelative.length}`);
|
|
56278
|
+
console.info("Selected files \u2192");
|
|
56279
|
+
absoluteFromRelative.forEach((p3) => console.info(` - ${p3}`));
|
|
56257
56280
|
return absoluteFromRelative;
|
|
56258
56281
|
};
|
|
56259
56282
|
var decideShouldRunJest = (vitestFiles, jestFiles, opts) => {
|
|
@@ -57349,12 +57372,12 @@ var renderPerFileCompositeTable = async (opts) => {
|
|
|
57349
57372
|
}
|
|
57350
57373
|
const table = renderTable(cols, rows);
|
|
57351
57374
|
console.info(table);
|
|
57352
|
-
const
|
|
57375
|
+
const sep3 = ansi.gray(
|
|
57353
57376
|
"\u2500".repeat(
|
|
57354
57377
|
Math.max(20, typeof process.stdout.columns === "number" ? process.stdout.columns : 100)
|
|
57355
57378
|
)
|
|
57356
57379
|
);
|
|
57357
|
-
console.info(
|
|
57380
|
+
console.info(sep3);
|
|
57358
57381
|
};
|
|
57359
57382
|
var printPerFileCompositeTables = async (opts) => {
|
|
57360
57383
|
const selectionAbs = (opts.selectionPaths ?? []).map(
|
|
@@ -59666,7 +59689,6 @@ var DEFAULT_EXCLUDES = [
|
|
|
59666
59689
|
];
|
|
59667
59690
|
var unique = (values) => Array.from(new Set(values));
|
|
59668
59691
|
var resolveTokens = async (tokens, repoRoot, opts) => {
|
|
59669
|
-
const includeGlobs = opts?.includeGlobs ?? [];
|
|
59670
59692
|
const excludeGlobs = unique([...opts?.excludeGlobs ?? [], ...DEFAULT_EXCLUDES]);
|
|
59671
59693
|
const results = /* @__PURE__ */ new Set();
|
|
59672
59694
|
const pushIf = (absPath) => {
|
|
@@ -59674,21 +59696,22 @@ var resolveTokens = async (tokens, repoRoot, opts) => {
|
|
|
59674
59696
|
if (existsFile(norm)) results.add(norm);
|
|
59675
59697
|
};
|
|
59676
59698
|
for (const raw of tokens) {
|
|
59677
|
-
const
|
|
59678
|
-
if (!
|
|
59699
|
+
const tokenRaw = String(raw || "").trim();
|
|
59700
|
+
if (!tokenRaw) {
|
|
59679
59701
|
continue;
|
|
59680
59702
|
}
|
|
59681
|
-
if (path14.isAbsolute(
|
|
59682
|
-
pushIf(
|
|
59703
|
+
if (path14.isAbsolute(tokenRaw)) {
|
|
59704
|
+
pushIf(tokenRaw);
|
|
59683
59705
|
continue;
|
|
59684
59706
|
}
|
|
59685
|
-
if (
|
|
59686
|
-
pushIf(path14.join(repoRoot,
|
|
59707
|
+
if (tokenRaw.startsWith("/")) {
|
|
59708
|
+
pushIf(path14.join(repoRoot, tokenRaw.slice(1)));
|
|
59687
59709
|
}
|
|
59688
|
-
|
|
59689
|
-
|
|
59690
|
-
|
|
59691
|
-
|
|
59710
|
+
const token = tokenRaw.startsWith("/") ? tokenRaw.slice(1) : tokenRaw;
|
|
59711
|
+
const trySearch = async (patterns) => {
|
|
59712
|
+
const args = ["--files"];
|
|
59713
|
+
for (const pat of patterns) {
|
|
59714
|
+
args.push("-g", pat);
|
|
59692
59715
|
}
|
|
59693
59716
|
for (const g3 of excludeGlobs) {
|
|
59694
59717
|
args.push("-g", g3);
|
|
@@ -59699,6 +59722,20 @@ var resolveTokens = async (tokens, repoRoot, opts) => {
|
|
|
59699
59722
|
timeoutMs: 4e3
|
|
59700
59723
|
});
|
|
59701
59724
|
out.split(/\r?\n/).map((ln2) => ln2.trim()).filter(Boolean).map((rel) => toAbsPosix(path14.resolve(repoRoot, rel))).forEach((abs) => results.add(abs));
|
|
59725
|
+
};
|
|
59726
|
+
try {
|
|
59727
|
+
await trySearch([`**/${token}`]);
|
|
59728
|
+
if (![...results].some(
|
|
59729
|
+
(p3) => p3.endsWith(path14.sep + token) || p3.endsWith("/" + token) || p3.endsWith(token)
|
|
59730
|
+
)) {
|
|
59731
|
+
const base = path14.basename(token);
|
|
59732
|
+
if (base && base !== token) {
|
|
59733
|
+
try {
|
|
59734
|
+
await trySearch([`**/${base}`]);
|
|
59735
|
+
} catch {
|
|
59736
|
+
}
|
|
59737
|
+
}
|
|
59738
|
+
}
|
|
59702
59739
|
} catch {
|
|
59703
59740
|
}
|
|
59704
59741
|
}
|
|
@@ -59711,8 +59748,7 @@ var resolveTokens = async (tokens, repoRoot, opts) => {
|
|
|
59711
59748
|
return unique(filtered);
|
|
59712
59749
|
};
|
|
59713
59750
|
var resolveTestSelectionTokens = async (tokens, repoRoot) => resolveTokens(tokens, repoRoot, {
|
|
59714
|
-
onlyTestFiles: true
|
|
59715
|
-
includeGlobs: ["**/*.test.*", "**/*.spec.*", "tests/**/*"]
|
|
59751
|
+
onlyTestFiles: true
|
|
59716
59752
|
});
|
|
59717
59753
|
var resolveProdSelectionTokens = async (tokens, repoRoot) => resolveTokens(tokens, repoRoot, { forbidTestFiles: true });
|
|
59718
59754
|
|
|
@@ -59908,9 +59944,9 @@ var emitMergedCoverage = async (ui2, opts) => {
|
|
|
59908
59944
|
if (/^\s*(Statements|Branches|Functions|Lines)\s*:/.test(lineText)) {
|
|
59909
59945
|
const updated = lineText.replace(
|
|
59910
59946
|
/(Statements|Branches|Functions|Lines)(\s*:\s*)(\d+(?:\.\d+)?)(%)/,
|
|
59911
|
-
(_m, label,
|
|
59947
|
+
(_m, label, sep3, num, pct) => {
|
|
59912
59948
|
const colorize = tintPct(Number(num));
|
|
59913
|
-
return `${colorize(label)}${
|
|
59949
|
+
return `${colorize(label)}${sep3}${colorize(`${num}${pct}`)}`;
|
|
59914
59950
|
}
|
|
59915
59951
|
);
|
|
59916
59952
|
return updated.replace(/\(\s*(\d+)\s*\/\s*(\d+)\s*\)/, (_match, coveredText, totalText) => {
|
|
@@ -60319,7 +60355,7 @@ var program = async () => {
|
|
|
60319
60355
|
`Selection classify \u2192 looksLikePath=${selectionLooksLikePath} looksLikeTest=${selectionLooksLikeTest} prodPaths=${selectionIncludesProdPaths}`
|
|
60320
60356
|
);
|
|
60321
60357
|
const stripPathTokens = (args) => args.filter((token) => !selectionPathsAugmented.includes(token));
|
|
60322
|
-
const jestDiscoveryArgs = selectionIncludesProdPaths ? stripPathTokens(jest) : jest;
|
|
60358
|
+
const jestDiscoveryArgs = selectionIncludesProdPaths || selectionHasPaths && selectionLooksLikeTest ? stripPathTokens(jest) : jest;
|
|
60323
60359
|
const projectConfigs = [];
|
|
60324
60360
|
try {
|
|
60325
60361
|
const baseCfg = path15.resolve("jest.config.js");
|
|
@@ -60334,7 +60370,20 @@ var program = async () => {
|
|
|
60334
60370
|
console.warn(`Failed to discover Jest project configs: ${String(err)}`);
|
|
60335
60371
|
}
|
|
60336
60372
|
const perProjectFiles = /* @__PURE__ */ new Map();
|
|
60337
|
-
if (!namePatternOnlyForDiscovery &&
|
|
60373
|
+
if (!namePatternOnlyForDiscovery && selectionLooksLikeTest && selectionHasPaths) {
|
|
60374
|
+
await Promise.all(
|
|
60375
|
+
projectConfigs.map(async (cfg) => {
|
|
60376
|
+
const cfgCwd = path15.dirname(cfg);
|
|
60377
|
+
const owned = await filterCandidatesForProject(
|
|
60378
|
+
cfg,
|
|
60379
|
+
jestDiscoveryArgs,
|
|
60380
|
+
resolvedSelectionTestPaths,
|
|
60381
|
+
cfgCwd
|
|
60382
|
+
);
|
|
60383
|
+
perProjectFiles.set(cfg, owned);
|
|
60384
|
+
})
|
|
60385
|
+
);
|
|
60386
|
+
} else if (!namePatternOnlyForDiscovery && selectionIncludesProdPaths) {
|
|
60338
60387
|
console.info(
|
|
60339
60388
|
`Discovering (rg-first) \u2192 related=${selectionIncludesProdPaths} | cwd=${repoRootForDiscovery}`
|
|
60340
60389
|
);
|
|
@@ -60447,9 +60496,7 @@ var program = async () => {
|
|
|
60447
60496
|
const perProjectFiltered = /* @__PURE__ */ new Map();
|
|
60448
60497
|
for (const cfg of projectConfigs) {
|
|
60449
60498
|
const files = perProjectFiles.get(cfg) ?? [];
|
|
60450
|
-
const selectionTestPaths = selectionPathsAugmented.filter(
|
|
60451
|
-
(pathToken) => /\.(test|spec)\.[tj]sx?$/i.test(pathToken) || /(^|\/)tests?\//i.test(pathToken)
|
|
60452
|
-
);
|
|
60499
|
+
const selectionTestPaths = selectionPathsAugmented.filter(isTestLikePathToken);
|
|
60453
60500
|
const selectionTestAbs = resolvedSelectionTestPaths.length ? resolvedSelectionTestPaths : selectionTestPaths;
|
|
60454
60501
|
const candidates = selectionHasPaths && selectionLooksLikeTest ? selectionTestAbs : files;
|
|
60455
60502
|
const absFiles = candidates.map(
|
|
@@ -60817,7 +60864,13 @@ var program = async () => {
|
|
|
60817
60864
|
if (shouldRunJest) {
|
|
60818
60865
|
console.info("Starting Jest (no Vitest targets)\u2026");
|
|
60819
60866
|
await runJestBootstrap(bootstrapCommand);
|
|
60820
|
-
const jestRunArgs = selectionIncludesProdPaths ? stripPathTokens(jestArgs) :
|
|
60867
|
+
const jestRunArgs = selectionIncludesProdPaths ? stripPathTokens(jestArgs) : selectionHasPaths && selectionLooksLikeTest && (resolvedSelectionTestPaths?.length ?? 0) > 0 ? (() => {
|
|
60868
|
+
const base = stripPathTokens(jestArgs);
|
|
60869
|
+
const resolved = (resolvedSelectionTestPaths ?? []).map(
|
|
60870
|
+
(absPath) => path15.resolve(absPath).replace(/\\/g, "/")
|
|
60871
|
+
);
|
|
60872
|
+
return [...base, ...resolved];
|
|
60873
|
+
})() : jestArgs;
|
|
60821
60874
|
const sanitizedJestRunArgs = jestRunArgs.filter(
|
|
60822
60875
|
(arg) => !/^--coverageDirectory(?:=|$)/.test(String(arg))
|
|
60823
60876
|
);
|