@ariestools/toolchain 8.7.29 → 9.0.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/README.md +94 -0
- package/dist/actions/analyze.d.ts.map +1 -1
- package/dist/actions/api-exposure/apiExposure.d.ts.map +1 -1
- package/dist/actions/build.d.ts.map +1 -1
- package/dist/actions/clean.d.ts.map +1 -1
- package/dist/actions/compile.d.ts +9 -3
- package/dist/actions/compile.d.ts.map +1 -1
- package/dist/actions/copy-assets.d.ts.map +1 -1
- package/dist/actions/dead/dead.d.ts.map +1 -1
- package/dist/actions/deplint/deplint.d.ts.map +1 -1
- package/dist/actions/deplint/deplintPick.d.ts.map +1 -1
- package/dist/actions/deplint/editXyConfigPackages.d.ts +1 -1
- package/dist/actions/deplint/editXyConfigPackages.d.ts.map +1 -1
- package/dist/actions/deplint/implicitDevDependencies.d.ts.map +1 -1
- package/dist/actions/deplint/packageEditor.d.ts.map +1 -1
- package/dist/actions/fix.d.ts.map +1 -1
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/license.d.ts.map +1 -1
- package/dist/actions/lint-config.d.ts +1 -1
- package/dist/actions/lint-config.d.ts.map +1 -1
- package/dist/actions/lint.d.ts.map +1 -1
- package/dist/actions/lintNextWorker.d.ts.map +1 -1
- package/dist/actions/npmignore-gen.d.ts.map +1 -1
- package/dist/actions/package/clean-outputs.d.ts.map +1 -1
- package/dist/actions/package/clean-typescript.d.ts.map +1 -1
- package/dist/actions/package/clean.d.ts.map +1 -1
- package/dist/actions/package/cleanPlan.d.ts +1 -1
- package/dist/actions/package/cleanPlan.d.ts.map +1 -1
- package/dist/actions/package/cleanRules.d.ts +6 -6
- package/dist/actions/package/cleanRules.d.ts.map +1 -1
- package/dist/actions/package/compile/XyConfig.d.ts +21 -0
- package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
- package/dist/actions/package/compile/buildEntries.d.ts.map +1 -1
- package/dist/actions/package/compile/compile.d.ts.map +1 -1
- package/dist/actions/package/compile/createTypescriptConfig.d.ts.map +1 -1
- package/dist/actions/package/compile/entryOutputName.d.ts +1 -1
- package/dist/actions/package/compile/entryOutputName.d.ts.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.d.ts.map +1 -1
- package/dist/actions/package/compile/inputs.d.ts.map +1 -1
- package/dist/actions/package/compile/monolithCompileLayout.d.ts +1 -1
- package/dist/actions/package/compile/monolithCompileLayout.d.ts.map +1 -1
- package/dist/actions/package/compile/packageCompileEsbuild.d.ts +2 -2
- package/dist/actions/package/compile/packageCompileEsbuild.d.ts.map +1 -1
- package/dist/actions/package/compile/packageCompileMonolith.d.ts.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.d.ts +1 -1
- package/dist/actions/package/compile/packageCompileTsc.d.ts.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.d.ts.map +1 -1
- package/dist/actions/package/compile/packageCompileVendor.d.ts.map +1 -1
- package/dist/actions/package/compile/resolveCompilePlatforms.d.ts.map +1 -1
- package/dist/actions/package/compile/resolvePlatformTypes.d.ts.map +1 -1
- package/dist/actions/package/compile/resolveTscBin.d.ts +46 -0
- package/dist/actions/package/compile/resolveTscBin.d.ts.map +1 -0
- package/dist/actions/package/compile/runTsc.d.ts +14 -1
- package/dist/actions/package/compile/runTsc.d.ts.map +1 -1
- package/dist/actions/package/compile/validateFullPackage.d.ts +2 -1
- package/dist/actions/package/compile/validateFullPackage.d.ts.map +1 -1
- package/dist/actions/package/compile/vendorCompileInternals.d.ts.map +1 -1
- package/dist/actions/package/compile/vendorCompileTypes.d.ts +1 -1
- package/dist/actions/package/compile/vendorCompileTypes.d.ts.map +1 -1
- package/dist/actions/package/copy-assets.d.ts.map +1 -1
- package/dist/actions/package/lint.d.ts.map +1 -1
- package/dist/actions/package/publint.d.ts.map +1 -1
- package/dist/actions/package/recompile.d.ts.map +1 -1
- package/dist/actions/package-lint-pnpm.d.ts +8 -1
- package/dist/actions/package-lint-pnpm.d.ts.map +1 -1
- package/dist/actions/package-lint.d.ts +16 -1
- package/dist/actions/package-lint.d.ts.map +1 -1
- package/dist/actions/packman/lint.d.ts.map +1 -1
- package/dist/actions/publint.d.ts.map +1 -1
- package/dist/actions/publish.d.ts.map +1 -1
- package/dist/actions/rebuild.d.ts.map +1 -1
- package/dist/actions/recompile.d.ts.map +1 -1
- package/dist/actions/reinstall.d.ts.map +1 -1
- package/dist/actions/releaseAgeExcludeScopes.d.ts +1 -1
- package/dist/actions/releaseAgeExcludeScopes.d.ts.map +1 -1
- package/dist/actions/relint.d.ts.map +1 -1
- package/dist/actions/republint.d.ts.map +1 -1
- package/dist/actions/retest.d.ts.map +1 -1
- package/dist/actions/ruleCatalog.d.ts +4 -1
- package/dist/actions/ruleCatalog.d.ts.map +1 -1
- package/dist/actions/ruleRunner.d.ts +2 -1
- package/dist/actions/ruleRunner.d.ts.map +1 -1
- package/dist/actions/secure/dependabot.d.ts +22 -0
- package/dist/actions/secure/dependabot.d.ts.map +1 -0
- package/dist/actions/secure/dependabotRules.d.ts +9 -0
- package/dist/actions/secure/dependabotRules.d.ts.map +1 -0
- package/dist/actions/secure/deps.d.ts +18 -0
- package/dist/actions/secure/deps.d.ts.map +1 -0
- package/dist/actions/secure/index.d.ts +5 -0
- package/dist/actions/secure/index.d.ts.map +1 -0
- package/dist/actions/secure/secure.d.ts +16 -0
- package/dist/actions/secure/secure.d.ts.map +1 -0
- package/dist/actions/secure.d.ts.map +1 -1
- package/dist/actions/skills/defaults.d.ts +2 -2
- package/dist/actions/skills/defaults.d.ts.map +1 -1
- package/dist/actions/skills/detectProfile.d.ts.map +1 -1
- package/dist/actions/skills/installed.d.ts +1 -1
- package/dist/actions/skills/installed.d.ts.map +1 -1
- package/dist/actions/skills/lint.d.ts.map +1 -1
- package/dist/actions/skills/passthrough.d.ts.map +1 -1
- package/dist/actions/skills/skillRules.d.ts.map +1 -1
- package/dist/actions/skills/updo.d.ts.map +1 -1
- package/dist/actions/skills/versions.d.ts.map +1 -1
- package/dist/actions/test.d.ts.map +1 -1
- package/dist/actions/tsc-validate/tscValidate.d.ts.map +1 -1
- package/dist/actions/updo.d.ts.map +1 -1
- package/dist/actions/work/github.d.ts +5 -10
- package/dist/actions/work/github.d.ts.map +1 -1
- package/dist/actions/work/helpers.d.ts +1 -1
- package/dist/actions/work/helpers.d.ts.map +1 -1
- package/dist/actions/work/id.d.ts.map +1 -1
- package/dist/actions/work/index.d.ts.map +1 -1
- package/dist/actions/work/inline.d.ts.map +1 -1
- package/dist/actions/work/lifecycle.d.ts.map +1 -1
- package/dist/actions/work/lint.d.ts.map +1 -1
- package/dist/actions/work/list.d.ts.map +1 -1
- package/dist/actions/work/move.d.ts.map +1 -1
- package/dist/actions/work/priority.d.ts.map +1 -1
- package/dist/actions/work/queue.d.ts.map +1 -1
- package/dist/actions/work/render.d.ts.map +1 -1
- package/dist/actions/work/result.d.ts.map +1 -1
- package/dist/actions/work/schema.d.ts +3 -3
- package/dist/actions/work/schema.d.ts.map +1 -1
- package/dist/actions/work/store.d.ts.map +1 -1
- package/dist/actions/work/sync.d.ts.map +1 -1
- package/dist/actions/work/workspace.d.ts +1 -1
- package/dist/actions/work/workspace.d.ts.map +1 -1
- package/dist/bin/package/build.mjs +557 -437
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +36 -30
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +141 -47
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +395 -369
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +149 -49
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/sync-layout.mjs +28 -28
- package/dist/bin/package/sync-layout.mjs.map +1 -1
- package/dist/bin/xy.mjs +1415 -739
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/lib/aliasSpec.d.ts +28 -0
- package/dist/lib/aliasSpec.d.ts.map +1 -0
- package/dist/lib/checkResult.d.ts +1 -1
- package/dist/lib/checkResult.d.ts.map +1 -1
- package/dist/lib/createBuildConfig.d.ts +1 -1
- package/dist/lib/createBuildConfig.d.ts.map +1 -1
- package/dist/lib/defaultBuildConfig.d.ts.map +1 -1
- package/dist/lib/deleteGlob.d.ts.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.d.ts.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.d.ts.map +1 -1
- package/dist/lib/file/fileLines.d.ts.map +1 -1
- package/dist/lib/file/tryReadFileSync.d.ts.map +1 -1
- package/dist/lib/generateIgnoreFiles.d.ts.map +1 -1
- package/dist/lib/github/index.d.ts +2 -0
- package/dist/lib/github/index.d.ts.map +1 -0
- package/dist/lib/github/runner.d.ts +25 -0
- package/dist/lib/github/runner.d.ts.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/jsonFormatters.d.ts.map +1 -1
- package/dist/lib/latestVersions.d.ts +5 -5
- package/dist/lib/latestVersions.d.ts.map +1 -1
- package/dist/lib/loadConfig.d.ts.map +1 -1
- package/dist/lib/parsedPackageJson.d.ts.map +1 -1
- package/dist/lib/processEx.d.ts.map +1 -1
- package/dist/lib/ruleCommandRegistry.d.ts +61 -46
- package/dist/lib/ruleCommandRegistry.d.ts.map +1 -1
- package/dist/lib/runSteps.d.ts.map +1 -1
- package/dist/lib/runStepsAsync.d.ts.map +1 -1
- package/dist/lib/runXy.d.ts.map +1 -1
- package/dist/lib/runXyWithWarning.d.ts.map +1 -1
- package/dist/lib/safeExit.d.ts.map +1 -1
- package/dist/lib/secure/dependabot/fetchDependabotAlerts.d.ts +12 -0
- package/dist/lib/secure/dependabot/fetchDependabotAlerts.d.ts.map +1 -0
- package/dist/lib/secure/dependabot/index.d.ts +6 -0
- package/dist/lib/secure/dependabot/index.d.ts.map +1 -0
- package/dist/lib/secure/dependabot/interfaces.d.ts +49 -0
- package/dist/lib/secure/dependabot/interfaces.d.ts.map +1 -0
- package/dist/lib/secure/dependabot/renderDependabotAlerts.d.ts +4 -0
- package/dist/lib/secure/dependabot/renderDependabotAlerts.d.ts.map +1 -0
- package/dist/lib/secure/dependabot/summarizeDependabotAlerts.d.ts +5 -0
- package/dist/lib/secure/dependabot/summarizeDependabotAlerts.d.ts.map +1 -0
- package/dist/lib/secure/dependabot/vulnerabilityAlerts.d.ts +21 -0
- package/dist/lib/secure/dependabot/vulnerabilityAlerts.d.ts.map +1 -0
- package/dist/lib/secure/index.d.ts +1 -0
- package/dist/lib/secure/index.d.ts.map +1 -1
- package/dist/lib/secure/renderSecurityAudit.d.ts +4 -0
- package/dist/lib/secure/renderSecurityAudit.d.ts.map +1 -1
- package/dist/lib/string/empty.d.ts.map +1 -1
- package/dist/lib/string/union.d.ts.map +1 -1
- package/dist/lib/updo/collectWorkspaceDeps.d.ts.map +1 -1
- package/dist/lib/updo/index.d.ts +1 -0
- package/dist/lib/updo/index.d.ts.map +1 -1
- package/dist/lib/updo/interactiveSelect.d.ts.map +1 -1
- package/dist/lib/updo/interfaces.d.ts +20 -0
- package/dist/lib/updo/interfaces.d.ts.map +1 -1
- package/dist/lib/updo/majorCeiling.d.ts +21 -0
- package/dist/lib/updo/majorCeiling.d.ts.map +1 -0
- package/dist/lib/updo/resolveVersions.d.ts.map +1 -1
- package/dist/lib/updo/runUpdo.d.ts.map +1 -1
- package/dist/lib/withErrnoException.d.ts.map +1 -1
- package/dist/lib/withError.d.ts.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.d.ts.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.d.ts.map +1 -1
- package/dist/pm/bunPackageManager.d.ts +1 -1
- package/dist/pm/bunPackageManager.d.ts.map +1 -1
- package/dist/pm/npmPackageManager.d.ts +1 -1
- package/dist/pm/npmPackageManager.d.ts.map +1 -1
- package/dist/pm/pnpmPackageManager.d.ts +1 -1
- package/dist/pm/pnpmPackageManager.d.ts.map +1 -1
- package/dist/pm/yarnPackageManager.d.ts +1 -1
- package/dist/pm/yarnPackageManager.d.ts.map +1 -1
- package/dist/xy/build/index.d.ts.map +1 -1
- package/dist/xy/common/index.d.ts.map +1 -1
- package/dist/xy/common/secure/dependabotCommand.d.ts +3 -0
- package/dist/xy/common/secure/dependabotCommand.d.ts.map +1 -0
- package/dist/xy/common/secure/depsCommand.d.ts +3 -0
- package/dist/xy/common/secure/depsCommand.d.ts.map +1 -0
- package/dist/xy/common/secure/index.d.ts +5 -0
- package/dist/xy/common/secure/index.d.ts.map +1 -0
- package/dist/xy/common/work/options.d.ts.map +1 -1
- package/dist/xy/deploy/index.d.ts.map +1 -1
- package/dist/xy/install/cleanCommand.d.ts.map +1 -1
- package/dist/xy/install/index.d.ts.map +1 -1
- package/dist/xy/lint/index.d.ts.map +1 -1
- package/dist/xy/param.d.ts.map +1 -1
- package/dist/xy/react/index.d.ts.map +1 -1
- package/dist/xy/xy.d.ts +2 -2
- package/dist/xy/xy.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/bin/xy.mjs
CHANGED
|
@@ -16,8 +16,8 @@ import Pe, { PassThrough } from "node:stream";
|
|
|
16
16
|
import { StringDecoder } from "node:string_decoder";
|
|
17
17
|
import { basename as basename$1, dirname as dirname$1, extname, join, normalize as normalize$1, relative, resolve as resolve$1 } from "path";
|
|
18
18
|
import { execFile, execFileSync, execSync, spawn } from "node:child_process";
|
|
19
|
-
import * as readline from "node:readline";
|
|
20
|
-
import
|
|
19
|
+
import * as readline$1 from "node:readline";
|
|
20
|
+
import readline, { createInterface } from "node:readline";
|
|
21
21
|
import { fileURLToPath as fileURLToPath$1 } from "url";
|
|
22
22
|
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
23
23
|
import { performance as performance$1 } from "node:perf_hooks";
|
|
@@ -71,6 +71,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
71
71
|
}) : target, mod));
|
|
72
72
|
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
73
73
|
//#endregion
|
|
74
|
+
//#region src/lib/aliasSpec.ts
|
|
75
|
+
const ALIAS_PREFIX = "npm:";
|
|
76
|
+
/**
|
|
77
|
+
* Splits an `npm:` alias spec into the registry name and the semver range it
|
|
78
|
+
* carries: `npm:typescript@~7.0.2` → `{ registryName: 'typescript', range: '~7.0.2' }`.
|
|
79
|
+
*
|
|
80
|
+
* Aliases exist so two releases of one package can be installed side by side —
|
|
81
|
+
* `typescript` (the compiler API) alongside `npm:typescript@7` (the native
|
|
82
|
+
* compiler). Without this, the declaration key is the only name updo sees, and
|
|
83
|
+
* a key like `typescript-native` is not a real package: the registry lookup
|
|
84
|
+
* 404s and the dependency is silently never updated.
|
|
85
|
+
*
|
|
86
|
+
* Returns undefined for non-alias specs and for alias specs carrying no range
|
|
87
|
+
* (`npm:typescript`), which express no version intent to move.
|
|
88
|
+
*/
|
|
89
|
+
function parseAliasSpec(spec) {
|
|
90
|
+
if (!spec.startsWith(ALIAS_PREFIX)) return void 0;
|
|
91
|
+
const target = spec.slice(4);
|
|
92
|
+
const separator = target.indexOf("@", 1);
|
|
93
|
+
if (separator <= 0 || separator === target.length - 1) return void 0;
|
|
94
|
+
return {
|
|
95
|
+
range: target.slice(separator + 1),
|
|
96
|
+
registryName: target.slice(0, separator)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Re-wraps a resolved range in its `npm:` alias spec, so an update to an
|
|
101
|
+
* aliased declaration is written back in the form the package manager expects.
|
|
102
|
+
* Non-aliased declarations pass through untouched.
|
|
103
|
+
*/
|
|
104
|
+
function formatDeclaredRange(dep, range) {
|
|
105
|
+
return dep.registryName === dep.name ? range : `${ALIAS_PREFIX}${dep.registryName}@${range}`;
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
74
108
|
//#region src/lib/bundledCliPath.ts
|
|
75
109
|
const require$8 = createRequire(import.meta.url);
|
|
76
110
|
function toolchainPackageRoot() {
|
|
@@ -688,24 +722,24 @@ function ht(n, t, e) {
|
|
|
688
722
|
return s;
|
|
689
723
|
}
|
|
690
724
|
function Bt(n, t = {}) {
|
|
691
|
-
return new I
|
|
725
|
+
return new I(n, t).streamSync();
|
|
692
726
|
}
|
|
693
727
|
function Qe(n, t = {}) {
|
|
694
|
-
return new I
|
|
728
|
+
return new I(n, t).stream();
|
|
695
729
|
}
|
|
696
730
|
function ts$1(n, t = {}) {
|
|
697
|
-
return new I
|
|
731
|
+
return new I(n, t).walkSync();
|
|
698
732
|
}
|
|
699
733
|
async function Je(n, t = {}) {
|
|
700
|
-
return new I
|
|
734
|
+
return new I(n, t).walk();
|
|
701
735
|
}
|
|
702
736
|
function Ut(n, t = {}) {
|
|
703
|
-
return new I
|
|
737
|
+
return new I(n, t).iterateSync();
|
|
704
738
|
}
|
|
705
739
|
function es(n, t = {}) {
|
|
706
|
-
return new I
|
|
740
|
+
return new I(n, t).iterate();
|
|
707
741
|
}
|
|
708
|
-
var Gt, ce, ss, fe, ue, qt, de, pe, is, rs, ns, os$2, hs, as, ls, cs, fs$5, us, ds, at, Ss, lt, Es, we, ye, W, xs, be, vs, Ct, Cs, Ts, As, ks, Kt, Se, Ee, Q, tt, O
|
|
742
|
+
var Gt, ce, ss, fe, ue, qt, de, pe, is, rs, ns, os$2, hs, as, ls, cs, fs$5, us, ds, at, Ss, lt, Es, we, ye, W, xs, be, vs, Ct, Cs, Ts, As, ks, Kt, Se, Ee, Q, tt, O, Rs, Os, Fs, Ds, Ms, Ns, _s, Ls, Ws, Ps, js, Is, zs, Bs, Us, $s, Gs, Hs, Ce, Te, Ae, xe, A, Vs, Ys, Xs, Js, N, Zs, ke, Qs, ti, ve, ei, D, si, Oe, Vt, Fe, At, Re, ii, q, De, Tt, ri, ft, Ne, oi, hi, ai, G, H, K, kt, ut, Rt, _e, Ot, Le, P, et, v, dt, st, C, F, T, Yt, Ft, k, x$1, Xt, Jt, We, Zt, B, Qt, Dt, pt, Y, M, mt, li, ci, fi, ui$1, Mt, te, di, pi, V, vi, wt, Ue, $e, Ri, Oi, L, Ge, He, U, qe, Ke, X, Ve, _, gt, se, je, yt, j, Nt, Lt, Ie, Fi, ie, ze, bt, Be, _t, Wt, ne, Ye, R, Pt, jt, It, it, rt, St, Xe, Di, Mi, Ni, nt, _i, ot, oe, he, ae, Et, Li, zt, xt, vt, Pi, I, le, ji, Ii, zi, Bi, Ui, Ze;
|
|
709
743
|
var init_index_min = __esmMin((() => {
|
|
710
744
|
Gt = (n, t, e) => {
|
|
711
745
|
let s = n instanceof RegExp ? ce(n, e) : n, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
|
|
@@ -1109,7 +1143,7 @@ var init_index_min = __esmMin((() => {
|
|
|
1109
1143
|
}
|
|
1110
1144
|
};
|
|
1111
1145
|
tt = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&");
|
|
1112
|
-
O
|
|
1146
|
+
O = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(n));
|
|
1113
1147
|
Rs = /^\*+([^+@!?\*\[\(]*)$/;
|
|
1114
1148
|
Os = (n) => (t) => !t.startsWith(".") && t.endsWith(n);
|
|
1115
1149
|
Fs = (n) => (t) => t.endsWith(n);
|
|
@@ -1153,59 +1187,59 @@ var init_index_min = __esmMin((() => {
|
|
|
1153
1187
|
win32: { sep: "\\" },
|
|
1154
1188
|
posix: { sep: "/" }
|
|
1155
1189
|
};
|
|
1156
|
-
O
|
|
1190
|
+
O.sep = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
|
|
1157
1191
|
A = Symbol("globstar **");
|
|
1158
|
-
O
|
|
1192
|
+
O.GLOBSTAR = A;
|
|
1159
1193
|
Vs = "[^/]*?";
|
|
1160
1194
|
Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
1161
1195
|
Xs = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
1162
|
-
Js = (n, t = {}) => (e) => O
|
|
1163
|
-
O
|
|
1164
|
-
N
|
|
1196
|
+
Js = (n, t = {}) => (e) => O(e, n, t);
|
|
1197
|
+
O.filter = Js;
|
|
1198
|
+
N = (n, t = {}) => Object.assign({}, n, t);
|
|
1165
1199
|
Zs = (n) => {
|
|
1166
|
-
if (!n || typeof n != "object" || !Object.keys(n).length) return O
|
|
1167
|
-
let t = O
|
|
1168
|
-
return Object.assign((s, i, r = {}) => t(s, i, N
|
|
1200
|
+
if (!n || typeof n != "object" || !Object.keys(n).length) return O;
|
|
1201
|
+
let t = O;
|
|
1202
|
+
return Object.assign((s, i, r = {}) => t(s, i, N(n, r)), {
|
|
1169
1203
|
Minimatch: class extends t.Minimatch {
|
|
1170
1204
|
constructor(i, r = {}) {
|
|
1171
|
-
super(i, N
|
|
1205
|
+
super(i, N(n, r));
|
|
1172
1206
|
}
|
|
1173
1207
|
static defaults(i) {
|
|
1174
|
-
return t.defaults(N
|
|
1208
|
+
return t.defaults(N(n, i)).Minimatch;
|
|
1175
1209
|
}
|
|
1176
1210
|
},
|
|
1177
1211
|
AST: class extends t.AST {
|
|
1178
1212
|
constructor(i, r, o = {}) {
|
|
1179
|
-
super(i, r, N
|
|
1213
|
+
super(i, r, N(n, o));
|
|
1180
1214
|
}
|
|
1181
1215
|
static fromGlob(i, r = {}) {
|
|
1182
|
-
return t.AST.fromGlob(i, N
|
|
1216
|
+
return t.AST.fromGlob(i, N(n, r));
|
|
1183
1217
|
}
|
|
1184
1218
|
},
|
|
1185
|
-
unescape: (s, i = {}) => t.unescape(s, N
|
|
1186
|
-
escape: (s, i = {}) => t.escape(s, N
|
|
1187
|
-
filter: (s, i = {}) => t.filter(s, N
|
|
1188
|
-
defaults: (s) => t.defaults(N
|
|
1189
|
-
makeRe: (s, i = {}) => t.makeRe(s, N
|
|
1190
|
-
braceExpand: (s, i = {}) => t.braceExpand(s, N
|
|
1191
|
-
match: (s, i, r = {}) => t.match(s, i, N
|
|
1219
|
+
unescape: (s, i = {}) => t.unescape(s, N(n, i)),
|
|
1220
|
+
escape: (s, i = {}) => t.escape(s, N(n, i)),
|
|
1221
|
+
filter: (s, i = {}) => t.filter(s, N(n, i)),
|
|
1222
|
+
defaults: (s) => t.defaults(N(n, s)),
|
|
1223
|
+
makeRe: (s, i = {}) => t.makeRe(s, N(n, i)),
|
|
1224
|
+
braceExpand: (s, i = {}) => t.braceExpand(s, N(n, i)),
|
|
1225
|
+
match: (s, i, r = {}) => t.match(s, i, N(n, r)),
|
|
1192
1226
|
sep: t.sep,
|
|
1193
1227
|
GLOBSTAR: A
|
|
1194
1228
|
});
|
|
1195
1229
|
};
|
|
1196
|
-
O
|
|
1230
|
+
O.defaults = Zs;
|
|
1197
1231
|
ke = (n, t = {}) => (at(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : ge(n, { max: t.braceExpandMax }));
|
|
1198
|
-
O
|
|
1199
|
-
Qs = (n, t = {}) => new D
|
|
1200
|
-
O
|
|
1232
|
+
O.braceExpand = ke;
|
|
1233
|
+
Qs = (n, t = {}) => new D(n, t).makeRe();
|
|
1234
|
+
O.makeRe = Qs;
|
|
1201
1235
|
ti = (n, t, e = {}) => {
|
|
1202
|
-
let s = new D
|
|
1236
|
+
let s = new D(t, e);
|
|
1203
1237
|
return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
|
|
1204
1238
|
};
|
|
1205
|
-
O
|
|
1239
|
+
O.match = ti;
|
|
1206
1240
|
ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
1207
1241
|
ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1208
|
-
D
|
|
1242
|
+
D = class {
|
|
1209
1243
|
options;
|
|
1210
1244
|
set;
|
|
1211
1245
|
pattern;
|
|
@@ -1482,13 +1516,13 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
1482
1516
|
return s.flipNegate ? !1 : this.negate;
|
|
1483
1517
|
}
|
|
1484
1518
|
static defaults(t) {
|
|
1485
|
-
return O
|
|
1519
|
+
return O.defaults(t).Minimatch;
|
|
1486
1520
|
}
|
|
1487
1521
|
};
|
|
1488
|
-
O
|
|
1489
|
-
O
|
|
1490
|
-
O
|
|
1491
|
-
O
|
|
1522
|
+
O.AST = Q;
|
|
1523
|
+
O.Minimatch = D;
|
|
1524
|
+
O.escape = tt;
|
|
1525
|
+
O.unescape = W;
|
|
1492
1526
|
si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
1493
1527
|
Oe = /* @__PURE__ */ new Set();
|
|
1494
1528
|
Vt = typeof process == "object" && process ? process : {};
|
|
@@ -2109,17 +2143,17 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
2109
2143
|
_e = Symbol("read");
|
|
2110
2144
|
Ot = Symbol("flush");
|
|
2111
2145
|
Le = Symbol("flushChunk");
|
|
2112
|
-
P
|
|
2146
|
+
P = Symbol("encoding");
|
|
2113
2147
|
et = Symbol("decoder");
|
|
2114
|
-
v
|
|
2148
|
+
v = Symbol("flowing");
|
|
2115
2149
|
dt = Symbol("paused");
|
|
2116
2150
|
st = Symbol("resume");
|
|
2117
|
-
C
|
|
2118
|
-
F
|
|
2119
|
-
T
|
|
2151
|
+
C = Symbol("buffer");
|
|
2152
|
+
F = Symbol("pipes");
|
|
2153
|
+
T = Symbol("bufferLength");
|
|
2120
2154
|
Yt = Symbol("bufferPush");
|
|
2121
2155
|
Ft = Symbol("bufferShift");
|
|
2122
|
-
k
|
|
2156
|
+
k = Symbol("objectMode");
|
|
2123
2157
|
x$1 = Symbol("destroyed");
|
|
2124
2158
|
Xt = Symbol("error");
|
|
2125
2159
|
Jt = Symbol("emitData");
|
|
@@ -2163,12 +2197,12 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
2163
2197
|
di = (n) => !!n.objectMode;
|
|
2164
2198
|
pi = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer";
|
|
2165
2199
|
V = class extends EventEmitter {
|
|
2166
|
-
[v
|
|
2200
|
+
[v] = !1;
|
|
2167
2201
|
[dt] = !1;
|
|
2168
|
-
[F
|
|
2169
|
-
[C
|
|
2170
|
-
[k
|
|
2171
|
-
[P
|
|
2202
|
+
[F] = [];
|
|
2203
|
+
[C] = [];
|
|
2204
|
+
[k];
|
|
2205
|
+
[P];
|
|
2172
2206
|
[B];
|
|
2173
2207
|
[et];
|
|
2174
2208
|
[G] = !1;
|
|
@@ -2176,7 +2210,7 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
2176
2210
|
[kt] = !1;
|
|
2177
2211
|
[Rt] = !1;
|
|
2178
2212
|
[ut] = null;
|
|
2179
|
-
[T
|
|
2213
|
+
[T] = 0;
|
|
2180
2214
|
[x$1] = !1;
|
|
2181
2215
|
[pt];
|
|
2182
2216
|
[Dt] = !1;
|
|
@@ -2187,15 +2221,15 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
2187
2221
|
constructor(...t) {
|
|
2188
2222
|
let e = t[0] || {};
|
|
2189
2223
|
if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
|
|
2190
|
-
di(e) ? (this[k
|
|
2224
|
+
di(e) ? (this[k] = !0, this[P] = null) : pi(e) ? (this[P] = e.encoding, this[k] = !1) : (this[k] = !1, this[P] = null), this[B] = !!e.async, this[et] = this[P] ? new StringDecoder(this[P]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[C] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[F] });
|
|
2191
2225
|
let { signal: s } = e;
|
|
2192
2226
|
s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
|
|
2193
2227
|
}
|
|
2194
2228
|
get bufferLength() {
|
|
2195
|
-
return this[T
|
|
2229
|
+
return this[T];
|
|
2196
2230
|
}
|
|
2197
2231
|
get encoding() {
|
|
2198
|
-
return this[P
|
|
2232
|
+
return this[P];
|
|
2199
2233
|
}
|
|
2200
2234
|
set encoding(t) {
|
|
2201
2235
|
throw new Error("Encoding must be set at instantiation time");
|
|
@@ -2204,7 +2238,7 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
2204
2238
|
throw new Error("Encoding must be set at instantiation time");
|
|
2205
2239
|
}
|
|
2206
2240
|
get objectMode() {
|
|
2207
|
-
return this[k
|
|
2241
|
+
return this[k];
|
|
2208
2242
|
}
|
|
2209
2243
|
set objectMode(t) {
|
|
2210
2244
|
throw new Error("objectMode must be set at instantiation time");
|
|
@@ -2228,80 +2262,80 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
2228
2262
|
if (this[x$1]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
|
|
2229
2263
|
typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
|
|
2230
2264
|
let i = this[B] ? mt : li;
|
|
2231
|
-
if (!this[k
|
|
2265
|
+
if (!this[k] && !Buffer.isBuffer(t)) {
|
|
2232
2266
|
if (ui$1(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
|
|
2233
2267
|
else if (fi(t)) t = Buffer.from(t);
|
|
2234
2268
|
else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
2235
2269
|
}
|
|
2236
|
-
return this[k
|
|
2270
|
+
return this[k] ? (this[v] && this[T] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : t.length ? (typeof t == "string" && !(e === this[P] && !this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P] && (t = this[et].write(t)), this[v] && this[T] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : (this[T] !== 0 && this.emit("readable"), s && i(s), this[v]);
|
|
2237
2271
|
}
|
|
2238
2272
|
read(t) {
|
|
2239
2273
|
if (this[x$1]) return null;
|
|
2240
|
-
if (this[M] = !1, this[T
|
|
2241
|
-
this[k
|
|
2242
|
-
let e = this[_e](t || null, this[C
|
|
2274
|
+
if (this[M] = !1, this[T] === 0 || t === 0 || t && t > this[T]) return this[H](), null;
|
|
2275
|
+
this[k] && (t = null), this[C].length > 1 && !this[k] && (this[C] = [this[P] ? this[C].join("") : Buffer.concat(this[C], this[T])]);
|
|
2276
|
+
let e = this[_e](t || null, this[C][0]);
|
|
2243
2277
|
return this[H](), e;
|
|
2244
2278
|
}
|
|
2245
2279
|
[_e](t, e) {
|
|
2246
|
-
if (this[k
|
|
2280
|
+
if (this[k]) this[Ft]();
|
|
2247
2281
|
else {
|
|
2248
2282
|
let s = e;
|
|
2249
|
-
t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C
|
|
2283
|
+
t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C][0] = s.slice(t), e = s.slice(0, t), this[T] -= t) : (this[C][0] = s.subarray(t), e = s.subarray(0, t), this[T] -= t);
|
|
2250
2284
|
}
|
|
2251
|
-
return this.emit("data", e), !this[C
|
|
2285
|
+
return this.emit("data", e), !this[C].length && !this[G] && this.emit("drain"), e;
|
|
2252
2286
|
}
|
|
2253
2287
|
end(t, e, s) {
|
|
2254
|
-
return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = !0, this.writable = !1, (this[v
|
|
2288
|
+
return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = !0, this.writable = !1, (this[v] || !this[dt]) && this[H](), this;
|
|
2255
2289
|
}
|
|
2256
2290
|
[st]() {
|
|
2257
|
-
this[x$1] || (!this[Y] && !this[F
|
|
2291
|
+
this[x$1] || (!this[Y] && !this[F].length && (this[M] = !0), this[dt] = !1, this[v] = !0, this.emit("resume"), this[C].length ? this[Ot]() : this[G] ? this[H]() : this.emit("drain"));
|
|
2258
2292
|
}
|
|
2259
2293
|
resume() {
|
|
2260
2294
|
return this[st]();
|
|
2261
2295
|
}
|
|
2262
2296
|
pause() {
|
|
2263
|
-
this[v
|
|
2297
|
+
this[v] = !1, this[dt] = !0, this[M] = !1;
|
|
2264
2298
|
}
|
|
2265
2299
|
get destroyed() {
|
|
2266
2300
|
return this[x$1];
|
|
2267
2301
|
}
|
|
2268
2302
|
get flowing() {
|
|
2269
|
-
return this[v
|
|
2303
|
+
return this[v];
|
|
2270
2304
|
}
|
|
2271
2305
|
get paused() {
|
|
2272
2306
|
return this[dt];
|
|
2273
2307
|
}
|
|
2274
2308
|
[Yt](t) {
|
|
2275
|
-
this[k
|
|
2309
|
+
this[k] ? this[T] += 1 : this[T] += t.length, this[C].push(t);
|
|
2276
2310
|
}
|
|
2277
2311
|
[Ft]() {
|
|
2278
|
-
return this[k
|
|
2312
|
+
return this[k] ? this[T] -= 1 : this[T] -= this[C][0].length, this[C].shift();
|
|
2279
2313
|
}
|
|
2280
2314
|
[Ot](t = !1) {
|
|
2281
2315
|
do ;
|
|
2282
|
-
while (this[Le](this[Ft]()) && this[C
|
|
2283
|
-
!t && !this[C
|
|
2316
|
+
while (this[Le](this[Ft]()) && this[C].length);
|
|
2317
|
+
!t && !this[C].length && !this[G] && this.emit("drain");
|
|
2284
2318
|
}
|
|
2285
2319
|
[Le](t) {
|
|
2286
|
-
return this.emit("data", t), this[v
|
|
2320
|
+
return this.emit("data", t), this[v];
|
|
2287
2321
|
}
|
|
2288
2322
|
pipe(t, e) {
|
|
2289
2323
|
if (this[x$1]) return t;
|
|
2290
2324
|
this[M] = !1;
|
|
2291
2325
|
let s = this[K];
|
|
2292
|
-
return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F
|
|
2326
|
+
return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
|
|
2293
2327
|
}
|
|
2294
2328
|
unpipe(t) {
|
|
2295
|
-
let e = this[F
|
|
2296
|
-
e && (this[F
|
|
2329
|
+
let e = this[F].find((s) => s.dest === t);
|
|
2330
|
+
e && (this[F].length === 1 ? (this[v] && this[Y] === 0 && (this[v] = !1), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe());
|
|
2297
2331
|
}
|
|
2298
2332
|
addListener(t, e) {
|
|
2299
2333
|
return this.on(t, e);
|
|
2300
2334
|
}
|
|
2301
2335
|
on(t, e) {
|
|
2302
2336
|
let s = super.on(t, e);
|
|
2303
|
-
if (t === "data") this[M] = !1, this[Y]++, !this[F
|
|
2304
|
-
else if (t === "readable" && this[T
|
|
2337
|
+
if (t === "data") this[M] = !1, this[Y]++, !this[F].length && !this[v] && this[st]();
|
|
2338
|
+
else if (t === "readable" && this[T] !== 0) super.emit("readable");
|
|
2305
2339
|
else if (ci(t) && this[K]) super.emit(t), this.removeAllListeners(t);
|
|
2306
2340
|
else if (t === "error" && this[ut]) {
|
|
2307
2341
|
let i = e;
|
|
@@ -2314,22 +2348,22 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2314
2348
|
}
|
|
2315
2349
|
off(t, e) {
|
|
2316
2350
|
let s = super.off(t, e);
|
|
2317
|
-
return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F
|
|
2351
|
+
return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F].length && (this[v] = !1)), s;
|
|
2318
2352
|
}
|
|
2319
2353
|
removeAllListeners(t) {
|
|
2320
2354
|
let e = super.removeAllListeners(t);
|
|
2321
|
-
return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F
|
|
2355
|
+
return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F].length && (this[v] = !1)), e;
|
|
2322
2356
|
}
|
|
2323
2357
|
get emittedEnd() {
|
|
2324
2358
|
return this[K];
|
|
2325
2359
|
}
|
|
2326
2360
|
[H]() {
|
|
2327
|
-
!this[kt] && !this[K] && !this[x$1] && this[C
|
|
2361
|
+
!this[kt] && !this[K] && !this[x$1] && this[C].length === 0 && this[G] && (this[kt] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = !1);
|
|
2328
2362
|
}
|
|
2329
2363
|
emit(t, ...e) {
|
|
2330
2364
|
let s = e[0];
|
|
2331
2365
|
if (t !== "error" && t !== "close" && t !== x$1 && this[x$1]) return !1;
|
|
2332
|
-
if (t === "data") return !this[k
|
|
2366
|
+
if (t === "data") return !this[k] && !s ? !1 : this[B] ? (mt(() => this[Jt](s)), !0) : this[Jt](s);
|
|
2333
2367
|
if (t === "end") return this[We]();
|
|
2334
2368
|
if (t === "close") {
|
|
2335
2369
|
if (this[Rt] = !0, !this[K] && !this[x$1]) return !1;
|
|
@@ -2350,7 +2384,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2350
2384
|
return this[H](), i;
|
|
2351
2385
|
}
|
|
2352
2386
|
[Jt](t) {
|
|
2353
|
-
for (let s of this[F
|
|
2387
|
+
for (let s of this[F]) s.dest.write(t) === !1 && this.pause();
|
|
2354
2388
|
let e = this[M] ? !1 : super.emit("data", t);
|
|
2355
2389
|
return this[H](), e;
|
|
2356
2390
|
}
|
|
@@ -2361,26 +2395,26 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2361
2395
|
if (this[et]) {
|
|
2362
2396
|
let e = this[et].end();
|
|
2363
2397
|
if (e) {
|
|
2364
|
-
for (let s of this[F
|
|
2398
|
+
for (let s of this[F]) s.dest.write(e);
|
|
2365
2399
|
this[M] || super.emit("data", e);
|
|
2366
2400
|
}
|
|
2367
2401
|
}
|
|
2368
|
-
for (let e of this[F
|
|
2402
|
+
for (let e of this[F]) e.end();
|
|
2369
2403
|
let t = super.emit("end");
|
|
2370
2404
|
return this.removeAllListeners("end"), t;
|
|
2371
2405
|
}
|
|
2372
2406
|
async collect() {
|
|
2373
2407
|
let t = Object.assign([], { dataLength: 0 });
|
|
2374
|
-
this[k
|
|
2408
|
+
this[k] || (t.dataLength = 0);
|
|
2375
2409
|
let e = this.promise();
|
|
2376
2410
|
return this.on("data", (s) => {
|
|
2377
|
-
t.push(s), this[k
|
|
2411
|
+
t.push(s), this[k] || (t.dataLength += s.length);
|
|
2378
2412
|
}), await e, t;
|
|
2379
2413
|
}
|
|
2380
2414
|
async concat() {
|
|
2381
|
-
if (this[k
|
|
2415
|
+
if (this[k]) throw new Error("cannot concat in objectMode");
|
|
2382
2416
|
let t = await this.collect();
|
|
2383
|
-
return this[P
|
|
2417
|
+
return this[P] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
2384
2418
|
}
|
|
2385
2419
|
async promise() {
|
|
2386
2420
|
return new Promise((t, e) => {
|
|
@@ -2452,7 +2486,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2452
2486
|
}
|
|
2453
2487
|
destroy(t) {
|
|
2454
2488
|
if (this[x$1]) return t ? this.emit("error", t) : this.emit(x$1), this;
|
|
2455
|
-
this[x$1] = !0, this[M] = !0, this[C
|
|
2489
|
+
this[x$1] = !0, this[M] = !0, this[C].length = 0, this[T] = 0;
|
|
2456
2490
|
let e = this;
|
|
2457
2491
|
return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x$1), this;
|
|
2458
2492
|
}
|
|
@@ -2493,15 +2527,15 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2493
2527
|
Ke = 8;
|
|
2494
2528
|
X = 10;
|
|
2495
2529
|
Ve = 12;
|
|
2496
|
-
_
|
|
2497
|
-
gt = ~_
|
|
2530
|
+
_ = 15;
|
|
2531
|
+
gt = ~_;
|
|
2498
2532
|
se = 16;
|
|
2499
2533
|
je = 32;
|
|
2500
2534
|
yt = 64;
|
|
2501
|
-
j
|
|
2535
|
+
j = 128;
|
|
2502
2536
|
Nt = 256;
|
|
2503
2537
|
Lt = 512;
|
|
2504
|
-
Ie = yt | j
|
|
2538
|
+
Ie = yt | j | Lt;
|
|
2505
2539
|
Fi = 1023;
|
|
2506
2540
|
ie = (n) => n.isFile() ? Ke : n.isDirectory() ? U : n.isSymbolicLink() ? X : n.isCharacterDevice() ? He : n.isBlockDevice() ? qe : n.isSocket() ? Ve : n.isFIFO() ? Ge : L;
|
|
2507
2541
|
ze = new ft({ max: 4096 });
|
|
@@ -2532,7 +2566,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2532
2566
|
}
|
|
2533
2567
|
};
|
|
2534
2568
|
Ye = Symbol("PathScurry setAsCwd");
|
|
2535
|
-
R
|
|
2569
|
+
R = class {
|
|
2536
2570
|
name;
|
|
2537
2571
|
root;
|
|
2538
2572
|
roots;
|
|
@@ -2663,7 +2697,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2663
2697
|
parent: this,
|
|
2664
2698
|
fullpath: o
|
|
2665
2699
|
});
|
|
2666
|
-
return this.canReaddir() || (h.#e |= j
|
|
2700
|
+
return this.canReaddir() || (h.#e |= j), s.push(h), h;
|
|
2667
2701
|
}
|
|
2668
2702
|
relative() {
|
|
2669
2703
|
if (this.isCWD) return "";
|
|
@@ -2700,7 +2734,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2700
2734
|
return this.#y = s;
|
|
2701
2735
|
}
|
|
2702
2736
|
isUnknown() {
|
|
2703
|
-
return (this.#e & _
|
|
2737
|
+
return (this.#e & _) === L;
|
|
2704
2738
|
}
|
|
2705
2739
|
isType(t) {
|
|
2706
2740
|
return this[`is${t}`]();
|
|
@@ -2709,22 +2743,22 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2709
2743
|
return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
|
|
2710
2744
|
}
|
|
2711
2745
|
isFile() {
|
|
2712
|
-
return (this.#e & _
|
|
2746
|
+
return (this.#e & _) === Ke;
|
|
2713
2747
|
}
|
|
2714
2748
|
isDirectory() {
|
|
2715
|
-
return (this.#e & _
|
|
2749
|
+
return (this.#e & _) === U;
|
|
2716
2750
|
}
|
|
2717
2751
|
isCharacterDevice() {
|
|
2718
|
-
return (this.#e & _
|
|
2752
|
+
return (this.#e & _) === He;
|
|
2719
2753
|
}
|
|
2720
2754
|
isBlockDevice() {
|
|
2721
|
-
return (this.#e & _
|
|
2755
|
+
return (this.#e & _) === qe;
|
|
2722
2756
|
}
|
|
2723
2757
|
isFIFO() {
|
|
2724
|
-
return (this.#e & _
|
|
2758
|
+
return (this.#e & _) === Ge;
|
|
2725
2759
|
}
|
|
2726
2760
|
isSocket() {
|
|
2727
|
-
return (this.#e & _
|
|
2761
|
+
return (this.#e & _) === Ve;
|
|
2728
2762
|
}
|
|
2729
2763
|
isSymbolicLink() {
|
|
2730
2764
|
return (this.#e & X) === X;
|
|
@@ -2745,14 +2779,14 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2745
2779
|
canReadlink() {
|
|
2746
2780
|
if (this.#M) return !0;
|
|
2747
2781
|
if (!this.parent) return !1;
|
|
2748
|
-
let t = this.#e & _
|
|
2749
|
-
return !(t !== L && t !== X || this.#e & Nt || this.#e & j
|
|
2782
|
+
let t = this.#e & _;
|
|
2783
|
+
return !(t !== L && t !== X || this.#e & Nt || this.#e & j);
|
|
2750
2784
|
}
|
|
2751
2785
|
calledReaddir() {
|
|
2752
2786
|
return !!(this.#e & se);
|
|
2753
2787
|
}
|
|
2754
2788
|
isENOENT() {
|
|
2755
|
-
return !!(this.#e & j
|
|
2789
|
+
return !!(this.#e & j);
|
|
2756
2790
|
}
|
|
2757
2791
|
isNamed(t) {
|
|
2758
2792
|
return this.nocase ? this.#C === _t(t) : this.#C === bt(t);
|
|
@@ -2787,7 +2821,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2787
2821
|
}
|
|
2788
2822
|
}
|
|
2789
2823
|
#v() {
|
|
2790
|
-
this.#e & j
|
|
2824
|
+
this.#e & j || (this.#e = (this.#e | j) & gt, this.#G());
|
|
2791
2825
|
}
|
|
2792
2826
|
#G() {
|
|
2793
2827
|
let t = this.children();
|
|
@@ -2800,7 +2834,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2800
2834
|
#L() {
|
|
2801
2835
|
if (this.#e & yt) return;
|
|
2802
2836
|
let t = this.#e;
|
|
2803
|
-
(t & _
|
|
2837
|
+
(t & _) === U && (t &= gt), this.#e = t | yt, this.#G();
|
|
2804
2838
|
}
|
|
2805
2839
|
#I(t = "") {
|
|
2806
2840
|
t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
|
|
@@ -2810,13 +2844,13 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2810
2844
|
}
|
|
2811
2845
|
#D(t = "") {
|
|
2812
2846
|
let e = this.#e;
|
|
2813
|
-
e |= Nt, t === "ENOENT" && (e |= j
|
|
2847
|
+
e |= Nt, t === "ENOENT" && (e |= j), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
|
|
2814
2848
|
}
|
|
2815
2849
|
#z(t, e) {
|
|
2816
2850
|
return this.#U(t, e) || this.#B(t, e);
|
|
2817
2851
|
}
|
|
2818
2852
|
#B(t, e) {
|
|
2819
|
-
let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _
|
|
2853
|
+
let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _;
|
|
2820
2854
|
return r !== U && r !== X && r !== L && (i.#e |= yt), e.unshift(i), e.provisional++, i;
|
|
2821
2855
|
}
|
|
2822
2856
|
#U(t, e) {
|
|
@@ -2830,14 +2864,14 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2830
2864
|
return e.#e = e.#e & gt | ie(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
|
|
2831
2865
|
}
|
|
2832
2866
|
async lstat() {
|
|
2833
|
-
if ((this.#e & j
|
|
2867
|
+
if ((this.#e & j) === 0) try {
|
|
2834
2868
|
return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
|
|
2835
2869
|
} catch (t) {
|
|
2836
2870
|
this.#F(t.code);
|
|
2837
2871
|
}
|
|
2838
2872
|
}
|
|
2839
2873
|
lstatSync() {
|
|
2840
|
-
if ((this.#e & j
|
|
2874
|
+
if ((this.#e & j) === 0) try {
|
|
2841
2875
|
return this.#$(this.#t.lstatSync(this.fullpath())), this;
|
|
2842
2876
|
} catch (t) {
|
|
2843
2877
|
this.#F(t.code);
|
|
@@ -2914,7 +2948,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2914
2948
|
}
|
|
2915
2949
|
canReaddir() {
|
|
2916
2950
|
if (this.#e & Ie) return !1;
|
|
2917
|
-
let t = _
|
|
2951
|
+
let t = _ & this.#e;
|
|
2918
2952
|
return t === L || t === U || t === X;
|
|
2919
2953
|
}
|
|
2920
2954
|
shouldWalk(t, e) {
|
|
@@ -2922,7 +2956,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2922
2956
|
}
|
|
2923
2957
|
async realpath() {
|
|
2924
2958
|
if (this.#k) return this.#k;
|
|
2925
|
-
if (!((Lt | Nt | j
|
|
2959
|
+
if (!((Lt | Nt | j) & this.#e)) try {
|
|
2926
2960
|
let t = await this.#t.promises.realpath(this.fullpath());
|
|
2927
2961
|
return this.#k = this.resolve(t);
|
|
2928
2962
|
} catch {
|
|
@@ -2931,7 +2965,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2931
2965
|
}
|
|
2932
2966
|
realpathSync() {
|
|
2933
2967
|
if (this.#k) return this.#k;
|
|
2934
|
-
if (!((Lt | Nt | j
|
|
2968
|
+
if (!((Lt | Nt | j) & this.#e)) try {
|
|
2935
2969
|
let t = this.#t.realpathSync(this.fullpath());
|
|
2936
2970
|
return this.#k = this.resolve(t);
|
|
2937
2971
|
} catch {
|
|
@@ -2946,7 +2980,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2946
2980
|
for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
|
|
2947
2981
|
}
|
|
2948
2982
|
};
|
|
2949
|
-
Pt = class n extends R
|
|
2983
|
+
Pt = class n extends R {
|
|
2950
2984
|
sep = "\\";
|
|
2951
2985
|
splitSep = Oi;
|
|
2952
2986
|
constructor(t, e = L, s, i, r, o, h) {
|
|
@@ -2967,7 +3001,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
2967
3001
|
return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
|
|
2968
3002
|
}
|
|
2969
3003
|
};
|
|
2970
|
-
jt = class n extends R
|
|
3004
|
+
jt = class n extends R {
|
|
2971
3005
|
splitSep = "/";
|
|
2972
3006
|
sep = "/";
|
|
2973
3007
|
constructor(t, e = L, s, i, r, o, h) {
|
|
@@ -3052,7 +3086,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3052
3086
|
return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
|
|
3053
3087
|
}
|
|
3054
3088
|
async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
|
|
3055
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3089
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
3056
3090
|
let { withFileTypes: s } = e;
|
|
3057
3091
|
if (t.canReaddir()) {
|
|
3058
3092
|
let i = await t.readdir();
|
|
@@ -3060,7 +3094,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3060
3094
|
} else return [];
|
|
3061
3095
|
}
|
|
3062
3096
|
readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
|
|
3063
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3097
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
3064
3098
|
let { withFileTypes: s = !0 } = e;
|
|
3065
3099
|
return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
|
|
3066
3100
|
}
|
|
@@ -3071,27 +3105,27 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3071
3105
|
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
|
|
3072
3106
|
}
|
|
3073
3107
|
async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
3074
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3108
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
3075
3109
|
let s = await t.readlink();
|
|
3076
3110
|
return e ? s : s?.fullpath();
|
|
3077
3111
|
}
|
|
3078
3112
|
readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
3079
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3113
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
3080
3114
|
let s = t.readlinkSync();
|
|
3081
3115
|
return e ? s : s?.fullpath();
|
|
3082
3116
|
}
|
|
3083
3117
|
async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
3084
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3118
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
3085
3119
|
let s = await t.realpath();
|
|
3086
3120
|
return e ? s : s?.fullpath();
|
|
3087
3121
|
}
|
|
3088
3122
|
realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
3089
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3123
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
3090
3124
|
let s = t.realpathSync();
|
|
3091
3125
|
return e ? s : s?.fullpath();
|
|
3092
3126
|
}
|
|
3093
3127
|
async walk(t = this.cwd, e = {}) {
|
|
3094
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3128
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
3095
3129
|
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
|
|
3096
3130
|
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
3097
3131
|
let a = /* @__PURE__ */ new Set(), l = (c, d) => {
|
|
@@ -3113,7 +3147,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3113
3147
|
});
|
|
3114
3148
|
}
|
|
3115
3149
|
walkSync(t = this.cwd, e = {}) {
|
|
3116
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3150
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
3117
3151
|
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
|
|
3118
3152
|
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
3119
3153
|
let a = /* @__PURE__ */ new Set([t]);
|
|
@@ -3135,13 +3169,13 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3135
3169
|
return this.iterate();
|
|
3136
3170
|
}
|
|
3137
3171
|
iterate(t = this.cwd, e = {}) {
|
|
3138
|
-
return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3172
|
+
return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
|
|
3139
3173
|
}
|
|
3140
3174
|
[Symbol.iterator]() {
|
|
3141
3175
|
return this.iterateSync();
|
|
3142
3176
|
}
|
|
3143
3177
|
*iterateSync(t = this.cwd, e = {}) {
|
|
3144
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3178
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
3145
3179
|
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
|
|
3146
3180
|
(!r || r(t)) && (yield s ? t : t.fullpath());
|
|
3147
3181
|
let h = /* @__PURE__ */ new Set([t]);
|
|
@@ -3159,7 +3193,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3159
3193
|
}
|
|
3160
3194
|
}
|
|
3161
3195
|
stream(t = this.cwd, e = {}) {
|
|
3162
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3196
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
3163
3197
|
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 });
|
|
3164
3198
|
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
3165
3199
|
let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
|
|
@@ -3195,7 +3229,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3195
3229
|
return c(), h;
|
|
3196
3230
|
}
|
|
3197
3231
|
streamSync(t = this.cwd, e = {}) {
|
|
3198
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R
|
|
3232
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
3199
3233
|
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
|
|
3200
3234
|
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
3201
3235
|
let l = [t], u = 0, c = () => {
|
|
@@ -3394,12 +3428,12 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3394
3428
|
for (let h of t) this.add(h);
|
|
3395
3429
|
}
|
|
3396
3430
|
add(t) {
|
|
3397
|
-
let e = new D
|
|
3431
|
+
let e = new D(t, this.mmopts);
|
|
3398
3432
|
for (let s = 0; s < e.set.length; s++) {
|
|
3399
3433
|
let i = e.set[s], r = e.globParts[s];
|
|
3400
3434
|
if (!i || !r) throw new Error("invalid pattern object");
|
|
3401
3435
|
for (; i[0] === "." && r[0] === ".";) i.shift(), r.shift();
|
|
3402
|
-
let o = new nt(i, r, 0, this.platform), h = new D
|
|
3436
|
+
let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
|
|
3403
3437
|
l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
|
|
3404
3438
|
}
|
|
3405
3439
|
}
|
|
@@ -3748,7 +3782,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3748
3782
|
}
|
|
3749
3783
|
};
|
|
3750
3784
|
Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
|
|
3751
|
-
I
|
|
3785
|
+
I = class {
|
|
3752
3786
|
absolute;
|
|
3753
3787
|
cwd;
|
|
3754
3788
|
root;
|
|
@@ -3811,7 +3845,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3811
3845
|
platform: this.platform,
|
|
3812
3846
|
windowsPathsNoEscape: this.windowsPathsNoEscape,
|
|
3813
3847
|
debug: !!this.opts.debug
|
|
3814
|
-
}, [o, h] = this.pattern.map((a) => new D
|
|
3848
|
+
}, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
|
|
3815
3849
|
this.patterns = o.map((a, l) => {
|
|
3816
3850
|
let u = h[l];
|
|
3817
3851
|
if (!u) throw new Error("invalid pattern object");
|
|
@@ -3869,7 +3903,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3869
3903
|
};
|
|
3870
3904
|
le = (n, t = {}) => {
|
|
3871
3905
|
Array.isArray(n) || (n = [n]);
|
|
3872
|
-
for (let e of n) if (new D
|
|
3906
|
+
for (let e of n) if (new D(e, t).hasMagic()) return !0;
|
|
3873
3907
|
return !1;
|
|
3874
3908
|
};
|
|
3875
3909
|
ji = Bt;
|
|
@@ -3892,7 +3926,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
|
|
|
3892
3926
|
iterate: Bi,
|
|
3893
3927
|
globIterateSync: Ut,
|
|
3894
3928
|
iterateSync: zi,
|
|
3895
|
-
Glob: I
|
|
3929
|
+
Glob: I,
|
|
3896
3930
|
hasMagic: le,
|
|
3897
3931
|
escape: tt,
|
|
3898
3932
|
unescape: W
|
|
@@ -6910,6 +6944,67 @@ function setGitConfig(key, value) {
|
|
|
6910
6944
|
], { stdio: "inherit" });
|
|
6911
6945
|
}
|
|
6912
6946
|
//#endregion
|
|
6947
|
+
//#region src/lib/github/runner.ts
|
|
6948
|
+
/**
|
|
6949
|
+
* Node's spawnSync defaults to a 1 MB buffer, which a paginated org-wide query
|
|
6950
|
+
* blows past — the child is killed and its partial stdout looks like a failure.
|
|
6951
|
+
*/
|
|
6952
|
+
const GITHUB_MAX_BUFFER = 268435456;
|
|
6953
|
+
const defaultGithubRunner = (args, options = {}) => {
|
|
6954
|
+
const result = spawnSync("gh", args, {
|
|
6955
|
+
cwd: options.cwd,
|
|
6956
|
+
encoding: "utf8",
|
|
6957
|
+
env: process.env,
|
|
6958
|
+
maxBuffer: GITHUB_MAX_BUFFER,
|
|
6959
|
+
stdio: [
|
|
6960
|
+
"ignore",
|
|
6961
|
+
"pipe",
|
|
6962
|
+
"pipe"
|
|
6963
|
+
]
|
|
6964
|
+
});
|
|
6965
|
+
return {
|
|
6966
|
+
status: result.status,
|
|
6967
|
+
stderr: typeof result.stderr === "string" ? result.stderr : "",
|
|
6968
|
+
stdout: typeof result.stdout === "string" ? result.stdout : ""
|
|
6969
|
+
};
|
|
6970
|
+
};
|
|
6971
|
+
/**
|
|
6972
|
+
`gh` is installed, authenticated, and the cwd resolves to a GitHub repository.
|
|
6973
|
+
*/
|
|
6974
|
+
function githubIsAvailable(runner, cwd) {
|
|
6975
|
+
if (runner(["--version"], { cwd }).status !== 0) return false;
|
|
6976
|
+
if (runner(["auth", "status"], { cwd }).status !== 0) return false;
|
|
6977
|
+
const repo = runner([
|
|
6978
|
+
"repo",
|
|
6979
|
+
"view",
|
|
6980
|
+
"--json",
|
|
6981
|
+
"nameWithOwner"
|
|
6982
|
+
], { cwd });
|
|
6983
|
+
return repo.status === 0 && repo.stdout.trim().length > 0;
|
|
6984
|
+
}
|
|
6985
|
+
function githubRunOrThrow(runner, args, cwd, context) {
|
|
6986
|
+
const result = runner(args, { cwd });
|
|
6987
|
+
if (result.status !== 0) {
|
|
6988
|
+
const detail = result.stderr.trim() || result.stdout.trim() || `exit ${String(result.status)}`;
|
|
6989
|
+
throw new Error(`${context}: ${detail}`);
|
|
6990
|
+
}
|
|
6991
|
+
return result.stdout;
|
|
6992
|
+
}
|
|
6993
|
+
/**
|
|
6994
|
+
Parse `gh api --paginate` output in either form it emits: without `--jq` it
|
|
6995
|
+
concatenates one JSON array per page with no separator, so the seams have to be
|
|
6996
|
+
spliced; with `--jq` it emits one compact JSON value per line.
|
|
6997
|
+
*/
|
|
6998
|
+
function parseGithubPaginatedJson(stdout) {
|
|
6999
|
+
const trimmed = stdout.trim();
|
|
7000
|
+
if (trimmed.length === 0) return [];
|
|
7001
|
+
if (trimmed.startsWith("[")) {
|
|
7002
|
+
const parsed = JSON.parse(trimmed.replaceAll(/\]\s*\[/g, ","));
|
|
7003
|
+
return Array.isArray(parsed) ? parsed : [parsed];
|
|
7004
|
+
}
|
|
7005
|
+
return trimmed.split("\n").filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
|
|
7006
|
+
}
|
|
7007
|
+
//#endregion
|
|
6913
7008
|
//#region src/lib/gitignoreTemplate.ts
|
|
6914
7009
|
const require$6 = createRequire(import.meta.url);
|
|
6915
7010
|
const packageRoot$1 = PATH.dirname(require$6.resolve("@ariestools/toolchain/package.json"));
|
|
@@ -7097,7 +7192,7 @@ function collectProductionLicenses(startDir) {
|
|
|
7097
7192
|
return result;
|
|
7098
7193
|
}
|
|
7099
7194
|
//#endregion
|
|
7100
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7195
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/common.js
|
|
7101
7196
|
var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7102
7197
|
function isNothing(subject) {
|
|
7103
7198
|
return typeof subject === "undefined" || subject === null;
|
|
@@ -7136,7 +7231,7 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7136
7231
|
module.exports.extend = extend;
|
|
7137
7232
|
}));
|
|
7138
7233
|
//#endregion
|
|
7139
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7234
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/exception.js
|
|
7140
7235
|
var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7141
7236
|
function formatError(exception, compact) {
|
|
7142
7237
|
let where = "";
|
|
@@ -7164,7 +7259,7 @@ var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7164
7259
|
module.exports = YAMLException;
|
|
7165
7260
|
}));
|
|
7166
7261
|
//#endregion
|
|
7167
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7262
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/snippet.js
|
|
7168
7263
|
var require_snippet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7169
7264
|
const common = require_common();
|
|
7170
7265
|
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
@@ -7226,7 +7321,7 @@ var require_snippet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7226
7321
|
module.exports = makeSnippet;
|
|
7227
7322
|
}));
|
|
7228
7323
|
//#endregion
|
|
7229
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7324
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type.js
|
|
7230
7325
|
var require_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7231
7326
|
const YAMLException = require_exception();
|
|
7232
7327
|
const TYPE_CONSTRUCTOR_OPTIONS = [
|
|
@@ -7281,7 +7376,7 @@ var require_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7281
7376
|
module.exports = Type;
|
|
7282
7377
|
}));
|
|
7283
7378
|
//#endregion
|
|
7284
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7379
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/schema.js
|
|
7285
7380
|
var require_schema$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7286
7381
|
const YAMLException = require_exception();
|
|
7287
7382
|
const Type = require_type();
|
|
@@ -7349,7 +7444,7 @@ var require_schema$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7349
7444
|
module.exports = Schema;
|
|
7350
7445
|
}));
|
|
7351
7446
|
//#endregion
|
|
7352
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7447
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/str.js
|
|
7353
7448
|
var require_str = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7354
7449
|
module.exports = new (require_type())("tag:yaml.org,2002:str", {
|
|
7355
7450
|
kind: "scalar",
|
|
@@ -7359,7 +7454,7 @@ var require_str = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7359
7454
|
});
|
|
7360
7455
|
}));
|
|
7361
7456
|
//#endregion
|
|
7362
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7457
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/seq.js
|
|
7363
7458
|
var require_seq$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7364
7459
|
module.exports = new (require_type())("tag:yaml.org,2002:seq", {
|
|
7365
7460
|
kind: "sequence",
|
|
@@ -7369,7 +7464,7 @@ var require_seq$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7369
7464
|
});
|
|
7370
7465
|
}));
|
|
7371
7466
|
//#endregion
|
|
7372
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7467
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/map.js
|
|
7373
7468
|
var require_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7374
7469
|
module.exports = new (require_type())("tag:yaml.org,2002:map", {
|
|
7375
7470
|
kind: "mapping",
|
|
@@ -7379,7 +7474,7 @@ var require_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7379
7474
|
});
|
|
7380
7475
|
}));
|
|
7381
7476
|
//#endregion
|
|
7382
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7477
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/schema/failsafe.js
|
|
7383
7478
|
var require_failsafe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7384
7479
|
module.exports = new (require_schema$3())({ explicit: [
|
|
7385
7480
|
require_str(),
|
|
@@ -7388,7 +7483,7 @@ var require_failsafe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7388
7483
|
] });
|
|
7389
7484
|
}));
|
|
7390
7485
|
//#endregion
|
|
7391
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7486
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/null.js
|
|
7392
7487
|
var require_null$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7393
7488
|
const Type = require_type();
|
|
7394
7489
|
function resolveYamlNull(data) {
|
|
@@ -7428,7 +7523,7 @@ var require_null$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7428
7523
|
});
|
|
7429
7524
|
}));
|
|
7430
7525
|
//#endregion
|
|
7431
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7526
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/bool.js
|
|
7432
7527
|
var require_bool$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7433
7528
|
const Type = require_type();
|
|
7434
7529
|
function resolveYamlBoolean(data) {
|
|
@@ -7462,7 +7557,7 @@ var require_bool$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7462
7557
|
});
|
|
7463
7558
|
}));
|
|
7464
7559
|
//#endregion
|
|
7465
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7560
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/int.js
|
|
7466
7561
|
var require_int$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7467
7562
|
const common = require_common();
|
|
7468
7563
|
const Type = require_type();
|
|
@@ -7571,7 +7666,7 @@ var require_int$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7571
7666
|
});
|
|
7572
7667
|
}));
|
|
7573
7668
|
//#endregion
|
|
7574
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7669
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/float.js
|
|
7575
7670
|
var require_float$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7576
7671
|
const common = require_common();
|
|
7577
7672
|
const Type = require_type();
|
|
@@ -7625,7 +7720,7 @@ var require_float$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7625
7720
|
});
|
|
7626
7721
|
}));
|
|
7627
7722
|
//#endregion
|
|
7628
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7723
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/schema/json.js
|
|
7629
7724
|
var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7630
7725
|
module.exports = require_failsafe().extend({ implicit: [
|
|
7631
7726
|
require_null$1(),
|
|
@@ -7635,12 +7730,12 @@ var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7635
7730
|
] });
|
|
7636
7731
|
}));
|
|
7637
7732
|
//#endregion
|
|
7638
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7733
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/schema/core.js
|
|
7639
7734
|
var require_core = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7640
7735
|
module.exports = require_json();
|
|
7641
7736
|
}));
|
|
7642
7737
|
//#endregion
|
|
7643
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7738
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/timestamp.js
|
|
7644
7739
|
var require_timestamp$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7645
7740
|
const Type = require_type();
|
|
7646
7741
|
const YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
@@ -7691,7 +7786,7 @@ var require_timestamp$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7691
7786
|
});
|
|
7692
7787
|
}));
|
|
7693
7788
|
//#endregion
|
|
7694
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7789
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/merge.js
|
|
7695
7790
|
var require_merge$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7696
7791
|
const Type = require_type();
|
|
7697
7792
|
function resolveYamlMerge(data) {
|
|
@@ -7703,7 +7798,7 @@ var require_merge$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7703
7798
|
});
|
|
7704
7799
|
}));
|
|
7705
7800
|
//#endregion
|
|
7706
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7801
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/binary.js
|
|
7707
7802
|
var require_binary$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7708
7803
|
const Type = require_type();
|
|
7709
7804
|
const BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
@@ -7790,14 +7885,14 @@ var require_binary$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7790
7885
|
});
|
|
7791
7886
|
}));
|
|
7792
7887
|
//#endregion
|
|
7793
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7888
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/omap.js
|
|
7794
7889
|
var require_omap$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7795
7890
|
const Type = require_type();
|
|
7796
7891
|
const _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
7797
7892
|
const _toString = Object.prototype.toString;
|
|
7798
7893
|
function resolveYamlOmap(data) {
|
|
7799
7894
|
if (data === null) return true;
|
|
7800
|
-
const objectKeys =
|
|
7895
|
+
const objectKeys = {};
|
|
7801
7896
|
const object = data;
|
|
7802
7897
|
for (let index = 0, length = object.length; index < length; index += 1) {
|
|
7803
7898
|
const pair = object[index];
|
|
@@ -7809,8 +7904,8 @@ var require_omap$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7809
7904
|
else return false;
|
|
7810
7905
|
}
|
|
7811
7906
|
if (!pairHasKey) return false;
|
|
7812
|
-
if (
|
|
7813
|
-
|
|
7907
|
+
if (_hasOwnProperty.call(objectKeys, pairKey)) return false;
|
|
7908
|
+
Object.defineProperty(objectKeys, pairKey, { value: true });
|
|
7814
7909
|
}
|
|
7815
7910
|
return true;
|
|
7816
7911
|
}
|
|
@@ -7824,7 +7919,7 @@ var require_omap$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7824
7919
|
});
|
|
7825
7920
|
}));
|
|
7826
7921
|
//#endregion
|
|
7827
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7922
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/pairs.js
|
|
7828
7923
|
var require_pairs$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7829
7924
|
const Type = require_type();
|
|
7830
7925
|
const _toString = Object.prototype.toString;
|
|
@@ -7859,7 +7954,7 @@ var require_pairs$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7859
7954
|
});
|
|
7860
7955
|
}));
|
|
7861
7956
|
//#endregion
|
|
7862
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7957
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/set.js
|
|
7863
7958
|
var require_set$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7864
7959
|
const Type = require_type();
|
|
7865
7960
|
const _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -7881,7 +7976,7 @@ var require_set$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7881
7976
|
});
|
|
7882
7977
|
}));
|
|
7883
7978
|
//#endregion
|
|
7884
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7979
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/schema/default.js
|
|
7885
7980
|
var require_default = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7886
7981
|
module.exports = require_core().extend({
|
|
7887
7982
|
implicit: [require_timestamp$1(), require_merge$2()],
|
|
@@ -7894,7 +7989,7 @@ var require_default = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7894
7989
|
});
|
|
7895
7990
|
}));
|
|
7896
7991
|
//#endregion
|
|
7897
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
7992
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/loader.js
|
|
7898
7993
|
var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7899
7994
|
const common = require_common();
|
|
7900
7995
|
const YAMLException = require_exception();
|
|
@@ -8922,7 +9017,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8922
9017
|
module.exports.load = load;
|
|
8923
9018
|
}));
|
|
8924
9019
|
//#endregion
|
|
8925
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
9020
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/dumper.js
|
|
8926
9021
|
var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8927
9022
|
const common = require_common();
|
|
8928
9023
|
const YAMLException = require_exception();
|
|
@@ -9421,7 +9516,7 @@ var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9421
9516
|
module.exports.dump = dump;
|
|
9422
9517
|
}));
|
|
9423
9518
|
//#endregion
|
|
9424
|
-
//#region ../../node_modules/.pnpm/js-yaml@4.3.
|
|
9519
|
+
//#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/index.js
|
|
9425
9520
|
var require_js_yaml = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9426
9521
|
const loader = require_loader();
|
|
9427
9522
|
const dumper = require_dumper();
|
|
@@ -10363,6 +10458,8 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10363
10458
|
}));
|
|
10364
10459
|
//#endregion
|
|
10365
10460
|
//#region src/lib/ruleCommandRegistry.ts
|
|
10461
|
+
/** Title for the root `xy --rules` catalog. */
|
|
10462
|
+
const ROOT_RULES_TITLE = "XY Rules";
|
|
10366
10463
|
const RULE_COMMANDS = {
|
|
10367
10464
|
apiExposure: {
|
|
10368
10465
|
command: "api-exposure",
|
|
@@ -10372,7 +10469,7 @@ const RULE_COMMANDS = {
|
|
|
10372
10469
|
},
|
|
10373
10470
|
check: {
|
|
10374
10471
|
command: "check",
|
|
10375
|
-
includeInRoot:
|
|
10472
|
+
includeInRoot: false,
|
|
10376
10473
|
title: "Check Rules"
|
|
10377
10474
|
},
|
|
10378
10475
|
clean: {
|
|
@@ -10392,6 +10489,12 @@ const RULE_COMMANDS = {
|
|
|
10392
10489
|
includeInRoot: true,
|
|
10393
10490
|
title: "Dead Rules"
|
|
10394
10491
|
},
|
|
10492
|
+
dependabot: {
|
|
10493
|
+
command: "secure dependabot",
|
|
10494
|
+
configKey: "dependabot",
|
|
10495
|
+
includeInRoot: true,
|
|
10496
|
+
title: "Dependabot Rules"
|
|
10497
|
+
},
|
|
10395
10498
|
deplint: {
|
|
10396
10499
|
command: "deplint",
|
|
10397
10500
|
configKey: "deplint",
|
|
@@ -10413,7 +10516,7 @@ const RULE_COMMANDS = {
|
|
|
10413
10516
|
lint: {
|
|
10414
10517
|
aliases: ["relint"],
|
|
10415
10518
|
command: "lint",
|
|
10416
|
-
includeInRoot:
|
|
10519
|
+
includeInRoot: false,
|
|
10417
10520
|
title: "Lint Rules"
|
|
10418
10521
|
},
|
|
10419
10522
|
lintLint: {
|
|
@@ -10494,7 +10597,7 @@ In-flight workspace loads — concurrent jobs for the same dir share one search.
|
|
|
10494
10597
|
*/
|
|
10495
10598
|
const workspaceConfigLoadPromises = /* @__PURE__ */ new Map();
|
|
10496
10599
|
const deprecationWarned = /* @__PURE__ */ new Set();
|
|
10497
|
-
function isRecord$
|
|
10600
|
+
function isRecord$9(value) {
|
|
10498
10601
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10499
10602
|
}
|
|
10500
10603
|
const explorerState = {};
|
|
@@ -10575,12 +10678,12 @@ function warnOnce(key, message) {
|
|
|
10575
10678
|
*/
|
|
10576
10679
|
function resolveCommandField(cfg, commandName, configPath) {
|
|
10577
10680
|
const configKey = canonicalRuleConfigKey(commandName);
|
|
10578
|
-
const commands = isRecord$
|
|
10681
|
+
const commands = isRecord$9(cfg.commands) ? cfg.commands : void 0;
|
|
10579
10682
|
const fromCommands = commands?.[configKey];
|
|
10580
|
-
if (isRecord$
|
|
10683
|
+
if (isRecord$9(fromCommands)) return fromCommands;
|
|
10581
10684
|
for (const alias of deprecatedRuleConfigAliases(configKey)) {
|
|
10582
10685
|
const fromAlias = commands?.[alias];
|
|
10583
|
-
if (!isRecord$
|
|
10686
|
+
if (!isRecord$9(fromAlias)) continue;
|
|
10584
10687
|
warnOnce(`${configPath ?? "unknown"}:commands.${alias}`, `[xy] Deprecated: "commands.${alias}" in ${configPath ?? "xy.config"} — use "commands.${configKey}"`);
|
|
10585
10688
|
return fromAlias;
|
|
10586
10689
|
}
|
|
@@ -10592,7 +10695,7 @@ function resolveCommandField(cfg, commandName, configPath) {
|
|
|
10592
10695
|
return {};
|
|
10593
10696
|
}
|
|
10594
10697
|
function mergeRuleConfigs(target, source) {
|
|
10595
|
-
if (isRecord$
|
|
10698
|
+
if (isRecord$9(target) && isRecord$9(source)) return {
|
|
10596
10699
|
...target,
|
|
10597
10700
|
...source
|
|
10598
10701
|
};
|
|
@@ -19306,6 +19409,295 @@ function collectSecureDeclaredDependencies(cwd, targets, localPackageNames) {
|
|
|
19306
19409
|
});
|
|
19307
19410
|
}
|
|
19308
19411
|
//#endregion
|
|
19412
|
+
//#region src/lib/secure/dependabot/fetchDependabotAlerts.ts
|
|
19413
|
+
/**
|
|
19414
|
+
Ask GitHub for only the fields we render. An org-wide sweep returns thousands
|
|
19415
|
+
of alerts, and each raw alert carries a full advisory body plus reference and
|
|
19416
|
+
identifier lists — the projection keeps the transfer to a fraction of that
|
|
19417
|
+
while preserving the payload shape `parseDependabotAlert` expects.
|
|
19418
|
+
*/
|
|
19419
|
+
const ALERT_PROJECTION = [
|
|
19420
|
+
".[] | {",
|
|
19421
|
+
"number, html_url, dependency, security_vulnerability,",
|
|
19422
|
+
"security_advisory: {",
|
|
19423
|
+
"ghsa_id: .security_advisory.ghsa_id,",
|
|
19424
|
+
"severity: .security_advisory.severity,",
|
|
19425
|
+
"summary: .security_advisory.summary },",
|
|
19426
|
+
"repository: { full_name: .repository.full_name }",
|
|
19427
|
+
"}"
|
|
19428
|
+
].join(" ");
|
|
19429
|
+
const SEVERITIES = /* @__PURE__ */ new Set([
|
|
19430
|
+
"critical",
|
|
19431
|
+
"high",
|
|
19432
|
+
"low",
|
|
19433
|
+
"medium"
|
|
19434
|
+
]);
|
|
19435
|
+
const SCOPES = /* @__PURE__ */ new Set(["development", "runtime"]);
|
|
19436
|
+
const RELATIONSHIPS = /* @__PURE__ */ new Set(["direct", "transitive"]);
|
|
19437
|
+
function isRecord$8(value) {
|
|
19438
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19439
|
+
}
|
|
19440
|
+
function readString(value) {
|
|
19441
|
+
return typeof value === "string" ? value : "";
|
|
19442
|
+
}
|
|
19443
|
+
function readSeverity(value) {
|
|
19444
|
+
const raw = readString(value).toLowerCase();
|
|
19445
|
+
return SEVERITIES.has(raw) ? raw : "low";
|
|
19446
|
+
}
|
|
19447
|
+
function readScope(value) {
|
|
19448
|
+
const raw = readString(value).toLowerCase();
|
|
19449
|
+
return SCOPES.has(raw) ? raw : "unknown";
|
|
19450
|
+
}
|
|
19451
|
+
function readRelationship(value) {
|
|
19452
|
+
const raw = readString(value).toLowerCase();
|
|
19453
|
+
return RELATIONSHIPS.has(raw) ? raw : "unknown";
|
|
19454
|
+
}
|
|
19455
|
+
function parseDependabotAlert(raw) {
|
|
19456
|
+
if (!isRecord$8(raw)) return void 0;
|
|
19457
|
+
const dependency = isRecord$8(raw.dependency) ? raw.dependency : {};
|
|
19458
|
+
const dependencyPackage = isRecord$8(dependency.package) ? dependency.package : {};
|
|
19459
|
+
const advisory = isRecord$8(raw.security_advisory) ? raw.security_advisory : {};
|
|
19460
|
+
const vulnerability = isRecord$8(raw.security_vulnerability) ? raw.security_vulnerability : {};
|
|
19461
|
+
const patched = isRecord$8(vulnerability.first_patched_version) ? vulnerability.first_patched_version : {};
|
|
19462
|
+
const repository = isRecord$8(raw.repository) ? raw.repository : {};
|
|
19463
|
+
const packageName = readString(dependencyPackage.name);
|
|
19464
|
+
if (packageName.length === 0) return void 0;
|
|
19465
|
+
const patchedVersion = readString(patched.identifier);
|
|
19466
|
+
const repositoryName = readString(repository.full_name);
|
|
19467
|
+
return {
|
|
19468
|
+
ecosystem: readString(dependencyPackage.ecosystem),
|
|
19469
|
+
ghsaId: readString(advisory.ghsa_id),
|
|
19470
|
+
htmlUrl: readString(raw.html_url),
|
|
19471
|
+
manifestPath: readString(dependency.manifest_path),
|
|
19472
|
+
number: typeof raw.number === "number" ? raw.number : 0,
|
|
19473
|
+
packageName,
|
|
19474
|
+
relationship: readRelationship(dependency.relationship),
|
|
19475
|
+
scope: readScope(dependency.scope),
|
|
19476
|
+
severity: readSeverity(advisory.severity),
|
|
19477
|
+
summary: readString(advisory.summary),
|
|
19478
|
+
vulnerableVersionRange: readString(vulnerability.vulnerable_version_range),
|
|
19479
|
+
...patchedVersion.length > 0 && { patchedVersion },
|
|
19480
|
+
...repositoryName.length > 0 && { repository: repositoryName }
|
|
19481
|
+
};
|
|
19482
|
+
}
|
|
19483
|
+
function resolveTarget(runner, cwd, org) {
|
|
19484
|
+
if (org !== void 0 && org.length > 0) return org;
|
|
19485
|
+
const result = runner([
|
|
19486
|
+
"repo",
|
|
19487
|
+
"view",
|
|
19488
|
+
"--json",
|
|
19489
|
+
"nameWithOwner",
|
|
19490
|
+
"--jq",
|
|
19491
|
+
".nameWithOwner"
|
|
19492
|
+
], { cwd });
|
|
19493
|
+
return result.status === 0 ? result.stdout.trim() : "";
|
|
19494
|
+
}
|
|
19495
|
+
/**
|
|
19496
|
+
GitHub answers "the feature is switched off for this repo" with a 403 rather
|
|
19497
|
+
than an empty list, so treat that one message as a state, not an error.
|
|
19498
|
+
*/
|
|
19499
|
+
function isAlertsDisabled(stderr, stdout) {
|
|
19500
|
+
return `${stderr}\n${stdout}`.includes("Dependabot alerts are disabled");
|
|
19501
|
+
}
|
|
19502
|
+
function fetchDependabotAlerts(options) {
|
|
19503
|
+
const { cwd, org, runner = defaultGithubRunner, state = "open" } = options;
|
|
19504
|
+
if (!githubIsAvailable(runner, cwd)) return {
|
|
19505
|
+
alerts: [],
|
|
19506
|
+
availability: "no-gh",
|
|
19507
|
+
target: org ?? ""
|
|
19508
|
+
};
|
|
19509
|
+
const target = resolveTarget(runner, cwd, org);
|
|
19510
|
+
const result = runner([
|
|
19511
|
+
"api",
|
|
19512
|
+
"--paginate",
|
|
19513
|
+
`${org !== void 0 && org.length > 0 ? `orgs/${org}/dependabot/alerts` : "repos/{owner}/{repo}/dependabot/alerts"}?state=${state}&per_page=100`,
|
|
19514
|
+
"--jq",
|
|
19515
|
+
ALERT_PROJECTION
|
|
19516
|
+
], { cwd });
|
|
19517
|
+
if (result.status !== 0) {
|
|
19518
|
+
if (isAlertsDisabled(result.stderr, result.stdout)) return {
|
|
19519
|
+
alerts: [],
|
|
19520
|
+
availability: "disabled",
|
|
19521
|
+
target
|
|
19522
|
+
};
|
|
19523
|
+
const detail = result.stderr.trim() || result.stdout.trim() || `exit ${String(result.status)}`;
|
|
19524
|
+
throw new Error(`Failed to read Dependabot alerts for ${target.length > 0 ? target : cwd}: ${detail}`);
|
|
19525
|
+
}
|
|
19526
|
+
return {
|
|
19527
|
+
alerts: parseGithubPaginatedJson(result.stdout).map((entry) => parseDependabotAlert(entry)).filter((alert) => alert !== void 0),
|
|
19528
|
+
availability: "ok",
|
|
19529
|
+
target
|
|
19530
|
+
};
|
|
19531
|
+
}
|
|
19532
|
+
//#endregion
|
|
19533
|
+
//#region src/lib/secure/dependabot/interfaces.ts
|
|
19534
|
+
const DEPENDABOT_SEVERITIES = [
|
|
19535
|
+
"critical",
|
|
19536
|
+
"high",
|
|
19537
|
+
"medium",
|
|
19538
|
+
"low"
|
|
19539
|
+
];
|
|
19540
|
+
//#endregion
|
|
19541
|
+
//#region src/lib/secure/dependabot/renderDependabotAlerts.ts
|
|
19542
|
+
const SEVERITY_COLOR = {
|
|
19543
|
+
critical: chalk.hex("#b26cff"),
|
|
19544
|
+
high: chalk.red,
|
|
19545
|
+
low: chalk.gray,
|
|
19546
|
+
medium: chalk.yellow
|
|
19547
|
+
};
|
|
19548
|
+
function relationshipLabel(alert) {
|
|
19549
|
+
return `${alert.relationship === "unknown" ? "?" : alert.relationship.slice(0, 6)}/${alert.scope === "development" ? "dev" : alert.scope === "runtime" ? "run" : "?"}`;
|
|
19550
|
+
}
|
|
19551
|
+
function pad$3(raw, colored, width) {
|
|
19552
|
+
return colored + " ".repeat(Math.max(0, width - raw.length));
|
|
19553
|
+
}
|
|
19554
|
+
function columnsFor(showRepository) {
|
|
19555
|
+
return [
|
|
19556
|
+
{
|
|
19557
|
+
color: (alert, raw) => SEVERITY_COLOR[alert.severity](raw),
|
|
19558
|
+
header: "Severity",
|
|
19559
|
+
value: (alert) => alert.severity
|
|
19560
|
+
},
|
|
19561
|
+
...showRepository ? [{
|
|
19562
|
+
color: (_alert, raw) => chalk.gray(raw),
|
|
19563
|
+
header: "Repository",
|
|
19564
|
+
value: (alert) => alert.repository ?? "-"
|
|
19565
|
+
}] : [],
|
|
19566
|
+
{
|
|
19567
|
+
color: (_alert, raw) => chalk.white(raw),
|
|
19568
|
+
header: "Package",
|
|
19569
|
+
value: (alert) => alert.packageName
|
|
19570
|
+
},
|
|
19571
|
+
{
|
|
19572
|
+
color: (_alert, raw) => chalk.gray(raw),
|
|
19573
|
+
header: "Kind",
|
|
19574
|
+
value: (alert) => relationshipLabel(alert)
|
|
19575
|
+
},
|
|
19576
|
+
{
|
|
19577
|
+
color: (_alert, raw) => chalk.gray(raw),
|
|
19578
|
+
header: "Vulnerable",
|
|
19579
|
+
value: (alert) => alert.vulnerableVersionRange.length > 0 ? alert.vulnerableVersionRange : "-"
|
|
19580
|
+
},
|
|
19581
|
+
{
|
|
19582
|
+
color: (_alert, raw) => chalk.green(raw),
|
|
19583
|
+
header: "Patched",
|
|
19584
|
+
value: (alert) => alert.patchedVersion ?? "none"
|
|
19585
|
+
},
|
|
19586
|
+
{
|
|
19587
|
+
color: (_alert, raw) => chalk.gray(raw),
|
|
19588
|
+
header: "Advisory",
|
|
19589
|
+
value: (alert) => alert.ghsaId.length > 0 ? alert.ghsaId : "-"
|
|
19590
|
+
}
|
|
19591
|
+
];
|
|
19592
|
+
}
|
|
19593
|
+
function renderDependabotSummary(summary) {
|
|
19594
|
+
if (summary.availability === "no-gh") {
|
|
19595
|
+
console.log(chalk.gray("Dependabot: gh is unavailable or unauthenticated — skipped."));
|
|
19596
|
+
return;
|
|
19597
|
+
}
|
|
19598
|
+
if (summary.availability === "disabled") {
|
|
19599
|
+
console.log(chalk.gray(`Dependabot: alerts are disabled for ${summary.target || "this repository"}.`));
|
|
19600
|
+
return;
|
|
19601
|
+
}
|
|
19602
|
+
if (summary.total === 0) {
|
|
19603
|
+
console.log(chalk.green(`Dependabot: no open alerts for ${summary.target || "this repository"}.`));
|
|
19604
|
+
return;
|
|
19605
|
+
}
|
|
19606
|
+
const parts = summary.bySeverity.filter((entry) => entry.count > 0).map((entry) => SEVERITY_COLOR[entry.severity](`${entry.count} ${entry.severity}`));
|
|
19607
|
+
const scope = summary.repositories > 1 ? ` across ${summary.repositories} repos` : "";
|
|
19608
|
+
console.log(`Dependabot: ${chalk.bold(String(summary.total))} open alert${summary.total === 1 ? "" : "s"}${scope} — ${parts.join(", ")}`);
|
|
19609
|
+
}
|
|
19610
|
+
function renderDependabotAlerts(alerts, summary) {
|
|
19611
|
+
renderDependabotSummary(summary);
|
|
19612
|
+
if (alerts.length === 0) return;
|
|
19613
|
+
const columns = columnsFor(alerts.some((alert) => alert.repository !== void 0) && summary.repositories > 1);
|
|
19614
|
+
const widths = columns.map((column) => {
|
|
19615
|
+
let width = column.header.length;
|
|
19616
|
+
for (const alert of alerts) width = Math.max(width, column.value(alert).length);
|
|
19617
|
+
return Math.min(width, 44);
|
|
19618
|
+
});
|
|
19619
|
+
console.log(columns.map((column, index) => chalk.bold(column.header.padEnd(widths[index]))).join(" "));
|
|
19620
|
+
let separatorWidth = -2;
|
|
19621
|
+
for (const width of widths) separatorWidth += width + 2;
|
|
19622
|
+
console.log(chalk.gray("─".repeat(separatorWidth)));
|
|
19623
|
+
for (const alert of alerts) console.log(columns.map((column, index) => {
|
|
19624
|
+
const raw = column.value(alert).slice(0, widths[index]);
|
|
19625
|
+
return pad$3(raw, column.color(alert, raw), widths[index]);
|
|
19626
|
+
}).join(" "));
|
|
19627
|
+
}
|
|
19628
|
+
//#endregion
|
|
19629
|
+
//#region src/lib/secure/dependabot/summarizeDependabotAlerts.ts
|
|
19630
|
+
function filterDependabotAlerts(alerts, filter = {}) {
|
|
19631
|
+
const { relationship = "all", scope = "all" } = filter;
|
|
19632
|
+
return alerts.filter((alert) => {
|
|
19633
|
+
if (scope !== "all" && alert.scope !== scope) return false;
|
|
19634
|
+
if (relationship !== "all" && alert.relationship !== relationship) return false;
|
|
19635
|
+
return true;
|
|
19636
|
+
});
|
|
19637
|
+
}
|
|
19638
|
+
const SEVERITY_ORDER = new Map(DEPENDABOT_SEVERITIES.map((severity, index) => [severity, index]));
|
|
19639
|
+
function sortDependabotAlerts(alerts) {
|
|
19640
|
+
return [...alerts].toSorted((left, right) => {
|
|
19641
|
+
const severity = (SEVERITY_ORDER.get(left.severity) ?? 0) - (SEVERITY_ORDER.get(right.severity) ?? 0);
|
|
19642
|
+
if (severity !== 0) return severity;
|
|
19643
|
+
const repository = (left.repository ?? "").localeCompare(right.repository ?? "");
|
|
19644
|
+
if (repository !== 0) return repository;
|
|
19645
|
+
return left.packageName.localeCompare(right.packageName) || left.number - right.number;
|
|
19646
|
+
});
|
|
19647
|
+
}
|
|
19648
|
+
function summarizeDependabotAlerts(report) {
|
|
19649
|
+
const repositories = new Set(report.alerts.map((alert) => alert.repository).filter((name) => name !== void 0));
|
|
19650
|
+
return {
|
|
19651
|
+
availability: report.availability,
|
|
19652
|
+
bySeverity: DEPENDABOT_SEVERITIES.map((severity) => {
|
|
19653
|
+
const matching = report.alerts.filter((alert) => alert.severity === severity);
|
|
19654
|
+
return {
|
|
19655
|
+
count: matching.length,
|
|
19656
|
+
direct: matching.filter((alert) => alert.relationship === "direct").length,
|
|
19657
|
+
runtime: matching.filter((alert) => alert.scope === "runtime").length,
|
|
19658
|
+
severity
|
|
19659
|
+
};
|
|
19660
|
+
}),
|
|
19661
|
+
repositories: repositories.size,
|
|
19662
|
+
target: report.target,
|
|
19663
|
+
total: report.alerts.length
|
|
19664
|
+
};
|
|
19665
|
+
}
|
|
19666
|
+
//#endregion
|
|
19667
|
+
//#region src/lib/secure/dependabot/vulnerabilityAlerts.ts
|
|
19668
|
+
const VULNERABILITY_ALERTS_PATH = "repos/{owner}/{repo}/vulnerability-alerts";
|
|
19669
|
+
/**
|
|
19670
|
+
GitHub answers the disabled case with a 404 whose body says so. Match the
|
|
19671
|
+
message rather than the status, because a bare 404 also covers "no such repo"
|
|
19672
|
+
and "token cannot see it", which are not the same finding.
|
|
19673
|
+
*/
|
|
19674
|
+
function isExplicitlyDisabled(text) {
|
|
19675
|
+
return text.includes("Vulnerability alerts are disabled");
|
|
19676
|
+
}
|
|
19677
|
+
/**
|
|
19678
|
+
One `gh` subprocess, no body: 204 when alerts are on, 404 when off. Deliberately
|
|
19679
|
+
skips the three-call `githubIsAvailable` probe — `gh api` already fails cleanly
|
|
19680
|
+
when gh is absent or unauthenticated, and this runs inside `xy repo lint`.
|
|
19681
|
+
*/
|
|
19682
|
+
function dependabotAlertsStatus(cwd, runner = defaultGithubRunner) {
|
|
19683
|
+
const result = runner(["api", VULNERABILITY_ALERTS_PATH], { cwd });
|
|
19684
|
+
if (result.status === 0) return "enabled";
|
|
19685
|
+
return isExplicitlyDisabled(`${result.stderr}\n${result.stdout}`) ? "disabled" : "unknown";
|
|
19686
|
+
}
|
|
19687
|
+
/**
|
|
19688
|
+
Turn Dependabot alerts on. Requires admin on the repository; returns false
|
|
19689
|
+
rather than throwing when the token cannot make the change, so a fix pass
|
|
19690
|
+
reports the rule as still failing instead of claiming a fix it did not make.
|
|
19691
|
+
*/
|
|
19692
|
+
function enableDependabotAlerts(cwd, runner = defaultGithubRunner) {
|
|
19693
|
+
return runner([
|
|
19694
|
+
"api",
|
|
19695
|
+
"--method",
|
|
19696
|
+
"PUT",
|
|
19697
|
+
VULNERABILITY_ALERTS_PATH
|
|
19698
|
+
], { cwd }).status === 0;
|
|
19699
|
+
}
|
|
19700
|
+
//#endregion
|
|
19309
19701
|
//#region src/lib/secure/fetchPackageSecurityMetadata.ts
|
|
19310
19702
|
const REGISTRY_BASE$2 = "https://registry.npmjs.org";
|
|
19311
19703
|
const DOWNLOADS_BASE = "https://api.npmjs.org/downloads/point/last-week";
|
|
@@ -19476,6 +19868,24 @@ const columns = [
|
|
|
19476
19868
|
value: (row) => formatSecureDownloads(row.downloads)
|
|
19477
19869
|
}
|
|
19478
19870
|
];
|
|
19871
|
+
/**
|
|
19872
|
+
One-line overview for `xy secure`; the full table lives in `xy secure deps`.
|
|
19873
|
+
*/
|
|
19874
|
+
function renderSecureDepsSummary(rows) {
|
|
19875
|
+
if (rows.length === 0) {
|
|
19876
|
+
console.log(chalk.green("Deps: no external direct dependencies found."));
|
|
19877
|
+
return;
|
|
19878
|
+
}
|
|
19879
|
+
const red = rows.filter((row) => row.red).length;
|
|
19880
|
+
const oldPackages = rows.filter((row) => row.ageLevel === "red" || row.ageLevel === "yellow").length;
|
|
19881
|
+
const lowDownloads = rows.filter((row) => row.downloadsLevel === "red" || row.downloadsLevel === "yellow").length;
|
|
19882
|
+
const detail = [
|
|
19883
|
+
red > 0 ? chalk.red(`${red} red`) : chalk.green("0 red"),
|
|
19884
|
+
chalk.gray(`${oldPackages} aging`),
|
|
19885
|
+
chalk.gray(`${lowDownloads} low-download`)
|
|
19886
|
+
].join(", ");
|
|
19887
|
+
console.log(`Deps: ${chalk.bold(String(rows.length))} direct dependenc${rows.length === 1 ? "y" : "ies"} — ${detail}`);
|
|
19888
|
+
}
|
|
19479
19889
|
function renderSecurityAuditRows(rows) {
|
|
19480
19890
|
if (rows.length === 0) {
|
|
19481
19891
|
console.log(chalk.green("Secure: no external direct dependencies found."));
|
|
@@ -19730,10 +20140,12 @@ function collectExternalWorkspaceDeps(deps, depField, ws, workspaceNames, declar
|
|
|
19730
20140
|
for (const [name, range] of Object.entries(deps)) {
|
|
19731
20141
|
if (workspaceNames.has(name)) continue;
|
|
19732
20142
|
if (range.startsWith("workspace:")) continue;
|
|
20143
|
+
const alias = parseAliasSpec(range);
|
|
19733
20144
|
declaredDeps.push({
|
|
19734
20145
|
depType: depField,
|
|
19735
20146
|
name,
|
|
19736
|
-
range,
|
|
20147
|
+
range: alias?.range ?? range,
|
|
20148
|
+
registryName: alias?.registryName ?? name,
|
|
19737
20149
|
workspaceLocation: ws.location,
|
|
19738
20150
|
workspaceName: ws.name
|
|
19739
20151
|
});
|
|
@@ -20139,7 +20551,7 @@ function getStore() {
|
|
|
20139
20551
|
if (!store) throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
20140
20552
|
return store;
|
|
20141
20553
|
}
|
|
20142
|
-
function readline$
|
|
20554
|
+
function readline$2() {
|
|
20143
20555
|
return getStore().rl;
|
|
20144
20556
|
}
|
|
20145
20557
|
function withUpdates(fn) {
|
|
@@ -20181,7 +20593,7 @@ const effectScheduler = {
|
|
|
20181
20593
|
const { index } = store;
|
|
20182
20594
|
store.hooksEffect.push(() => {
|
|
20183
20595
|
store.hooksCleanup[index]?.();
|
|
20184
|
-
const cleanFn = cb(readline$
|
|
20596
|
+
const cleanFn = cb(readline$2());
|
|
20185
20597
|
if (cleanFn != null && typeof cleanFn !== "function") throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
20186
20598
|
store.hooksCleanup[index] = cleanFn;
|
|
20187
20599
|
});
|
|
@@ -20478,7 +20890,7 @@ const stringVisibleTrimSpacesRight$1 = (string) => {
|
|
|
20478
20890
|
if (last === words.length) return string;
|
|
20479
20891
|
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
20480
20892
|
};
|
|
20481
|
-
const exec$
|
|
20893
|
+
const exec$2 = (string, columns, options = {}) => {
|
|
20482
20894
|
if (options.trim !== false && string.trim() === "") return "";
|
|
20483
20895
|
let returnValue = "";
|
|
20484
20896
|
let escapeCode;
|
|
@@ -20563,7 +20975,7 @@ const exec$1 = (string, columns, options = {}) => {
|
|
|
20563
20975
|
};
|
|
20564
20976
|
const CRLF_OR_LF = /\r?\n/;
|
|
20565
20977
|
function wrapAnsi$1(string, columns, options) {
|
|
20566
|
-
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec$
|
|
20978
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec$2(line, columns, options)).join("\n");
|
|
20567
20979
|
}
|
|
20568
20980
|
//#endregion
|
|
20569
20981
|
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/utils.js
|
|
@@ -20588,7 +21000,7 @@ function breakLines(content, width) {
|
|
|
20588
21000
|
function readlineWidth() {
|
|
20589
21001
|
return (0, import_cli_width.default)({
|
|
20590
21002
|
defaultWidth: 80,
|
|
20591
|
-
output: readline$
|
|
21003
|
+
output: readline$2().output
|
|
20592
21004
|
});
|
|
20593
21005
|
}
|
|
20594
21006
|
//#endregion
|
|
@@ -21005,7 +21417,7 @@ function createPrompt(view) {
|
|
|
21005
21417
|
const cleanups = /* @__PURE__ */ new Set();
|
|
21006
21418
|
const output = new import_lib.default();
|
|
21007
21419
|
output.pipe(context.output ?? process.stdout);
|
|
21008
|
-
const rl = readline.createInterface({
|
|
21420
|
+
const rl = readline$1.createInterface({
|
|
21009
21421
|
terminal: true,
|
|
21010
21422
|
input,
|
|
21011
21423
|
output
|
|
@@ -21284,7 +21696,7 @@ const updoPrompt = createPrompt((config, done) => {
|
|
|
21284
21696
|
const version = getTargetVersion(dep, selectionsRef.current[i]);
|
|
21285
21697
|
if (version != null && version.length > 0) results.push({
|
|
21286
21698
|
name: dep.name,
|
|
21287
|
-
targetRange: version,
|
|
21699
|
+
targetRange: formatDeclaredRange(dep, version),
|
|
21288
21700
|
workspaces: dep.workspaces
|
|
21289
21701
|
});
|
|
21290
21702
|
}
|
|
@@ -21331,6 +21743,36 @@ async function interactiveSelect(deps, options = {}) {
|
|
|
21331
21743
|
}
|
|
21332
21744
|
}
|
|
21333
21745
|
//#endregion
|
|
21746
|
+
//#region src/lib/updo/majorCeiling.ts
|
|
21747
|
+
/**
|
|
21748
|
+
* Packages whose next major is not the same thing further along, but a
|
|
21749
|
+
* different distribution published under the same name. updo will not offer a
|
|
21750
|
+
* bump across the ceiling — not even under `--latest`, whose whole job is to
|
|
21751
|
+
* pick the highest available bump.
|
|
21752
|
+
*
|
|
21753
|
+
* A declaration already anchored above the ceiling is left alone: that is the
|
|
21754
|
+
* deliberate side-by-side install (`"typescript-native": "npm:typescript@7"`),
|
|
21755
|
+
* which should keep receiving updates like anything else.
|
|
21756
|
+
*/
|
|
21757
|
+
const MAJOR_CEILINGS = /* @__PURE__ */ new Map([["typescript", {
|
|
21758
|
+
maxMajor: 6,
|
|
21759
|
+
reason: [
|
|
21760
|
+
"typescript@7 is the native compiler and exports no compiler API —",
|
|
21761
|
+
"ESLint, deplint, dead-code and api-exposure all load it from `typescript`.",
|
|
21762
|
+
"Install it side by side instead: `\"typescript-native\": \"npm:typescript@7\"`",
|
|
21763
|
+
"with `compile.compiler: \"native\"`."
|
|
21764
|
+
].join(" ")
|
|
21765
|
+
}]]);
|
|
21766
|
+
/**
|
|
21767
|
+
* The ceiling in force for a declaration, or undefined when none applies —
|
|
21768
|
+
* including when the declaration is already above its ceiling.
|
|
21769
|
+
*/
|
|
21770
|
+
function majorCeilingFor(registryName, anchorMajor) {
|
|
21771
|
+
const ceiling = MAJOR_CEILINGS.get(registryName);
|
|
21772
|
+
if (ceiling === void 0) return void 0;
|
|
21773
|
+
return anchorMajor <= ceiling.maxMajor ? ceiling : void 0;
|
|
21774
|
+
}
|
|
21775
|
+
//#endregion
|
|
21334
21776
|
//#region src/lib/updo/resolveVersions.ts
|
|
21335
21777
|
function parseExclude(pattern) {
|
|
21336
21778
|
const sep = pattern.indexOf("@", 1);
|
|
@@ -21445,7 +21887,7 @@ function differentFromCurrent(value, current) {
|
|
|
21445
21887
|
if (value == null || value.length === 0) return void 0;
|
|
21446
21888
|
return value === current ? void 0 : value;
|
|
21447
21889
|
}
|
|
21448
|
-
function unresolvedDep(name, current, declaredRanges, preferredRangePrefix, workspaces) {
|
|
21890
|
+
function unresolvedDep(name, registryName, current, declaredRanges, preferredRangePrefix, workspaces) {
|
|
21449
21891
|
return {
|
|
21450
21892
|
current,
|
|
21451
21893
|
declaredRanges,
|
|
@@ -21456,10 +21898,23 @@ function unresolvedDep(name, current, declaredRanges, preferredRangePrefix, work
|
|
|
21456
21898
|
next: void 0,
|
|
21457
21899
|
patch: void 0,
|
|
21458
21900
|
preferredRangePrefix,
|
|
21901
|
+
registryName,
|
|
21459
21902
|
updateAvailable: false,
|
|
21460
21903
|
workspaces
|
|
21461
21904
|
};
|
|
21462
21905
|
}
|
|
21906
|
+
function majorOf(version) {
|
|
21907
|
+
return import_semver.default.parse(version)?.major;
|
|
21908
|
+
}
|
|
21909
|
+
function underCeiling(version, ceiling) {
|
|
21910
|
+
const major = majorOf(version);
|
|
21911
|
+
return major === void 0 || major <= ceiling.maxMajor;
|
|
21912
|
+
}
|
|
21913
|
+
function ceilingFilteredDistTags(distTags, ceiling) {
|
|
21914
|
+
const filtered = {};
|
|
21915
|
+
for (const [tag, version] of Object.entries(distTags)) if (underCeiling(version, ceiling)) filtered[tag] = version;
|
|
21916
|
+
return filtered;
|
|
21917
|
+
}
|
|
21463
21918
|
function normalizedMixedPatch(patch, declaredRanges, preferredRangePrefix, anchor) {
|
|
21464
21919
|
if (patch != null && patch.length > 0 || declaredRanges.length <= 1) return patch;
|
|
21465
21920
|
if (!declaredRanges.every((range) => {
|
|
@@ -21469,6 +21924,25 @@ function normalizedMixedPatch(patch, declaredRanges, preferredRangePrefix, ancho
|
|
|
21469
21924
|
const normalized = `${preferredRangePrefix}${anchor.version}`;
|
|
21470
21925
|
return declaredRanges.some((r) => r !== normalized) ? normalized : patch;
|
|
21471
21926
|
}
|
|
21927
|
+
/**
|
|
21928
|
+
* Removes candidate versions above the package's major ceiling, and reports
|
|
21929
|
+
* when doing so hid a major bump that would otherwise have been offered.
|
|
21930
|
+
*/
|
|
21931
|
+
function applyMajorCeiling(registryName, stable, distTags, anchor) {
|
|
21932
|
+
const ceiling = majorCeilingFor(registryName, anchor.major);
|
|
21933
|
+
if (ceiling === void 0) return {
|
|
21934
|
+
distTags,
|
|
21935
|
+
eligible: stable,
|
|
21936
|
+
withheldMajorReason: void 0
|
|
21937
|
+
};
|
|
21938
|
+
const eligible = stable.filter((v) => underCeiling(v, ceiling));
|
|
21939
|
+
const isMajorWithheld = pickBuckets(eligible, anchor).major === void 0 && pickBuckets(stable, anchor).major !== void 0;
|
|
21940
|
+
return {
|
|
21941
|
+
distTags: ceilingFilteredDistTags(distTags, ceiling),
|
|
21942
|
+
eligible,
|
|
21943
|
+
withheldMajorReason: isMajorWithheld ? ceiling.reason : void 0
|
|
21944
|
+
};
|
|
21945
|
+
}
|
|
21472
21946
|
function resolveOne(name, group, info, options, excludeRules) {
|
|
21473
21947
|
const nonPeer = group.filter((d) => d.depType !== "peerDependencies");
|
|
21474
21948
|
const sourceForRange = nonPeer.length > 0 ? nonPeer : group;
|
|
@@ -21477,15 +21951,16 @@ function resolveOne(name, group, info, options, excludeRules) {
|
|
|
21477
21951
|
const current = declaredRanges.length === 1 ? declaredRanges[0] : "mixed";
|
|
21478
21952
|
const preferredRangePrefix = pickPrefix(declaredRanges);
|
|
21479
21953
|
const anchor = lowestAnchor(declaredRanges);
|
|
21480
|
-
|
|
21481
|
-
|
|
21482
|
-
const
|
|
21483
|
-
const
|
|
21484
|
-
const
|
|
21954
|
+
const registryName = group[0].registryName;
|
|
21955
|
+
if (info === void 0 || anchor === void 0) return unresolvedDep(name, registryName, current, declaredRanges, preferredRangePrefix, workspaces);
|
|
21956
|
+
const effectiveInfo = options.minReleaseAge ? filterRegistryInfo(registryName, info, options.minReleaseAge, excludeRules) : info;
|
|
21957
|
+
const { distTags, eligible, withheldMajorReason } = applyMajorCeiling(registryName, effectiveInfo.versions.filter((v) => import_semver.default.valid(v) !== null && isStable(v)), effectiveInfo.distTags, anchor);
|
|
21958
|
+
const downgrade = options.minReleaseAge && !isDeclaredRangeSatisfiable(declaredRanges, eligible) ? format$1(preferredRangePrefix, pickDowngrade(eligible, anchor)) : void 0;
|
|
21959
|
+
const buckets = pickBuckets(eligible, anchor);
|
|
21485
21960
|
const patchRaw = format$1(preferredRangePrefix, buckets.patch);
|
|
21486
21961
|
const minorRaw = format$1(preferredRangePrefix, buckets.minor);
|
|
21487
21962
|
const majorRaw = format$1(preferredRangePrefix, buckets.major);
|
|
21488
|
-
const nextRaw = options.shouldIncludeNext ?? false ? format$1(preferredRangePrefix, pickPrerelease(
|
|
21963
|
+
const nextRaw = options.shouldIncludeNext ?? false ? format$1(preferredRangePrefix, pickPrerelease(distTags, anchor)) : void 0;
|
|
21489
21964
|
const patch = normalizedMixedPatch(differentFromCurrent(patchRaw, current), declaredRanges, preferredRangePrefix, anchor);
|
|
21490
21965
|
const minor = differentFromCurrent(minorRaw, current);
|
|
21491
21966
|
const major = differentFromCurrent(majorRaw, current);
|
|
@@ -21501,7 +21976,9 @@ function resolveOne(name, group, info, options, excludeRules) {
|
|
|
21501
21976
|
next,
|
|
21502
21977
|
patch,
|
|
21503
21978
|
preferredRangePrefix,
|
|
21979
|
+
registryName,
|
|
21504
21980
|
updateAvailable: availableVersion !== void 0 && availableVersion.length > 0,
|
|
21981
|
+
withheldMajorReason,
|
|
21505
21982
|
workspaces
|
|
21506
21983
|
};
|
|
21507
21984
|
}
|
|
@@ -21514,7 +21991,7 @@ function resolveVersions(deps, registry, options = {}) {
|
|
|
21514
21991
|
}
|
|
21515
21992
|
const excludeRules = options.minReleaseAge ? buildExcludeRules(options.minReleaseAge.exclude) : [];
|
|
21516
21993
|
const resolved = [];
|
|
21517
|
-
for (const [name, group] of grouped) resolved.push(resolveOne(name, group, registry.get(
|
|
21994
|
+
for (const [name, group] of grouped) resolved.push(resolveOne(name, group, registry.get(group[0].registryName), options, excludeRules));
|
|
21518
21995
|
return resolved.toSorted((a, b) => {
|
|
21519
21996
|
if (a.updateAvailable !== b.updateAvailable) return a.updateAvailable ? -1 : 1;
|
|
21520
21997
|
return a.name.localeCompare(b.name);
|
|
@@ -21565,7 +22042,7 @@ async function runUpdo(pm, options = {}) {
|
|
|
21565
22042
|
const uniqueDependencyNames = /* @__PURE__ */ new Set();
|
|
21566
22043
|
console.log(chalk.gray("Scanning workspace dependencies..."));
|
|
21567
22044
|
const declaredDeps = collectWorkspaceDeps(cwd, workspaces, workspaceNames);
|
|
21568
|
-
for (const dep of declaredDeps) uniqueDependencyNames.add(dep.
|
|
22045
|
+
for (const dep of declaredDeps) uniqueDependencyNames.add(dep.registryName);
|
|
21569
22046
|
console.log(chalk.gray(` Found ${uniqueDependencyNames.size} unique dependencies across ${workspaces.length} workspaces`));
|
|
21570
22047
|
const minReleaseAge = resolveMinReleaseAgeFilter(pm.name, cwd);
|
|
21571
22048
|
console.log(chalk.gray("Fetching registry info..."));
|
|
@@ -21583,6 +22060,10 @@ async function runUpdo(pm, options = {}) {
|
|
|
21583
22060
|
});
|
|
21584
22061
|
const downgradeCount = resolved.filter((r) => r.downgrade !== void 0).length;
|
|
21585
22062
|
if (downgradeCount > 0) console.log(chalk.yellow(` ${downgradeCount} package(s) have a current range that pnpm will reject — see the red "Down" column for downgrade suggestions.`));
|
|
22063
|
+
for (const dep of resolved) {
|
|
22064
|
+
if (dep.withheldMajorReason === void 0) continue;
|
|
22065
|
+
console.log(chalk.gray(` ${dep.name}: major bump withheld — ${dep.withheldMajorReason}`));
|
|
22066
|
+
}
|
|
21586
22067
|
const updates = await interactiveSelect(resolved, {
|
|
21587
22068
|
shouldIncludeNext: isIncludeNext,
|
|
21588
22069
|
latest: isLatest,
|
|
@@ -25468,11 +25949,22 @@ function shouldUseIncremental$3(incremental) {
|
|
|
25468
25949
|
return incremental !== false;
|
|
25469
25950
|
}
|
|
25470
25951
|
/**
|
|
25471
|
-
CLI flag wins, then root `compile.validator`, then per-package spawns.
|
|
25952
|
+
* CLI flag wins, then root `compile.validator`, then per-package spawns.
|
|
25953
|
+
*
|
|
25954
|
+
* The shared validator runs every package through one `ts.Program` host so
|
|
25955
|
+
* dependency declarations are parsed once. That cache only exists in the JS
|
|
25956
|
+
* compiler API, which `compile.compiler: 'native'` does not have — so the two
|
|
25957
|
+
* cannot be combined, and the native compiler's own parallelism is the
|
|
25958
|
+
* intended replacement for the shared cache.
|
|
25472
25959
|
*/
|
|
25473
25960
|
async function resolveCompileValidator(override) {
|
|
25474
|
-
|
|
25475
|
-
|
|
25961
|
+
const rootConfig = await loadConfig();
|
|
25962
|
+
const requested = override ?? rootConfig.compile?.validator ?? "per-package";
|
|
25963
|
+
if (requested === "shared" && rootConfig.compile?.compiler === "native") {
|
|
25964
|
+
console.warn(chalk.yellow("Compile: compile.validator \"shared\" is not available with compile.compiler \"native\" — validating per package."));
|
|
25965
|
+
return "per-package";
|
|
25966
|
+
}
|
|
25967
|
+
return requested;
|
|
25476
25968
|
}
|
|
25477
25969
|
function createCompilePlan({ incrementalPlan, pm, shouldUseIncremental, isVerbose, workspaces }) {
|
|
25478
25970
|
if (!shouldUseIncremental) return void 0;
|
|
@@ -28321,9 +28813,36 @@ const rules = [
|
|
|
28321
28813
|
isNeeded: hasTypescriptFiles
|
|
28322
28814
|
}
|
|
28323
28815
|
];
|
|
28816
|
+
/**
|
|
28817
|
+
* Packages the toolchain runs as a binary rather than imports, and which are
|
|
28818
|
+
* therefore installed under an `npm:` alias. Today that is the native
|
|
28819
|
+
* TypeScript compiler: `typescript@7` shares the `typescript` package name and
|
|
28820
|
+
* `tsc` bin with the compiler API package, so it can only be installed
|
|
28821
|
+
* alongside as `"typescript-native": "npm:typescript@7"`.
|
|
28822
|
+
*
|
|
28823
|
+
* Static analysis can never justify such a declaration — nothing imports the
|
|
28824
|
+
* alias key, and nothing could, since TypeScript@7 exports no API. `xy compile`
|
|
28825
|
+
* resolves it by path when `compile.compiler` is `native`.
|
|
28826
|
+
*/
|
|
28827
|
+
const spawnedAliasTargets = /* @__PURE__ */ new Set(["typescript"]);
|
|
28828
|
+
function getSpawnedAliasDependencies({ location }) {
|
|
28829
|
+
const implicit = /* @__PURE__ */ new Set();
|
|
28830
|
+
let devDependencies;
|
|
28831
|
+
try {
|
|
28832
|
+
devDependencies = JSON.parse(fs.readFileSync(`${location}/package.json`, "utf8")).devDependencies ?? {};
|
|
28833
|
+
} catch {
|
|
28834
|
+
return implicit;
|
|
28835
|
+
}
|
|
28836
|
+
for (const [name, spec] of Object.entries(devDependencies)) {
|
|
28837
|
+
const alias = parseAliasSpec(spec);
|
|
28838
|
+
if (alias !== void 0 && spawnedAliasTargets.has(alias.registryName)) implicit.add(name);
|
|
28839
|
+
}
|
|
28840
|
+
return implicit;
|
|
28841
|
+
}
|
|
28324
28842
|
function getImplicitDevDependencies(context) {
|
|
28325
28843
|
const implicit = /* @__PURE__ */ new Set();
|
|
28326
28844
|
for (const rule of rules) if (rule.isNeeded(context)) implicit.add(rule.package);
|
|
28845
|
+
for (const name of getSpawnedAliasDependencies(context)) implicit.add(name);
|
|
28327
28846
|
return implicit;
|
|
28328
28847
|
}
|
|
28329
28848
|
//#endregion
|
|
@@ -33901,45 +34420,45 @@ function cloneResolvedPublintRules(rules) {
|
|
|
33901
34420
|
};
|
|
33902
34421
|
}
|
|
33903
34422
|
//#endregion
|
|
33904
|
-
//#region ../../node_modules/.pnpm/tinyexec@1.
|
|
33905
|
-
function
|
|
33906
|
-
for (const
|
|
33907
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
33908
|
-
const
|
|
33909
|
-
if (!
|
|
34423
|
+
//#region ../../node_modules/.pnpm/tinyexec@1.3.0/node_modules/tinyexec/dist/main.mjs
|
|
34424
|
+
function getPathFromEnv(env) {
|
|
34425
|
+
for (const key in env) {
|
|
34426
|
+
if (!Object.prototype.hasOwnProperty.call(env, key) || !isPathLikePattern.test(key)) continue;
|
|
34427
|
+
const value = env[key];
|
|
34428
|
+
if (!value) return defaultEnvPathInfo;
|
|
33910
34429
|
return {
|
|
33911
|
-
key
|
|
33912
|
-
value
|
|
34430
|
+
key,
|
|
34431
|
+
value
|
|
33913
34432
|
};
|
|
33914
34433
|
}
|
|
33915
|
-
return
|
|
34434
|
+
return defaultEnvPathInfo;
|
|
33916
34435
|
}
|
|
33917
|
-
function
|
|
33918
|
-
const
|
|
33919
|
-
const
|
|
33920
|
-
let
|
|
33921
|
-
let
|
|
34436
|
+
function addNodeBinToPath(cwd, path) {
|
|
34437
|
+
const parts = path.value.split(delimiter);
|
|
34438
|
+
const nodeBinPaths = [];
|
|
34439
|
+
let currentPath = cwd;
|
|
34440
|
+
let lastPath;
|
|
33922
34441
|
do {
|
|
33923
|
-
|
|
33924
|
-
|
|
33925
|
-
|
|
33926
|
-
} while (
|
|
33927
|
-
|
|
33928
|
-
const
|
|
34442
|
+
nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
|
|
34443
|
+
lastPath = currentPath;
|
|
34444
|
+
currentPath = dirname(currentPath);
|
|
34445
|
+
} while (currentPath !== lastPath);
|
|
34446
|
+
nodeBinPaths.push(dirname(process.execPath));
|
|
34447
|
+
const newPath = nodeBinPaths.concat(parts).join(delimiter);
|
|
33929
34448
|
return {
|
|
33930
|
-
key:
|
|
33931
|
-
value:
|
|
34449
|
+
key: path.key,
|
|
34450
|
+
value: newPath
|
|
33932
34451
|
};
|
|
33933
34452
|
}
|
|
33934
|
-
function
|
|
33935
|
-
const
|
|
34453
|
+
function computeEnv(cwd, env, nodePath = true) {
|
|
34454
|
+
const envWithDefault = {
|
|
33936
34455
|
...process.env,
|
|
33937
|
-
...
|
|
34456
|
+
...env
|
|
33938
34457
|
};
|
|
33939
|
-
if (!
|
|
33940
|
-
const
|
|
33941
|
-
|
|
33942
|
-
return
|
|
34458
|
+
if (!nodePath) return envWithDefault;
|
|
34459
|
+
const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
|
|
34460
|
+
envWithDefault[envPathInfo.key] = envPathInfo.value;
|
|
34461
|
+
return envWithDefault;
|
|
33943
34462
|
}
|
|
33944
34463
|
/**
|
|
33945
34464
|
* Normalizes the command and arguments to work cross-platform.
|
|
@@ -33947,157 +34466,168 @@ function y(e, t, n = true) {
|
|
|
33947
34466
|
* `node_modules/.bin` commands, and escaping meta characters.
|
|
33948
34467
|
* On other platforms, it just returns the command and arguments as-is.
|
|
33949
34468
|
*/
|
|
33950
|
-
function
|
|
33951
|
-
if (
|
|
33952
|
-
command
|
|
33953
|
-
args
|
|
33954
|
-
options
|
|
33955
|
-
};
|
|
33956
|
-
let
|
|
33957
|
-
let
|
|
33958
|
-
if (
|
|
33959
|
-
const
|
|
33960
|
-
const
|
|
33961
|
-
let
|
|
34469
|
+
function normalizeSpawnCommand(command, args = [], options = {}) {
|
|
34470
|
+
if (options.shell === true || !isWindows) return {
|
|
34471
|
+
command,
|
|
34472
|
+
args,
|
|
34473
|
+
options
|
|
34474
|
+
};
|
|
34475
|
+
let file = resolveCommand(command, options);
|
|
34476
|
+
let shebang = null;
|
|
34477
|
+
if (file !== null) {
|
|
34478
|
+
const size = 150;
|
|
34479
|
+
const buffer = Buffer.alloc(size);
|
|
34480
|
+
let fd = null;
|
|
33962
34481
|
try {
|
|
33963
|
-
|
|
33964
|
-
readSync(
|
|
34482
|
+
fd = openSync(file, "r");
|
|
34483
|
+
readSync(fd, buffer, 0, size, 0);
|
|
33965
34484
|
} catch {} finally {
|
|
33966
|
-
if (
|
|
33967
|
-
}
|
|
33968
|
-
const
|
|
33969
|
-
if (
|
|
33970
|
-
const
|
|
33971
|
-
const
|
|
33972
|
-
const
|
|
33973
|
-
const
|
|
33974
|
-
const
|
|
33975
|
-
|
|
33976
|
-
}
|
|
33977
|
-
}
|
|
33978
|
-
if (
|
|
33979
|
-
|
|
33980
|
-
|
|
33981
|
-
|
|
33982
|
-
}
|
|
33983
|
-
if (
|
|
33984
|
-
const
|
|
33985
|
-
|
|
33986
|
-
|
|
33987
|
-
|
|
33988
|
-
|
|
33989
|
-
|
|
33990
|
-
|
|
33991
|
-
|
|
33992
|
-
if (
|
|
33993
|
-
return
|
|
34485
|
+
if (fd !== null) closeSync(fd);
|
|
34486
|
+
}
|
|
34487
|
+
const match = buffer.toString().match(shebangRegExp);
|
|
34488
|
+
if (match !== null) {
|
|
34489
|
+
const line = match[1].trim();
|
|
34490
|
+
const separatorIndex = line.indexOf(" ");
|
|
34491
|
+
const path = separatorIndex !== -1 ? line.slice(0, separatorIndex) : line;
|
|
34492
|
+
const argument = separatorIndex !== -1 ? line.slice(separatorIndex + 1) : "";
|
|
34493
|
+
const binary = basename(path);
|
|
34494
|
+
shebang = binary === "env" ? argument || null : binary;
|
|
34495
|
+
}
|
|
34496
|
+
}
|
|
34497
|
+
if (shebang !== null && file !== null) {
|
|
34498
|
+
args = [file, ...args];
|
|
34499
|
+
command = shebang;
|
|
34500
|
+
file = resolveCommand(command, options);
|
|
34501
|
+
}
|
|
34502
|
+
if (file === null || !isWindowsExecutableRegExp.test(file)) {
|
|
34503
|
+
const needsDoubleEscapeMetaChars = file !== null && isNodeModulesCmdRegExp.test(file);
|
|
34504
|
+
command = normalize(command);
|
|
34505
|
+
command = command.replace(metaCharsRegExp, "^$1");
|
|
34506
|
+
args = args.map((arg) => {
|
|
34507
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
34508
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
34509
|
+
arg = `"${arg}"`;
|
|
34510
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
34511
|
+
if (needsDoubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
34512
|
+
return arg;
|
|
33994
34513
|
});
|
|
33995
|
-
|
|
34514
|
+
args = [
|
|
33996
34515
|
"/d",
|
|
33997
34516
|
"/s",
|
|
33998
34517
|
"/c",
|
|
33999
|
-
`"${[
|
|
34518
|
+
`"${[command, ...args].join(" ")}"`
|
|
34000
34519
|
];
|
|
34001
|
-
|
|
34002
|
-
|
|
34003
|
-
...
|
|
34520
|
+
command = options.env?.comspec ?? "cmd.exe";
|
|
34521
|
+
options = {
|
|
34522
|
+
...options,
|
|
34004
34523
|
windowsVerbatimArguments: true
|
|
34005
34524
|
};
|
|
34006
34525
|
}
|
|
34007
34526
|
return {
|
|
34008
|
-
command
|
|
34009
|
-
args
|
|
34010
|
-
options
|
|
34527
|
+
command,
|
|
34528
|
+
args,
|
|
34529
|
+
options
|
|
34011
34530
|
};
|
|
34012
34531
|
}
|
|
34013
34532
|
/**
|
|
34014
34533
|
* Resolves the command to an absolute path if possible.
|
|
34015
34534
|
* Handles things like traversing PATH and adding extensions from PATHEXT
|
|
34016
34535
|
*/
|
|
34017
|
-
function
|
|
34018
|
-
const
|
|
34019
|
-
const
|
|
34020
|
-
const
|
|
34021
|
-
const
|
|
34022
|
-
|
|
34023
|
-
if (
|
|
34024
|
-
for (const
|
|
34025
|
-
const
|
|
34026
|
-
for (const
|
|
34027
|
-
const
|
|
34536
|
+
function resolveCommand(command, options) {
|
|
34537
|
+
const cwd$3 = (options.cwd ?? cwd()).toString();
|
|
34538
|
+
const env = options.env ?? process.env;
|
|
34539
|
+
const PATH = getPathFromEnv(env).value;
|
|
34540
|
+
const pathEnv = command.includes("/") || command.includes("\\") ? [""] : [cwd$3, ...PATH.split(delimiter)];
|
|
34541
|
+
let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
|
|
34542
|
+
if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
|
|
34543
|
+
for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
|
|
34544
|
+
const dest = resolve(cwd$3, path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path, command);
|
|
34545
|
+
for (const ext of extensions) {
|
|
34546
|
+
const destWithExt = dest + ext;
|
|
34028
34547
|
try {
|
|
34029
|
-
if (statSync(
|
|
34548
|
+
if (statSync(destWithExt).isFile()) return destWithExt;
|
|
34030
34549
|
} catch {}
|
|
34031
34550
|
}
|
|
34032
34551
|
}
|
|
34033
34552
|
return null;
|
|
34034
34553
|
}
|
|
34035
|
-
function
|
|
34036
|
-
const
|
|
34037
|
-
for (const
|
|
34038
|
-
if (
|
|
34039
|
-
|
|
34040
|
-
return
|
|
34554
|
+
function combineSignals(signals) {
|
|
34555
|
+
const controller = new AbortController();
|
|
34556
|
+
for (const signal of signals) {
|
|
34557
|
+
if (signal.aborted) {
|
|
34558
|
+
controller.abort();
|
|
34559
|
+
return signal;
|
|
34041
34560
|
}
|
|
34042
|
-
const
|
|
34043
|
-
|
|
34561
|
+
const onAbort = () => {
|
|
34562
|
+
controller.abort(signal.reason);
|
|
34044
34563
|
};
|
|
34045
|
-
|
|
34564
|
+
signal.addEventListener("abort", onAbort, { signal: controller.signal });
|
|
34046
34565
|
}
|
|
34047
|
-
return
|
|
34566
|
+
return controller.signal;
|
|
34048
34567
|
}
|
|
34049
|
-
async function
|
|
34050
|
-
let
|
|
34568
|
+
async function readStream(stream) {
|
|
34569
|
+
let output = "";
|
|
34051
34570
|
try {
|
|
34052
|
-
for await (const
|
|
34571
|
+
for await (const chunk of stream) output += chunk.toString();
|
|
34053
34572
|
} catch {}
|
|
34054
|
-
return
|
|
34573
|
+
return output;
|
|
34055
34574
|
}
|
|
34056
|
-
var
|
|
34575
|
+
var isPathLikePattern, defaultEnvPathInfo, combineStreams, metaCharsRegExp, shebangRegExp, isWindowsExecutableRegExp, isNodeModulesCmdRegExp, isWindows, defaultPathExt, noPathExt, NonZeroExitError, defaultOptions, defaultNodeOptions, ExecProcess, x, exec$1;
|
|
34057
34576
|
var init_main = __esmMin((() => {
|
|
34058
|
-
|
|
34059
|
-
|
|
34577
|
+
isPathLikePattern = /^path$/i;
|
|
34578
|
+
defaultEnvPathInfo = {
|
|
34060
34579
|
key: "PATH",
|
|
34061
34580
|
value: ""
|
|
34062
34581
|
};
|
|
34063
|
-
|
|
34064
|
-
let
|
|
34065
|
-
const
|
|
34066
|
-
const
|
|
34067
|
-
if (--
|
|
34582
|
+
combineStreams = (streams) => {
|
|
34583
|
+
let streamCount = streams.length;
|
|
34584
|
+
const combined = new PassThrough();
|
|
34585
|
+
const maybeEmitEnd = () => {
|
|
34586
|
+
if (--streamCount === 0) combined.end();
|
|
34068
34587
|
};
|
|
34069
|
-
for (const
|
|
34070
|
-
return
|
|
34071
|
-
};
|
|
34072
|
-
|
|
34073
|
-
|
|
34074
|
-
|
|
34075
|
-
|
|
34076
|
-
|
|
34077
|
-
|
|
34588
|
+
for (const stream of streams) pipeline(stream, combined, { end: false }).then(maybeEmitEnd).catch(maybeEmitEnd);
|
|
34589
|
+
return combined;
|
|
34590
|
+
};
|
|
34591
|
+
metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
34592
|
+
shebangRegExp = /^#!\s*(.+)/;
|
|
34593
|
+
isWindowsExecutableRegExp = /\.(?:com|exe)$/i;
|
|
34594
|
+
isNodeModulesCmdRegExp = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
|
|
34595
|
+
isWindows = process.platform === "win32";
|
|
34596
|
+
defaultPathExt = [
|
|
34078
34597
|
".EXE",
|
|
34079
34598
|
".CMD",
|
|
34080
34599
|
".BAT",
|
|
34081
34600
|
".COM"
|
|
34082
34601
|
];
|
|
34083
|
-
|
|
34602
|
+
noPathExt = [""];
|
|
34603
|
+
NonZeroExitError = class extends Error {
|
|
34084
34604
|
result;
|
|
34085
34605
|
output;
|
|
34086
|
-
|
|
34087
|
-
|
|
34088
|
-
|
|
34089
|
-
|
|
34090
|
-
|
|
34091
|
-
|
|
34092
|
-
|
|
34606
|
+
exitCode;
|
|
34607
|
+
get signalCode() {
|
|
34608
|
+
return this.result.signalCode;
|
|
34609
|
+
}
|
|
34610
|
+
constructor(result, output, command, args) {
|
|
34611
|
+
let target = "The process";
|
|
34612
|
+
if (command) target = `The command \`${args?.length ? `${command} ${args.map((a) => /[ "'`()]/.test(a) ? JSON.stringify(a) : a).join(" ")}` : command}\``;
|
|
34613
|
+
const exitCode = result.exitCode ?? 1;
|
|
34614
|
+
super(result.signalCode !== null ? `${target} was killed by the signal ${result.signalCode}` : `${target} exited with a non-zero status (${exitCode})`);
|
|
34615
|
+
this.result = result;
|
|
34616
|
+
this.output = output;
|
|
34617
|
+
this.exitCode = exitCode;
|
|
34618
|
+
Object.defineProperty(this, "result", {
|
|
34619
|
+
enumerable: false,
|
|
34620
|
+
writable: false,
|
|
34621
|
+
configurable: false
|
|
34622
|
+
});
|
|
34093
34623
|
}
|
|
34094
34624
|
};
|
|
34095
|
-
|
|
34625
|
+
defaultOptions = {
|
|
34096
34626
|
timeout: void 0,
|
|
34097
34627
|
persist: false
|
|
34098
34628
|
};
|
|
34099
|
-
|
|
34100
|
-
|
|
34629
|
+
defaultNodeOptions = { windowsHide: true };
|
|
34630
|
+
ExecProcess = class {
|
|
34101
34631
|
_process;
|
|
34102
34632
|
_aborted = false;
|
|
34103
34633
|
_options;
|
|
@@ -34115,19 +34645,22 @@ var init_main = __esmMin((() => {
|
|
|
34115
34645
|
get exitCode() {
|
|
34116
34646
|
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
34117
34647
|
}
|
|
34118
|
-
|
|
34648
|
+
get signalCode() {
|
|
34649
|
+
return this._process?.signalCode ?? null;
|
|
34650
|
+
}
|
|
34651
|
+
constructor(command, args, options) {
|
|
34119
34652
|
this._options = {
|
|
34120
|
-
...
|
|
34121
|
-
...
|
|
34653
|
+
...defaultOptions,
|
|
34654
|
+
...options
|
|
34122
34655
|
};
|
|
34123
|
-
this._command =
|
|
34124
|
-
this._args =
|
|
34125
|
-
this._processClosed = new Promise((
|
|
34126
|
-
this._resolveClose =
|
|
34656
|
+
this._command = command;
|
|
34657
|
+
this._args = args ?? [];
|
|
34658
|
+
this._processClosed = new Promise((resolve) => {
|
|
34659
|
+
this._resolveClose = resolve;
|
|
34127
34660
|
});
|
|
34128
34661
|
}
|
|
34129
|
-
kill(
|
|
34130
|
-
return this._process?.kill(
|
|
34662
|
+
kill(signal) {
|
|
34663
|
+
return this._process?.kill(signal) === true;
|
|
34131
34664
|
}
|
|
34132
34665
|
get aborted() {
|
|
34133
34666
|
return this._aborted;
|
|
@@ -34135,99 +34668,99 @@ var init_main = __esmMin((() => {
|
|
|
34135
34668
|
get killed() {
|
|
34136
34669
|
return this._process?.killed === true;
|
|
34137
34670
|
}
|
|
34138
|
-
pipe(
|
|
34139
|
-
return
|
|
34140
|
-
...
|
|
34671
|
+
pipe(command, args, options) {
|
|
34672
|
+
return exec$1(command, args, {
|
|
34673
|
+
...options,
|
|
34141
34674
|
stdin: this
|
|
34142
34675
|
});
|
|
34143
34676
|
}
|
|
34144
34677
|
async *[Symbol.asyncIterator]() {
|
|
34145
|
-
const
|
|
34146
|
-
if (!
|
|
34147
|
-
const
|
|
34148
|
-
if (this._streamErr)
|
|
34149
|
-
if (this._streamOut)
|
|
34150
|
-
const
|
|
34151
|
-
const
|
|
34152
|
-
for await (const
|
|
34678
|
+
const proc = this._process;
|
|
34679
|
+
if (!proc) return;
|
|
34680
|
+
const streams = [];
|
|
34681
|
+
if (this._streamErr) streams.push(this._streamErr);
|
|
34682
|
+
if (this._streamOut) streams.push(this._streamOut);
|
|
34683
|
+
const streamCombined = combineStreams(streams);
|
|
34684
|
+
const rl = readline.createInterface({ input: streamCombined });
|
|
34685
|
+
for await (const chunk of rl) yield chunk.toString();
|
|
34153
34686
|
await this._processClosed;
|
|
34154
|
-
|
|
34687
|
+
proc.removeAllListeners();
|
|
34155
34688
|
if (this._thrownError) throw this._thrownError;
|
|
34156
|
-
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
34689
|
+
if (this._options?.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, void 0, this._command, this._args);
|
|
34157
34690
|
}
|
|
34158
34691
|
async _waitForOutput() {
|
|
34159
|
-
const
|
|
34160
|
-
if (!
|
|
34161
|
-
const [
|
|
34692
|
+
const proc = this._process;
|
|
34693
|
+
if (!proc) throw new Error("No process was started");
|
|
34694
|
+
const [stdout, stderr] = await Promise.all([this._streamOut ? readStream(this._streamOut) : "", this._streamErr ? readStream(this._streamErr) : ""]);
|
|
34162
34695
|
await this._processClosed;
|
|
34163
|
-
const { stdin
|
|
34164
|
-
if (
|
|
34165
|
-
|
|
34696
|
+
const { stdin } = this._options;
|
|
34697
|
+
if (stdin && typeof stdin !== "string") await stdin;
|
|
34698
|
+
proc.removeAllListeners();
|
|
34166
34699
|
if (this._thrownError) throw this._thrownError;
|
|
34167
|
-
const
|
|
34168
|
-
stderr
|
|
34169
|
-
stdout
|
|
34700
|
+
const result = {
|
|
34701
|
+
stderr,
|
|
34702
|
+
stdout,
|
|
34170
34703
|
exitCode: this.exitCode
|
|
34171
34704
|
};
|
|
34172
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
34173
|
-
return
|
|
34705
|
+
if (this._options.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, result, this._command, this._args);
|
|
34706
|
+
return result;
|
|
34174
34707
|
}
|
|
34175
|
-
then(
|
|
34176
|
-
return this._waitForOutput().then(
|
|
34708
|
+
then(onfulfilled, onrejected) {
|
|
34709
|
+
return this._waitForOutput().then(onfulfilled, onrejected);
|
|
34177
34710
|
}
|
|
34178
34711
|
_streamOut;
|
|
34179
34712
|
_streamErr;
|
|
34180
34713
|
spawn() {
|
|
34181
|
-
const
|
|
34182
|
-
const
|
|
34183
|
-
const
|
|
34184
|
-
...
|
|
34185
|
-
...
|
|
34714
|
+
const cwd$1 = cwd();
|
|
34715
|
+
const options = this._options;
|
|
34716
|
+
const nodeOptions = {
|
|
34717
|
+
...defaultNodeOptions,
|
|
34718
|
+
...options.nodeOptions
|
|
34186
34719
|
};
|
|
34187
|
-
const
|
|
34720
|
+
const signals = [];
|
|
34188
34721
|
this._resetState();
|
|
34189
|
-
if (
|
|
34190
|
-
if (
|
|
34191
|
-
if (
|
|
34192
|
-
if (
|
|
34193
|
-
|
|
34194
|
-
const
|
|
34195
|
-
const
|
|
34196
|
-
if (
|
|
34197
|
-
if (
|
|
34198
|
-
this._process =
|
|
34199
|
-
|
|
34200
|
-
|
|
34201
|
-
if (
|
|
34202
|
-
const { stdin
|
|
34203
|
-
if (typeof
|
|
34204
|
-
else
|
|
34722
|
+
if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
|
|
34723
|
+
if (options.signal !== void 0) signals.push(options.signal);
|
|
34724
|
+
if (options.persist === true) nodeOptions.detached = true;
|
|
34725
|
+
if (signals.length > 0) nodeOptions.signal = combineSignals(signals);
|
|
34726
|
+
nodeOptions.env = computeEnv(cwd$1, nodeOptions.env, options.nodePath);
|
|
34727
|
+
const crossResult = normalizeSpawnCommand(this._command, this._args, nodeOptions);
|
|
34728
|
+
const handle = spawn(crossResult.command, crossResult.args, crossResult.options);
|
|
34729
|
+
if (handle.stderr) this._streamErr = handle.stderr;
|
|
34730
|
+
if (handle.stdout) this._streamOut = handle.stdout;
|
|
34731
|
+
this._process = handle;
|
|
34732
|
+
handle.once("error", this._onError);
|
|
34733
|
+
handle.once("close", this._onClose);
|
|
34734
|
+
if (handle.stdin) {
|
|
34735
|
+
const { stdin } = options;
|
|
34736
|
+
if (typeof stdin === "string") handle.stdin.end(stdin);
|
|
34737
|
+
else stdin?.process?.stdout?.pipe(handle.stdin);
|
|
34205
34738
|
}
|
|
34206
34739
|
}
|
|
34207
34740
|
_resetState() {
|
|
34208
34741
|
this._aborted = false;
|
|
34209
|
-
this._processClosed = new Promise((
|
|
34210
|
-
this._resolveClose =
|
|
34742
|
+
this._processClosed = new Promise((resolve) => {
|
|
34743
|
+
this._resolveClose = resolve;
|
|
34211
34744
|
});
|
|
34212
34745
|
this._thrownError = void 0;
|
|
34213
34746
|
}
|
|
34214
|
-
_onError = (
|
|
34215
|
-
if (
|
|
34747
|
+
_onError = (err) => {
|
|
34748
|
+
if (err.name === "AbortError" && (!(err.cause instanceof Error) || err.cause.name !== "TimeoutError")) {
|
|
34216
34749
|
this._aborted = true;
|
|
34217
34750
|
return;
|
|
34218
34751
|
}
|
|
34219
|
-
this._thrownError =
|
|
34752
|
+
this._thrownError = err;
|
|
34220
34753
|
};
|
|
34221
34754
|
_onClose = () => {
|
|
34222
34755
|
if (this._resolveClose) this._resolveClose();
|
|
34223
34756
|
};
|
|
34224
34757
|
};
|
|
34225
|
-
|
|
34226
|
-
const
|
|
34227
|
-
|
|
34228
|
-
return
|
|
34758
|
+
x = (command, args, userOptions) => {
|
|
34759
|
+
const proc = new ExecProcess(command, args, userOptions);
|
|
34760
|
+
proc.spawn();
|
|
34761
|
+
return proc;
|
|
34229
34762
|
};
|
|
34230
|
-
|
|
34763
|
+
exec$1 = x;
|
|
34231
34764
|
}));
|
|
34232
34765
|
//#endregion
|
|
34233
34766
|
//#region ../../node_modules/.pnpm/@publint+pack@0.1.6/node_modules/@publint/pack/src/node/utils.js
|
|
@@ -34276,7 +34809,7 @@ async function pack(dir, opts) {
|
|
|
34276
34809
|
case "yarn": break;
|
|
34277
34810
|
default: command.push("--ignore-scripts");
|
|
34278
34811
|
}
|
|
34279
|
-
const output = await
|
|
34812
|
+
const output = await exec$1(command[0], command.slice(1), { nodeOptions: { cwd: dir } });
|
|
34280
34813
|
const tarballFile = await fs$1.readdir(packDestination).then((files) => {
|
|
34281
34814
|
return files.find((file) => file.endsWith(".tgz") && output.stdout.includes(file));
|
|
34282
34815
|
});
|
|
@@ -34313,7 +34846,7 @@ async function packAsJson(dir, opts) {
|
|
|
34313
34846
|
case "yarn": break;
|
|
34314
34847
|
default: command.push("--ignore-scripts");
|
|
34315
34848
|
}
|
|
34316
|
-
let { stdout } = await
|
|
34849
|
+
let { stdout } = await exec$1(command[0], command.slice(1), { nodeOptions: { cwd: dir } });
|
|
34317
34850
|
try {
|
|
34318
34851
|
stdout = stdout.trim();
|
|
34319
34852
|
if (packageManager === "pnpm") stdout = fixPnpmStdout(stdout);
|
|
@@ -35978,7 +36511,7 @@ function createTarballVfs(files) {
|
|
|
35978
36511
|
}
|
|
35979
36512
|
var init_vfs_tarball = __esmMin((() => {}));
|
|
35980
36513
|
//#endregion
|
|
35981
|
-
//#region ../../node_modules/.pnpm/package-manager-detector@1.
|
|
36514
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@1.8.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
35982
36515
|
var AGENTS, LOCKS, INSTALL_METADATA;
|
|
35983
36516
|
var init_constants = __esmMin((() => {
|
|
35984
36517
|
AGENTS = [
|
|
@@ -35987,6 +36520,7 @@ var init_constants = __esmMin((() => {
|
|
|
35987
36520
|
"yarn@berry",
|
|
35988
36521
|
"pnpm",
|
|
35989
36522
|
"pnpm@6",
|
|
36523
|
+
"pnpm-rush",
|
|
35990
36524
|
"bun",
|
|
35991
36525
|
"deno",
|
|
35992
36526
|
"nub",
|
|
@@ -35998,6 +36532,7 @@ var init_constants = __esmMin((() => {
|
|
|
35998
36532
|
"bun.lock": "bun",
|
|
35999
36533
|
"bun.lockb": "bun",
|
|
36000
36534
|
"deno.lock": "deno",
|
|
36535
|
+
"nub.lock": "nub",
|
|
36001
36536
|
"pnpm-lock.yaml": "pnpm",
|
|
36002
36537
|
"pnpm-workspace.yaml": "pnpm",
|
|
36003
36538
|
"yarn.lock": "yarn",
|
|
@@ -36018,7 +36553,7 @@ var init_constants = __esmMin((() => {
|
|
|
36018
36553
|
};
|
|
36019
36554
|
}));
|
|
36020
36555
|
//#endregion
|
|
36021
|
-
//#region ../../node_modules/.pnpm/package-manager-detector@1.
|
|
36556
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@1.8.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
36022
36557
|
var detect_exports = /* @__PURE__ */ __exportAll({
|
|
36023
36558
|
detect: () => detect,
|
|
36024
36559
|
getUserAgent: () => getUserAgent
|
|
@@ -36063,6 +36598,10 @@ async function detect(options = {}) {
|
|
|
36063
36598
|
for (const directory of lookup(cwd)) {
|
|
36064
36599
|
for (const strategy of strategies) switch (strategy) {
|
|
36065
36600
|
case "lockfile":
|
|
36601
|
+
if (await pathExists(PATH.join(directory, "rush.json"), "file")) return {
|
|
36602
|
+
name: "pnpm",
|
|
36603
|
+
agent: "pnpm-rush"
|
|
36604
|
+
};
|
|
36066
36605
|
for (const lock of Object.keys(LOCKS)) if (await pathExists(PATH.join(directory, lock), "file")) {
|
|
36067
36606
|
const name = LOCKS[lock];
|
|
36068
36607
|
const result = await parsePackageJson(PATH.join(directory, "package.json"), options);
|
|
@@ -41731,12 +42270,19 @@ function setWorkspaceScalar(cwd, key, value, isSatisfied, successMessage) {
|
|
|
41731
42270
|
function fixPnpmMinimumReleaseAge(cwd) {
|
|
41732
42271
|
setWorkspaceScalar(cwd, "minimumReleaseAge", DEFAULT_MINIMUM_RELEASE_AGE_MINUTES, isMinimumReleaseAgeSatisfied, ` ✔ Fixed: set minimumReleaseAge: ${DEFAULT_MINIMUM_RELEASE_AGE_MINUTES} in pnpm-workspace.yaml`);
|
|
41733
42272
|
}
|
|
41734
|
-
|
|
42273
|
+
/**
|
|
42274
|
+
Rewrites `minimumReleaseAgeExclude` through the YAML document model rather than
|
|
42275
|
+
by splicing lines. Scoped patterns start with `@`, a YAML reserved indicator, so
|
|
42276
|
+
a hand-built ` - @scope/*` line is not valid YAML — the serializer quotes them.
|
|
42277
|
+
|
|
42278
|
+
Returns whether the file was updated.
|
|
42279
|
+
*/
|
|
42280
|
+
function fixPnpmReleaseAgeExcludes(cwd, workspaces = [], configuredPatterns) {
|
|
41735
42281
|
const doc = readPnpmWorkspaceDocument(cwd);
|
|
41736
|
-
if (!doc) return;
|
|
42282
|
+
if (!doc) return false;
|
|
41737
42283
|
if (!import_dist.isMap(doc.contents)) {
|
|
41738
42284
|
console.log(chalk.yellow(" ⚠ pnpm-workspace.yaml has no top-level map; skipping fix"));
|
|
41739
|
-
return;
|
|
42285
|
+
return false;
|
|
41740
42286
|
}
|
|
41741
42287
|
let seq = doc.get("minimumReleaseAgeExclude");
|
|
41742
42288
|
if (!import_dist.isSeq(seq)) {
|
|
@@ -41744,8 +42290,8 @@ function fixPnpmReleaseAgeExcludes(cwd, workspaces = []) {
|
|
|
41744
42290
|
doc.set("minimumReleaseAgeExclude", seq);
|
|
41745
42291
|
}
|
|
41746
42292
|
const seqNode = seq;
|
|
41747
|
-
const { missing, unnecessary } = diffReleaseAgeExcludePatterns(cwd, workspaces, readSequenceStrings(seqNode));
|
|
41748
|
-
if (missing.length === 0 && unnecessary.length === 0) return;
|
|
42293
|
+
const { missing, unnecessary } = diffReleaseAgeExcludePatterns(cwd, workspaces, readSequenceStrings(seqNode), configuredPatterns);
|
|
42294
|
+
if (missing.length === 0 && unnecessary.length === 0) return false;
|
|
41749
42295
|
const unnecessarySet = new Set(unnecessary.map(normalizeReleaseAgeExcludePattern));
|
|
41750
42296
|
seqNode.items = seqNode.items.filter((item) => {
|
|
41751
42297
|
const value = import_dist.isScalar(item) ? item.value : item;
|
|
@@ -41762,6 +42308,7 @@ function fixPnpmReleaseAgeExcludes(cwd, workspaces = []) {
|
|
|
41762
42308
|
writeFileSync(pnpmWorkspacePath(cwd), String(doc), "utf8");
|
|
41763
42309
|
if (missing.length > 0) console.log(chalk.green(` ✔ Fixed: added ${missing.join(", ")} to minimumReleaseAgeExclude in pnpm-workspace.yaml`));
|
|
41764
42310
|
if (unnecessary.length > 0) console.log(chalk.green(` ✔ Fixed: removed ${unnecessary.join(", ")} from minimumReleaseAgeExclude in pnpm-workspace.yaml`));
|
|
42311
|
+
return true;
|
|
41765
42312
|
}
|
|
41766
42313
|
//#endregion
|
|
41767
42314
|
//#region src/actions/package-lint-specs.ts
|
|
@@ -41940,7 +42487,7 @@ function checkWorkspaceGlobCoverage(pkg, cwd, pm, workspaces) {
|
|
|
41940
42487
|
}
|
|
41941
42488
|
return result;
|
|
41942
42489
|
}
|
|
41943
|
-
function lintResultDiagnostics(ruleId, result) {
|
|
42490
|
+
function lintResultDiagnostics(ruleId, ruleLevel, result) {
|
|
41944
42491
|
return [
|
|
41945
42492
|
...result.errors.map((message) => ({
|
|
41946
42493
|
level: "error",
|
|
@@ -41948,7 +42495,7 @@ function lintResultDiagnostics(ruleId, result) {
|
|
|
41948
42495
|
rule: ruleId
|
|
41949
42496
|
})),
|
|
41950
42497
|
...result.fixable.map((message) => ({
|
|
41951
|
-
level:
|
|
42498
|
+
level: ruleLevel,
|
|
41952
42499
|
message: `${message} (fixable)`,
|
|
41953
42500
|
rule: ruleId
|
|
41954
42501
|
})),
|
|
@@ -41959,30 +42506,136 @@ function lintResultDiagnostics(ruleId, result) {
|
|
|
41959
42506
|
}))
|
|
41960
42507
|
];
|
|
41961
42508
|
}
|
|
41962
|
-
function
|
|
42509
|
+
function repoLintRule({ check, description, fix, id, level = "error" }) {
|
|
41963
42510
|
return {
|
|
41964
|
-
check: ({
|
|
41965
|
-
const result =
|
|
41966
|
-
const
|
|
42511
|
+
check: (context, { fix: shouldFix, level: ruleLevel }) => {
|
|
42512
|
+
const result = check(context);
|
|
42513
|
+
const applied = shouldFix && fix !== void 0 && result.fixable.length > 0 ? fix(context) !== false : false;
|
|
42514
|
+
const diagnostics = lintResultDiagnostics(id, ruleLevel, {
|
|
41967
42515
|
errors: result.errors,
|
|
41968
|
-
fixable:
|
|
42516
|
+
fixable: applied ? [] : result.fixable,
|
|
41969
42517
|
warnings: result.warnings
|
|
41970
42518
|
});
|
|
41971
|
-
|
|
41972
|
-
|
|
41973
|
-
|
|
41974
|
-
|
|
41975
|
-
fixedCount: result.fixable.length
|
|
41976
|
-
};
|
|
41977
|
-
}
|
|
41978
|
-
return { diagnostics: nonFixableDiagnostics };
|
|
42519
|
+
return applied ? {
|
|
42520
|
+
diagnostics,
|
|
42521
|
+
fixedCount: result.fixable.length
|
|
42522
|
+
} : { diagnostics };
|
|
41979
42523
|
},
|
|
41980
|
-
defaultLevel:
|
|
41981
|
-
description
|
|
41982
|
-
fixable:
|
|
41983
|
-
id
|
|
42524
|
+
defaultLevel: level,
|
|
42525
|
+
description,
|
|
42526
|
+
fixable: fix !== void 0,
|
|
42527
|
+
id
|
|
41984
42528
|
};
|
|
41985
42529
|
}
|
|
42530
|
+
const REPO_LINT_RULES = [
|
|
42531
|
+
repoLintRule({
|
|
42532
|
+
check: ({ pkg }) => checkRootPrivate(pkg),
|
|
42533
|
+
description: "Root package is private",
|
|
42534
|
+
fix: ({ cwd, pkg }) => fixRootPrivate(cwd, pkg),
|
|
42535
|
+
id: "repo.root-private"
|
|
42536
|
+
}),
|
|
42537
|
+
repoLintRule({
|
|
42538
|
+
check: ({ pkg }) => checkNoPublishConfigOnPrivate(pkg),
|
|
42539
|
+
description: "Private root has no publishConfig",
|
|
42540
|
+
fix: ({ cwd, pkg }) => fixNoPublishConfigOnPrivate(cwd, pkg),
|
|
42541
|
+
id: "repo.no-private-publish-config"
|
|
42542
|
+
}),
|
|
42543
|
+
repoLintRule({
|
|
42544
|
+
check: ({ workspaces }) => checkPackagesFolder(workspaces),
|
|
42545
|
+
description: "Workspace packages live under packages/",
|
|
42546
|
+
id: "repo.packages-folder"
|
|
42547
|
+
}),
|
|
42548
|
+
repoLintRule({
|
|
42549
|
+
check: ({ cwd, workspaces }) => checkSpecFileLayout(cwd, workspaces),
|
|
42550
|
+
description: "Spec files live in spec/ folders",
|
|
42551
|
+
id: "repo.spec-layout"
|
|
42552
|
+
}),
|
|
42553
|
+
repoLintRule({
|
|
42554
|
+
check: ({ cwd, pm, workspaces }) => checkWorkspacesFieldPlacement(cwd, pm, workspaces),
|
|
42555
|
+
description: "Workspace fields are declared in the package-manager-specific location",
|
|
42556
|
+
fix: ({ cwd, pm, workspaces }) => fixWorkspacesFieldPlacement(cwd, pm, workspaces),
|
|
42557
|
+
id: "repo.workspaces-field-placement"
|
|
42558
|
+
}),
|
|
42559
|
+
repoLintRule({
|
|
42560
|
+
check: ({ cwd, pkg, pm, workspaces }) => checkWorkspaceGlobCoverage(pkg, cwd, pm, workspaces),
|
|
42561
|
+
description: "Workspace globs cover every package",
|
|
42562
|
+
id: "repo.workspace-glob-coverage"
|
|
42563
|
+
}),
|
|
42564
|
+
repoLintRule({
|
|
42565
|
+
check: ({ cwd, workspaces }) => checkNoPackageManagerInWorkspaces(cwd, workspaces),
|
|
42566
|
+
description: "Only the root package declares packageManager",
|
|
42567
|
+
fix: ({ cwd, pkg, workspaces }) => fixNoPackageManagerInWorkspaces(cwd, pkg, workspaces),
|
|
42568
|
+
id: "repo.no-package-manager-in-workspaces"
|
|
42569
|
+
}),
|
|
42570
|
+
repoLintRule({
|
|
42571
|
+
check: ({ cwd, workspaces }) => checkVoltaOnlyInRoot(cwd, workspaces),
|
|
42572
|
+
description: "Only the root package declares volta",
|
|
42573
|
+
fix: ({ cwd, pkg, workspaces }) => fixVoltaOnlyInRoot(cwd, pkg, workspaces),
|
|
42574
|
+
id: "repo.volta-only-root"
|
|
42575
|
+
}),
|
|
42576
|
+
repoLintRule({
|
|
42577
|
+
check: ({ cwd, workspaces }) => checkEnginesOnlyInNonTerminal(cwd, workspaces),
|
|
42578
|
+
description: "Only non-terminal packages declare engines",
|
|
42579
|
+
fix: ({ cwd, pkg, workspaces }) => fixEnginesOnlyInNonTerminal(cwd, pkg, workspaces),
|
|
42580
|
+
id: "repo.engines-non-terminal"
|
|
42581
|
+
}),
|
|
42582
|
+
repoLintRule({
|
|
42583
|
+
check: ({ cwd, workspaces }) => checkVersionsIncludeLts(cwd, workspaces),
|
|
42584
|
+
description: "Engine and volta versions include latest LTS",
|
|
42585
|
+
id: "repo.engines-lts"
|
|
42586
|
+
}),
|
|
42587
|
+
repoLintRule({
|
|
42588
|
+
check: ({ cwd, pkg, workspaces }) => checkVersionConsistency(cwd, pkg, workspaces),
|
|
42589
|
+
description: "Workspace versions are consistent",
|
|
42590
|
+
fix: ({ cwd, pkg, workspaces }) => fixVersionConsistency(cwd, pkg, writeRootPackageJson, workspaces),
|
|
42591
|
+
id: "repo.version-consistency"
|
|
42592
|
+
}),
|
|
42593
|
+
repoLintRule({
|
|
42594
|
+
check: ({ cwd, pm, workspaces }) => pm === "pnpm" ? checkWorkspaceProtocol(cwd, workspaces) : checkInternalDepVersions(cwd, workspaces),
|
|
42595
|
+
description: "Internal dependencies use the expected workspace/version protocol",
|
|
42596
|
+
fix: ({ cwd, pm, workspaces }) => pm === "pnpm" ? fixWorkspaceProtocol(cwd, workspaces) : fixInternalDepVersions(cwd, workspaces),
|
|
42597
|
+
id: "repo.internal-dependency-ranges"
|
|
42598
|
+
}),
|
|
42599
|
+
repoLintRule({
|
|
42600
|
+
check: ({ cwd, workspaces }) => checkInternalPeerVersions(cwd, workspaces),
|
|
42601
|
+
description: "Internal peerDependencies use publishable ranges",
|
|
42602
|
+
fix: ({ cwd, workspaces }) => fixInternalPeerVersions(cwd, workspaces),
|
|
42603
|
+
id: "repo.internal-peer-ranges"
|
|
42604
|
+
}),
|
|
42605
|
+
repoLintRule({
|
|
42606
|
+
check: ({ cwd, pm, workspaces }) => checkPnpmReleaseAgeExcludes(cwd, pm, workspaces),
|
|
42607
|
+
description: "pnpm minimumReleaseAgeExclude matches imported scopes",
|
|
42608
|
+
fix: ({ cwd, workspaces }) => fixPnpmReleaseAgeExcludes(cwd, workspaces),
|
|
42609
|
+
id: "repo.pnpm-release-age-excludes"
|
|
42610
|
+
}),
|
|
42611
|
+
repoLintRule({
|
|
42612
|
+
check: ({ cwd, pm }) => checkPnpmMinimumReleaseAge(cwd, pm),
|
|
42613
|
+
description: "pnpm minimumReleaseAge is configured",
|
|
42614
|
+
fix: ({ cwd }) => fixPnpmMinimumReleaseAge(cwd),
|
|
42615
|
+
id: "repo.pnpm-minimum-release-age"
|
|
42616
|
+
}),
|
|
42617
|
+
repoLintRule({
|
|
42618
|
+
check: ({ cwd, pkg, pm }) => checkPnpmDependencyOverrides(cwd, pm, pkg),
|
|
42619
|
+
description: "pnpm dependency overrides are not configured",
|
|
42620
|
+
id: "repo.pnpm-no-overrides",
|
|
42621
|
+
level: "warn"
|
|
42622
|
+
}),
|
|
42623
|
+
repoLintRule({
|
|
42624
|
+
check: ({ cwd, githubRunner }) => {
|
|
42625
|
+
const result = emptyResult();
|
|
42626
|
+
if (dependabotAlertsStatus(cwd, githubRunner) === "disabled") result.fixable.push("Dependabot alerts are disabled for this repository");
|
|
42627
|
+
return result;
|
|
42628
|
+
},
|
|
42629
|
+
description: "Dependabot security alerts are enabled for the repository",
|
|
42630
|
+
fix: ({ cwd, githubRunner }) => {
|
|
42631
|
+
if (enableDependabotAlerts(cwd, githubRunner)) return true;
|
|
42632
|
+
console.log(chalk.yellow(" ⚠ Could not enable Dependabot alerts — the token needs admin on this repository"));
|
|
42633
|
+
return false;
|
|
42634
|
+
},
|
|
42635
|
+
id: "repo.dependabot-enabled",
|
|
42636
|
+
level: "warn"
|
|
42637
|
+
})
|
|
42638
|
+
];
|
|
41986
42639
|
function logRuleDiagnostic(diagnostic) {
|
|
41987
42640
|
const color = diagnostic.level === "error" ? chalk.red : chalk.yellow;
|
|
41988
42641
|
const marker = diagnostic.level === "error" ? "✗" : "⚠";
|
|
@@ -41994,12 +42647,19 @@ function logRulePassed(rule) {
|
|
|
41994
42647
|
function logRuleFixed(rule, fixedCount) {
|
|
41995
42648
|
console.log(chalk.green(` ✔ Fixed ${fixedCount} issue(s): ${rule.description ?? rule.id}`));
|
|
41996
42649
|
}
|
|
41997
|
-
function logSummary(errors, fixed) {
|
|
42650
|
+
function logSummary(errors, warnings, fixed) {
|
|
41998
42651
|
if (fixed > 0) console.log(chalk.green(`\n Fixed ${fixed} issue(s)`));
|
|
41999
|
-
if (errors > 0)
|
|
42000
|
-
|
|
42652
|
+
if (errors > 0) {
|
|
42653
|
+
console.log(chalk.red(`\n ${errors} error(s) found`));
|
|
42654
|
+
return;
|
|
42655
|
+
}
|
|
42656
|
+
if (warnings > 0) {
|
|
42657
|
+
console.log(chalk.yellow(`\n ${warnings} warning(s) found`));
|
|
42658
|
+
return;
|
|
42659
|
+
}
|
|
42660
|
+
if (fixed === 0) console.log(chalk.green("\n All checks passed"));
|
|
42001
42661
|
}
|
|
42002
|
-
async function packageLintMonorepo(shouldFix = false) {
|
|
42662
|
+
async function packageLintMonorepo(shouldFix = false, options = {}) {
|
|
42003
42663
|
const cwd = INIT_CWD();
|
|
42004
42664
|
let pkg;
|
|
42005
42665
|
try {
|
|
@@ -42015,112 +42675,17 @@ async function packageLintMonorepo(shouldFix = false) {
|
|
|
42015
42675
|
console.log(chalk.green("Repo Lint"));
|
|
42016
42676
|
const pm = detectPackageManager$1();
|
|
42017
42677
|
const workspaces = getPackageManager().listWorkspaces();
|
|
42018
|
-
const
|
|
42019
|
-
{
|
|
42020
|
-
check: () => checkRootPrivate(pkg),
|
|
42021
|
-
id: "repo.root-private",
|
|
42022
|
-
shouldFix: fixRootPrivate,
|
|
42023
|
-
label: "Root package is private"
|
|
42024
|
-
},
|
|
42025
|
-
{
|
|
42026
|
-
check: () => checkNoPublishConfigOnPrivate(pkg),
|
|
42027
|
-
id: "repo.no-private-publish-config",
|
|
42028
|
-
shouldFix: fixNoPublishConfigOnPrivate,
|
|
42029
|
-
label: "No publishConfig on private root"
|
|
42030
|
-
},
|
|
42031
|
-
{
|
|
42032
|
-
check: () => checkPackagesFolder(workspaces),
|
|
42033
|
-
id: "repo.packages-folder",
|
|
42034
|
-
label: "All packages are in packages/ folder"
|
|
42035
|
-
},
|
|
42036
|
-
{
|
|
42037
|
-
check: () => checkSpecFileLayout(cwd, workspaces),
|
|
42038
|
-
id: "repo.spec-layout",
|
|
42039
|
-
label: "Spec files live in a spec/ folder"
|
|
42040
|
-
},
|
|
42041
|
-
{
|
|
42042
|
-
check: () => checkWorkspacesFieldPlacement(cwd, pm, workspaces),
|
|
42043
|
-
id: "repo.workspaces-field-placement",
|
|
42044
|
-
shouldFix: () => fixWorkspacesFieldPlacement(cwd, pm, workspaces),
|
|
42045
|
-
label: pm === "pnpm" ? "No workspaces field in package.json (use pnpm-workspace.yaml)" : "Workspaces field only in root package.json"
|
|
42046
|
-
},
|
|
42047
|
-
{
|
|
42048
|
-
check: () => checkWorkspaceGlobCoverage(pkg, cwd, pm, workspaces),
|
|
42049
|
-
id: "repo.workspace-glob-coverage",
|
|
42050
|
-
label: "Workspace globs cover all packages"
|
|
42051
|
-
},
|
|
42052
|
-
{
|
|
42053
|
-
check: () => checkNoPackageManagerInWorkspaces(cwd, workspaces),
|
|
42054
|
-
id: "repo.no-package-manager-in-workspaces",
|
|
42055
|
-
shouldFix: () => fixNoPackageManagerInWorkspaces(cwd, pkg, workspaces),
|
|
42056
|
-
label: "No packageManager in workspace packages"
|
|
42057
|
-
},
|
|
42058
|
-
{
|
|
42059
|
-
check: () => checkVoltaOnlyInRoot(cwd, workspaces),
|
|
42060
|
-
id: "repo.volta-only-root",
|
|
42061
|
-
shouldFix: () => fixVoltaOnlyInRoot(cwd, pkg, workspaces),
|
|
42062
|
-
label: "Volta only in root package.json"
|
|
42063
|
-
},
|
|
42064
|
-
{
|
|
42065
|
-
check: () => checkEnginesOnlyInNonTerminal(cwd, workspaces),
|
|
42066
|
-
id: "repo.engines-non-terminal",
|
|
42067
|
-
shouldFix: () => fixEnginesOnlyInNonTerminal(cwd, pkg, workspaces),
|
|
42068
|
-
label: "Engines only in non-terminal (library) packages"
|
|
42069
|
-
},
|
|
42070
|
-
{
|
|
42071
|
-
check: () => checkVersionsIncludeLts(cwd, workspaces),
|
|
42072
|
-
id: "repo.engines-lts",
|
|
42073
|
-
label: "Engine/volta versions include latest LTS"
|
|
42074
|
-
},
|
|
42075
|
-
{
|
|
42076
|
-
check: () => checkVersionConsistency(cwd, pkg, workspaces),
|
|
42077
|
-
id: "repo.version-consistency",
|
|
42078
|
-
shouldFix: () => fixVersionConsistency(cwd, pkg, writeRootPackageJson, workspaces),
|
|
42079
|
-
label: "Consistent versions across packages"
|
|
42080
|
-
},
|
|
42081
|
-
pm === "pnpm" ? {
|
|
42082
|
-
check: () => checkWorkspaceProtocol(cwd, workspaces),
|
|
42083
|
-
id: "repo.internal-dependency-ranges",
|
|
42084
|
-
shouldFix: () => fixWorkspaceProtocol(cwd, workspaces),
|
|
42085
|
-
label: "Internal deps/devDeps use workspace: protocol"
|
|
42086
|
-
} : {
|
|
42087
|
-
check: () => checkInternalDepVersions(cwd, workspaces),
|
|
42088
|
-
id: "repo.internal-dependency-ranges",
|
|
42089
|
-
shouldFix: () => fixInternalDepVersions(cwd, workspaces),
|
|
42090
|
-
label: "Internal deps/devDeps use correct version ranges"
|
|
42091
|
-
},
|
|
42092
|
-
{
|
|
42093
|
-
check: () => checkInternalPeerVersions(cwd, workspaces),
|
|
42094
|
-
id: "repo.internal-peer-ranges",
|
|
42095
|
-
shouldFix: () => fixInternalPeerVersions(cwd, workspaces),
|
|
42096
|
-
label: "Internal peerDeps use publishable ranges"
|
|
42097
|
-
},
|
|
42098
|
-
{
|
|
42099
|
-
check: () => checkPnpmReleaseAgeExcludes(cwd, pm, workspaces),
|
|
42100
|
-
id: "repo.pnpm-release-age-excludes",
|
|
42101
|
-
shouldFix: () => fixPnpmReleaseAgeExcludes(cwd, workspaces),
|
|
42102
|
-
label: "pnpm-workspace.yaml minimumReleaseAgeExclude matches imported scoped packages"
|
|
42103
|
-
},
|
|
42104
|
-
{
|
|
42105
|
-
check: () => checkPnpmMinimumReleaseAge(cwd, pm),
|
|
42106
|
-
id: "repo.pnpm-minimum-release-age",
|
|
42107
|
-
shouldFix: () => fixPnpmMinimumReleaseAge(cwd),
|
|
42108
|
-
label: "pnpm-workspace.yaml sets minimumReleaseAge"
|
|
42109
|
-
},
|
|
42110
|
-
...pm === "pnpm" ? [{
|
|
42111
|
-
check: () => checkPnpmDependencyOverrides(cwd, pm, pkg),
|
|
42112
|
-
id: "repo.pnpm-no-overrides",
|
|
42113
|
-
label: "No pnpm dependency overrides configured",
|
|
42114
|
-
level: "warn"
|
|
42115
|
-
}] : []
|
|
42116
|
-
];
|
|
42678
|
+
const config = await loadWorkspaceCommandConfig(cwd, "repoLint");
|
|
42117
42679
|
const result = await runRuleChecks({
|
|
42118
|
-
commandName:
|
|
42119
|
-
configKey:
|
|
42120
|
-
config
|
|
42680
|
+
commandName: RULE_COMMANDS.repoLint.command,
|
|
42681
|
+
configKey: RULE_COMMANDS.repoLint.configKey,
|
|
42682
|
+
config,
|
|
42121
42683
|
context: {
|
|
42122
42684
|
cwd,
|
|
42123
|
-
pkg
|
|
42685
|
+
pkg,
|
|
42686
|
+
pm,
|
|
42687
|
+
workspaces,
|
|
42688
|
+
...options.githubRunner !== void 0 && { githubRunner: options.githubRunner }
|
|
42124
42689
|
},
|
|
42125
42690
|
fix: shouldFix,
|
|
42126
42691
|
reporter: {
|
|
@@ -42128,9 +42693,9 @@ async function packageLintMonorepo(shouldFix = false) {
|
|
|
42128
42693
|
fixed: logRuleFixed,
|
|
42129
42694
|
passed: logRulePassed
|
|
42130
42695
|
},
|
|
42131
|
-
rules:
|
|
42696
|
+
rules: REPO_LINT_RULES
|
|
42132
42697
|
});
|
|
42133
|
-
logSummary(result.envelope.errorCount, result.envelope.data.fixedCount);
|
|
42698
|
+
logSummary(result.envelope.errorCount, result.envelope.warningCount, result.envelope.data.fixedCount);
|
|
42134
42699
|
if (shouldFix && result.envelope.data.fixedCount > 0) shouldRunInstall();
|
|
42135
42700
|
return result;
|
|
42136
42701
|
}
|
|
@@ -43062,36 +43627,16 @@ function shouldCheckMinimumReleaseAgeExclude(cwd, config, isVerbose, isSilent) {
|
|
|
43062
43627
|
}
|
|
43063
43628
|
return false;
|
|
43064
43629
|
}
|
|
43630
|
+
/**
|
|
43631
|
+
Delegates to the shared YAML-document writer. Splicing ` - ${pattern}` lines by
|
|
43632
|
+
hand emitted invalid YAML for scoped patterns — `@` is a YAML reserved
|
|
43633
|
+
indicator, so a plain scalar cannot start with one and pnpm then failed to read
|
|
43634
|
+
its own workspace file.
|
|
43635
|
+
*/
|
|
43065
43636
|
function shouldFixMinimumReleaseAgeExclude(cwd, config) {
|
|
43066
43637
|
const content = readPnpmWorkspaceYaml(cwd);
|
|
43067
43638
|
if (content == null || content.length === 0) return false;
|
|
43068
|
-
|
|
43069
|
-
const existingExcludes = parseYamlListSection(content, "minimumReleaseAgeExclude").map(normalizeReleaseAgeExcludePattern);
|
|
43070
|
-
const { missing, unnecessary } = diffReleaseAgeExcludePatterns(cwd, workspaces, existingExcludes, config.configuredReleaseAgeExclude ?? [...KNOWN_RELEASE_AGE_EXCLUDE_PATTERNS]);
|
|
43071
|
-
if (missing.length === 0 && unnecessary.length === 0) return true;
|
|
43072
|
-
const unnecessarySet = new Set(unnecessary);
|
|
43073
|
-
const nextExcludes = [...existingExcludes.filter((pattern) => !unnecessarySet.has(pattern))];
|
|
43074
|
-
for (const pattern of missing) if (!nextExcludes.includes(pattern)) nextExcludes.push(pattern);
|
|
43075
|
-
const lines = content.split("\n");
|
|
43076
|
-
const sectionIndex = lines.findIndex((line) => /^minimumReleaseAgeExclude\s*:/.test(line));
|
|
43077
|
-
if (nextExcludes.length === 0) {
|
|
43078
|
-
if (sectionIndex !== -1) {
|
|
43079
|
-
let end = sectionIndex + 1;
|
|
43080
|
-
while (end < lines.length && /^\s+-/.test(lines[end])) end++;
|
|
43081
|
-
lines.splice(sectionIndex, end - sectionIndex);
|
|
43082
|
-
}
|
|
43083
|
-
} else if (sectionIndex === -1) {
|
|
43084
|
-
const newSection = ["minimumReleaseAgeExclude:", ...nextExcludes.map((s) => ` - ${s}`)];
|
|
43085
|
-
if (lines.at(-1) === "") lines.splice(-1, 0, ...newSection);
|
|
43086
|
-
else lines.push(...newSection);
|
|
43087
|
-
} else {
|
|
43088
|
-
let end = sectionIndex + 1;
|
|
43089
|
-
while (end < lines.length && /^\s+-/.test(lines[end])) end++;
|
|
43090
|
-
lines.splice(sectionIndex, end - sectionIndex, "minimumReleaseAgeExclude:", ...nextExcludes.map((s) => ` - ${s}`));
|
|
43091
|
-
}
|
|
43092
|
-
writePnpmWorkspaceYaml(cwd, lines.join("\n"));
|
|
43093
|
-
if (missing.length > 0) console.log(chalk.green(` Fixed: added ${missing.join(", ")} to minimumReleaseAgeExclude`));
|
|
43094
|
-
if (unnecessary.length > 0) console.log(chalk.green(` Fixed: removed ${unnecessary.join(", ")} from minimumReleaseAgeExclude`));
|
|
43639
|
+
fixPnpmReleaseAgeExcludes(cwd, getPackageManager().listWorkspaces(), config.configuredReleaseAgeExclude ?? [...KNOWN_RELEASE_AGE_EXCLUDE_PATTERNS]);
|
|
43095
43640
|
return true;
|
|
43096
43641
|
}
|
|
43097
43642
|
function hasPnpmWorkspaceSetting(content, key) {
|
|
@@ -50283,6 +50828,51 @@ function ruleCatalogResult(rules, title) {
|
|
|
50283
50828
|
};
|
|
50284
50829
|
}
|
|
50285
50830
|
//#endregion
|
|
50831
|
+
//#region src/actions/secure/dependabotRules.ts
|
|
50832
|
+
/**
|
|
50833
|
+
Severity → default level. Alerts are overwhelmingly transitive lockfile
|
|
50834
|
+
findings, so nothing fails a build by default; raise these in
|
|
50835
|
+
`commands.dependabot.rules` to gate on them.
|
|
50836
|
+
*/
|
|
50837
|
+
const DEFAULT_LEVELS = {
|
|
50838
|
+
critical: "warn",
|
|
50839
|
+
high: "warn",
|
|
50840
|
+
low: "off",
|
|
50841
|
+
medium: "off"
|
|
50842
|
+
};
|
|
50843
|
+
function alertLabel(alert) {
|
|
50844
|
+
const where = alert.repository === void 0 ? "" : `${alert.repository} `;
|
|
50845
|
+
const kind = `${alert.relationship}/${alert.scope}`;
|
|
50846
|
+
const patched = alert.patchedVersion === void 0 ? "no patch available" : `patched in ${alert.patchedVersion}`;
|
|
50847
|
+
const advisory = alert.ghsaId.length > 0 ? ` ${alert.ghsaId}` : "";
|
|
50848
|
+
return `${where}${alert.packageName} ${alert.vulnerableVersionRange} (${kind}) — ${patched}${advisory}`;
|
|
50849
|
+
}
|
|
50850
|
+
function severityRule(severity) {
|
|
50851
|
+
return {
|
|
50852
|
+
check: ({ alerts }) => {
|
|
50853
|
+
return { diagnostics: alerts.filter((alert) => alert.severity === severity).map((alert) => ({
|
|
50854
|
+
message: alertLabel(alert),
|
|
50855
|
+
rule: `dependabot.${severity}`
|
|
50856
|
+
})) };
|
|
50857
|
+
},
|
|
50858
|
+
defaultLevel: DEFAULT_LEVELS[severity],
|
|
50859
|
+
description: `Open Dependabot alerts with ${severity} severity`,
|
|
50860
|
+
id: `dependabot.${severity}`
|
|
50861
|
+
};
|
|
50862
|
+
}
|
|
50863
|
+
const DEPENDABOT_RULES = [...DEPENDABOT_SEVERITIES.map((severity) => severityRule(severity)), {
|
|
50864
|
+
check: ({ availability, target }) => {
|
|
50865
|
+
if (availability !== "disabled") return {};
|
|
50866
|
+
return { diagnostics: [{
|
|
50867
|
+
message: `Dependabot alerts are disabled for ${target.length > 0 ? target : "this repository"} — enable them in Settings → Code security`,
|
|
50868
|
+
rule: "dependabot.alerts-enabled"
|
|
50869
|
+
}] };
|
|
50870
|
+
},
|
|
50871
|
+
defaultLevel: "warn",
|
|
50872
|
+
description: "Dependabot alerts are enabled for the repository",
|
|
50873
|
+
id: "dependabot.alerts-enabled"
|
|
50874
|
+
}];
|
|
50875
|
+
//#endregion
|
|
50286
50876
|
//#region src/actions/skills/detectProfile.ts
|
|
50287
50877
|
const XYLABS_SCOPE = "@xylabs/";
|
|
50288
50878
|
const ARIESTOOLS_SCOPE = "@ariestools/";
|
|
@@ -51035,34 +51625,11 @@ const XY_WORK_GITHUB_LABEL = "xy-work";
|
|
|
51035
51625
|
HTML comment marker embedded in issue bodies so we can recognize our issues.
|
|
51036
51626
|
*/
|
|
51037
51627
|
const XY_WORK_GITHUB_BODY_MARKER_PREFIX = "<!-- xy-work:";
|
|
51038
|
-
const defaultGithubWorkRunner =
|
|
51039
|
-
const result = spawnSync("gh", args, {
|
|
51040
|
-
cwd: options.cwd,
|
|
51041
|
-
encoding: "utf8",
|
|
51042
|
-
env: process.env,
|
|
51043
|
-
stdio: [
|
|
51044
|
-
"ignore",
|
|
51045
|
-
"pipe",
|
|
51046
|
-
"pipe"
|
|
51047
|
-
]
|
|
51048
|
-
});
|
|
51049
|
-
return {
|
|
51050
|
-
status: result.status,
|
|
51051
|
-
stderr: typeof result.stderr === "string" ? result.stderr : "",
|
|
51052
|
-
stdout: typeof result.stdout === "string" ? result.stdout : ""
|
|
51053
|
-
};
|
|
51054
|
-
};
|
|
51628
|
+
const defaultGithubWorkRunner = defaultGithubRunner;
|
|
51055
51629
|
const isRecord = (value) => {
|
|
51056
51630
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
51057
51631
|
};
|
|
51058
|
-
const runOrThrow =
|
|
51059
|
-
const result = runner(args, { cwd });
|
|
51060
|
-
if (result.status !== 0) {
|
|
51061
|
-
const detail = result.stderr.trim() || result.stdout.trim() || `exit ${String(result.status)}`;
|
|
51062
|
-
throw new Error(`${context}: ${detail}`);
|
|
51063
|
-
}
|
|
51064
|
-
return result.stdout;
|
|
51065
|
-
};
|
|
51632
|
+
const runOrThrow = githubRunOrThrow;
|
|
51066
51633
|
const parseIssueUrl = (url) => {
|
|
51067
51634
|
const match = url.trim().match(/\/issues\/(\d+)\s*$/);
|
|
51068
51635
|
if (match === null) throw new Error(`Could not parse GitHub issue number from: ${url.trim()}`);
|
|
@@ -51250,17 +51817,7 @@ const createGithubWorkBridge = (runner = defaultGithubWorkRunner) => {
|
|
|
51250
51817
|
], cwd, "Failed to create GitHub issue");
|
|
51251
51818
|
return parseIssueUrl(stdout);
|
|
51252
51819
|
},
|
|
51253
|
-
isAvailable: (cwd) =>
|
|
51254
|
-
if (runner(["--version"], { cwd }).status !== 0) return false;
|
|
51255
|
-
if (runner(["auth", "status"], { cwd }).status !== 0) return false;
|
|
51256
|
-
const repo = runner([
|
|
51257
|
-
"repo",
|
|
51258
|
-
"view",
|
|
51259
|
-
"--json",
|
|
51260
|
-
"nameWithOwner"
|
|
51261
|
-
], { cwd });
|
|
51262
|
-
return repo.status === 0 && repo.stdout.trim().length > 0;
|
|
51263
|
-
},
|
|
51820
|
+
isAvailable: (cwd) => githubIsAvailable(runner, cwd),
|
|
51264
51821
|
listIssues,
|
|
51265
51822
|
listOpenIssues: (cwd) => listIssues(cwd, "open"),
|
|
51266
51823
|
updateIssue: (cwd, issueNumber, update) => {
|
|
@@ -51993,109 +52550,6 @@ const workLint = async (options = {}) => {
|
|
|
51993
52550
|
};
|
|
51994
52551
|
//#endregion
|
|
51995
52552
|
//#region src/actions/ruleCatalog.ts
|
|
51996
|
-
const REPO_LINT_RULES = [
|
|
51997
|
-
[
|
|
51998
|
-
"repo.root-private",
|
|
51999
|
-
"Root package is private",
|
|
52000
|
-
"error",
|
|
52001
|
-
true
|
|
52002
|
-
],
|
|
52003
|
-
[
|
|
52004
|
-
"repo.no-private-publish-config",
|
|
52005
|
-
"Private root has no publishConfig",
|
|
52006
|
-
"error",
|
|
52007
|
-
true
|
|
52008
|
-
],
|
|
52009
|
-
[
|
|
52010
|
-
"repo.packages-folder",
|
|
52011
|
-
"Workspace packages live under packages/",
|
|
52012
|
-
"error",
|
|
52013
|
-
false
|
|
52014
|
-
],
|
|
52015
|
-
[
|
|
52016
|
-
"repo.spec-layout",
|
|
52017
|
-
"Spec files live in spec/ folders",
|
|
52018
|
-
"error",
|
|
52019
|
-
false
|
|
52020
|
-
],
|
|
52021
|
-
[
|
|
52022
|
-
"repo.workspaces-field-placement",
|
|
52023
|
-
"Workspace fields are declared in the package-manager-specific location",
|
|
52024
|
-
"error",
|
|
52025
|
-
true
|
|
52026
|
-
],
|
|
52027
|
-
[
|
|
52028
|
-
"repo.workspace-glob-coverage",
|
|
52029
|
-
"Workspace globs cover every package",
|
|
52030
|
-
"error",
|
|
52031
|
-
false
|
|
52032
|
-
],
|
|
52033
|
-
[
|
|
52034
|
-
"repo.no-package-manager-in-workspaces",
|
|
52035
|
-
"Only the root package declares packageManager",
|
|
52036
|
-
"error",
|
|
52037
|
-
true
|
|
52038
|
-
],
|
|
52039
|
-
[
|
|
52040
|
-
"repo.volta-only-root",
|
|
52041
|
-
"Only the root package declares volta",
|
|
52042
|
-
"error",
|
|
52043
|
-
true
|
|
52044
|
-
],
|
|
52045
|
-
[
|
|
52046
|
-
"repo.engines-non-terminal",
|
|
52047
|
-
"Only non-terminal packages declare engines",
|
|
52048
|
-
"error",
|
|
52049
|
-
true
|
|
52050
|
-
],
|
|
52051
|
-
[
|
|
52052
|
-
"repo.engines-lts",
|
|
52053
|
-
"Engine and volta versions include latest LTS",
|
|
52054
|
-
"error",
|
|
52055
|
-
false
|
|
52056
|
-
],
|
|
52057
|
-
[
|
|
52058
|
-
"repo.version-consistency",
|
|
52059
|
-
"Workspace versions are consistent",
|
|
52060
|
-
"error",
|
|
52061
|
-
true
|
|
52062
|
-
],
|
|
52063
|
-
[
|
|
52064
|
-
"repo.internal-dependency-ranges",
|
|
52065
|
-
"Internal dependencies use the expected workspace/version protocol",
|
|
52066
|
-
"error",
|
|
52067
|
-
true
|
|
52068
|
-
],
|
|
52069
|
-
[
|
|
52070
|
-
"repo.internal-peer-ranges",
|
|
52071
|
-
"Internal peerDependencies use publishable ranges",
|
|
52072
|
-
"error",
|
|
52073
|
-
true
|
|
52074
|
-
],
|
|
52075
|
-
[
|
|
52076
|
-
"repo.pnpm-release-age-excludes",
|
|
52077
|
-
"pnpm minimumReleaseAgeExclude matches imported scopes",
|
|
52078
|
-
"error",
|
|
52079
|
-
true
|
|
52080
|
-
],
|
|
52081
|
-
[
|
|
52082
|
-
"repo.pnpm-minimum-release-age",
|
|
52083
|
-
"pnpm minimumReleaseAge is configured",
|
|
52084
|
-
"error",
|
|
52085
|
-
true
|
|
52086
|
-
],
|
|
52087
|
-
[
|
|
52088
|
-
"repo.pnpm-no-overrides",
|
|
52089
|
-
"pnpm dependency overrides are not configured",
|
|
52090
|
-
"warn",
|
|
52091
|
-
false
|
|
52092
|
-
]
|
|
52093
|
-
].map(([id, description, defaultLevel, fixable]) => ({
|
|
52094
|
-
defaultLevel,
|
|
52095
|
-
description,
|
|
52096
|
-
fixable,
|
|
52097
|
-
id
|
|
52098
|
-
}));
|
|
52099
52553
|
const NON_FIXABLE_DEAD_RULES = /* @__PURE__ */ new Set([
|
|
52100
52554
|
"dead.repo.deprecated-export",
|
|
52101
52555
|
"dead.workspace.deprecated-export",
|
|
@@ -52116,7 +52570,7 @@ async function loadCommandConfig(commandName, pkg) {
|
|
|
52116
52570
|
}
|
|
52117
52571
|
return loadWorkspaceCommandConfig(process.cwd(), commandName);
|
|
52118
52572
|
}
|
|
52119
|
-
function
|
|
52573
|
+
function runtimeRuleCatalog(command, configKey, definitions, config) {
|
|
52120
52574
|
const ruleSettings = config?.rules ?? {};
|
|
52121
52575
|
const known = new Set(definitions.flatMap((rule) => [rule.id, ...rule.aliases ?? []]));
|
|
52122
52576
|
const unknown = Object.keys(ruleSettings).filter((id) => !known.has(id));
|
|
@@ -52135,9 +52589,6 @@ function staticCatalog(command, configKey, definitions, config) {
|
|
|
52135
52589
|
level: parseRuleLevelSetting(ruleConfigPath(configKey, rule.id), resolveSetting(rule), rule.defaultLevel)
|
|
52136
52590
|
}));
|
|
52137
52591
|
}
|
|
52138
|
-
function runtimeRuleCatalog(command, configKey, definitions, config) {
|
|
52139
|
-
return staticCatalog(command, configKey, definitions, config);
|
|
52140
|
-
}
|
|
52141
52592
|
function commandPrefix(prefix, rules) {
|
|
52142
52593
|
return rules.map((rule) => ({
|
|
52143
52594
|
...rule,
|
|
@@ -52205,6 +52656,9 @@ async function getApiExposureRuleCatalog(pkg) {
|
|
|
52205
52656
|
};
|
|
52206
52657
|
});
|
|
52207
52658
|
}
|
|
52659
|
+
async function getDependabotRuleCatalog() {
|
|
52660
|
+
return runtimeRuleCatalog(RULE_COMMANDS.dependabot.command, RULE_COMMANDS.dependabot.configKey, DEPENDABOT_RULES, await loadCommandConfig("dependabot"));
|
|
52661
|
+
}
|
|
52208
52662
|
async function getGitlintRuleCatalog() {
|
|
52209
52663
|
return runtimeRuleCatalog(RULE_COMMANDS.gitLint.command, RULE_COMMANDS.gitLint.configKey, GITLINT_RULES, await loadCommandConfig("gitLint"));
|
|
52210
52664
|
}
|
|
@@ -52212,7 +52666,7 @@ async function getPackmanRuleCatalog() {
|
|
|
52212
52666
|
return runtimeRuleCatalog(RULE_COMMANDS.packman.command, RULE_COMMANDS.packman.configKey, PACKMAN_RULES, await loadCommandConfig("packman"));
|
|
52213
52667
|
}
|
|
52214
52668
|
async function getRepoLintRuleCatalog() {
|
|
52215
|
-
return
|
|
52669
|
+
return runtimeRuleCatalog(RULE_COMMANDS.repoLint.command, RULE_COMMANDS.repoLint.configKey, REPO_LINT_RULES, await loadCommandConfig("repoLint"));
|
|
52216
52670
|
}
|
|
52217
52671
|
async function getNodeLintRuleCatalog() {
|
|
52218
52672
|
return runtimeRuleCatalog(RULE_COMMANDS.nodeLint.command, RULE_COMMANDS.nodeLint.configKey, NODE_LINT_RULES, await loadCommandConfig("nodeLint"));
|
|
@@ -52306,53 +52760,186 @@ function getCycleRuleCatalog(depth = 25) {
|
|
|
52306
52760
|
level: "warn"
|
|
52307
52761
|
}];
|
|
52308
52762
|
}
|
|
52309
|
-
async function loadDirectRuleCatalog() {
|
|
52310
|
-
return sortRules([...(await Promise.all([
|
|
52311
|
-
getApiExposureRuleCatalog(),
|
|
52312
|
-
getCleanRuleCatalog(),
|
|
52313
|
-
getDeadRuleCatalog(),
|
|
52314
|
-
getDeplintRuleCatalog(),
|
|
52315
|
-
getGitlintRuleCatalog(),
|
|
52316
|
-
getPackmanRuleCatalog(),
|
|
52317
|
-
getPublintRuleCatalog(),
|
|
52318
|
-
getRepoLintRuleCatalog(),
|
|
52319
|
-
getNodeLintRuleCatalog(),
|
|
52320
|
-
getLintlintRuleCatalog(),
|
|
52321
|
-
getSkillsLintRuleCatalog(),
|
|
52322
|
-
getWorkLintRuleCatalog()
|
|
52323
|
-
])).flat(), ...getCycleRuleCatalog()]);
|
|
52324
|
-
}
|
|
52325
52763
|
async function getCheckRuleCatalog() {
|
|
52326
|
-
|
|
52764
|
+
const groups = await Promise.all([
|
|
52327
52765
|
getGitlintRuleCatalog(),
|
|
52328
52766
|
getPackmanRuleCatalog(),
|
|
52329
52767
|
getPublintRuleCatalog(),
|
|
52330
52768
|
getRepoLintRuleCatalog(),
|
|
52331
52769
|
getLintlintRuleCatalog(),
|
|
52332
52770
|
getSkillsLintRuleCatalog()
|
|
52333
|
-
])
|
|
52771
|
+
]);
|
|
52772
|
+
return sortRules(commandPrefix(RULE_COMMANDS.check.command, groups.flat()));
|
|
52334
52773
|
}
|
|
52335
52774
|
async function getFixRuleCatalog() {
|
|
52336
|
-
|
|
52775
|
+
const groups = await Promise.all([
|
|
52337
52776
|
getGitlintRuleCatalog(),
|
|
52338
52777
|
getDeplintRuleCatalog(),
|
|
52339
52778
|
getRepoLintRuleCatalog(),
|
|
52340
52779
|
getPublintRuleCatalog(),
|
|
52341
|
-
getEslintRuleCatalog(
|
|
52780
|
+
getEslintRuleCatalog(RULE_COMMANDS.lint.command),
|
|
52342
52781
|
getLintlintRuleCatalog()
|
|
52343
|
-
])
|
|
52782
|
+
]);
|
|
52783
|
+
return sortRules(commandPrefix(RULE_COMMANDS.fix.command, groups.flat()));
|
|
52784
|
+
}
|
|
52785
|
+
/**
|
|
52786
|
+
* Every rule-bearing command, keyed by its `RULE_COMMANDS` entry. Declaring
|
|
52787
|
+
* this as a total `Record<RuleCommandKey, …>` makes the compiler reject a new
|
|
52788
|
+
* registry entry that has no catalog loader (and vice versa), so the root
|
|
52789
|
+
* `xy --rules` view cannot silently miss a command.
|
|
52790
|
+
*/
|
|
52791
|
+
const RULE_CATALOG_LOADERS = {
|
|
52792
|
+
apiExposure: () => getApiExposureRuleCatalog(),
|
|
52793
|
+
check: () => getCheckRuleCatalog(),
|
|
52794
|
+
clean: () => getCleanRuleCatalog(),
|
|
52795
|
+
cycle: () => getCycleRuleCatalog(),
|
|
52796
|
+
dead: () => getDeadRuleCatalog(),
|
|
52797
|
+
dependabot: () => getDependabotRuleCatalog(),
|
|
52798
|
+
deplint: () => getDeplintRuleCatalog(),
|
|
52799
|
+
fix: () => getFixRuleCatalog(),
|
|
52800
|
+
gitLint: () => getGitlintRuleCatalog(),
|
|
52801
|
+
lint: () => getEslintRuleCatalog(),
|
|
52802
|
+
lintLint: () => getLintlintRuleCatalog(),
|
|
52803
|
+
nodeLint: () => getNodeLintRuleCatalog(),
|
|
52804
|
+
packman: () => getPackmanRuleCatalog(),
|
|
52805
|
+
publint: () => getPublintRuleCatalog(),
|
|
52806
|
+
repoLint: () => getRepoLintRuleCatalog(),
|
|
52807
|
+
skillsLint: () => getSkillsLintRuleCatalog(),
|
|
52808
|
+
workLint: () => getWorkLintRuleCatalog()
|
|
52809
|
+
};
|
|
52810
|
+
function rootRuleCommandKeys() {
|
|
52811
|
+
return Object.keys(RULE_COMMANDS).filter((key) => RULE_COMMANDS[key].includeInRoot);
|
|
52812
|
+
}
|
|
52813
|
+
async function getDirectRuleCatalog() {
|
|
52814
|
+
return sortRules((await Promise.all(rootRuleCommandKeys().map((key) => RULE_CATALOG_LOADERS[key]()))).flat());
|
|
52344
52815
|
}
|
|
52345
52816
|
async function getMasterRuleCatalog() {
|
|
52346
|
-
return
|
|
52817
|
+
return getDirectRuleCatalog();
|
|
52818
|
+
}
|
|
52819
|
+
//#endregion
|
|
52820
|
+
//#region src/actions/secure/dependabot.ts
|
|
52821
|
+
/**
|
|
52822
|
+
Fetch and filter alerts without rendering — used by `xy secure` to build its
|
|
52823
|
+
per-tool summary, and by `xy secure dependabot` before rule evaluation.
|
|
52824
|
+
*/
|
|
52825
|
+
function collectDependabotAlerts(options = {}) {
|
|
52826
|
+
const report = fetchDependabotAlerts({
|
|
52827
|
+
cwd: options.cwd ?? INIT_CWD(),
|
|
52828
|
+
...options.org !== void 0 && { org: options.org },
|
|
52829
|
+
...options.runner !== void 0 && { runner: options.runner },
|
|
52830
|
+
...options.state !== void 0 && { state: options.state }
|
|
52831
|
+
});
|
|
52832
|
+
const filtered = {
|
|
52833
|
+
...report,
|
|
52834
|
+
alerts: sortDependabotAlerts(filterDependabotAlerts(report.alerts, {
|
|
52835
|
+
...options.relationship !== void 0 && { relationship: options.relationship },
|
|
52836
|
+
...options.scope !== void 0 && { scope: options.scope }
|
|
52837
|
+
}))
|
|
52838
|
+
};
|
|
52839
|
+
return {
|
|
52840
|
+
report: filtered,
|
|
52841
|
+
summary: summarizeDependabotAlerts(filtered)
|
|
52842
|
+
};
|
|
52843
|
+
}
|
|
52844
|
+
/**
|
|
52845
|
+
An org-wide sweep can match thousands of alerts. Cap what reaches the console
|
|
52846
|
+
and say how many were held back — the envelope always carries every one.
|
|
52847
|
+
*/
|
|
52848
|
+
const DIAGNOSTIC_DISPLAY_LIMIT = 50;
|
|
52849
|
+
function createCappedReporter() {
|
|
52850
|
+
let shown = 0;
|
|
52851
|
+
let suppressed = 0;
|
|
52852
|
+
return {
|
|
52853
|
+
diagnostic: (diagnostic) => {
|
|
52854
|
+
if (shown >= DIAGNOSTIC_DISPLAY_LIMIT) {
|
|
52855
|
+
suppressed += 1;
|
|
52856
|
+
return;
|
|
52857
|
+
}
|
|
52858
|
+
shown += 1;
|
|
52859
|
+
const color = diagnostic.level === "error" ? chalk.red : chalk.yellow;
|
|
52860
|
+
const marker = diagnostic.level === "error" ? "✗" : "⚠";
|
|
52861
|
+
console.log(color(` ${marker} ${diagnostic.message}`));
|
|
52862
|
+
},
|
|
52863
|
+
reportSuppressed: () => {
|
|
52864
|
+
if (suppressed === 0) return;
|
|
52865
|
+
console.log(chalk.gray(` … ${suppressed} more not shown — re-run with --json for the full list`));
|
|
52866
|
+
}
|
|
52867
|
+
};
|
|
52868
|
+
}
|
|
52869
|
+
async function dependabot(options = {}) {
|
|
52870
|
+
const cwd = options.cwd ?? INIT_CWD();
|
|
52871
|
+
const { report, summary } = collectDependabotAlerts(options);
|
|
52872
|
+
if (options.summaryOnly === true) renderDependabotAlerts([], summary);
|
|
52873
|
+
else renderDependabotAlerts(report.alerts, summary);
|
|
52874
|
+
const context = {
|
|
52875
|
+
alerts: report.alerts,
|
|
52876
|
+
availability: report.availability,
|
|
52877
|
+
target: report.target
|
|
52878
|
+
};
|
|
52879
|
+
const config = await loadWorkspaceCommandConfig(cwd, RULE_COMMANDS.dependabot.configKey);
|
|
52880
|
+
const reporter = createCappedReporter();
|
|
52881
|
+
const result = await runRuleChecks({
|
|
52882
|
+
commandName: RULE_COMMANDS.dependabot.command,
|
|
52883
|
+
config,
|
|
52884
|
+
configKey: RULE_COMMANDS.dependabot.configKey,
|
|
52885
|
+
context,
|
|
52886
|
+
reporter: options.summaryOnly === true ? {} : { diagnostic: reporter.diagnostic },
|
|
52887
|
+
rules: DEPENDABOT_RULES,
|
|
52888
|
+
...options.strict !== void 0 && { strict: options.strict }
|
|
52889
|
+
});
|
|
52890
|
+
if (options.summaryOnly === true) {
|
|
52891
|
+
const reportable = result.envelope.errorCount + result.envelope.warningCount;
|
|
52892
|
+
if (reportable > 0) console.log(chalk.gray(` ${reportable} alert(s) at or above the configured rule levels — re-run without --summary for detail`));
|
|
52893
|
+
} else reporter.reportSuppressed();
|
|
52894
|
+
return result;
|
|
52347
52895
|
}
|
|
52348
52896
|
//#endregion
|
|
52349
|
-
//#region src/actions/secure.ts
|
|
52350
|
-
const
|
|
52897
|
+
//#region src/actions/secure/deps.ts
|
|
52898
|
+
const secureDeps = async ({ jobs = 16, pkg, render, verbose = false } = {}) => {
|
|
52351
52899
|
return await runSecurityAudit(getPackageManager(), {
|
|
52352
52900
|
concurrency: jobs,
|
|
52353
52901
|
pkg,
|
|
52354
|
-
verbose
|
|
52902
|
+
verbose,
|
|
52903
|
+
...render !== void 0 && { render }
|
|
52904
|
+
});
|
|
52905
|
+
};
|
|
52906
|
+
/**
|
|
52907
|
+
Run the dependency audit purely to collect its rows — used by `xy secure` to
|
|
52908
|
+
build a summary without printing the full table.
|
|
52909
|
+
*/
|
|
52910
|
+
const collectSecureDepsRows = async (options = {}) => {
|
|
52911
|
+
let rows = [];
|
|
52912
|
+
return {
|
|
52913
|
+
exitCode: await secureDeps({
|
|
52914
|
+
...options,
|
|
52915
|
+
render: (collected) => {
|
|
52916
|
+
rows = collected;
|
|
52917
|
+
}
|
|
52918
|
+
}),
|
|
52919
|
+
rows
|
|
52920
|
+
};
|
|
52921
|
+
};
|
|
52922
|
+
//#endregion
|
|
52923
|
+
//#region src/actions/secure/secure.ts
|
|
52924
|
+
/**
|
|
52925
|
+
The `xy secure` overview: run both audits, print one summary line each, and
|
|
52926
|
+
point at the subcommands for the detail tables.
|
|
52927
|
+
*/
|
|
52928
|
+
const secure = async (options = {}) => {
|
|
52929
|
+
const { rows, exitCode } = await collectSecureDepsRows({
|
|
52930
|
+
jobs: options.jobs,
|
|
52931
|
+
pkg: options.pkg,
|
|
52932
|
+
verbose: options.verbose ?? false
|
|
52933
|
+
});
|
|
52934
|
+
renderSecureDepsSummary(rows);
|
|
52935
|
+
const { summary } = collectDependabotAlerts({
|
|
52936
|
+
...options.cwd !== void 0 && { cwd: options.cwd },
|
|
52937
|
+
...options.org !== void 0 && { org: options.org },
|
|
52938
|
+
...options.runner !== void 0 && { runner: options.runner }
|
|
52355
52939
|
});
|
|
52940
|
+
renderDependabotSummary(summary);
|
|
52941
|
+
console.log(chalk.gray("\n Details: xy secure deps · xy secure dependabot"));
|
|
52942
|
+
return combineResults([resultFromExitCode(exitCode)]);
|
|
52356
52943
|
};
|
|
52357
52944
|
//#endregion
|
|
52358
52945
|
//#region src/actions/sitemap.ts
|
|
@@ -53403,7 +53990,7 @@ const checkCommand = {
|
|
|
53403
53990
|
const jobs = argv.jobs;
|
|
53404
53991
|
if (isVerbose) console.log("Check");
|
|
53405
53992
|
if (argv.rules === true) {
|
|
53406
|
-
await withEnvelope("check rules", async () => ruleCatalogResult(await getCheckRuleCatalog(),
|
|
53993
|
+
await withEnvelope("check rules", async () => ruleCatalogResult(await getCheckRuleCatalog(), RULE_COMMANDS.check.title));
|
|
53407
53994
|
return;
|
|
53408
53995
|
}
|
|
53409
53996
|
await withEnvelope("check", async () => {
|
|
@@ -53489,7 +54076,7 @@ const deadCommand = {
|
|
|
53489
54076
|
const isFixRemove = argv["fix-remove"] === true;
|
|
53490
54077
|
const pkg = argv.package;
|
|
53491
54078
|
if (argv.rules === true) {
|
|
53492
|
-
await withEnvelope("dead rules", async () => ruleCatalogResult(await getDeadRuleCatalog(pkg, { deprecated: argv.deprecated === true }),
|
|
54079
|
+
await withEnvelope("dead rules", async () => ruleCatalogResult(await getDeadRuleCatalog(pkg, { deprecated: argv.deprecated === true }), RULE_COMMANDS.dead.title));
|
|
53493
54080
|
return;
|
|
53494
54081
|
}
|
|
53495
54082
|
await withEnvelope("dead", () => dead({
|
|
@@ -53669,7 +54256,7 @@ const lintCommand$3 = {
|
|
|
53669
54256
|
},
|
|
53670
54257
|
handler: async (argv) => {
|
|
53671
54258
|
if (argv.rules === true) {
|
|
53672
|
-
await withEnvelope("packman lint rules", async () => ruleCatalogResult(await getPackmanRuleCatalog(),
|
|
54259
|
+
await withEnvelope("packman lint rules", async () => ruleCatalogResult(await getPackmanRuleCatalog(), RULE_COMMANDS.packman.title));
|
|
53673
54260
|
return;
|
|
53674
54261
|
}
|
|
53675
54262
|
await withEnvelope("packman lint", () => packmanLint({
|
|
@@ -53801,7 +54388,7 @@ const lintCommand$2 = {
|
|
|
53801
54388
|
handler: async (argv) => {
|
|
53802
54389
|
if (Boolean(argv.verbose)) console.log("Repo Lint");
|
|
53803
54390
|
if (argv.rules === true) {
|
|
53804
|
-
await withEnvelope("repo lint rules", async () => ruleCatalogResult(await getRepoLintRuleCatalog(),
|
|
54391
|
+
await withEnvelope("repo lint rules", async () => ruleCatalogResult(await getRepoLintRuleCatalog(), RULE_COMMANDS.repoLint.title));
|
|
53805
54392
|
return;
|
|
53806
54393
|
}
|
|
53807
54394
|
await withEnvelope("repo lint", () => packageLintMonorepo(!!Boolean(argv.fix)));
|
|
@@ -53831,19 +54418,101 @@ const retestCommand = {
|
|
|
53831
54418
|
}
|
|
53832
54419
|
};
|
|
53833
54420
|
//#endregion
|
|
53834
|
-
//#region src/xy/common/
|
|
53835
|
-
const
|
|
54421
|
+
//#region src/xy/common/secure/dependabotCommand.ts
|
|
54422
|
+
const dependabotCommand = {
|
|
54423
|
+
builder: (yargs) => {
|
|
54424
|
+
return yargs.option("org", {
|
|
54425
|
+
description: "Report every repository in this GitHub org instead of the current repo",
|
|
54426
|
+
type: "string"
|
|
54427
|
+
}).option("relationship", {
|
|
54428
|
+
choices: [
|
|
54429
|
+
"all",
|
|
54430
|
+
"direct",
|
|
54431
|
+
"transitive"
|
|
54432
|
+
],
|
|
54433
|
+
default: "all",
|
|
54434
|
+
description: "Only report alerts for direct or transitive dependencies",
|
|
54435
|
+
type: "string"
|
|
54436
|
+
}).option("rules", {
|
|
54437
|
+
description: "List supported dependabot rules and their effective levels",
|
|
54438
|
+
type: "boolean"
|
|
54439
|
+
}).option("scope", {
|
|
54440
|
+
choices: [
|
|
54441
|
+
"all",
|
|
54442
|
+
"development",
|
|
54443
|
+
"runtime"
|
|
54444
|
+
],
|
|
54445
|
+
default: "all",
|
|
54446
|
+
description: "Only report alerts for runtime or development dependencies",
|
|
54447
|
+
type: "string"
|
|
54448
|
+
}).option("state", {
|
|
54449
|
+
choices: [
|
|
54450
|
+
"all",
|
|
54451
|
+
"dismissed",
|
|
54452
|
+
"fixed",
|
|
54453
|
+
"open"
|
|
54454
|
+
],
|
|
54455
|
+
default: "open",
|
|
54456
|
+
description: "Alert state to report",
|
|
54457
|
+
type: "string"
|
|
54458
|
+
}).option("summary", {
|
|
54459
|
+
description: "Print only the summary line, not the per-alert table",
|
|
54460
|
+
type: "boolean"
|
|
54461
|
+
});
|
|
54462
|
+
},
|
|
54463
|
+
command: "dependabot",
|
|
54464
|
+
describe: "Report GitHub Dependabot security alerts",
|
|
54465
|
+
handler: async (argv) => {
|
|
54466
|
+
if (argv.rules === true) {
|
|
54467
|
+
await withEnvelope("secure dependabot rules", async () => ruleCatalogResult(await getDependabotRuleCatalog(), RULE_COMMANDS.dependabot.title));
|
|
54468
|
+
return;
|
|
54469
|
+
}
|
|
54470
|
+
const options = {
|
|
54471
|
+
relationship: argv.relationship,
|
|
54472
|
+
scope: argv.scope,
|
|
54473
|
+
state: argv.state,
|
|
54474
|
+
strict: argv.strict === true,
|
|
54475
|
+
summaryOnly: argv.summary === true,
|
|
54476
|
+
...typeof argv.org === "string" && argv.org.length > 0 && { org: argv.org }
|
|
54477
|
+
};
|
|
54478
|
+
await withEnvelope("secure dependabot", () => dependabot(options));
|
|
54479
|
+
}
|
|
54480
|
+
};
|
|
54481
|
+
//#endregion
|
|
54482
|
+
//#region src/xy/common/secure/depsCommand.ts
|
|
54483
|
+
const depsCommand = {
|
|
53836
54484
|
builder: (yargs) => {
|
|
53837
54485
|
return packagePositionalParam(yargs);
|
|
53838
54486
|
},
|
|
54487
|
+
command: "deps [package]",
|
|
54488
|
+
describe: "Audit direct dependency age and downloads",
|
|
54489
|
+
handler: async (argv) => {
|
|
54490
|
+
if (Boolean(argv.verbose)) console.log(`Secure deps: ${argv.package ?? "all"}`);
|
|
54491
|
+
await withEnvelope("secure deps", () => secureDeps({
|
|
54492
|
+
jobs: argv.jobs,
|
|
54493
|
+
pkg: argv.package,
|
|
54494
|
+
verbose: !!Boolean(argv.verbose)
|
|
54495
|
+
}));
|
|
54496
|
+
}
|
|
54497
|
+
};
|
|
54498
|
+
//#endregion
|
|
54499
|
+
//#region src/xy/common/secure/index.ts
|
|
54500
|
+
const secureCommand = {
|
|
54501
|
+
builder: (yargs) => {
|
|
54502
|
+
return packagePositionalParam(yargs).command(dependabotCommand).command(depsCommand).option("org", {
|
|
54503
|
+
description: "Summarize Dependabot alerts for this GitHub org instead of the current repo",
|
|
54504
|
+
type: "string"
|
|
54505
|
+
});
|
|
54506
|
+
},
|
|
53839
54507
|
command: "secure [package]",
|
|
53840
|
-
describe: "Secure -
|
|
54508
|
+
describe: "Secure - Dependency and Dependabot security overview",
|
|
53841
54509
|
handler: async (argv) => {
|
|
53842
54510
|
if (Boolean(argv.verbose)) console.log(`Secure: ${argv.package ?? "all"}`);
|
|
53843
54511
|
await withEnvelope("secure", () => secure({
|
|
53844
54512
|
jobs: argv.jobs,
|
|
53845
54513
|
pkg: argv.package,
|
|
53846
|
-
verbose: !!Boolean(argv.verbose)
|
|
54514
|
+
verbose: !!Boolean(argv.verbose),
|
|
54515
|
+
...typeof argv.org === "string" && argv.org.length > 0 && { org: argv.org }
|
|
53847
54516
|
}));
|
|
53848
54517
|
}
|
|
53849
54518
|
};
|
|
@@ -53943,7 +54612,7 @@ const runSkillsTail = async (tail) => {
|
|
|
53943
54612
|
}
|
|
53944
54613
|
if (subcommand === "defaults") return skillsDefaults(args);
|
|
53945
54614
|
if (subcommand === "lint") {
|
|
53946
|
-
if (args.includes("--rules")) return ruleCatalogResult(await getSkillsLintRuleCatalog(),
|
|
54615
|
+
if (args.includes("--rules")) return ruleCatalogResult(await getSkillsLintRuleCatalog(), RULE_COMMANDS.skillsLint.title);
|
|
53947
54616
|
const lintArgs = args.filter((arg) => !LINT_FLAGS.has(arg) && !HELP_FLAGS.has(arg));
|
|
53948
54617
|
if (lintArgs.length > 0) {
|
|
53949
54618
|
console.error(`Unknown arguments for skills lint: ${lintArgs.join(", ")}`);
|
|
@@ -54491,9 +55160,16 @@ const cleanCommand = {
|
|
|
54491
55160
|
default: false,
|
|
54492
55161
|
description: "Like --full, but also ignores clean.exclude / default excludes (only .git is protected)",
|
|
54493
55162
|
type: "boolean"
|
|
55163
|
+
}).option("rules", {
|
|
55164
|
+
description: "List supported clean rules and their effective levels",
|
|
55165
|
+
type: "boolean"
|
|
54494
55166
|
});
|
|
54495
55167
|
},
|
|
54496
55168
|
handler: async (argv) => {
|
|
55169
|
+
if (argv.rules === true) {
|
|
55170
|
+
await withEnvelope("clean rules", async () => ruleCatalogResult(await getCleanRuleCatalog(argv.package), RULE_COMMANDS.clean.title));
|
|
55171
|
+
return;
|
|
55172
|
+
}
|
|
54497
55173
|
const fullMode = resolveFullMode(argv);
|
|
54498
55174
|
if (Boolean(argv.verbose)) console.log(`Cleaning: ${argv.package ?? "all"}${fullMode === "none" ? "" : ` (${fullMode})`}`);
|
|
54499
55175
|
await withEnvelope("clean", () => clean({
|
|
@@ -54622,7 +55298,7 @@ const apiExposureCommand = {
|
|
|
54622
55298
|
if (Boolean(argv.verbose)) console.log("API Exposure");
|
|
54623
55299
|
const pkg = typeof argv.package === "string" ? argv.package : void 0;
|
|
54624
55300
|
if (argv.rules === true) {
|
|
54625
|
-
await withEnvelope("api-exposure rules", async () => ruleCatalogResult(await getApiExposureRuleCatalog(pkg),
|
|
55301
|
+
await withEnvelope("api-exposure rules", async () => ruleCatalogResult(await getApiExposureRuleCatalog(pkg), RULE_COMMANDS.apiExposure.title));
|
|
54626
55302
|
return;
|
|
54627
55303
|
}
|
|
54628
55304
|
const dep = argv.dep?.flatMap((value) => value.split(",")).map((value) => value.trim()).filter(Boolean);
|
|
@@ -54664,7 +55340,7 @@ const cycleCommand = {
|
|
|
54664
55340
|
handler: async (argv) => {
|
|
54665
55341
|
if (Boolean(argv.verbose)) console.log("Cycle");
|
|
54666
55342
|
if (argv.rules === true) {
|
|
54667
|
-
await withEnvelope("cycle rules", async () => ruleCatalogResult(getCycleRuleCatalog(argv.depth),
|
|
55343
|
+
await withEnvelope("cycle rules", async () => ruleCatalogResult(getCycleRuleCatalog(argv.depth), RULE_COMMANDS.cycle.title));
|
|
54668
55344
|
return;
|
|
54669
55345
|
}
|
|
54670
55346
|
await withEnvelope("cycle", () => cycle({
|
|
@@ -54757,7 +55433,7 @@ const deplintRunCommand = {
|
|
|
54757
55433
|
if (Boolean(argv.verbose)) console.log("Deplint");
|
|
54758
55434
|
const pkg = typeof argv.package === "string" ? argv.package : void 0;
|
|
54759
55435
|
if (argv.rules === true) {
|
|
54760
|
-
await withEnvelope("deplint rules", async () => ruleCatalogResult(await getDeplintRuleCatalog(pkg),
|
|
55436
|
+
await withEnvelope("deplint rules", async () => ruleCatalogResult(await getDeplintRuleCatalog(pkg), RULE_COMMANDS.deplint.title));
|
|
54761
55437
|
return;
|
|
54762
55438
|
}
|
|
54763
55439
|
const cliExclude = argv.exclude?.flatMap((v) => v.split(",")).map((v) => v.trim()).filter(Boolean);
|
|
@@ -54801,7 +55477,7 @@ const fixCommand = {
|
|
|
54801
55477
|
handler: async (argv) => {
|
|
54802
55478
|
if (Boolean(argv.verbose)) console.log("Fix");
|
|
54803
55479
|
if (argv.rules === true) {
|
|
54804
|
-
await withEnvelope("fix rules", async () => ruleCatalogResult(await getFixRuleCatalog(),
|
|
55480
|
+
await withEnvelope("fix rules", async () => ruleCatalogResult(await getFixRuleCatalog(), RULE_COMMANDS.fix.title));
|
|
54805
55481
|
return;
|
|
54806
55482
|
}
|
|
54807
55483
|
await withEnvelope("fix", () => fix({
|
|
@@ -54950,7 +55626,7 @@ const runCommand = {
|
|
|
54950
55626
|
handler: async (argv) => {
|
|
54951
55627
|
if (Boolean(argv.verbose)) console.log(Boolean(argv.analyze) ? "Lint analyze" : "Lint");
|
|
54952
55628
|
if (argv.rules === true) {
|
|
54953
|
-
await withEnvelope("lint rules", async () => ruleCatalogResult(await getEslintRuleCatalog("lint"),
|
|
55629
|
+
await withEnvelope("lint rules", async () => ruleCatalogResult(await getEslintRuleCatalog("lint"), RULE_COMMANDS.lint.title));
|
|
54954
55630
|
return;
|
|
54955
55631
|
}
|
|
54956
55632
|
if (Boolean(argv.fresh)) {
|
|
@@ -60690,7 +61366,7 @@ const xyBase = async (plugins) => {
|
|
|
60690
61366
|
warnIfUnsupportedPackageManager();
|
|
60691
61367
|
if (isRootRulesRequest()) {
|
|
60692
61368
|
if (process.argv.some((arg) => isTruthyLongFlag(arg, "--json"))) setJsonMode(true);
|
|
60693
|
-
await withEnvelope("rules", async () => ruleCatalogResult(await getMasterRuleCatalog(),
|
|
61369
|
+
await withEnvelope("rules", async () => ruleCatalogResult(await getMasterRuleCatalog(), ROOT_RULES_TITLE));
|
|
60694
61370
|
return;
|
|
60695
61371
|
}
|
|
60696
61372
|
const options = xyParseOptions();
|