@ariestools/toolchain 9.0.1 → 9.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.
Files changed (52) hide show
  1. package/README.md +28 -0
  2. package/dist/actions/enable/editXyConfigCompile.d.ts +32 -0
  3. package/dist/actions/enable/editXyConfigCompile.d.ts.map +1 -0
  4. package/dist/actions/enable/index.d.ts +3 -0
  5. package/dist/actions/enable/index.d.ts.map +1 -0
  6. package/dist/actions/enable/tsNative.d.ts +36 -0
  7. package/dist/actions/enable/tsNative.d.ts.map +1 -0
  8. package/dist/actions/index.d.ts +2 -0
  9. package/dist/actions/index.d.ts.map +1 -1
  10. package/dist/actions/lint.d.ts +10 -1
  11. package/dist/actions/lint.d.ts.map +1 -1
  12. package/dist/actions/lintMode.d.ts +18 -0
  13. package/dist/actions/lintMode.d.ts.map +1 -0
  14. package/dist/actions/lintNext.d.ts +7 -1
  15. package/dist/actions/lintNext.d.ts.map +1 -1
  16. package/dist/actions/lintNextRun.d.ts +3 -1
  17. package/dist/actions/lintNextRun.d.ts.map +1 -1
  18. package/dist/actions/lintNextWorker.d.ts +6 -0
  19. package/dist/actions/lintNextWorker.d.ts.map +1 -1
  20. package/dist/actions/lintSharedTypecheck.d.ts +10 -0
  21. package/dist/actions/lintSharedTypecheck.d.ts.map +1 -0
  22. package/dist/actions/lintSharedTypecheckRules.d.ts +24 -0
  23. package/dist/actions/lintSharedTypecheckRules.d.ts.map +1 -0
  24. package/dist/actions/package/compile/XyConfig.d.ts +7 -2
  25. package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
  26. package/dist/actions/package/compile/resolveTscBin.d.ts +10 -0
  27. package/dist/actions/package/compile/resolveTscBin.d.ts.map +1 -1
  28. package/dist/actions/package/compile/runTsc.d.ts.map +1 -1
  29. package/dist/actions/relint.d.ts +10 -1
  30. package/dist/actions/relint.d.ts.map +1 -1
  31. package/dist/actions/tsc-validate/sharedValidate.d.ts +18 -0
  32. package/dist/actions/tsc-validate/sharedValidate.d.ts.map +1 -1
  33. package/dist/bin/package/build.mjs +127 -86
  34. package/dist/bin/package/build.mjs.map +1 -1
  35. package/dist/bin/package/clean.mjs +34 -1
  36. package/dist/bin/package/clean.mjs.map +1 -1
  37. package/dist/bin/package/compile.mjs +133 -89
  38. package/dist/bin/package/compile.mjs.map +1 -1
  39. package/dist/bin/package/publint.mjs +34 -1
  40. package/dist/bin/package/publint.mjs.map +1 -1
  41. package/dist/bin/package/recompile.mjs +127 -86
  42. package/dist/bin/package/recompile.mjs.map +1 -1
  43. package/dist/bin/package/sync-layout.mjs +40 -4
  44. package/dist/bin/package/sync-layout.mjs.map +1 -1
  45. package/dist/bin/xy.mjs +962 -120
  46. package/dist/bin/xy.mjs.map +1 -1
  47. package/dist/xy/common/enable/index.d.ts +3 -0
  48. package/dist/xy/common/enable/index.d.ts.map +1 -0
  49. package/dist/xy/common/index.d.ts.map +1 -1
  50. package/dist/xy/lint/lint/runCommand.d.ts.map +1 -1
  51. package/dist/xy/lint/relintCommand.d.ts.map +1 -1
  52. package/package.json +10 -9
package/dist/bin/xy.mjs CHANGED
@@ -19,12 +19,14 @@ import { execFile, execFileSync, execSync, spawn } from "node:child_process";
19
19
  import * as readline$1 from "node:readline";
20
20
  import readline, { createInterface } from "node:readline";
21
21
  import { fileURLToPath as fileURLToPath$1 } from "url";
22
- import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
22
+ import { createJiti } from "jiti";
23
23
  import { performance as performance$1 } from "node:perf_hooks";
24
24
  import util, { promisify, stripVTControlCharacters } from "node:util";
25
25
  import ts from "typescript";
26
26
  import { createHash, randomBytes } from "node:crypto";
27
- import { applyRecommendedConfigTypeChecked, parseRecommendedConfigSource } from "@ariestools/eslint-config-flat";
27
+ import { ESLint } from "eslint";
28
+ import { applyRecommendedConfigTypeChecked, collectTypeCheckedRuleNames, getRuleSeverity, parseRecommendedConfigSource } from "@ariestools/eslint-config-flat";
29
+ import { includeIgnoreFile } from "eslint/config";
28
30
  import { pipeline } from "node:stream/promises";
29
31
  import zlib from "node:zlib";
30
32
  import { builtinRules } from "eslint/use-at-your-own-risk";
@@ -10457,6 +10459,39 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
10457
10459
  exports.cosmiconfigSync = cosmiconfigSync;
10458
10460
  }));
10459
10461
  //#endregion
10462
+ //#region ../../node_modules/.pnpm/cosmiconfig-typescript-loader@6.3.0_@types+node@26.2.0_cosmiconfig@10.0.0_typescript@6.0.3/node_modules/cosmiconfig-typescript-loader/dist/esm/typescript-compile-error.mjs
10463
+ var TypeScriptCompileError = class _TypeScriptCompileError extends Error {
10464
+ constructor(message) {
10465
+ super(message);
10466
+ this.name = this.constructor.name;
10467
+ Object.setPrototypeOf(this, new.target.prototype);
10468
+ }
10469
+ static fromError(error) {
10470
+ const message = `TypeScriptLoader failed to compile TypeScript:
10471
+ ${error.message}`;
10472
+ const newError = new _TypeScriptCompileError(message);
10473
+ newError.stack = error.stack;
10474
+ return newError;
10475
+ }
10476
+ };
10477
+ //#endregion
10478
+ //#region ../../node_modules/.pnpm/cosmiconfig-typescript-loader@6.3.0_@types+node@26.2.0_cosmiconfig@10.0.0_typescript@6.0.3/node_modules/cosmiconfig-typescript-loader/dist/esm/loader.mjs
10479
+ function TypeScriptLoader(options) {
10480
+ const loader = createJiti("", {
10481
+ interopDefault: true,
10482
+ ...options
10483
+ });
10484
+ return async (path, _content) => {
10485
+ try {
10486
+ const result = await loader.import(path);
10487
+ return result.default || result;
10488
+ } catch (error) {
10489
+ if (error instanceof Error) throw TypeScriptCompileError.fromError(error);
10490
+ throw error;
10491
+ }
10492
+ };
10493
+ }
10494
+ //#endregion
10460
10495
  //#region src/lib/ruleCommandRegistry.ts
10461
10496
  /** Title for the root `xy --rules` catalog. */
10462
10497
  const ROOT_RULES_TITLE = "XY Rules";
@@ -10597,7 +10632,7 @@ In-flight workspace loads — concurrent jobs for the same dir share one search.
10597
10632
  */
10598
10633
  const workspaceConfigLoadPromises = /* @__PURE__ */ new Map();
10599
10634
  const deprecationWarned = /* @__PURE__ */ new Set();
