@ariestools/toolchain 8.7.14 → 8.7.16
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/api-exposure/analyzer/analyzePackage.d.ts +2 -1
- package/dist/actions/api-exposure/analyzer/analyzePackage.d.ts.map +1 -1
- package/dist/actions/api-exposure/analyzer/placement.d.ts +24 -0
- package/dist/actions/api-exposure/analyzer/placement.d.ts.map +1 -0
- package/dist/actions/api-exposure/apiExposure.d.ts.map +1 -1
- package/dist/actions/api-exposure/reporters.d.ts.map +1 -1
- package/dist/actions/api-exposure/types.d.ts +9 -0
- package/dist/actions/api-exposure/types.d.ts.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.d.ts +1 -1
- package/dist/actions/deplint/checkPackage/getUnsatisfiedPeerDependencies.d.ts.map +1 -1
- package/dist/actions/deplint/engine.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/packagePolicy.d.ts +14 -0
- package/dist/actions/deplint/packagePolicy.d.ts.map +1 -0
- package/dist/actions/deplint/rules.d.ts.map +1 -1
- package/dist/actions/deplint/snapshot.d.ts +5 -1
- package/dist/actions/deplint/snapshot.d.ts.map +1 -1
- package/dist/actions/deplint/types.d.ts +8 -4
- package/dist/actions/deplint/types.d.ts.map +1 -1
- package/dist/actions/package/compile/ApiExposureConfig.d.ts +1 -1
- package/dist/actions/package/compile/XyConfig.d.ts +22 -2
- package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/lint-verbose.mjs.map +1 -1
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/bin/package/sync-layout.mjs.map +1 -1
- package/dist/bin/run-or-exec.mjs.map +1 -1
- package/dist/bin/skills.mjs +275 -298
- package/dist/bin/skills.mjs.map +1 -1
- package/dist/bin/source-map-explorer.mjs.map +1 -1
- package/dist/bin/xy.mjs +120 -25
- package/dist/bin/xy.mjs.map +1 -1
- package/package.json +7 -7
package/dist/bin/xy.mjs
CHANGED
|
@@ -24961,6 +24961,24 @@ function getImportedPackages(program, workspaceDir) {
|
|
|
24961
24961
|
};
|
|
24962
24962
|
}
|
|
24963
24963
|
//#endregion
|
|
24964
|
+
//#region src/actions/api-exposure/analyzer/placement.ts
|
|
24965
|
+
/**
|
|
24966
|
+
* Whether deplint can require a local runtime-section placement for this
|
|
24967
|
+
* assessment. A dependency already listed in a runtime section is locally
|
|
24968
|
+
* owned. Otherwise it is actionable only when this package names it directly,
|
|
24969
|
+
* an override explicitly claims it, or `peerForwarding: "always"` deliberately
|
|
24970
|
+
* forwards its inherited peer contract. Type-checker findings that merely
|
|
24971
|
+
* trace through another package remain useful exposure evidence, but that
|
|
24972
|
+
* provider owns their manifest placement.
|
|
24973
|
+
*/
|
|
24974
|
+
function isPlacementActionable({ config, currentSection, dependency, importedPackages, recommendationSource, requiredPeerSources }) {
|
|
24975
|
+
if (currentSection === "dependencies" || currentSection === "dependencies+peerDependencies") return true;
|
|
24976
|
+
if (recommendationSource === "override" || recommendationSource === "workspace-internal") return true;
|
|
24977
|
+
if (importedPackages === void 0) return true;
|
|
24978
|
+
if (importedPackages.value.has(dependency) || importedPackages.typeOnly.has(dependency)) return true;
|
|
24979
|
+
return config.peerForwarding === "always" && requiredPeerSources.has(dependency);
|
|
24980
|
+
}
|
|
24981
|
+
//#endregion
|
|
24964
24982
|
//#region src/actions/api-exposure/analyzer/program.ts
|
|
24965
24983
|
function createSharedProgramCache() {
|
|
24966
24984
|
return { sourceFiles: /* @__PURE__ */ new Map() };
|
|
@@ -25258,6 +25276,14 @@ function assessDependency({ config, dependency, importedPackages, isSelfOrIntern
|
|
|
25258
25276
|
dependency,
|
|
25259
25277
|
findings,
|
|
25260
25278
|
installStrategy,
|
|
25279
|
+
placementActionable: isPlacementActionable({
|
|
25280
|
+
config,
|
|
25281
|
+
currentSection: currentSectionOf(dependency, sections),
|
|
25282
|
+
dependency,
|
|
25283
|
+
importedPackages,
|
|
25284
|
+
recommendationSource,
|
|
25285
|
+
requiredPeerSources
|
|
25286
|
+
}),
|
|
25261
25287
|
recommendation,
|
|
25262
25288
|
recommendationSource,
|
|
25263
25289
|
treeShakingModifier: score.treeShakingModifier
|
|
@@ -25347,6 +25373,26 @@ function analyzeWorkspaceApiExposure({ cache, config, isTerminal, refTypes, work
|
|
|
25347
25373
|
};
|
|
25348
25374
|
}
|
|
25349
25375
|
//#endregion
|
|
25376
|
+
//#region src/actions/deplint/packagePolicy.ts
|
|
25377
|
+
/**
|
|
25378
|
+
* Resolves the public package config into independent placement and presence
|
|
25379
|
+
* policies. Deprecated `refType` retains its historical vouching behavior;
|
|
25380
|
+
* new `placement` entries default to inferred presence.
|
|
25381
|
+
*/
|
|
25382
|
+
function normalizeDeplintPackagePolicy(config) {
|
|
25383
|
+
const placement = config.placement ?? config.refType;
|
|
25384
|
+
const presence = config.presence ?? (config.refType !== void 0 || config.placement === void 0 && config.peerOptional !== void 0 ? "allowed" : "inferred");
|
|
25385
|
+
if (presence === "required" && placement === void 0) throw new TypeError("Deplint package config with presence \"required\" must also define placement");
|
|
25386
|
+
return {
|
|
25387
|
+
...config.peerOptional !== void 0 && { peerOptional: config.peerOptional },
|
|
25388
|
+
...placement !== void 0 && { placement },
|
|
25389
|
+
presence
|
|
25390
|
+
};
|
|
25391
|
+
}
|
|
25392
|
+
function normalizeDeplintPackagePolicies(packages = {}) {
|
|
25393
|
+
return new Map(Object.entries(packages).map(([name, config]) => [name, normalizeDeplintPackagePolicy(config)]));
|
|
25394
|
+
}
|
|
25395
|
+
//#endregion
|
|
25350
25396
|
//#region src/actions/api-exposure/reporters.ts
|
|
25351
25397
|
function bandIndex(band) {
|
|
25352
25398
|
return AEI_BAND_ORDER.indexOf(band);
|
|
@@ -25359,7 +25405,8 @@ function bandIndex(band) {
|
|
|
25359
25405
|
* when both `dependencies` and `peerDependencies` list the package.
|
|
25360
25406
|
*/
|
|
25361
25407
|
function isMismatch(assessment) {
|
|
25362
|
-
const { currentSection, recommendation } = assessment;
|
|
25408
|
+
const { currentSection, placementActionable, recommendation } = assessment;
|
|
25409
|
+
if (placementActionable === false) return false;
|
|
25363
25410
|
if (recommendation === "review") return false;
|
|
25364
25411
|
if (recommendation === "peer-with-default") return currentSection !== "dependencies+peerDependencies";
|
|
25365
25412
|
if (bandIndex(recommendation) > bandIndex("review")) return currentSection !== "peerDependencies";
|
|
@@ -25382,7 +25429,8 @@ function renderAssessment(assessment, verbose) {
|
|
|
25382
25429
|
const mismatch = isMismatch(assessment) ? ` ${chalk.red("MISMATCH")}` : "";
|
|
25383
25430
|
const source = assessment.recommendationSource === "score" ? "" : ` [${assessment.recommendationSource}]`;
|
|
25384
25431
|
const strategy = assessment.installStrategy === void 0 ? "" : chalk.dim(` strategy=${assessment.installStrategy}`);
|
|
25385
|
-
|
|
25432
|
+
const placement = assessment.placementActionable === false ? chalk.dim(" placement=transitive") : "";
|
|
25433
|
+
console.log(` ${chalk.bold(assessment.dependency)} ${formatScore(assessment)} → ${color(assessment.recommendation)} (currently: ${assessment.currentSection})${source}${strategy}${placement}${mismatch}`);
|
|
25386
25434
|
if (!(verbose || isMismatch(assessment) || assessment.recommendation === "review")) return;
|
|
25387
25435
|
for (const finding of assessment.findings) {
|
|
25388
25436
|
const weight = finding.infinite ? " ∞" : `+${finding.weight}`.padStart(4);
|
|
@@ -25421,7 +25469,7 @@ function resolveTargetWorkspaces$1(targetPackage, inputWorkspaces) {
|
|
|
25421
25469
|
};
|
|
25422
25470
|
}
|
|
25423
25471
|
function refTypesFromDeplintConfig(deplintConfig) {
|
|
25424
|
-
return new Map(
|
|
25472
|
+
return new Map([...normalizeDeplintPackagePolicies(deplintConfig.packages)].flatMap(([name, policy]) => policy.placement === void 0 ? [] : [[name, policy.placement]]));
|
|
25425
25473
|
}
|
|
25426
25474
|
async function loadNormalizedConfig(workspaceLocation) {
|
|
25427
25475
|
const apiExposureConfig = await loadWorkspaceCommandConfig(workspaceLocation, "apiExposure");
|
|
@@ -29600,7 +29648,7 @@ function isDistTypeImportListed(imp, name, dependencies, devDependencies, peerDe
|
|
|
29600
29648
|
* package. External (non-workspace) runtime deps default to peers so
|
|
29601
29649
|
* consumers are in control of the version. Workspace-internal deps stay
|
|
29602
29650
|
* as regular dependencies. Callers are expected to already have excluded
|
|
29603
|
-
* forceDeps (
|
|
29651
|
+
* forceDeps (`placement: "dep"` or legacy `refType`) and terminal packages. The `currentPeers`
|
|
29604
29652
|
* and `distImports` parameters are retained for future heuristics (e.g.
|
|
29605
29653
|
* promoting only when an import shares peers with existing peerDeps) but
|
|
29606
29654
|
* are not required to trigger promotion under the external-default rule.
|
|
@@ -30029,7 +30077,7 @@ function resolvedAddFix(context, dependency, section, detail, isOptional) {
|
|
|
30029
30077
|
action: "add",
|
|
30030
30078
|
dependency,
|
|
30031
30079
|
detail,
|
|
30032
|
-
...section === "peerDependencies" && isOptional !== void 0 && { isOptional },
|
|
30080
|
+
...section === "peerDependencies" && isOptional !== void 0 && { optional: isOptional },
|
|
30033
30081
|
section,
|
|
30034
30082
|
version
|
|
30035
30083
|
};
|
|
@@ -30060,21 +30108,21 @@ function evaluateMisplacedPeer(context, dep, version) {
|
|
|
30060
30108
|
if (context.forceDeps.has(dep)) return {
|
|
30061
30109
|
alreadyInTarget: context.packageParams.dependencies.includes(dep),
|
|
30062
30110
|
dep,
|
|
30063
|
-
message: `peerDependency ${dep} should be a dependency — configured
|
|
30111
|
+
message: `peerDependency ${dep} should be a dependency — configured placement is "dep"`,
|
|
30064
30112
|
mode: "to-dep",
|
|
30065
30113
|
version
|
|
30066
30114
|
};
|
|
30067
30115
|
if (context.forceDevs.has(dep)) return {
|
|
30068
30116
|
alreadyInTarget: context.packageParams.devDependencies.includes(dep),
|
|
30069
30117
|
dep,
|
|
30070
|
-
message: `peerDependency ${dep} should be a devDependency — configured
|
|
30118
|
+
message: `peerDependency ${dep} should be a devDependency — configured placement is "dev"`,
|
|
30071
30119
|
mode: "to-dev",
|
|
30072
30120
|
version
|
|
30073
30121
|
};
|
|
30074
30122
|
if ((context.workspaceNames?.has(dep) ?? false) && !context.forcePeers.has(dep) && !context.forcePeerWithDefault.has(dep)) return {
|
|
30075
30123
|
alreadyInTarget: context.packageParams.dependencies.includes(dep),
|
|
30076
30124
|
dep,
|
|
30077
|
-
message: `peerDependency ${dep} should be a dependency — sibling workspace packages ship in lockstep; set
|
|
30125
|
+
message: `peerDependency ${dep} should be a dependency — sibling workspace packages ship in lockstep; set placement "peer" in xy.config.ts to override`,
|
|
30078
30126
|
mode: "to-dep",
|
|
30079
30127
|
version
|
|
30080
30128
|
};
|
|
@@ -30116,7 +30164,7 @@ const misplacedDependenciesRule = {
|
|
|
30116
30164
|
mode: "to-dev"
|
|
30117
30165
|
},
|
|
30118
30166
|
dependency: dep,
|
|
30119
|
-
message: `dependency ${dep} should be a devDependency — configured
|
|
30167
|
+
message: `dependency ${dep} should be a devDependency — configured placement is "dev"`
|
|
30120
30168
|
});
|
|
30121
30169
|
continue;
|
|
30122
30170
|
}
|
|
@@ -30136,7 +30184,7 @@ const misplacedDependenciesRule = {
|
|
|
30136
30184
|
continue;
|
|
30137
30185
|
}
|
|
30138
30186
|
if (context.forcePeers.has(dep) || context.classifyDependency(dep) === "peer") {
|
|
30139
|
-
const reason = context.forcePeers.has(dep) ? "configured
|
|
30187
|
+
const reason = context.forcePeers.has(dep) ? "configured placement is \"peer\"" : "external runtime dep — consumers should control the version";
|
|
30140
30188
|
context.report({
|
|
30141
30189
|
data: {
|
|
30142
30190
|
dep,
|
|
@@ -30339,6 +30387,54 @@ function resolveAddVersionForSection(context, dependency, section, sourceRange)
|
|
|
30339
30387
|
if (section === "peerDependencies") return resolvePeerVersionForFix(context.workspace.location, dependency, context.packageParams.devDependencyVersions[dependency] ?? sourceRange, context.peerRangeForm, context.peerRangeBound);
|
|
30340
30388
|
return resolveExpectedDependencyVersion(context.workspace.location, dependency, sourceRange);
|
|
30341
30389
|
}
|
|
30390
|
+
function requiredSectionsToAdd(context, dependency, placement) {
|
|
30391
|
+
const inDependencies = context.packageParams.dependencies.includes(dependency);
|
|
30392
|
+
const inDevDependencies = context.packageParams.devDependencies.includes(dependency);
|
|
30393
|
+
const inPeerDependencies = context.packageParams.peerDependencies.includes(dependency);
|
|
30394
|
+
switch (placement) {
|
|
30395
|
+
case "dep":
|
|
30396
|
+
if (inDependencies || inPeerDependencies) return [];
|
|
30397
|
+
return ["dependencies"];
|
|
30398
|
+
case "dev":
|
|
30399
|
+
if (inDevDependencies || inDependencies || inPeerDependencies) return [];
|
|
30400
|
+
return ["devDependencies"];
|
|
30401
|
+
case "peer":
|
|
30402
|
+
if (inDependencies) return [];
|
|
30403
|
+
return [...inPeerDependencies ? [] : ["peerDependencies"], ...inDevDependencies ? [] : ["devDependencies"]];
|
|
30404
|
+
case "peer-with-default":
|
|
30405
|
+
if (inDependencies || inPeerDependencies) return [];
|
|
30406
|
+
return ["dependencies", "peerDependencies"];
|
|
30407
|
+
}
|
|
30408
|
+
}
|
|
30409
|
+
const requiredPackagesRule = {
|
|
30410
|
+
category: "workspace",
|
|
30411
|
+
id: "dep.package.required",
|
|
30412
|
+
meta: {
|
|
30413
|
+
description: "Packages configured with required presence must be declared",
|
|
30414
|
+
fixable: ["manifest"],
|
|
30415
|
+
severity: "error"
|
|
30416
|
+
},
|
|
30417
|
+
evaluate(context) {
|
|
30418
|
+
for (const [dependency, placement] of context.requiredPackages) {
|
|
30419
|
+
const sections = requiredSectionsToAdd(context, dependency, placement);
|
|
30420
|
+
if (sections.length === 0) continue;
|
|
30421
|
+
context.report({
|
|
30422
|
+
data: {
|
|
30423
|
+
dependency,
|
|
30424
|
+
sections
|
|
30425
|
+
},
|
|
30426
|
+
dependency,
|
|
30427
|
+
message: `Required package ${dependency} is missing from ${sections.join(" and ")}`
|
|
30428
|
+
});
|
|
30429
|
+
}
|
|
30430
|
+
},
|
|
30431
|
+
resolveFixes(diagnostic, context) {
|
|
30432
|
+
const data = diagnostic.data;
|
|
30433
|
+
if (!data) return [];
|
|
30434
|
+
const optional = resolvePromotedPeerOptional(context, data.dependency);
|
|
30435
|
+
return data.sections.map((section) => resolvedAddFix(context, data.dependency, section, `added required package to ${section}`, section === "peerDependencies" ? optional : void 0));
|
|
30436
|
+
}
|
|
30437
|
+
};
|
|
30342
30438
|
const unlistedDependenciesRule = {
|
|
30343
30439
|
category: "dependencies",
|
|
30344
30440
|
id: "dep.dependencies.unlisted",
|
|
@@ -30831,6 +30927,7 @@ function expectedPeerRangeStyle(context, dep, devRange, peerRange, form, boundTy
|
|
|
30831
30927
|
const builtInDeplintPlugin = {
|
|
30832
30928
|
name: "builtin",
|
|
30833
30929
|
rules: [
|
|
30930
|
+
requiredPackagesRule,
|
|
30834
30931
|
unlistedDependenciesRule,
|
|
30835
30932
|
unusedDependenciesRule,
|
|
30836
30933
|
misplacedDependenciesRule,
|
|
@@ -30899,21 +30996,14 @@ function buildUnusedDependencyExclude(options, requiredTransitivePeers) {
|
|
|
30899
30996
|
return /* @__PURE__ */ new Set([
|
|
30900
30997
|
...options.exclude ?? [],
|
|
30901
30998
|
...requiredTransitivePeers,
|
|
30902
|
-
...options.
|
|
30903
|
-
...options.forceDevs ?? [],
|
|
30904
|
-
...options.forcePeers ?? [],
|
|
30905
|
-
...options.forcePeerWithDefault ?? [],
|
|
30906
|
-
...options.forcePeerOptional?.keys() ?? []
|
|
30999
|
+
...options.allowedPackages ?? []
|
|
30907
31000
|
]);
|
|
30908
31001
|
}
|
|
30909
31002
|
function buildUnusedPeerDependencyExclude(options, runtimeRootedRequired) {
|
|
30910
31003
|
return /* @__PURE__ */ new Set([
|
|
30911
31004
|
...options.exclude ?? [],
|
|
30912
31005
|
...runtimeRootedRequired,
|
|
30913
|
-
...options.
|
|
30914
|
-
...options.forcePeers ?? [],
|
|
30915
|
-
...options.forcePeerWithDefault ?? [],
|
|
30916
|
-
...options.forcePeerOptional?.keys() ?? []
|
|
31006
|
+
...options.allowedPackages ?? []
|
|
30917
31007
|
]);
|
|
30918
31008
|
}
|
|
30919
31009
|
const sharedAeiProgramCache = createSharedProgramCache();
|
|
@@ -31017,6 +31107,7 @@ function buildWorkspaceContext(workspace, options = {}) {
|
|
|
31017
31107
|
peerForwarding,
|
|
31018
31108
|
peerRangeBound: options.peerRangeBound,
|
|
31019
31109
|
peerRangeForm: options.peerRangeForm ?? "shorthand",
|
|
31110
|
+
requiredPackages: options.requiredPackages ?? /* @__PURE__ */ new Map(),
|
|
31020
31111
|
sourceParams,
|
|
31021
31112
|
sourceExclude: sourceExclude ?? [],
|
|
31022
31113
|
unusedDependencyExclude: buildUnusedDependencyExclude(options, requiredTransitivePeers),
|
|
@@ -31092,13 +31183,15 @@ async function loadWorkspaceEvaluationContext(workspace, options, workspaceNames
|
|
|
31092
31183
|
const configuredExclude = normalizeConfigList(wsConfig.exclude);
|
|
31093
31184
|
const cliExclude = normalizeConfigList(options.cliExclude);
|
|
31094
31185
|
const sourceExclude = [...configuredExclude, ...cliExclude];
|
|
31095
|
-
const packageEntries =
|
|
31096
|
-
const forceDeps = new Set(packageEntries.filter(([,
|
|
31097
|
-
const forceDevs = new Set(packageEntries.filter(([,
|
|
31098
|
-
const forcePeers = new Set(packageEntries.filter(([,
|
|
31099
|
-
const forcePeerWithDefault = new Set(packageEntries.filter(([,
|
|
31186
|
+
const packageEntries = normalizeDeplintPackagePolicies(wsConfig.packages).entries().toArray();
|
|
31187
|
+
const forceDeps = new Set(packageEntries.filter(([, policy]) => policy.placement === "dep").map(([name]) => name));
|
|
31188
|
+
const forceDevs = new Set(packageEntries.filter(([, policy]) => policy.placement === "dev").map(([name]) => name));
|
|
31189
|
+
const forcePeers = new Set(packageEntries.filter(([, policy]) => policy.placement === "peer").map(([name]) => name));
|
|
31190
|
+
const forcePeerWithDefault = new Set(packageEntries.filter(([, policy]) => policy.placement === "peer-with-default").map(([name]) => name));
|
|
31191
|
+
const allowedPackages = new Set(packageEntries.filter(([, policy]) => policy.presence !== "inferred").map(([name]) => name));
|
|
31192
|
+
const requiredPackages = new Map(packageEntries.flatMap(([name, policy]) => policy.presence === "required" && policy.placement !== void 0 ? [[name, policy.placement]] : []));
|
|
31100
31193
|
const forcePeerOptional = /* @__PURE__ */ new Map();
|
|
31101
|
-
for (const [name,
|
|
31194
|
+
for (const [name, policy] of packageEntries) if (typeof policy.peerOptional === "boolean") forcePeerOptional.set(name, policy.peerOptional);
|
|
31102
31195
|
const rangeStyleOptions = rules.find((rule) => rule.id === "dep.peerDependencies.range-style")?.options ?? {};
|
|
31103
31196
|
const peerRangeForm = resolvePeerRangeFormOption(rangeStyleOptions);
|
|
31104
31197
|
const peerRangeBound = resolvePeerRangeBoundOption(rangeStyleOptions);
|
|
@@ -31111,6 +31204,7 @@ async function loadWorkspaceEvaluationContext(workspace, options, workspaceNames
|
|
|
31111
31204
|
return {
|
|
31112
31205
|
configMs,
|
|
31113
31206
|
context: buildWorkspaceContext(workspace, {
|
|
31207
|
+
allowedPackages,
|
|
31114
31208
|
apiExposureConfig,
|
|
31115
31209
|
classifier,
|
|
31116
31210
|
forceDeps,
|
|
@@ -31121,6 +31215,7 @@ async function loadWorkspaceEvaluationContext(workspace, options, workspaceNames
|
|
|
31121
31215
|
peerRangeBound,
|
|
31122
31216
|
peerRangeForm,
|
|
31123
31217
|
phases: options.profile === true ? contextPhases : void 0,
|
|
31218
|
+
requiredPackages,
|
|
31124
31219
|
sourceExclude,
|
|
31125
31220
|
terminalOverride: wsConfig.terminal,
|
|
31126
31221
|
workspaceNames
|