@ariestools/toolchain 10.0.1 → 10.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/dead/classifyPackageVisibility.d.ts +2 -3
- package/dist/actions/dead/classifyPackageVisibility.d.ts.map +1 -1
- package/dist/actions/deplint/deplint.d.ts.map +1 -1
- package/dist/actions/deplint/engine.d.ts.map +1 -1
- package/dist/actions/deplint/fetchPackageManifest.d.ts +17 -0
- package/dist/actions/deplint/fetchPackageManifest.d.ts.map +1 -1
- package/dist/actions/deplint/index.d.ts +1 -0
- package/dist/actions/deplint/index.d.ts.map +1 -1
- package/dist/actions/deplint/packageJsonEditor.d.ts +3 -0
- package/dist/actions/deplint/packageJsonEditor.d.ts.map +1 -1
- package/dist/actions/deplint/ruleConfig.d.ts.map +1 -1
- package/dist/actions/deplint/rules.d.ts.map +1 -1
- package/dist/actions/deplint/rulesNotPublic.d.ts +25 -0
- package/dist/actions/deplint/rulesNotPublic.d.ts.map +1 -0
- package/dist/actions/deplint/snapshot.d.ts +1 -0
- package/dist/actions/deplint/snapshot.d.ts.map +1 -1
- package/dist/actions/deplint/types.d.ts +10 -0
- package/dist/actions/deplint/types.d.ts.map +1 -1
- package/dist/actions/package/compile/XyConfig.d.ts +2 -0
- package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
- package/dist/bin/skills.mjs +158 -60
- package/dist/bin/skills.mjs.map +1 -1
- package/dist/bin/xy.mjs +249 -87
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/bin/xyex.mjs +249 -87
- package/dist/bin/xyex.mjs.map +1 -1
- package/dist/lib/classifyPackageVisibility.d.ts +8 -0
- package/dist/lib/classifyPackageVisibility.d.ts.map +1 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/package.json +9 -9
package/dist/bin/xyex.mjs
CHANGED
|
@@ -649,6 +649,22 @@ const checkResult = (name, result, level = "error", shouldExitOnFail = false) =>
|
|
|
649
649
|
logFailure(name, result, level, "Continuing");
|
|
650
650
|
};
|
|
651
651
|
//#endregion
|
|
652
|
+
//#region src/lib/classifyPackageVisibility.ts
|
|
653
|
+
function isScopedPackageName$1(name) {
|
|
654
|
+
return typeof name === "string" && name.startsWith("@");
|
|
655
|
+
}
|
|
656
|
+
function classifyPackageVisibility(manifest) {
|
|
657
|
+
if (manifest?.private === true) return "private";
|
|
658
|
+
const access = manifest?.publishConfig;
|
|
659
|
+
if (typeof access === "object" && access !== null && !Array.isArray(access)) {
|
|
660
|
+
const publishAccess = access.access;
|
|
661
|
+
if (publishAccess === "restricted") return "restricted";
|
|
662
|
+
if (publishAccess === "public") return "public";
|
|
663
|
+
}
|
|
664
|
+
if (isScopedPackageName$1(manifest?.name)) return "restricted";
|
|
665
|
+
return "public";
|
|
666
|
+
}
|
|
667
|
+
//#endregion
|
|
652
668
|
//#region src/lib/concurrency.ts
|
|
653
669
|
const outputStorage = new AsyncLocalStorage();
|
|
654
670
|
const captureState = { isInstalled: false };
|
|
@@ -21080,7 +21096,7 @@ const downloadsCache = /* @__PURE__ */ new Map();
|
|
|
21080
21096
|
function packageUrlSegment(packageName) {
|
|
21081
21097
|
return encodeURIComponent(packageName);
|
|
21082
21098
|
}
|
|
21083
|
-
function isScopedPackageName
|
|
21099
|
+
function isScopedPackageName(packageName) {
|
|
21084
21100
|
return packageName.startsWith("@");
|
|
21085
21101
|
}
|
|
21086
21102
|
function chunks(items, size) {
|
|
@@ -21152,8 +21168,8 @@ async function fetchBulkWeeklyDownloads(packageNames) {
|
|
|
21152
21168
|
}
|
|
21153
21169
|
async function fetchAllSecureWeeklyDownloads(packageNames, concurrency = SCOPED_DOWNLOADS_CONCURRENCY) {
|
|
21154
21170
|
const uniqueNames = [...new Set(packageNames)].toSorted((a, b) => a.localeCompare(b));
|
|
21155
|
-
const unscopedNames = uniqueNames.filter((name) => !isScopedPackageName
|
|
21156
|
-
const scopedNames = uniqueNames.filter(isScopedPackageName
|
|
21171
|
+
const unscopedNames = uniqueNames.filter((name) => !isScopedPackageName(name));
|
|
21172
|
+
const scopedNames = uniqueNames.filter(isScopedPackageName);
|
|
21157
21173
|
const results = /* @__PURE__ */ new Map();
|
|
21158
21174
|
await runWithConcurrency(chunks(unscopedNames, BULK_DOWNLOADS_CHUNK_SIZE), 1, async (chunk) => {
|
|
21159
21175
|
const chunkResults = await fetchBulkWeeklyDownloads(chunk);
|
|
@@ -21864,13 +21880,13 @@ async function fetchAllRegistryInfo(packageNames, options = {}) {
|
|
|
21864
21880
|
return await fetchAllRegistryInfoDirect(packageNames, options);
|
|
21865
21881
|
}
|
|
21866
21882
|
//#endregion
|
|
21867
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
21883
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/key.js
|
|
21868
21884
|
const isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
21869
21885
|
const isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
21870
21886
|
const isSpaceKey = (key) => key.name === "space";
|
|
21871
21887
|
const isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
21872
21888
|
//#endregion
|
|
21873
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
21889
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/errors.js
|
|
21874
21890
|
var AbortPromptError = class extends Error {
|
|
21875
21891
|
name = "AbortPromptError";
|
|
21876
21892
|
message = "Prompt was aborted";
|
|
@@ -21893,7 +21909,7 @@ var ValidationError = class extends Error {
|
|
|
21893
21909
|
name = "ValidationError";
|
|
21894
21910
|
};
|
|
21895
21911
|
//#endregion
|
|
21896
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
21912
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
21897
21913
|
const hookStorage = new AsyncLocalStorage();
|
|
21898
21914
|
function createStore(rl) {
|
|
21899
21915
|
return {
|
|
@@ -21989,7 +22005,7 @@ const effectScheduler = {
|
|
|
21989
22005
|
}
|
|
21990
22006
|
};
|
|
21991
22007
|
//#endregion
|
|
21992
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22008
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
21993
22009
|
function isFactory(value) {
|
|
21994
22010
|
return typeof value === "function";
|
|
21995
22011
|
}
|
|
@@ -22013,7 +22029,7 @@ function useState(defaultValue) {
|
|
|
22013
22029
|
});
|
|
22014
22030
|
}
|
|
22015
22031
|
//#endregion
|
|
22016
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22032
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
22017
22033
|
function useEffect(cb, depArray) {
|
|
22018
22034
|
withPointer((pointer) => {
|
|
22019
22035
|
const oldDeps = pointer.get();
|
|
@@ -22022,12 +22038,12 @@ function useEffect(cb, depArray) {
|
|
|
22022
22038
|
});
|
|
22023
22039
|
}
|
|
22024
22040
|
//#endregion
|
|
22025
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22041
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
22026
22042
|
function useRef(val) {
|
|
22027
22043
|
return useState({ current: val })[0];
|
|
22028
22044
|
}
|
|
22029
22045
|
//#endregion
|
|
22030
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22046
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
22031
22047
|
function useKeypress(userHandler) {
|
|
22032
22048
|
const signal = useRef(userHandler);
|
|
22033
22049
|
signal.current = userHandler;
|
|
@@ -22355,7 +22371,7 @@ function wrapAnsi$1(string, columns, options) {
|
|
|
22355
22371
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec$2(line, columns, options)).join("\n");
|
|
22356
22372
|
}
|
|
22357
22373
|
//#endregion
|
|
22358
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22374
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/utils.js
|
|
22359
22375
|
var import_cli_width = /* @__PURE__ */ __toESM(require_cli_width(), 1);
|
|
22360
22376
|
/**
|
|
22361
22377
|
* Force line returns at specific width. This function is ANSI code friendly and it'll
|
|
@@ -22678,7 +22694,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
22678
22694
|
const process$2 = globalThis.process;
|
|
22679
22695
|
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
22680
22696
|
//#endregion
|
|
22681
|
-
//#region ../../node_modules/.pnpm/@inquirer+ansi@2.0.
|
|
22697
|
+
//#region ../../node_modules/.pnpm/@inquirer+ansi@2.0.8/node_modules/@inquirer/ansi/dist/index.js
|
|
22682
22698
|
const ESC = "\x1B[";
|
|
22683
22699
|
/** Show the cursor */
|
|
22684
22700
|
const cursorShow = "\x1B[?25h";
|
|
@@ -22695,7 +22711,7 @@ const eraseLine = "\x1B[2K";
|
|
|
22695
22711
|
/** Erase the specified number of lines above the cursor */
|
|
22696
22712
|
const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + "\x1B[2K\x1B[G" : "";
|
|
22697
22713
|
//#endregion
|
|
22698
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22714
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
22699
22715
|
const height = (content) => content.split("\n").length;
|
|
22700
22716
|
const lastLine = (content) => content.split("\n").pop() ?? "";
|
|
22701
22717
|
var ScreenManager = class {
|
|
@@ -22752,7 +22768,7 @@ var ScreenManager = class {
|
|
|
22752
22768
|
}
|
|
22753
22769
|
};
|
|
22754
22770
|
//#endregion
|
|
22755
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22771
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
22756
22772
|
var PromisePolyfill = class extends Promise {
|
|
22757
22773
|
static withResolver() {
|
|
22758
22774
|
let resolve;
|
|
@@ -22768,7 +22784,7 @@ var PromisePolyfill = class extends Promise {
|
|
|
22768
22784
|
}
|
|
22769
22785
|
};
|
|
22770
22786
|
//#endregion
|
|
22771
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22787
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.2_@types+node@26.4.1/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
22772
22788
|
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
22773
22789
|
const nativeSetImmediate = globalThis.setImmediate;
|
|
22774
22790
|
function getCallSites() {
|
|
@@ -28233,6 +28249,10 @@ function isRuleLevel$3(value) {
|
|
|
28233
28249
|
function severityFromLevel$1(level) {
|
|
28234
28250
|
return level === "warn" ? "warning" : "error";
|
|
28235
28251
|
}
|
|
28252
|
+
const DEFAULT_ERROR_RULE_IDS = /* @__PURE__ */ new Set(["dep.dependencies.not-public", "dep.peerDependencies.not-public"]);
|
|
28253
|
+
function defaultSeverityForUnconfigured(ruleId) {
|
|
28254
|
+
return DEFAULT_ERROR_RULE_IDS.has(ruleId) ? "error" : "warning";
|
|
28255
|
+
}
|
|
28236
28256
|
function formatRuleConfigLocation$1(ruleId) {
|
|
28237
28257
|
return `commands.deplint.rules["${ruleId}"]`;
|
|
28238
28258
|
}
|
|
@@ -28309,7 +28329,7 @@ function normalizeDeplintRules(rules, config, builtInRuleIds) {
|
|
|
28309
28329
|
enabled: true,
|
|
28310
28330
|
meta: {
|
|
28311
28331
|
...rule.meta,
|
|
28312
|
-
severity:
|
|
28332
|
+
severity: defaultSeverityForUnconfigured(rule.id)
|
|
28313
28333
|
},
|
|
28314
28334
|
options: {}
|
|
28315
28335
|
};
|
|
@@ -30682,6 +30702,201 @@ const misplacedPeerDependenciesRule = {
|
|
|
30682
30702
|
}
|
|
30683
30703
|
};
|
|
30684
30704
|
//#endregion
|
|
30705
|
+
//#region src/actions/deplint/fetchPackageManifest.ts
|
|
30706
|
+
/**
|
|
30707
|
+
* Fetches npm registry manifests for deplint's peer-dependency resolution.
|
|
30708
|
+
*
|
|
30709
|
+
* Unlike `lib/updo/fetchRegistryInfo`, which returns only version strings
|
|
30710
|
+
* and dist-tags, this helper preserves each version's `peerDependencies`
|
|
30711
|
+
* block. That's what we need to answer the question: "what's the latest
|
|
30712
|
+
* version of package X whose peer range accepts peer Y at version Z?"
|
|
30713
|
+
*
|
|
30714
|
+
* Results are cached per-process so repeated lookups within a single
|
|
30715
|
+
* deplint run hit the registry at most once per package.
|
|
30716
|
+
*/
|
|
30717
|
+
const REGISTRY_BASE = "https://registry.npmjs.org";
|
|
30718
|
+
const cache = /* @__PURE__ */ new Map();
|
|
30719
|
+
const availabilityCache = /* @__PURE__ */ new Map();
|
|
30720
|
+
const availabilityLookupState = {};
|
|
30721
|
+
async function fetchUncached(packageName) {
|
|
30722
|
+
try {
|
|
30723
|
+
const url = `${REGISTRY_BASE}/${encodeURIComponent(packageName)}`;
|
|
30724
|
+
const res = await fetch(url, { headers: { Accept: "application/vnd.npm.install-v1+json" } });
|
|
30725
|
+
if (!res.ok) return void 0;
|
|
30726
|
+
const data = await res.json();
|
|
30727
|
+
const versionsMap = data.versions ?? {};
|
|
30728
|
+
const versions = Object.entries(versionsMap).map(([version, manifest]) => ({
|
|
30729
|
+
peerDependencies: manifest.peerDependencies ?? {},
|
|
30730
|
+
version
|
|
30731
|
+
}));
|
|
30732
|
+
return {
|
|
30733
|
+
distTags: data["dist-tags"] ?? {},
|
|
30734
|
+
versions
|
|
30735
|
+
};
|
|
30736
|
+
} catch {
|
|
30737
|
+
return;
|
|
30738
|
+
}
|
|
30739
|
+
}
|
|
30740
|
+
function fetchPackageManifest(packageName) {
|
|
30741
|
+
const existing = cache.get(packageName);
|
|
30742
|
+
if (existing) return existing;
|
|
30743
|
+
const pending = fetchUncached(packageName);
|
|
30744
|
+
cache.set(packageName, pending);
|
|
30745
|
+
return pending;
|
|
30746
|
+
}
|
|
30747
|
+
async function fetchPackageManifests(packageNames, concurrency = 16) {
|
|
30748
|
+
const unique = [...new Set(packageNames)];
|
|
30749
|
+
const results = /* @__PURE__ */ new Map();
|
|
30750
|
+
await runWithConcurrency(unique, concurrency, async (name) => {
|
|
30751
|
+
results.set(name, await fetchPackageManifest(name));
|
|
30752
|
+
});
|
|
30753
|
+
return results;
|
|
30754
|
+
}
|
|
30755
|
+
async function fetchNpmjsPublicAvailabilityUncached(packageName) {
|
|
30756
|
+
try {
|
|
30757
|
+
const url = `${REGISTRY_BASE}/${encodeURIComponent(packageName)}`;
|
|
30758
|
+
const res = await fetch(url, {
|
|
30759
|
+
headers: { Accept: "application/vnd.npm.install-v1+json" },
|
|
30760
|
+
signal: AbortSignal.timeout(1e4)
|
|
30761
|
+
});
|
|
30762
|
+
if (res.status === 404) return "not-public";
|
|
30763
|
+
if (!res.ok) return "unknown";
|
|
30764
|
+
return "public";
|
|
30765
|
+
} catch {
|
|
30766
|
+
return "unknown";
|
|
30767
|
+
}
|
|
30768
|
+
}
|
|
30769
|
+
function cachedNpmjsPublicAvailability(packageName) {
|
|
30770
|
+
const existing = availabilityCache.get(packageName);
|
|
30771
|
+
if (existing) return existing;
|
|
30772
|
+
const pending = fetchNpmjsPublicAvailabilityUncached(packageName);
|
|
30773
|
+
availabilityCache.set(packageName, pending);
|
|
30774
|
+
return pending;
|
|
30775
|
+
}
|
|
30776
|
+
/**
|
|
30777
|
+
* Unauthenticated npmjs lookup: can a stranger resolve this package name?
|
|
30778
|
+
* 404 (unpublished or private-org) is `not-public`. Network / 5xx is `unknown`.
|
|
30779
|
+
*
|
|
30780
|
+
* Vitest sets `VITEST=true`. Those runs skip the registry unless a test installs
|
|
30781
|
+
* an override, so other deplint fixtures with fake package names do not 404.
|
|
30782
|
+
*/
|
|
30783
|
+
function lookupNpmjsPublicAvailability(packageName) {
|
|
30784
|
+
if (availabilityLookupState.override !== void 0) return availabilityLookupState.override(packageName);
|
|
30785
|
+
if (process.env.VITEST === "true") return Promise.resolve("unknown");
|
|
30786
|
+
return cachedNpmjsPublicAvailability(packageName);
|
|
30787
|
+
}
|
|
30788
|
+
async function lookupNpmjsPublicAvailabilities(packageNames, concurrency = 16) {
|
|
30789
|
+
const unique = [...new Set(packageNames)];
|
|
30790
|
+
const results = /* @__PURE__ */ new Map();
|
|
30791
|
+
await runWithConcurrency(unique, concurrency, async (name) => {
|
|
30792
|
+
results.set(name, await lookupNpmjsPublicAvailability(name));
|
|
30793
|
+
});
|
|
30794
|
+
return results;
|
|
30795
|
+
}
|
|
30796
|
+
//#endregion
|
|
30797
|
+
//#region src/actions/deplint/rulesNotPublic.ts
|
|
30798
|
+
function workspaceVisibilityByName(workspaceDirs) {
|
|
30799
|
+
const visibilities = /* @__PURE__ */ new Map();
|
|
30800
|
+
for (const [name, dir] of workspaceDirs) try {
|
|
30801
|
+
visibilities.set(name, classifyPackageVisibility(readPackageJson$4(dir)));
|
|
30802
|
+
} catch {}
|
|
30803
|
+
return visibilities;
|
|
30804
|
+
}
|
|
30805
|
+
function inspectDeclaredDependencyPublic(dependency, version, workspaceVisibility) {
|
|
30806
|
+
const siblingVisibility = workspaceVisibility.get(dependency);
|
|
30807
|
+
if (siblingVisibility !== void 0) {
|
|
30808
|
+
if (siblingVisibility === "public") return { status: "public" };
|
|
30809
|
+
return {
|
|
30810
|
+
reason: {
|
|
30811
|
+
type: "workspace",
|
|
30812
|
+
visibility: siblingVisibility
|
|
30813
|
+
},
|
|
30814
|
+
status: "not-public"
|
|
30815
|
+
};
|
|
30816
|
+
}
|
|
30817
|
+
if (version !== void 0 && isOpaqueVersionSpec(version)) return {
|
|
30818
|
+
reason: {
|
|
30819
|
+
spec: version.trim(),
|
|
30820
|
+
type: "non-registry-spec"
|
|
30821
|
+
},
|
|
30822
|
+
status: "not-public"
|
|
30823
|
+
};
|
|
30824
|
+
return { status: "check-registry" };
|
|
30825
|
+
}
|
|
30826
|
+
function formatNotPublicMessage(dependency, section, reason) {
|
|
30827
|
+
switch (reason.type) {
|
|
30828
|
+
case "non-registry-spec": return `${dependency} is specified as "${reason.spec}", which is not a public npmjs package, so it cannot appear in ${section} of a package published publicly on npmjs`;
|
|
30829
|
+
case "unpublished": return `${dependency} is not published publicly on npmjs, so it cannot appear in ${section} of a package published publicly on npmjs`;
|
|
30830
|
+
case "workspace":
|
|
30831
|
+
if (reason.visibility === "private") return `${dependency} is a private workspace package, so it cannot appear in ${section} of a package published publicly on npmjs`;
|
|
30832
|
+
return `${dependency} is not public on npmjs (scoped workspace package without publishConfig.access "public"), so it cannot appear in ${section} of a package published publicly on npmjs`;
|
|
30833
|
+
}
|
|
30834
|
+
}
|
|
30835
|
+
async function evaluateNotPublicSection(context, section, dependencies, versions) {
|
|
30836
|
+
if (classifyPackageVisibility(readPackageJsonSafe(context)) !== "public") return;
|
|
30837
|
+
const workspaceVisibility = workspaceVisibilityByName(context.workspaceDirs);
|
|
30838
|
+
const inspections = dependencies.map((dependency) => {
|
|
30839
|
+
return [dependency, inspectDeclaredDependencyPublic(dependency, versions[dependency], workspaceVisibility)];
|
|
30840
|
+
});
|
|
30841
|
+
const registryNames = inspections.filter(([, inspection]) => inspection.status === "check-registry").map(([dependency]) => dependency);
|
|
30842
|
+
const availability = registryNames.length === 0 ? /* @__PURE__ */ new Map() : await lookupNpmjsPublicAvailabilities(registryNames);
|
|
30843
|
+
for (const [dependency, inspection] of inspections) {
|
|
30844
|
+
if (inspection.status === "public") continue;
|
|
30845
|
+
if (inspection.status === "not-public") {
|
|
30846
|
+
context.report({
|
|
30847
|
+
data: {
|
|
30848
|
+
reason: inspection.reason,
|
|
30849
|
+
section
|
|
30850
|
+
},
|
|
30851
|
+
dependency,
|
|
30852
|
+
message: formatNotPublicMessage(dependency, section, inspection.reason)
|
|
30853
|
+
});
|
|
30854
|
+
continue;
|
|
30855
|
+
}
|
|
30856
|
+
if (availability.get(dependency) !== "not-public") continue;
|
|
30857
|
+
const reason = { type: "unpublished" };
|
|
30858
|
+
context.report({
|
|
30859
|
+
data: {
|
|
30860
|
+
reason,
|
|
30861
|
+
section
|
|
30862
|
+
},
|
|
30863
|
+
dependency,
|
|
30864
|
+
message: formatNotPublicMessage(dependency, section, reason)
|
|
30865
|
+
});
|
|
30866
|
+
}
|
|
30867
|
+
}
|
|
30868
|
+
function readPackageJsonSafe(context) {
|
|
30869
|
+
try {
|
|
30870
|
+
return readPackageJson$4(context.workspace.dir);
|
|
30871
|
+
} catch {
|
|
30872
|
+
return;
|
|
30873
|
+
}
|
|
30874
|
+
}
|
|
30875
|
+
const notPublicDependenciesRule = {
|
|
30876
|
+
category: "dependencies",
|
|
30877
|
+
id: "dep.dependencies.not-public",
|
|
30878
|
+
meta: {
|
|
30879
|
+
description: "Public packages must not list non-public npmjs packages in dependencies",
|
|
30880
|
+
fixable: [],
|
|
30881
|
+
severity: "error"
|
|
30882
|
+
},
|
|
30883
|
+
async evaluate(context) {
|
|
30884
|
+
await evaluateNotPublicSection(context, "dependencies", context.packageParams.dependencies, context.packageParams.dependencyVersions);
|
|
30885
|
+
}
|
|
30886
|
+
};
|
|
30887
|
+
const notPublicPeerDependenciesRule = {
|
|
30888
|
+
category: "peerDependencies",
|
|
30889
|
+
id: "dep.peerDependencies.not-public",
|
|
30890
|
+
meta: {
|
|
30891
|
+
description: "Public packages must not list non-public npmjs packages in peerDependencies",
|
|
30892
|
+
fixable: [],
|
|
30893
|
+
severity: "error"
|
|
30894
|
+
},
|
|
30895
|
+
async evaluate(context) {
|
|
30896
|
+
await evaluateNotPublicSection(context, "peerDependencies", context.packageParams.peerDependencies, context.packageParams.peerDependencyVersions);
|
|
30897
|
+
}
|
|
30898
|
+
};
|
|
30899
|
+
//#endregion
|
|
30685
30900
|
//#region src/actions/deplint/rulesRedundantPlacement.ts
|
|
30686
30901
|
function isDeclaredDependency(context, dependency) {
|
|
30687
30902
|
const { dependencies, devDependencies, peerDependencies } = context.packageParams;
|
|
@@ -31444,6 +31659,7 @@ const builtInDeplintPlugin = {
|
|
|
31444
31659
|
unlistedDependenciesRule,
|
|
31445
31660
|
unusedDependenciesRule,
|
|
31446
31661
|
misplacedDependenciesRule,
|
|
31662
|
+
notPublicDependenciesRule,
|
|
31447
31663
|
{
|
|
31448
31664
|
category: "dependencies",
|
|
31449
31665
|
id: "dep.dependencies.aei-review",
|
|
@@ -31477,6 +31693,7 @@ const builtInDeplintPlugin = {
|
|
|
31477
31693
|
unusedPeerDependenciesRule,
|
|
31478
31694
|
unrequestedPeerDependenciesRule,
|
|
31479
31695
|
misplacedPeerDependenciesRule,
|
|
31696
|
+
notPublicPeerDependenciesRule,
|
|
31480
31697
|
redundantPeerDependenciesRule,
|
|
31481
31698
|
mismatchedPeerDevVersionsRule,
|
|
31482
31699
|
peerDependencyRangeStyleRule,
|
|
@@ -31644,6 +31861,7 @@ function buildWorkspaceContext(workspace, options = {}) {
|
|
|
31644
31861
|
unusedDependencyExclude: buildUnusedDependencyExclude(options, requiredTransitivePeers),
|
|
31645
31862
|
unusedPeerDependencyExclude: buildUnusedPeerDependencyExclude(options, runtimeRootedRequired),
|
|
31646
31863
|
workspace,
|
|
31864
|
+
workspaceDirs: options.workspaceDirs ?? /* @__PURE__ */ new Map(),
|
|
31647
31865
|
workspaceNames: options.workspaceNames
|
|
31648
31866
|
};
|
|
31649
31867
|
}
|
|
@@ -31706,7 +31924,12 @@ function normalizeConfigList(values) {
|
|
|
31706
31924
|
if (!Array.isArray(values)) return [];
|
|
31707
31925
|
return values.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean);
|
|
31708
31926
|
}
|
|
31709
|
-
|
|
31927
|
+
function collectWorkspaceDirs(workspaces, options) {
|
|
31928
|
+
const dirs = new Map(options.workspaceDirs);
|
|
31929
|
+
for (const workspace of workspaces) dirs.set(workspace.name, workspace.dir);
|
|
31930
|
+
return dirs;
|
|
31931
|
+
}
|
|
31932
|
+
async function loadWorkspaceEvaluationContext(workspace, options, workspaceNames, workspaceDirs) {
|
|
31710
31933
|
const configStarted = performance.now();
|
|
31711
31934
|
const wsConfig = await loadWorkspaceCommandConfig(workspace.location, "deplint");
|
|
31712
31935
|
const rules = await loadDeplintRules(wsConfig);
|
|
@@ -31766,13 +31989,14 @@ async function loadWorkspaceEvaluationContext(workspace, options, workspaceNames
|
|
|
31766
31989
|
},
|
|
31767
31990
|
sourceExclude,
|
|
31768
31991
|
terminalOverride: wsConfig.terminal,
|
|
31992
|
+
workspaceDirs,
|
|
31769
31993
|
workspaceNames
|
|
31770
31994
|
}),
|
|
31771
31995
|
contextPhases,
|
|
31772
31996
|
rules
|
|
31773
31997
|
};
|
|
31774
31998
|
}
|
|
31775
|
-
async function evaluateWorkspace(workspace, workspaceIndex, workspaceTotal, options, workspaceNames, pass, emitProgress) {
|
|
31999
|
+
async function evaluateWorkspace(workspace, workspaceIndex, workspaceTotal, options, workspaceNames, workspaceDirs, pass, emitProgress) {
|
|
31776
32000
|
const workspaceStarted = performance.now();
|
|
31777
32001
|
const diagnostics = [];
|
|
31778
32002
|
const progressEvents = [];
|
|
@@ -31783,7 +32007,7 @@ async function evaluateWorkspace(workspace, workspaceIndex, workspaceTotal, opti
|
|
|
31783
32007
|
let rulesEvaluated = 0;
|
|
31784
32008
|
let rulesSkipped = 0;
|
|
31785
32009
|
const ruleTimings = [];
|
|
31786
|
-
const { configMs, context, contextPhases, rules } = await loadWorkspaceEvaluationContext(workspace, options, workspaceNames);
|
|
32010
|
+
const { configMs, context, contextPhases, rules } = await loadWorkspaceEvaluationContext(workspace, options, workspaceNames, workspaceDirs);
|
|
31787
32011
|
const workspaceDiagnosticStart = diagnostics.length;
|
|
31788
32012
|
progress({
|
|
31789
32013
|
context: buildWorkspaceProgressContext(context),
|
|
@@ -31911,11 +32135,12 @@ async function evaluateWorkspaces(workspaces, options, workspaceNames, pass = 1,
|
|
|
31911
32135
|
const concurrency = Math.max(1, options.jobs ?? 1);
|
|
31912
32136
|
const isEmitProgressImmediately = concurrency === 1;
|
|
31913
32137
|
const noopProgress = (_event) => void 0;
|
|
32138
|
+
const workspaceDirs = collectWorkspaceDirs(workspaces, options);
|
|
31914
32139
|
await runWithConcurrency(workspaces.map((workspace, workspaceIndex) => ({
|
|
31915
32140
|
workspace,
|
|
31916
32141
|
workspaceIndex
|
|
31917
32142
|
})), concurrency, async ({ workspace, workspaceIndex }) => {
|
|
31918
|
-
results[workspaceIndex] = await evaluateWorkspace(workspace, workspaceIndex, workspaces.length, options, workspaceNames, pass, isEmitProgressImmediately ? progress ?? noopProgress : noopProgress);
|
|
32143
|
+
results[workspaceIndex] = await evaluateWorkspace(workspace, workspaceIndex, workspaces.length, options, workspaceNames, workspaceDirs, pass, isEmitProgressImmediately ? progress ?? noopProgress : noopProgress);
|
|
31919
32144
|
});
|
|
31920
32145
|
for (const result of results) {
|
|
31921
32146
|
if (!isEmitProgressImmediately) for (const event of result.progressEvents) progress?.(event);
|
|
@@ -32049,55 +32274,6 @@ function applyDeplintFixes(diagnostics) {
|
|
|
32049
32274
|
return [...applyManifestFixes(diagnostics), ...applyConfigFixes(diagnostics)];
|
|
32050
32275
|
}
|
|
32051
32276
|
//#endregion
|
|
32052
|
-
//#region src/actions/deplint/fetchPackageManifest.ts
|
|
32053
|
-
/**
|
|
32054
|
-
* Fetches npm registry manifests for deplint's peer-dependency resolution.
|
|
32055
|
-
*
|
|
32056
|
-
* Unlike `lib/updo/fetchRegistryInfo`, which returns only version strings
|
|
32057
|
-
* and dist-tags, this helper preserves each version's `peerDependencies`
|
|
32058
|
-
* block. That's what we need to answer the question: "what's the latest
|
|
32059
|
-
* version of package X whose peer range accepts peer Y at version Z?"
|
|
32060
|
-
*
|
|
32061
|
-
* Results are cached per-process so repeated lookups within a single
|
|
32062
|
-
* deplint run hit the registry at most once per package.
|
|
32063
|
-
*/
|
|
32064
|
-
const REGISTRY_BASE = "https://registry.npmjs.org";
|
|
32065
|
-
const cache = /* @__PURE__ */ new Map();
|
|
32066
|
-
async function fetchUncached(packageName) {
|
|
32067
|
-
try {
|
|
32068
|
-
const url = `${REGISTRY_BASE}/${encodeURIComponent(packageName)}`;
|
|
32069
|
-
const res = await fetch(url, { headers: { Accept: "application/vnd.npm.install-v1+json" } });
|
|
32070
|
-
if (!res.ok) return void 0;
|
|
32071
|
-
const data = await res.json();
|
|
32072
|
-
const versionsMap = data.versions ?? {};
|
|
32073
|
-
const versions = Object.entries(versionsMap).map(([version, manifest]) => ({
|
|
32074
|
-
peerDependencies: manifest.peerDependencies ?? {},
|
|
32075
|
-
version
|
|
32076
|
-
}));
|
|
32077
|
-
return {
|
|
32078
|
-
distTags: data["dist-tags"] ?? {},
|
|
32079
|
-
versions
|
|
32080
|
-
};
|
|
32081
|
-
} catch {
|
|
32082
|
-
return;
|
|
32083
|
-
}
|
|
32084
|
-
}
|
|
32085
|
-
function fetchPackageManifest(packageName) {
|
|
32086
|
-
const existing = cache.get(packageName);
|
|
32087
|
-
if (existing) return existing;
|
|
32088
|
-
const pending = fetchUncached(packageName);
|
|
32089
|
-
cache.set(packageName, pending);
|
|
32090
|
-
return pending;
|
|
32091
|
-
}
|
|
32092
|
-
async function fetchPackageManifests(packageNames, concurrency = 16) {
|
|
32093
|
-
const unique = [...new Set(packageNames)];
|
|
32094
|
-
const results = /* @__PURE__ */ new Map();
|
|
32095
|
-
await runWithConcurrency(unique, concurrency, async (name) => {
|
|
32096
|
-
results.set(name, await fetchPackageManifest(name));
|
|
32097
|
-
});
|
|
32098
|
-
return results;
|
|
32099
|
-
}
|
|
32100
|
-
//#endregion
|
|
32101
32277
|
//#region src/actions/deplint/resolvePeerBumpFixes.ts
|
|
32102
32278
|
/**
|
|
32103
32279
|
* Resolves `resolve-peer-bump` fixes by consulting the npm registry.
|
|
@@ -32387,6 +32563,7 @@ function resolveTargetWorkspaces$1(targetPackage, inputWorkspaces) {
|
|
|
32387
32563
|
const workspaceNames = pm.name === "pnpm" ? new Set(allWorkspaces.map((ws) => ws.name)) : void 0;
|
|
32388
32564
|
const targetWorkspace = targetPackage === void 0 ? void 0 : pm.findWorkspace(targetPackage);
|
|
32389
32565
|
return {
|
|
32566
|
+
allWorkspaces,
|
|
32390
32567
|
targetWorkspaces: targetPackage === void 0 ? inputWorkspaces ?? allWorkspaces : targetWorkspace ? [targetWorkspace] : [],
|
|
32391
32568
|
workspaceNames
|
|
32392
32569
|
};
|
|
@@ -32394,7 +32571,7 @@ function resolveTargetWorkspaces$1(targetPackage, inputWorkspaces) {
|
|
|
32394
32571
|
const deplint = async ({ pkg, classifier, deps, devDeps, fix, peerDeps, profile, verbose, cliExclude, format, jobs, workspaces: inputWorkspaces }) => {
|
|
32395
32572
|
const effectiveFormat = format ?? (isJsonMode() ? "json" : "human");
|
|
32396
32573
|
const targetPackage = typeof pkg === "string" && pkg !== "undefined" && pkg.length > 0 ? pkg : void 0;
|
|
32397
|
-
const { targetWorkspaces, workspaceNames } = resolveTargetWorkspaces$1(targetPackage, inputWorkspaces);
|
|
32574
|
+
const { allWorkspaces, targetWorkspaces, workspaceNames } = resolveTargetWorkspaces$1(targetPackage, inputWorkspaces);
|
|
32398
32575
|
if (targetPackage === void 0 && inputWorkspaces !== void 0 && targetWorkspaces.length === 0) return emptyResult$7();
|
|
32399
32576
|
if (targetWorkspaces.length === 0) return missingWorkspaceResult(targetPackage);
|
|
32400
32577
|
const result = await runDeplint(targetWorkspaces, {
|
|
@@ -32408,7 +32585,8 @@ const deplint = async ({ pkg, classifier, deps, devDeps, fix, peerDeps, profile,
|
|
|
32408
32585
|
profile,
|
|
32409
32586
|
progress: effectiveFormat === "human" ? createHumanDeplintProgressReporter({ isVerbose: verbose }) : void 0,
|
|
32410
32587
|
reporter: effectiveFormat,
|
|
32411
|
-
verbose
|
|
32588
|
+
verbose,
|
|
32589
|
+
workspaceDirs: new Map(allWorkspaces.map((workspace) => [workspace.name, workspace.dir]))
|
|
32412
32590
|
}, workspaceNames);
|
|
32413
32591
|
if (!isJsonMode()) {
|
|
32414
32592
|
getDeplintReporter(effectiveFormat).render(result);
|
|
@@ -40254,22 +40432,6 @@ const copyAssets = async ({ target, pkg }) => {
|
|
|
40254
40432
|
}
|
|
40255
40433
|
};
|
|
40256
40434
|
//#endregion
|
|
40257
|
-
//#region src/actions/dead/classifyPackageVisibility.ts
|
|
40258
|
-
function isScopedPackageName(name) {
|
|
40259
|
-
return typeof name === "string" && name.startsWith("@");
|
|
40260
|
-
}
|
|
40261
|
-
function classifyPackageVisibility(manifest) {
|
|
40262
|
-
if (manifest?.private === true) return "private";
|
|
40263
|
-
const access = manifest?.publishConfig;
|
|
40264
|
-
if (typeof access === "object" && access !== null && !Array.isArray(access)) {
|
|
40265
|
-
const publishAccess = access.access;
|
|
40266
|
-
if (publishAccess === "restricted") return "restricted";
|
|
40267
|
-
if (publishAccess === "public") return "public";
|
|
40268
|
-
}
|
|
40269
|
-
if (isScopedPackageName(manifest?.name)) return "restricted";
|
|
40270
|
-
return "public";
|
|
40271
|
-
}
|
|
40272
|
-
//#endregion
|
|
40273
40435
|
//#region src/actions/dead/deprecation.ts
|
|
40274
40436
|
function getLeadingRanges(sourceFile, node) {
|
|
40275
40437
|
const ranges = [...ts.getLeadingCommentRanges(sourceFile.text, node.pos) ?? [], ...ts.getLeadingCommentRanges(sourceFile.text, node.getFullStart()) ?? []];
|