@icebreakers/monorepo 5.7.1 → 5.8.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-CRCTiMNM.mjs → baseline-Cnw2O2JV.mjs} +1 -1
- package/dist/{catalog-D0Sk385O.mjs → catalog-DWrBLClC.mjs} +3 -3
- package/dist/cli.mjs +67 -65
- package/dist/{commands-Bj0sX3R9.mjs → commands-CayOzFY-.mjs} +285 -91
- package/dist/{config-Dg-voj8q.mjs → config-BfvlEAis.mjs} +3 -3
- package/dist/{create-flow-BWFWDWR4.mjs → create-flow-CmbddTMr.mjs} +3 -3
- package/dist/{deps-BbykICqB.mjs → deps-C-9vium9.mjs} +3 -3
- package/dist/{execute-D2GlX018.mjs → execute-DT-DjHFK.mjs} +2 -2
- package/dist/{execute-DI1mgVLv.mjs → execute-NrC2ym6M.mjs} +2 -2
- package/dist/{format-Dbs0fupU.mjs → format-4H_J7wGG.mjs} +1 -1
- package/dist/{index-CoCTFWZJ.d.mts → index-D61zjikU.d.mts} +2 -2
- package/dist/index.d.mts +29 -4
- package/dist/index.mjs +10 -10
- package/dist/{inputs-BKtLcrQ9.mjs → inputs-hoTJICnb.mjs} +1 -1
- package/dist/{npm-Bh6HBy5V.mjs → npm-CjOsZ7tH.mjs} +1 -1
- package/dist/{plan-CxySMaLN.mjs → plan-BA_10vfL.mjs} +1 -1
- package/dist/{run-D_bceMqf.mjs → run-ohOkzTLN.mjs} +4 -4
- package/dist/{save-DzIWKs0T.mjs → save-HSOp4zHC.mjs} +3 -3
- package/dist/{scan-B_-E6BWh.mjs → scan-gJt1WqW4.mjs} +2 -3
- package/dist/{template-drift-D0hKxixr.mjs → template-drift-D8CpRENe.mjs} +3 -3
- package/dist/tooling-entry.d.mts +1 -1
- package/dist/tooling-entry.mjs +2 -2
- package/dist/{transaction-DFam8_dp.mjs → transaction-CkjiAvNJ.mjs} +2 -2
- package/dist/{tsconfig-BZ6E1fBA.mjs → tsconfig-01vm_d3r.mjs} +7 -7
- package/dist/{vitest-XbNmiloj.mjs → vitest-WPpMJqzw.mjs} +10 -8
- package/dist/{workspace-tasks-C5W-QwWj.mjs → workspace-tasks-BPSq4jjn.mjs} +17 -7
- package/package.json +10 -10
- package/resources/skills/repoctl/references/commands.md +5 -0
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
-
import { A as referenceTarget, B as saveKnipBaseline, C as loadCompiler, D as ownershipFile, E as exists$1, Gt as getWorkspacePackages, Ht as clearWorkspaceCache, I as getKnipConfigurationSuggestions, J as getWorkspaceGraph, K as mergeText, M as formatEnvironmentCache, O as readText, P as checkEnvironmentCache, R as planKnipCheck, S as configReader, St as localize, T as compare$1, Tt as resolveRepoctlLocale, Ut as getWorkspaceData, W as analyzeTurboRuns, Wt as getWorkspacePackageSummaries, Z as getWorkspaceImpact, _ as planTemplateLink, _t as assetsDir$1, at as record$
|
|
3
|
-
import { a as resolveFullWorkspaceCheckPlan, c as verifyCommitMsg, d as runPnpmCommand, f as logger, i as getKnownRepoCheckCommands, l as verifyPreCommit, n as resolveAffectedCheckContext, o as resolveRecommendedCheckPlan, r as resolveAffectedCheckPlan, s as runRecommendedCheck, t as runCheckWithReport, u as verifyStagedTypecheck } from "./execute-
|
|
4
|
-
import { B as presetPackageName, C as checkedFile, E as relativeFile$1, F as normalizeTemplateSourceRequest, G as commandConfigDirectory, L as sourceRequestKey, O as package_default$1, P as normalizeTemplateRemoteSource, R as templateSourcePath, S as canonicalDirectory, T as readOptional$1, U as appendConfigPath, V as presetVersion, _ as listToolingCapabilities, b as presetRelativePath, d as loadMonorepoConfig, f as loadMonorepoConfigDetails, g as presetAssetTarget, j as ConfigValidationError, k as version$2, n as defineTsconfigConfig, p as resolveCommandConfig, u as getRepoctlConfigCandidates, v as installedPresetDirectory, w as hash$2, x as readPresetFile, y as parsePresetJson } from "./tsconfig-
|
|
5
|
-
import { c as selectCommandOverrides, i as rangesOverlap, l as chinaMirrorsEnvs, r as parseSpecifier, s as resolveCommandValues } from "./scan-
|
|
6
|
-
import { A as record$
|
|
7
|
-
import { t as writeDependencyTransaction } from "./transaction-
|
|
8
|
-
import { i as applyDependencyFixPlan, r as planDependencyFix, t as checkDependencies } from "./deps-
|
|
9
|
-
import { i as applyCatalogMigrationPlan, n as checkCatalogs, r as planCatalogMigration } from "./catalog-
|
|
2
|
+
import { A as referenceTarget, B as saveKnipBaseline, C as loadCompiler, D as ownershipFile, E as exists$1, Gt as getWorkspacePackages, Ht as clearWorkspaceCache, I as getKnipConfigurationSuggestions, J as getWorkspaceGraph, Jt as GitClient, K as mergeText, M as formatEnvironmentCache, O as readText, P as checkEnvironmentCache, R as planKnipCheck, S as configReader, St as localize, T as compare$1, Tt as resolveRepoctlLocale, Ut as getWorkspaceData, W as analyzeTurboRuns, Wt as getWorkspacePackageSummaries, Z as getWorkspaceImpact, _ as planTemplateLink, _t as assetsDir$1, at as record$3, b as planGenerate, c as loadTemplateInstanceRegistry$1, ct as renderCreateNewProject, dt as migrateLegacyToolingReferences, et as compareGraphValues, f as recoverTemplateUpgrade, ft as setByPath, g as applyTemplateLinkPlan, gt as validateCleanTargets, h as loadTemplateUpgradeJournal, ht as isWithin, it as readInput, j as relativeFile, jt as fs$2, k as referencePath, l as rebuildTemplateInstanceBaseline, lt as rewriteTemplateSnapshotReferences, m as planTemplateUpgrade, mt as assertSafePath, nt as workspaceDependencyTypes, o as listTemplateInstances, ot as safeFile, p as applyTemplateUpgradePlan, pt as stageFileTransaction, q as withOperationLock, qt as findWorkspacePackages, rt as hash$1, s as loadTemplateBaseline$1, tt as resolveWorkspaceGraphNode, u as relocateTemplateInstance, w as validateGraph, x as generators, xt as templatesDir, y as applyGeneratePlan, yt as packageDir$1, z as runKnipCheck } from "./workspace-tasks-BPSq4jjn.mjs";
|
|
3
|
+
import { a as resolveFullWorkspaceCheckPlan, c as verifyCommitMsg, d as runPnpmCommand, f as logger, i as getKnownRepoCheckCommands, l as verifyPreCommit, n as resolveAffectedCheckContext, o as resolveRecommendedCheckPlan, r as resolveAffectedCheckPlan, s as runRecommendedCheck, t as runCheckWithReport, u as verifyStagedTypecheck } from "./execute-NrC2ym6M.mjs";
|
|
4
|
+
import { B as presetPackageName, C as checkedFile, E as relativeFile$1, F as normalizeTemplateSourceRequest, G as commandConfigDirectory, L as sourceRequestKey, O as package_default$1, P as normalizeTemplateRemoteSource, R as templateSourcePath, S as canonicalDirectory, T as readOptional$1, U as appendConfigPath, V as presetVersion, _ as listToolingCapabilities, b as presetRelativePath, d as loadMonorepoConfig, f as loadMonorepoConfigDetails, g as presetAssetTarget, j as ConfigValidationError, k as version$2, n as defineTsconfigConfig, p as resolveCommandConfig, u as getRepoctlConfigCandidates, v as installedPresetDirectory, w as hash$2, x as readPresetFile, y as parsePresetJson } from "./tsconfig-01vm_d3r.mjs";
|
|
5
|
+
import { c as selectCommandOverrides, i as rangesOverlap, l as chinaMirrorsEnvs, r as parseSpecifier, s as resolveCommandValues } from "./scan-gJt1WqW4.mjs";
|
|
6
|
+
import { A as record$4, C as baselineDirectory, D as parseBaseline, E as isRootAsset, F as toWorkspaceAssetPath, M as summarizeChecks, O as templatePackage, S as checkDependencyAdmission, T as encodeBaseline, a as applyDoctorSuppressions, b as parseWorkspaceLockfile, c as collectSelectedDoctorChecks, d as recommendedRepoScripts, f as inspectInstallSecurity, g as isLegacyReleaseWorkflow, h as supportedVersion, i as hasTemplateDriftIssues, j as getWorkspacePatterns, k as getAssetTargets, l as getDoctorRuleIds, m as settingState, o as validateDoctorSuppressions, p as readSecuritySources, r as formatTemplateDriftReport, s as validateDoctorConfiguration, t as checkTemplateDrift, u as selectDoctorRules, v as inspectPnpmRuntime, w as baselinePath, y as lockfileRecord } from "./template-drift-D8CpRENe.mjs";
|
|
7
|
+
import { t as writeDependencyTransaction } from "./transaction-CkjiAvNJ.mjs";
|
|
8
|
+
import { i as applyDependencyFixPlan, r as planDependencyFix, t as checkDependencies } from "./deps-C-9vium9.mjs";
|
|
9
|
+
import { i as applyCatalogMigrationPlan, n as checkCatalogs, r as planCatalogMigration } from "./catalog-DWrBLClC.mjs";
|
|
10
10
|
import { createRequire, isBuiltin } from "node:module";
|
|
11
11
|
import { findWorkspaceDir } from "@pnpm/find-workspace-dir";
|
|
12
|
-
import { findWorkspacePackages } from "@pnpm/workspace.find-packages";
|
|
13
12
|
import { readWorkspaceManifest } from "@pnpm/workspace.read-manifest";
|
|
14
13
|
import path, { normalize } from "pathe";
|
|
15
14
|
import process from "node:process";
|
|
@@ -932,14 +931,14 @@ function presetTemplateDeclarations(layers) {
|
|
|
932
931
|
}
|
|
933
932
|
//#endregion
|
|
934
933
|
//#region src/core/template-catalog/entries.ts
|
|
935
|
-
function record$
|
|
934
|
+
function record$2(value) {
|
|
936
935
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
937
936
|
}
|
|
938
937
|
function definition(value) {
|
|
939
938
|
const data = typeof value === "string" ? {
|
|
940
939
|
source: value,
|
|
941
940
|
target: value
|
|
942
|
-
} : record$
|
|
941
|
+
} : record$2(value);
|
|
943
942
|
if (!data || ["source", "target"].some((key) => typeof data[key] !== "string" || !data[key].trim() || data[key].includes("\0"))) return;
|
|
944
943
|
if (["label", "description"].some((key) => data[key] !== void 0 && typeof data[key] !== "string")) return;
|
|
945
944
|
if (data["category"] !== void 0 && (typeof data["category"] !== "string" || !isTemplateCategory(data["category"]))) return;
|
|
@@ -981,7 +980,7 @@ function resolveCatalogEntries(context, diagnostics) {
|
|
|
981
980
|
"templatesDir",
|
|
982
981
|
"templateMap",
|
|
983
982
|
"choices"
|
|
984
|
-
].filter((field) => record$
|
|
983
|
+
].filter((field) => record$2(raw)?.[field] === null).map((field) => `commands.create.${field}`), ...Object.entries(record$2(raw?.templateMap) ?? {}).filter(([, value]) => value === null).map(([key]) => appendConfigPath("commands.create.templateMap", key))];
|
|
985
984
|
for (const configPath of paths) if (!diagnostics.some((item) => item.configPath === configPath)) diagnostics.push({
|
|
986
985
|
id: "template-definition",
|
|
987
986
|
status: "fail",
|
|
@@ -990,7 +989,7 @@ function resolveCatalogEntries(context, diagnostics) {
|
|
|
990
989
|
detail: localize("Template configuration cannot be null.", "模板配置不能为 null。")
|
|
991
990
|
});
|
|
992
991
|
}
|
|
993
|
-
const extra = record$
|
|
992
|
+
const extra = record$2(createConfig.templateMap);
|
|
994
993
|
if (createConfig.templateMap !== void 0 && !extra) diagnostics.push({
|
|
995
994
|
id: "template-definition",
|
|
996
995
|
status: "fail",
|
|
@@ -1058,7 +1057,7 @@ function resolveCatalogChoices(context, entries, diagnostics) {
|
|
|
1058
1057
|
detail: localize("choices must be an array.", "choices 必须是数组。")
|
|
1059
1058
|
});
|
|
1060
1059
|
for (const [index, raw] of (Array.isArray(choices) ? choices : []).entries()) {
|
|
1061
|
-
const choice = record$
|
|
1060
|
+
const choice = record$2(raw);
|
|
1062
1061
|
const key = choice?.["value"];
|
|
1063
1062
|
const configPath = `commands.create.choices[${index}]`;
|
|
1064
1063
|
if (!choice || typeof key !== "string" || !entries.has(key) || selected.has(key) || [
|
|
@@ -1459,7 +1458,7 @@ async function downloadGitTemplate(source, directory, timeout) {
|
|
|
1459
1458
|
async function resolveRemoteTemplateSource(source, templatePath = ".", options = {}) {
|
|
1460
1459
|
const request = normalizeTemplateSourceRequest(source, templatePath);
|
|
1461
1460
|
const cwd = path$1.resolve(options.cwd ?? process.cwd());
|
|
1462
|
-
const npm = request.source.kind === "npm" ? await import("./npm-
|
|
1461
|
+
const npm = request.source.kind === "npm" ? await import("./npm-CjOsZ7tH.mjs") : void 0;
|
|
1463
1462
|
const configuration = request.source.kind === "npm" ? await npm.npmTemplateConfiguration(request.source, cwd) : void 0;
|
|
1464
1463
|
if (request.source.kind === "npm") request.source.registry = configuration.registry;
|
|
1465
1464
|
const cacheDir = path$1.resolve(cwd, options.cacheDir ?? path$1.join(process.env["XDG_CACHE_HOME"] ?? path$1.join(homedir(), ".cache"), "repoctl", "template-sources-v1"));
|
|
@@ -1715,7 +1714,7 @@ async function discoverDoctorManifests(workspaceDir, patterns) {
|
|
|
1715
1714
|
try {
|
|
1716
1715
|
const text = (await readFile(path$1.join(workspaceDir, filename), "utf8")).replace(/^\uFEFF/, "");
|
|
1717
1716
|
const value = filename.endsWith(".yaml") ? YAML.parse(text) : filename.endsWith(".json5") ? JSON5.parse(text) : JSON.parse(text);
|
|
1718
|
-
const data = record$
|
|
1717
|
+
const data = record$4(value);
|
|
1719
1718
|
if (!data) entry.error = "invalid_structure";
|
|
1720
1719
|
else {
|
|
1721
1720
|
entry.data = data;
|
|
@@ -1731,11 +1730,11 @@ async function discoverDoctorManifests(workspaceDir, patterns) {
|
|
|
1731
1730
|
//#endregion
|
|
1732
1731
|
//#region src/commands/doctor/context.ts
|
|
1733
1732
|
function rootPackageJson(data = {}) {
|
|
1734
|
-
const stringMap = (value) => Object.fromEntries(Object.entries(record$
|
|
1733
|
+
const stringMap = (value) => Object.fromEntries(Object.entries(record$4(value) ?? {}).filter((item) => typeof item[1] === "string"));
|
|
1735
1734
|
return {
|
|
1736
1735
|
...data,
|
|
1737
1736
|
packageManager: typeof data["packageManager"] === "string" ? data["packageManager"] : void 0,
|
|
1738
|
-
engines: typeof record$
|
|
1737
|
+
engines: typeof record$4(data["engines"])?.["node"] === "string" ? { node: record$4(data["engines"])["node"] } : {},
|
|
1739
1738
|
dependencies: stringMap(data["dependencies"]),
|
|
1740
1739
|
devDependencies: stringMap(data["devDependencies"]),
|
|
1741
1740
|
scripts: stringMap(data["scripts"])
|
|
@@ -1776,7 +1775,7 @@ async function collectDoctorContext(cwd) {
|
|
|
1776
1775
|
let workspacePatterns = [];
|
|
1777
1776
|
let workspaceManifestError = false;
|
|
1778
1777
|
if (hasWorkspaceManifest) try {
|
|
1779
|
-
const workspace = record$
|
|
1778
|
+
const workspace = record$4(YAML.parse(await fs$2.readFile(workspaceManifestPath, "utf8")));
|
|
1780
1779
|
const patterns = workspace?.["packages"];
|
|
1781
1780
|
if (!workspace || patterns !== void 0 && (!Array.isArray(patterns) || patterns.some((value) => typeof value !== "string" || !value))) throw new Error("Invalid workspace patterns");
|
|
1782
1781
|
workspacePatterns = patterns === void 0 ? [".", "**"] : getWorkspacePatterns(workspace);
|
|
@@ -2458,7 +2457,7 @@ var ReleaseCommandError = class extends Error {
|
|
|
2458
2457
|
function invalid(field) {
|
|
2459
2458
|
throw new ReleaseCommandError(`Invalid release branch configuration: ${field}`);
|
|
2460
2459
|
}
|
|
2461
|
-
function record(value, fields, field) {
|
|
2460
|
+
function record$1(value, fields, field) {
|
|
2462
2461
|
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).some((key) => !fields.includes(key))) invalid(field);
|
|
2463
2462
|
return value;
|
|
2464
2463
|
}
|
|
@@ -2485,7 +2484,7 @@ function releasePullRequestHead(rule) {
|
|
|
2485
2484
|
}
|
|
2486
2485
|
/** Build one deterministic mapping used by planning, preparation, publishing, CI and recovery. */
|
|
2487
2486
|
function resolveReleaseBranches(input = {}) {
|
|
2488
|
-
const config = record(input, [
|
|
2487
|
+
const config = record$1(input, [
|
|
2489
2488
|
"stable",
|
|
2490
2489
|
"maintenance",
|
|
2491
2490
|
"prerelease"
|
|
@@ -2493,7 +2492,7 @@ function resolveReleaseBranches(input = {}) {
|
|
|
2493
2492
|
const stable = branch$1(config["stable"] === void 0 ? "main" : config["stable"], "branches.stable");
|
|
2494
2493
|
const maintenance = list(config["maintenance"] === void 0 ? [] : config["maintenance"], "branches.maintenance").map((value, index) => {
|
|
2495
2494
|
const field = `branches.maintenance[${index}]`;
|
|
2496
|
-
const item = record(value, [
|
|
2495
|
+
const item = record$1(value, [
|
|
2497
2496
|
"branch",
|
|
2498
2497
|
"range",
|
|
2499
2498
|
"tag"
|
|
@@ -2539,7 +2538,7 @@ function resolveReleaseBranches(input = {}) {
|
|
|
2539
2538
|
}));
|
|
2540
2539
|
const prerelease = list(config["prerelease"] === void 0 ? defaults : config["prerelease"], "branches.prerelease").map((value, index) => {
|
|
2541
2540
|
const field = `branches.prerelease[${index}]`;
|
|
2542
|
-
const item = record(value, [
|
|
2541
|
+
const item = record$1(value, [
|
|
2543
2542
|
"branch",
|
|
2544
2543
|
"lane",
|
|
2545
2544
|
"tag",
|
|
@@ -3289,10 +3288,10 @@ async function readDoctorManifest(workspaceDir) {
|
|
|
3289
3288
|
function planMissingRootScripts(original) {
|
|
3290
3289
|
let manifest;
|
|
3291
3290
|
try {
|
|
3292
|
-
manifest = record$
|
|
3291
|
+
manifest = record$3(JSON.parse(original.replace(/^\uFEFF/, "")));
|
|
3293
3292
|
} catch {}
|
|
3294
3293
|
if (!manifest) return { notes: ["package.json must be a valid JSON object; repair it manually."] };
|
|
3295
|
-
const scripts = manifest["scripts"] === void 0 ? {} : record$
|
|
3294
|
+
const scripts = manifest["scripts"] === void 0 ? {} : record$3(manifest["scripts"]);
|
|
3296
3295
|
if (!scripts) return { notes: ["scripts is not an object; repair it manually before adding recommended scripts."] };
|
|
3297
3296
|
const additions = Object.entries(recommendedRepoScripts).filter(([name]) => !Object.hasOwn(scripts, name)).map(([name, command]) => ({
|
|
3298
3297
|
name,
|
|
@@ -3353,10 +3352,10 @@ async function planDoctorFix(cwd, options = {}) {
|
|
|
3353
3352
|
};
|
|
3354
3353
|
}
|
|
3355
3354
|
function validatePlan(value, workspaceDir) {
|
|
3356
|
-
const plan = record$
|
|
3355
|
+
const plan = record$3(value);
|
|
3357
3356
|
if (!plan || plan["schemaVersion"] !== 1 || plan["workspaceDir"] !== workspaceDir || !Array.isArray(plan["operations"]) || plan["operations"].length > 1) throw new Error("Invalid doctor fix plan or workspace. Generate a new plan.");
|
|
3358
3357
|
return plan["operations"].map((value) => {
|
|
3359
|
-
const operation = record$
|
|
3358
|
+
const operation = record$3(value);
|
|
3360
3359
|
if (!operation || typeof operation["before"] !== "string") throw new Error("Invalid doctor fix operation.");
|
|
3361
3360
|
const expected = planMissingRootScripts(operation["before"]).operation;
|
|
3362
3361
|
if (!expected || !isDeepStrictEqual(operation, expected)) throw new Error("Unsupported or modified doctor fix operation. Generate a new plan.");
|
|
@@ -3631,7 +3630,7 @@ var package_default = {
|
|
|
3631
3630
|
type: "module",
|
|
3632
3631
|
version: "0.0.0",
|
|
3633
3632
|
"private": true,
|
|
3634
|
-
packageManager: "pnpm@12.
|
|
3633
|
+
packageManager: "pnpm@12.10.1",
|
|
3635
3634
|
description: "Source workspace for repoctl and Icebreaker's shared development packages",
|
|
3636
3635
|
author: "ice breaker <hi@sonofmagic.top>",
|
|
3637
3636
|
license: "MIT",
|
|
@@ -3729,21 +3728,21 @@ var package_default = {
|
|
|
3729
3728
|
"@icebreakers/eslint-config": "workspace:*",
|
|
3730
3729
|
"@icebreakers/monorepo": "workspace:*",
|
|
3731
3730
|
"@icebreakers/stylelint-config": "workspace:*",
|
|
3732
|
-
"@types/node": "^26.6.
|
|
3731
|
+
"@types/node": "^26.6.4",
|
|
3733
3732
|
"@vitest/coverage-v8": "~5.0.3",
|
|
3734
|
-
"eslint": "^10.
|
|
3735
|
-
"execa": "^10.0
|
|
3733
|
+
"eslint": "^10.12.0",
|
|
3734
|
+
"execa": "^10.1.0",
|
|
3736
3735
|
"husky": "^9.1.7",
|
|
3737
3736
|
"lint-staged": "^17.6.0",
|
|
3738
3737
|
"make-fetch-happen": "15.0.6",
|
|
3739
3738
|
"only-allow": "^1.2.2",
|
|
3740
|
-
"playwright": "^1.
|
|
3739
|
+
"playwright": "^1.64.0",
|
|
3741
3740
|
"repoctl": "workspace:*",
|
|
3742
3741
|
"stylelint": "^17.16.0",
|
|
3743
3742
|
"tailwindcss": "^4.3.3",
|
|
3744
3743
|
"tsd": "^0.33.0",
|
|
3745
3744
|
"tsdown": "0.23.0",
|
|
3746
|
-
"turbo": "^2.11.
|
|
3745
|
+
"turbo": "^2.11.7",
|
|
3747
3746
|
"typescript": "^6.0.3",
|
|
3748
3747
|
"vitest": "~5.0.3",
|
|
3749
3748
|
"yaml": "^2.9.1"
|
|
@@ -4517,6 +4516,11 @@ async function readPendingIntents(cwd) {
|
|
|
4517
4516
|
function getReleaseEnv(options) {
|
|
4518
4517
|
return options.env ?? process.env;
|
|
4519
4518
|
}
|
|
4519
|
+
/** CLI 预检与发布调度共享模式优先级,确保核验入口不加载可执行配置。 */
|
|
4520
|
+
function resolveReleaseMode(options) {
|
|
4521
|
+
const requested = options.mode && options.mode !== "auto" ? options.mode : (options.env ?? process.env)["REPO_RELEASE_MODE"]?.trim();
|
|
4522
|
+
return requested && requested !== "auto" ? requested : "auto";
|
|
4523
|
+
}
|
|
4520
4524
|
function run(command, args, options) {
|
|
4521
4525
|
const result = (options.spawn ?? spawnSync)(command, args, {
|
|
4522
4526
|
cwd: options.cwd,
|
|
@@ -4982,7 +4986,11 @@ async function readReleaseState(request, key) {
|
|
|
4982
4986
|
throw error;
|
|
4983
4987
|
}
|
|
4984
4988
|
}
|
|
4985
|
-
|
|
4989
|
+
function transient(error) {
|
|
4990
|
+
if (!error || typeof error !== "object" || !("status" in error) || typeof error.status !== "number") return false;
|
|
4991
|
+
return error.status === 0 || error.status === 429 || error.status >= 500;
|
|
4992
|
+
}
|
|
4993
|
+
async function writeReleaseState(request, key, state, revision, options = {}) {
|
|
4986
4994
|
if (!revision) try {
|
|
4987
4995
|
await request("GET", `/git/ref/heads/${branch}`);
|
|
4988
4996
|
} catch (error) {
|
|
@@ -4997,7 +5005,11 @@ async function writeReleaseState(request, key, state, revision) {
|
|
|
4997
5005
|
}
|
|
4998
5006
|
}
|
|
4999
5007
|
const content = JSON.stringify(state);
|
|
5000
|
-
|
|
5008
|
+
const attempts = Math.max(1, options.retryAttempts ?? 3);
|
|
5009
|
+
const delay = Math.max(0, options.retryDelay ?? 1e3);
|
|
5010
|
+
const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)));
|
|
5011
|
+
let error;
|
|
5012
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) try {
|
|
5001
5013
|
const { data } = await request("PUT", statePath(key), {
|
|
5002
5014
|
message: "chore(release): checkpoint release lifecycle [skip ci]",
|
|
5003
5015
|
branch,
|
|
@@ -5006,11 +5018,14 @@ async function writeReleaseState(request, key, state, revision) {
|
|
|
5006
5018
|
});
|
|
5007
5019
|
if (!data?.content.sha) throw new ReleaseCommandError("GitHub returned no release checkpoint revision");
|
|
5008
5020
|
return data.content.sha;
|
|
5009
|
-
} catch (
|
|
5021
|
+
} catch (caught) {
|
|
5022
|
+
error = caught;
|
|
5010
5023
|
const recovered = await readReleaseState(request, key);
|
|
5011
5024
|
if (recovered && JSON.stringify(recovered.state) === content) return recovered.revision;
|
|
5012
|
-
|
|
5025
|
+
if (recovered?.revision !== revision || !transient(caught) || attempt === attempts) break;
|
|
5026
|
+
await sleep(delay * 2 ** (attempt - 1));
|
|
5013
5027
|
}
|
|
5028
|
+
throw new ReleaseCommandError(`Release checkpoint write failed or another publisher advanced it; retry after the other run finishes. ${error instanceof Error ? error.message : String(error)}`);
|
|
5014
5029
|
}
|
|
5015
5030
|
//#endregion
|
|
5016
5031
|
//#region src/commands/release/github/tags.ts
|
|
@@ -5146,7 +5161,11 @@ var GitHubClient = class {
|
|
|
5146
5161
|
return readReleaseState(this.getRequest(), key);
|
|
5147
5162
|
}
|
|
5148
5163
|
async writeReleaseState(key, state, revision) {
|
|
5149
|
-
return writeReleaseState(this.getRequest(), key, state, revision
|
|
5164
|
+
return writeReleaseState(this.getRequest(), key, state, revision, {
|
|
5165
|
+
retryAttempts: this.retryAttempts,
|
|
5166
|
+
retryDelay: this.retryDelay,
|
|
5167
|
+
sleep: this.sleep
|
|
5168
|
+
});
|
|
5150
5169
|
}
|
|
5151
5170
|
async ensurePullRequest(options) {
|
|
5152
5171
|
const [owner] = this.getRepository().split("/");
|
|
@@ -5972,6 +5991,160 @@ async function publishLifecycle(options, selected, distTag = "latest") {
|
|
|
5972
5991
|
return packages;
|
|
5973
5992
|
}
|
|
5974
5993
|
//#endregion
|
|
5994
|
+
//#region src/core/oidc/identity.ts
|
|
5995
|
+
const npmRegistry = "https://registry.npmjs.org";
|
|
5996
|
+
const npmAudience = "npm:registry.npmjs.org";
|
|
5997
|
+
const requestTimeout = 15e3;
|
|
5998
|
+
const identityKeys = [
|
|
5999
|
+
"iss",
|
|
6000
|
+
"aud",
|
|
6001
|
+
"sub",
|
|
6002
|
+
"repository",
|
|
6003
|
+
"repository_id",
|
|
6004
|
+
"repository_owner_id",
|
|
6005
|
+
"workflow_ref",
|
|
6006
|
+
"job_workflow_ref",
|
|
6007
|
+
"event_name",
|
|
6008
|
+
"runner_environment",
|
|
6009
|
+
"environment"
|
|
6010
|
+
];
|
|
6011
|
+
function publicMessage(value, secrets) {
|
|
6012
|
+
let message = typeof value === "string" ? value : "npm did not return a recognizable error message";
|
|
6013
|
+
for (const secret of secrets) if (secret) message = message.replaceAll(secret, "[redacted]");
|
|
6014
|
+
return message.replaceAll(/\beyJ[\w-]+\.[\w-]+\.[\w-]+\b/g, "[redacted]").replaceAll(/\bnpm_[a-z0-9]+\b/gi, "[redacted]").replaceAll(/\p{Cc}/gu, " ").slice(0, 500);
|
|
6015
|
+
}
|
|
6016
|
+
function record(value) {
|
|
6017
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
6018
|
+
}
|
|
6019
|
+
async function requestIdentity(env, fetcher) {
|
|
6020
|
+
const requestToken = env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"];
|
|
6021
|
+
const requestUrl = env["ACTIONS_ID_TOKEN_REQUEST_URL"];
|
|
6022
|
+
if (!requestToken || !requestUrl || !env["GITHUB_REPOSITORY"] || !env["GITHUB_WORKFLOW_REF"]) throw new Error("OIDC audit requires a GitHub-hosted job with id-token: write, GITHUB_REPOSITORY and GITHUB_WORKFLOW_REF");
|
|
6023
|
+
let response;
|
|
6024
|
+
try {
|
|
6025
|
+
const url = new URL(requestUrl);
|
|
6026
|
+
if (url.protocol !== "https:" || url.username || url.password) throw new Error("invalid OIDC request URL");
|
|
6027
|
+
url.searchParams.set("audience", npmAudience);
|
|
6028
|
+
response = await fetcher(url, {
|
|
6029
|
+
headers: { Authorization: `Bearer ${requestToken}` },
|
|
6030
|
+
signal: AbortSignal.timeout(requestTimeout),
|
|
6031
|
+
redirect: "error"
|
|
6032
|
+
});
|
|
6033
|
+
} catch {
|
|
6034
|
+
throw new Error("GitHub OIDC request failed, timed out or returned an invalid response; no credentials were saved");
|
|
6035
|
+
}
|
|
6036
|
+
if (!response.ok) throw new Error(`GitHub OIDC request failed: HTTP ${response.status}`);
|
|
6037
|
+
let body;
|
|
6038
|
+
try {
|
|
6039
|
+
body = record(await response.json());
|
|
6040
|
+
} catch {
|
|
6041
|
+
throw new Error("GitHub OIDC returned an invalid JSON response");
|
|
6042
|
+
}
|
|
6043
|
+
if (typeof body["value"] !== "string" || !body["value"]) throw new Error("GitHub OIDC response is missing an identity token");
|
|
6044
|
+
const idToken = body["value"];
|
|
6045
|
+
let claims;
|
|
6046
|
+
try {
|
|
6047
|
+
const segments = idToken.split(".");
|
|
6048
|
+
if (segments.length !== 3) throw new Error("invalid JWT");
|
|
6049
|
+
claims = record(JSON.parse(Buffer.from(segments[1], "base64url").toString("utf8")));
|
|
6050
|
+
} catch {
|
|
6051
|
+
throw new Error("GitHub OIDC identity claims could not be parsed");
|
|
6052
|
+
}
|
|
6053
|
+
if (claims["iss"] !== "https://token.actions.githubusercontent.com" || claims["aud"] !== "npm:registry.npmjs.org" || claims["repository"] !== env["GITHUB_REPOSITORY"] || claims["workflow_ref"] !== env["GITHUB_WORKFLOW_REF"] || claims["runner_environment"] !== "github-hosted") throw new Error("GitHub OIDC identity does not match the current GitHub-hosted workflow; no npm exchanges were attempted");
|
|
6054
|
+
return {
|
|
6055
|
+
idToken,
|
|
6056
|
+
requestToken,
|
|
6057
|
+
identity: Object.fromEntries(identityKeys.filter((key) => typeof claims[key] === "string").map((key) => [key, publicMessage(claims[key], [idToken, requestToken])]))
|
|
6058
|
+
};
|
|
6059
|
+
}
|
|
6060
|
+
//#endregion
|
|
6061
|
+
//#region src/core/oidc/exchange.ts
|
|
6062
|
+
async function exchangePackage(name, idToken, requestToken, fetcher) {
|
|
6063
|
+
try {
|
|
6064
|
+
const response = await fetcher(new URL(`/-/npm/v1/oidc/token/exchange/package/${encodeURIComponent(name)}`, npmRegistry), {
|
|
6065
|
+
method: "POST",
|
|
6066
|
+
headers: {
|
|
6067
|
+
Authorization: `Bearer ${idToken}`,
|
|
6068
|
+
Accept: "application/json"
|
|
6069
|
+
},
|
|
6070
|
+
body: "",
|
|
6071
|
+
signal: AbortSignal.timeout(requestTimeout),
|
|
6072
|
+
redirect: "error"
|
|
6073
|
+
});
|
|
6074
|
+
let body;
|
|
6075
|
+
try {
|
|
6076
|
+
body = record(await response.json());
|
|
6077
|
+
} catch {
|
|
6078
|
+
return {
|
|
6079
|
+
package: name,
|
|
6080
|
+
ok: false,
|
|
6081
|
+
status: response.status,
|
|
6082
|
+
message: "npm returned an invalid JSON response"
|
|
6083
|
+
};
|
|
6084
|
+
}
|
|
6085
|
+
const token = typeof body["token"] === "string" ? body["token"] : "";
|
|
6086
|
+
const ok = response.ok && token.length > 0;
|
|
6087
|
+
return {
|
|
6088
|
+
package: name,
|
|
6089
|
+
ok,
|
|
6090
|
+
status: response.status,
|
|
6091
|
+
message: ok ? "OIDC token exchange succeeded" : response.ok ? "npm response is missing an exchange token" : publicMessage(body["message"] ?? record(body["body"])["message"], [
|
|
6092
|
+
idToken,
|
|
6093
|
+
requestToken,
|
|
6094
|
+
token
|
|
6095
|
+
])
|
|
6096
|
+
};
|
|
6097
|
+
} catch {
|
|
6098
|
+
return {
|
|
6099
|
+
package: name,
|
|
6100
|
+
ok: false,
|
|
6101
|
+
status: null,
|
|
6102
|
+
message: "npm token exchange request failed or timed out"
|
|
6103
|
+
};
|
|
6104
|
+
}
|
|
6105
|
+
}
|
|
6106
|
+
//#endregion
|
|
6107
|
+
//#region src/commands/release/oidc/index.ts
|
|
6108
|
+
/** 逐包核验官方 npm 的短时凭据交换;不发布、不执行 hooks,也不保存凭据。 */
|
|
6109
|
+
async function auditReleaseOidc(options) {
|
|
6110
|
+
clearWorkspaceCache();
|
|
6111
|
+
const { packages } = await getWorkspaceData(options.cwd);
|
|
6112
|
+
const candidates = packages.filter(({ manifest }) => typeof manifest.name === "string" && typeof manifest.version === "string");
|
|
6113
|
+
if (!candidates.length) throw new ReleaseCommandError("OIDC audit found no versioned publishable workspace packages");
|
|
6114
|
+
if (candidates.some(({ manifest }) => {
|
|
6115
|
+
const registry = record(record(manifest)["publishConfig"])["registry"];
|
|
6116
|
+
return registry !== void 0 && (typeof registry !== "string" || registry.replace(/\/$/, "") !== "https://registry.npmjs.org");
|
|
6117
|
+
})) throw new ReleaseCommandError("OIDC audit supports only the official npm registry; no credentials were requested");
|
|
6118
|
+
const fetcher = options.fetch ?? globalThis.fetch;
|
|
6119
|
+
const { idToken, requestToken, identity } = await requestIdentity(options.env ?? process.env, fetcher);
|
|
6120
|
+
const names = [...new Set(candidates.map((pkg) => pkg.manifest.name))].sort();
|
|
6121
|
+
const results = [];
|
|
6122
|
+
for (let start = 0; start < names.length; start += 4) results.push(...await Promise.all(names.slice(start, start + 4).map((name) => exchangePackage(name, idToken, requestToken, fetcher))));
|
|
6123
|
+
const hints = results.some((result) => result.status === 404) ? [
|
|
6124
|
+
"HTTP 404 alone does not prove that a package is missing or that its trusted publisher has expired. Check the npm package settings and the repository, workflow and environment identity.",
|
|
6125
|
+
"If npm explicitly reports Expired, delete and recreate the trusted publisher, then complete its first successful publish within 48 hours. Token exchange alone does not validate the configuration.",
|
|
6126
|
+
"npm policy: https://github.blog/changelog/2026-10-02-unvalidated-npm-trusted-publishing-configurations-now-expire/"
|
|
6127
|
+
] : ["Token exchange success confirms current exchange access only. It does not complete the first successful publish required to validate a new trusted publisher."];
|
|
6128
|
+
return {
|
|
6129
|
+
schemaVersion: 1,
|
|
6130
|
+
identity,
|
|
6131
|
+
results,
|
|
6132
|
+
ok: results.every((result) => result.ok),
|
|
6133
|
+
hints
|
|
6134
|
+
};
|
|
6135
|
+
}
|
|
6136
|
+
async function runReleaseOidcAudit(options) {
|
|
6137
|
+
const env = getReleaseEnv(options);
|
|
6138
|
+
if (options.sourceSha || env["REPO_RELEASE_RECOVERY_SOURCE_SHA"]?.trim() || options.dryRun || env["REPO_RELEASE_DRY_RUN"] === "true" || options.packageName || options.packageVersion || env["REPO_RELEASE_PACKAGE"]?.trim() || env["REPO_RELEASE_VERSION"]?.trim()) throw new ReleaseCommandError("oidc-audit cannot be combined with source-sha, dry-run, package or version recovery options");
|
|
6139
|
+
const report = await auditReleaseOidc({
|
|
6140
|
+
cwd: options.cwd,
|
|
6141
|
+
env
|
|
6142
|
+
});
|
|
6143
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
6144
|
+
if (!report.ok) throw new ReleaseCommandError(`npm OIDC audit failed for ${report.results.filter((result) => !result.ok).length}/${report.results.length} packages; see the safe report above`);
|
|
6145
|
+
return report;
|
|
6146
|
+
}
|
|
6147
|
+
//#endregion
|
|
5975
6148
|
//#region src/commands/release/plan/native.ts
|
|
5976
6149
|
var PlanError = class extends Error {
|
|
5977
6150
|
id;
|
|
@@ -6147,7 +6320,7 @@ async function assertPreviousReleaseComplete(options, distTag = "latest") {
|
|
|
6147
6320
|
if (repository && github?.readReleaseState) for (const group of [candidates, ...cohorts.values()]) {
|
|
6148
6321
|
const key = releaseStateKey(repository, distTag, group);
|
|
6149
6322
|
const checkpoint = await github.readReleaseState(key);
|
|
6150
|
-
if (checkpoint && (!checkpoint.state.complete || checkpoint.state.schemaVersion !== 1)) group.forEach((pkg) => unfinished.add(packageKey(pkg)));
|
|
6323
|
+
if (checkpoint && (!checkpoint.state.complete || checkpoint.state.schemaVersion !== 1)) (checkpoint.state.schemaVersion === 1 ? checkpoint.state.packages : group).forEach((pkg) => unfinished.add(packageKey(pkg)));
|
|
6151
6324
|
}
|
|
6152
6325
|
const blocked = [];
|
|
6153
6326
|
const rule = options.config?.branches ? await resolveReleaseBranch(options) : void 0;
|
|
@@ -6395,6 +6568,26 @@ async function readSourceCandidates(options, source) {
|
|
|
6395
6568
|
return candidates;
|
|
6396
6569
|
}
|
|
6397
6570
|
//#endregion
|
|
6571
|
+
//#region src/commands/release/recovery/environment.ts
|
|
6572
|
+
/** Resolve pnpm from the historical checkout for installs and nested lifecycle scripts. */
|
|
6573
|
+
async function sourcePackageManagerEnvironment(options, root) {
|
|
6574
|
+
const directory = path$1.join(root, "package-manager");
|
|
6575
|
+
await mkdir(directory);
|
|
6576
|
+
run("corepack", [
|
|
6577
|
+
"enable",
|
|
6578
|
+
"--install-directory",
|
|
6579
|
+
directory,
|
|
6580
|
+
"pnpm"
|
|
6581
|
+
], options);
|
|
6582
|
+
const env = { ...getReleaseEnv(options) };
|
|
6583
|
+
const pathKey = Object.keys(env).find((key) => key.toLowerCase() === "path") ?? "PATH";
|
|
6584
|
+
env[pathKey] = `${directory}${path$1.delimiter}${env[pathKey] ?? ""}`;
|
|
6585
|
+
env["COREPACK_ENABLE_PROJECT_SPEC"] = "1";
|
|
6586
|
+
env["COREPACK_ENABLE_STRICT"] = "1";
|
|
6587
|
+
env["COREPACK_ENABLE_AUTO_PIN"] = "0";
|
|
6588
|
+
return env;
|
|
6589
|
+
}
|
|
6590
|
+
//#endregion
|
|
6398
6591
|
//#region src/commands/release/recovery/source.ts
|
|
6399
6592
|
/** Run current tooling against the original source, never today's package contents. */
|
|
6400
6593
|
async function recoverSource(options, source) {
|
|
@@ -6465,6 +6658,10 @@ async function recoverSource(options, source) {
|
|
|
6465
6658
|
}
|
|
6466
6659
|
}
|
|
6467
6660
|
if (!(options.dryRun ?? env["REPO_RELEASE_DRY_RUN"] === "true")) {
|
|
6661
|
+
recovery = {
|
|
6662
|
+
...recovery,
|
|
6663
|
+
env: await sourcePackageManagerEnvironment(recovery, root)
|
|
6664
|
+
};
|
|
6468
6665
|
run("pnpm", ["install", "--frozen-lockfile"], recovery);
|
|
6469
6666
|
const config = await resolveCommandConfig("release", cwd);
|
|
6470
6667
|
recovery = {
|
|
@@ -6750,11 +6947,6 @@ async function recoverUnpublished(options) {
|
|
|
6750
6947
|
runAfterPublishHooks(packages, options);
|
|
6751
6948
|
return packages;
|
|
6752
6949
|
}
|
|
6753
|
-
function resolveMode(options) {
|
|
6754
|
-
const requested = options.mode && options.mode !== "auto" ? options.mode : getReleaseEnv(options)["REPO_RELEASE_MODE"]?.trim();
|
|
6755
|
-
if (requested && requested !== "auto") return requested;
|
|
6756
|
-
return "auto";
|
|
6757
|
-
}
|
|
6758
6950
|
async function publishStableCi(options) {
|
|
6759
6951
|
const github = resolveGitHub(options);
|
|
6760
6952
|
if (github.readReleaseState && github.writeReleaseState) {
|
|
@@ -6770,11 +6962,12 @@ async function publishStableCi(options) {
|
|
|
6770
6962
|
return packages;
|
|
6771
6963
|
}
|
|
6772
6964
|
async function releaseCi(options) {
|
|
6965
|
+
const mode = resolveReleaseMode(options);
|
|
6966
|
+
if (mode === "oidc-audit") return runReleaseOidcAudit(options);
|
|
6773
6967
|
options = {
|
|
6774
6968
|
...options,
|
|
6775
6969
|
config: options.config ?? await resolveCommandConfig("release", options.cwd) ?? {}
|
|
6776
6970
|
};
|
|
6777
|
-
const mode = resolveMode(options);
|
|
6778
6971
|
const source = options.sourceSha ?? getReleaseEnv(options)["REPO_RELEASE_RECOVERY_SOURCE_SHA"]?.trim();
|
|
6779
6972
|
if (source) return recoverSource({
|
|
6780
6973
|
...options,
|
|
@@ -6790,7 +6983,7 @@ async function releaseCi(options) {
|
|
|
6790
6983
|
...options,
|
|
6791
6984
|
dryRun: options.dryRun ?? getReleaseEnv(options)["REPO_RELEASE_DRY_RUN"] === "true"
|
|
6792
6985
|
});
|
|
6793
|
-
if (mode !== "auto") throw new ReleaseCommandError(`unknown release CI mode ${mode}; expected auto, prepare, publish, publish-unpublished, or
|
|
6986
|
+
if (mode !== "auto") throw new ReleaseCommandError(`unknown release CI mode ${mode}; expected auto, prepare, publish, publish-unpublished, reconcile, or oidc-audit`);
|
|
6794
6987
|
const eventName = getReleaseEnv(options)["GITHUB_EVENT_NAME"]?.trim();
|
|
6795
6988
|
if (eventName && eventName !== "workflow_dispatch") {
|
|
6796
6989
|
if (!shouldRunRelease(await readReleaseTriggerContext(options))) {
|
|
@@ -7344,7 +7537,7 @@ function reportPath(value) {
|
|
|
7344
7537
|
}
|
|
7345
7538
|
function targets(value) {
|
|
7346
7539
|
if (typeof value === "string") return [value];
|
|
7347
|
-
const conditions = record$
|
|
7540
|
+
const conditions = record$3(value);
|
|
7348
7541
|
if (!conditions || Object.keys(conditions).some((condition) => condition.startsWith("types@"))) return [];
|
|
7349
7542
|
if (Object.hasOwn(conditions, "types")) return targets(conditions["types"]);
|
|
7350
7543
|
return Object.values(conditions).flatMap(targets);
|
|
@@ -7356,7 +7549,7 @@ async function entryPaths(root, workspace, subpath, config, tsconfig = "tsconfig
|
|
|
7356
7549
|
const relative = (filename) => workspace === "." ? filename : `${workspace}/${filename}`;
|
|
7357
7550
|
const packageJson = await safeFile(root, relative("package.json"));
|
|
7358
7551
|
const manifest = JSON.parse(await readFile(packageJson, "utf8"));
|
|
7359
|
-
const exports = record$
|
|
7552
|
+
const exports = record$3(manifest["exports"]);
|
|
7360
7553
|
const exported = exports && Object.keys(exports).some((key) => key.startsWith(".")) ? exports[subpath] : subpath === "." ? manifest["exports"] : void 0;
|
|
7361
7554
|
const declarations = targets(exported).map((item) => item.replace(/^\.\//u, "").replace(/(?<!\.d)\.(cjs|mjs|js)$/u, (_, ext) => ext === "js" ? ".d.ts" : ext === "mjs" ? ".d.mts" : ".d.cts"));
|
|
7362
7555
|
const types = manifest["types"] ?? manifest["typings"];
|
|
@@ -7376,14 +7569,14 @@ async function entryPaths(root, workspace, subpath, config, tsconfig = "tsconfig
|
|
|
7376
7569
|
//#endregion
|
|
7377
7570
|
//#region src/commands/api-report/settings.ts
|
|
7378
7571
|
function configValue(input) {
|
|
7379
|
-
const config = record$
|
|
7572
|
+
const config = record$3(input);
|
|
7380
7573
|
if (!config) throw new Error("tooling.apiReports must map exact workspace selectors to entry configurations.");
|
|
7381
7574
|
for (const value of Object.values(config)) {
|
|
7382
|
-
const item = record$
|
|
7383
|
-
const entries = record$
|
|
7575
|
+
const item = record$3(value);
|
|
7576
|
+
const entries = record$3(item?.["entries"]);
|
|
7384
7577
|
if (!item || Object.keys(item).some((key) => !["entries", "tsconfig"].includes(key)) || !entries || !Object.keys(entries).length || item["tsconfig"] !== void 0 && typeof item["tsconfig"] !== "string") throw new Error("Each apiReports package requires a nonempty entries map and optional tsconfig path.");
|
|
7385
7578
|
for (const [subpath, entry] of Object.entries(entries)) {
|
|
7386
|
-
const data = record$
|
|
7579
|
+
const data = record$3(entry);
|
|
7387
7580
|
if (subpath !== "." && !/^\.\/[\w./-]+$/iu.test(subpath) || subpath.includes("..") || !data || Object.keys(data).some((key) => !["entryPoint", "baseline"].includes(key)) || typeof data["entryPoint"] !== "string" || typeof data["baseline"] !== "string") throw new Error("API entries require a literal public subpath, entryPoint and baseline strings.");
|
|
7388
7581
|
}
|
|
7389
7582
|
}
|
|
@@ -7483,11 +7676,11 @@ async function extractPublicApi(root, tool, packageJson, entryPoint, tsconfig, o
|
|
|
7483
7676
|
}
|
|
7484
7677
|
let result;
|
|
7485
7678
|
try {
|
|
7486
|
-
result = record$
|
|
7679
|
+
result = record$3(JSON.parse(stdout));
|
|
7487
7680
|
} catch {
|
|
7488
7681
|
throw new Error("API Extractor returned invalid analysis output.");
|
|
7489
7682
|
}
|
|
7490
|
-
if (!result || typeof result["succeeded"] !== "boolean" || !Array.isArray(result["diagnostics"]) || result["report"] !== null && typeof result["report"] !== "string" || result["succeeded"] && (!Array.isArray(result["inputs"]) || result["inputs"].some((item) => !record$
|
|
7683
|
+
if (!result || typeof result["succeeded"] !== "boolean" || !Array.isArray(result["diagnostics"]) || result["report"] !== null && typeof result["report"] !== "string" || result["succeeded"] && (!Array.isArray(result["inputs"]) || result["inputs"].some((item) => !record$3(item) || typeof item.path !== "string" || !path.isAbsolute(item.path) || typeof item.hash !== "string" || !/^[a-f\d]{64}$/u.test(item.hash))) || result["succeeded"] && (processFailed || typeof result["inputHash"] !== "string" || !/^[a-f\d]{64}$/u.test(result["inputHash"]) || typeof result["report"] !== "string" || !result["report"].startsWith("## API Report File for ")) || result["diagnostics"].some((item) => !record$3(item) || typeof item.code !== "string" || typeof item.message !== "string" || !["warning", "error"].includes(item.severity))) throw new Error("API Extractor returned an incomplete analysis result.");
|
|
7491
7684
|
return {
|
|
7492
7685
|
inputs: result["inputs"] ?? [],
|
|
7493
7686
|
inputHash: typeof result["inputHash"] === "string" ? result["inputHash"] : null,
|
|
@@ -7734,18 +7927,18 @@ async function readPeerLockfile(root) {
|
|
|
7734
7927
|
try {
|
|
7735
7928
|
const documents = parseAllDocuments(await readFile(path$1.join(root, "pnpm-lock.yaml"), "utf8"));
|
|
7736
7929
|
if (documents.some((doc) => doc.errors.length)) return { state: "unsupported" };
|
|
7737
|
-
const candidates = documents.map((doc) => record$
|
|
7738
|
-
const importers = record$
|
|
7930
|
+
const candidates = documents.map((doc) => record$3(doc.toJSON())).filter((doc) => {
|
|
7931
|
+
const importers = record$3(doc?.["importers"]);
|
|
7739
7932
|
return importers && Object.values(importers).some((value) => [
|
|
7740
7933
|
"dependencies",
|
|
7741
7934
|
"devDependencies",
|
|
7742
7935
|
"optionalDependencies"
|
|
7743
|
-
].some((section) => record$
|
|
7936
|
+
].some((section) => record$3(value)?.[section] !== void 0));
|
|
7744
7937
|
});
|
|
7745
7938
|
if (candidates.length !== 1 || Number(candidates[0]["lockfileVersion"]) !== 9) return { state: "unsupported" };
|
|
7746
7939
|
return {
|
|
7747
7940
|
state: "supported",
|
|
7748
|
-
importers: record$
|
|
7941
|
+
importers: record$3(candidates[0]["importers"])
|
|
7749
7942
|
};
|
|
7750
7943
|
} catch (error) {
|
|
7751
7944
|
if (error.code === "ENOENT") return { state: "absent" };
|
|
@@ -7754,7 +7947,7 @@ async function readPeerLockfile(root) {
|
|
|
7754
7947
|
}
|
|
7755
7948
|
function lockedPeerVersion(lock, directory, name, specifiers, source, range) {
|
|
7756
7949
|
if (lock.state !== "supported") return { state: lock.state };
|
|
7757
|
-
const entry = record$
|
|
7950
|
+
const entry = record$3(record$3(record$3(lock.importers[directory])?.["devDependencies"])?.[name]);
|
|
7758
7951
|
if (!entry || typeof entry["specifier"] !== "string" || !specifiers.includes(entry["specifier"]) || typeof entry["version"] !== "string") return { state: "stale" };
|
|
7759
7952
|
let version = entry["version"].split("(")[0];
|
|
7760
7953
|
if (version.startsWith(`${source}@`)) version = version.slice(source.length + 1);
|
|
@@ -7811,10 +8004,10 @@ function resolvePeerSpecifier(name, input, directory, packages, workspace) {
|
|
|
7811
8004
|
let effective = input;
|
|
7812
8005
|
if (input.startsWith("catalog:")) {
|
|
7813
8006
|
const catalog = input.slice(8);
|
|
7814
|
-
const named = record$
|
|
8007
|
+
const named = record$3(workspace["catalogs"]);
|
|
7815
8008
|
const isDefault = !catalog || catalog === "default";
|
|
7816
8009
|
const duplicateDefault = workspace["catalog"] != null && named?.["default"] != null;
|
|
7817
|
-
const value = (isDefault ? duplicateDefault ? void 0 : record$
|
|
8010
|
+
const value = (isDefault ? duplicateDefault ? void 0 : record$3(workspace["catalog"] ?? named?.["default"]) : record$3(named?.[catalog]))?.[name];
|
|
7818
8011
|
if (typeof value === "string" && !value.startsWith("catalog:")) effective = value;
|
|
7819
8012
|
else return {
|
|
7820
8013
|
source: null,
|
|
@@ -7863,7 +8056,7 @@ async function checkPeerDependencies(cwd) {
|
|
|
7863
8056
|
ignorePrivatePackage: false,
|
|
7864
8057
|
ignoreRootPackage: false
|
|
7865
8058
|
});
|
|
7866
|
-
const workspace = record$
|
|
8059
|
+
const workspace = record$3(parse$1(await readFile(path$1.join(workspaceDir, "pnpm-workspace.yaml"), "utf8"))) ?? {};
|
|
7867
8060
|
const lockfile = await readPeerLockfile(workspaceDir);
|
|
7868
8061
|
const targets = packages.map((pkg) => ({
|
|
7869
8062
|
name: pkg.manifest.name ?? null,
|
|
@@ -7888,11 +8081,11 @@ async function checkPeerDependencies(cwd) {
|
|
|
7888
8081
|
}
|
|
7889
8082
|
};
|
|
7890
8083
|
for (const pkg of packages.toSorted((a, b) => a.rootDir.localeCompare(b.rootDir))) {
|
|
7891
|
-
const manifest = record$
|
|
7892
|
-
const peers = record$
|
|
7893
|
-
const dev = record$
|
|
8084
|
+
const manifest = record$3(pkg.manifest);
|
|
8085
|
+
const peers = record$3(manifest["peerDependencies"]);
|
|
8086
|
+
const dev = record$3(manifest["devDependencies"]);
|
|
7894
8087
|
if (manifest["peerDependencies"] !== void 0 && !peers || manifest["devDependencies"] !== void 0 && !dev) throw new Error(`Invalid peer/development dependency map: ${pkg.rootDir}`);
|
|
7895
|
-
const metadata = record$
|
|
8088
|
+
const metadata = record$3(manifest["peerDependenciesMeta"]);
|
|
7896
8089
|
for (const [name, value] of Object.entries(peers ?? {}).sort(([a], [b]) => a.localeCompare(b))) {
|
|
7897
8090
|
const testValue = dev?.[name];
|
|
7898
8091
|
if (typeof value !== "string" || testValue !== void 0 && typeof testValue !== "string") throw new Error(`Invalid peer/development specifier: ${pkg.rootDir} ${name}`);
|
|
@@ -7902,7 +8095,7 @@ async function checkPeerDependencies(cwd) {
|
|
|
7902
8095
|
packageName: pkg.manifest.name ?? null,
|
|
7903
8096
|
path: path$1.relative(workspaceDir, pkg.rootDir).replaceAll("\\", "/") || ".",
|
|
7904
8097
|
peer: name,
|
|
7905
|
-
optional: record$
|
|
8098
|
+
optional: record$3(metadata?.[name])?.["optional"] === true,
|
|
7906
8099
|
peerSpecifier: value,
|
|
7907
8100
|
testSpecifier: typeof testValue === "string" ? testValue : null,
|
|
7908
8101
|
peerRange: peer.range,
|
|
@@ -7933,7 +8126,7 @@ const presetValues = {
|
|
|
7933
8126
|
};
|
|
7934
8127
|
function renderAdditions(content, additions) {
|
|
7935
8128
|
const document = YAML.parseDocument(content);
|
|
7936
|
-
if (document.errors.length || !record$
|
|
8129
|
+
if (document.errors.length || !record$3(document.toJS())) throw new Error("Cannot plan changes to invalid pnpm-workspace.yaml.");
|
|
7937
8130
|
for (const [key, value] of Object.entries(additions)) {
|
|
7938
8131
|
if (document.has(key)) throw new Error(`Preset refuses to overwrite an existing ${key}.`);
|
|
7939
8132
|
document.set(key, structuredClone(value));
|
|
@@ -7977,7 +8170,7 @@ async function planInstallSecurityPreset(cwd, options = {}) {
|
|
|
7977
8170
|
};
|
|
7978
8171
|
}
|
|
7979
8172
|
async function applyInstallSecurityPreset(cwd, plan) {
|
|
7980
|
-
if (!plan || plan.schemaVersion !== 1 || plan.kind !== "install-security-preset" || plan.preset !== "balanced" || typeof plan.workspaceDir !== "string" || typeof plan.pnpmVersion !== "string" || !/^[a-f\d]{64}$/u.test(plan.policyHash) || !/^[a-f\d]{64}$/u.test(plan.beforeHash) || !/^[a-f\d]{64}$/u.test(plan.afterHash) || !record$
|
|
8173
|
+
if (!plan || plan.schemaVersion !== 1 || plan.kind !== "install-security-preset" || plan.preset !== "balanced" || typeof plan.workspaceDir !== "string" || typeof plan.pnpmVersion !== "string" || !/^[a-f\d]{64}$/u.test(plan.policyHash) || !/^[a-f\d]{64}$/u.test(plan.beforeHash) || !/^[a-f\d]{64}$/u.test(plan.afterHash) || !record$3(plan.additions) || Object.entries(plan.additions).some(([key, value]) => !Object.hasOwn(presetValues, key) || !isDeepStrictEqual(value, presetValues[key]))) throw new Error("Invalid installation security preset plan.");
|
|
7981
8174
|
const current = await planInstallSecurityPreset(cwd);
|
|
7982
8175
|
if (current.workspaceDir !== plan.workspaceDir || current.pnpmVersion !== plan.pnpmVersion) throw new Error("Security preset belongs to a different workspace or pnpm version.");
|
|
7983
8176
|
const original = await readInput(current.workspaceDir, "pnpm-workspace.yaml");
|
|
@@ -9534,8 +9727,8 @@ async function readOwnership(root, inputs) {
|
|
|
9534
9727
|
}
|
|
9535
9728
|
const original = await readText(root, ownershipFile, inputs);
|
|
9536
9729
|
const state = JSON.parse(original.replace(/^\uFEFF/, ""));
|
|
9537
|
-
if (record$
|
|
9538
|
-
if (!record$
|
|
9730
|
+
if (record$3(state) && Object.hasOwn(state, "transaction")) throw new Error("Pending TypeScript references transaction. Verify no writer is active, preserve backups and reconcile the registry before retrying.");
|
|
9731
|
+
if (!record$3(state) || state.schemaVersion !== 1 || Object.keys(state).some((key) => !["schemaVersion", "configs"].includes(key)) || !record$3(state.configs)) throw new Error("Invalid TypeScript reference ownership registry.");
|
|
9539
9732
|
for (const [file, references] of Object.entries(state.configs)) {
|
|
9540
9733
|
relativeFile(file);
|
|
9541
9734
|
if (!Array.isArray(references) || references.length !== new Set(references).size || references.some((ref) => typeof ref !== "string" || referencePath(file, referenceTarget(file, ref)) !== ref)) throw new Error(`Invalid managed project references: ${file}`);
|
|
@@ -9597,7 +9790,7 @@ function renderReferences(ts, config, references) {
|
|
|
9597
9790
|
//#region src/commands/project-references/settings.ts
|
|
9598
9791
|
function parseSettings(value) {
|
|
9599
9792
|
if (value === void 0) return {};
|
|
9600
|
-
const config = record$
|
|
9793
|
+
const config = record$3(value);
|
|
9601
9794
|
if (!config || Object.keys(config).some((key) => ![
|
|
9602
9795
|
"enabled",
|
|
9603
9796
|
"root",
|
|
@@ -9611,7 +9804,7 @@ function parseSettings(value) {
|
|
|
9611
9804
|
if (config["relations"] !== void 0) {
|
|
9612
9805
|
if (!Array.isArray(config["relations"])) throw new TypeError("projectReferences.relations must be an array.");
|
|
9613
9806
|
for (const value of config["relations"]) {
|
|
9614
|
-
const edge = record$
|
|
9807
|
+
const edge = record$3(value);
|
|
9615
9808
|
if (!edge || Object.keys(edge).some((key) => !["source", "target"].includes(key))) throw new Error("Invalid projectReferences relation.");
|
|
9616
9809
|
relativeFile(edge["source"]);
|
|
9617
9810
|
relativeFile(edge["target"]);
|
|
@@ -9621,7 +9814,7 @@ function parseSettings(value) {
|
|
|
9621
9814
|
}
|
|
9622
9815
|
function validateLayers(layers) {
|
|
9623
9816
|
for (const layer of layers) {
|
|
9624
|
-
const tooling = record$
|
|
9817
|
+
const tooling = record$3(record$3(layer)?.["tooling"]);
|
|
9625
9818
|
if (tooling && Object.hasOwn(tooling, "projectReferences")) parseSettings(tooling["projectReferences"]);
|
|
9626
9819
|
}
|
|
9627
9820
|
}
|
|
@@ -9748,7 +9941,7 @@ async function planProjectReferences(cwd) {
|
|
|
9748
9941
|
await validateGraph([.../* @__PURE__ */ new Set([plan.root, ...projected.keys()])].sort(compare$1), projected, read, plan.diagnostics);
|
|
9749
9942
|
for (const project of plan.projects) {
|
|
9750
9943
|
const pkg = packages.filter((pkg) => project.startsWith(`${pkg.relative}/`)).at(-1);
|
|
9751
|
-
const script = record$
|
|
9944
|
+
const script = record$3(record$3(pkg.manifest)?.["scripts"])?.["typecheck"];
|
|
9752
9945
|
plan.validation.push({
|
|
9753
9946
|
config: project,
|
|
9754
9947
|
cwd: pkg.relative,
|
|
@@ -12822,14 +13015,14 @@ function moveManifestChanges(contents, graph, target, to, name, gitRoot = graph.
|
|
|
12822
13015
|
manifest.name = name;
|
|
12823
13016
|
fields.push("name");
|
|
12824
13017
|
}
|
|
12825
|
-
const repository = record$
|
|
13018
|
+
const repository = record$3(manifest.repository);
|
|
12826
13019
|
if (to !== target.id && repository && typeof repository["directory"] === "string" && path.resolve(gitRoot, repository["directory"]) === path.join(graph.workspaceDir, target.id)) {
|
|
12827
13020
|
repository["directory"] = path.relative(gitRoot, path.join(graph.workspaceDir, to));
|
|
12828
13021
|
fields.push("repository.directory");
|
|
12829
13022
|
}
|
|
12830
13023
|
}
|
|
12831
13024
|
for (const section of workspaceDependencyTypes) {
|
|
12832
|
-
const dependencies = record$
|
|
13025
|
+
const dependencies = record$3(manifest[section]);
|
|
12833
13026
|
for (const [dependency, specifier] of Object.entries(dependencies ?? {})) {
|
|
12834
13027
|
if (typeof specifier !== "string") continue;
|
|
12835
13028
|
const next = dependencyValue(graph.workspaceDir, node.id, specifier, target, to, name);
|
|
@@ -12845,7 +13038,7 @@ function moveManifestChanges(contents, graph, target, to, name, gitRoot = graph.
|
|
|
12845
13038
|
}
|
|
12846
13039
|
}
|
|
12847
13040
|
for (const section of ["dependenciesMeta", "peerDependenciesMeta"]) {
|
|
12848
|
-
const metadata = record$
|
|
13041
|
+
const metadata = record$3(manifest[section]);
|
|
12849
13042
|
for (const dependency of renamedDependencies) if (metadata && Object.hasOwn(metadata, dependency)) {
|
|
12850
13043
|
renameKey(metadata, dependency, name);
|
|
12851
13044
|
fields.push(`${section}.${dependency} → ${name}`);
|
|
@@ -12859,7 +13052,7 @@ function moveWorkspaceManifest(before, from, to) {
|
|
|
12859
13052
|
if (from === to) return;
|
|
12860
13053
|
const document = YAML.parseDocument(before);
|
|
12861
13054
|
const original = document.toJS();
|
|
12862
|
-
if (document.errors.length || !record$
|
|
13055
|
+
if (document.errors.length || !record$3(original) || !Array.isArray(original.packages) || original.packages.some((item) => typeof item !== "string")) throw new Error("Moving requires a valid packages array in pnpm-workspace.yaml.");
|
|
12863
13056
|
const packages = original.packages;
|
|
12864
13057
|
if (packages.some((item) => item.startsWith("!") && matchesGlob(to, item.slice(1)))) throw new Error("The destination is excluded by pnpm-workspace.yaml; review its package patterns first.");
|
|
12865
13058
|
const updated = packages.map((item) => item === from || item === `./${from}` ? to : item);
|
|
@@ -12878,7 +13071,7 @@ function moveTypeScriptConfig(root, file, before, target, to, name) {
|
|
|
12878
13071
|
const fields = [];
|
|
12879
13072
|
let config;
|
|
12880
13073
|
try {
|
|
12881
|
-
config = record$
|
|
13074
|
+
config = record$3(parse$2(before));
|
|
12882
13075
|
} catch {
|
|
12883
13076
|
tasks.push({
|
|
12884
13077
|
path: file,
|
|
@@ -12921,9 +13114,9 @@ function moveTypeScriptConfig(root, file, before, target, to, name) {
|
|
|
12921
13114
|
update(config, key, "");
|
|
12922
13115
|
}
|
|
12923
13116
|
if (Array.isArray(config["references"])) {
|
|
12924
|
-
for (const [index, reference] of config["references"].entries()) if (record$
|
|
13117
|
+
for (const [index, reference] of config["references"].entries()) if (record$3(reference)) update(reference, "path", `references.${index}.`);
|
|
12925
13118
|
}
|
|
12926
|
-
const options = record$
|
|
13119
|
+
const options = record$3(config["compilerOptions"]);
|
|
12927
13120
|
if (options) {
|
|
12928
13121
|
const base = path.relative(root, path.resolve(root, directory, typeof options["baseUrl"] === "string" ? options["baseUrl"] : "."));
|
|
12929
13122
|
const nextBase = movedPath(base, target.id, to);
|
|
@@ -12935,7 +13128,7 @@ function moveTypeScriptConfig(root, file, before, target, to, name) {
|
|
|
12935
13128
|
"declarationDir",
|
|
12936
13129
|
"typeRoots"
|
|
12937
13130
|
]) update(options, key, "compilerOptions.");
|
|
12938
|
-
const aliases = record$
|
|
13131
|
+
const aliases = record$3(options["paths"]);
|
|
12939
13132
|
if (aliases && config["extends"] && typeof options["baseUrl"] !== "string") tasks.push({
|
|
12940
13133
|
path: file,
|
|
12941
13134
|
line: 1,
|
|
@@ -13100,7 +13293,7 @@ async function planWorkspaceMove(cwd, options) {
|
|
|
13100
13293
|
code: "nested_repository",
|
|
13101
13294
|
paths: inventory.repositories
|
|
13102
13295
|
});
|
|
13103
|
-
const diagnostics = await relevantDiagnostics(graph, target, record$
|
|
13296
|
+
const diagnostics = await relevantDiagnostics(graph, target, record$3(YAML.parse(contents.get("pnpm-workspace.yaml"))) ?? {});
|
|
13104
13297
|
if (diagnostics.length) blockers.push({
|
|
13105
13298
|
code: "graph_incomplete",
|
|
13106
13299
|
paths: [...new Set(diagnostics.flatMap((item) => item.source ? [item.source] : item.candidates))].sort()
|
|
@@ -13170,7 +13363,7 @@ async function planWorkspaceMove(cwd, options) {
|
|
|
13170
13363
|
//#endregion
|
|
13171
13364
|
//#region src/commands/workspace/move/verify.ts
|
|
13172
13365
|
function validateMovePlan(plan) {
|
|
13173
|
-
if (!record$
|
|
13366
|
+
if (!record$3(plan) || plan.schemaVersion !== 1 || plan.kind !== "workspace-move" || typeof plan.workspaceDir !== "string" || !record$3(plan.selection) || !record$3(plan.target) || !record$3(plan.destination) || typeof plan.target.id !== "string" || typeof plan.destination.id !== "string" || plan.selection.target !== `./${plan.target.id}` || plan.selection.to !== plan.destination.id || plan.selection.name !== plan.destination.name || typeof plan.canApply !== "boolean" || !Array.isArray(plan.blockers) || !Array.isArray(plan.inputs) || !Array.isArray(plan.files) || !Array.isArray(plan.inventory) || !Array.isArray(plan.workspaces) || plan.inputs.some((item) => !record$3(item) || typeof item.path !== "string" || !/^[a-f\d]{64}$/u.test(item.hash)) || plan.files.some((item) => !record$3(item) || typeof item.path !== "string" || typeof item.before !== "string" || typeof item.after !== "string" || item.beforeHash !== hash$1(item.before) || item.afterHash !== hash$1(item.after) || !plan.inputs.some((input) => input.path === item.path && input.hash === item.beforeHash)) || new Set(plan.inputs.map((item) => item.path)).size !== plan.inputs.length || new Set(plan.files.map((item) => item.path)).size !== plan.files.length || !record$3(plan.templateInstances) || plan.templateInstances.from !== plan.target.id || plan.templateInstances.to !== plan.destination.id || !/^[a-f\d]{64}$/u.test(plan.templateInstances.beforeHash) || !/^[a-f\d]{64}$/u.test(plan.templateInstances.afterHash) || !Array.isArray(plan.templateInstances.relocations) || plan.templateInstances.relocations.some((item) => !record$3(item) || !/^[a-f\d]{24}$/u.test(item.id) || typeof item.from !== "string" || item.to !== movedPath(item.from, plan.target.id, plan.destination.id))) throw new Error("Invalid workspace move plan.");
|
|
13174
13367
|
}
|
|
13175
13368
|
async function verifyMovePostState(plan, recoveryPaths = [], requireHead = true) {
|
|
13176
13369
|
const root = plan.workspaceDir;
|
|
@@ -13359,16 +13552,16 @@ function removalManifestChanges(contents, references) {
|
|
|
13359
13552
|
const manifest = JSON.parse(before);
|
|
13360
13553
|
const fields = [];
|
|
13361
13554
|
for (const edge of edges) {
|
|
13362
|
-
const dependencies = record$
|
|
13555
|
+
const dependencies = record$3(manifest[edge.type]);
|
|
13363
13556
|
if (!dependencies || dependencies[edge.dependency] !== edge.specifier) throw new Error(`Manifest changed while computing removal references: ${file}`);
|
|
13364
13557
|
delete dependencies[edge.dependency];
|
|
13365
13558
|
fields.push(`${edge.type}.${edge.dependency}`);
|
|
13366
|
-
if (edge.type === "peerDependencies" && Object.hasOwn(record$
|
|
13559
|
+
if (edge.type === "peerDependencies" && Object.hasOwn(record$3(manifest.peerDependenciesMeta) ?? {}, edge.dependency)) {
|
|
13367
13560
|
delete manifest.peerDependenciesMeta[edge.dependency];
|
|
13368
13561
|
fields.push(`peerDependenciesMeta.${edge.dependency}`);
|
|
13369
13562
|
}
|
|
13370
13563
|
}
|
|
13371
|
-
for (const name of new Set(edges.map((edge) => edge.dependency))) if (workspaceDependencyTypes.every((section) => !Object.hasOwn(record$
|
|
13564
|
+
for (const name of new Set(edges.map((edge) => edge.dependency))) if (workspaceDependencyTypes.every((section) => !Object.hasOwn(record$3(manifest[section]) ?? {}, name)) && Object.hasOwn(record$3(manifest.dependenciesMeta) ?? {}, name)) {
|
|
13372
13565
|
delete manifest.dependenciesMeta[name];
|
|
13373
13566
|
fields.push(`dependenciesMeta.${name}`);
|
|
13374
13567
|
}
|
|
@@ -13494,7 +13687,7 @@ async function planWorkspaceRemoval(cwd, options) {
|
|
|
13494
13687
|
code: "consumers",
|
|
13495
13688
|
paths: consumers.map((item) => item.id)
|
|
13496
13689
|
});
|
|
13497
|
-
const diagnostics = await relevantDiagnostics(graph, target, record$
|
|
13690
|
+
const diagnostics = await relevantDiagnostics(graph, target, record$3(YAML.parse(contents.get("pnpm-workspace.yaml"))) ?? {});
|
|
13498
13691
|
if (diagnostics.length) blockers.push({
|
|
13499
13692
|
code: "graph_incomplete",
|
|
13500
13693
|
paths: [...new Set(diagnostics.flatMap((item) => item.source ? [item.source] : item.candidates))].sort()
|
|
@@ -13621,7 +13814,7 @@ async function cleanupRemovalRecovery(root, recovery, inventory) {
|
|
|
13621
13814
|
//#endregion
|
|
13622
13815
|
//#region src/commands/workspace/remove/verify.ts
|
|
13623
13816
|
function validateRemovalPlan(plan) {
|
|
13624
|
-
if (!record$
|
|
13817
|
+
if (!record$3(plan) || plan.schemaVersion !== 1 || plan.kind !== "workspace-removal" || typeof plan.workspaceDir !== "string" || !record$3(plan.selection) || !record$3(plan.target) || typeof plan.target.id !== "string" || typeof plan.selection.target !== "string" || typeof plan.selection.removeReferences !== "boolean" || typeof plan.canApply !== "boolean" || !Array.isArray(plan.inputs) || !Array.isArray(plan.files) || !Array.isArray(plan.inventory) || !Array.isArray(plan.workspaces) || !Array.isArray(plan.blockers) || !record$3(plan.review) || !Array.isArray(plan.nextSteps) || plan.nextSteps.some((step) => typeof step !== "string") || plan.inputs.some((item) => !record$3(item) || typeof item.path !== "string" || typeof item.hash !== "string") || plan.files.some((item) => !record$3(item) || typeof item.path !== "string" || typeof item.before !== "string" || typeof item.after !== "string" || item.beforeHash !== hash$1(item.before) || item.afterHash !== hash$1(item.after) || !plan.inputs.some((input) => input.path === item.path && input.hash === item.beforeHash)) || plan.workspaces.some((item) => typeof item !== "string") || !plan.workspaces.includes(plan.target.id) || plan.selection.target !== `./${plan.target.id}` || plan.review.scope !== "git-tracked-text-literal-matches" || !Array.isArray(plan.review.scanned) || !Array.isArray(plan.review.matches) || !Array.isArray(plan.review.skipped) || 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("Invalid workspace removal plan.");
|
|
13625
13818
|
}
|
|
13626
13819
|
async function verifyRemovalPostState(plan, requireHead = true) {
|
|
13627
13820
|
const root = plan.workspaceDir;
|
|
@@ -13738,6 +13931,7 @@ var commands_exports = /* @__PURE__ */ __exportAll({
|
|
|
13738
13931
|
applyWorkspaceArtifactPlan: () => applyWorkspaceArtifactPlan,
|
|
13739
13932
|
applyWorkspaceMovePlan: () => applyWorkspaceMovePlan,
|
|
13740
13933
|
applyWorkspaceRemovalPlan: () => applyWorkspaceRemovalPlan,
|
|
13934
|
+
auditReleaseOidc: () => auditReleaseOidc,
|
|
13741
13935
|
checkCatalogs: () => checkCatalogs,
|
|
13742
13936
|
checkDependencies: () => checkDependencies,
|
|
13743
13937
|
checkDependencyAdmission: () => checkDependencyAdmission,
|
|
@@ -13846,4 +14040,4 @@ var commands_exports = /* @__PURE__ */ __exportAll({
|
|
|
13846
14040
|
verifyStagedTypecheck: () => verifyStagedTypecheck
|
|
13847
14041
|
});
|
|
13848
14042
|
//#endregion
|
|
13849
|
-
export {
|
|
14043
|
+
export { GitHubClient as $, resolveAffectedCheckMatrix as A, resolveTemplateCatalog as At, syncSkills as B, defaultAgenticBaseDir as Bt, applyOrganizationPresetAssets as C, defaultTemplate as Ct, applyInstallSecurityPreset as D, templateMap as Dt, planDevContainer as E, getTemplateMap as Et, upgradeMonorepo as F, sanitizeConfigReport as Ft, prepareStable as G, createReleasePullRequest as H, generateAgenticTemplates as Ht, formatUpgradePlan as I, validateConfigFile as It, reconcileRelease as J, publishStable as K, checkTemplates as L, cleanProjects as Lt, applyPublicApiUpdate as M, updateIssueTemplateConfig as Mt, planPublicApiUpdate as N, inspectMonorepoConfig as Nt, planInstallSecurityPreset as O, resolveRemoteTemplateSource as Ot, formatPublicApiReport as P, explainMonorepoConfig as Pt, auditReleaseOidc as Q, getSkillTargetPaths as R, verifyPrePush as Rt, detectMaintenanceVersionChange as S, createNewProject as St, applyDevContainerPlan as T, getCreateChoices as Tt, recoverUnpublished as U, loadAgenticTasks as Ut, repairReleaseNotes as V, generateAgenticTemplate as Vt, releaseCi as W, exitPrerelease as X, enterPrerelease as Y, releasePrerelease as Z, applyProjectReferencesPlan as _, planDoctorFix as _t, planWorkspaceMove as a, init as at, getMaintenanceWorkflow as b, applyUpgradePlan as bt, applyToolingCapability as c, normalizeInitToolingTargets as ct, planTemplateValidation as d, collectEnvInfo as dt, GitHubApiError as et, releaseSnapshot as f, collectEnvPaths as ft, syncProjectReferences as g, applyDoctorFixPlan as gt, checkProjectReferences as h, runDoctor as ht, applyWorkspaceMovePlan as i, setVscodeBinaryMirror as it, checkPublicApi as j, loadTemplateCatalogContext as jt, checkPeerDependencies as k, createTemplateCatalog as kt, planToolingCapability as l, initToolingTargets as lt, createReleasePlan as m, collectEnvSupportBundle as mt, applyWorkspaceRemovalPlan as n, resolveReleaseMode as nt, applyWorkspaceArtifactPlan as o, initMetadata as ot, createSnapshotPlan as p, collectEnvSnapshot as pt, releaseStable as q, planWorkspaceRemoval as r, renderReleasePullRequest as rt, planWorkspaceArtifact as s, initTooling as st, commands_exports as t, parsePublishSummary as tt, validateTemplate as u, createContext as ut, planProjectReferences as v, planUpgrade as vt, planOrganizationPresetAssets as w, resolveCreateNewProjectPlan as wt, prepareMaintenanceUpgrade as x, applyCreateNewProjectPlan as xt, checkPackages as y, resolveReleaseBranches as yt, skillTargets as z, createTimestampFolderName as zt };
|