@ariestools/toolchain 8.6.11 → 8.6.12
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/apiExposure.d.ts.map +1 -1
- package/dist/actions/api-exposure/config.d.ts.map +1 -1
- package/dist/actions/api-exposure/types.d.ts +3 -0
- package/dist/actions/api-exposure/types.d.ts.map +1 -1
- package/dist/actions/gitlint-fix.d.ts +2 -1
- package/dist/actions/gitlint-fix.d.ts.map +1 -1
- package/dist/actions/gitlint.d.ts +3 -1
- package/dist/actions/gitlint.d.ts.map +1 -1
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/lintlint.d.ts +1 -1
- package/dist/actions/lintlint.d.ts.map +1 -1
- package/dist/actions/node-lint.d.ts +1 -1
- package/dist/actions/node-lint.d.ts.map +1 -1
- package/dist/actions/package/compile/ApiExposureConfig.d.ts +9 -2
- package/dist/actions/package/compile/ApiExposureConfig.d.ts.map +1 -1
- package/dist/actions/package/compile/MonolithConfig.d.ts +23 -0
- package/dist/actions/package/compile/MonolithConfig.d.ts.map +1 -1
- package/dist/actions/package/compile/PublintConfig.d.ts +41 -0
- package/dist/actions/package/compile/PublintConfig.d.ts.map +1 -0
- package/dist/actions/package/compile/RuleLevelConfig.d.ts +7 -0
- package/dist/actions/package/compile/RuleLevelConfig.d.ts.map +1 -0
- package/dist/actions/package/compile/XyConfig.d.ts +29 -34
- package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
- package/dist/actions/package/compile/monolithCompileEntries.d.ts.map +1 -1
- package/dist/actions/package/compile/monolithCompileLayout.d.ts.map +1 -1
- package/dist/actions/package/index.d.ts +1 -0
- package/dist/actions/package/index.d.ts.map +1 -1
- package/dist/actions/package/publint.d.ts +3 -1
- package/dist/actions/package/publint.d.ts.map +1 -1
- package/dist/actions/package/publintRules.d.ts +10 -0
- package/dist/actions/package/publintRules.d.ts.map +1 -0
- package/dist/actions/package-lint.d.ts +2 -1
- package/dist/actions/package-lint.d.ts.map +1 -1
- package/dist/actions/packman/lint.d.ts +2 -1
- package/dist/actions/packman/lint.d.ts.map +1 -1
- package/dist/actions/publint.d.ts.map +1 -1
- package/dist/actions/ruleCatalog.d.ts +40 -0
- package/dist/actions/ruleCatalog.d.ts.map +1 -0
- package/dist/actions/ruleRunner.d.ts +60 -0
- package/dist/actions/ruleRunner.d.ts.map +1 -0
- package/dist/actions/skills/lint.d.ts +3 -1
- package/dist/actions/skills/lint.d.ts.map +1 -1
- package/dist/bin/package/build.mjs +218 -67
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +8 -4
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +210 -63
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +8 -4
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/sync-layout.mjs +1 -1
- package/dist/bin/package/sync-layout.mjs.map +1 -1
- package/dist/bin/xy.mjs +1484 -315
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/lib/loadConfig.d.ts.map +1 -1
- package/dist/xy/common/checkCommand.d.ts.map +1 -1
- package/dist/xy/common/deadCommand.d.ts.map +1 -1
- package/dist/xy/common/gitlintCommand.d.ts.map +1 -1
- package/dist/xy/common/packmanCommand.d.ts.map +1 -1
- package/dist/xy/common/repo/lintCommand.d.ts.map +1 -1
- package/dist/xy/common/skills/index.d.ts.map +1 -1
- package/dist/xy/lint/apiExposureCommand.d.ts.map +1 -1
- package/dist/xy/lint/cycleCommand.d.ts.map +1 -1
- package/dist/xy/lint/deplintCommand.d.ts.map +1 -1
- package/dist/xy/lint/fixCommand.d.ts.map +1 -1
- package/dist/xy/lint/lint/runCommand.d.ts.map +1 -1
- package/dist/xy/lint/lintlintCommand.d.ts.map +1 -1
- package/dist/xy/lint/nodeLintCommand.d.ts.map +1 -1
- package/dist/xy/lint/publintCommand.d.ts.map +1 -1
- package/dist/xy/lint/relintCommand.d.ts.map +1 -1
- package/dist/xy/lint/republintCommand.d.ts.map +1 -1
- package/dist/xy/xy.d.ts +3 -10
- package/dist/xy/xy.d.ts.map +1 -1
- package/dist/xy/xyParseOptions.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -9381,15 +9381,27 @@ function mergeRuleConfigs(target, source) {
|
|
|
9381
9381
|
};
|
|
9382
9382
|
return source;
|
|
9383
9383
|
}
|
|
9384
|
+
const RULE_CONFIG_COMMANDS = /* @__PURE__ */ new Set([
|
|
9385
|
+
"apiExposure",
|
|
9386
|
+
"dead",
|
|
9387
|
+
"deplint",
|
|
9388
|
+
"gitlint",
|
|
9389
|
+
"lintlint",
|
|
9390
|
+
"nodeLint",
|
|
9391
|
+
"packman",
|
|
9392
|
+
"publint",
|
|
9393
|
+
"repoLint",
|
|
9394
|
+
"skillsLint"
|
|
9395
|
+
]);
|
|
9384
9396
|
function mergeCommandConfig(rootCmd, workspaceCmd, commandName) {
|
|
9385
|
-
return deepMerge(rootCmd, workspaceCmd, { customMerge: (key) => (commandName
|
|
9397
|
+
return deepMerge(rootCmd, workspaceCmd, { customMerge: (key) => RULE_CONFIG_COMMANDS.has(commandName) && key === "rules" ? mergeRuleConfigs : void 0 });
|
|
9386
9398
|
}
|
|
9387
9399
|
/**
|
|
9388
9400
|
* Loads a command-specific config merged from root and workspace levels.
|
|
9389
9401
|
* The root config provides defaults; the workspace config extends/overrides.
|
|
9390
9402
|
* Arrays (e.g. `exclude`) are unioned and maps (e.g. `packages`) are merged
|
|
9391
9403
|
* via deepmerge, with workspace entries overriding root entries for the same key.
|
|
9392
|
-
*
|
|
9404
|
+
* Rule entries are replaced per rule id so tuple configs keep their
|
|
9393
9405
|
* ESLint-like shape instead of being concatenated as arrays.
|
|
9394
9406
|
*/
|
|
9395
9407
|
/**
|
|
@@ -10291,7 +10303,7 @@ const resolveCompilePlatforms = (compile) => {
|
|
|
10291
10303
|
};
|
|
10292
10304
|
};
|
|
10293
10305
|
//#endregion
|
|
10294
|
-
//#region src/actions/package/compile/
|
|
10306
|
+
//#region src/actions/package/compile/PublintConfig.ts
|
|
10295
10307
|
const ALL_PUBLINT_CHECKS = [
|
|
10296
10308
|
"compileTargets",
|
|
10297
10309
|
"defaultExportOrder",
|
|
@@ -11194,6 +11206,96 @@ async function checkPlatform(pkgDir, pkg, shouldFix = false) {
|
|
|
11194
11206
|
return result;
|
|
11195
11207
|
}
|
|
11196
11208
|
//#endregion
|
|
11209
|
+
//#region src/actions/package/publintRules.ts
|
|
11210
|
+
const PUBLINT_RULE_LEVELS = /* @__PURE__ */ new Set([
|
|
11211
|
+
"error",
|
|
11212
|
+
"off",
|
|
11213
|
+
"warn"
|
|
11214
|
+
]);
|
|
11215
|
+
function defaultPublintLevel(check) {
|
|
11216
|
+
return check === "platform" || check === "publint" ? "error" : "warn";
|
|
11217
|
+
}
|
|
11218
|
+
function normalizePublintConfig$2(value) {
|
|
11219
|
+
if (typeof value === "object") return value;
|
|
11220
|
+
return {};
|
|
11221
|
+
}
|
|
11222
|
+
function isPublintCheckName(value) {
|
|
11223
|
+
return ALL_PUBLINT_CHECKS.includes(value);
|
|
11224
|
+
}
|
|
11225
|
+
function isRuleLevel(value) {
|
|
11226
|
+
return typeof value === "string" && PUBLINT_RULE_LEVELS.has(value);
|
|
11227
|
+
}
|
|
11228
|
+
function candidateRuleLevelValue(value) {
|
|
11229
|
+
if (Array.isArray(value) && value.length > 0) return value[0];
|
|
11230
|
+
if (typeof value === "object" && value !== null) {
|
|
11231
|
+
const record = value;
|
|
11232
|
+
return record.level ?? record.enabled;
|
|
11233
|
+
}
|
|
11234
|
+
return value;
|
|
11235
|
+
}
|
|
11236
|
+
function parseRuleLevel(location, value) {
|
|
11237
|
+
const candidate = candidateRuleLevelValue(value);
|
|
11238
|
+
if (candidate === true) return "warn";
|
|
11239
|
+
if (candidate === false) return "off";
|
|
11240
|
+
if (isRuleLevel(candidate)) return candidate;
|
|
11241
|
+
throw new TypeError(`${location} must be "error", "warn", "off", boolean, [level, options], or { level?, enabled? }`);
|
|
11242
|
+
}
|
|
11243
|
+
function normalizePublintRuleNames(location, values) {
|
|
11244
|
+
return (values ?? []).map((value) => {
|
|
11245
|
+
if (!isPublintCheckName(value)) throw new TypeError(`Unknown publint check "${value}" in ${location}`);
|
|
11246
|
+
return value;
|
|
11247
|
+
});
|
|
11248
|
+
}
|
|
11249
|
+
function defaultLevels() {
|
|
11250
|
+
return new Map(ALL_PUBLINT_CHECKS.map((check) => [check, defaultPublintLevel(check)]));
|
|
11251
|
+
}
|
|
11252
|
+
function setRuleLevel(levels, explicit, check, level) {
|
|
11253
|
+
levels.set(check, level);
|
|
11254
|
+
explicit.add(check);
|
|
11255
|
+
}
|
|
11256
|
+
function applyIncludedOnly(levels, explicit, include) {
|
|
11257
|
+
if (include.length === 0) return;
|
|
11258
|
+
const included = new Set(include);
|
|
11259
|
+
for (const check of ALL_PUBLINT_CHECKS) {
|
|
11260
|
+
if (included.has(check)) continue;
|
|
11261
|
+
setRuleLevel(levels, explicit, check, "off");
|
|
11262
|
+
}
|
|
11263
|
+
}
|
|
11264
|
+
function applyExcluded(levels, explicit, exclude) {
|
|
11265
|
+
for (const check of exclude) setRuleLevel(levels, explicit, check, "off");
|
|
11266
|
+
}
|
|
11267
|
+
function applyConfiguredRules(levels, explicit, rules) {
|
|
11268
|
+
for (const [check, setting] of Object.entries(rules ?? {})) {
|
|
11269
|
+
if (!isPublintCheckName(check)) throw new TypeError(`Unknown publint check "${check}" in commands.publint.rules`);
|
|
11270
|
+
setRuleLevel(levels, explicit, check, parseRuleLevel(`commands.publint.rules["${check}"]`, setting));
|
|
11271
|
+
}
|
|
11272
|
+
}
|
|
11273
|
+
function resolvePublintRules(value, cliExclude, cliInclude) {
|
|
11274
|
+
const config = normalizePublintConfig$2(value);
|
|
11275
|
+
const configExclude = normalizePublintRuleNames("commands.publint.exclude", config.exclude);
|
|
11276
|
+
const configInclude = normalizePublintRuleNames("commands.publint.include", config.include);
|
|
11277
|
+
const normalizedCliExclude = normalizePublintRuleNames("--exclude", cliExclude);
|
|
11278
|
+
const normalizedCliInclude = normalizePublintRuleNames("--include", cliInclude);
|
|
11279
|
+
const levels = defaultLevels();
|
|
11280
|
+
const explicit = /* @__PURE__ */ new Set();
|
|
11281
|
+
if ((configExclude.length > 0 || normalizedCliExclude.length > 0) && (configInclude.length > 0 || normalizedCliInclude.length > 0)) throw new TypeError("Publint: --include and --exclude cannot be used together");
|
|
11282
|
+
applyIncludedOnly(levels, explicit, configInclude);
|
|
11283
|
+
applyExcluded(levels, explicit, configExclude);
|
|
11284
|
+
applyConfiguredRules(levels, explicit, config.rules);
|
|
11285
|
+
applyIncludedOnly(levels, explicit, normalizedCliInclude);
|
|
11286
|
+
applyExcluded(levels, explicit, normalizedCliExclude);
|
|
11287
|
+
return {
|
|
11288
|
+
explicit,
|
|
11289
|
+
levels
|
|
11290
|
+
};
|
|
11291
|
+
}
|
|
11292
|
+
function cloneResolvedPublintRules(rules) {
|
|
11293
|
+
return {
|
|
11294
|
+
explicit: new Set(rules.explicit),
|
|
11295
|
+
levels: new Map(rules.levels)
|
|
11296
|
+
};
|
|
11297
|
+
}
|
|
11298
|
+
//#endregion
|
|
11197
11299
|
//#region ../../node_modules/.pnpm/@publint+pack@0.1.4/node_modules/@publint/pack/src/node/pack.js
|
|
11198
11300
|
/** @type {import('../index.d.ts').pack} */
|
|
11199
11301
|
async function pack(dir, opts) {
|
|
@@ -13311,9 +13413,6 @@ function normalizePublintConfig$1(value) {
|
|
|
13311
13413
|
if (typeof value === "object") return value;
|
|
13312
13414
|
return {};
|
|
13313
13415
|
}
|
|
13314
|
-
function mergeWorkspaceExclude(exclude, wsPublintConfig) {
|
|
13315
|
-
return /* @__PURE__ */ new Set([...exclude, ...wsPublintConfig.exclude ?? []]);
|
|
13316
|
-
}
|
|
13317
13416
|
const shouldRemoveSourceFromExports = (exports) => {
|
|
13318
13417
|
let isRemoved = false;
|
|
13319
13418
|
for (const [key, value] of Object.entries(exports)) if (key === "source") {
|
|
@@ -13369,6 +13468,15 @@ function mergeResults(target, source) {
|
|
|
13369
13468
|
target.warnings += source.warnings;
|
|
13370
13469
|
target.modified ||= source.modified;
|
|
13371
13470
|
}
|
|
13471
|
+
function mergeLeveledResult(target, source, check, rules) {
|
|
13472
|
+
const issueCount = source.errors + source.warnings;
|
|
13473
|
+
if (rules.explicit.has(check)) {
|
|
13474
|
+
const level = rules.levels.get(check) ?? defaultPublintLevel(check);
|
|
13475
|
+
if (level === "error") target.errors += issueCount;
|
|
13476
|
+
else if (level === "warn") target.warnings += issueCount;
|
|
13477
|
+
} else mergeResults(target, source);
|
|
13478
|
+
target.modified ||= source.modified;
|
|
13479
|
+
}
|
|
13372
13480
|
async function readPackageJson(pkgDir) {
|
|
13373
13481
|
return JSON.parse(await promises.readFile(PATH.join(pkgDir, "package.json"), "utf8"));
|
|
13374
13482
|
}
|
|
@@ -13495,21 +13603,21 @@ function checkRootTypes(pkg, shouldFix) {
|
|
|
13495
13603
|
result.warnings++;
|
|
13496
13604
|
return result;
|
|
13497
13605
|
}
|
|
13498
|
-
async function customPubLint(pkgDir, pkg, shouldFix = false,
|
|
13606
|
+
async function customPubLint(pkgDir, pkg, shouldFix = false, rules) {
|
|
13499
13607
|
const result = emptyCustomResult();
|
|
13500
|
-
if (
|
|
13501
|
-
if (
|
|
13502
|
-
if (
|
|
13503
|
-
if (
|
|
13504
|
-
if (
|
|
13505
|
-
if (
|
|
13506
|
-
if (
|
|
13507
|
-
if (
|
|
13508
|
-
if (
|
|
13509
|
-
if (
|
|
13510
|
-
if (
|
|
13511
|
-
if (
|
|
13512
|
-
if (
|
|
13608
|
+
if (rules.levels.get("files") !== "off") mergeLeveledResult(result, checkFiles(pkg, shouldFix), "files", rules);
|
|
13609
|
+
if (rules.levels.get("source") !== "off") mergeLeveledResult(result, checkExportsSource(pkg, shouldFix), "source", rules);
|
|
13610
|
+
if (rules.levels.get("rootSource") !== "off") mergeLeveledResult(result, checkRootSource(pkg, shouldFix), "rootSource", rules);
|
|
13611
|
+
if (rules.levels.get("main") !== "off") mergeLeveledResult(result, migrateFieldToExports(pkg, "main", "default", shouldFix), "main", rules);
|
|
13612
|
+
if (rules.levels.get("types") !== "off") mergeLeveledResult(result, migrateFieldToExports(pkg, "types", "types", shouldFix), "types", rules);
|
|
13613
|
+
if (rules.levels.get("module") !== "off") mergeLeveledResult(result, migrateFieldToExports(pkg, "module", "default", shouldFix), "module", rules);
|
|
13614
|
+
if (rules.levels.get("importToDefault") !== "off") mergeLeveledResult(result, checkImportToDefault(pkg, shouldFix), "importToDefault", rules);
|
|
13615
|
+
if (rules.levels.get("neutralToDefault") !== "off") mergeLeveledResult(result, checkNeutralToDefault(pkg, shouldFix, (message) => console.warn(chalk.yellow(message))), "neutralToDefault", rules);
|
|
13616
|
+
if (rules.levels.get("defaultExportOrder") !== "off") mergeLeveledResult(result, checkDefaultExportOrder(pkg, shouldFix, (message) => console.warn(chalk.yellow(message))), "defaultExportOrder", rules);
|
|
13617
|
+
if (rules.levels.get("rootTypes") !== "off") mergeLeveledResult(result, checkRootTypes(pkg, shouldFix), "rootTypes", rules);
|
|
13618
|
+
if (rules.levels.get("platform") !== "off") mergeLeveledResult(result, await checkPlatform(pkgDir, pkg, shouldFix), "platform", rules);
|
|
13619
|
+
if (rules.levels.get("sideEffects") !== "off") mergeLeveledResult(result, checkSideEffects(pkg), "sideEffects", rules);
|
|
13620
|
+
if (rules.levels.get("resolutions") !== "off") mergeLeveledResult(result, checkResolutions(pkg), "resolutions", rules);
|
|
13513
13621
|
return [
|
|
13514
13622
|
result.errors,
|
|
13515
13623
|
result.warnings,
|
|
@@ -13585,42 +13693,89 @@ async function runPublintLibrary(pkgDir, pkg, isStrict, shouldPack) {
|
|
|
13585
13693
|
warnings: messages.filter((message) => message.type !== "error").length
|
|
13586
13694
|
};
|
|
13587
13695
|
}
|
|
13588
|
-
|
|
13696
|
+
function applyEffectiveExcludes(pkg, exclude, rules) {
|
|
13697
|
+
const effectiveExclude = Boolean(pkg.private) ? /* @__PURE__ */ new Set([...exclude, ...PUBLISH_ONLY_CHECKS]) : exclude;
|
|
13698
|
+
for (const check of effectiveExclude) {
|
|
13699
|
+
rules.levels.set(check, "off");
|
|
13700
|
+
rules.explicit.add(check);
|
|
13701
|
+
}
|
|
13702
|
+
}
|
|
13703
|
+
async function runCustomPublintPass(pkgDir, pkg, shouldFix, rules) {
|
|
13704
|
+
const [errors, warnings, modified] = await customPubLint(pkgDir, pkg, shouldFix, rules);
|
|
13705
|
+
if (shouldFix && modified) {
|
|
13706
|
+
await writePackageJson(pkgDir, pkg);
|
|
13707
|
+
return {
|
|
13708
|
+
pkg: await readPackageJson(pkgDir),
|
|
13709
|
+
result: {
|
|
13710
|
+
errors,
|
|
13711
|
+
modified,
|
|
13712
|
+
warnings
|
|
13713
|
+
}
|
|
13714
|
+
};
|
|
13715
|
+
}
|
|
13716
|
+
return {
|
|
13717
|
+
pkg,
|
|
13718
|
+
result: {
|
|
13719
|
+
errors,
|
|
13720
|
+
modified,
|
|
13721
|
+
warnings
|
|
13722
|
+
}
|
|
13723
|
+
};
|
|
13724
|
+
}
|
|
13725
|
+
async function runLeveledPublintLibrary(pkgDir, pkg, isStrict, shouldPack, rules) {
|
|
13726
|
+
const level = rules.levels.get("publint");
|
|
13727
|
+
if (level === "off") return {
|
|
13728
|
+
errors: 0,
|
|
13729
|
+
warnings: 0
|
|
13730
|
+
};
|
|
13731
|
+
const library = await runPublintLibrary(pkgDir, pkg, isStrict, shouldPack);
|
|
13732
|
+
if (!rules.explicit.has("publint")) return library;
|
|
13733
|
+
const issueCount = library.errors + library.warnings;
|
|
13734
|
+
return level === "error" ? {
|
|
13735
|
+
errors: issueCount,
|
|
13736
|
+
warnings: 0
|
|
13737
|
+
} : {
|
|
13738
|
+
errors: 0,
|
|
13739
|
+
warnings: issueCount
|
|
13740
|
+
};
|
|
13741
|
+
}
|
|
13742
|
+
function runLeveledCompileTargets(pkgDir, shouldFix, rules) {
|
|
13743
|
+
const level = rules.levels.get("compileTargets");
|
|
13744
|
+
const raw = level === "off" ? {
|
|
13745
|
+
errors: 0,
|
|
13746
|
+
warnings: 0
|
|
13747
|
+
} : checkCompileTargets(pkgDir, shouldFix);
|
|
13748
|
+
if (!rules.explicit.has("compileTargets")) return raw;
|
|
13749
|
+
const issueCount = raw.errors + raw.warnings;
|
|
13750
|
+
return level === "error" ? {
|
|
13751
|
+
errors: issueCount,
|
|
13752
|
+
warnings: 0
|
|
13753
|
+
} : {
|
|
13754
|
+
errors: 0,
|
|
13755
|
+
warnings: issueCount
|
|
13756
|
+
};
|
|
13757
|
+
}
|
|
13758
|
+
const packagePublintDetailed = async ({ exclude = /* @__PURE__ */ new Set(), ruleLevels, shouldFix = false, shouldPack: shouldPackParam, pkgDir: pkgDirParam, isStrict = isStrictMode(), verbose: _verbose = false } = {}) => {
|
|
13589
13759
|
const pkgDir = PATH.resolve(pkgDirParam ?? INIT_CWD());
|
|
13590
13760
|
const wsPublintConfig = normalizePublintConfig$1(await loadWorkspaceCommandConfig(pkgDir, "publint"));
|
|
13591
|
-
const workspaceExclude = mergeWorkspaceExclude(exclude, wsPublintConfig);
|
|
13592
13761
|
const shouldPack = shouldPackParam ?? wsPublintConfig.pack ?? true;
|
|
13762
|
+
const resolvedRules = ruleLevels === void 0 ? resolvePublintRules(wsPublintConfig) : cloneResolvedPublintRules(ruleLevels);
|
|
13593
13763
|
let pkg = await readPackageJson(pkgDir);
|
|
13594
|
-
|
|
13764
|
+
applyEffectiveExcludes(pkg, exclude, resolvedRules);
|
|
13595
13765
|
console.log(chalk.green(`Publint: ${String(pkg.name)}${Boolean(pkg.private) ? chalk.gray(" (private)") : ""}`));
|
|
13596
13766
|
console.log(chalk.gray(pkgDir));
|
|
13597
|
-
let
|
|
13598
|
-
|
|
13599
|
-
|
|
13600
|
-
|
|
13601
|
-
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
13605
|
-
|
|
13606
|
-
await writePackageJson(pkgDir, pkg);
|
|
13607
|
-
pkg = await readPackageJson(pkgDir);
|
|
13608
|
-
}
|
|
13609
|
-
};
|
|
13610
|
-
if (shouldFix) await runCustomChecks();
|
|
13611
|
-
if (!effectiveExclude.has("publint")) {
|
|
13612
|
-
const library = await runPublintLibrary(pkgDir, pkg, isStrict, shouldPack);
|
|
13613
|
-
libraryErrors = library.errors;
|
|
13614
|
-
libraryWarnings = library.warnings;
|
|
13615
|
-
}
|
|
13616
|
-
if (!shouldFix) await runCustomChecks();
|
|
13617
|
-
const compileTargets = effectiveExclude.has("compileTargets") ? {
|
|
13618
|
-
errors: 0,
|
|
13619
|
-
warnings: 0
|
|
13620
|
-
} : checkCompileTargets(pkgDir, shouldFix);
|
|
13767
|
+
let customResult = emptyCustomResult();
|
|
13768
|
+
if (shouldFix) {
|
|
13769
|
+
const customPass = await runCustomPublintPass(pkgDir, pkg, shouldFix, resolvedRules);
|
|
13770
|
+
customResult = customPass.result;
|
|
13771
|
+
pkg = customPass.pkg;
|
|
13772
|
+
}
|
|
13773
|
+
const library = await runLeveledPublintLibrary(pkgDir, pkg, isStrict, shouldPack, resolvedRules);
|
|
13774
|
+
if (!shouldFix) customResult = (await runCustomPublintPass(pkgDir, pkg, shouldFix, resolvedRules)).result;
|
|
13775
|
+
const compileTargets = runLeveledCompileTargets(pkgDir, shouldFix, resolvedRules);
|
|
13621
13776
|
return {
|
|
13622
|
-
errors:
|
|
13623
|
-
warnings:
|
|
13777
|
+
errors: library.errors + customResult.errors + compileTargets.errors,
|
|
13778
|
+
warnings: library.warnings + customResult.warnings + compileTargets.warnings
|
|
13624
13779
|
};
|
|
13625
13780
|
};
|
|
13626
13781
|
const packagePublint = async (params = {}) => {
|
|
@@ -13629,28 +13784,20 @@ const packagePublint = async (params = {}) => {
|
|
|
13629
13784
|
};
|
|
13630
13785
|
//#endregion
|
|
13631
13786
|
//#region src/actions/publint.ts
|
|
13632
|
-
function resolveExclude(publintConfig, cliExclude, cliInclude) {
|
|
13633
|
-
const hasExclude = (publintConfig.exclude?.length ?? 0) > 0 || (cliExclude?.length ?? 0) > 0;
|
|
13634
|
-
const hasInclude = (publintConfig.include?.length ?? 0) > 0 || (cliInclude?.length ?? 0) > 0;
|
|
13635
|
-
if (hasExclude && hasInclude) {
|
|
13636
|
-
console.error(chalk.red("Publint: --include and --exclude cannot be used together"));
|
|
13637
|
-
return;
|
|
13638
|
-
}
|
|
13639
|
-
if (hasInclude) {
|
|
13640
|
-
const include = /* @__PURE__ */ new Set([...publintConfig.include ?? [], ...cliInclude ?? []]);
|
|
13641
|
-
return new Set(ALL_PUBLINT_CHECKS.filter((c) => !include.has(c)));
|
|
13642
|
-
}
|
|
13643
|
-
return /* @__PURE__ */ new Set([...publintConfig.exclude ?? [], ...cliExclude ?? []]);
|
|
13644
|
-
}
|
|
13645
13787
|
function normalizePublintConfig(value) {
|
|
13646
13788
|
if (typeof value === "object") return value;
|
|
13647
13789
|
return {};
|
|
13648
13790
|
}
|
|
13791
|
+
function offChecks(rules) {
|
|
13792
|
+
const excluded = /* @__PURE__ */ new Set();
|
|
13793
|
+
for (const [check, level] of rules.levels) if (level === "off") excluded.add(check);
|
|
13794
|
+
return excluded;
|
|
13795
|
+
}
|
|
13649
13796
|
async function loadPublintOptions() {
|
|
13650
13797
|
const config = await loadConfig();
|
|
13651
13798
|
const publintConfig = normalizePublintConfig(config.commands?.publint ?? config.publint);
|
|
13652
13799
|
return {
|
|
13653
|
-
exclude:
|
|
13800
|
+
exclude: offChecks(resolvePublintRules(publintConfig)),
|
|
13654
13801
|
pack: publintConfig.pack ?? true
|
|
13655
13802
|
};
|
|
13656
13803
|
}
|