@ariestools/toolchain 8.7.13 → 8.7.14
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lintNextRun.d.ts","sourceRoot":"","sources":["../../src/actions/lintNextRun.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEpF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,CAAA;AAElD,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,eAAe,EAC5B,aAAa,EAAE,OAAO,GACrB,kBAAkB,CAQpB;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,mBAAmB,EAChC,WAAW,EAAE,eAAe,GAAG,SAAS,EACxC,WAAW,EAAE,sBAAsB,GAAG,SAAS,GAC9C,kBAAkB,GAAG,SAAS,CAQhC;AAkBD,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,sBAAsB,CAAA;IACpC,KAAK,EAAE,OAAO,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,OAAO,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,0BAA0B,CAAC,MAAM,CAAC,CAAA;IACxC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,i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W,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,sBAAsB,CAAA;IACpC,KAAK,EAAE,OAAO,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,OAAO,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,0BAA0B,CAAC,MAAM,CAAC,CAAA;IACxC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAA;IAClF,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,eAAe,CAAA;IAC7B,WAAW,EAAE,mBAAmB,CAAA;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,SAAS,EAAE,CAAA;CACxB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,OAAO,EACP,WAAW,EACX,KAAK,EACL,WAAW,EACX,UAAU,EACV,GAAG,EACH,SAAS,EACT,IAAI,EACJ,eAAe,EACf,OAAO,EACP,OAAO,EACP,SAAS,EACT,WAAW,EACX,WAAW,EACX,OAAO,EACP,UAAU,GACX,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAsG1D"}
|
|
@@ -39,6 +39,8 @@ export interface LintPackageJobOptions {
|
|
|
39
39
|
configOverride?: LintConfigOverride;
|
|
40
40
|
cycleDepth?: number;
|
|
41
41
|
fix: boolean;
|
|
42
|
+
/** Whether generated project configs should honor the repository .gitignore. */
|
|
43
|
+
gitignore?: boolean;
|
|
42
44
|
/** Absolute path to a repository .gitignore file to apply as global ignores. */
|
|
43
45
|
gitignorePath?: string;
|
|
44
46
|
profile?: boolean;
|
|
@@ -79,7 +81,7 @@ export declare class LintWorkerPool {
|
|
|
79
81
|
private spawnWorker;
|
|
80
82
|
}
|
|
81
83
|
/** @deprecated Prefer {@link LintWorkerPool} — one-shot spawn for a single package. */
|
|
82
|
-
export declare function lintOnePackageProcess({ analyze, analyzeTier, cache, cacheLocation, cwd, cycleDepth, fix, gitignorePath, profile, rootDir, verbose, }: LintPackageJobOptions & {
|
|
84
|
+
export declare function lintOnePackageProcess({ analyze, analyzeTier, cache, cacheLocation, cwd, cycleDepth, fix, gitignore, gitignorePath, profile, rootDir, verbose, }: LintPackageJobOptions & {
|
|
83
85
|
cacheLocation?: string;
|
|
84
86
|
cwd: string;
|
|
85
87
|
rootDir?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lintNextWorker.d.ts","sourceRoot":"","sources":["../../src/actions/lintNextWorker.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEpF,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,uCAAuC;IACvC,OAAO,CAAC,EAAE,iBAAiB,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IACjE,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG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M;IAKnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBtB,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAatE,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,CAAC,iBAAiB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAKtF,2CAA2C;IAC3C,KAAK,IAAI,IAAI;IAOb,OAAO,CAAC,aAAa;IAuCrB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,IAAI;IAsCZ,OAAO,CAAC,WAAW;CAiDpB;AAED,uFAAuF;AACvF,wBAAsB,qBAAqB,CAAC,EAC1C,OAAO,EACP,WAAW,EACX,KAAK,EACL,aAAa,EACb,GAAG,EACH,UAAU,EACV,GAAG,EACH,SAAgB,EAChB,aAAa,EACb,OAAe,EACf,OAAO,EACP,OAAO,GACR,EAAE,qBAAqB,GAAG;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,OAAO,CAAC,iBAAiB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAalD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lintlintGitignore.d.ts","sourceRoot":"","sources":["../../src/actions/lintlintGitignore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lintlintGitignore.d.ts","sourceRoot":"","sources":["../../src/actions/lintlintGitignore.ts"],"names":[],"mappings":"AAsOA,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAS1D;AA4FD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,gBAAgB,SAAsB,EACtC,gBAAgB,SAAkB,GACjC,MAAM,EAAE,CASV;AA8CD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA6BrE"}
|
package/dist/bin/xy.mjs
CHANGED
|
@@ -26233,6 +26233,7 @@ function collectExternalUsage(folderRoots, targetPackageNames) {
|
|
|
26233
26233
|
//#endregion
|
|
26234
26234
|
//#region src/actions/lintlintGitignore.ts
|
|
26235
26235
|
const GITIGNORE_NAME = "XY repository .gitignore";
|
|
26236
|
+
const GITIGNORE_ENVIRONMENT_VARIABLE = "XY_LINT_GITIGNORE";
|
|
26236
26237
|
function parseConfig(source) {
|
|
26237
26238
|
return ts.createSourceFile("eslint.config.ts", source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
26238
26239
|
}
|
|
@@ -26251,6 +26252,44 @@ function importedReference(sourceFile, moduleSpecifier, importedName) {
|
|
|
26251
26252
|
for (const specifier of bindings.elements) if ((specifier.propertyName?.text ?? specifier.name.text) === importedName) return specifier.name.text;
|
|
26252
26253
|
}
|
|
26253
26254
|
}
|
|
26255
|
+
function addBindingNames(name, names) {
|
|
26256
|
+
if (ts.isIdentifier(name)) {
|
|
26257
|
+
names.add(name.text);
|
|
26258
|
+
return;
|
|
26259
|
+
}
|
|
26260
|
+
for (const element of name.elements) if (!ts.isOmittedExpression(element)) addBindingNames(element.name, names);
|
|
26261
|
+
}
|
|
26262
|
+
function topLevelBindingNames(sourceFile) {
|
|
26263
|
+
const names = /* @__PURE__ */ new Set();
|
|
26264
|
+
for (const statement of sourceFile.statements) {
|
|
26265
|
+
if (ts.isImportDeclaration(statement)) {
|
|
26266
|
+
const clause = statement.importClause;
|
|
26267
|
+
if (clause?.name !== void 0) names.add(clause.name.text);
|
|
26268
|
+
const bindings = clause?.namedBindings;
|
|
26269
|
+
if (bindings !== void 0 && ts.isNamespaceImport(bindings)) names.add(bindings.name.text);
|
|
26270
|
+
if (bindings !== void 0 && ts.isNamedImports(bindings)) for (const element of bindings.elements) names.add(element.name.text);
|
|
26271
|
+
continue;
|
|
26272
|
+
}
|
|
26273
|
+
if (ts.isVariableStatement(statement)) {
|
|
26274
|
+
for (const declaration of statement.declarationList.declarations) addBindingNames(declaration.name, names);
|
|
26275
|
+
continue;
|
|
26276
|
+
}
|
|
26277
|
+
if ((ts.isClassDeclaration(statement) || ts.isEnumDeclaration(statement) || ts.isFunctionDeclaration(statement)) && statement.name !== void 0) names.add(statement.name.text);
|
|
26278
|
+
}
|
|
26279
|
+
return names;
|
|
26280
|
+
}
|
|
26281
|
+
function uniqueImportReference(sourceFile, importedName) {
|
|
26282
|
+
const names = topLevelBindingNames(sourceFile);
|
|
26283
|
+
if (!names.has(importedName)) return importedName;
|
|
26284
|
+
const base = `xy${importedName[0]?.toUpperCase() ?? ""}${importedName.slice(1)}`;
|
|
26285
|
+
let candidate = base;
|
|
26286
|
+
let suffix = 2;
|
|
26287
|
+
while (names.has(candidate)) {
|
|
26288
|
+
candidate = `${base}${suffix}`;
|
|
26289
|
+
suffix++;
|
|
26290
|
+
}
|
|
26291
|
+
return candidate;
|
|
26292
|
+
}
|
|
26254
26293
|
function variableInitializers(sourceFile) {
|
|
26255
26294
|
const initializers = /* @__PURE__ */ new Map();
|
|
26256
26295
|
for (const statement of sourceFile.statements) {
|
|
@@ -26307,18 +26346,12 @@ function isRequiredGitignoreCall(node, includeReference, sourceFile, initializer
|
|
|
26307
26346
|
const [ignorePath, options] = node.arguments;
|
|
26308
26347
|
return ignorePath !== void 0 && expressionReferencesGitignore(ignorePath, sourceFile, initializers) && enablesGitignoreResolution(options);
|
|
26309
26348
|
}
|
|
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;
|
|
26349
|
+
function findRequiredGitignoreCall(configArray, includeReference, sourceFile, initializers) {
|
|
26350
|
+
let found;
|
|
26318
26351
|
function visit(node) {
|
|
26319
|
-
if (found) return;
|
|
26320
|
-
if (isRequiredGitignoreCall(node,
|
|
26321
|
-
found =
|
|
26352
|
+
if (found !== void 0) return;
|
|
26353
|
+
if (isRequiredGitignoreCall(node, includeReference, sourceFile, initializers)) {
|
|
26354
|
+
found = node;
|
|
26322
26355
|
return;
|
|
26323
26356
|
}
|
|
26324
26357
|
ts.forEachChild(node, visit);
|
|
@@ -26326,11 +26359,36 @@ function hasGitignoreConfig(source) {
|
|
|
26326
26359
|
visit(configArray);
|
|
26327
26360
|
return found;
|
|
26328
26361
|
}
|
|
26329
|
-
function
|
|
26362
|
+
function isGitignoreControlCondition(expression, sourceFile) {
|
|
26363
|
+
const compact = expression.getText(sourceFile).replaceAll(/\s/g, "");
|
|
26364
|
+
return [
|
|
26365
|
+
`globalThis.process.env.${GITIGNORE_ENVIRONMENT_VARIABLE}==='false'`,
|
|
26366
|
+
`'false'===globalThis.process.env.${GITIGNORE_ENVIRONMENT_VARIABLE}`,
|
|
26367
|
+
`process.env.${GITIGNORE_ENVIRONMENT_VARIABLE}==='false'`,
|
|
26368
|
+
`'false'===process.env.${GITIGNORE_ENVIRONMENT_VARIABLE}`
|
|
26369
|
+
].includes(compact);
|
|
26370
|
+
}
|
|
26371
|
+
function isControlledGitignoreCall(call, configArray, sourceFile) {
|
|
26372
|
+
let current = call;
|
|
26373
|
+
while (current !== configArray && current.parent !== void 0) {
|
|
26374
|
+
current = current.parent;
|
|
26375
|
+
if (ts.isConditionalExpression(current) && isGitignoreControlCondition(current.condition, sourceFile)) return true;
|
|
26376
|
+
}
|
|
26377
|
+
return false;
|
|
26378
|
+
}
|
|
26379
|
+
function hasGitignoreConfig(source) {
|
|
26380
|
+
const sourceFile = parseConfig(source);
|
|
26381
|
+
const includeReference = importedReference(sourceFile, "eslint/config", "includeIgnoreFile");
|
|
26382
|
+
const configArray = findConfigArray(sourceFile);
|
|
26383
|
+
if (includeReference === void 0 || configArray === void 0) return false;
|
|
26384
|
+
const call = findRequiredGitignoreCall(configArray, includeReference, sourceFile, variableInitializers(sourceFile));
|
|
26385
|
+
return call !== void 0 && isControlledGitignoreCall(call, configArray, sourceFile);
|
|
26386
|
+
}
|
|
26387
|
+
function updateNamedImport(declaration, importedName, referenceName, sourceFile) {
|
|
26330
26388
|
const clause = declaration.importClause;
|
|
26331
26389
|
const bindings = clause?.namedBindings;
|
|
26332
26390
|
const elements = bindings !== void 0 && ts.isNamedImports(bindings) ? [...bindings.elements] : [];
|
|
26333
|
-
const namedImports = ts.factory.createNamedImports([...elements, ts.factory.createImportSpecifier(false, void 0
|
|
26391
|
+
const namedImports = ts.factory.createNamedImports([...elements, ts.factory.createImportSpecifier(false, importedName === referenceName ? void 0 : ts.factory.createIdentifier(importedName), ts.factory.createIdentifier(referenceName))]);
|
|
26334
26392
|
const updatedClause = ts.factory.updateImportClause(clause ?? ts.factory.createImportClause(false, void 0, namedImports), false, clause?.name, namedImports);
|
|
26335
26393
|
const updated = ts.factory.updateImportDeclaration(declaration, declaration.modifiers, updatedClause, declaration.moduleSpecifier, declaration.attributes);
|
|
26336
26394
|
const printer = ts.createPrinter({
|
|
@@ -26346,17 +26404,19 @@ function updateNamedImport(declaration, importedName, sourceFile) {
|
|
|
26346
26404
|
function resolveImportReference(sourceFile, moduleSpecifier, importedName, newImports) {
|
|
26347
26405
|
const existingReference = importedReference(sourceFile, moduleSpecifier, importedName);
|
|
26348
26406
|
if (existingReference !== void 0) return { reference: existingReference };
|
|
26407
|
+
const referenceName = uniqueImportReference(sourceFile, importedName);
|
|
26349
26408
|
for (const declaration of importDeclarations(sourceFile)) {
|
|
26350
26409
|
if (moduleName(declaration) !== moduleSpecifier || declaration.importClause?.isTypeOnly === true) continue;
|
|
26351
26410
|
const bindings = declaration.importClause?.namedBindings;
|
|
26352
26411
|
if (bindings !== void 0 && ts.isNamespaceImport(bindings)) return { reference: `${bindings.name.text}.${importedName}` };
|
|
26353
26412
|
return {
|
|
26354
|
-
edit: updateNamedImport(declaration, importedName, sourceFile),
|
|
26355
|
-
reference:
|
|
26413
|
+
edit: updateNamedImport(declaration, importedName, referenceName, sourceFile),
|
|
26414
|
+
reference: referenceName
|
|
26356
26415
|
};
|
|
26357
26416
|
}
|
|
26358
|
-
|
|
26359
|
-
|
|
26417
|
+
const importedBinding = importedName === referenceName ? importedName : `${importedName} as ${referenceName}`;
|
|
26418
|
+
newImports.push(`import { ${importedBinding} } from '${moduleSpecifier}'`);
|
|
26419
|
+
return { reference: referenceName };
|
|
26360
26420
|
}
|
|
26361
26421
|
function newImportsEdit(sourceFile, imports) {
|
|
26362
26422
|
if (imports.length === 0) return void 0;
|
|
@@ -26378,12 +26438,26 @@ function lineIndent(source, position) {
|
|
|
26378
26438
|
}
|
|
26379
26439
|
function gitignoreConfigEntryLines(indent, includeReference = "includeIgnoreFile", fileUrlReference = "fileURLToPath") {
|
|
26380
26440
|
return [
|
|
26381
|
-
`${indent}
|
|
26382
|
-
`${indent}
|
|
26383
|
-
`${indent}
|
|
26384
|
-
`${indent}
|
|
26441
|
+
`${indent}globalThis.process.env.${GITIGNORE_ENVIRONMENT_VARIABLE} === 'false'`,
|
|
26442
|
+
`${indent} ? { ignores: [] }`,
|
|
26443
|
+
`${indent} : ${includeReference}(${fileUrlReference}(new URL('.gitignore', import.meta.url)), {`,
|
|
26444
|
+
`${indent} gitignoreResolution: true,`,
|
|
26445
|
+
`${indent} name: '${GITIGNORE_NAME}',`,
|
|
26446
|
+
`${indent} }),`
|
|
26385
26447
|
];
|
|
26386
26448
|
}
|
|
26449
|
+
function controlledGitignoreCallEdit(source, sourceFile, call) {
|
|
26450
|
+
const indent = lineIndent(source, call.getStart(sourceFile));
|
|
26451
|
+
return {
|
|
26452
|
+
end: call.getEnd(),
|
|
26453
|
+
start: call.getStart(sourceFile),
|
|
26454
|
+
text: [
|
|
26455
|
+
`globalThis.process.env.${GITIGNORE_ENVIRONMENT_VARIABLE} === 'false'`,
|
|
26456
|
+
`${indent} ? { ignores: [] }`,
|
|
26457
|
+
`${indent} : ${call.getText(sourceFile)}`
|
|
26458
|
+
].join("\n")
|
|
26459
|
+
};
|
|
26460
|
+
}
|
|
26387
26461
|
function configArrayEdit(source, sourceFile, array, includeReference, fileUrlReference) {
|
|
26388
26462
|
const start = array.getStart(sourceFile) + 1;
|
|
26389
26463
|
const indent = `${lineIndent(source, array.getStart(sourceFile))} `;
|
|
@@ -26404,6 +26478,11 @@ function addGitignoreConfig(source) {
|
|
|
26404
26478
|
const sourceFile = parseConfig(source);
|
|
26405
26479
|
const configArray = findConfigArray(sourceFile);
|
|
26406
26480
|
if (configArray === void 0) return void 0;
|
|
26481
|
+
const existingIncludeReference = importedReference(sourceFile, "eslint/config", "includeIgnoreFile");
|
|
26482
|
+
if (existingIncludeReference !== void 0) {
|
|
26483
|
+
const existingCall = findRequiredGitignoreCall(configArray, existingIncludeReference, sourceFile, variableInitializers(sourceFile));
|
|
26484
|
+
if (existingCall !== void 0) return applyEdits(source, [controlledGitignoreCallEdit(source, sourceFile, existingCall)]);
|
|
26485
|
+
}
|
|
26407
26486
|
const edits = [];
|
|
26408
26487
|
const newImports = [];
|
|
26409
26488
|
const includeImport = resolveImportReference(sourceFile, "eslint/config", "includeIgnoreFile", newImports);
|
|
@@ -31797,7 +31876,7 @@ async function createLintEngine(cwd, options) {
|
|
|
31797
31876
|
})
|
|
31798
31877
|
}
|
|
31799
31878
|
|
|
31800
|
-
async function
|
|
31879
|
+
async function runJobWithConfiguredEnvironment(job) {
|
|
31801
31880
|
const cwd = job.cwd
|
|
31802
31881
|
const options = job.options ?? {}
|
|
31803
31882
|
const profile = options.profile === true
|
|
@@ -31850,6 +31929,17 @@ async function runJob(job) {
|
|
|
31850
31929
|
return payload
|
|
31851
31930
|
}
|
|
31852
31931
|
|
|
31932
|
+
async function runJob(job) {
|
|
31933
|
+
const previousGitignore = process.env.XY_LINT_GITIGNORE
|
|
31934
|
+
process.env.XY_LINT_GITIGNORE = job.options?.gitignore === false ? 'false' : 'true'
|
|
31935
|
+
try {
|
|
31936
|
+
return await runJobWithConfiguredEnvironment(job)
|
|
31937
|
+
} finally {
|
|
31938
|
+
if (previousGitignore === undefined) delete process.env.XY_LINT_GITIGNORE
|
|
31939
|
+
else process.env.XY_LINT_GITIGNORE = previousGitignore
|
|
31940
|
+
}
|
|
31941
|
+
}
|
|
31942
|
+
|
|
31853
31943
|
const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity })
|
|
31854
31944
|
for await (const line of rl) {
|
|
31855
31945
|
const trimmed = line.trim()
|
|
@@ -32264,6 +32354,7 @@ async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, c
|
|
|
32264
32354
|
configOverride: analyze ? void 0 : configOverride,
|
|
32265
32355
|
cycleDepth,
|
|
32266
32356
|
fix,
|
|
32357
|
+
gitignore,
|
|
32267
32358
|
gitignorePath,
|
|
32268
32359
|
profile,
|
|
32269
32360
|
verbose
|