@icebreakers/monorepo 6.4.0 → 6.4.1
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/{baseline-BahTYIy-.mjs → baseline-CgvgNCUI.mjs} +3 -5
- package/dist/{bundle-B9vRch4R.mjs → bundle-BT26jZsH.mjs} +1 -2
- package/dist/{catalog-CXITrKhb.mjs → catalog-zafyCCYH.mjs} +11 -18
- package/dist/cli.mjs +141 -220
- package/dist/{commands-1ApnhvJF.mjs → commands-By0wXIqB.mjs} +371 -725
- package/dist/{config-BmK7bacv.mjs → config-CnB1hpD_.mjs} +4 -5
- package/dist/{create-flow-B2sFa_5j.mjs → create-flow-B6mkhe47.mjs} +6 -9
- package/dist/{deps-BbkQSTqk.mjs → deps-BJyokXyG.mjs} +6 -8
- package/dist/docs-context-entry.d.mts +0 -4
- package/dist/docs-context-entry.mjs +2 -4
- package/dist/{execute-0NGtp4hR.mjs → execute-By0DFwdk.mjs} +12 -22
- package/dist/{execute-BdnLU2-t.mjs → execute-dyUt94Dv.mjs} +4 -6
- package/dist/{format-BcU-hzT_.mjs → format-qyk-2EXc.mjs} +2 -3
- package/dist/{index-BBYRSLAi.d.mts → index-CyUOTGW4.d.mts} +1 -85
- package/dist/index.d.mts +3 -345
- package/dist/index.mjs +11 -13
- package/dist/{inputs-DCMUM9kz.mjs → inputs-D0jkn1xJ.mjs} +2 -3
- package/dist/{npm-DB-0FHcW.mjs → npm-BkilS3Rx.mjs} +2 -3
- package/dist/{plan-C47MSubl.mjs → plan-lepevajA.mjs} +2 -3
- package/dist/{rolldown-runtime-8H4AJuhK.mjs → rolldown-runtime-BJohB4LM.mjs} +1 -2
- package/dist/{run-5IdtzJJR.mjs → run-Coc92Trs.mjs} +6 -8
- package/dist/{save-cKCfFQrh.mjs → save-6C5t4ZGp.mjs} +4 -5
- package/dist/{scan-Diyd5MkZ.mjs → scan-DsiJldTw.mjs} +7 -12
- package/dist/{template-drift-C8gMh7d5.mjs → template-drift-DOG6iGjV.mjs} +60 -113
- package/dist/tooling-entry.d.mts +1 -1
- package/dist/tooling-entry.mjs +2 -2
- package/dist/{transaction-B33_Cacq.mjs → transaction-DWst6RWq.mjs} +6 -10
- package/dist/{tsconfig-B32VPzfD.mjs → tsconfig-KnvwNzkL.mjs} +36 -63
- package/dist/{vitest-HFe4zq1M.mjs → vitest-YHXyRHui.mjs} +6 -9
- package/dist/{workspace-tasks-xyIJwdmH.mjs → workspace-tasks-i69iIhom.mjs} +78 -157
- package/package.json +10 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as dependencySections, i as rangesOverlap, r as parseSpecifier, t as scanDependencies } from "./scan-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.mjs";
|
|
2
|
+
import { D as relativeFile, N as ConfigValidationError, T as readOptional, W as resolveNightlyConfig, f as loadMonorepoConfigDetails, j as version, p as resolveCommandConfig, w as hash } from "./tsconfig-KnvwNzkL.mjs";
|
|
3
|
+
import { J as getWorkspaceGraph, St as localize, Y as parseDependencyReference, at as record$4, jt as fs$2, nt as workspaceDependencyTypes, rt as hash$1, ut as hasLegacyToolingReference } from "./workspace-tasks-i69iIhom.mjs";
|
|
4
|
+
import { a as dependencySections, i as rangesOverlap, r as parseSpecifier, t as scanDependencies } from "./scan-DsiJldTw.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { findWorkspaceDir } from "@pnpm/find-workspace-dir";
|
|
7
7
|
import path from "pathe";
|
|
@@ -33,8 +33,7 @@ const legacyStagedConfigNames = [
|
|
|
33
33
|
"mts"
|
|
34
34
|
].flatMap((extension) => [`lint-staged.config.${extension}`, `.lintstagedrc.${extension}`])
|
|
35
35
|
];
|
|
36
|
-
|
|
37
|
-
//#region src/commands/doctor/helpers.ts
|
|
36
|
+
// src/commands/doctor/helpers.ts
|
|
38
37
|
function createCheck(check) {
|
|
39
38
|
return check;
|
|
40
39
|
}
|
|
@@ -65,13 +64,11 @@ function isWorkspacePatternCovered(relativeDir, patterns) {
|
|
|
65
64
|
return normalized === pattern;
|
|
66
65
|
});
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
//#region src/commands/doctor/manifest/types.ts
|
|
67
|
+
// src/commands/doctor/manifest/types.ts
|
|
70
68
|
function record$3(value) {
|
|
71
69
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
72
70
|
}
|
|
73
|
-
|
|
74
|
-
//#region src/commands/template-drift/files.ts
|
|
71
|
+
// src/commands/template-drift/files.ts
|
|
75
72
|
const contentHash = (content) => createHash("sha256").update(content).digest("hex");
|
|
76
73
|
const errorDetail = (error) => error instanceof Error ? error.message : String(error);
|
|
77
74
|
const isMissing = (error) => ["ENOENT", "ENOTDIR"].includes(error.code ?? "");
|
|
@@ -119,8 +116,7 @@ function localDriftState(files, baseline) {
|
|
|
119
116
|
if (files.some((file) => file.state === "modified" || file.state === "deleted")) return "drifted";
|
|
120
117
|
return files.length && files.every((file) => file.state === "excluded") ? "excluded" : "unchanged";
|
|
121
118
|
}
|
|
122
|
-
|
|
123
|
-
//#region src/commands/template-drift/versions.ts
|
|
119
|
+
// src/commands/template-drift/versions.ts
|
|
124
120
|
const templatePackageName = "@icebreakers/monorepo-templates";
|
|
125
121
|
async function collectVersionEvidence(options) {
|
|
126
122
|
const kind = options.remote ? "remote" : options.sourceDir ? "extracted" : "installed";
|
|
@@ -176,8 +172,7 @@ function compareTemplateVersion(source, evidence) {
|
|
|
176
172
|
detail: `Compared retained ${source.version} with ${evidence.kind} ${evidence.version}; ${status === "newer" ? "a newer package version is known" : status === "ahead" ? "the retained source is newer than this comparison package" : "these package versions match"}.`
|
|
177
173
|
};
|
|
178
174
|
}
|
|
179
|
-
|
|
180
|
-
//#region src/commands/template-drift/instances.ts
|
|
175
|
+
// src/commands/template-drift/instances.ts
|
|
181
176
|
async function inspectInstance(workspaceDir, instance, evidence) {
|
|
182
177
|
const owner = {
|
|
183
178
|
kind: "instance",
|
|
@@ -303,22 +298,20 @@ async function collectInstanceDrift(workspaceDir, evidence) {
|
|
|
303
298
|
};
|
|
304
299
|
}
|
|
305
300
|
}
|
|
306
|
-
|
|
307
|
-
//#region src/commands/upgrade/baseline/record.ts
|
|
301
|
+
// src/commands/upgrade/baseline/record.ts
|
|
308
302
|
const baselineDirectory = ".repoctl/baselines/root";
|
|
309
303
|
const templatePackage = "@icebreakers/monorepo-templates";
|
|
310
304
|
function isRootAsset(filename) {
|
|
311
305
|
return legacyStagedConfigNames.includes(filename) || /^\.husky\/(?:pre-commit|commit-msg|pre-push)$/u.test(filename) || getAssetTargets().some((target) => filename === target || filename.startsWith(`${target}/`));
|
|
312
306
|
}
|
|
313
|
-
const baselinePath = (filename) => `${baselineDirectory}/${hash
|
|
307
|
+
const baselinePath = (filename) => `${baselineDirectory}/${hash(Buffer.from(filename))}.json`;
|
|
314
308
|
const encodeBaseline = (record) => Buffer.from(`${JSON.stringify(record, null, 2)}\n`);
|
|
315
309
|
function parseBaseline(content, filename) {
|
|
316
310
|
const record = JSON.parse(content.toString());
|
|
317
|
-
if (!record || record.schemaVersion !== 1 || typeof record.path !== "string" || !isRootAsset(relativeFile(record.path)) || filename !== baselinePath(record.path) || !record.source || record.source.package !== "@icebreakers/monorepo-templates" || typeof record.source.version !== "string" || !record.source.version || typeof record.source.assetPath !== "string" || !relativeFile(record.source.assetPath) || toWorkspaceAssetPath(record.source.assetPath) !== record.path || !/^[\da-f]{64}$/.test(record.source.hash) || !record.upstream || typeof record.upstream.content !== "string" || Buffer.from(record.upstream.content, "base64").toString("base64") !== record.upstream.content || hash
|
|
311
|
+
if (!record || record.schemaVersion !== 1 || typeof record.path !== "string" || !isRootAsset(relativeFile(record.path)) || filename !== baselinePath(record.path) || !record.source || record.source.package !== "@icebreakers/monorepo-templates" || typeof record.source.version !== "string" || !record.source.version || typeof record.source.assetPath !== "string" || !relativeFile(record.source.assetPath) || toWorkspaceAssetPath(record.source.assetPath) !== record.path || !/^[\da-f]{64}$/.test(record.source.hash) || !record.upstream || typeof record.upstream.content !== "string" || Buffer.from(record.upstream.content, "base64").toString("base64") !== record.upstream.content || hash(Buffer.from(record.upstream.content, "base64")) !== record.upstream.hash) throw new Error(`Invalid root asset baseline: ${filename}`);
|
|
318
312
|
return record;
|
|
319
313
|
}
|
|
320
|
-
|
|
321
|
-
//#region src/commands/template-drift/root-assets.ts
|
|
314
|
+
// src/commands/template-drift/root-assets.ts
|
|
322
315
|
async function collectRootAssetDrift(workspaceDir, evidence) {
|
|
323
316
|
const registry = {
|
|
324
317
|
path: baselineDirectory,
|
|
@@ -381,8 +374,7 @@ async function collectRootAssetDrift(workspaceDir, evidence) {
|
|
|
381
374
|
owners
|
|
382
375
|
};
|
|
383
376
|
}
|
|
384
|
-
|
|
385
|
-
//#region src/commands/template-drift/collector.ts
|
|
377
|
+
// src/commands/template-drift/collector.ts
|
|
386
378
|
/** This layer never loads config, writes assets, renders templates or executes package scripts. */
|
|
387
379
|
async function collectTemplateDrift(workspaceDir, options = {}) {
|
|
388
380
|
if (!options || typeof options !== "object" || Array.isArray(options) || options.remote !== void 0 && typeof options.remote !== "boolean" || options.sourceDir !== void 0 && (typeof options.sourceDir !== "string" || !options.sourceDir.trim()) || options.remote && options.sourceDir) throw new Error("Template drift options require either an extracted source directory or explicit remote lookup, not both.");
|
|
@@ -399,8 +391,7 @@ async function collectTemplateDrift(workspaceDir, options = {}) {
|
|
|
399
391
|
owners: [...instances.owners, ...roots.owners]
|
|
400
392
|
};
|
|
401
393
|
}
|
|
402
|
-
|
|
403
|
-
//#region src/commands/template-drift/checks.ts
|
|
394
|
+
// src/commands/template-drift/checks.ts
|
|
404
395
|
const templateDriftRuleIds = [
|
|
405
396
|
"template-version-evidence",
|
|
406
397
|
"template-instance-registry",
|
|
@@ -466,17 +457,16 @@ function templateDriftChecks(report) {
|
|
|
466
457
|
async function collectTemplateDriftChecks(context, selected) {
|
|
467
458
|
return templateDriftChecks(await collectTemplateDrift(context.workspaceDir)).filter((check) => selected.has(check.id));
|
|
468
459
|
}
|
|
469
|
-
|
|
470
|
-
//#region src/commands/deps/admission/baseline.ts
|
|
460
|
+
// src/commands/deps/admission/baseline.ts
|
|
471
461
|
function canonical$1(value) {
|
|
472
462
|
if (Array.isArray(value)) return value.map(canonical$1);
|
|
473
463
|
const object = record$4(value);
|
|
474
464
|
return object ? Object.fromEntries(Object.keys(object).sort().filter((key) => object[key] !== void 0).map((key) => [key, canonical$1(object[key])])) : value;
|
|
475
465
|
}
|
|
476
|
-
const admissionPolicyHash = (policy) => hash(JSON.stringify(canonical$1(policy)));
|
|
466
|
+
const admissionPolicyHash = (policy) => hash$1(JSON.stringify(canonical$1(policy)));
|
|
477
467
|
function admissionFindingKey(finding) {
|
|
478
468
|
const declaration = finding.declaration;
|
|
479
|
-
return hash(JSON.stringify([
|
|
469
|
+
return hash$1(JSON.stringify([
|
|
480
470
|
finding.id,
|
|
481
471
|
finding.rule,
|
|
482
472
|
...declaration ? [
|
|
@@ -509,8 +499,7 @@ function readAdmissionBaseline(value, policyHash) {
|
|
|
509
499
|
}
|
|
510
500
|
return keys;
|
|
511
501
|
}
|
|
512
|
-
|
|
513
|
-
//#region src/commands/deps/admission/config.ts
|
|
502
|
+
// src/commands/deps/admission/config.ts
|
|
514
503
|
const object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
515
504
|
const text$1 = (value) => typeof value === "string" && value.trim().length > 0;
|
|
516
505
|
const strings = (value) => Array.isArray(value) && value.length > 0 && value.every(text$1);
|
|
@@ -599,8 +588,7 @@ async function loadAdmissionConfig(cwd) {
|
|
|
599
588
|
config: parseAdmissionConfig(loaded.config.dependencyPolicy === void 0 ? { rules: [] } : loaded.config.dependencyPolicy)
|
|
600
589
|
};
|
|
601
590
|
}
|
|
602
|
-
|
|
603
|
-
//#region src/commands/deps/admission/scan.ts
|
|
591
|
+
// src/commands/deps/admission/scan.ts
|
|
604
592
|
function catalogValue(name, specifier, workspace) {
|
|
605
593
|
if (!specifier.startsWith("catalog:")) return specifier;
|
|
606
594
|
const key = specifier.slice(8) || "default";
|
|
@@ -672,8 +660,7 @@ function matchesWorkspace(selector, node) {
|
|
|
672
660
|
function matchesDependency(pattern, name) {
|
|
673
661
|
return pattern.endsWith("/*") ? name.startsWith(pattern.slice(0, -1)) : pattern === name;
|
|
674
662
|
}
|
|
675
|
-
|
|
676
|
-
//#region src/commands/deps/admission/evaluate.ts
|
|
663
|
+
// src/commands/deps/admission/evaluate.ts
|
|
677
664
|
function evaluateAdmission(inputs, nodes, config, report, now) {
|
|
678
665
|
const add = (finding) => {
|
|
679
666
|
const key = admissionFindingKey(finding);
|
|
@@ -777,8 +764,7 @@ function evaluateAdmission(inputs, nodes, config, report, now) {
|
|
|
777
764
|
});
|
|
778
765
|
});
|
|
779
766
|
}
|
|
780
|
-
|
|
781
|
-
//#region src/commands/deps/admission/index.ts
|
|
767
|
+
// src/commands/deps/admission/index.ts
|
|
782
768
|
/** Offline inspection of third-party direct declarations; never changes manifests or lockfiles. */
|
|
783
769
|
async function checkDependencyAdmission(cwd, options = {}) {
|
|
784
770
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
@@ -815,8 +801,7 @@ async function checkDependencyAdmission(cwd, options = {}) {
|
|
|
815
801
|
report.summary.waived = report.exceptions.length;
|
|
816
802
|
return report;
|
|
817
803
|
}
|
|
818
|
-
|
|
819
|
-
//#region src/commands/doctor/admission.ts
|
|
804
|
+
// src/commands/doctor/admission.ts
|
|
820
805
|
async function collectAdmissionChecks(workspaceDir, selected) {
|
|
821
806
|
const title = "Third-party dependency admission";
|
|
822
807
|
try {
|
|
@@ -855,8 +840,7 @@ async function collectAdmissionChecks(workspaceDir, selected) {
|
|
|
855
840
|
}];
|
|
856
841
|
}
|
|
857
842
|
}
|
|
858
|
-
|
|
859
|
-
//#region src/core/workspace-boundaries/config.ts
|
|
843
|
+
// src/core/workspace-boundaries/config.ts
|
|
860
844
|
const dependencyTypes = [
|
|
861
845
|
"dependencies",
|
|
862
846
|
"devDependencies",
|
|
@@ -975,8 +959,7 @@ function parseBoundariesConfig(value) {
|
|
|
975
959
|
}
|
|
976
960
|
return value;
|
|
977
961
|
}
|
|
978
|
-
|
|
979
|
-
//#region src/core/workspace-boundaries/cycles.ts
|
|
962
|
+
// src/core/workspace-boundaries/cycles.ts
|
|
980
963
|
/** Iterative Kosaraju traversal avoids recursive stack overflow and cycle enumeration. */
|
|
981
964
|
function findWorkspaceCycles(ids, edges) {
|
|
982
965
|
const forward = new Map(ids.map((id) => [id, []]));
|
|
@@ -1060,8 +1043,7 @@ function findWorkspaceCycles(ids, edges) {
|
|
|
1060
1043
|
}
|
|
1061
1044
|
return cycles.sort((a, b) => a.members[0] < b.members[0] ? -1 : 1);
|
|
1062
1045
|
}
|
|
1063
|
-
|
|
1064
|
-
//#region src/core/workspace-boundaries/selectors.ts
|
|
1046
|
+
// src/core/workspace-boundaries/selectors.ts
|
|
1065
1047
|
function matches(node, selector, tags) {
|
|
1066
1048
|
return (selector.private === void 0 || node.private === selector.private) && (!selector.packages || selector.packages.includes(node.name ?? "")) && (!selector.paths || selector.paths.some((pattern) => pattern.endsWith("/**") ? pattern === "./**" || node.id.startsWith(`${pattern.slice(0, -3)}/`) : node.id === pattern)) && (!selector.tags || selector.tags.some((tag) => tags.get(tag)?.has(node.id)));
|
|
1067
1049
|
}
|
|
@@ -1085,8 +1067,7 @@ function selectBoundaryNodes(nodes, selector, tags, field, findings) {
|
|
|
1085
1067
|
});
|
|
1086
1068
|
return selected;
|
|
1087
1069
|
}
|
|
1088
|
-
|
|
1089
|
-
//#region src/core/workspace-boundaries/evaluate.ts
|
|
1070
|
+
// src/core/workspace-boundaries/evaluate.ts
|
|
1090
1071
|
function evaluateBoundaries(graph, config, report) {
|
|
1091
1072
|
const findings = report.findings;
|
|
1092
1073
|
const tags = /* @__PURE__ */ new Map();
|
|
@@ -1169,8 +1150,7 @@ function evaluateBoundaries(graph, config, report) {
|
|
|
1169
1150
|
detail: `Dependency graph is incomplete for an enabled policy: ${diagnostic.code} (${diagnostic.dependency}).`
|
|
1170
1151
|
});
|
|
1171
1152
|
}
|
|
1172
|
-
|
|
1173
|
-
//#region src/core/workspace-boundaries/project.ts
|
|
1153
|
+
// src/core/workspace-boundaries/project.ts
|
|
1174
1154
|
/** C12 defaults intentionally discard null; a malformed policy must not disappear. */
|
|
1175
1155
|
function rejectNull(value, field) {
|
|
1176
1156
|
if (value === null) throw new BoundaryConfigError(field, "Null is not a valid boundary policy value; omit optional fields instead.");
|
|
@@ -1185,8 +1165,7 @@ async function loadBoundaryConfiguration(cwd) {
|
|
|
1185
1165
|
config: parseBoundariesConfig(loaded.config.boundaries === void 0 ? {} : loaded.config.boundaries)
|
|
1186
1166
|
};
|
|
1187
1167
|
}
|
|
1188
|
-
|
|
1189
|
-
//#region src/core/workspace-boundaries/index.ts
|
|
1168
|
+
// src/core/workspace-boundaries/index.ts
|
|
1190
1169
|
/** Manifest graph inspection only: never executes tasks, rewrites dependencies or scans imports. */
|
|
1191
1170
|
async function checkWorkspaceBoundaries(cwd, options = {}) {
|
|
1192
1171
|
const graph = await getWorkspaceGraph(cwd, {
|
|
@@ -1224,8 +1203,7 @@ async function checkWorkspaceBoundaries(cwd, options = {}) {
|
|
|
1224
1203
|
report.summary.waived = report.exceptions.reduce((sum, exception) => sum + exception.edges.length, 0);
|
|
1225
1204
|
return report;
|
|
1226
1205
|
}
|
|
1227
|
-
|
|
1228
|
-
//#region src/commands/doctor/boundaries.ts
|
|
1206
|
+
// src/commands/doctor/boundaries.ts
|
|
1229
1207
|
/** Architecture policy is opt-in for existing doctor callers. */
|
|
1230
1208
|
async function collectBoundaryChecks(workspaceDir, selected) {
|
|
1231
1209
|
const title = localize("Workspace architecture boundaries", "工作区架构边界");
|
|
@@ -1263,8 +1241,7 @@ async function collectBoundaryChecks(workspaceDir, selected) {
|
|
|
1263
1241
|
}];
|
|
1264
1242
|
}
|
|
1265
1243
|
}
|
|
1266
|
-
|
|
1267
|
-
//#region src/commands/doctor/hooks.ts
|
|
1244
|
+
// src/commands/doctor/hooks.ts
|
|
1268
1245
|
async function collectHooksCheck(context) {
|
|
1269
1246
|
const { workspaceDir, packageJson, hasLefthookConfig, hasLegacyHooks } = context;
|
|
1270
1247
|
let problem;
|
|
@@ -1307,8 +1284,7 @@ async function collectHooksCheck(context) {
|
|
|
1307
1284
|
...problem ? { fix: localize("Run repo upgrade --yes for default hooks; migrate custom configuration manually, then run pnpm install and pnpm exec lefthook install.", "默认钩子运行 repo upgrade --yes;自定义配置需手动迁移,然后运行 pnpm install 和 pnpm exec lefthook install。") } : {}
|
|
1308
1285
|
});
|
|
1309
1286
|
}
|
|
1310
|
-
|
|
1311
|
-
//#region src/core/lockfile/index.ts
|
|
1287
|
+
// src/core/lockfile/index.ts
|
|
1312
1288
|
const lockfileRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
1313
1289
|
/** pnpm 12 prepends a separate package-manager/config dependency document. */
|
|
1314
1290
|
function parseWorkspaceLockfile(source) {
|
|
@@ -1324,8 +1300,7 @@ function parseWorkspaceLockfile(source) {
|
|
|
1324
1300
|
return;
|
|
1325
1301
|
}
|
|
1326
1302
|
}
|
|
1327
|
-
|
|
1328
|
-
//#region src/commands/doctor/installation/lockfile.ts
|
|
1303
|
+
// src/commands/doctor/installation/lockfile.ts
|
|
1329
1304
|
const dependencyGroups = [
|
|
1330
1305
|
"dependencies",
|
|
1331
1306
|
"devDependencies",
|
|
@@ -1413,8 +1388,7 @@ function compareManifest(originalManifest, importer, workspace, lockfile) {
|
|
|
1413
1388
|
unknown
|
|
1414
1389
|
};
|
|
1415
1390
|
}
|
|
1416
|
-
|
|
1417
|
-
//#region src/utils/pnpm-runtime.ts
|
|
1391
|
+
// src/utils/pnpm-runtime.ts
|
|
1418
1392
|
/** Read version evidence without executing package-manager shims or activating Corepack. */
|
|
1419
1393
|
async function inspectPnpmRuntime() {
|
|
1420
1394
|
const userAgent = process.env["npm_config_user_agent"]?.match(/^pnpm\/([^ ]+)/)?.[1];
|
|
@@ -1464,8 +1438,7 @@ async function inspectPnpmRuntime() {
|
|
|
1464
1438
|
source: "PATH"
|
|
1465
1439
|
};
|
|
1466
1440
|
}
|
|
1467
|
-
|
|
1468
|
-
//#region src/commands/doctor/runtime/pnpm.ts
|
|
1441
|
+
// src/commands/doctor/runtime/pnpm.ts
|
|
1469
1442
|
function declaredPnpmVersion(value) {
|
|
1470
1443
|
if (typeof value !== "string" || !value.startsWith("pnpm@")) return;
|
|
1471
1444
|
const version = value.slice(5).split("+sha")[0];
|
|
@@ -1494,8 +1467,7 @@ async function collectPnpmChecks({ packageJson }, selected) {
|
|
|
1494
1467
|
}
|
|
1495
1468
|
return checks;
|
|
1496
1469
|
}
|
|
1497
|
-
|
|
1498
|
-
//#region src/commands/doctor/installation/state.ts
|
|
1470
|
+
// src/commands/doctor/installation/state.ts
|
|
1499
1471
|
async function checkInstallation(context, wanted, lockCheck, manifests) {
|
|
1500
1472
|
const { workspaceDir, packageJson } = context;
|
|
1501
1473
|
const modulesDir = path.join(workspaceDir, "node_modules");
|
|
@@ -1533,8 +1505,7 @@ async function checkInstallation(context, wanted, lockCheck, manifests) {
|
|
|
1533
1505
|
}
|
|
1534
1506
|
return result("pass", "Manifest specifiers, lockfiles and recorded pnpm installation agree; required direct dependency manifests exist. Package integrity and build scripts were not checked.", "依赖声明、锁文件与 pnpm 安装记录一致,必需的直接依赖清单存在。未检查包内容完整性或构建脚本。");
|
|
1535
1507
|
}
|
|
1536
|
-
|
|
1537
|
-
//#region src/commands/doctor/installation/index.ts
|
|
1508
|
+
// src/commands/doctor/installation/index.ts
|
|
1538
1509
|
async function collectInstallationChecks(context, selected) {
|
|
1539
1510
|
const { workspaceDir, packageJson } = context;
|
|
1540
1511
|
const manifests = context.manifests.filter((entry) => entry.data).map((entry) => ({
|
|
@@ -1580,8 +1551,7 @@ async function collectInstallationChecks(context, selected) {
|
|
|
1580
1551
|
if (!selected || selected.has("installation-state")) checks.push(await checkInstallation(context, lockfile, lockCheck, manifests));
|
|
1581
1552
|
return checks;
|
|
1582
1553
|
}
|
|
1583
|
-
|
|
1584
|
-
//#region src/commands/doctor/manifest/finding.ts
|
|
1554
|
+
// src/commands/doctor/manifest/finding.ts
|
|
1585
1555
|
function finding(entry, id, field, status, english, chinese) {
|
|
1586
1556
|
return {
|
|
1587
1557
|
id: `manifest-${id}`,
|
|
@@ -1592,8 +1562,7 @@ function finding(entry, id, field, status, english, chinese) {
|
|
|
1592
1562
|
detail: localize(english, chinese)
|
|
1593
1563
|
};
|
|
1594
1564
|
}
|
|
1595
|
-
|
|
1596
|
-
//#region src/commands/doctor/manifest/dependencies.ts
|
|
1565
|
+
// src/commands/doctor/manifest/dependencies.ts
|
|
1597
1566
|
function canonical(directory) {
|
|
1598
1567
|
try {
|
|
1599
1568
|
return realpathSync(directory);
|
|
@@ -1670,8 +1639,7 @@ function dependencyChecks(entry, manifests, selected) {
|
|
|
1670
1639
|
}
|
|
1671
1640
|
return checks;
|
|
1672
1641
|
}
|
|
1673
|
-
|
|
1674
|
-
//#region src/commands/doctor/manifest/metadata.ts
|
|
1642
|
+
// src/commands/doctor/manifest/metadata.ts
|
|
1675
1643
|
function metadataChecks(entry, workspaceDir, selected) {
|
|
1676
1644
|
const includes = (id) => !selected || selected.has(`manifest-${id}`);
|
|
1677
1645
|
const data = entry.data;
|
|
@@ -1714,8 +1682,7 @@ function metadataChecks(entry, workspaceDir, selected) {
|
|
|
1714
1682
|
}
|
|
1715
1683
|
return checks;
|
|
1716
1684
|
}
|
|
1717
|
-
|
|
1718
|
-
//#region src/commands/doctor/manifest/index.ts
|
|
1685
|
+
// src/commands/doctor/manifest/index.ts
|
|
1719
1686
|
function collectManifestChecks(context, selected) {
|
|
1720
1687
|
const active = selected?.has("manifest-health") ? void 0 : selected;
|
|
1721
1688
|
const includes = (id) => !active || active.has(id);
|
|
@@ -1749,8 +1716,7 @@ function collectManifestChecks(context, selected) {
|
|
|
1749
1716
|
}];
|
|
1750
1717
|
return selected ? result.filter((check) => selected.has(check.id)) : result;
|
|
1751
1718
|
}
|
|
1752
|
-
|
|
1753
|
-
//#region src/commands/release/errors.ts
|
|
1719
|
+
// src/commands/release/errors.ts
|
|
1754
1720
|
var ReleaseCommandError = class extends Error {
|
|
1755
1721
|
exitCode;
|
|
1756
1722
|
constructor(message, exitCode = 1) {
|
|
@@ -1759,8 +1725,7 @@ var ReleaseCommandError = class extends Error {
|
|
|
1759
1725
|
this.name = "ReleaseCommandError";
|
|
1760
1726
|
}
|
|
1761
1727
|
};
|
|
1762
|
-
|
|
1763
|
-
//#region src/commands/release/lines/config.ts
|
|
1728
|
+
// src/commands/release/lines/config.ts
|
|
1764
1729
|
function invalid(field) {
|
|
1765
1730
|
throw new ReleaseCommandError(`Invalid release branch configuration: ${field}`);
|
|
1766
1731
|
}
|
|
@@ -1874,8 +1839,7 @@ function resolveReleaseBranches(input = {}) {
|
|
|
1874
1839
|
if (rules.some((rule) => heads.some((head) => rule.branch === head || rule.branch.startsWith(`${head}/`) || head.startsWith(`${rule.branch}/`)))) invalid("release branches conflict with generated pull request heads");
|
|
1875
1840
|
return rules;
|
|
1876
1841
|
}
|
|
1877
|
-
|
|
1878
|
-
//#region src/commands/release/lines/workflow.ts
|
|
1842
|
+
// src/commands/release/lines/workflow.ts
|
|
1879
1843
|
/** Called only while planning an explicitly managed workflow; custom workflows stay protected. */
|
|
1880
1844
|
function renderReleaseBranchesWorkflow(content, config) {
|
|
1881
1845
|
if (config === void 0) return content;
|
|
@@ -1967,8 +1931,7 @@ function renderReleaseWorkflow(content, config) {
|
|
|
1967
1931
|
} : { contents: "read" });
|
|
1968
1932
|
return document.toString({ lineWidth: 0 });
|
|
1969
1933
|
}
|
|
1970
|
-
|
|
1971
|
-
//#region src/commands/doctor/nightly/index.ts
|
|
1934
|
+
// src/commands/doctor/nightly/index.ts
|
|
1972
1935
|
const nightlyDoctorIds = [
|
|
1973
1936
|
"nightly-workflow",
|
|
1974
1937
|
"nightly-provider",
|
|
@@ -2037,8 +2000,7 @@ async function collectNightlyChecks(context, selected) {
|
|
|
2037
2000
|
}
|
|
2038
2001
|
return checks;
|
|
2039
2002
|
}
|
|
2040
|
-
|
|
2041
|
-
//#region src/commands/upgrade/release-migration/classify.ts
|
|
2003
|
+
// src/commands/upgrade/release-migration/classify.ts
|
|
2042
2004
|
const releaseWorkflowMarker = "# repoctl-managed: release/v2";
|
|
2043
2005
|
function isLegacyReleaseWorkflow(content) {
|
|
2044
2006
|
if (!content.includes("changesets/action")) return false;
|
|
@@ -2052,8 +2014,7 @@ async function classifyReleaseWorkflow(workspaceDir) {
|
|
|
2052
2014
|
if (isLegacyReleaseWorkflow(content)) return "legacy";
|
|
2053
2015
|
return "custom";
|
|
2054
2016
|
}
|
|
2055
|
-
|
|
2056
|
-
//#region src/commands/doctor/release.ts
|
|
2017
|
+
// src/commands/doctor/release.ts
|
|
2057
2018
|
const releaseCiMinimumVersion = "5.1.0";
|
|
2058
2019
|
function hasValidFixedGroups(fixed) {
|
|
2059
2020
|
return fixed === void 0 || Array.isArray(fixed) && fixed.every((group) => Array.isArray(group) && group.length > 0 && group.every((name) => typeof name === "string" && name.trim().length > 0));
|
|
@@ -2112,8 +2073,7 @@ async function collectReleaseChecks(workspaceDir, pkgJson, selected) {
|
|
|
2112
2073
|
}
|
|
2113
2074
|
return checks;
|
|
2114
2075
|
}
|
|
2115
|
-
|
|
2116
|
-
//#region src/commands/doctor/runtime/node.ts
|
|
2076
|
+
// src/commands/doctor/runtime/node.ts
|
|
2117
2077
|
function checkNodeVersion({ packageJson }) {
|
|
2118
2078
|
const range = packageJson.engines?.node;
|
|
2119
2079
|
const known = typeof range === "string" && !!validRange(range);
|
|
@@ -2161,8 +2121,7 @@ async function checkNodeVersionFiles({ workspaceDir, packageJson }) {
|
|
|
2161
2121
|
...status !== "pass" ? { fix: localize("Align .nvmrc, .node-version and engines.node using numeric versions, then switch Node.", "使用数字版本统一 .nvmrc、.node-version 和 engines.node,然后切换 Node。") } : {}
|
|
2162
2122
|
};
|
|
2163
2123
|
}
|
|
2164
|
-
|
|
2165
|
-
//#region src/commands/doctor/security/settings.ts
|
|
2124
|
+
// src/commands/doctor/security/settings.ts
|
|
2166
2125
|
const policyKeys = [
|
|
2167
2126
|
"minimumReleaseAge",
|
|
2168
2127
|
"minimumReleaseAgeStrict",
|
|
@@ -2259,8 +2218,7 @@ function selectorSyntaxSupported(key, value, version) {
|
|
|
2259
2218
|
if (key === "minimumReleaseAgeExclude" && lt(version, "10.17.0") && value.some((item) => typeof item === "string" && item.includes("*"))) return false;
|
|
2260
2219
|
return !(["minimumReleaseAgeExclude", "onlyBuiltDependencies"].includes(key) && lt(version, "10.19.0") && value.some((item) => selectorIdentity(item)?.selector === "version"));
|
|
2261
2220
|
}
|
|
2262
|
-
|
|
2263
|
-
//#region src/commands/doctor/security/evaluate.ts
|
|
2221
|
+
// src/commands/doctor/security/evaluate.ts
|
|
2264
2222
|
const installSecurityRuleIds = [
|
|
2265
2223
|
"install-security-version",
|
|
2266
2224
|
"install-security-release-age",
|
|
@@ -2390,8 +2348,7 @@ function evaluateSecurity(source, selected) {
|
|
|
2390
2348
|
version: source.version
|
|
2391
2349
|
};
|
|
2392
2350
|
}
|
|
2393
|
-
|
|
2394
|
-
//#region src/commands/doctor/security/expectations.ts
|
|
2351
|
+
// src/commands/doctor/security/expectations.ts
|
|
2395
2352
|
function validateExpectations(input) {
|
|
2396
2353
|
const config = record$4(input);
|
|
2397
2354
|
if (!config || Object.keys(config).some((key) => ![
|
|
@@ -2435,8 +2392,7 @@ function evaluateExpectations(result, config) {
|
|
|
2435
2392
|
if (!Array.isArray(selectors) || !selectors.includes(exception.package)) result.add("install-security-exception", "warn", `Unused reason for ${exception.key}: ${selectorIdentity(exception.package).package}.`);
|
|
2436
2393
|
}
|
|
2437
2394
|
}
|
|
2438
|
-
|
|
2439
|
-
//#region src/commands/doctor/security/sources.ts
|
|
2395
|
+
// src/commands/doctor/security/sources.ts
|
|
2440
2396
|
const keyName = (key) => key.replace(/[-_]/gu, "").toLowerCase();
|
|
2441
2397
|
async function textFile(filename, label) {
|
|
2442
2398
|
try {
|
|
@@ -2605,8 +2561,7 @@ async function readSecuritySources(cwd, options = {}) {
|
|
|
2605
2561
|
limitations
|
|
2606
2562
|
};
|
|
2607
2563
|
}
|
|
2608
|
-
|
|
2609
|
-
//#region src/commands/doctor/security/index.ts
|
|
2564
|
+
// src/commands/doctor/security/index.ts
|
|
2610
2565
|
async function inspectInstallSecurity(cwd, options = {}, selected) {
|
|
2611
2566
|
const source = await readSecuritySources(cwd, options);
|
|
2612
2567
|
const result = evaluateSecurity(source, selected);
|
|
@@ -2643,8 +2598,7 @@ async function collectInstallSecurityChecks(context, selected) {
|
|
|
2643
2598
|
}];
|
|
2644
2599
|
}
|
|
2645
2600
|
}
|
|
2646
|
-
|
|
2647
|
-
//#region src/commands/doctor/tooling.ts
|
|
2601
|
+
// src/commands/doctor/tooling.ts
|
|
2648
2602
|
const recommendedRepoScripts = {
|
|
2649
2603
|
"repo:init": "repo init",
|
|
2650
2604
|
"repo:new": "repo new",
|
|
@@ -2733,8 +2687,7 @@ async function collectToolingChecks(context, selected) {
|
|
|
2733
2687
|
}
|
|
2734
2688
|
return checks;
|
|
2735
2689
|
}
|
|
2736
|
-
|
|
2737
|
-
//#region src/commands/doctor/workspace.ts
|
|
2690
|
+
// src/commands/doctor/workspace.ts
|
|
2738
2691
|
function collectWorkspaceChecks(context, selected) {
|
|
2739
2692
|
const includes = (id) => !selected || selected.has(id);
|
|
2740
2693
|
const rootManifest = context.manifests.find((entry) => entry.directory === context.workspaceDir);
|
|
@@ -2822,8 +2775,7 @@ function collectWorkspaceChecks(context, selected) {
|
|
|
2822
2775
|
}
|
|
2823
2776
|
return checks;
|
|
2824
2777
|
}
|
|
2825
|
-
|
|
2826
|
-
//#region src/commands/doctor/rules.ts
|
|
2778
|
+
// src/commands/doctor/rules.ts
|
|
2827
2779
|
const manifestIds = [
|
|
2828
2780
|
"multiple",
|
|
2829
2781
|
"parse",
|
|
@@ -2964,15 +2916,13 @@ async function collectSelectedDoctorChecks(context, selected) {
|
|
|
2964
2916
|
for (const collector of collectors) if (collector.ids.some((id) => selected.has(id))) checks.push(...await collector.collect(context, selected));
|
|
2965
2917
|
return checks;
|
|
2966
2918
|
}
|
|
2967
|
-
|
|
2968
|
-
//#region src/commands/doctor/settings.ts
|
|
2919
|
+
// src/commands/doctor/settings.ts
|
|
2969
2920
|
/** C12 defaults drop nulls. Reject them in original layers before merging hides mistakes. */
|
|
2970
2921
|
function validateDoctorConfiguration(value, field = "commands.doctor") {
|
|
2971
2922
|
if (value === null) throw new Error(`${field} cannot be null; omit optional settings instead.`);
|
|
2972
2923
|
if (value && typeof value === "object") for (const [key, child] of Object.entries(value)) validateDoctorConfiguration(child, `${field}.${key}`);
|
|
2973
2924
|
}
|
|
2974
|
-
|
|
2975
|
-
//#region src/commands/doctor/suppressions.ts
|
|
2925
|
+
// src/commands/doctor/suppressions.ts
|
|
2976
2926
|
function isRecord(value) {
|
|
2977
2927
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2978
2928
|
}
|
|
@@ -3023,8 +2973,7 @@ function applyDoctorSuppressions(checks, suppressions, now = /* @__PURE__ */ new
|
|
|
3023
2973
|
}
|
|
3024
2974
|
return reports;
|
|
3025
2975
|
}
|
|
3026
|
-
|
|
3027
|
-
//#region src/commands/template-drift/report.ts
|
|
2976
|
+
// src/commands/template-drift/report.ts
|
|
3028
2977
|
const cell = (value) => value.replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
3029
2978
|
function hasTemplateDriftIssues(report, strict = false) {
|
|
3030
2979
|
return report.summary.fail > 0 || strict && report.summary.warn > 0;
|
|
@@ -3055,8 +3004,7 @@ function formatTemplateDriftReport(report) {
|
|
|
3055
3004
|
for (const suppression of report.suppressions) lines.push("", `Suppression ${suppression.id}${suppression.path ? ` (${cell(suppression.path)})` : ""}: ${suppression.state}, ${suppression.matched} matched; ${cell(suppression.reason)}.`);
|
|
3056
3005
|
return lines.join("\n");
|
|
3057
3006
|
}
|
|
3058
|
-
|
|
3059
|
-
//#region src/commands/template-drift/index.ts
|
|
3007
|
+
// src/commands/template-drift/index.ts
|
|
3060
3008
|
var template_drift_exports = /* @__PURE__ */ __exportAll({
|
|
3061
3009
|
checkTemplateDrift: () => checkTemplateDrift,
|
|
3062
3010
|
formatTemplateDriftReport: () => formatTemplateDriftReport,
|
|
@@ -3077,5 +3025,4 @@ async function checkTemplateDrift(cwd, options = {}) {
|
|
|
3077
3025
|
suppressions: reports
|
|
3078
3026
|
};
|
|
3079
3027
|
}
|
|
3080
|
-
//#endregion
|
|
3081
3028
|
export { isRootAsset as A, toWorkspaceAssetPath as B, lockfileRecord as C, baselineDirectory as D, checkDependencyAdmission as E, getWorkspacePatterns as F, summarizeChecks as I, legacyStagedConfigNames as L, templatePackage as M, getAssetTargets as N, baselinePath as O, record$3 as P, isGitignoreFile as R, inspectPnpmRuntime as S, checkWorkspaceBoundaries as T, toWorkspaceGitignorePath as V, releaseWorkflowMarker as _, applyDoctorSuppressions as a, resolveReleaseBranches as b, collectSelectedDoctorChecks as c, recommendedRepoScripts as d, inspectInstallSecurity as f, isLegacyReleaseWorkflow as g, supportedVersion as h, hasTemplateDriftIssues as i, parseBaseline as j, encodeBaseline as k, getDoctorRuleIds as l, settingState as m, template_drift_exports as n, validateDoctorSuppressions as o, readSecuritySources as p, formatTemplateDriftReport as r, validateDoctorConfiguration as s, checkTemplateDrift as t, selectDoctorRules as u, renderReleaseWorkflow as v, parseWorkspaceLockfile as w, ReleaseCommandError as x, releasePullRequestHead as y, toPublishGitignorePath as z };
|
package/dist/tooling-entry.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as MonorepoVitestConfigOverrides, E as MonorepoVitestProjectConfigResult, S as MonorepoVitestConfigOptions, T as MonorepoVitestProjectConfigOptions, _ as DefineVitestProjectConfigOptions, a as createMonorepoTsconfig, b as MonorepoStylelintConfig, c as createMonorepoCommitlintConfig, d as defineCommitlintConfig, f as defineEslintConfig, g as DefineVitestConfigOptions, h as DefineEslintConfigOptions, i as defineVitestProjectConfig, l as createMonorepoEslintConfig, m as DefineConfigOptions, n as createMonorepoVitestProjectConfig, o as defineTsconfigConfig, p as defineStylelintConfig, r as defineVitestConfig, s as loadMonorepoToolingConfig, t as createMonorepoVitestConfig, u as createMonorepoStylelintConfig, v as MonorepoCommitlintConfig, w as MonorepoVitestConfigResult, x as MonorepoTsconfig, y as MonorepoEslintConfig } from "./index-
|
|
1
|
+
import { C as MonorepoVitestConfigOverrides, E as MonorepoVitestProjectConfigResult, S as MonorepoVitestConfigOptions, T as MonorepoVitestProjectConfigOptions, _ as DefineVitestProjectConfigOptions, a as createMonorepoTsconfig, b as MonorepoStylelintConfig, c as createMonorepoCommitlintConfig, d as defineCommitlintConfig, f as defineEslintConfig, g as DefineVitestConfigOptions, h as DefineEslintConfigOptions, i as defineVitestProjectConfig, l as createMonorepoEslintConfig, m as DefineConfigOptions, n as createMonorepoVitestProjectConfig, o as defineTsconfigConfig, p as defineStylelintConfig, r as defineVitestConfig, s as loadMonorepoToolingConfig, t as createMonorepoVitestConfig, u as createMonorepoStylelintConfig, v as MonorepoCommitlintConfig, w as MonorepoVitestConfigResult, x as MonorepoTsconfig, y as MonorepoEslintConfig } from "./index-CyUOTGW4.mjs";
|
|
2
2
|
export { DefineConfigOptions, DefineEslintConfigOptions, DefineVitestConfigOptions, DefineVitestProjectConfigOptions, MonorepoCommitlintConfig, MonorepoEslintConfig, MonorepoStylelintConfig, MonorepoTsconfig, MonorepoVitestConfigOptions, MonorepoVitestConfigOverrides, MonorepoVitestConfigResult, MonorepoVitestProjectConfigOptions, MonorepoVitestProjectConfigResult, createMonorepoCommitlintConfig, createMonorepoEslintConfig, createMonorepoStylelintConfig, createMonorepoTsconfig, createMonorepoVitestConfig, createMonorepoVitestProjectConfig, defineCommitlintConfig, defineEslintConfig, defineStylelintConfig, defineTsconfigConfig, defineVitestConfig, defineVitestProjectConfig, loadMonorepoToolingConfig };
|
package/dist/tooling-entry.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as loadMonorepoToolingConfig, n as defineTsconfigConfig, t as createMonorepoTsconfig } from "./tsconfig-
|
|
2
|
-
import { a as createMonorepoCommitlintConfig, c as defineCommitlintConfig, i as defineVitestProjectConfig, l as defineEslintConfig, n as createMonorepoVitestProjectConfig, o as createMonorepoEslintConfig, r as defineVitestConfig, s as createMonorepoStylelintConfig, t as createMonorepoVitestConfig, u as defineStylelintConfig } from "./vitest-
|
|
1
|
+
import { i as loadMonorepoToolingConfig, n as defineTsconfigConfig, t as createMonorepoTsconfig } from "./tsconfig-KnvwNzkL.mjs";
|
|
2
|
+
import { a as createMonorepoCommitlintConfig, c as defineCommitlintConfig, i as defineVitestProjectConfig, l as defineEslintConfig, n as createMonorepoVitestProjectConfig, o as createMonorepoEslintConfig, r as defineVitestConfig, s as createMonorepoStylelintConfig, t as createMonorepoVitestConfig, u as defineStylelintConfig } from "./vitest-YHXyRHui.mjs";
|
|
3
3
|
export { createMonorepoCommitlintConfig, createMonorepoEslintConfig, createMonorepoStylelintConfig, createMonorepoTsconfig, createMonorepoVitestConfig, createMonorepoVitestProjectConfig, defineCommitlintConfig, defineEslintConfig, defineStylelintConfig, defineTsconfigConfig, defineVitestConfig, defineVitestProjectConfig, loadMonorepoToolingConfig };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { St as localize, at as record, ot as safeFile, pt as stageFileTransaction, rt as hash, st as updateManifest } from "./workspace-tasks-
|
|
2
|
-
import { a as dependencySections, i as rangesOverlap, n as equivalentRanges, o as matchGroup, r as parseSpecifier } from "./scan-
|
|
1
|
+
import { St as localize, at as record, ot as safeFile, pt as stageFileTransaction, rt as hash, st as updateManifest } from "./workspace-tasks-i69iIhom.mjs";
|
|
2
|
+
import { a as dependencySections, i as rangesOverlap, n as equivalentRanges, o as matchGroup, r as parseSpecifier } from "./scan-DsiJldTw.mjs";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
|
-
|
|
4
|
+
// src/commands/deps/report.ts
|
|
5
5
|
function classify(group) {
|
|
6
6
|
const occurrences = group.occurrences;
|
|
7
7
|
if (group.status === "exception") return;
|
|
@@ -76,8 +76,7 @@ function dependencyReport(scan) {
|
|
|
76
76
|
summary
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
//#region src/commands/deps/plan.ts
|
|
79
|
+
// src/commands/deps/plan.ts
|
|
81
80
|
const dependencyNextSteps = ["pnpm install --lockfile-only", "pnpm install --frozen-lockfile"];
|
|
82
81
|
function prepareDependencyFix(scan, options) {
|
|
83
82
|
if (!options || typeof options.dependency !== "string" || !options.dependency.trim() || !dependencySections.includes(options.section) || typeof options.to !== "string" || !options.to.trim() || options.group !== void 0 && (typeof options.group !== "string" || !options.group)) throw new Error(localize("Select a dependency, dependency section and explicit target specifier.", "请明确选择依赖名称、依赖分区和目标版本声明。"));
|
|
@@ -125,8 +124,7 @@ function prepareDependencyFix(scan, options) {
|
|
|
125
124
|
updates
|
|
126
125
|
};
|
|
127
126
|
}
|
|
128
|
-
|
|
129
|
-
//#region src/commands/deps/guard.ts
|
|
127
|
+
// src/commands/deps/guard.ts
|
|
130
128
|
function validateDependencyPlan(plan) {
|
|
131
129
|
if (!record(plan) || plan.schemaVersion !== 1 || typeof plan.workspaceDir !== "string" || !record(plan.selection) || !Array.isArray(plan.inputs) || !Array.isArray(plan.files) || plan.inputs.some((item) => !record(item) || typeof item.path !== "string" || typeof item.hash !== "string") || plan.files.some((item) => !record(item) || typeof item.path !== "string" || typeof item.beforeHash !== "string" || typeof item.afterHash !== "string") || new Set(plan.inputs.map((item) => item.path)).size !== plan.inputs.length || new Set(plan.files.map((item) => item.path)).size !== plan.files.length) throw new Error(localize("Invalid dependency fix plan.", "依赖修复计划无效。"));
|
|
132
130
|
}
|
|
@@ -149,8 +147,7 @@ function inspectDependencyPlanInputs(scan, plan) {
|
|
|
149
147
|
if (applied === plan.files.length && applied > 0) return true;
|
|
150
148
|
return false;
|
|
151
149
|
}
|
|
152
|
-
|
|
153
|
-
//#region src/commands/deps/transaction.ts
|
|
150
|
+
// src/commands/deps/transaction.ts
|
|
154
151
|
/** Stage every replacement, retain originals until commit, and roll back recoverable failures. */
|
|
155
152
|
async function writeDependencyTransaction(root, updates) {
|
|
156
153
|
const transaction = await stageFileTransaction(updates, (file) => safeFile(root, file), "deps");
|
|
@@ -164,5 +161,4 @@ async function writeDependencyTransaction(root, updates) {
|
|
|
164
161
|
const leftovers = await transaction.cleanup();
|
|
165
162
|
if (leftovers.length) throw new Error(localize(`Dependency changes were applied; remove retained backups after review: ${leftovers.join(", ")}`, `依赖变更已应用;核查后请删除保留的备份:${leftovers.join(",")}`));
|
|
166
163
|
}
|
|
167
|
-
//#endregion
|
|
168
164
|
export { prepareDependencyFix as a, dependencyNextSteps as i, inspectDependencyPlanInputs as n, dependencyReport as o, validateDependencyPlan as r, writeDependencyTransaction as t };
|