10600
- function isRecord$9(value) {
10635
+ function isRecord$10(value) {
10601
10636
  return typeof value === "object" && value !== null && !Array.isArray(value);
10602
10637
  }
10603
10638
  const explorerState = {};
@@ -10678,12 +10713,12 @@ function warnOnce(key, message) {
10678
10713
  */
10679
10714
  function resolveCommandField(cfg, commandName, configPath) {
10680
10715
  const configKey = canonicalRuleConfigKey(commandName);
10681
- const commands = isRecord$9(cfg.commands) ? cfg.commands : void 0;
10716
+ const commands = isRecord$10(cfg.commands) ? cfg.commands : void 0;
10682
10717
  const fromCommands = commands?.[configKey];
10683
- if (isRecord$9(fromCommands)) return fromCommands;
10718
+ if (isRecord$10(fromCommands)) return fromCommands;
10684
10719
  for (const alias of deprecatedRuleConfigAliases(configKey)) {
10685
10720
  const fromAlias = commands?.[alias];
10686
- if (!isRecord$9(fromAlias)) continue;
10721
+ if (!isRecord$10(fromAlias)) continue;
10687
10722
  warnOnce(`${configPath ?? "unknown"}:commands.${alias}`, `[xy] Deprecated: "commands.${alias}" in ${configPath ?? "xy.config"} — use "commands.${configKey}"`);
10688
10723
  return fromAlias;
10689
10724
  }
@@ -10695,7 +10730,7 @@ function resolveCommandField(cfg, commandName, configPath) {
10695
10730
  return {};
10696
10731
  }
10697
10732
  function mergeRuleConfigs(target, source) {
10698
- if (isRecord$9(target) && isRecord$9(source)) return {
10733
+ if (isRecord$10(target) && isRecord$10(source)) return {
10699
10734
  ...target,
10700
10735
  ...source
10701
10736
  };
@@ -19434,7 +19469,7 @@ const SEVERITIES = /* @__PURE__ */ new Set([
19434
19469
  ]);
19435
19470
  const SCOPES = /* @__PURE__ */ new Set(["development", "runtime"]);
19436
19471
  const RELATIONSHIPS = /* @__PURE__ */ new Set(["direct", "transitive"]);
19437
- function isRecord$8(value) {
19472
+ function isRecord$9(value) {
19438
19473
  return typeof value === "object" && value !== null && !Array.isArray(value);
19439
19474
  }
19440
19475
  function readString(value) {
@@ -19453,13 +19488,13 @@ function readRelationship(value) {
19453
19488
  return RELATIONSHIPS.has(raw) ? raw : "unknown";
19454
19489
  }
19455
19490
  function parseDependabotAlert(raw) {
19456
- if (!isRecord$8(raw)) return void 0;
19457
- const dependency = isRecord$8(raw.dependency) ? raw.dependency : {};
19458
- const dependencyPackage = isRecord$8(dependency.package) ? dependency.package : {};
19459
- const advisory = isRecord$8(raw.security_advisory) ? raw.security_advisory : {};
19460
- const vulnerability = isRecord$8(raw.security_vulnerability) ? raw.security_vulnerability : {};
19461
- const patched = isRecord$8(vulnerability.first_patched_version) ? vulnerability.first_patched_version : {};
19462
- const repository = isRecord$8(raw.repository) ? raw.repository : {};
19491
+ if (!isRecord$9(raw)) return void 0;
19492
+ const dependency = isRecord$9(raw.dependency) ? raw.dependency : {};
19493
+ const dependencyPackage = isRecord$9(dependency.package) ? dependency.package : {};
19494
+ const advisory = isRecord$9(raw.security_advisory) ? raw.security_advisory : {};
19495
+ const vulnerability = isRecord$9(raw.security_vulnerability) ? raw.security_vulnerability : {};
19496
+ const patched = isRecord$9(vulnerability.first_patched_version) ? vulnerability.first_patched_version : {};
19497
+ const repository = isRecord$9(raw.repository) ? raw.repository : {};
19463
19498
  const packageName = readString(dependencyPackage.name);
19464
19499
  if (packageName.length === 0) return void 0;
19465
19500
  const patchedVersion = readString(patched.identifier);
@@ -21759,8 +21794,8 @@ const MAJOR_CEILINGS = /* @__PURE__ */ new Map([["typescript", {
21759
21794
  reason: [
21760
21795
  "typescript@7 is the native compiler and exports no compiler API —",
21761
21796
  "ESLint, deplint, dead-code and api-exposure all load it from `typescript`.",
21762
- "Install it side by side instead: `\"typescript-native\": \"npm:typescript@7\"`",
21763
- "with `compile.compiler: \"native\"`."
21797
+ "Install it side by side instead: run `xy enable ts-native`, or add",
21798
+ "`\"typescript-native\": \"npm:typescript@7\"` with `compile.compiler: \"native\"`."
21764
21799
  ].join(" ")
21765
21800
  }]]);
21766
21801
  /**
@@ -23022,7 +23057,7 @@ const RULE_LEVELS$2 = /* @__PURE__ */ new Set([
23022
23057
  "off",
23023
23058
  "warn"
23024
23059
  ]);
23025
- function isRecord$7(value) {
23060
+ function isRecord$8(value) {
23026
23061
  return typeof value === "object" && value !== null && !Array.isArray(value);
23027
23062
  }
23028
23063
  function isValidWeight(value) {
@@ -23039,7 +23074,7 @@ function parseTupleRuleSetting(location, setting) {
23039
23074
  if (setting.length !== 2) throw new TypeError(`${location} tuple must be [level, options]`);
23040
23075
  const [level, options] = setting;
23041
23076
  if (!isRuleLevel$5(level)) throw new TypeError(`${location} level must be "error", "warn", or "off"`);
23042
- if (!isRecord$7(options)) throw new TypeError(`${location} options must be an object`);
23077
+ if (!isRecord$8(options)) throw new TypeError(`${location} options must be an object`);
23043
23078
  return {
23044
23079
  enabled: level !== "off",
23045
23080
  level,
@@ -23072,7 +23107,7 @@ function parseRuleSetting(location, setting) {
23072
23107
  weight: parseWeight(location, setting)
23073
23108
  };
23074
23109
  if (Array.isArray(setting)) return parseTupleRuleSetting(location, setting);
23075
- if (isRecord$7(setting)) return parseObjectRuleSetting(location, setting);
23110
+ if (isRecord$8(setting)) return parseObjectRuleSetting(location, setting);
23076
23111
  throw new TypeError(`${location} must be a boolean, rule level, number, "infinite", [level, options], or { enabled?, level?, weight? } object`);
23077
23112
  }
23078
23113
  function validateRuleIds(location, rules) {
@@ -25658,21 +25693,16 @@ function isInPackageSubdirectory(pkg, fileName, directoryName) {
25658
25693
  return relative !== "" && !relative.startsWith("../") && relative !== "..";
25659
25694
  }
25660
25695
  /**
25661
- * Validates one package in-process, reproducing exactly the program that
25662
- * `package-compile --validate-only` runs via `tsc -p`: the package's own
25663
- * tsconfig (its `lib`, `jsx`, `types`, `paths` — every option is the
25664
- * package's own), the same file set (tsconfig includes minus nested
25665
- * workspace dirs), with `noEmit` and `rootDir` overridden the same way.
25666
- * Only the compiler *host* is shared, for SourceFile reuse across packages.
25696
+ Create one package-specific TypeScript Program while reusing immutable parsed
25697
+ SourceFiles from earlier packages in the same process. Compiler options and the
25698
+ semantic Program remain package-specific.
25667
25699
  */
25668
- function validateWorkspaceInProcess(workspaceDir, cache) {
25700
+ function createWorkspaceProgramInProcess(workspaceDir, cache) {
25669
25701
  const pkg = PATH.resolve(workspaceDir);
25670
25702
  const tsconfigPath = PATH.join(pkg, "tsconfig.json");
25671
25703
  if (!fs.existsSync(tsconfigPath)) return {
25672
- errorCount: 0,
25673
- fileCount: 0,
25674
- formatted: "",
25675
- skipped: "no-tsconfig"
25704
+ kind: "skipped",
25705
+ reason: "no-tsconfig"
25676
25706
  };
25677
25707
  const formatHost = {
25678
25708
  getCanonicalFileName: (fileName) => fileName,
@@ -25682,14 +25712,14 @@ function validateWorkspaceInProcess(workspaceDir, cache) {
25682
25712
  const configFile = ts.readConfigFile(tsconfigPath, (fileName) => ts.sys.readFile(fileName));
25683
25713
  if (configFile.error) return {
25684
25714
  errorCount: 1,
25685
- fileCount: 0,
25686
- formatted: ts.formatDiagnosticsWithColorAndContext([configFile.error], formatHost)
25715
+ formatted: ts.formatDiagnosticsWithColorAndContext([configFile.error], formatHost),
25716
+ kind: "error"
25687
25717
  };
25688
25718
  const parsed = ts.parseJsonConfigFileContent(configFile.config, ts.sys, pkg, void 0, tsconfigPath);
25689
25719
  if (parsed.errors.length > 0) return {
25690
25720
  errorCount: parsed.errors.length,
25691
- fileCount: 0,
25692
- formatted: ts.formatDiagnosticsWithColorAndContext(parsed.errors, formatHost)
25721
+ formatted: ts.formatDiagnosticsWithColorAndContext(parsed.errors, formatHost),
25722
+ kind: "error"
25693
25723
  };
25694
25724
  const rootNames = parsed.fileNames.filter((fileName) => !isInPackageSubdirectory(pkg, fileName, "packages"));
25695
25725
  const options = {
@@ -25697,16 +25727,46 @@ function validateWorkspaceInProcess(workspaceDir, cache) {
25697
25727
  noEmit: true,
25698
25728
  rootDir: pkg
25699
25729
  };
25700
- const program = ts.createProgram({
25701
- host: createSharedHost(options, cache),
25702
- options,
25730
+ return {
25731
+ kind: "ready",
25732
+ program: ts.createProgram({
25733
+ host: createSharedHost(options, cache),
25734
+ options,
25735
+ rootNames
25736
+ }),
25703
25737
  rootNames
25704
- });
25705
- const diagnostics = ts.getPreEmitDiagnostics(program);
25738
+ };
25739
+ }
25740
+ /**
25741
+ * Validates one package in-process, reproducing exactly the program that
25742
+ * `package-compile --validate-only` runs via `tsc -p`: the package's own
25743
+ * tsconfig (its `lib`, `jsx`, `types`, `paths` — every option is the
25744
+ * package's own), the same file set (tsconfig includes minus nested
25745
+ * workspace dirs), with `noEmit` and `rootDir` overridden the same way.
25746
+ * Only the compiler *host* is shared, for SourceFile reuse across packages.
25747
+ */
25748
+ function validateWorkspaceInProcess(workspaceDir, cache) {
25749
+ const result = createWorkspaceProgramInProcess(workspaceDir, cache);
25750
+ if (result.kind === "skipped") return {
25751
+ errorCount: 0,
25752
+ fileCount: 0,
25753
+ formatted: "",
25754
+ skipped: "no-tsconfig"
25755
+ };
25756
+ if (result.kind === "error") return {
25757
+ errorCount: result.errorCount,
25758
+ fileCount: 0,
25759
+ formatted: result.formatted
25760
+ };
25761
+ const diagnostics = ts.getPreEmitDiagnostics(result.program);
25706
25762
  return {
25707
25763
  errorCount: diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error).length,
25708
- fileCount: rootNames.length,
25709
- formatted: diagnostics.length > 0 ? ts.formatDiagnosticsWithColorAndContext(diagnostics, formatHost) : ""
25764
+ fileCount: result.rootNames.length,
25765
+ formatted: diagnostics.length > 0 ? ts.formatDiagnosticsWithColorAndContext(diagnostics, {
25766
+ getCanonicalFileName: (fileName) => fileName,
25767
+ getCurrentDirectory: () => PATH.resolve(workspaceDir),
25768
+ getNewLine: () => ts.sys.newLine
25769
+ }) : ""
25710
25770
  };
25711
25771
  }
25712
25772
  //#endregion
@@ -26147,18 +26207,18 @@ function findXyConfigFile(dir) {
26147
26207
  if (fs.existsSync(candidate)) return candidate;
26148
26208
  }
26149
26209
  }
26150
- function isJsonConfigPath(configPath) {
26210
+ function isJsonConfigPath$1(configPath) {
26151
26211
  const base = PATH.basename(configPath);
26152
26212
  return base === ".xyrc.json" || base.endsWith(".json");
26153
26213
  }
26154
- function getPropertyName$2(prop) {
26214
+ function getPropertyName$3(prop) {
26155
26215
  if (ts.isPropertyAssignment(prop)) {
26156
26216
  const { name } = prop;
26157
26217
  if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNoSubstitutionTemplateLiteral(name)) return name.text;
26158
26218
  }
26159
26219
  if (ts.isShorthandPropertyAssignment(prop)) return prop.name.text;
26160
26220
  }
26161
- function isWhitespace$1(char) {
26221
+ function isWhitespace$2(char) {
26162
26222
  return char !== void 0 && /\s/.test(char);
26163
26223
  }
26164
26224
  /**
@@ -26169,9 +26229,9 @@ function findDeplintPackagesAssignment(sourceFile) {
26169
26229
  let found;
26170
26230
  function visit(node) {
26171
26231
  if (found !== void 0) return;
26172
- if (ts.isPropertyAssignment(node) && getPropertyName$2(node) === "packages" && ts.isObjectLiteralExpression(node.initializer)) {
26232
+ if (ts.isPropertyAssignment(node) && getPropertyName$3(node) === "packages" && ts.isObjectLiteralExpression(node.initializer)) {
26173
26233
  const parentObject = node.parent;
26174
- if (ts.isObjectLiteralExpression(parentObject) && ts.isPropertyAssignment(parentObject.parent) && getPropertyName$2(parentObject.parent) === "deplint") {
26234
+ if (ts.isObjectLiteralExpression(parentObject) && ts.isPropertyAssignment(parentObject.parent) && getPropertyName$3(parentObject.parent) === "deplint") {
26175
26235
  found = node;
26176
26236
  return;
26177
26237
  }
@@ -26185,7 +26245,7 @@ function findDeplintObjectAssignment(sourceFile) {
26185
26245
  let found;
26186
26246
  function visit(node) {
26187
26247
  if (found !== void 0) return;
26188
- if (ts.isPropertyAssignment(node) && getPropertyName$2(node) === "deplint" && ts.isObjectLiteralExpression(node.initializer)) {
26248
+ if (ts.isPropertyAssignment(node) && getPropertyName$3(node) === "deplint" && ts.isObjectLiteralExpression(node.initializer)) {
26189
26249
  found = node;
26190
26250
  return;
26191
26251
  }
@@ -26198,7 +26258,7 @@ function findCommandsObjectAssignment(sourceFile) {
26198
26258
  let found;
26199
26259
  function visit(node) {
26200
26260
  if (found !== void 0) return;
26201
- if (ts.isPropertyAssignment(node) && getPropertyName$2(node) === "commands" && ts.isObjectLiteralExpression(node.initializer)) {
26261
+ if (ts.isPropertyAssignment(node) && getPropertyName$3(node) === "commands" && ts.isObjectLiteralExpression(node.initializer)) {
26202
26262
  found = node;
26203
26263
  return;
26204
26264
  }
@@ -26207,7 +26267,7 @@ function findCommandsObjectAssignment(sourceFile) {
26207
26267
  visit(sourceFile);
26208
26268
  return found;
26209
26269
  }
26210
- function findDefaultExportObject(sourceFile) {
26270
+ function findDefaultExportObject$1(sourceFile) {
26211
26271
  for (const statement of sourceFile.statements) {
26212
26272
  if (ts.isExportAssignment(statement) && !statement.isExportEquals && ts.isObjectLiteralExpression(statement.expression)) return statement.expression;
26213
26273
  if (!ts.isVariableStatement(statement)) continue;
@@ -26230,7 +26290,7 @@ function formatPackageConfigValue(config) {
26230
26290
  if (config.refType !== void 0) parts.push(`refType: '${config.refType}'`);
26231
26291
  return `{ ${parts.join(", ")} }`;
26232
26292
  }
26233
- function detectIndent$1(text, packagesObject, sourceFile) {
26293
+ function detectIndent$2(text, packagesObject, sourceFile) {
26234
26294
  if (packagesObject.properties.length > 0) {
26235
26295
  const start = packagesObject.properties[0].getStart(sourceFile);
26236
26296
  let lineStart = start;
@@ -26246,18 +26306,18 @@ function detectIndent$1(text, packagesObject, sourceFile) {
26246
26306
  function findPackageProperty(packagesObject, dependency) {
26247
26307
  for (const prop of packagesObject.properties) {
26248
26308
  if (!ts.isPropertyAssignment(prop)) continue;
26249
- if (getPropertyName$2(prop) === dependency) return prop;
26309
+ if (getPropertyName$3(prop) === dependency) return prop;
26250
26310
  }
26251
26311
  }
26252
- function removePropertyFromObject(text, prop, sourceFile) {
26312
+ function removePropertyFromObject$1(text, prop, sourceFile) {
26253
26313
  let start = prop.getFullStart();
26254
26314
  let end = prop.getEnd();
26255
26315
  let cursor = end;
26256
- while (isWhitespace$1(text[cursor])) cursor++;
26316
+ while (isWhitespace$2(text[cursor])) cursor++;
26257
26317
  if (text[cursor] === ",") end = cursor + 1;
26258
26318
  else {
26259
26319
  let back = prop.getStart(sourceFile) - 1;
26260
- while (back >= 0 && isWhitespace$1(text[back])) back--;
26320
+ while (back >= 0 && isWhitespace$2(text[back])) back--;
26261
26321
  if (text[back] === ",") start = back;
26262
26322
  }
26263
26323
  return `${text.slice(0, start)}${text.slice(end)}`;
@@ -26268,7 +26328,7 @@ function upsertPackagePropertyInObject(text, packagesAssignment, sourceFile, dep
26268
26328
  const existing = findPackageProperty(packagesObject, dependency);
26269
26329
  if (config === void 0) {
26270
26330
  if (existing === void 0) return text;
26271
- return removePropertyFromObject(text, existing, sourceFile);
26331
+ return removePropertyFromObject$1(text, existing, sourceFile);
26272
26332
  }
26273
26333
  if (existing !== void 0) {
26274
26334
  const valueText = formatPackageConfigValue(config);
@@ -26278,7 +26338,7 @@ function upsertPackagePropertyInObject(text, packagesAssignment, sourceFile, dep
26278
26338
  }
26279
26339
  const valueText = formatPackageConfigValue(config);
26280
26340
  const keyText = quotePackageKey(dependency);
26281
- const indent = detectIndent$1(text, packagesObject, sourceFile);
26341
+ const indent = detectIndent$2(text, packagesObject, sourceFile);
26282
26342
  const entry = `${keyText}: ${valueText}`;
26283
26343
  const openBraceEnd = packagesObject.getStart(sourceFile) + 1;
26284
26344
  const insertion = `\n${indent}${entry},`;
@@ -26287,7 +26347,7 @@ function upsertPackagePropertyInObject(text, packagesAssignment, sourceFile, dep
26287
26347
  function insertPackagesIntoDeplint(text, deplintAssignment, sourceFile, dependency, config) {
26288
26348
  if (!ts.isObjectLiteralExpression(deplintAssignment.initializer)) throw new TypeError("deplint must be an object literal");
26289
26349
  const deplintObject = deplintAssignment.initializer;
26290
- const indent = detectIndent$1(text, deplintObject, sourceFile);
26350
+ const indent = detectIndent$2(text, deplintObject, sourceFile);
26291
26351
  const packagesBlock = `packages: {\n${indent} ${quotePackageKey(dependency)}: ${formatPackageConfigValue(config)},\n${indent}}`;
26292
26352
  const openBraceEnd = deplintObject.getStart(sourceFile) + 1;
26293
26353
  const insertion = `\n${indent}${packagesBlock},`;
@@ -26296,7 +26356,7 @@ function insertPackagesIntoDeplint(text, deplintAssignment, sourceFile, dependen
26296
26356
  function insertDeplintIntoCommands(text, commandsAssignment, sourceFile, dependency, config) {
26297
26357
  if (!ts.isObjectLiteralExpression(commandsAssignment.initializer)) throw new TypeError("commands must be an object literal");
26298
26358
  const commandsObject = commandsAssignment.initializer;
26299
- const indent = detectIndent$1(text, commandsObject, sourceFile);
26359
+ const indent = detectIndent$2(text, commandsObject, sourceFile);
26300
26360
  const block = [
26301
26361
  "deplint: {",
26302
26362
  `${indent} packages: {`,
@@ -26309,7 +26369,7 @@ function insertDeplintIntoCommands(text, commandsAssignment, sourceFile, depende
26309
26369
  return `${text.slice(0, openBraceEnd)}${insertion}${text.slice(openBraceEnd)}`;
26310
26370
  }
26311
26371
  function insertCommandsIntoConfigObject(text, configObject, sourceFile, dependency, config) {
26312
- const indent = detectIndent$1(text, configObject, sourceFile);
26372
+ const indent = detectIndent$2(text, configObject, sourceFile);
26313
26373
  const block = [
26314
26374
  "commands: {",
26315
26375
  `${indent} deplint: {`,
@@ -26348,7 +26408,7 @@ function applyPackageEditsToTsSource(text, edits) {
26348
26408
  result = insertDeplintIntoCommands(result, commandsAssignment, sourceFile, edit.dependency, edit.config);
26349
26409
  continue;
26350
26410
  }
26351
- const configObject = findDefaultExportObject(sourceFile);
26411
+ const configObject = findDefaultExportObject$1(sourceFile);
26352
26412
  if (configObject !== void 0) {
26353
26413
  result = insertCommandsIntoConfigObject(result, configObject, sourceFile, edit.dependency, edit.config);
26354
26414
  continue;
@@ -26357,11 +26417,11 @@ function applyPackageEditsToTsSource(text, edits) {
26357
26417
  }
26358
26418
  return result;
26359
26419
  }
26360
- function isRecord$6(value) {
26420
+ function isRecord$7(value) {
26361
26421
  return typeof value === "object" && value !== null && !Array.isArray(value);
26362
26422
  }
26363
26423
  function readJsonPackageConfig(value) {
26364
- if (!isRecord$6(value)) return void 0;
26424
+ if (!isRecord$7(value)) return void 0;
26365
26425
  const config = {};
26366
26426
  if (typeof value.placement === "string") config.placement = value.placement;
26367
26427
  if (typeof value.presence === "string") config.presence = value.presence;
@@ -26370,10 +26430,10 @@ function readJsonPackageConfig(value) {
26370
26430
  return config;
26371
26431
  }
26372
26432
  function resolveJsonDeplintObject(root) {
26373
- const commands = isRecord$6(root.commands) ? root.commands : void 0;
26374
- if (commands !== void 0 && isRecord$6(commands.deplint)) return commands.deplint;
26375
- if (isRecord$6(root.deplint)) return root.deplint;
26376
- if (!isRecord$6(root.commands)) root.commands = {};
26433
+ const commands = isRecord$7(root.commands) ? root.commands : void 0;
26434
+ if (commands !== void 0 && isRecord$7(commands.deplint)) return commands.deplint;
26435
+ if (isRecord$7(root.deplint)) return root.deplint;
26436
+ if (!isRecord$7(root.commands)) root.commands = {};
26377
26437
  const cmds = root.commands;
26378
26438
  const deplint = {};
26379
26439
  cmds.deplint = deplint;
@@ -26386,7 +26446,7 @@ function applyPackageEditsToJsonSource(text, edits) {
26386
26446
  if (edits.length === 0) return text;
26387
26447
  const root = JSON.parse(text);
26388
26448
  const deplint = resolveJsonDeplintObject(root);
26389
- const packages = isRecord$6(deplint.packages) ? deplint.packages : deplint.packages = {};
26449
+ const packages = isRecord$7(deplint.packages) ? deplint.packages : deplint.packages = {};
26390
26450
  for (const edit of edits) if (edit.config === void 0) delete packages[edit.dependency];
26391
26451
  else packages[edit.dependency] = edit.config;
26392
26452
  if (Object.keys(packages).length === 0) delete deplint.packages;
@@ -26396,7 +26456,7 @@ function readPackageConfigFromObjectLiteral(objectLiteral) {
26396
26456
  const config = {};
26397
26457
  for (const prop of objectLiteral.properties) {
26398
26458
  if (!ts.isPropertyAssignment(prop)) continue;
26399
- const key = getPropertyName$2(prop);
26459
+ const key = getPropertyName$3(prop);
26400
26460
  if (key === void 0) continue;
26401
26461
  const { initializer } = prop;
26402
26462
  if ([
@@ -26419,11 +26479,11 @@ Read `commands.deplint.packages` (or top-level `deplint.packages`) from a config
26419
26479
  function readPackagesFromConfigFile(configPath) {
26420
26480
  const text = fs.readFileSync(configPath, "utf8");
26421
26481
  const result = /* @__PURE__ */ new Map();
26422
- if (isJsonConfigPath(configPath)) try {
26482
+ if (isJsonConfigPath$1(configPath)) try {
26423
26483
  const root = JSON.parse(text);
26424
- const commands = isRecord$6(root.commands) ? root.commands : void 0;
26425
- const deplint = commands !== void 0 && isRecord$6(commands.deplint) ? commands.deplint : isRecord$6(root.deplint) ? root.deplint : void 0;
26426
- const packages = deplint !== void 0 && isRecord$6(deplint.packages) ? deplint.packages : void 0;
26484
+ const commands = isRecord$7(root.commands) ? root.commands : void 0;
26485
+ const deplint = commands !== void 0 && isRecord$7(commands.deplint) ? commands.deplint : isRecord$7(root.deplint) ? root.deplint : void 0;
26486
+ const packages = deplint !== void 0 && isRecord$7(deplint.packages) ? deplint.packages : void 0;
26427
26487
  if (packages === void 0) return result;
26428
26488
  for (const [name, value] of Object.entries(packages)) {
26429
26489
  const config = readJsonPackageConfig(value);
@@ -26437,7 +26497,7 @@ function readPackagesFromConfigFile(configPath) {
26437
26497
  if (packagesAssignment === void 0 || !ts.isObjectLiteralExpression(packagesAssignment.initializer)) return result;
26438
26498
  for (const prop of packagesAssignment.initializer.properties) {
26439
26499
  if (!ts.isPropertyAssignment(prop)) continue;
26440
- const name = getPropertyName$2(prop);
26500
+ const name = getPropertyName$3(prop);
26441
26501
  if (name === void 0 || !ts.isObjectLiteralExpression(prop.initializer)) continue;
26442
26502
  result.set(name, readPackageConfigFromObjectLiteral(prop.initializer));
26443
26503
  }
@@ -26482,7 +26542,7 @@ function applyPackageEditsToConfigDir(dir, edits) {
26482
26542
  return configPath;
26483
26543
  }
26484
26544
  const before = fs.readFileSync(existingPath, "utf8");
26485
- const after = isJsonConfigPath(existingPath) ? applyPackageEditsToJsonSource(before, edits) : applyPackageEditsToTsSource(before, edits);
26545
+ const after = isJsonConfigPath$1(existingPath) ? applyPackageEditsToJsonSource(before, edits) : applyPackageEditsToTsSource(before, edits);
26486
26546
  if (after === before) return void 0;
26487
26547
  fs.writeFileSync(existingPath, after, "utf8");
26488
26548
  return existingPath;
@@ -26769,7 +26829,7 @@ const BUILT_IN_RULE_OPTION_KEYS = {
26769
26829
  ]),
26770
26830
  "dep.workspace.protocol": /* @__PURE__ */ new Set(["ignore", "protocol"])
26771
26831
  };
26772
- function isRecord$5(value) {
26832
+ function isRecord$6(value) {
26773
26833
  return typeof value === "object" && value !== null && !Array.isArray(value);
26774
26834
  }
26775
26835
  function isRuleLevel$4(value) {
@@ -26806,7 +26866,7 @@ function parseRuleConfig$1(ruleId, value) {
26806
26866
  const level = value[0];
26807
26867
  if (!isRuleLevel$4(level)) throw new TypeError(`${formatRuleConfigLocation$1(ruleId)} level must be one of "off", "warn", or "error"`);
26808
26868
  const options = value[1];
26809
- if (!isRecord$5(options)) throw new TypeError(`${formatRuleConfigLocation$1(ruleId)} options must be an object`);
26869
+ if (!isRecord$6(options)) throw new TypeError(`${formatRuleConfigLocation$1(ruleId)} options must be an object`);
26810
26870
  return {
26811
26871
  level,
26812
26872
  options: { ...options }
@@ -27258,7 +27318,7 @@ const npmPackageNamePattern = /^@?[a-z0-9][\w./-]*$/i;
27258
27318
  function isStorybookMainFile(filePath) {
27259
27319
  return storybookMainPattern.test(filePath);
27260
27320
  }
27261
- function getPropertyName$1(prop) {
27321
+ function getPropertyName$2(prop) {
27262
27322
  if (ts.isIdentifier(prop.name)) return prop.name.text;
27263
27323
  if (ts.isStringLiteral(prop.name) || ts.isNoSubstitutionTemplateLiteral(prop.name)) return prop.name.text;
27264
27324
  }
@@ -27275,7 +27335,7 @@ function extractFromEntry(node, collected) {
27275
27335
  return;
27276
27336
  }
27277
27337
  if (ts.isObjectLiteralExpression(node)) {
27278
- for (const prop of node.properties) if (ts.isPropertyAssignment(prop) && getPropertyName$1(prop) === "name") extractFromEntry(prop.initializer, collected);
27338
+ for (const prop of node.properties) if (ts.isPropertyAssignment(prop) && getPropertyName$2(prop) === "name") extractFromEntry(prop.initializer, collected);
27279
27339
  return;
27280
27340
  }
27281
27341
  if (ts.isCallExpression(node)) {
@@ -27292,7 +27352,7 @@ function getStorybookConfigImports(filePath, importPaths) {
27292
27352
  const collected = [];
27293
27353
  function visit(node) {
27294
27354
  if (ts.isPropertyAssignment(node)) {
27295
- const name = getPropertyName$1(node);
27355
+ const name = getPropertyName$2(node);
27296
27356
  if (name === "addons") {
27297
27357
  if (ts.isArrayLiteralExpression(node.initializer)) for (const element of node.initializer.elements) extractFromEntry(element, collected);
27298
27358
  } else if (name === "framework" || name === "builder") extractFromEntry(node.initializer, collected);
@@ -27536,7 +27596,7 @@ function getMostUsedKey(indents) {
27536
27596
  function makeIndentString(type, amount) {
27537
27597
  return (type === INDENT_TYPE_SPACE ? " " : " ").repeat(amount);
27538
27598
  }
27539
- function detectIndent(string) {
27599
+ function detectIndent$1(string) {
27540
27600
  if (typeof string !== "string") throw new TypeError("Expected a string");
27541
27601
  let indents = makeIndentsMap(string, true);
27542
27602
  if (indents.size === 0) indents = makeIndentsMap(string, false);
@@ -28172,7 +28232,7 @@ const defaultSortOrder = fields.map(({ key }) => key);
28172
28232
  const overFields = pipe(fields.map(({ key, over }) => over ? overProperty(key, over) : void 0).filter(Boolean));
28173
28233
  function editStringJSON(json, over) {
28174
28234
  if (typeof json === "string") {
28175
- const { indent, type } = detectIndent(json);
28235
+ const { indent, type } = detectIndent$1(json);
28176
28236
  const endCharacters = json.slice(-1) === "\n" ? "\n" : "";
28177
28237
  const newline = detectNewlineGraceful(json);
28178
28238
  json = JSON.parse(json);
@@ -31216,6 +31276,32 @@ const deplintPick = async ({ classifier, jobs, pkg, verbose } = {}) => {
31216
31276
  return emptyPickResult(rows.length, decisions.length, changedFiles);
31217
31277
  };
31218
31278
  //#endregion
31279
+ //#region src/actions/lintMode.ts
31280
+ const lintModes = [
31281
+ "package-workers",
31282
+ "shared-typecheck",
31283
+ "workspace-eslint"
31284
+ ];
31285
+ const defaultLintMode = "package-workers";
31286
+ /**
31287
+ Resolve the named lint implementation while preserving the two historical
31288
+ boolean selectors as hidden transition aliases.
31289
+ */
31290
+ function resolveLintMode({ mode = defaultLintMode, next = false, prev = false }) {
31291
+ if (next && prev) throw new Error("--next and --prev cannot be combined; use --mode instead");
31292
+ const legacyMode = next ? "package-workers" : prev ? "workspace-eslint" : void 0;
31293
+ if (legacyMode !== void 0 && mode !== "package-workers" && mode !== legacyMode) throw new Error(`--mode ${mode} cannot be combined with ${next ? "--next" : "--prev"}`);
31294
+ if (next) return {
31295
+ legacyOption: "--next",
31296
+ mode: "package-workers"
31297
+ };
31298
+ if (prev) return {
31299
+ legacyOption: "--prev",
31300
+ mode: "workspace-eslint"
31301
+ };
31302
+ return { mode };
31303
+ }
31304
+ //#endregion
31219
31305
  //#region src/actions/lintNextWorker.ts
31220
31306
  const lintNextIgnorePatterns = ["packages/**"];
31221
31307
  const lintNextResultMarker = "__XY_LINT_NEXT_RESULT__";
@@ -31316,8 +31402,24 @@ function gitignoreOverrideBlock(options) {
31316
31402
  })
31317
31403
  }
31318
31404
 
31405
+ function structuralOverrideBlock(options) {
31406
+ if (options.phase !== 'structural') return undefined
31407
+ const rules = Object.fromEntries((options.typeCheckedRuleNames ?? []).map(ruleName => [ruleName, 'off']))
31408
+ return {
31409
+ files: cycleRuleFilePatterns,
31410
+ languageOptions: {
31411
+ parserOptions: {
31412
+ programs: null,
31413
+ project: false,
31414
+ projectService: false,
31415
+ },
31416
+ },
31417
+ rules,
31418
+ }
31419
+ }
31420
+
31319
31421
  function additionalOverrideBlocks(options) {
31320
- return [gitignoreOverrideBlock(options), cycleOverrideBlock(options)].filter(Boolean)
31422
+ return [gitignoreOverrideBlock(options), structuralOverrideBlock(options), cycleOverrideBlock(options)].filter(Boolean)
31321
31423
  }
31322
31424
 
31323
31425
  async function createLintEngine(cwd, options) {
@@ -31325,10 +31427,12 @@ async function createLintEngine(cwd, options) {
31325
31427
  const overrideSpec = options.configOverride ?? options.analyzeTier
31326
31428
  if (overrideSpec) {
31327
31429
  const gitignoreBlock = gitignoreOverrideBlock(options)
31430
+ const structuralBlock = structuralOverrideBlock(options)
31328
31431
  const cycleBlock = cycleOverrideBlock(options)
31329
31432
  const overrideConfig = [
31330
31433
  ...(gitignoreBlock === undefined ? [] : [gitignoreBlock]),
31331
31434
  ...await resolveAnalyzeOverrideConfig(cwd, overrideSpec),
31435
+ ...(structuralBlock === undefined ? [] : [structuralBlock]),
31332
31436
  ...(cycleBlock === undefined ? [] : [cycleBlock]),
31333
31437
  ]
31334
31438
  return new ESLint({
@@ -31788,7 +31892,7 @@ function emptyPackageResult(pkg) {
31788
31892
  * Classify packages, skip empty/meta as configured, then lint the rest via
31789
31893
  * the persistent ESLint worker pool.
31790
31894
  */
31791
- async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, cycleDepth, fix, gitignore, meta, onPackageResult, profile, rootDir, skipEmpty, tierContext, typeChecked, verbose, workspaces }) {
31895
+ async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, cycleDepth, fix, gitignore, meta, onPackageResult, phase = "full", profile, rootDir, skipEmpty, tierContext, typeChecked, typeCheckedRuleNames, verbose, workspaces }) {
31792
31896
  const forceFull = workspaces.length === 1;
31793
31897
  const classified = workspaces.map((ws) => {
31794
31898
  return {
@@ -31841,7 +31945,9 @@ async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, c
31841
31945
  fix,
31842
31946
  gitignore,
31843
31947
  gitignorePath,
31948
+ phase,
31844
31949
  profile,
31950
+ typeCheckedRuleNames,
31845
31951
  verbose
31846
31952
  }
31847
31953
  });
@@ -31869,6 +31975,370 @@ async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, c
31869
31975
  return [...skippedResults, ...lintResults];
31870
31976
  }
31871
31977
  //#endregion
31978
+ //#region src/actions/lintSharedTypecheckRules.ts
31979
+ init_index_min();
31980
+ const sharedTypecheckScriptPatterns = [
31981
+ "**/*.ts",
31982
+ "**/*.tsx",
31983
+ "**/*.mts",
31984
+ "**/*.cts",
31985
+ "**/*.js",
31986
+ "**/*.jsx",
31987
+ "**/*.cjs",
31988
+ "**/*.mjs",
31989
+ "**/*.d.ts",
31990
+ "**/*.d.tsx",
31991
+ "**/*.d.jsx",
31992
+ "**/*.d.mts",
31993
+ "**/*.d.cts"
31994
+ ];
31995
+ const packageIgnorePatterns = [
31996
+ "packages/**",
31997
+ "**/build/**",
31998
+ "**/dist/**",
31999
+ "**/node_modules/**"
32000
+ ];
32001
+ function configPackageName(configOverride) {
32002
+ return configOverride.configPackageName ?? (configOverride.isReact ? "@ariestools/eslint-config-react-flat" : "@ariestools/eslint-config-flat");
32003
+ }
32004
+ function mergeRules(configs) {
32005
+ const rules = {};
32006
+ for (const config of configs) Object.assign(rules, config.rules);
32007
+ return rules;
32008
+ }
32009
+ function isEnabledRule(entry) {
32010
+ const severity = getRuleSeverity(entry);
32011
+ return severity !== void 0 && severity !== "off";
32012
+ }
32013
+ async function resolveManagedTypeCheckedRuleNames(rootDir, configOverride) {
32014
+ const result = new Set(collectTypeCheckedRuleNames());
32015
+ if (configOverride === void 0) return result;
32016
+ const resolved = createRequire(PATH.join(rootDir, "package.json")).resolve(configPackageName(configOverride));
32017
+ const configPackage = await import(pathToFileURL(resolved).href);
32018
+ if (configPackage.recommendedConfig === void 0) return result;
32019
+ const common = { tier: configOverride.tier };
32020
+ const checked = mergeRules(configPackage.recommendedConfig({
32021
+ ...common,
32022
+ isTypeChecked: true
32023
+ }));
32024
+ const unchecked = mergeRules(configPackage.recommendedConfig({
32025
+ ...common,
32026
+ isTypeChecked: false
32027
+ }));
32028
+ for (const [ruleName, entry] of Object.entries(checked)) if (isEnabledRule(entry) && !isEnabledRule(unchecked[ruleName])) result.add(ruleName);
32029
+ return result;
32030
+ }
32031
+ async function resolveConfigOverride(cwd, configOverride) {
32032
+ const resolved = createRequire(PATH.join(cwd, "package.json")).resolve(configPackageName(configOverride));
32033
+ const configPackage = await import(pathToFileURL(resolved).href);
32034
+ if (configPackage.recommendedConfig !== void 0) return configPackage.recommendedConfig({
32035
+ isTypeChecked: configOverride.isTypeChecked,
32036
+ tier: configOverride.tier
32037
+ });
32038
+ const configs = configPackage[configOverride.exportName];
32039
+ if (!Array.isArray(configs)) throw new TypeError(`Missing ESLint tier export "${configOverride.exportName}"`);
32040
+ return configs;
32041
+ }
32042
+ async function baseSharedTypecheckConfigs(cwd, configOverride, gitignorePath) {
32043
+ const ignored = gitignorePath === void 0 ? void 0 : includeIgnoreFile(gitignorePath, {
32044
+ gitignoreResolution: true,
32045
+ name: "XY repository .gitignore"
32046
+ });
32047
+ if (configOverride === void 0) return { configs: ignored === void 0 ? [] : [ignored] };
32048
+ return {
32049
+ configs: [...ignored === void 0 ? [] : [ignored], ...await resolveConfigOverride(cwd, configOverride)],
32050
+ overrideConfigFile: true
32051
+ };
32052
+ }
32053
+ function sharedTypecheckEslintOptions({ configs, cwd, fix, overrideConfigFile }) {
32054
+ return {
32055
+ cache: false,
32056
+ cwd,
32057
+ fix,
32058
+ ignorePatterns: ["packages/**"],
32059
+ overrideConfig: configs,
32060
+ ...overrideConfigFile !== void 0 && { overrideConfigFile },
32061
+ warnIgnored: false
32062
+ };
32063
+ }
32064
+ function ruleRequiresTypeChecking(config, ruleName) {
32065
+ const slash = ruleName.lastIndexOf("/");
32066
+ if (slash <= 0) return false;
32067
+ const pluginName = ruleName.slice(0, slash);
32068
+ const localRuleName = ruleName.slice(slash + 1);
32069
+ return ((config.plugins?.[pluginName])?.rules?.[localRuleName])?.meta?.docs?.requiresTypeChecking === true;
32070
+ }
32071
+ function collectActiveRules(config, plan) {
32072
+ const entries = Object.entries(config.rules ?? {});
32073
+ for (const [ruleName, entry] of entries) {
32074
+ if (!isEnabledRule(entry)) continue;
32075
+ plan.activeRuleNames.add(ruleName);
32076
+ if (ruleRequiresTypeChecking(config, ruleName)) plan.typeCheckedRuleNames.add(ruleName);
32077
+ }
32078
+ }
32079
+ async function inspectPackageRules({ configOverride, cwd, gitignorePath, knownTypeCheckedRuleNames }) {
32080
+ const base = await baseSharedTypecheckConfigs(cwd, configOverride, gitignorePath);
32081
+ const engine = new ESLint(sharedTypecheckEslintOptions({
32082
+ configs: base.configs,
32083
+ cwd,
32084
+ fix: false,
32085
+ overrideConfigFile: base.overrideConfigFile
32086
+ }));
32087
+ const candidates = ts$1(sharedTypecheckScriptPatterns, {
32088
+ absolute: true,
32089
+ cwd,
32090
+ ignore: packageIgnorePatterns,
32091
+ nodir: true
32092
+ });
32093
+ const plan = {
32094
+ activeRuleNames: /* @__PURE__ */ new Set(),
32095
+ typeCheckedRuleNames: new Set(knownTypeCheckedRuleNames)
32096
+ };
32097
+ for (const file of candidates) {
32098
+ const config = await engine.calculateConfigForFile(file);
32099
+ if (config !== void 0) collectActiveRules(config, plan);
32100
+ }
32101
+ return plan;
32102
+ }
32103
+ async function withSharedTypecheckGitignore(gitignore, action) {
32104
+ const previous = process.env.XY_LINT_GITIGNORE;
32105
+ process.env.XY_LINT_GITIGNORE = gitignore ? "true" : "false";
32106
+ try {
32107
+ return await action();
32108
+ } finally {
32109
+ if (previous === void 0) delete process.env.XY_LINT_GITIGNORE;
32110
+ else process.env.XY_LINT_GITIGNORE = previous;
32111
+ }
32112
+ }
32113
+ async function inspectSharedTypecheckRulePlans({ analyze, analyzeTier, gitignore, rootDir, tierContext, typeChecked, workspaces }) {
32114
+ const configOverride = resolvePackageConfigOverride(typeChecked, analyze ? void 0 : tierContext, analyzeTier);
32115
+ const known = await resolveManagedTypeCheckedRuleNames(rootDir, configOverride ?? (tierContext?.hasXylabsConfig === true ? buildForcedConfigOverride(tierContext, true) : void 0));
32116
+ const repositoryGitignore = PATH.resolve(rootDir, ".gitignore");
32117
+ const gitignorePath = gitignore && existsSync(repositoryGitignore) ? repositoryGitignore : void 0;
32118
+ const plans = /* @__PURE__ */ new Map();
32119
+ const allTypeCheckedRuleNames = new Set(known);
32120
+ await withSharedTypecheckGitignore(gitignore, async () => {
32121
+ for (const workspace of workspaces) {
32122
+ const plan = await inspectPackageRules({
32123
+ configOverride,
32124
+ cwd: PATH.resolve(rootDir, workspace.location),
32125
+ gitignorePath,
32126
+ knownTypeCheckedRuleNames: known
32127
+ });
32128
+ plans.set(workspace.name, plan);
32129
+ for (const ruleName of plan.typeCheckedRuleNames) allTypeCheckedRuleNames.add(ruleName);
32130
+ }
32131
+ });
32132
+ return {
32133
+ allTypeCheckedRuleNames: [...allTypeCheckedRuleNames],
32134
+ plans
32135
+ };
32136
+ }
32137
+ //#endregion
32138
+ //#region src/actions/lintSharedTypecheck.ts
32139
+ const scriptExtensionPattern = /\.(?:[cm]?[jt]s|[jt]sx)$/u;
32140
+ function lintableWorkspaces({ meta, rootDir, skipEmpty, workspaces }) {
32141
+ const forceFull = workspaces.length === 1;
32142
+ return workspaces.filter((workspace) => {
32143
+ return classifyLintPackage(rootDir, workspace, workspaces, {
32144
+ forceFull,
32145
+ meta,
32146
+ skipEmpty
32147
+ }).mode !== "skip";
32148
+ });
32149
+ }
32150
+ function emptySemanticResult(pkg) {
32151
+ return {
32152
+ errors: 0,
32153
+ files: 0,
32154
+ messages: [],
32155
+ output: "",
32156
+ pkg,
32157
+ timeMs: 0,
32158
+ warnings: 0
32159
+ };
32160
+ }
32161
+ function failedSemanticResult(pkg, output, timeMs) {
32162
+ return {
32163
+ errors: 1,
32164
+ files: 0,
32165
+ messages: [],
32166
+ output,
32167
+ pkg,
32168
+ timeMs,
32169
+ warnings: 0
32170
+ };
32171
+ }
32172
+ async function lintSemanticPackage({ analyze, configOverride, fix, gitignore, gitignorePath, profile, rulePlan, sharedCache, verbose, workspace }) {
32173
+ const started = performance$1.now();
32174
+ const programResult = createWorkspaceProgramInProcess(workspace.location, sharedCache);
32175
+ if (programResult.kind === "skipped") return failedSemanticResult(workspace.name, `Shared typecheck [${workspace.name}] requires ${PATH.join(workspace.location, "tsconfig.json")}\n`, Math.round(performance$1.now() - started));
32176
+ if (programResult.kind === "error") return failedSemanticResult(workspace.name, programResult.formatted, Math.round(performance$1.now() - started));
32177
+ const lintFiles = programResult.rootNames.filter((fileName) => scriptExtensionPattern.test(fileName));
32178
+ if (lintFiles.length === 0) return emptySemanticResult(workspace.name);
32179
+ const base = await baseSharedTypecheckConfigs(workspace.location, configOverride, gitignorePath);
32180
+ const disabledRules = Object.fromEntries([...rulePlan.activeRuleNames].filter((ruleName) => !rulePlan.typeCheckedRuleNames.has(ruleName)).map((ruleName) => [ruleName, "off"]));
32181
+ const semanticConfig = {
32182
+ files: sharedTypecheckScriptPatterns,
32183
+ languageOptions: { parserOptions: {
32184
+ programs: [programResult.program],
32185
+ project: false,
32186
+ projectService: false
32187
+ } },
32188
+ rules: disabledRules
32189
+ };
32190
+ const engine = new ESLint(sharedTypecheckEslintOptions({
32191
+ configs: [...base.configs, semanticConfig],
32192
+ cwd: workspace.location,
32193
+ fix: analyze ? false : fix,
32194
+ overrideConfigFile: base.overrideConfigFile
32195
+ }));
32196
+ const lintStarted = performance$1.now();
32197
+ const lintResults = await withSharedTypecheckGitignore(gitignore, async () => engine.lintFiles(lintFiles));
32198
+ const finished = performance$1.now();
32199
+ if (fix && !analyze) await ESLint.outputFixes(lintResults);
32200
+ let output = "";
32201
+ if (!analyze || verbose) output = await (await engine.loadFormatter("stylish")).format(lintResults);
32202
+ const result = {
32203
+ errors: lintResults.reduce((sum, entry) => sum + entry.errorCount, 0),
32204
+ files: lintResults.length,
32205
+ messages: analyze ? lintResults.flatMap((entry) => entry.messages.map((message) => ({
32206
+ ruleId: message.ruleId ?? null,
32207
+ severity: message.severity
32208
+ }))) : [],
32209
+ output,
32210
+ pkg: workspace.name,
32211
+ timeMs: Math.round(finished - started),
32212
+ warnings: lintResults.reduce((sum, entry) => sum + entry.warningCount, 0)
32213
+ };
32214
+ if (profile) result.profile = {
32215
+ configMs: Math.round(lintStarted - started),
32216
+ lintMs: Math.round(finished - lintStarted),
32217
+ spawnMs: 0,
32218
+ wallMs: result.timeMs,
32219
+ totalMs: Math.round(finished - started)
32220
+ };
32221
+ return result;
32222
+ }
32223
+ function mergeOutput(first, second) {
32224
+ if (first.length === 0) return second;
32225
+ if (second.length === 0) return first;
32226
+ return `${first.endsWith("\n") ? first : `${first}\n`}${second}`;
32227
+ }
32228
+ function mergePackageResults(structural, semantic) {
32229
+ if (semantic === void 0) return structural;
32230
+ const result = {
32231
+ errors: structural.errors + semantic.errors,
32232
+ files: structural.files,
32233
+ messages: [...structural.messages, ...semantic.messages],
32234
+ output: mergeOutput(structural.output, semantic.output),
32235
+ pkg: structural.pkg,
32236
+ timeMs: structural.timeMs + semantic.timeMs,
32237
+ warnings: structural.warnings + semantic.warnings
32238
+ };
32239
+ if (structural.profile !== void 0 || semantic.profile !== void 0) {
32240
+ const structuralProfile = structural.profile ?? {
32241
+ configMs: 0,
32242
+ lintMs: 0,
32243
+ spawnMs: 0,
32244
+ totalMs: 0,
32245
+ wallMs: structural.timeMs
32246
+ };
32247
+ const semanticProfile = semantic.profile ?? {
32248
+ configMs: 0,
32249
+ lintMs: 0,
32250
+ spawnMs: 0,
32251
+ totalMs: 0,
32252
+ wallMs: semantic.timeMs
32253
+ };
32254
+ result.profile = {
32255
+ configMs: structuralProfile.configMs + semanticProfile.configMs,
32256
+ lintMs: structuralProfile.lintMs + semanticProfile.lintMs,
32257
+ spawnMs: structuralProfile.spawnMs,
32258
+ totalMs: structuralProfile.totalMs + semanticProfile.totalMs,
32259
+ wallMs: structuralProfile.wallMs + semanticProfile.wallMs
32260
+ };
32261
+ }
32262
+ return result;
32263
+ }
32264
+ function isTypeCheckingEnabled({ analyzeTier, tierContext, typeChecked }) {
32265
+ if (analyzeTier !== void 0) return analyzeTier.isTypeChecked;
32266
+ if (typeChecked !== "auto") return typeChecked;
32267
+ return tierContext?.isTypeChecked ?? true;
32268
+ }
32269
+ function ignorePackageResult() {}
32270
+ /**
32271
+ Run syntax/structural rules in the existing package-worker pool while one
32272
+ process owns every package-specific TypeScript Program used by semantic rules.
32273
+ Only parsed SourceFiles are shared; compiler options and TypeCheckers remain
32274
+ isolated per package.
32275
+ */
32276
+ async function runLintSharedTypecheckPackages(params) {
32277
+ if (!isTypeCheckingEnabled(params)) {
32278
+ if (params.profile) console.log(chalk.gray(" shared typecheck: disabled by effective ESLint configuration"));
32279
+ return await runLintNextPackages(params);
32280
+ }
32281
+ const targets = lintableWorkspaces(params);
32282
+ const { allTypeCheckedRuleNames, plans } = await inspectSharedTypecheckRulePlans({
32283
+ ...params,
32284
+ workspaces: targets
32285
+ });
32286
+ if (params.profile) console.log(chalk.gray(` shared typecheck: 1 semantic owner · ${allTypeCheckedRuleNames.length} semantic rules · semantic cache off`));
32287
+ const structuralAction = async () => runLintNextPackages({
32288
+ ...params,
32289
+ onPackageResult: ignorePackageResult,
32290
+ phase: "structural",
32291
+ typeCheckedRuleNames: allTypeCheckedRuleNames
32292
+ });
32293
+ const semanticAction = async () => {
32294
+ const sharedCache = createSharedValidateCache();
32295
+ const configOverride = resolvePackageConfigOverride(params.typeChecked, params.analyze ? void 0 : params.tierContext, params.analyzeTier);
32296
+ const repositoryGitignore = PATH.resolve(params.rootDir, ".gitignore");
32297
+ const gitignorePath = params.gitignore && existsSync(repositoryGitignore) ? repositoryGitignore : void 0;
32298
+ const results = [];
32299
+ for (const workspace of targets) {
32300
+ const rulePlan = plans.get(workspace.name) ?? {
32301
+ activeRuleNames: /* @__PURE__ */ new Set(),
32302
+ typeCheckedRuleNames: new Set(allTypeCheckedRuleNames)
32303
+ };
32304
+ results.push(await lintSemanticPackage({
32305
+ analyze: params.analyze,
32306
+ configOverride,
32307
+ fix: params.fix,
32308
+ gitignore: params.gitignore,
32309
+ gitignorePath,
32310
+ profile: params.profile,
32311
+ rulePlan,
32312
+ sharedCache,
32313
+ verbose: params.verbose,
32314
+ workspace: {
32315
+ ...workspace,
32316
+ location: PATH.resolve(params.rootDir, workspace.location)
32317
+ }
32318
+ }));
32319
+ }
32320
+ if (params.profile) {
32321
+ const heapMiB = Math.round(process.memoryUsage().heapUsed / 1024 / 1024);
32322
+ console.log(chalk.gray(` shared TypeScript sources: ${sharedCache.sourceFiles.size} · semantic heap: ${heapMiB} MiB`));
32323
+ }
32324
+ return results;
32325
+ };
32326
+ let semanticResults;
32327
+ let structuralResults;
32328
+ if (params.fix) {
32329
+ structuralResults = await structuralAction();
32330
+ semanticResults = await semanticAction();
32331
+ } else [structuralResults, semanticResults] = await Promise.all([structuralAction(), semanticAction()]);
32332
+ const semanticByPackage = new Map(semanticResults.map((result) => [result.pkg, result]));
32333
+ const merged = structuralResults.map((result) => mergePackageResults(result, semanticByPackage.get(result.pkg)));
32334
+ const mergedByPackage = new Map(merged.map((result) => [result.pkg, result]));
32335
+ for (const [index, workspace] of targets.entries()) {
32336
+ const result = mergedByPackage.get(workspace.name);
32337
+ if (result !== void 0) params.onPackageResult(index, targets.length, result);
32338
+ }
32339
+ return merged;
32340
+ }
32341
+ //#endregion
31872
32342
  //#region ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
31873
32343
  var Node = class {
31874
32344
  value;
@@ -32546,7 +33016,10 @@ function logLintProfileHeader(cache, gitignore, typeChecked, detectedContext, me
32546
33016
  console.log(chalk.gray(` type-checked: ${typeCheckedLabel}`));
32547
33017
  console.log(chalk.gray(` meta packages: ${meta} · skip empty: ${skipEmpty ? "on" : "off"}`));
32548
33018
  }
32549
- async function lintNext({ analyze = false, cache = true, cycleDepth, fix = false, gitignore = true, jobs, meta = "full", pkg, profile = false, skipEmpty = true, typeChecked = "auto", verbose = false, workspaces: targetWorkspaces }) {
33019
+ function runLintModePackages(mode, params) {
33020
+ return mode === "shared-typecheck" ? runLintSharedTypecheckPackages(params) : runLintNextPackages(params);
33021
+ }
33022
+ async function lintNext({ analyze = false, cache = true, cycleDepth, fix = false, gitignore = true, jobs, meta = "full", mode = "package-workers", pkg, profile = false, skipEmpty = true, typeChecked = "auto", verbose = false, workspaces: targetWorkspaces }) {
32550
33023
  const rootDir = INIT_CWD();
32551
33024
  const { analyzeContext, detectedContext, tierContext } = resolveTierForLint(analyze, rootDir);
32552
33025
  if (analyzeContext.kind === "invalid") return resultFromExitCode(1);
@@ -32557,12 +33030,15 @@ async function lintNext({ analyze = false, cache = true, cycleDepth, fix = false
32557
33030
  const analyzeStarted = Date.now();
32558
33031
  const label = getLintLabel(analyze, fix, cycleDepth);
32559
33032
  if (analyze && tierContext !== void 0) printAnalyzeRunHeader(workspaces);
32560
- if (profile) logLintProfileHeader(cache, gitignore, typeChecked, detectedContext, meta, skipEmpty);
33033
+ if (profile) {
33034
+ console.log(chalk.gray(` lint mode: ${mode}`));
33035
+ logLintProfileHeader(cache, gitignore, typeChecked, detectedContext, meta, skipEmpty);
33036
+ }
32561
33037
  return finishLintNext({
32562
33038
  analyze,
32563
33039
  analyzeStarted,
32564
33040
  profile,
32565
- results: await runLintNextPackages({
33041
+ results: await runLintModePackages(mode, {
32566
33042
  analyze,
32567
33043
  analyzeTier,
32568
33044
  cache,
@@ -32601,11 +33077,12 @@ function shouldUseIncremental$2(incremental) {
32601
33077
  function shouldUseIncrementalLint({ analyze, fix, incremental, pkg }) {
32602
33078
  return pkg === void 0 && fix !== true && analyze !== true && shouldUseIncremental$2(incremental);
32603
33079
  }
32604
- function lintOptionsHash({ cycleDepth, gitignore }) {
33080
+ function lintOptionsHash({ cycleDepth, gitignore, mode = defaultLintMode }) {
32605
33081
  const gitignorePath = PATH.resolve(INIT_CWD(), ".gitignore");
32606
33082
  return {
32607
33083
  cycleDepth,
32608
33084
  gitignore: gitignore === false ? false : existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf8") : null,
33085
+ mode,
32609
33086
  strict: isStrictMode()
32610
33087
  };
32611
33088
  }
@@ -32613,7 +33090,7 @@ const lintPackage = ({ pkg, fix, verbose }) => {
32613
33090
  const pm = getPackageManager();
32614
33091
  return runSteps(`${fix ?? false ? "Fix" : "Lint"} [${pkg}]`, [pm.runInWorkspace(pkg, fix ?? false ? "package-fix" : verbose ?? false ? "package-lint-verbose" : "package-lint")]);
32615
33092
  };
32616
- async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta, profile, skipEmpty, typeChecked, verbose, workspaces: targetWorkspaces }) {
33093
+ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta, mode, profile, skipEmpty, typeChecked, verbose, workspaces: targetWorkspaces }) {
32617
33094
  const pm = getPackageManager();
32618
33095
  const allWorkspaces = targetWorkspaces ?? pm.listWorkspaces();
32619
33096
  if (allWorkspaces.length === 0) return await lintNext({
@@ -32623,6 +33100,7 @@ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta,
32623
33100
  gitignore,
32624
33101
  jobs,
32625
33102
  meta,
33103
+ mode,
32626
33104
  profile,
32627
33105
  skipEmpty,
32628
33106
  typeChecked,
@@ -32632,7 +33110,8 @@ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta,
32632
33110
  action: "lint",
32633
33111
  options: lintOptionsHash({
32634
33112
  cycleDepth,
32635
- gitignore
33113
+ gitignore,
33114
+ mode
32636
33115
  }),
32637
33116
  pm,
32638
33117
  isVerbose: verbose,
@@ -32645,7 +33124,8 @@ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta,
32645
33124
  action: "lint",
32646
33125
  options: lintOptionsHash({
32647
33126
  cycleDepth,
32648
- gitignore
33127
+ gitignore,
33128
+ mode
32649
33129
  }),
32650
33130
  pm,
32651
33131
  workspaces: allWorkspaces
@@ -32659,6 +33139,7 @@ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta,
32659
33139
  gitignore,
32660
33140
  jobs,
32661
33141
  meta,
33142
+ mode,
32662
33143
  profile,
32663
33144
  skipEmpty,
32664
33145
  typeChecked,
@@ -32669,19 +33150,25 @@ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta,
32669
33150
  action: "lint",
32670
33151
  options: lintOptionsHash({
32671
33152
  cycleDepth,
32672
- gitignore
33153
+ gitignore,
33154
+ mode
32673
33155
  }),
32674
33156
  pm,
32675
33157
  workspaces: allWorkspaces
32676
33158
  });
32677
33159
  return result;
32678
33160
  }
32679
- const lint = ({ analyze, cache, cycleDepth, fix, gitignore, incremental, jobs, meta, prev, pkg, profile, skipEmpty, typeChecked, verbose, workspaces }) => {
33161
+ const lint = ({ analyze, cache, cycleDepth, fix, gitignore, incremental, jobs, meta, mode, next, prev, pkg, profile, skipEmpty, typeChecked, verbose, workspaces }) => {
32680
33162
  if (analyze === true && fix === true) {
32681
33163
  console.error("The --analyze option cannot be combined with --fix");
32682
33164
  return 1;
32683
33165
  }
32684
- if (!(prev ?? false)) {
33166
+ const resolvedMode = resolveLintMode({
33167
+ mode,
33168
+ next,
33169
+ prev
33170
+ }).mode;
33171
+ if (resolvedMode !== "workspace-eslint") {
32685
33172
  if (shouldUseIncrementalLint({
32686
33173
  analyze,
32687
33174
  fix,
@@ -32694,6 +33181,7 @@ const lint = ({ analyze, cache, cycleDepth, fix, gitignore, incremental, jobs, m
32694
33181
  gitignore,
32695
33182
  jobs,
32696
33183
  meta,
33184
+ mode: resolvedMode,
32697
33185
  profile,
32698
33186
  skipEmpty,
32699
33187
  typeChecked,
@@ -32707,6 +33195,7 @@ const lint = ({ analyze, cache, cycleDepth, fix, gitignore, incremental, jobs, m
32707
33195
  gitignore,
32708
33196
  jobs,
32709
33197
  meta,
33198
+ mode: resolvedMode,
32710
33199
  pkg,
32711
33200
  profile,
32712
33201
  skipEmpty,
@@ -33300,6 +33789,18 @@ const resolveCompilePlatforms = (compile) => {
33300
33789
  };
33301
33790
  };
33302
33791
  //#endregion
33792
+ //#region src/actions/package/compile/resolveTscBin.ts
33793
+ /**
33794
+ * Default `package.json` key the native compiler is expected under:
33795
+ * `"typescript-native": "npm:typescript@~7.0.2"`. Override per package with
33796
+ * `compile.nativePackage`.
33797
+ */
33798
+ const DEFAULT_NATIVE_PACKAGE = "typescript-native";
33799
+ /**
33800
+ * Full `package.json` alias spec for {@link DEFAULT_NATIVE_PACKAGE}.
33801
+ */
33802
+ const DEFAULT_NATIVE_ALIAS_SPEC = `npm:typescript@~7.0.2`;
33803
+ //#endregion
33303
33804
  //#region src/actions/package/compile/monolithCopyEntries.ts
33304
33805
  const copyPlatforms = /* @__PURE__ */ new Set([
33305
33806
  "browser",
@@ -33412,7 +33913,7 @@ function findConfigFile(pkgDir) {
33412
33913
  if (fs.existsSync(candidate)) return candidate;
33413
33914
  }
33414
33915
  }
33415
- function getPropertyName(prop) {
33916
+ function getPropertyName$1(prop) {
33416
33917
  if (!ts.isPropertyAssignment(prop)) return void 0;
33417
33918
  const { name } = prop;
33418
33919
  if (ts.isIdentifier(name) || ts.isStringLiteral(name)) return name.text;
@@ -33425,15 +33926,15 @@ function getPropertyName(prop) {
33425
33926
  function collectEmptyTargetProps(sourceFile) {
33426
33927
  const found = [];
33427
33928
  function visit(node) {
33428
- if (ts.isPropertyAssignment(node) && getPropertyName(node) === "compile" && ts.isObjectLiteralExpression(node.initializer)) {
33429
- for (const prop of node.initializer.properties) if (ts.isPropertyAssignment(prop) && COMPILE_TARGET_NAMES.has(getPropertyName(prop) ?? "") && ts.isObjectLiteralExpression(prop.initializer) && prop.initializer.properties.length === 0) found.push(prop);
33929
+ if (ts.isPropertyAssignment(node) && getPropertyName$1(node) === "compile" && ts.isObjectLiteralExpression(node.initializer)) {
33930
+ for (const prop of node.initializer.properties) if (ts.isPropertyAssignment(prop) && COMPILE_TARGET_NAMES.has(getPropertyName$1(prop) ?? "") && ts.isObjectLiteralExpression(prop.initializer) && prop.initializer.properties.length === 0) found.push(prop);
33430
33931
  }
33431
33932
  ts.forEachChild(node, visit);
33432
33933
  }
33433
33934
  visit(sourceFile);
33434
33935
  return found;
33435
33936
  }
33436
- function isWhitespace(char) {
33937
+ function isWhitespace$1(char) {
33437
33938
  return char !== void 0 && /\s/.test(char);
33438
33939
  }
33439
33940
  /**
@@ -33449,11 +33950,11 @@ function removeProperties(text, props, sourceFile) {
33449
33950
  let start = prop.getFullStart();
33450
33951
  let end = prop.getEnd();
33451
33952
  let cursor = end;
33452
- while (isWhitespace(result[cursor])) cursor++;
33953
+ while (isWhitespace$1(result[cursor])) cursor++;
33453
33954
  if (result[cursor] === ",") end = cursor + 1;
33454
33955
  else {
33455
33956
  let back = prop.getStart(sourceFile) - 1;
33456
- while (back >= 0 && isWhitespace(result[back])) back--;
33957
+ while (back >= 0 && isWhitespace$1(result[back])) back--;
33457
33958
  if (result[back] === ",") start = back;
33458
33959
  }
33459
33960
  result = result.slice(0, start) + result.slice(end);
@@ -33477,9 +33978,9 @@ function checkCompileTargets(pkgDir, shouldFix) {
33477
33978
  const configName = PATH.basename(configPath);
33478
33979
  if (shouldFix) {
33479
33980
  fs.writeFileSync(configPath, removeProperties(text, emptyProps, sourceFile));
33480
- for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: removed deprecated empty "compile.${getPropertyName(prop)}" target from ${configName}`));
33981
+ for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: removed deprecated empty "compile.${getPropertyName$1(prop)}" target from ${configName}`));
33481
33982
  result.modified = true;
33482
- } else for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: "compile.${getPropertyName(prop)} = {}" is treated as "do not build" — set it to \`false\` or remove it (use --fix to remove) in ${configName}`));
33983
+ } else for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: "compile.${getPropertyName$1(prop)} = {}" is treated as "do not build" — set it to \`false\` or remove it (use --fix to remove) in ${configName}`));
33483
33984
  result.warnings += emptyProps.length;
33484
33985
  return result;
33485
33986
  }
@@ -33734,7 +34235,7 @@ function formatExportPath$1(pathParts) {
33734
34235
  function ensureExportsPath$1(value) {
33735
34236
  return value.startsWith("./") ? value : `./${value}`;
33736
34237
  }
33737
- function isRecord$4(value) {
34238
+ function isRecord$5(value) {
33738
34239
  return typeof value === "object" && value !== null && !Array.isArray(value);
33739
34240
  }
33740
34241
  function normalizeTarget(target) {
@@ -33771,7 +34272,7 @@ function collectExportLeaves(value, subpath = ".", pathParts = ["exports"], cond
33771
34272
  }];
33772
34273
  }
33773
34274
  if (Array.isArray(value)) return value.flatMap((entry, index) => collectExportLeaves(entry, subpath, [...pathParts, `[${index}]`], conditionPath));
33774
- if (!isRecord$4(value)) return [];
34275
+ if (!isRecord$5(value)) return [];
33775
34276
  return Object.entries(value).flatMap(([key, nested]) => {
33776
34277
  if (isSubpathExportKey$1(key)) return collectExportLeaves(nested, key, [...pathParts, key], conditionPath);
33777
34278
  return collectExportLeaves(nested, subpath, [...pathParts, key], [...conditionPath, key]);
@@ -33869,14 +34370,14 @@ function shouldNormalizeExportsForFix(pkg) {
33869
34370
  pkg.exports = { ".": pkg.exports };
33870
34371
  return true;
33871
34372
  }
33872
- if (isRecord$4(pkg.exports) && !hasSubpathKeys(pkg.exports)) {
34373
+ if (isRecord$5(pkg.exports) && !hasSubpathKeys(pkg.exports)) {
33873
34374
  pkg.exports = { ".": pkg.exports };
33874
34375
  return true;
33875
34376
  }
33876
34377
  return false;
33877
34378
  }
33878
34379
  function isRecordObject(value) {
33879
- return isRecord$4(value);
34380
+ return isRecord$5(value);
33880
34381
  }
33881
34382
  function ensureSubpath(exports, subpath) {
33882
34383
  const existing = exports[subpath];
@@ -39443,7 +39944,7 @@ const VALID_RULE_LEVELS = /* @__PURE__ */ new Set([
39443
39944
  "warn",
39444
39945
  "error"
39445
39946
  ]);
39446
- function isRecord$3(value) {
39947
+ function isRecord$4(value) {
39447
39948
  return typeof value === "object" && value !== null && !Array.isArray(value);
39448
39949
  }
39449
39950
  function isRuleLevel$1(value) {
@@ -39468,13 +39969,13 @@ function parseRuleConfig(ruleId, value) {
39468
39969
  const level = value[0];
39469
39970
  if (!isRuleLevel$1(level)) throw new TypeError(`${formatRuleConfigLocation(ruleId)} level must be one of "off", "warn", or "error"`);
39470
39971
  const options = value[1];
39471
- if (!isRecord$3(options)) throw new TypeError(`${formatRuleConfigLocation(ruleId)} options must be an object`);
39972
+ if (!isRecord$4(options)) throw new TypeError(`${formatRuleConfigLocation(ruleId)} options must be an object`);
39472
39973
  return {
39473
39974
  level,
39474
39975
  options: { ...options }
39475
39976
  };
39476
39977
  }
39477
- if (isRecord$3(value)) return {
39978
+ if (isRecord$4(value)) return {
39478
39979
  level: "warn",
39479
39980
  options: { ...value }
39480
39981
  };
@@ -40510,6 +41011,290 @@ const eject = () => {
40510
41011
  return runSteps("Eject", [[pm.command, "react-scripts eject"]]);
40511
41012
  };
40512
41013
  //#endregion
41014
+ //#region src/actions/enable/editXyConfigCompile.ts
41015
+ function isJsonConfigPath(configPath) {
41016
+ const base = PATH.basename(configPath);
41017
+ return base === ".xyrc.json" || base.endsWith(".json");
41018
+ }
41019
+ function getPropertyName(prop) {
41020
+ if (ts.isPropertyAssignment(prop)) {
41021
+ const { name } = prop;
41022
+ if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNoSubstitutionTemplateLiteral(name)) return name.text;
41023
+ }
41024
+ if (ts.isShorthandPropertyAssignment(prop)) return prop.name.text;
41025
+ }
41026
+ function isWhitespace(char) {
41027
+ return char !== void 0 && /\s/.test(char);
41028
+ }
41029
+ function findDefaultExportObject(sourceFile) {
41030
+ for (const statement of sourceFile.statements) {
41031
+ if (ts.isExportAssignment(statement) && !statement.isExportEquals && ts.isObjectLiteralExpression(statement.expression)) return statement.expression;
41032
+ if (!ts.isVariableStatement(statement)) continue;
41033
+ for (const decl of statement.declarationList.declarations) if (decl.initializer && ts.isObjectLiteralExpression(decl.initializer) && ts.isIdentifier(decl.name) && decl.name.text === "config") return decl.initializer;
41034
+ }
41035
+ for (const statement of sourceFile.statements) {
41036
+ if (!ts.isVariableStatement(statement)) continue;
41037
+ for (const decl of statement.declarationList.declarations) if (decl.initializer && ts.isObjectLiteralExpression(decl.initializer)) return decl.initializer;
41038
+ }
41039
+ }
41040
+ function findObjectProperty(object, key) {
41041
+ for (const prop of object.properties) {
41042
+ if (!ts.isPropertyAssignment(prop)) continue;
41043
+ if (getPropertyName(prop) === key) return prop;
41044
+ }
41045
+ }
41046
+ function detectIndent(text, object, sourceFile) {
41047
+ if (object.properties.length > 0) {
41048
+ const start = object.properties[0].getStart(sourceFile);
41049
+ let lineStart = start;
41050
+ while (lineStart > 0 && text[lineStart - 1] !== "\n" && text[lineStart - 1] !== "\r") lineStart -= 1;
41051
+ const indent = text.slice(lineStart, start).match(/^[ \t]*/)?.[0];
41052
+ if (indent !== void 0 && indent.length > 0) return indent;
41053
+ }
41054
+ const braceStart = object.getStart(sourceFile);
41055
+ let lineStart = braceStart;
41056
+ while (lineStart > 0 && text[lineStart - 1] !== "\n" && text[lineStart - 1] !== "\r") lineStart -= 1;
41057
+ return `${text.slice(lineStart, braceStart).match(/^[ \t]*/)?.[0] ?? ""} `;
41058
+ }
41059
+ function removePropertyFromObject(text, prop, sourceFile) {
41060
+ let start = prop.getFullStart();
41061
+ let end = prop.getEnd();
41062
+ let cursor = end;
41063
+ while (isWhitespace(text[cursor])) cursor++;
41064
+ if (text[cursor] === ",") end = cursor + 1;
41065
+ else {
41066
+ let back = prop.getStart(sourceFile) - 1;
41067
+ while (back >= 0 && isWhitespace(text[back])) back--;
41068
+ if (text[back] === ",") start = back;
41069
+ }
41070
+ return `${text.slice(0, start)}${text.slice(end)}`;
41071
+ }
41072
+ function insertPropertyIntoObject(text, object, sourceFile, entry) {
41073
+ const indent = detectIndent(text, object, sourceFile);
41074
+ const openBraceEnd = object.getStart(sourceFile) + 1;
41075
+ const insertion = `\n${indent}${entry},`;
41076
+ return `${text.slice(0, openBraceEnd)}${insertion}${text.slice(openBraceEnd)}`;
41077
+ }
41078
+ function setStringProperty(text, object, sourceFile, key, value) {
41079
+ const existing = findObjectProperty(object, key);
41080
+ const valueText = `'${value}'`;
41081
+ if (existing !== void 0) {
41082
+ const valueStart = existing.initializer.getStart(sourceFile);
41083
+ const valueEnd = existing.initializer.getEnd();
41084
+ return `${text.slice(0, valueStart)}${valueText}${text.slice(valueEnd)}`;
41085
+ }
41086
+ return insertPropertyIntoObject(text, object, sourceFile, `${key}: ${valueText}`);
41087
+ }
41088
+ /**
41089
+ * Ensure `compile.compiler` is set on a TypeScript/JS xy.config source.
41090
+ * When `compiler` is `native` and `compile.validator` is `'shared'`, drops the
41091
+ * validator field — shared validation only works with the JS compiler API.
41092
+ */
41093
+ function applyCompileCompilerToTsSource(text, compiler) {
41094
+ const sourceFile = ts.createSourceFile("xy.config.ts", text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
41095
+ const configObject = findDefaultExportObject(sourceFile);
41096
+ if (configObject === void 0) throw new Error("Could not find a config object in xy.config to set compile.compiler");
41097
+ const compileAssignment = findObjectProperty(configObject, "compile");
41098
+ if (compileAssignment === void 0) return insertPropertyIntoObject(text, configObject, sourceFile, `compile: { compiler: '${compiler}' }`);
41099
+ if (!ts.isObjectLiteralExpression(compileAssignment.initializer)) throw new TypeError("compile must be an object literal to set compiler");
41100
+ let result = setStringProperty(text, compileAssignment.initializer, sourceFile, "compiler", compiler);
41101
+ if (compiler !== "native") return result;
41102
+ const afterCompiler = ts.createSourceFile("xy.config.ts", result, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
41103
+ const afterConfig = findDefaultExportObject(afterCompiler);
41104
+ if (afterConfig === void 0) return result;
41105
+ const afterCompile = findObjectProperty(afterConfig, "compile");
41106
+ if (afterCompile === void 0 || !ts.isObjectLiteralExpression(afterCompile.initializer)) return result;
41107
+ const validator = findObjectProperty(afterCompile.initializer, "validator");
41108
+ if (validator === void 0) return result;
41109
+ if ((ts.isStringLiteral(validator.initializer) || ts.isNoSubstitutionTemplateLiteral(validator.initializer)) && validator.initializer.text === "shared") result = removePropertyFromObject(result, validator, afterCompiler);
41110
+ return result;
41111
+ }
41112
+ function isRecord$3(value) {
41113
+ return typeof value === "object" && value !== null && !Array.isArray(value);
41114
+ }
41115
+ /**
41116
+ * Ensure `compile.compiler` is set on a JSON xy.config (`.xyrc.json`).
41117
+ */
41118
+ function applyCompileCompilerToJsonSource(text, compiler) {
41119
+ const root = JSON.parse(text);
41120
+ const compile = isRecord$3(root.compile) ? { ...root.compile } : {};
41121
+ compile.compiler = compiler;
41122
+ if (compiler === "native" && compile.validator === "shared") delete compile.validator;
41123
+ root.compile = compile;
41124
+ return `${JSON.stringify(root, null, 2)}\n`;
41125
+ }
41126
+ function createMinimalNativeCompileConfigSource() {
41127
+ return [
41128
+ "import type { XyConfig } from '@ariestools/toolchain'",
41129
+ "",
41130
+ "const config: XyConfig = {",
41131
+ " compile: { compiler: 'native' },",
41132
+ "}",
41133
+ "",
41134
+ "export default config",
41135
+ ""
41136
+ ].join("\n");
41137
+ }
41138
+ /**
41139
+ * Set `compile.compiler` on the repo's xy config.
41140
+ * Creates `xy.config.ts` when none exists.
41141
+ */
41142
+ function applyCompileCompilerToConfigDir(dir, compiler) {
41143
+ const existingPath = findXyConfigFile(dir);
41144
+ if (existingPath === void 0) {
41145
+ const configPath = PATH.join(dir, "xy.config.ts");
41146
+ const text = compiler === "native" ? createMinimalNativeCompileConfigSource() : [
41147
+ "import type { XyConfig } from '@ariestools/toolchain'",
41148
+ "",
41149
+ "const config: XyConfig = {",
41150
+ ` compile: { compiler: '${compiler}' },`,
41151
+ "}",
41152
+ "",
41153
+ "export default config",
41154
+ ""
41155
+ ].join("\n");
41156
+ fs.writeFileSync(configPath, text, "utf8");
41157
+ return {
41158
+ changed: true,
41159
+ created: true,
41160
+ path: configPath
41161
+ };
41162
+ }
41163
+ const before = fs.readFileSync(existingPath, "utf8");
41164
+ const after = isJsonConfigPath(existingPath) ? applyCompileCompilerToJsonSource(before, compiler) : applyCompileCompilerToTsSource(before, compiler);
41165
+ if (after === before) return {
41166
+ changed: false,
41167
+ created: false,
41168
+ path: existingPath
41169
+ };
41170
+ fs.writeFileSync(existingPath, after, "utf8");
41171
+ return {
41172
+ changed: true,
41173
+ created: false,
41174
+ path: existingPath
41175
+ };
41176
+ }
41177
+ //#endregion
41178
+ //#region src/actions/enable/tsNative.ts
41179
+ function formatAliasSpec(range) {
41180
+ return `npm:typescript@${range}`;
41181
+ }
41182
+ /**
41183
+ * Prefer an existing 7.x alias range when already declared; otherwise use the
41184
+ * toolchain default (`~7.0.2`).
41185
+ */
41186
+ function resolveNativeAliasSpec(existing) {
41187
+ if (existing === void 0) return DEFAULT_NATIVE_ALIAS_SPEC;
41188
+ if (existing.startsWith("npm:typescript@")) return existing;
41189
+ if (import_semver.default.validRange(existing) !== null) return formatAliasSpec(existing);
41190
+ return DEFAULT_NATIVE_ALIAS_SPEC;
41191
+ }
41192
+ function typescriptMajor(spec) {
41193
+ if (spec === void 0) return void 0;
41194
+ if (spec.startsWith("workspace:") || spec.startsWith("npm:")) return void 0;
41195
+ return import_semver.default.coerce(spec)?.major;
41196
+ }
41197
+ /**
41198
+ * Ensure `typescript-native` lives in devDependencies at the resolved alias
41199
+ * spec. Moves a misplaced `dependencies` entry when present.
41200
+ */
41201
+ function ensureNativeDevDependency(cwd, pkg, nativeSpec, isVerbose) {
41202
+ if ((pkg.devDependencies?.["typescript-native"] ?? pkg.dependencies?.["typescript-native"]) === nativeSpec && pkg.devDependencies?.["typescript-native"] === nativeSpec) {
41203
+ if (isVerbose) console.log(chalk.gray(` ${DEFAULT_NATIVE_PACKAGE} already declared as ${nativeSpec}`));
41204
+ return false;
41205
+ }
41206
+ if (pkg.dependencies?.["typescript-native"] !== void 0) {
41207
+ delete pkg.dependencies[DEFAULT_NATIVE_PACKAGE];
41208
+ if (Object.keys(pkg.dependencies).length === 0) delete pkg.dependencies;
41209
+ }
41210
+ addDep(pkg, DEFAULT_NATIVE_PACKAGE, nativeSpec, "devDependencies");
41211
+ writePackageJson$2(cwd, pkg);
41212
+ console.log(chalk.green(`Added ${DEFAULT_NATIVE_PACKAGE}@${nativeSpec} to devDependencies`));
41213
+ return true;
41214
+ }
41215
+ /**
41216
+ * Warn when the JS compiler API package is missing or pinned to major 7+.
41217
+ */
41218
+ function logTypescriptApiStatus(pkg, isVerbose) {
41219
+ const apiSpec = pkg.devDependencies?.typescript ?? pkg.dependencies?.typescript;
41220
+ if (apiSpec === void 0) {
41221
+ console.warn(chalk.yellow("Note: no \"typescript\" package found. Keep typescript@6.x installed for ESLint and xy analyzers (the native compiler exports no compiler API)."));
41222
+ return;
41223
+ }
41224
+ const apiMajor = typescriptMajor(apiSpec);
41225
+ if (apiMajor !== void 0 && apiMajor >= 7) {
41226
+ console.warn(chalk.yellow(`Note: "typescript" is pinned to ${apiSpec} (major ${apiMajor}). Major 7+ is the native compiler and exports no API — pin typescript to 6.x and use ${DEFAULT_NATIVE_PACKAGE} for compile.`));
41227
+ return;
41228
+ }
41229
+ if (isVerbose) console.log(chalk.gray(` typescript (compiler API) remains ${apiSpec}`));
41230
+ }
41231
+ function configDisplayPath(cwd, configPath) {
41232
+ return PATH.relative(cwd, configPath) || PATH.basename(configPath);
41233
+ }
41234
+ function logConfigResult(cwd, configResult) {
41235
+ const display = configDisplayPath(cwd, configResult.path);
41236
+ if (configResult.created) {
41237
+ console.log(chalk.green(`Created ${display} with compile.compiler: 'native'`));
41238
+ return;
41239
+ }
41240
+ if (configResult.changed) {
41241
+ console.log(chalk.green(`Updated ${display} → compile.compiler: 'native'`));
41242
+ return;
41243
+ }
41244
+ console.log(chalk.gray(`${display} already has compile.compiler: 'native'`));
41245
+ }
41246
+ function maybeInstall(cwd, packageJsonChanged, noInstall) {
41247
+ if (!packageJsonChanged) return;
41248
+ if (noInstall) {
41249
+ console.log(chalk.gray("Skipped install (--no-install). Run your package manager install when ready."));
41250
+ return;
41251
+ }
41252
+ shouldRunInstall(cwd);
41253
+ }
41254
+ /**
41255
+ * Enable TypeScript native (`typescript@7` Go compiler) for type-check and
41256
+ * declaration emit in the current repo:
41257
+ *
41258
+ * 1. `devDependencies["typescript-native"] = "npm:typescript@~7.0.2"`
41259
+ * 2. `xy.config` → `compile.compiler: 'native'`
41260
+ * 3. Drop incompatible `compile.validator: 'shared'` when present
41261
+ * 4. Install when package.json changed (unless `--no-install`)
41262
+ *
41263
+ * Leaves the `typescript` (JS compiler API, 6.x) package alone — ESLint,
41264
+ * deplint, dead-code, and api-exposure still load it.
41265
+ */
41266
+ function enableTsNative({ noInstall = false, isVerbose = false } = {}) {
41267
+ const cwd = INIT_CWD();
41268
+ const packageJsonPath = PATH.join(cwd, "package.json");
41269
+ if (!existsSync(packageJsonPath)) throw new Error(`No package.json found in ${cwd}`);
41270
+ const pkg = readPackageJson$4(cwd);
41271
+ const nativeSpec = resolveNativeAliasSpec(pkg.devDependencies?.["typescript-native"] ?? pkg.dependencies?.["typescript-native"]);
41272
+ const packageJsonChanged = ensureNativeDevDependency(cwd, pkg, nativeSpec, isVerbose);
41273
+ logTypescriptApiStatus(pkg, isVerbose);
41274
+ const configResult = applyCompileCompilerToConfigDir(cwd, "native");
41275
+ logConfigResult(cwd, configResult);
41276
+ maybeInstall(cwd, packageJsonChanged, noInstall);
41277
+ console.log(chalk.cyan("TypeScript native compile enabled. `xy compile` will use the Go tsc for validation and declarations."));
41278
+ return {
41279
+ configChanged: configResult.changed,
41280
+ configCreated: configResult.created,
41281
+ configPath: configResult.path,
41282
+ packageJsonChanged,
41283
+ nativePackage: DEFAULT_NATIVE_PACKAGE,
41284
+ nativeSpec
41285
+ };
41286
+ }
41287
+ async function enableTsNativeAction(params = {}) {
41288
+ try {
41289
+ enableTsNative(params);
41290
+ return 0;
41291
+ } catch (error) {
41292
+ const message = error instanceof Error ? error.message : String(error);
41293
+ console.error(chalk.red(message));
41294
+ return resultFromExitCode(1);
41295
+ }
41296
+ }
41297
+ //#endregion
40513
41298
  //#region src/actions/fix.ts
40514
41299
  const fix = async ({ jobs, pkg, verbose }) => {
40515
41300
  const pkgOpts = pkg === void 0 ? [] : [pkg];
@@ -43922,8 +44707,13 @@ const relintPackage = ({ pkg, fix, verbose }) => {
43922
44707
  const pm = getPackageManager();
43923
44708
  return runSteps(`${fix ?? false ? "Fix" : "Lint"} [${pkg}]`, [pm.runInWorkspace(pkg, fix ?? false ? "package-fix" : verbose ?? false ? "package-lint-verbose" : "package-lint")]);
43924
44709
  };
43925
- const relint = ({ fix, gitignore, jobs, pkg, prev, verbose }) => {
43926
- if (!(prev ?? false)) {
44710
+ const relint = ({ fix, gitignore, jobs, mode, next, pkg, prev, verbose }) => {
44711
+ const resolvedMode = resolveLintMode({
44712
+ mode,
44713
+ next,
44714
+ prev
44715
+ }).mode;
44716
+ if (resolvedMode !== "workspace-eslint") {
43927
44717
  cleanLintCaches(pkg);
43928
44718
  clearIncrementalSnapshot("lint");
43929
44719
  return lint({
@@ -43932,6 +44722,7 @@ const relint = ({ fix, gitignore, jobs, pkg, prev, verbose }) => {
43932
44722
  gitignore,
43933
44723
  incremental: true,
43934
44724
  jobs,
44725
+ mode: resolvedMode,
43935
44726
  pkg,
43936
44727
  verbose
43937
44728
  });
@@ -54091,6 +54882,33 @@ const deadCommand = {
54091
54882
  }
54092
54883
  };
54093
54884
  //#endregion
54885
+ //#region src/xy/common/enable/index.ts
54886
+ const tsNativeCommand = {
54887
+ command: "ts-native",
54888
+ describe: "Enable TypeScript native (Go) compiler for type-check and declaration emit",
54889
+ builder: (yargs) => {
54890
+ return yargs.option("no-install", {
54891
+ default: false,
54892
+ description: "Skip package manager install after adding typescript-native",
54893
+ type: "boolean"
54894
+ });
54895
+ },
54896
+ handler: async (argv) => {
54897
+ await withEnvelope("enable ts-native", () => enableTsNativeAction({
54898
+ isVerbose: !!Boolean(argv.verbose),
54899
+ noInstall: !!Boolean(argv["no-install"])
54900
+ }));
54901
+ }
54902
+ };
54903
+ const enableCommand = {
54904
+ builder: (yargs) => {
54905
+ return yargs.command(tsNativeCommand).demandCommand(1, "Please specify what to enable (e.g. ts-native)").strictCommands();
54906
+ },
54907
+ command: "enable",
54908
+ describe: "Enable optional toolchain features for this repository",
54909
+ handler: () => {}
54910
+ };
54911
+ //#endregion
54094
54912
  //#region src/xy/deprecatedCommand.ts
54095
54913
  function warnDeprecatedCommand(oldCommand, newCommand) {
54096
54914
  console.warn(chalk.yellow(`Deprecated: "xy ${oldCommand}" is deprecated; use "xy ${newCommand}" instead.`));
@@ -55089,7 +55907,7 @@ const workCommand = {
55089
55907
  //#endregion
55090
55908
  //#region src/xy/common/index.ts
55091
55909
  const xyCommonCommands = (args) => {
55092
- return args.command(checkCommand).command(licenseCommand).command(deadCommand).command(gitCommand).command(gitlintCommand).command(gitignoreCommand).command(npmignoreGenCommand).command(orphanCommand).command(packmanCommand).command(repoCommand).command(retestCommand).command(secureCommand).command(skillsCommand).command(testCommand).command(workCommand);
55910
+ return args.command(checkCommand).command(licenseCommand).command(deadCommand).command(enableCommand).command(gitCommand).command(gitlintCommand).command(gitignoreCommand).command(npmignoreGenCommand).command(orphanCommand).command(packmanCommand).command(repoCommand).command(retestCommand).command(secureCommand).command(skillsCommand).command(testCommand).command(workCommand);
55093
55911
  };
55094
55912
  //#endregion
55095
55913
  //#region src/xy/deploy/deployCommand.ts
@@ -55589,14 +56407,20 @@ const runCommand = {
55589
56407
  default: true,
55590
56408
  description: "Ignore files matched by the repository root .gitignore (disable with --no-gitignore)",
55591
56409
  type: "boolean"
56410
+ }).option("mode", {
56411
+ choices: lintModes,
56412
+ default: defaultLintMode,
56413
+ description: "Lint implementation: package workers, shared type-checking, or workspace ESLint",
56414
+ type: "string"
55592
56415
  }).option("next", {
55593
56416
  default: false,
55594
- description: "Deprecated: per-package lint is the default",
56417
+ description: "Deprecated: use --mode package-workers",
55595
56418
  hidden: true,
55596
56419
  type: "boolean"
55597
56420
  }).option("prev", {
55598
56421
  default: false,
55599
- description: "Use the previous all-packages lint runner",
56422
+ description: "Deprecated: use --mode workspace-eslint",
56423
+ hidden: true,
55600
56424
  type: "boolean"
55601
56425
  }).option("analyze", {
55602
56426
  default: false,
@@ -55629,12 +56453,18 @@ const runCommand = {
55629
56453
  await withEnvelope("lint rules", async () => ruleCatalogResult(await getEslintRuleCatalog("lint"), RULE_COMMANDS.lint.title));
55630
56454
  return;
55631
56455
  }
56456
+ const resolvedMode = resolveLintMode({
56457
+ mode: argv.mode,
56458
+ next: argv.next,
56459
+ prev: argv.prev
56460
+ });
56461
+ if (resolvedMode.legacyOption !== void 0) console.warn(chalk.yellow(`Deprecated: "${resolvedMode.legacyOption}" is deprecated; use "--mode ${resolvedMode.mode}" instead.`));
55632
56462
  if (Boolean(argv.fresh)) {
55633
56463
  await withEnvelope("lint", () => relint({
55634
56464
  gitignore: argv.gitignore,
55635
56465
  jobs: argv.jobs,
56466
+ mode: resolvedMode.mode,
55636
56467
  pkg: argv.package,
55637
- prev: argv.prev,
55638
56468
  verbose: !!Boolean(argv.verbose)
55639
56469
  }));
55640
56470
  return;
@@ -55648,7 +56478,7 @@ const runCommand = {
55648
56478
  incremental: argv.incremental !== false,
55649
56479
  jobs: argv.jobs,
55650
56480
  meta: argv.meta,
55651
- prev: argv.prev,
56481
+ mode: resolvedMode.mode,
55652
56482
  pkg: argv.package,
55653
56483
  profile: argv.profile,
55654
56484
  skipEmpty: argv["skip-empty"],
@@ -55794,15 +56624,21 @@ const relintCommand = {
55794
56624
  command: "relint [package]",
55795
56625
  describe: "Deprecated: use \"xy lint --fresh\"",
55796
56626
  builder: (yargs) => {
55797
- return packagePositionalParam(yargs).option("next", {
56627
+ return packagePositionalParam(yargs).option("mode", {
56628
+ choices: lintModes,
56629
+ default: defaultLintMode,
56630
+ description: "Lint implementation: package workers, shared type-checking, or workspace ESLint",
56631
+ type: "string"
56632
+ }).option("next", {
55798
56633
  alias: "n",
55799
56634
  default: false,
55800
- description: "Deprecated: per-package lint is the default",
56635
+ description: "Deprecated: use --mode package-workers",
55801
56636
  hidden: true,
55802
56637
  type: "boolean"
55803
56638
  }).option("prev", {
55804
56639
  default: false,
55805
- description: "Use the previous all-packages lint runner",
56640
+ description: "Deprecated: use --mode workspace-eslint",
56641
+ hidden: true,
55806
56642
  type: "boolean"
55807
56643
  }).option("rules", {
55808
56644
  default: false,
@@ -55817,10 +56653,16 @@ const relintCommand = {
55817
56653
  await withEnvelope("lint rules", async () => ruleCatalogResult(await getEslintRuleCatalog("lint"), RULE_COMMANDS.lint.title));
55818
56654
  return;
55819
56655
  }
56656
+ const resolvedMode = resolveLintMode({
56657
+ mode: argv.mode,
56658
+ next: argv.next,
56659
+ prev: argv.prev
56660
+ });
56661
+ if (resolvedMode.legacyOption !== void 0) console.warn(chalk.yellow(`Deprecated: "${resolvedMode.legacyOption}" is deprecated; use "--mode ${resolvedMode.mode}" instead.`));
55820
56662
  await withEnvelope("lint", () => relint({
55821
56663
  jobs: argv.jobs,
56664
+ mode: resolvedMode.mode,
55822
56665
  pkg: argv.package,
55823
- prev: argv.prev,
55824
56666
  verbose: !!Boolean(argv.verbose)
55825
56667
  }));
55826
56668
  }