@ariestools/toolchain 8.7.13 → 8.7.15
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/apiExposure.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/lintNextRun.d.ts.map +1 -1
- package/dist/actions/lintNextWorker.d.ts +3 -1
- package/dist/actions/lintNextWorker.d.ts.map +1 -1
- package/dist/actions/lintlintGitignore.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/xy.mjs +203 -45
- package/dist/bin/xy.mjs.map +1 -1
- package/package.json +4 -4
package/dist/bin/xy.mjs
CHANGED
|
@@ -25347,6 +25347,26 @@ function analyzeWorkspaceApiExposure({ cache, config, isTerminal, refTypes, work
|
|
|
25347
25347
|
};
|
|
25348
25348
|
}
|
|
25349
25349
|
//#endregion
|
|
25350
|
+
//#region src/actions/deplint/packagePolicy.ts
|
|
25351
|
+
/**
|
|
25352
|
+
* Resolves the public package config into independent placement and presence
|
|
25353
|
+
* policies. Deprecated `refType` retains its historical vouching behavior;
|
|
25354
|
+
* new `placement` entries default to inferred presence.
|
|
25355
|
+
*/
|
|
25356
|
+
function normalizeDeplintPackagePolicy(config) {
|
|
25357
|
+
const placement = config.placement ?? config.refType;
|
|
25358
|
+
const presence = config.presence ?? (config.refType !== void 0 || config.placement === void 0 && config.peerOptional !== void 0 ? "allowed" : "inferred");
|
|
25359
|
+
if (presence === "required" && placement === void 0) throw new TypeError("Deplint package config with presence \"required\" must also define placement");
|
|
25360
|
+
return {
|
|
25361
|
+
...config.peerOptional !== void 0 && { peerOptional: config.peerOptional },
|
|
25362
|
+
...placement !== void 0 && { placement },
|
|
25363
|
+
presence
|
|
25364
|
+
};
|
|
25365
|
+
}
|
|
25366
|
+
function normalizeDeplintPackagePolicies(packages = {}) {
|
|
25367
|
+
return new Map(Object.entries(packages).map(([name, config]) => [name, normalizeDeplintPackagePolicy(config)]));
|
|
25368
|
+
}
|
|
25369
|
+
//#endregion
|
|
25350
25370
|
//#region src/actions/api-exposure/reporters.ts
|
|
25351
25371
|
function bandIndex(band) {
|
|
25352
25372
|
return AEI_BAND_ORDER.indexOf(band);
|
|
@@ -25421,7 +25441,7 @@ function resolveTargetWorkspaces$1(targetPackage, inputWorkspaces) {
|
|
|
25421
25441
|
};
|
|
25422
25442
|
}
|
|
25423
25443
|
function refTypesFromDeplintConfig(deplintConfig) {
|
|
25424
|
-
return new Map(
|
|
25444
|
+
return new Map([...normalizeDeplintPackagePolicies(deplintConfig.packages)].flatMap(([name, policy]) => policy.placement === void 0 ? [] : [[name, policy.placement]]));
|
|
25425
25445
|
}
|
|
25426
25446
|
async function loadNormalizedConfig(workspaceLocation) {
|
|
25427
25447
|
const apiExposureConfig = await loadWorkspaceCommandConfig(workspaceLocation, "apiExposure");
|
|
@@ -26233,6 +26253,7 @@ function collectExternalUsage(folderRoots, targetPackageNames) {
|
|
|
26233
26253
|
//#endregion
|
|
26234
26254
|
//#region src/actions/lintlintGitignore.ts
|
|
26235
26255
|
const GITIGNORE_NAME = "XY repository .gitignore";
|
|
26256
|
+
const GITIGNORE_ENVIRONMENT_VARIABLE = "XY_LINT_GITIGNORE";
|
|
26236
26257
|
function parseConfig(source) {
|
|
26237
26258
|
return ts.createSourceFile("eslint.config.ts", source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
26238
26259
|
}
|
|
@@ -26251,6 +26272,44 @@ function importedReference(sourceFile, moduleSpecifier, importedName) {
|
|
|
26251
26272
|
for (const specifier of bindings.elements) if ((specifier.propertyName?.text ?? specifier.name.text) === importedName) return specifier.name.text;
|
|
26252
26273
|
}
|
|
26253
26274
|
}
|
|
26275
|
+
function addBindingNames(name, names) {
|
|
26276
|
+
if (ts.isIdentifier(name)) {
|
|
26277
|
+
names.add(name.text);
|
|
26278
|
+
return;
|
|
26279
|
+
}
|
|
26280
|
+
for (const element of name.elements) if (!ts.isOmittedExpression(element)) addBindingNames(element.name, names);
|
|
26281
|
+
}
|
|
26282
|
+
function topLevelBindingNames(sourceFile) {
|
|
26283
|
+
const names = /* @__PURE__ */ new Set();
|
|
26284
|
+
for (const statement of sourceFile.statements) {
|
|
26285
|
+
if (ts.isImportDeclaration(statement)) {
|
|
26286
|
+
const clause = statement.importClause;
|
|
26287
|
+
if (clause?.name !== void 0) names.add(clause.name.text);
|
|
26288
|
+
const bindings = clause?.namedBindings;
|
|
26289
|
+
if (bindings !== void 0 && ts.isNamespaceImport(bindings)) names.add(bindings.name.text);
|
|
26290
|
+
if (bindings !== void 0 && ts.isNamedImports(bindings)) for (const element of bindings.elements) names.add(element.name.text);
|
|
26291
|
+
continue;
|
|
26292
|
+
}
|
|
26293
|
+
if (ts.isVariableStatement(statement)) {
|
|
26294
|
+
for (const declaration of statement.declarationList.declarations) addBindingNames(declaration.name, names);
|
|
26295
|
+
continue;
|
|
26296
|
+
}
|
|
26297
|
+
if ((ts.isClassDeclaration(statement) || ts.isEnumDeclaration(statement) || ts.isFunctionDeclaration(statement)) && statement.name !== void 0) names.add(statement.name.text);
|
|
26298
|
+
}
|
|
26299
|
+
return names;
|
|
26300
|
+
}
|
|
26301
|
+
function uniqueImportReference(sourceFile, importedName) {
|
|
26302
|
+
const names = topLevelBindingNames(sourceFile);
|
|
26303
|
+
if (!names.has(importedName)) return importedName;
|
|
26304
|
+
const base = `xy${importedName[0]?.toUpperCase() ?? ""}${importedName.slice(1)}`;
|
|
26305
|
+
let candidate = base;
|
|
26306
|
+
let suffix = 2;
|
|
26307
|
+
while (names.has(candidate)) {
|
|
26308
|
+
candidate = `${base}${suffix}`;
|
|
26309
|
+
suffix++;
|
|
26310
|
+
}
|
|
26311
|
+
return candidate;
|
|
26312
|
+
}
|
|
26254
26313
|
function variableInitializers(sourceFile) {
|
|
26255
26314
|
const initializers = /* @__PURE__ */ new Map();
|
|
26256
26315
|
for (const statement of sourceFile.statements) {
|
|
@@ -26307,18 +26366,12 @@ function isRequiredGitignoreCall(node, includeReference, sourceFile, initializer
|
|
|
26307
26366
|
const [ignorePath, options] = node.arguments;
|
|
26308
26367
|
return ignorePath !== void 0 && expressionReferencesGitignore(ignorePath, sourceFile, initializers) && enablesGitignoreResolution(options);
|
|
26309
26368
|
}
|
|
26310
|
-
function
|
|
26311
|
-
|
|
26312
|
-
const includeReference = importedReference(sourceFile, "eslint/config", "includeIgnoreFile");
|
|
26313
|
-
const configArray = findConfigArray(sourceFile);
|
|
26314
|
-
if (includeReference === void 0 || configArray === void 0) return false;
|
|
26315
|
-
const resolvedIncludeReference = includeReference;
|
|
26316
|
-
const initializers = variableInitializers(sourceFile);
|
|
26317
|
-
let found = false;
|
|
26369
|
+
function findRequiredGitignoreCall(configArray, includeReference, sourceFile, initializers) {
|
|
26370
|
+
let found;
|
|
26318
26371
|
function visit(node) {
|
|
26319
|
-
if (found) return;
|
|
26320
|
-
if (isRequiredGitignoreCall(node,
|
|
26321
|
-
found =
|
|
26372
|
+
if (found !== void 0) return;
|
|
26373
|
+
if (isRequiredGitignoreCall(node, includeReference, sourceFile, initializers)) {
|
|
26374
|
+
found = node;
|
|
26322
26375
|
return;
|
|
26323
26376
|
}
|
|
26324
26377
|
ts.forEachChild(node, visit);
|
|
@@ -26326,11 +26379,36 @@ function hasGitignoreConfig(source) {
|
|
|
26326
26379
|
visit(configArray);
|
|
26327
26380
|
return found;
|
|
26328
26381
|
}
|
|
26329
|
-
function
|
|
26382
|
+
function isGitignoreControlCondition(expression, sourceFile) {
|
|
26383
|
+
const compact = expression.getText(sourceFile).replaceAll(/\s/g, "");
|
|
26384
|
+
return [
|
|
26385
|
+
`globalThis.process.env.${GITIGNORE_ENVIRONMENT_VARIABLE}==='false'`,
|
|
26386
|
+
`'false'===globalThis.process.env.${GITIGNORE_ENVIRONMENT_VARIABLE}`,
|
|
26387
|
+
`process.env.${GITIGNORE_ENVIRONMENT_VARIABLE}==='false'`,
|
|
26388
|
+
`'false'===process.env.${GITIGNORE_ENVIRONMENT_VARIABLE}`
|
|
26389
|
+
].includes(compact);
|
|
26390
|
+
}
|
|
26391
|
+
function isControlledGitignoreCall(call, configArray, sourceFile) {
|
|
26392
|
+
let current = call;
|
|
26393
|
+
while (current !== configArray && current.parent !== void 0) {
|
|
26394
|
+
current = current.parent;
|
|
26395
|
+
if (ts.isConditionalExpression(current) && isGitignoreControlCondition(current.condition, sourceFile)) return true;
|
|
26396
|
+
}
|
|
26397
|
+
return false;
|
|
26398
|
+
}
|
|
26399
|
+
function hasGitignoreConfig(source) {
|
|
26400
|
+
const sourceFile = parseConfig(source);
|
|
26401
|
+
const includeReference = importedReference(sourceFile, "eslint/config", "includeIgnoreFile");
|
|
26402
|
+
const configArray = findConfigArray(sourceFile);
|
|
26403
|
+
if (includeReference === void 0 || configArray === void 0) return false;
|
|
26404
|
+
const call = findRequiredGitignoreCall(configArray, includeReference, sourceFile, variableInitializers(sourceFile));
|
|
26405
|
+
return call !== void 0 && isControlledGitignoreCall(call, configArray, sourceFile);
|
|
26406
|
+
}
|
|
26407
|
+
function updateNamedImport(declaration, importedName, referenceName, sourceFile) {
|
|
26330
26408
|
const clause = declaration.importClause;
|
|
26331
26409
|
const bindings = clause?.namedBindings;
|
|
26332
26410
|
const elements = bindings !== void 0 && ts.isNamedImports(bindings) ? [...bindings.elements] : [];
|
|
26333
|
-
const namedImports = ts.factory.createNamedImports([...elements, ts.factory.createImportSpecifier(false, void 0
|
|
26411
|
+
const namedImports = ts.factory.createNamedImports([...elements, ts.factory.createImportSpecifier(false, importedName === referenceName ? void 0 : ts.factory.createIdentifier(importedName), ts.factory.createIdentifier(referenceName))]);
|
|
26334
26412
|
const updatedClause = ts.factory.updateImportClause(clause ?? ts.factory.createImportClause(false, void 0, namedImports), false, clause?.name, namedImports);
|
|
26335
26413
|
const updated = ts.factory.updateImportDeclaration(declaration, declaration.modifiers, updatedClause, declaration.moduleSpecifier, declaration.attributes);
|
|
26336
26414
|
const printer = ts.createPrinter({
|
|
@@ -26346,17 +26424,19 @@ function updateNamedImport(declaration, importedName, sourceFile) {
|
|
|
26346
26424
|
function resolveImportReference(sourceFile, moduleSpecifier, importedName, newImports) {
|
|
26347
26425
|
const existingReference = importedReference(sourceFile, moduleSpecifier, importedName);
|
|
26348
26426
|
if (existingReference !== void 0) return { reference: existingReference };
|
|
26427
|
+
const referenceName = uniqueImportReference(sourceFile, importedName);
|
|
26349
26428
|
for (const declaration of importDeclarations(sourceFile)) {
|
|
26350
26429
|
if (moduleName(declaration) !== moduleSpecifier || declaration.importClause?.isTypeOnly === true) continue;
|
|
26351
26430
|
const bindings = declaration.importClause?.namedBindings;
|
|
26352
26431
|
if (bindings !== void 0 && ts.isNamespaceImport(bindings)) return { reference: `${bindings.name.text}.${importedName}` };
|
|
26353
26432
|
return {
|
|
26354
|
-
edit: updateNamedImport(declaration, importedName, sourceFile),
|
|
26355
|
-
reference:
|
|
26433
|
+
edit: updateNamedImport(declaration, importedName, referenceName, sourceFile),
|
|
26434
|
+
reference: referenceName
|
|
26356
26435
|
};
|
|
26357
26436
|
}
|
|
26358
|
-
|
|
26359
|
-
|
|
26437
|
+
const importedBinding = importedName === referenceName ? importedName : `${importedName} as ${referenceName}`;
|
|
26438
|
+
newImports.push(`import { ${importedBinding} } from '${moduleSpecifier}'`);
|
|
26439
|
+
return { reference: referenceName };
|
|
26360
26440
|
}
|
|
26361
26441
|
function newImportsEdit(sourceFile, imports) {
|
|
26362
26442
|
if (imports.length === 0) return void 0;
|
|
@@ -26378,12 +26458,26 @@ function lineIndent(source, position) {
|
|
|
26378
26458
|
}
|
|
26379
26459
|
function gitignoreConfigEntryLines(indent, includeReference = "includeIgnoreFile", fileUrlReference = "fileURLToPath") {
|
|
26380
26460
|
return [
|
|
26381
|
-
`${indent}
|
|
26382
|
-
`${indent}
|
|
26383
|
-
`${indent}
|
|
26384
|
-
`${indent}
|
|
26461
|
+
`${indent}globalThis.process.env.${GITIGNORE_ENVIRONMENT_VARIABLE} === 'false'`,
|
|
26462
|
+
`${indent} ? { ignores: [] }`,
|
|
26463
|
+
`${indent} : ${includeReference}(${fileUrlReference}(new URL('.gitignore', import.meta.url)), {`,
|
|
26464
|
+
`${indent} gitignoreResolution: true,`,
|
|
26465
|
+
`${indent} name: '${GITIGNORE_NAME}',`,
|
|
26466
|
+
`${indent} }),`
|
|
26385
26467
|
];
|
|
26386
26468
|
}
|
|
26469
|
+
function controlledGitignoreCallEdit(source, sourceFile, call) {
|
|
26470
|
+
const indent = lineIndent(source, call.getStart(sourceFile));
|
|
26471
|
+
return {
|
|
26472
|
+
end: call.getEnd(),
|
|
26473
|
+
start: call.getStart(sourceFile),
|
|
26474
|
+
text: [
|
|
26475
|
+
`globalThis.process.env.${GITIGNORE_ENVIRONMENT_VARIABLE} === 'false'`,
|
|
26476
|
+
`${indent} ? { ignores: [] }`,
|
|
26477
|
+
`${indent} : ${call.getText(sourceFile)}`
|
|
26478
|
+
].join("\n")
|
|
26479
|
+
};
|
|
26480
|
+
}
|
|
26387
26481
|
function configArrayEdit(source, sourceFile, array, includeReference, fileUrlReference) {
|
|
26388
26482
|
const start = array.getStart(sourceFile) + 1;
|
|
26389
26483
|
const indent = `${lineIndent(source, array.getStart(sourceFile))} `;
|
|
@@ -26404,6 +26498,11 @@ function addGitignoreConfig(source) {
|
|
|
26404
26498
|
const sourceFile = parseConfig(source);
|
|
26405
26499
|
const configArray = findConfigArray(sourceFile);
|
|
26406
26500
|
if (configArray === void 0) return void 0;
|
|
26501
|
+
const existingIncludeReference = importedReference(sourceFile, "eslint/config", "includeIgnoreFile");
|
|
26502
|
+
if (existingIncludeReference !== void 0) {
|
|
26503
|
+
const existingCall = findRequiredGitignoreCall(configArray, existingIncludeReference, sourceFile, variableInitializers(sourceFile));
|
|
26504
|
+
if (existingCall !== void 0) return applyEdits(source, [controlledGitignoreCallEdit(source, sourceFile, existingCall)]);
|
|
26505
|
+
}
|
|
26407
26506
|
const edits = [];
|
|
26408
26507
|
const newImports = [];
|
|
26409
26508
|
const includeImport = resolveImportReference(sourceFile, "eslint/config", "includeIgnoreFile", newImports);
|
|
@@ -29521,7 +29620,7 @@ function isDistTypeImportListed(imp, name, dependencies, devDependencies, peerDe
|
|
|
29521
29620
|
* package. External (non-workspace) runtime deps default to peers so
|
|
29522
29621
|
* consumers are in control of the version. Workspace-internal deps stay
|
|
29523
29622
|
* as regular dependencies. Callers are expected to already have excluded
|
|
29524
|
-
* forceDeps (
|
|
29623
|
+
* forceDeps (`placement: "dep"` or legacy `refType`) and terminal packages. The `currentPeers`
|
|
29525
29624
|
* and `distImports` parameters are retained for future heuristics (e.g.
|
|
29526
29625
|
* promoting only when an import shares peers with existing peerDeps) but
|
|
29527
29626
|
* are not required to trigger promotion under the external-default rule.
|
|
@@ -29950,7 +30049,7 @@ function resolvedAddFix(context, dependency, section, detail, isOptional) {
|
|
|
29950
30049
|
action: "add",
|
|
29951
30050
|
dependency,
|
|
29952
30051
|
detail,
|
|
29953
|
-
...section === "peerDependencies" && isOptional !== void 0 && { isOptional },
|
|
30052
|
+
...section === "peerDependencies" && isOptional !== void 0 && { optional: isOptional },
|
|
29954
30053
|
section,
|
|
29955
30054
|
version
|
|
29956
30055
|
};
|
|
@@ -29981,21 +30080,21 @@ function evaluateMisplacedPeer(context, dep, version) {
|
|
|
29981
30080
|
if (context.forceDeps.has(dep)) return {
|
|
29982
30081
|
alreadyInTarget: context.packageParams.dependencies.includes(dep),
|
|
29983
30082
|
dep,
|
|
29984
|
-
message: `peerDependency ${dep} should be a dependency — configured
|
|
30083
|
+
message: `peerDependency ${dep} should be a dependency — configured placement is "dep"`,
|
|
29985
30084
|
mode: "to-dep",
|
|
29986
30085
|
version
|
|
29987
30086
|
};
|
|
29988
30087
|
if (context.forceDevs.has(dep)) return {
|
|
29989
30088
|
alreadyInTarget: context.packageParams.devDependencies.includes(dep),
|
|
29990
30089
|
dep,
|
|
29991
|
-
message: `peerDependency ${dep} should be a devDependency — configured
|
|
30090
|
+
message: `peerDependency ${dep} should be a devDependency — configured placement is "dev"`,
|
|
29992
30091
|
mode: "to-dev",
|
|
29993
30092
|
version
|
|
29994
30093
|
};
|
|
29995
30094
|
if ((context.workspaceNames?.has(dep) ?? false) && !context.forcePeers.has(dep) && !context.forcePeerWithDefault.has(dep)) return {
|
|
29996
30095
|
alreadyInTarget: context.packageParams.dependencies.includes(dep),
|
|
29997
30096
|
dep,
|
|
29998
|
-
message: `peerDependency ${dep} should be a dependency — sibling workspace packages ship in lockstep; set
|
|
30097
|
+
message: `peerDependency ${dep} should be a dependency — sibling workspace packages ship in lockstep; set placement "peer" in xy.config.ts to override`,
|
|
29999
30098
|
mode: "to-dep",
|
|
30000
30099
|
version
|
|
30001
30100
|
};
|
|
@@ -30037,7 +30136,7 @@ const misplacedDependenciesRule = {
|
|
|
30037
30136
|
mode: "to-dev"
|
|
30038
30137
|
},
|
|
30039
30138
|
dependency: dep,
|
|
30040
|
-
message: `dependency ${dep} should be a devDependency — configured
|
|
30139
|
+
message: `dependency ${dep} should be a devDependency — configured placement is "dev"`
|
|
30041
30140
|
});
|
|
30042
30141
|
continue;
|
|
30043
30142
|
}
|
|
@@ -30057,7 +30156,7 @@ const misplacedDependenciesRule = {
|
|
|
30057
30156
|
continue;
|
|
30058
30157
|
}
|
|
30059
30158
|
if (context.forcePeers.has(dep) || context.classifyDependency(dep) === "peer") {
|
|
30060
|
-
const reason = context.forcePeers.has(dep) ? "configured
|
|
30159
|
+
const reason = context.forcePeers.has(dep) ? "configured placement is \"peer\"" : "external runtime dep — consumers should control the version";
|
|
30061
30160
|
context.report({
|
|
30062
30161
|
data: {
|
|
30063
30162
|
dep,
|
|
@@ -30260,6 +30359,54 @@ function resolveAddVersionForSection(context, dependency, section, sourceRange)
|
|
|
30260
30359
|
if (section === "peerDependencies") return resolvePeerVersionForFix(context.workspace.location, dependency, context.packageParams.devDependencyVersions[dependency] ?? sourceRange, context.peerRangeForm, context.peerRangeBound);
|
|
30261
30360
|
return resolveExpectedDependencyVersion(context.workspace.location, dependency, sourceRange);
|
|
30262
30361
|
}
|
|
30362
|
+
function requiredSectionsToAdd(context, dependency, placement) {
|
|
30363
|
+
const inDependencies = context.packageParams.dependencies.includes(dependency);
|
|
30364
|
+
const inDevDependencies = context.packageParams.devDependencies.includes(dependency);
|
|
30365
|
+
const inPeerDependencies = context.packageParams.peerDependencies.includes(dependency);
|
|
30366
|
+
switch (placement) {
|
|
30367
|
+
case "dep":
|
|
30368
|
+
if (inDependencies || inPeerDependencies) return [];
|
|
30369
|
+
return ["dependencies"];
|
|
30370
|
+
case "dev":
|
|
30371
|
+
if (inDevDependencies || inDependencies || inPeerDependencies) return [];
|
|
30372
|
+
return ["devDependencies"];
|
|
30373
|
+
case "peer":
|
|
30374
|
+
if (inDependencies) return [];
|
|
30375
|
+
return [...inPeerDependencies ? [] : ["peerDependencies"], ...inDevDependencies ? [] : ["devDependencies"]];
|
|
30376
|
+
case "peer-with-default":
|
|
30377
|
+
if (inDependencies || inPeerDependencies) return [];
|
|
30378
|
+
return ["dependencies", "peerDependencies"];
|
|
30379
|
+
}
|
|
30380
|
+
}
|
|
30381
|
+
const requiredPackagesRule = {
|
|
30382
|
+
category: "workspace",
|
|
30383
|
+
id: "dep.package.required",
|
|
30384
|
+
meta: {
|
|
30385
|
+
description: "Packages configured with required presence must be declared",
|
|
30386
|
+
fixable: ["manifest"],
|
|
30387
|
+
severity: "error"
|
|
30388
|
+
},
|
|
30389
|
+
evaluate(context) {
|
|
30390
|
+
for (const [dependency, placement] of context.requiredPackages) {
|
|
30391
|
+
const sections = requiredSectionsToAdd(context, dependency, placement);
|
|
30392
|
+
if (sections.length === 0) continue;
|
|
30393
|
+
context.report({
|
|
30394
|
+
data: {
|
|
30395
|
+
dependency,
|
|
30396
|
+
sections
|
|
30397
|
+
},
|
|
30398
|
+
dependency,
|
|
30399
|
+
message: `Required package ${dependency} is missing from ${sections.join(" and ")}`
|
|
30400
|
+
});
|
|
30401
|
+
}
|
|
30402
|
+
},
|
|
30403
|
+
resolveFixes(diagnostic, context) {
|
|
30404
|
+
const data = diagnostic.data;
|
|
30405
|
+
if (!data) return [];
|
|
30406
|
+
const optional = resolvePromotedPeerOptional(context, data.dependency);
|
|
30407
|
+
return data.sections.map((section) => resolvedAddFix(context, data.dependency, section, `added required package to ${section}`, section === "peerDependencies" ? optional : void 0));
|
|
30408
|
+
}
|
|
30409
|
+
};
|
|
30263
30410
|
const unlistedDependenciesRule = {
|
|
30264
30411
|
category: "dependencies",
|
|
30265
30412
|
id: "dep.dependencies.unlisted",
|
|
@@ -30752,6 +30899,7 @@ function expectedPeerRangeStyle(context, dep, devRange, peerRange, form, boundTy
|
|
|
30752
30899
|
const builtInDeplintPlugin = {
|
|
30753
30900
|
name: "builtin",
|
|
30754
30901
|
rules: [
|
|
30902
|
+
requiredPackagesRule,
|
|
30755
30903
|
unlistedDependenciesRule,
|
|
30756
30904
|
unusedDependenciesRule,
|
|
30757
30905
|
misplacedDependenciesRule,
|
|
@@ -30820,21 +30968,14 @@ function buildUnusedDependencyExclude(options, requiredTransitivePeers) {
|
|
|
30820
30968
|
return /* @__PURE__ */ new Set([
|
|
30821
30969
|
...options.exclude ?? [],
|
|
30822
30970
|
...requiredTransitivePeers,
|
|
30823
|
-
...options.
|
|
30824
|
-
...options.forceDevs ?? [],
|
|
30825
|
-
...options.forcePeers ?? [],
|
|
30826
|
-
...options.forcePeerWithDefault ?? [],
|
|
30827
|
-
...options.forcePeerOptional?.keys() ?? []
|
|
30971
|
+
...options.allowedPackages ?? []
|
|
30828
30972
|
]);
|
|
30829
30973
|
}
|
|
30830
30974
|
function buildUnusedPeerDependencyExclude(options, runtimeRootedRequired) {
|
|
30831
30975
|
return /* @__PURE__ */ new Set([
|
|
30832
30976
|
...options.exclude ?? [],
|
|
30833
30977
|
...runtimeRootedRequired,
|
|
30834
|
-
...options.
|
|
30835
|
-
...options.forcePeers ?? [],
|
|
30836
|
-
...options.forcePeerWithDefault ?? [],
|
|
30837
|
-
...options.forcePeerOptional?.keys() ?? []
|
|
30978
|
+
...options.allowedPackages ?? []
|
|
30838
30979
|
]);
|
|
30839
30980
|
}
|
|
30840
30981
|
const sharedAeiProgramCache = createSharedProgramCache();
|
|
@@ -30938,6 +31079,7 @@ function buildWorkspaceContext(workspace, options = {}) {
|
|
|
30938
31079
|
peerForwarding,
|
|
30939
31080
|
peerRangeBound: options.peerRangeBound,
|
|
30940
31081
|
peerRangeForm: options.peerRangeForm ?? "shorthand",
|
|
31082
|
+
requiredPackages: options.requiredPackages ?? /* @__PURE__ */ new Map(),
|
|
30941
31083
|
sourceParams,
|
|
30942
31084
|
sourceExclude: sourceExclude ?? [],
|
|
30943
31085
|
unusedDependencyExclude: buildUnusedDependencyExclude(options, requiredTransitivePeers),
|
|
@@ -31013,13 +31155,15 @@ async function loadWorkspaceEvaluationContext(workspace, options, workspaceNames
|
|
|
31013
31155
|
const configuredExclude = normalizeConfigList(wsConfig.exclude);
|
|
31014
31156
|
const cliExclude = normalizeConfigList(options.cliExclude);
|
|
31015
31157
|
const sourceExclude = [...configuredExclude, ...cliExclude];
|
|
31016
|
-
const packageEntries =
|
|
31017
|
-
const forceDeps = new Set(packageEntries.filter(([,
|
|
31018
|
-
const forceDevs = new Set(packageEntries.filter(([,
|
|
31019
|
-
const forcePeers = new Set(packageEntries.filter(([,
|
|
31020
|
-
const forcePeerWithDefault = new Set(packageEntries.filter(([,
|
|
31158
|
+
const packageEntries = normalizeDeplintPackagePolicies(wsConfig.packages).entries().toArray();
|
|
31159
|
+
const forceDeps = new Set(packageEntries.filter(([, policy]) => policy.placement === "dep").map(([name]) => name));
|
|
31160
|
+
const forceDevs = new Set(packageEntries.filter(([, policy]) => policy.placement === "dev").map(([name]) => name));
|
|
31161
|
+
const forcePeers = new Set(packageEntries.filter(([, policy]) => policy.placement === "peer").map(([name]) => name));
|
|
31162
|
+
const forcePeerWithDefault = new Set(packageEntries.filter(([, policy]) => policy.placement === "peer-with-default").map(([name]) => name));
|
|
31163
|
+
const allowedPackages = new Set(packageEntries.filter(([, policy]) => policy.presence !== "inferred").map(([name]) => name));
|
|
31164
|
+
const requiredPackages = new Map(packageEntries.flatMap(([name, policy]) => policy.presence === "required" && policy.placement !== void 0 ? [[name, policy.placement]] : []));
|
|
31021
31165
|
const forcePeerOptional = /* @__PURE__ */ new Map();
|
|
31022
|
-
for (const [name,
|
|
31166
|
+
for (const [name, policy] of packageEntries) if (typeof policy.peerOptional === "boolean") forcePeerOptional.set(name, policy.peerOptional);
|
|
31023
31167
|
const rangeStyleOptions = rules.find((rule) => rule.id === "dep.peerDependencies.range-style")?.options ?? {};
|
|
31024
31168
|
const peerRangeForm = resolvePeerRangeFormOption(rangeStyleOptions);
|
|
31025
31169
|
const peerRangeBound = resolvePeerRangeBoundOption(rangeStyleOptions);
|
|
@@ -31032,6 +31176,7 @@ async function loadWorkspaceEvaluationContext(workspace, options, workspaceNames
|
|
|
31032
31176
|
return {
|
|
31033
31177
|
configMs,
|
|
31034
31178
|
context: buildWorkspaceContext(workspace, {
|
|
31179
|
+
allowedPackages,
|
|
31035
31180
|
apiExposureConfig,
|
|
31036
31181
|
classifier,
|
|
31037
31182
|
forceDeps,
|
|
@@ -31042,6 +31187,7 @@ async function loadWorkspaceEvaluationContext(workspace, options, workspaceNames
|
|
|
31042
31187
|
peerRangeBound,
|
|
31043
31188
|
peerRangeForm,
|
|
31044
31189
|
phases: options.profile === true ? contextPhases : void 0,
|
|
31190
|
+
requiredPackages,
|
|
31045
31191
|
sourceExclude,
|
|
31046
31192
|
terminalOverride: wsConfig.terminal,
|
|
31047
31193
|
workspaceNames
|
|
@@ -31797,7 +31943,7 @@ async function createLintEngine(cwd, options) {
|
|
|
31797
31943
|
})
|
|
31798
31944
|
}
|
|
31799
31945
|
|
|
31800
|
-
async function
|
|
31946
|
+
async function runJobWithConfiguredEnvironment(job) {
|
|
31801
31947
|
const cwd = job.cwd
|
|
31802
31948
|
const options = job.options ?? {}
|
|
31803
31949
|
const profile = options.profile === true
|
|
@@ -31850,6 +31996,17 @@ async function runJob(job) {
|
|
|
31850
31996
|
return payload
|
|
31851
31997
|
}
|
|
31852
31998
|
|
|
31999
|
+
async function runJob(job) {
|
|
32000
|
+
const previousGitignore = process.env.XY_LINT_GITIGNORE
|
|
32001
|
+
process.env.XY_LINT_GITIGNORE = job.options?.gitignore === false ? 'false' : 'true'
|
|
32002
|
+
try {
|
|
32003
|
+
return await runJobWithConfiguredEnvironment(job)
|
|
32004
|
+
} finally {
|
|
32005
|
+
if (previousGitignore === undefined) delete process.env.XY_LINT_GITIGNORE
|
|
32006
|
+
else process.env.XY_LINT_GITIGNORE = previousGitignore
|
|
32007
|
+
}
|
|
32008
|
+
}
|
|
32009
|
+
|
|
31853
32010
|
const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity })
|
|
31854
32011
|
for await (const line of rl) {
|
|
31855
32012
|
const trimmed = line.trim()
|
|
@@ -32264,6 +32421,7 @@ async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, c
|
|
|
32264
32421
|
configOverride: analyze ? void 0 : configOverride,
|
|
32265
32422
|
cycleDepth,
|
|
32266
32423
|
fix,
|
|
32424
|
+
gitignore,
|
|
32267
32425
|
gitignorePath,
|
|
32268
32426
|
profile,
|
|
32269
32427
|
verbose
|