react-doctor 0.4.2-dev.98066c2 → 0.4.2-dev.a254414

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e1ad7784-a0ce-584d-ae5f-d37a821e4c57")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b818de08-3056-5722-a734-180e56f0923b")}catch(e){}}();
3
3
  import { createRequire } from "node:module";
4
4
  import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
5
5
  import * as path$1 from "node:path";
@@ -8,6 +8,7 @@ import * as fs$1 from "node:fs";
8
8
  import fs, { mkdtempSync, rmSync } from "node:fs";
9
9
  import process$1 from "node:process";
10
10
  import * as Schema from "effect/Schema";
11
+ import * as ts from "typescript";
11
12
  import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, FRAMEWORK_SPECIFIC_RULE_KEYS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES } from "oxlint-plugin-react-doctor";
12
13
  import * as Cause from "effect/Cause";
13
14
  import * as Effect from "effect/Effect";
@@ -32,9 +33,8 @@ import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
32
33
  import * as NodePath from "@effect/platform-node-shared/NodePath";
33
34
  import * as ChildProcess from "effect/unstable/process/ChildProcess";
34
35
  import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
35
- import * as ts from "typescript";
36
36
  import { gzipSync } from "node:zlib";
37
- import { createHash, randomUUID } from "node:crypto";
37
+ import crypto, { createHash, randomUUID } from "node:crypto";
38
38
  import * as Exit from "effect/Exit";
39
39
  import * as Sentry from "@sentry/node";
40
40
  import { performance } from "node:perf_hooks";
@@ -3205,7 +3205,7 @@ var JsonReportV2 = class extends Schema.Class("JsonReportV2")({
3205
3205
  Schema.Union([JsonReportV1, JsonReportV2]);
3206
3206
  //#endregion
3207
3207
  //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
3208
- var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3208
+ var require_constants$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3209
3209
  const WIN_SLASH = "\\\\/";
3210
3210
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
3211
3211
  const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
@@ -3375,7 +3375,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3375
3375
  //#endregion
3376
3376
  //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
3377
3377
  var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports) => {
3378
- const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
3378
+ const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1();
3379
3379
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
3380
3380
  exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
3381
3381
  exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
@@ -3424,7 +3424,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports) => {
3424
3424
  //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
3425
3425
  var require_scan = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3426
3426
  const utils = require_utils();
3427
- const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
3427
+ const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants$1();
3428
3428
  const isPathSeparator = (code) => {
3429
3429
  return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
3430
3430
  };
@@ -3709,8 +3709,8 @@ var require_scan = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3709
3709
  }));
3710
3710
  //#endregion
3711
3711
  //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
3712
- var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3713
- const constants = require_constants();
3712
+ var require_parse$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3713
+ const constants = require_constants$1();
3714
3714
  const utils = require_utils();
3715
3715
  /**
3716
3716
  * Constants
@@ -4766,9 +4766,9 @@ var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
4766
4766
  //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
4767
4767
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
4768
4768
  const scan = require_scan();
4769
- const parse = require_parse();
4769
+ const parse = require_parse$1();
4770
4770
  const utils = require_utils();
4771
- const constants = require_constants();
4771
+ const constants = require_constants$1();
4772
4772
  const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
4773
4773
  /**
4774
4774
  * Creates a matcher function from one or more glob patterns. The
@@ -5063,8 +5063,8 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
5063
5063
  module.exports = picomatch;
5064
5064
  }));
5065
5065
  //#endregion
5066
- //#region ../core/dist/index.js
5067
- var import_picomatch = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5066
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js
5067
+ var require_picomatch = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5068
5068
  const pico = require_picomatch$1();
5069
5069
  const utils = require_utils();
5070
5070
  function picomatch(glob, options, returnState = false) {
@@ -5076,206 +5076,1548 @@ var import_picomatch = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$
5076
5076
  }
5077
5077
  Object.assign(picomatch, pico);
5078
5078
  module.exports = picomatch;
5079
- })))(), 1);
5080
- var __create = Object.create;
5081
- var __defProp = Object.defineProperty;
5082
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5083
- var __getOwnPropNames = Object.getOwnPropertyNames;
5084
- var __getProtoOf = Object.getPrototypeOf;
5085
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5086
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
5087
- var __copyProps = (to, from, except, desc) => {
5088
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
5089
- key = keys[i];
5090
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
5091
- get: ((k) => from[k]).bind(null, key),
5092
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
5093
- });
5094
- }
5095
- return to;
5096
- };
5097
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
5098
- value: mod,
5099
- enumerable: true
5100
- }) : target, mod));
5101
- var ProjectNotFoundError = class extends Error {
5102
- name = "ProjectNotFoundError";
5103
- directory;
5104
- kind;
5105
- constructor(directory, options) {
5106
- const kind = options?.kind ?? "no-project";
5107
- super(kind === "missing-path" ? `Scan target "${directory}" does not exist. Check the path and try again.` : `No React project found in ${directory}. Expected a package.json at the directory root or a nested package.json with a React dependency.`, options);
5108
- this.directory = directory;
5109
- this.kind = kind;
5110
- }
5111
- };
5112
- var NoReactDependencyError = class extends Error {
5113
- name = "NoReactDependencyError";
5114
- directory;
5115
- constructor(directory, options) {
5116
- super(`No React dependency found in ${directory}/package.json. Add "react" to dependencies (or peerDependencies) and re-run.`, options);
5117
- this.directory = directory;
5118
- }
5119
- };
5120
- var PackageJsonNotFoundError = class extends Error {
5121
- name = "PackageJsonNotFoundError";
5122
- directory;
5123
- constructor(directory, options) {
5124
- super(`No package.json found in ${directory}`, options);
5125
- this.directory = directory;
5126
- }
5127
- };
5128
- var NotADirectoryError = class extends Error {
5129
- name = "NotADirectoryError";
5130
- resolvedPath;
5131
- constructor(resolvedPath, options) {
5132
- super(`Resolved scan target "${resolvedPath}" is not a directory. Ensure the path exists and points to a project directory, not a file.`, options);
5133
- this.resolvedPath = resolvedPath;
5134
- }
5135
- };
5136
- var AmbiguousProjectError = class extends Error {
5137
- name = "AmbiguousProjectError";
5138
- directory;
5139
- candidates;
5140
- constructor(directory, candidates, options) {
5141
- super(`Multiple React projects found under ${directory} (${candidates.length} candidates): ${candidates.join(", ")}. Re-run diagnose() with one of those subdirectories, or iterate them yourself.`, options);
5142
- this.directory = directory;
5143
- this.candidates = candidates;
5144
- }
5145
- };
5146
- const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
5147
- const isFile = (filePath) => {
5148
- try {
5149
- return fs$1.statSync(filePath).isFile();
5150
- } catch {
5151
- return false;
5152
- }
5153
- };
5154
- const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
5155
- const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
5156
- const MINIFIED_SNIFF_BYTES = 65536;
5157
- const GIT_LS_FILES_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
5158
- const IGNORED_DIRECTORIES = new Set([
5159
- ".git",
5160
- ".next",
5161
- ".nuxt",
5162
- ".output",
5163
- ".svelte-kit",
5164
- ".turbo",
5165
- "build",
5166
- "coverage",
5167
- "dist",
5168
- "node_modules",
5169
- "out",
5170
- "storybook-static"
5171
- ]);
5172
- const isLintableSourceFile = (filePath) => SOURCE_FILE_PATTERN.test(filePath) && !GENERATED_BUNDLE_FILE_PATTERN.test(filePath);
5173
- const isMinifiedSource = (absolutePath) => {
5174
- let fileDescriptor;
5175
- try {
5176
- fileDescriptor = fs$1.openSync(absolutePath, "r");
5177
- const buffer = Buffer.alloc(MINIFIED_SNIFF_BYTES);
5178
- const bytesRead = fs$1.readSync(fileDescriptor, buffer, 0, MINIFIED_SNIFF_BYTES, 0);
5179
- const prefix = buffer.toString("utf8", 0, bytesRead);
5180
- const lines = prefix.split("\n");
5181
- const longestLineLength = lines.reduce((longest, line) => Math.max(longest, line.length), 0);
5182
- const averageLineLength = prefix.length / lines.length;
5183
- return longestLineLength > 1e3 && averageLineLength > 500;
5184
- } catch {
5185
- return false;
5186
- } finally {
5187
- if (fileDescriptor !== void 0) fs$1.closeSync(fileDescriptor);
5188
- }
5189
- };
5190
- const isLargeMinifiedFile = (absolutePath) => {
5191
- let sizeBytes;
5192
- try {
5193
- sizeBytes = fs$1.statSync(absolutePath).size;
5194
- } catch {
5195
- return false;
5196
- }
5197
- if (sizeBytes < 2e4) return false;
5198
- return isMinifiedSource(absolutePath);
5199
- };
5200
- const IGNORABLE_READDIR_ERROR_CODES = new Set([
5201
- "EACCES",
5202
- "EPERM",
5203
- "ENOENT",
5204
- "ENOTDIR",
5205
- "EINVAL",
5206
- "ELOOP",
5207
- "ENAMETOOLONG"
5208
- ]);
5209
- const isIgnorableReaddirError = (error) => {
5210
- if (typeof error !== "object" || error === null) return false;
5211
- const errorCode = error.code;
5212
- return typeof errorCode === "string" && IGNORABLE_READDIR_ERROR_CODES.has(errorCode);
5213
- };
5214
- const readDirectoryEntries = (directoryPath) => {
5215
- try {
5216
- return fs$1.readdirSync(directoryPath, { withFileTypes: true });
5217
- } catch (error) {
5218
- if (isIgnorableReaddirError(error)) return [];
5219
- throw error;
5220
- }
5221
- };
5222
- const countSourceFilesViaFilesystem = (rootDirectory) => {
5223
- let count = 0;
5224
- const stack = [rootDirectory];
5225
- while (stack.length > 0) {
5226
- const currentDirectory = stack.pop();
5227
- const entries = readDirectoryEntries(currentDirectory);
5228
- for (const entry of entries) {
5229
- if (entry.isDirectory()) {
5230
- if (!entry.name.startsWith(".") && !IGNORED_DIRECTORIES.has(entry.name)) stack.push(path$1.join(currentDirectory, entry.name));
5231
- continue;
5079
+ }));
5080
+ //#endregion
5081
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js
5082
+ var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5083
+ const SEMVER_SPEC_VERSION = "2.0.0";
5084
+ const MAX_LENGTH = 256;
5085
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
5086
+ module.exports = {
5087
+ MAX_LENGTH,
5088
+ MAX_SAFE_COMPONENT_LENGTH: 16,
5089
+ MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
5090
+ MAX_SAFE_INTEGER,
5091
+ RELEASE_TYPES: [
5092
+ "major",
5093
+ "premajor",
5094
+ "minor",
5095
+ "preminor",
5096
+ "patch",
5097
+ "prepatch",
5098
+ "prerelease"
5099
+ ],
5100
+ SEMVER_SPEC_VERSION,
5101
+ FLAG_INCLUDE_PRERELEASE: 1,
5102
+ FLAG_LOOSE: 2
5103
+ };
5104
+ }));
5105
+ //#endregion
5106
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
5107
+ var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5108
+ module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
5109
+ }));
5110
+ //#endregion
5111
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js
5112
+ var require_re = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5113
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
5114
+ const debug = require_debug();
5115
+ exports = module.exports = {};
5116
+ const re = exports.re = [];
5117
+ const safeRe = exports.safeRe = [];
5118
+ const src = exports.src = [];
5119
+ const safeSrc = exports.safeSrc = [];
5120
+ const t = exports.t = {};
5121
+ let R = 0;
5122
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
5123
+ const safeRegexReplacements = [
5124
+ ["\\s", 1],
5125
+ ["\\d", MAX_LENGTH],
5126
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
5127
+ ];
5128
+ const makeSafeRegex = (value) => {
5129
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
5130
+ return value;
5131
+ };
5132
+ const createToken = (name, value, isGlobal) => {
5133
+ const safe = makeSafeRegex(value);
5134
+ const index = R++;
5135
+ debug(name, index, value);
5136
+ t[name] = index;
5137
+ src[index] = value;
5138
+ safeSrc[index] = safe;
5139
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
5140
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
5141
+ };
5142
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
5143
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
5144
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
5145
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
5146
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
5147
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
5148
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
5149
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
5150
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
5151
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
5152
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
5153
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
5154
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
5155
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
5156
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
5157
+ createToken("GTLT", "((?:<|>)?=?)");
5158
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
5159
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
5160
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
5161
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
5162
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
5163
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
5164
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
5165
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
5166
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
5167
+ createToken("COERCERTL", src[t.COERCE], true);
5168
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
5169
+ createToken("LONETILDE", "(?:~>?)");
5170
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
5171
+ exports.tildeTrimReplace = "$1~";
5172
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
5173
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
5174
+ createToken("LONECARET", "(?:\\^)");
5175
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
5176
+ exports.caretTrimReplace = "$1^";
5177
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
5178
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
5179
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
5180
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
5181
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
5182
+ exports.comparatorTrimReplace = "$1$2$3";
5183
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
5184
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
5185
+ createToken("STAR", "(<|>)?=?\\s*\\*");
5186
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
5187
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
5188
+ }));
5189
+ //#endregion
5190
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js
5191
+ var require_parse_options = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5192
+ const looseOption = Object.freeze({ loose: true });
5193
+ const emptyOpts = Object.freeze({});
5194
+ const parseOptions = (options) => {
5195
+ if (!options) return emptyOpts;
5196
+ if (typeof options !== "object") return looseOption;
5197
+ return options;
5198
+ };
5199
+ module.exports = parseOptions;
5200
+ }));
5201
+ //#endregion
5202
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js
5203
+ var require_identifiers = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5204
+ const numeric = /^[0-9]+$/;
5205
+ const compareIdentifiers = (a, b) => {
5206
+ if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
5207
+ const anum = numeric.test(a);
5208
+ const bnum = numeric.test(b);
5209
+ if (anum && bnum) {
5210
+ a = +a;
5211
+ b = +b;
5212
+ }
5213
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
5214
+ };
5215
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
5216
+ module.exports = {
5217
+ compareIdentifiers,
5218
+ rcompareIdentifiers
5219
+ };
5220
+ }));
5221
+ //#endregion
5222
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js
5223
+ var require_semver$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5224
+ const debug = require_debug();
5225
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
5226
+ const { safeRe: re, t } = require_re();
5227
+ const parseOptions = require_parse_options();
5228
+ const { compareIdentifiers } = require_identifiers();
5229
+ module.exports = class SemVer {
5230
+ constructor(version, options) {
5231
+ options = parseOptions(options);
5232
+ if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
5233
+ else version = version.version;
5234
+ else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
5235
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
5236
+ debug("SemVer", version, options);
5237
+ this.options = options;
5238
+ this.loose = !!options.loose;
5239
+ this.includePrerelease = !!options.includePrerelease;
5240
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
5241
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
5242
+ this.raw = version;
5243
+ this.major = +m[1];
5244
+ this.minor = +m[2];
5245
+ this.patch = +m[3];
5246
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
5247
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
5248
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
5249
+ if (!m[4]) this.prerelease = [];
5250
+ else this.prerelease = m[4].split(".").map((id) => {
5251
+ if (/^[0-9]+$/.test(id)) {
5252
+ const num = +id;
5253
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
5254
+ }
5255
+ return id;
5256
+ });
5257
+ this.build = m[5] ? m[5].split(".") : [];
5258
+ this.format();
5259
+ }
5260
+ format() {
5261
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
5262
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
5263
+ return this.version;
5264
+ }
5265
+ toString() {
5266
+ return this.version;
5267
+ }
5268
+ compare(other) {
5269
+ debug("SemVer.compare", this.version, this.options, other);
5270
+ if (!(other instanceof SemVer)) {
5271
+ if (typeof other === "string" && other === this.version) return 0;
5272
+ other = new SemVer(other, this.options);
5232
5273
  }
5233
- if (entry.isFile() && isLintableSourceFile(entry.name) && !isLargeMinifiedFile(path$1.join(currentDirectory, entry.name))) count++;
5274
+ if (other.version === this.version) return 0;
5275
+ return this.compareMain(other) || this.comparePre(other);
5276
+ }
5277
+ compareMain(other) {
5278
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
5279
+ if (this.major < other.major) return -1;
5280
+ if (this.major > other.major) return 1;
5281
+ if (this.minor < other.minor) return -1;
5282
+ if (this.minor > other.minor) return 1;
5283
+ if (this.patch < other.patch) return -1;
5284
+ if (this.patch > other.patch) return 1;
5285
+ return 0;
5286
+ }
5287
+ comparePre(other) {
5288
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
5289
+ if (this.prerelease.length && !other.prerelease.length) return -1;
5290
+ else if (!this.prerelease.length && other.prerelease.length) return 1;
5291
+ else if (!this.prerelease.length && !other.prerelease.length) return 0;
5292
+ let i = 0;
5293
+ do {
5294
+ const a = this.prerelease[i];
5295
+ const b = other.prerelease[i];
5296
+ debug("prerelease compare", i, a, b);
5297
+ if (a === void 0 && b === void 0) return 0;
5298
+ else if (b === void 0) return 1;
5299
+ else if (a === void 0) return -1;
5300
+ else if (a === b) continue;
5301
+ else return compareIdentifiers(a, b);
5302
+ } while (++i);
5303
+ }
5304
+ compareBuild(other) {
5305
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
5306
+ let i = 0;
5307
+ do {
5308
+ const a = this.build[i];
5309
+ const b = other.build[i];
5310
+ debug("build compare", i, a, b);
5311
+ if (a === void 0 && b === void 0) return 0;
5312
+ else if (b === void 0) return 1;
5313
+ else if (a === void 0) return -1;
5314
+ else if (a === b) continue;
5315
+ else return compareIdentifiers(a, b);
5316
+ } while (++i);
5317
+ }
5318
+ inc(release, identifier, identifierBase) {
5319
+ if (release.startsWith("pre")) {
5320
+ if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
5321
+ if (identifier) {
5322
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
5323
+ if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
5324
+ }
5325
+ }
5326
+ switch (release) {
5327
+ case "premajor":
5328
+ this.prerelease.length = 0;
5329
+ this.patch = 0;
5330
+ this.minor = 0;
5331
+ this.major++;
5332
+ this.inc("pre", identifier, identifierBase);
5333
+ break;
5334
+ case "preminor":
5335
+ this.prerelease.length = 0;
5336
+ this.patch = 0;
5337
+ this.minor++;
5338
+ this.inc("pre", identifier, identifierBase);
5339
+ break;
5340
+ case "prepatch":
5341
+ this.prerelease.length = 0;
5342
+ this.inc("patch", identifier, identifierBase);
5343
+ this.inc("pre", identifier, identifierBase);
5344
+ break;
5345
+ case "prerelease":
5346
+ if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
5347
+ this.inc("pre", identifier, identifierBase);
5348
+ break;
5349
+ case "release":
5350
+ if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
5351
+ this.prerelease.length = 0;
5352
+ break;
5353
+ case "major":
5354
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
5355
+ this.minor = 0;
5356
+ this.patch = 0;
5357
+ this.prerelease = [];
5358
+ break;
5359
+ case "minor":
5360
+ if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
5361
+ this.patch = 0;
5362
+ this.prerelease = [];
5363
+ break;
5364
+ case "patch":
5365
+ if (this.prerelease.length === 0) this.patch++;
5366
+ this.prerelease = [];
5367
+ break;
5368
+ case "pre": {
5369
+ const base = Number(identifierBase) ? 1 : 0;
5370
+ if (this.prerelease.length === 0) this.prerelease = [base];
5371
+ else {
5372
+ let i = this.prerelease.length;
5373
+ while (--i >= 0) if (typeof this.prerelease[i] === "number") {
5374
+ this.prerelease[i]++;
5375
+ i = -2;
5376
+ }
5377
+ if (i === -1) {
5378
+ if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
5379
+ this.prerelease.push(base);
5380
+ }
5381
+ }
5382
+ if (identifier) {
5383
+ let prerelease = [identifier, base];
5384
+ if (identifierBase === false) prerelease = [identifier];
5385
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
5386
+ if (isNaN(this.prerelease[1])) this.prerelease = prerelease;
5387
+ } else this.prerelease = prerelease;
5388
+ }
5389
+ break;
5390
+ }
5391
+ default: throw new Error(`invalid increment argument: ${release}`);
5392
+ }
5393
+ this.raw = this.format();
5394
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
5395
+ return this;
5234
5396
  }
5235
- }
5236
- return count;
5237
- };
5238
- const countSourceFilesViaGit = (rootDirectory) => {
5239
- const result = spawnSync("git", [
5240
- "ls-files",
5241
- "-z",
5242
- "--cached",
5243
- "--others",
5244
- "--exclude-standard"
5245
- ], {
5246
- cwd: rootDirectory,
5247
- encoding: "utf-8",
5248
- maxBuffer: GIT_LS_FILES_MAX_BUFFER_BYTES
5249
- });
5250
- if (result.error || result.status !== 0) return null;
5251
- return result.stdout.split("\0").filter((filePath) => filePath.length > 0 && isLintableSourceFile(filePath) && !isLargeMinifiedFile(path$1.resolve(rootDirectory, filePath))).length;
5252
- };
5253
- const countSourceFiles = (rootDirectory) => countSourceFilesViaGit(rootDirectory) ?? countSourceFilesViaFilesystem(rootDirectory);
5254
- const cachedPackageJsons = /* @__PURE__ */ new Map();
5255
- const readPackageJsonUncached = (packageJsonPath) => {
5256
- try {
5257
- return JSON.parse(fs$1.readFileSync(packageJsonPath, "utf-8"));
5258
- } catch (error) {
5259
- if (error instanceof SyntaxError) return {};
5260
- if (error instanceof Error && "code" in error) {
5261
- const { code } = error;
5262
- if (code === "EISDIR" || code === "EACCES" || code === "EPERM" || code === "ENOENT") return {};
5397
+ };
5398
+ }));
5399
+ //#endregion
5400
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js
5401
+ var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5402
+ const SemVer = require_semver$1();
5403
+ const parse = (version, options, throwErrors = false) => {
5404
+ if (version instanceof SemVer) return version;
5405
+ try {
5406
+ return new SemVer(version, options);
5407
+ } catch (er) {
5408
+ if (!throwErrors) return null;
5409
+ throw er;
5263
5410
  }
5264
- throw error;
5265
- }
5266
- };
5267
- const readPackageJson$1 = (packageJsonPath) => {
5268
- const absolutePath = path$1.resolve(packageJsonPath);
5269
- const cached = cachedPackageJsons.get(absolutePath);
5270
- if (cached !== void 0) return cached;
5271
- const result = readPackageJsonUncached(absolutePath);
5272
- cachedPackageJsons.set(absolutePath, result);
5273
- return result;
5274
- };
5275
- const isMonorepoRoot = (directory) => {
5276
- if (isFile(path$1.join(directory, "pnpm-workspace.yaml"))) return true;
5277
- if (isFile(path$1.join(directory, "nx.json"))) return true;
5278
- const packageJsonPath = path$1.join(directory, "package.json");
5411
+ };
5412
+ module.exports = parse;
5413
+ }));
5414
+ //#endregion
5415
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js
5416
+ var require_valid$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5417
+ const parse = require_parse();
5418
+ const valid = (version, options) => {
5419
+ const v = parse(version, options);
5420
+ return v ? v.version : null;
5421
+ };
5422
+ module.exports = valid;
5423
+ }));
5424
+ //#endregion
5425
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js
5426
+ var require_clean = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5427
+ const parse = require_parse();
5428
+ const clean = (version, options) => {
5429
+ const s = parse(version.trim().replace(/^[=v]+/, ""), options);
5430
+ return s ? s.version : null;
5431
+ };
5432
+ module.exports = clean;
5433
+ }));
5434
+ //#endregion
5435
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js
5436
+ var require_inc = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5437
+ const SemVer = require_semver$1();
5438
+ const inc = (version, release, options, identifier, identifierBase) => {
5439
+ if (typeof options === "string") {
5440
+ identifierBase = identifier;
5441
+ identifier = options;
5442
+ options = void 0;
5443
+ }
5444
+ try {
5445
+ return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
5446
+ } catch (er) {
5447
+ return null;
5448
+ }
5449
+ };
5450
+ module.exports = inc;
5451
+ }));
5452
+ //#endregion
5453
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js
5454
+ var require_diff = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5455
+ const parse = require_parse();
5456
+ const diff = (version1, version2) => {
5457
+ const v1 = parse(version1, null, true);
5458
+ const v2 = parse(version2, null, true);
5459
+ const comparison = v1.compare(v2);
5460
+ if (comparison === 0) return null;
5461
+ const v1Higher = comparison > 0;
5462
+ const highVersion = v1Higher ? v1 : v2;
5463
+ const lowVersion = v1Higher ? v2 : v1;
5464
+ const highHasPre = !!highVersion.prerelease.length;
5465
+ if (!!lowVersion.prerelease.length && !highHasPre) {
5466
+ if (!lowVersion.patch && !lowVersion.minor) return "major";
5467
+ if (lowVersion.compareMain(highVersion) === 0) {
5468
+ if (lowVersion.minor && !lowVersion.patch) return "minor";
5469
+ return "patch";
5470
+ }
5471
+ }
5472
+ const prefix = highHasPre ? "pre" : "";
5473
+ if (v1.major !== v2.major) return prefix + "major";
5474
+ if (v1.minor !== v2.minor) return prefix + "minor";
5475
+ if (v1.patch !== v2.patch) return prefix + "patch";
5476
+ return "prerelease";
5477
+ };
5478
+ module.exports = diff;
5479
+ }));
5480
+ //#endregion
5481
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js
5482
+ var require_major = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5483
+ const SemVer = require_semver$1();
5484
+ const major = (a, loose) => new SemVer(a, loose).major;
5485
+ module.exports = major;
5486
+ }));
5487
+ //#endregion
5488
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js
5489
+ var require_minor = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5490
+ const SemVer = require_semver$1();
5491
+ const minor = (a, loose) => new SemVer(a, loose).minor;
5492
+ module.exports = minor;
5493
+ }));
5494
+ //#endregion
5495
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js
5496
+ var require_patch = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5497
+ const SemVer = require_semver$1();
5498
+ const patch = (a, loose) => new SemVer(a, loose).patch;
5499
+ module.exports = patch;
5500
+ }));
5501
+ //#endregion
5502
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js
5503
+ var require_prerelease = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5504
+ const parse = require_parse();
5505
+ const prerelease = (version, options) => {
5506
+ const parsed = parse(version, options);
5507
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
5508
+ };
5509
+ module.exports = prerelease;
5510
+ }));
5511
+ //#endregion
5512
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js
5513
+ var require_compare = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5514
+ const SemVer = require_semver$1();
5515
+ const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
5516
+ module.exports = compare;
5517
+ }));
5518
+ //#endregion
5519
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js
5520
+ var require_rcompare = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5521
+ const compare = require_compare();
5522
+ const rcompare = (a, b, loose) => compare(b, a, loose);
5523
+ module.exports = rcompare;
5524
+ }));
5525
+ //#endregion
5526
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js
5527
+ var require_compare_loose = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5528
+ const compare = require_compare();
5529
+ const compareLoose = (a, b) => compare(a, b, true);
5530
+ module.exports = compareLoose;
5531
+ }));
5532
+ //#endregion
5533
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js
5534
+ var require_compare_build = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5535
+ const SemVer = require_semver$1();
5536
+ const compareBuild = (a, b, loose) => {
5537
+ const versionA = new SemVer(a, loose);
5538
+ const versionB = new SemVer(b, loose);
5539
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
5540
+ };
5541
+ module.exports = compareBuild;
5542
+ }));
5543
+ //#endregion
5544
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js
5545
+ var require_sort = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5546
+ const compareBuild = require_compare_build();
5547
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
5548
+ module.exports = sort;
5549
+ }));
5550
+ //#endregion
5551
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js
5552
+ var require_rsort = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5553
+ const compareBuild = require_compare_build();
5554
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
5555
+ module.exports = rsort;
5556
+ }));
5557
+ //#endregion
5558
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js
5559
+ var require_gt = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5560
+ const compare = require_compare();
5561
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
5562
+ module.exports = gt;
5563
+ }));
5564
+ //#endregion
5565
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js
5566
+ var require_lt = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5567
+ const compare = require_compare();
5568
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
5569
+ module.exports = lt;
5570
+ }));
5571
+ //#endregion
5572
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js
5573
+ var require_eq = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5574
+ const compare = require_compare();
5575
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
5576
+ module.exports = eq;
5577
+ }));
5578
+ //#endregion
5579
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js
5580
+ var require_neq = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5581
+ const compare = require_compare();
5582
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
5583
+ module.exports = neq;
5584
+ }));
5585
+ //#endregion
5586
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js
5587
+ var require_gte = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5588
+ const compare = require_compare();
5589
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
5590
+ module.exports = gte;
5591
+ }));
5592
+ //#endregion
5593
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js
5594
+ var require_lte = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5595
+ const compare = require_compare();
5596
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
5597
+ module.exports = lte;
5598
+ }));
5599
+ //#endregion
5600
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js
5601
+ var require_cmp = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5602
+ const eq = require_eq();
5603
+ const neq = require_neq();
5604
+ const gt = require_gt();
5605
+ const gte = require_gte();
5606
+ const lt = require_lt();
5607
+ const lte = require_lte();
5608
+ const cmp = (a, op, b, loose) => {
5609
+ switch (op) {
5610
+ case "===":
5611
+ if (typeof a === "object") a = a.version;
5612
+ if (typeof b === "object") b = b.version;
5613
+ return a === b;
5614
+ case "!==":
5615
+ if (typeof a === "object") a = a.version;
5616
+ if (typeof b === "object") b = b.version;
5617
+ return a !== b;
5618
+ case "":
5619
+ case "=":
5620
+ case "==": return eq(a, b, loose);
5621
+ case "!=": return neq(a, b, loose);
5622
+ case ">": return gt(a, b, loose);
5623
+ case ">=": return gte(a, b, loose);
5624
+ case "<": return lt(a, b, loose);
5625
+ case "<=": return lte(a, b, loose);
5626
+ default: throw new TypeError(`Invalid operator: ${op}`);
5627
+ }
5628
+ };
5629
+ module.exports = cmp;
5630
+ }));
5631
+ //#endregion
5632
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js
5633
+ var require_coerce = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5634
+ const SemVer = require_semver$1();
5635
+ const parse = require_parse();
5636
+ const { safeRe: re, t } = require_re();
5637
+ const coerce = (version, options) => {
5638
+ if (version instanceof SemVer) return version;
5639
+ if (typeof version === "number") version = String(version);
5640
+ if (typeof version !== "string") return null;
5641
+ options = options || {};
5642
+ let match = null;
5643
+ if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
5644
+ else {
5645
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
5646
+ let next;
5647
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
5648
+ if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
5649
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
5650
+ }
5651
+ coerceRtlRegex.lastIndex = -1;
5652
+ }
5653
+ if (match === null) return null;
5654
+ const major = match[2];
5655
+ return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
5656
+ };
5657
+ module.exports = coerce;
5658
+ }));
5659
+ //#endregion
5660
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js
5661
+ var require_lrucache = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5662
+ var LRUCache = class {
5663
+ constructor() {
5664
+ this.max = 1e3;
5665
+ this.map = /* @__PURE__ */ new Map();
5666
+ }
5667
+ get(key) {
5668
+ const value = this.map.get(key);
5669
+ if (value === void 0) return;
5670
+ else {
5671
+ this.map.delete(key);
5672
+ this.map.set(key, value);
5673
+ return value;
5674
+ }
5675
+ }
5676
+ delete(key) {
5677
+ return this.map.delete(key);
5678
+ }
5679
+ set(key, value) {
5680
+ if (!this.delete(key) && value !== void 0) {
5681
+ if (this.map.size >= this.max) {
5682
+ const firstKey = this.map.keys().next().value;
5683
+ this.delete(firstKey);
5684
+ }
5685
+ this.map.set(key, value);
5686
+ }
5687
+ return this;
5688
+ }
5689
+ };
5690
+ module.exports = LRUCache;
5691
+ }));
5692
+ //#endregion
5693
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js
5694
+ var require_range = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5695
+ const SPACE_CHARACTERS = /\s+/g;
5696
+ module.exports = class Range {
5697
+ constructor(range, options) {
5698
+ options = parseOptions(options);
5699
+ if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
5700
+ else return new Range(range.raw, options);
5701
+ if (range instanceof Comparator) {
5702
+ this.raw = range.value;
5703
+ this.set = [[range]];
5704
+ this.formatted = void 0;
5705
+ return this;
5706
+ }
5707
+ this.options = options;
5708
+ this.loose = !!options.loose;
5709
+ this.includePrerelease = !!options.includePrerelease;
5710
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
5711
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
5712
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
5713
+ if (this.set.length > 1) {
5714
+ const first = this.set[0];
5715
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
5716
+ if (this.set.length === 0) this.set = [first];
5717
+ else if (this.set.length > 1) {
5718
+ for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
5719
+ this.set = [c];
5720
+ break;
5721
+ }
5722
+ }
5723
+ }
5724
+ this.formatted = void 0;
5725
+ }
5726
+ get range() {
5727
+ if (this.formatted === void 0) {
5728
+ this.formatted = "";
5729
+ for (let i = 0; i < this.set.length; i++) {
5730
+ if (i > 0) this.formatted += "||";
5731
+ const comps = this.set[i];
5732
+ for (let k = 0; k < comps.length; k++) {
5733
+ if (k > 0) this.formatted += " ";
5734
+ this.formatted += comps[k].toString().trim();
5735
+ }
5736
+ }
5737
+ }
5738
+ return this.formatted;
5739
+ }
5740
+ format() {
5741
+ return this.range;
5742
+ }
5743
+ toString() {
5744
+ return this.range;
5745
+ }
5746
+ parseRange(range) {
5747
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
5748
+ const cached = cache.get(memoKey);
5749
+ if (cached) return cached;
5750
+ const loose = this.options.loose;
5751
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
5752
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
5753
+ debug("hyphen replace", range);
5754
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
5755
+ debug("comparator trim", range);
5756
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
5757
+ debug("tilde trim", range);
5758
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
5759
+ debug("caret trim", range);
5760
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
5761
+ if (loose) rangeList = rangeList.filter((comp) => {
5762
+ debug("loose invalid filter", comp, this.options);
5763
+ return !!comp.match(re[t.COMPARATORLOOSE]);
5764
+ });
5765
+ debug("range list", rangeList);
5766
+ const rangeMap = /* @__PURE__ */ new Map();
5767
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
5768
+ for (const comp of comparators) {
5769
+ if (isNullSet(comp)) return [comp];
5770
+ rangeMap.set(comp.value, comp);
5771
+ }
5772
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
5773
+ const result = [...rangeMap.values()];
5774
+ cache.set(memoKey, result);
5775
+ return result;
5776
+ }
5777
+ intersects(range, options) {
5778
+ if (!(range instanceof Range)) throw new TypeError("a Range is required");
5779
+ return this.set.some((thisComparators) => {
5780
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
5781
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
5782
+ return rangeComparators.every((rangeComparator) => {
5783
+ return thisComparator.intersects(rangeComparator, options);
5784
+ });
5785
+ });
5786
+ });
5787
+ });
5788
+ }
5789
+ test(version) {
5790
+ if (!version) return false;
5791
+ if (typeof version === "string") try {
5792
+ version = new SemVer(version, this.options);
5793
+ } catch (er) {
5794
+ return false;
5795
+ }
5796
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
5797
+ return false;
5798
+ }
5799
+ };
5800
+ const cache = new (require_lrucache())();
5801
+ const parseOptions = require_parse_options();
5802
+ const Comparator = require_comparator();
5803
+ const debug = require_debug();
5804
+ const SemVer = require_semver$1();
5805
+ const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
5806
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
5807
+ const isNullSet = (c) => c.value === "<0.0.0-0";
5808
+ const isAny = (c) => c.value === "";
5809
+ const isSatisfiable = (comparators, options) => {
5810
+ let result = true;
5811
+ const remainingComparators = comparators.slice();
5812
+ let testComparator = remainingComparators.pop();
5813
+ while (result && remainingComparators.length) {
5814
+ result = remainingComparators.every((otherComparator) => {
5815
+ return testComparator.intersects(otherComparator, options);
5816
+ });
5817
+ testComparator = remainingComparators.pop();
5818
+ }
5819
+ return result;
5820
+ };
5821
+ const parseComparator = (comp, options) => {
5822
+ comp = comp.replace(re[t.BUILD], "");
5823
+ debug("comp", comp, options);
5824
+ comp = replaceCarets(comp, options);
5825
+ debug("caret", comp);
5826
+ comp = replaceTildes(comp, options);
5827
+ debug("tildes", comp);
5828
+ comp = replaceXRanges(comp, options);
5829
+ debug("xrange", comp);
5830
+ comp = replaceStars(comp, options);
5831
+ debug("stars", comp);
5832
+ return comp;
5833
+ };
5834
+ const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
5835
+ const replaceTildes = (comp, options) => {
5836
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
5837
+ };
5838
+ const replaceTilde = (comp, options) => {
5839
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
5840
+ return comp.replace(r, (_, M, m, p, pr) => {
5841
+ debug("tilde", comp, _, M, m, p, pr);
5842
+ let ret;
5843
+ if (isX(M)) ret = "";
5844
+ else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
5845
+ else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
5846
+ else if (pr) {
5847
+ debug("replaceTilde pr", pr);
5848
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
5849
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
5850
+ debug("tilde return", ret);
5851
+ return ret;
5852
+ });
5853
+ };
5854
+ const replaceCarets = (comp, options) => {
5855
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
5856
+ };
5857
+ const replaceCaret = (comp, options) => {
5858
+ debug("caret", comp, options);
5859
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
5860
+ const z = options.includePrerelease ? "-0" : "";
5861
+ return comp.replace(r, (_, M, m, p, pr) => {
5862
+ debug("caret", comp, _, M, m, p, pr);
5863
+ let ret;
5864
+ if (isX(M)) ret = "";
5865
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
5866
+ else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
5867
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
5868
+ else if (pr) {
5869
+ debug("replaceCaret pr", pr);
5870
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
5871
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
5872
+ else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
5873
+ } else {
5874
+ debug("no pr");
5875
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
5876
+ else ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
5877
+ else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
5878
+ }
5879
+ debug("caret return", ret);
5880
+ return ret;
5881
+ });
5882
+ };
5883
+ const replaceXRanges = (comp, options) => {
5884
+ debug("replaceXRanges", comp, options);
5885
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
5886
+ };
5887
+ const replaceXRange = (comp, options) => {
5888
+ comp = comp.trim();
5889
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
5890
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
5891
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
5892
+ const xM = isX(M);
5893
+ const xm = xM || isX(m);
5894
+ const xp = xm || isX(p);
5895
+ const anyX = xp;
5896
+ if (gtlt === "=" && anyX) gtlt = "";
5897
+ pr = options.includePrerelease ? "-0" : "";
5898
+ if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
5899
+ else ret = "*";
5900
+ else if (gtlt && anyX) {
5901
+ if (xm) m = 0;
5902
+ p = 0;
5903
+ if (gtlt === ">") {
5904
+ gtlt = ">=";
5905
+ if (xm) {
5906
+ M = +M + 1;
5907
+ m = 0;
5908
+ p = 0;
5909
+ } else {
5910
+ m = +m + 1;
5911
+ p = 0;
5912
+ }
5913
+ } else if (gtlt === "<=") {
5914
+ gtlt = "<";
5915
+ if (xm) M = +M + 1;
5916
+ else m = +m + 1;
5917
+ }
5918
+ if (gtlt === "<") pr = "-0";
5919
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
5920
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
5921
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
5922
+ debug("xRange return", ret);
5923
+ return ret;
5924
+ });
5925
+ };
5926
+ const replaceStars = (comp, options) => {
5927
+ debug("replaceStars", comp, options);
5928
+ return comp.trim().replace(re[t.STAR], "");
5929
+ };
5930
+ const replaceGTE0 = (comp, options) => {
5931
+ debug("replaceGTE0", comp, options);
5932
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
5933
+ };
5934
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
5935
+ if (isX(fM)) from = "";
5936
+ else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
5937
+ else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
5938
+ else if (fpr) from = `>=${from}`;
5939
+ else from = `>=${from}${incPr ? "-0" : ""}`;
5940
+ if (isX(tM)) to = "";
5941
+ else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
5942
+ else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
5943
+ else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
5944
+ else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
5945
+ else to = `<=${to}`;
5946
+ return `${from} ${to}`.trim();
5947
+ };
5948
+ const testSet = (set, version, options) => {
5949
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
5950
+ if (version.prerelease.length && !options.includePrerelease) {
5951
+ for (let i = 0; i < set.length; i++) {
5952
+ debug(set[i].semver);
5953
+ if (set[i].semver === Comparator.ANY) continue;
5954
+ if (set[i].semver.prerelease.length > 0) {
5955
+ const allowed = set[i].semver;
5956
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
5957
+ }
5958
+ }
5959
+ return false;
5960
+ }
5961
+ return true;
5962
+ };
5963
+ }));
5964
+ //#endregion
5965
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js
5966
+ var require_comparator = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5967
+ const ANY = Symbol("SemVer ANY");
5968
+ module.exports = class Comparator {
5969
+ static get ANY() {
5970
+ return ANY;
5971
+ }
5972
+ constructor(comp, options) {
5973
+ options = parseOptions(options);
5974
+ if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
5975
+ else comp = comp.value;
5976
+ comp = comp.trim().split(/\s+/).join(" ");
5977
+ debug("comparator", comp, options);
5978
+ this.options = options;
5979
+ this.loose = !!options.loose;
5980
+ this.parse(comp);
5981
+ if (this.semver === ANY) this.value = "";
5982
+ else this.value = this.operator + this.semver.version;
5983
+ debug("comp", this);
5984
+ }
5985
+ parse(comp) {
5986
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
5987
+ const m = comp.match(r);
5988
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
5989
+ this.operator = m[1] !== void 0 ? m[1] : "";
5990
+ if (this.operator === "=") this.operator = "";
5991
+ if (!m[2]) this.semver = ANY;
5992
+ else this.semver = new SemVer(m[2], this.options.loose);
5993
+ }
5994
+ toString() {
5995
+ return this.value;
5996
+ }
5997
+ test(version) {
5998
+ debug("Comparator.test", version, this.options.loose);
5999
+ if (this.semver === ANY || version === ANY) return true;
6000
+ if (typeof version === "string") try {
6001
+ version = new SemVer(version, this.options);
6002
+ } catch (er) {
6003
+ return false;
6004
+ }
6005
+ return cmp(version, this.operator, this.semver, this.options);
6006
+ }
6007
+ intersects(comp, options) {
6008
+ if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
6009
+ if (this.operator === "") {
6010
+ if (this.value === "") return true;
6011
+ return new Range(comp.value, options).test(this.value);
6012
+ } else if (comp.operator === "") {
6013
+ if (comp.value === "") return true;
6014
+ return new Range(this.value, options).test(comp.semver);
6015
+ }
6016
+ options = parseOptions(options);
6017
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
6018
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
6019
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
6020
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
6021
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
6022
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
6023
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
6024
+ return false;
6025
+ }
6026
+ };
6027
+ const parseOptions = require_parse_options();
6028
+ const { safeRe: re, t } = require_re();
6029
+ const cmp = require_cmp();
6030
+ const debug = require_debug();
6031
+ const SemVer = require_semver$1();
6032
+ const Range = require_range();
6033
+ }));
6034
+ //#endregion
6035
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js
6036
+ var require_satisfies = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6037
+ const Range = require_range();
6038
+ const satisfies = (version, range, options) => {
6039
+ try {
6040
+ range = new Range(range, options);
6041
+ } catch (er) {
6042
+ return false;
6043
+ }
6044
+ return range.test(version);
6045
+ };
6046
+ module.exports = satisfies;
6047
+ }));
6048
+ //#endregion
6049
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js
6050
+ var require_to_comparators = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6051
+ const Range = require_range();
6052
+ const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
6053
+ module.exports = toComparators;
6054
+ }));
6055
+ //#endregion
6056
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js
6057
+ var require_max_satisfying = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6058
+ const SemVer = require_semver$1();
6059
+ const Range = require_range();
6060
+ const maxSatisfying = (versions, range, options) => {
6061
+ let max = null;
6062
+ let maxSV = null;
6063
+ let rangeObj = null;
6064
+ try {
6065
+ rangeObj = new Range(range, options);
6066
+ } catch (er) {
6067
+ return null;
6068
+ }
6069
+ versions.forEach((v) => {
6070
+ if (rangeObj.test(v)) {
6071
+ if (!max || maxSV.compare(v) === -1) {
6072
+ max = v;
6073
+ maxSV = new SemVer(max, options);
6074
+ }
6075
+ }
6076
+ });
6077
+ return max;
6078
+ };
6079
+ module.exports = maxSatisfying;
6080
+ }));
6081
+ //#endregion
6082
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js
6083
+ var require_min_satisfying = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6084
+ const SemVer = require_semver$1();
6085
+ const Range = require_range();
6086
+ const minSatisfying = (versions, range, options) => {
6087
+ let min = null;
6088
+ let minSV = null;
6089
+ let rangeObj = null;
6090
+ try {
6091
+ rangeObj = new Range(range, options);
6092
+ } catch (er) {
6093
+ return null;
6094
+ }
6095
+ versions.forEach((v) => {
6096
+ if (rangeObj.test(v)) {
6097
+ if (!min || minSV.compare(v) === 1) {
6098
+ min = v;
6099
+ minSV = new SemVer(min, options);
6100
+ }
6101
+ }
6102
+ });
6103
+ return min;
6104
+ };
6105
+ module.exports = minSatisfying;
6106
+ }));
6107
+ //#endregion
6108
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js
6109
+ var require_min_version = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6110
+ const SemVer = require_semver$1();
6111
+ const Range = require_range();
6112
+ const gt = require_gt();
6113
+ const minVersion = (range, loose) => {
6114
+ range = new Range(range, loose);
6115
+ let minver = new SemVer("0.0.0");
6116
+ if (range.test(minver)) return minver;
6117
+ minver = new SemVer("0.0.0-0");
6118
+ if (range.test(minver)) return minver;
6119
+ minver = null;
6120
+ for (let i = 0; i < range.set.length; ++i) {
6121
+ const comparators = range.set[i];
6122
+ let setMin = null;
6123
+ comparators.forEach((comparator) => {
6124
+ const compver = new SemVer(comparator.semver.version);
6125
+ switch (comparator.operator) {
6126
+ case ">":
6127
+ if (compver.prerelease.length === 0) compver.patch++;
6128
+ else compver.prerelease.push(0);
6129
+ compver.raw = compver.format();
6130
+ case "":
6131
+ case ">=":
6132
+ if (!setMin || gt(compver, setMin)) setMin = compver;
6133
+ break;
6134
+ case "<":
6135
+ case "<=": break;
6136
+ /* istanbul ignore next */
6137
+ default: throw new Error(`Unexpected operation: ${comparator.operator}`);
6138
+ }
6139
+ });
6140
+ if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
6141
+ }
6142
+ if (minver && range.test(minver)) return minver;
6143
+ return null;
6144
+ };
6145
+ module.exports = minVersion;
6146
+ }));
6147
+ //#endregion
6148
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js
6149
+ var require_valid = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6150
+ const Range = require_range();
6151
+ const validRange = (range, options) => {
6152
+ try {
6153
+ return new Range(range, options).range || "*";
6154
+ } catch (er) {
6155
+ return null;
6156
+ }
6157
+ };
6158
+ module.exports = validRange;
6159
+ }));
6160
+ //#endregion
6161
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js
6162
+ var require_outside = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6163
+ const SemVer = require_semver$1();
6164
+ const Comparator = require_comparator();
6165
+ const { ANY } = Comparator;
6166
+ const Range = require_range();
6167
+ const satisfies = require_satisfies();
6168
+ const gt = require_gt();
6169
+ const lt = require_lt();
6170
+ const lte = require_lte();
6171
+ const gte = require_gte();
6172
+ const outside = (version, range, hilo, options) => {
6173
+ version = new SemVer(version, options);
6174
+ range = new Range(range, options);
6175
+ let gtfn, ltefn, ltfn, comp, ecomp;
6176
+ switch (hilo) {
6177
+ case ">":
6178
+ gtfn = gt;
6179
+ ltefn = lte;
6180
+ ltfn = lt;
6181
+ comp = ">";
6182
+ ecomp = ">=";
6183
+ break;
6184
+ case "<":
6185
+ gtfn = lt;
6186
+ ltefn = gte;
6187
+ ltfn = gt;
6188
+ comp = "<";
6189
+ ecomp = "<=";
6190
+ break;
6191
+ default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
6192
+ }
6193
+ if (satisfies(version, range, options)) return false;
6194
+ for (let i = 0; i < range.set.length; ++i) {
6195
+ const comparators = range.set[i];
6196
+ let high = null;
6197
+ let low = null;
6198
+ comparators.forEach((comparator) => {
6199
+ if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
6200
+ high = high || comparator;
6201
+ low = low || comparator;
6202
+ if (gtfn(comparator.semver, high.semver, options)) high = comparator;
6203
+ else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
6204
+ });
6205
+ if (high.operator === comp || high.operator === ecomp) return false;
6206
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
6207
+ else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
6208
+ }
6209
+ return true;
6210
+ };
6211
+ module.exports = outside;
6212
+ }));
6213
+ //#endregion
6214
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js
6215
+ var require_gtr = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6216
+ const outside = require_outside();
6217
+ const gtr = (version, range, options) => outside(version, range, ">", options);
6218
+ module.exports = gtr;
6219
+ }));
6220
+ //#endregion
6221
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js
6222
+ var require_ltr = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6223
+ const outside = require_outside();
6224
+ const ltr = (version, range, options) => outside(version, range, "<", options);
6225
+ module.exports = ltr;
6226
+ }));
6227
+ //#endregion
6228
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js
6229
+ var require_intersects = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6230
+ const Range = require_range();
6231
+ const intersects = (r1, r2, options) => {
6232
+ r1 = new Range(r1, options);
6233
+ r2 = new Range(r2, options);
6234
+ return r1.intersects(r2, options);
6235
+ };
6236
+ module.exports = intersects;
6237
+ }));
6238
+ //#endregion
6239
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js
6240
+ var require_simplify = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6241
+ const satisfies = require_satisfies();
6242
+ const compare = require_compare();
6243
+ module.exports = (versions, range, options) => {
6244
+ const set = [];
6245
+ let first = null;
6246
+ let prev = null;
6247
+ const v = versions.sort((a, b) => compare(a, b, options));
6248
+ for (const version of v) if (satisfies(version, range, options)) {
6249
+ prev = version;
6250
+ if (!first) first = version;
6251
+ } else {
6252
+ if (prev) set.push([first, prev]);
6253
+ prev = null;
6254
+ first = null;
6255
+ }
6256
+ if (first) set.push([first, null]);
6257
+ const ranges = [];
6258
+ for (const [min, max] of set) if (min === max) ranges.push(min);
6259
+ else if (!max && min === v[0]) ranges.push("*");
6260
+ else if (!max) ranges.push(`>=${min}`);
6261
+ else if (min === v[0]) ranges.push(`<=${max}`);
6262
+ else ranges.push(`${min} - ${max}`);
6263
+ const simplified = ranges.join(" || ");
6264
+ const original = typeof range.raw === "string" ? range.raw : String(range);
6265
+ return simplified.length < original.length ? simplified : range;
6266
+ };
6267
+ }));
6268
+ //#endregion
6269
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js
6270
+ var require_subset = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6271
+ const Range = require_range();
6272
+ const Comparator = require_comparator();
6273
+ const { ANY } = Comparator;
6274
+ const satisfies = require_satisfies();
6275
+ const compare = require_compare();
6276
+ const subset = (sub, dom, options = {}) => {
6277
+ if (sub === dom) return true;
6278
+ sub = new Range(sub, options);
6279
+ dom = new Range(dom, options);
6280
+ let sawNonNull = false;
6281
+ OUTER: for (const simpleSub of sub.set) {
6282
+ for (const simpleDom of dom.set) {
6283
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
6284
+ sawNonNull = sawNonNull || isSub !== null;
6285
+ if (isSub) continue OUTER;
6286
+ }
6287
+ if (sawNonNull) return false;
6288
+ }
6289
+ return true;
6290
+ };
6291
+ const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
6292
+ const minimumVersion = [new Comparator(">=0.0.0")];
6293
+ const simpleSubset = (sub, dom, options) => {
6294
+ if (sub === dom) return true;
6295
+ if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
6296
+ else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
6297
+ else sub = minimumVersion;
6298
+ if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
6299
+ else dom = minimumVersion;
6300
+ const eqSet = /* @__PURE__ */ new Set();
6301
+ let gt, lt;
6302
+ for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
6303
+ else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
6304
+ else eqSet.add(c.semver);
6305
+ if (eqSet.size > 1) return null;
6306
+ let gtltComp;
6307
+ if (gt && lt) {
6308
+ gtltComp = compare(gt.semver, lt.semver, options);
6309
+ if (gtltComp > 0) return null;
6310
+ else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
6311
+ }
6312
+ for (const eq of eqSet) {
6313
+ if (gt && !satisfies(eq, String(gt), options)) return null;
6314
+ if (lt && !satisfies(eq, String(lt), options)) return null;
6315
+ for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
6316
+ return true;
6317
+ }
6318
+ let higher, lower;
6319
+ let hasDomLT, hasDomGT;
6320
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
6321
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
6322
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
6323
+ for (const c of dom) {
6324
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
6325
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
6326
+ if (gt) {
6327
+ if (needDomGTPre) {
6328
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
6329
+ }
6330
+ if (c.operator === ">" || c.operator === ">=") {
6331
+ higher = higherGT(gt, c, options);
6332
+ if (higher === c && higher !== gt) return false;
6333
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) return false;
6334
+ }
6335
+ if (lt) {
6336
+ if (needDomLTPre) {
6337
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
6338
+ }
6339
+ if (c.operator === "<" || c.operator === "<=") {
6340
+ lower = lowerLT(lt, c, options);
6341
+ if (lower === c && lower !== lt) return false;
6342
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) return false;
6343
+ }
6344
+ if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
6345
+ }
6346
+ if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
6347
+ if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
6348
+ if (needDomGTPre || needDomLTPre) return false;
6349
+ return true;
6350
+ };
6351
+ const higherGT = (a, b, options) => {
6352
+ if (!a) return b;
6353
+ const comp = compare(a.semver, b.semver, options);
6354
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
6355
+ };
6356
+ const lowerLT = (a, b, options) => {
6357
+ if (!a) return b;
6358
+ const comp = compare(a.semver, b.semver, options);
6359
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
6360
+ };
6361
+ module.exports = subset;
6362
+ }));
6363
+ //#endregion
6364
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js
6365
+ var require_semver = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6366
+ const internalRe = require_re();
6367
+ const constants = require_constants();
6368
+ const SemVer = require_semver$1();
6369
+ const identifiers = require_identifiers();
6370
+ module.exports = {
6371
+ parse: require_parse(),
6372
+ valid: require_valid$1(),
6373
+ clean: require_clean(),
6374
+ inc: require_inc(),
6375
+ diff: require_diff(),
6376
+ major: require_major(),
6377
+ minor: require_minor(),
6378
+ patch: require_patch(),
6379
+ prerelease: require_prerelease(),
6380
+ compare: require_compare(),
6381
+ rcompare: require_rcompare(),
6382
+ compareLoose: require_compare_loose(),
6383
+ compareBuild: require_compare_build(),
6384
+ sort: require_sort(),
6385
+ rsort: require_rsort(),
6386
+ gt: require_gt(),
6387
+ lt: require_lt(),
6388
+ eq: require_eq(),
6389
+ neq: require_neq(),
6390
+ gte: require_gte(),
6391
+ lte: require_lte(),
6392
+ cmp: require_cmp(),
6393
+ coerce: require_coerce(),
6394
+ Comparator: require_comparator(),
6395
+ Range: require_range(),
6396
+ satisfies: require_satisfies(),
6397
+ toComparators: require_to_comparators(),
6398
+ maxSatisfying: require_max_satisfying(),
6399
+ minSatisfying: require_min_satisfying(),
6400
+ minVersion: require_min_version(),
6401
+ validRange: require_valid(),
6402
+ outside: require_outside(),
6403
+ gtr: require_gtr(),
6404
+ ltr: require_ltr(),
6405
+ intersects: require_intersects(),
6406
+ simplifyRange: require_simplify(),
6407
+ subset: require_subset(),
6408
+ SemVer,
6409
+ re: internalRe.re,
6410
+ src: internalRe.src,
6411
+ tokens: internalRe.t,
6412
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
6413
+ RELEASE_TYPES: constants.RELEASE_TYPES,
6414
+ compareIdentifiers: identifiers.compareIdentifiers,
6415
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
6416
+ };
6417
+ }));
6418
+ //#endregion
6419
+ //#region ../core/dist/index.js
6420
+ var import_picomatch = /* @__PURE__ */ __toESM$1(require_picomatch(), 1);
6421
+ var import_semver = /* @__PURE__ */ __toESM$1(require_semver(), 1);
6422
+ var __create = Object.create;
6423
+ var __defProp = Object.defineProperty;
6424
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6425
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6426
+ var __getProtoOf = Object.getPrototypeOf;
6427
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6428
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
6429
+ var __copyProps = (to, from, except, desc) => {
6430
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
6431
+ key = keys[i];
6432
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
6433
+ get: ((k) => from[k]).bind(null, key),
6434
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
6435
+ });
6436
+ }
6437
+ return to;
6438
+ };
6439
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
6440
+ value: mod,
6441
+ enumerable: true
6442
+ }) : target, mod));
6443
+ var ProjectNotFoundError = class extends Error {
6444
+ name = "ProjectNotFoundError";
6445
+ directory;
6446
+ kind;
6447
+ constructor(directory, options) {
6448
+ const kind = options?.kind ?? "no-project";
6449
+ super(kind === "missing-path" ? `Scan target "${directory}" does not exist. Check the path and try again.` : `No React project found in ${directory}. Expected a package.json at the directory root or a nested package.json with a React dependency.`, options);
6450
+ this.directory = directory;
6451
+ this.kind = kind;
6452
+ }
6453
+ };
6454
+ var NoReactDependencyError = class extends Error {
6455
+ name = "NoReactDependencyError";
6456
+ directory;
6457
+ constructor(directory, options) {
6458
+ super(`No React dependency found in ${directory}/package.json. Add "react" to dependencies (or peerDependencies) and re-run.`, options);
6459
+ this.directory = directory;
6460
+ }
6461
+ };
6462
+ var PackageJsonNotFoundError = class extends Error {
6463
+ name = "PackageJsonNotFoundError";
6464
+ directory;
6465
+ constructor(directory, options) {
6466
+ super(`No package.json found in ${directory}`, options);
6467
+ this.directory = directory;
6468
+ }
6469
+ };
6470
+ var NotADirectoryError = class extends Error {
6471
+ name = "NotADirectoryError";
6472
+ resolvedPath;
6473
+ constructor(resolvedPath, options) {
6474
+ super(`Resolved scan target "${resolvedPath}" is not a directory. Ensure the path exists and points to a project directory, not a file.`, options);
6475
+ this.resolvedPath = resolvedPath;
6476
+ }
6477
+ };
6478
+ var AmbiguousProjectError = class extends Error {
6479
+ name = "AmbiguousProjectError";
6480
+ directory;
6481
+ candidates;
6482
+ constructor(directory, candidates, options) {
6483
+ super(`Multiple React projects found under ${directory} (${candidates.length} candidates): ${candidates.join(", ")}. Re-run diagnose() with one of those subdirectories, or iterate them yourself.`, options);
6484
+ this.directory = directory;
6485
+ this.candidates = candidates;
6486
+ }
6487
+ };
6488
+ const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
6489
+ const isFile = (filePath) => {
6490
+ try {
6491
+ return fs$1.statSync(filePath).isFile();
6492
+ } catch {
6493
+ return false;
6494
+ }
6495
+ };
6496
+ const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
6497
+ const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
6498
+ const MINIFIED_SNIFF_BYTES = 65536;
6499
+ const GIT_LS_FILES_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
6500
+ const IGNORED_DIRECTORIES = new Set([
6501
+ ".git",
6502
+ ".next",
6503
+ ".nuxt",
6504
+ ".output",
6505
+ ".svelte-kit",
6506
+ ".turbo",
6507
+ "build",
6508
+ "coverage",
6509
+ "dist",
6510
+ "node_modules",
6511
+ "out",
6512
+ "storybook-static"
6513
+ ]);
6514
+ const isLintableSourceFile = (filePath) => SOURCE_FILE_PATTERN.test(filePath) && !GENERATED_BUNDLE_FILE_PATTERN.test(filePath);
6515
+ const isMinifiedSource = (absolutePath) => {
6516
+ let fileDescriptor;
6517
+ try {
6518
+ fileDescriptor = fs$1.openSync(absolutePath, "r");
6519
+ const buffer = Buffer.alloc(MINIFIED_SNIFF_BYTES);
6520
+ const bytesRead = fs$1.readSync(fileDescriptor, buffer, 0, MINIFIED_SNIFF_BYTES, 0);
6521
+ const prefix = buffer.toString("utf8", 0, bytesRead);
6522
+ const lines = prefix.split("\n");
6523
+ const longestLineLength = lines.reduce((longest, line) => Math.max(longest, line.length), 0);
6524
+ const averageLineLength = prefix.length / lines.length;
6525
+ return longestLineLength > 1e3 && averageLineLength > 500;
6526
+ } catch {
6527
+ return false;
6528
+ } finally {
6529
+ if (fileDescriptor !== void 0) fs$1.closeSync(fileDescriptor);
6530
+ }
6531
+ };
6532
+ const isLargeMinifiedFile = (absolutePath) => {
6533
+ let sizeBytes;
6534
+ try {
6535
+ sizeBytes = fs$1.statSync(absolutePath).size;
6536
+ } catch {
6537
+ return false;
6538
+ }
6539
+ if (sizeBytes < 2e4) return false;
6540
+ return isMinifiedSource(absolutePath);
6541
+ };
6542
+ const IGNORABLE_READDIR_ERROR_CODES = new Set([
6543
+ "EACCES",
6544
+ "EPERM",
6545
+ "ENOENT",
6546
+ "ENOTDIR",
6547
+ "EINVAL",
6548
+ "ELOOP",
6549
+ "ENAMETOOLONG"
6550
+ ]);
6551
+ const isIgnorableReaddirError = (error) => {
6552
+ if (typeof error !== "object" || error === null) return false;
6553
+ const errorCode = error.code;
6554
+ return typeof errorCode === "string" && IGNORABLE_READDIR_ERROR_CODES.has(errorCode);
6555
+ };
6556
+ const readDirectoryEntries = (directoryPath) => {
6557
+ try {
6558
+ return fs$1.readdirSync(directoryPath, { withFileTypes: true });
6559
+ } catch (error) {
6560
+ if (isIgnorableReaddirError(error)) return [];
6561
+ throw error;
6562
+ }
6563
+ };
6564
+ const countSourceFilesViaFilesystem = (rootDirectory) => {
6565
+ let count = 0;
6566
+ const stack = [rootDirectory];
6567
+ while (stack.length > 0) {
6568
+ const currentDirectory = stack.pop();
6569
+ const entries = readDirectoryEntries(currentDirectory);
6570
+ for (const entry of entries) {
6571
+ if (entry.isDirectory()) {
6572
+ if (!entry.name.startsWith(".") && !IGNORED_DIRECTORIES.has(entry.name)) stack.push(path$1.join(currentDirectory, entry.name));
6573
+ continue;
6574
+ }
6575
+ if (entry.isFile() && isLintableSourceFile(entry.name) && !isLargeMinifiedFile(path$1.join(currentDirectory, entry.name))) count++;
6576
+ }
6577
+ }
6578
+ return count;
6579
+ };
6580
+ const countSourceFilesViaGit = (rootDirectory) => {
6581
+ const result = spawnSync("git", [
6582
+ "ls-files",
6583
+ "-z",
6584
+ "--cached",
6585
+ "--others",
6586
+ "--exclude-standard"
6587
+ ], {
6588
+ cwd: rootDirectory,
6589
+ encoding: "utf-8",
6590
+ maxBuffer: GIT_LS_FILES_MAX_BUFFER_BYTES
6591
+ });
6592
+ if (result.error || result.status !== 0) return null;
6593
+ return result.stdout.split("\0").filter((filePath) => filePath.length > 0 && isLintableSourceFile(filePath) && !isLargeMinifiedFile(path$1.resolve(rootDirectory, filePath))).length;
6594
+ };
6595
+ const countSourceFiles = (rootDirectory) => countSourceFilesViaGit(rootDirectory) ?? countSourceFilesViaFilesystem(rootDirectory);
6596
+ const cachedPackageJsons = /* @__PURE__ */ new Map();
6597
+ const readPackageJsonUncached = (packageJsonPath) => {
6598
+ try {
6599
+ return JSON.parse(fs$1.readFileSync(packageJsonPath, "utf-8"));
6600
+ } catch (error) {
6601
+ if (error instanceof SyntaxError) return {};
6602
+ if (error instanceof Error && "code" in error) {
6603
+ const { code } = error;
6604
+ if (code === "EISDIR" || code === "EACCES" || code === "EPERM" || code === "ENOENT") return {};
6605
+ }
6606
+ throw error;
6607
+ }
6608
+ };
6609
+ const readPackageJson$1 = (packageJsonPath) => {
6610
+ const absolutePath = path$1.resolve(packageJsonPath);
6611
+ const cached = cachedPackageJsons.get(absolutePath);
6612
+ if (cached !== void 0) return cached;
6613
+ const result = readPackageJsonUncached(absolutePath);
6614
+ cachedPackageJsons.set(absolutePath, result);
6615
+ return result;
6616
+ };
6617
+ const isMonorepoRoot = (directory) => {
6618
+ if (isFile(path$1.join(directory, "pnpm-workspace.yaml"))) return true;
6619
+ if (isFile(path$1.join(directory, "nx.json"))) return true;
6620
+ const packageJsonPath = path$1.join(directory, "package.json");
5279
6621
  if (!isFile(packageJsonPath)) return false;
5280
6622
  const packageJson = readPackageJson$1(packageJsonPath);
5281
6623
  return Array.isArray(packageJson.workspaces) || Boolean(packageJson.workspaces?.packages);
@@ -6064,6 +7406,218 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
6064
7406
  if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
6065
7407
  return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
6066
7408
  };
7409
+ const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
7410
+ const MILLISECONDS_PER_SECOND = 1e3;
7411
+ const SCORE_API_URL = "https://www.react.doctor/api/score";
7412
+ const ENTERPRISE_CONTACT_URL = "https://react.doctor/enterprise";
7413
+ const SHARE_BASE_URL = "https://react.doctor/share";
7414
+ const CI_URL = "https://react.doctor/ci";
7415
+ const GITHUB_ACTIONS_SETUP_URL = "https://www.react.doctor/docs/ci-and-prs/github-actions-setup";
7416
+ const DOCS_URL = "https://react.doctor/docs";
7417
+ const DOCS_RULES_BASE_URL = `${DOCS_URL}/rules`;
7418
+ const FETCH_TIMEOUT_MS = 1e4;
7419
+ const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
7420
+ const DEFAULT_BRANCH_CANDIDATES = ["main", "master"];
7421
+ const ADOPTABLE_LINT_CONFIG_FILENAMES = [".oxlintrc.json", ".eslintrc.json"];
7422
+ const OXLINT_NODE_REQUIREMENT = "^20.19.0 || >=22.12.0";
7423
+ const GIT_SHOW_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
7424
+ const ES_TARGET_YEAR_BY_NAME = {
7425
+ es3: 1999,
7426
+ es5: 2009,
7427
+ es6: 2015,
7428
+ es2015: 2015,
7429
+ es2016: 2016,
7430
+ es2017: 2017,
7431
+ es2018: 2018,
7432
+ es2019: 2019,
7433
+ es2020: 2020,
7434
+ es2021: 2021,
7435
+ es2022: 2022,
7436
+ es2023: 2023,
7437
+ es2024: 2024,
7438
+ es2025: 2025,
7439
+ esnext: 9999
7440
+ };
7441
+ /**
7442
+ * Project-config files that `StagedFiles.materialize` copies into
7443
+ * the temp directory alongside staged sources so oxlint resolves
7444
+ * `tsconfig` / `package.json` / lint configs the same way it would
7445
+ * in the working tree. Hoisted out of the staged-files helper so
7446
+ * the constant lives next to the rest of the IO budget knobs.
7447
+ */
7448
+ const STAGED_FILES_PROJECT_CONFIG_FILENAMES = [
7449
+ "tsconfig.json",
7450
+ "tsconfig.base.json",
7451
+ "package.json",
7452
+ "doctor.config.ts",
7453
+ "doctor.config.mts",
7454
+ "doctor.config.cts",
7455
+ "doctor.config.js",
7456
+ "doctor.config.mjs",
7457
+ "doctor.config.cjs",
7458
+ "doctor.config.json",
7459
+ "doctor.config.jsonc",
7460
+ "oxlint.json",
7461
+ ".oxlintrc.json"
7462
+ ];
7463
+ const CONFIG_FINGERPRINT_FILENAMES = [
7464
+ "doctor.config.ts",
7465
+ "doctor.config.mts",
7466
+ "doctor.config.cts",
7467
+ "doctor.config.js",
7468
+ "doctor.config.mjs",
7469
+ "doctor.config.cjs",
7470
+ "doctor.config.json",
7471
+ "doctor.config.jsonc",
7472
+ "react-doctor.config.json",
7473
+ "package.json",
7474
+ "pnpm-workspace.yaml",
7475
+ "tsconfig.json",
7476
+ "tsconfig.base.json",
7477
+ ".oxlintrc.json",
7478
+ ".eslintrc.json",
7479
+ "pnpm-lock.yaml",
7480
+ "package-lock.json",
7481
+ "yarn.lock",
7482
+ "bun.lock",
7483
+ "bun.lockb",
7484
+ ".gitignore"
7485
+ ];
7486
+ const CANONICAL_GITHUB_URL = "https://github.com/millionco/react-doctor";
7487
+ const CANONICAL_DISCORD_URL = "https://react.doctor/discord";
7488
+ const SKILL_NAME = "react-doctor";
7489
+ const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
7490
+ const OXLINT_SPAWN_TIMEOUT_MS = 6e4;
7491
+ const DEAD_CODE_WORKER_MAX_OLD_SPACE_MB = 8192;
7492
+ const RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES = 10080;
7493
+ const REACT_SERVER_DOM_PACKAGES = [
7494
+ "react-server-dom-webpack",
7495
+ "react-server-dom-parcel",
7496
+ "react-server-dom-turbopack"
7497
+ ];
7498
+ const REACT_BLOG_RSC_ADVISORY_URL = "https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components";
7499
+ const VERCEL_NEXTJS_SECURITY_RELEASE_URL = "https://vercel.com/changelog/next-js-may-2026-security-release";
7500
+ const DIAGNOSTIC_CATEGORY_BUCKETS = [
7501
+ "Security",
7502
+ "Bugs",
7503
+ "Performance",
7504
+ "Accessibility",
7505
+ "Maintainability"
7506
+ ];
7507
+ const APP_ONLY_RULE_KEYS = new Set([
7508
+ "react-hooks-js/static-components",
7509
+ "react-doctor/no-render-prop-children",
7510
+ "react-doctor/prefer-explicit-variants"
7511
+ ]);
7512
+ const COMPILER_CLEANUP_BUCKET = "compiler-cleanup";
7513
+ const COMPILER_CLEANUP_RULE_KEYS = new Set(["react-doctor/react-compiler-no-manual-memoization"]);
7514
+ const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
7515
+ const CONFIG_CACHE_TTL_MS = 300 * 1e3;
7516
+ const SOCKET_FREE_PURL_API_BASE = "https://firewall-api.socket.dev/purl";
7517
+ const SOCKET_PACKAGE_PAGE_BASE = "https://socket.dev/npm/package";
7518
+ const SOCKET_FREE_USER_AGENT = "react-doctor-supply-chain";
7519
+ const SUPPLY_CHAIN_PLUGIN = "socket";
7520
+ const SUPPLY_CHAIN_RULE = "low-supply-chain-score";
7521
+ const SUPPLY_CHAIN_CATEGORY = "Security";
7522
+ const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
7523
+ const TSCONFIG_FILENAME = "tsconfig.json";
7524
+ const isRelativeExtendsValue = (extendsValue) => extendsValue.startsWith("./") || extendsValue.startsWith("../") || path$1.isAbsolute(extendsValue);
7525
+ const ensureJsonExtension = (filePath) => path$1.extname(filePath) === "" ? `${filePath}.json` : filePath;
7526
+ const resolvePackageExtendsPath = (extendsValue, fromConfigDirectory) => {
7527
+ const requireFromConfig = createRequire(path$1.join(fromConfigDirectory, "tsconfig.json"));
7528
+ const candidates = [
7529
+ extendsValue,
7530
+ ensureJsonExtension(extendsValue),
7531
+ `${extendsValue.replace(/\/$/, "")}/tsconfig.json`
7532
+ ];
7533
+ for (const candidate of candidates) try {
7534
+ return requireFromConfig.resolve(candidate);
7535
+ } catch {
7536
+ continue;
7537
+ }
7538
+ return null;
7539
+ };
7540
+ const resolveExtendsPath = (extendsValue, fromConfigDirectory) => {
7541
+ if (isRelativeExtendsValue(extendsValue)) return ensureJsonExtension(path$1.resolve(fromConfigDirectory, extendsValue));
7542
+ return resolvePackageExtendsPath(extendsValue, fromConfigDirectory);
7543
+ };
7544
+ const normalizeCompilerOptions = (compilerOptions) => {
7545
+ if (!isPlainObject(compilerOptions)) return { hasExplicitLib: false };
7546
+ const target = typeof compilerOptions.target === "string" ? compilerOptions.target : void 0;
7547
+ const hasExplicitLib = Object.hasOwn(compilerOptions, "lib");
7548
+ return {
7549
+ target,
7550
+ lib: Array.isArray(compilerOptions.lib) ? compilerOptions.lib.filter((entry) => typeof entry === "string") : void 0,
7551
+ hasExplicitLib
7552
+ };
7553
+ };
7554
+ const readTsConfig = (filePath) => {
7555
+ let content;
7556
+ try {
7557
+ content = fs$1.readFileSync(filePath, "utf-8");
7558
+ } catch {
7559
+ return null;
7560
+ }
7561
+ const parsed = ts.parseConfigFileTextToJson(filePath, content);
7562
+ if (!isPlainObject(parsed.config)) return null;
7563
+ return {
7564
+ extends: typeof parsed.config.extends === "string" ? parsed.config.extends : void 0,
7565
+ compilerOptions: normalizeCompilerOptions(parsed.config.compilerOptions)
7566
+ };
7567
+ };
7568
+ const mergeCompilerOptions = (inherited, current) => {
7569
+ const target = current.target ?? inherited?.target;
7570
+ const hasExplicitLib = current.hasExplicitLib || Boolean(inherited?.hasExplicitLib);
7571
+ return {
7572
+ target,
7573
+ lib: current.hasExplicitLib ? current.lib : inherited?.lib,
7574
+ hasExplicitLib
7575
+ };
7576
+ };
7577
+ const readResolvedCompilerOptions = (tsConfigPath, extendsDepth, visitedPaths) => {
7578
+ const realPath = fs$1.realpathSync.native(tsConfigPath);
7579
+ if (visitedPaths.has(realPath)) return null;
7580
+ const tsConfig = readTsConfig(realPath);
7581
+ if (!tsConfig) return null;
7582
+ const nextVisitedPaths = new Set(visitedPaths);
7583
+ nextVisitedPaths.add(realPath);
7584
+ if (tsConfig.extends && extendsDepth < 8) {
7585
+ const parentPath = resolveExtendsPath(tsConfig.extends, path$1.dirname(realPath));
7586
+ if (parentPath && isFile(parentPath)) return mergeCompilerOptions(readResolvedCompilerOptions(parentPath, extendsDepth + 1, nextVisitedPaths), tsConfig.compilerOptions);
7587
+ }
7588
+ return tsConfig.compilerOptions;
7589
+ };
7590
+ const targetYearIsPreES2023 = (target) => {
7591
+ const year = ES_TARGET_YEAR_BY_NAME[target.toLowerCase()];
7592
+ return year !== void 0 && year < 2023;
7593
+ };
7594
+ const libEntryIncludesES2023Array = (entry) => {
7595
+ const normalizedEntry = entry.toLowerCase();
7596
+ if (normalizedEntry === "esnext" || normalizedEntry === "esnext.array") return true;
7597
+ const esYearMatch = /^es(\d{4})(?:\.(.+))?$/.exec(normalizedEntry);
7598
+ if (!esYearMatch) return false;
7599
+ if (Number(esYearMatch[1]) < 2023) return false;
7600
+ const component = esYearMatch[2];
7601
+ return component === void 0 || component === "array";
7602
+ };
7603
+ const libIncludesES2023 = (lib) => lib.some(libEntryIncludesES2023Array);
7604
+ const compilerOptionsArePreES2023 = (compilerOptions) => {
7605
+ if (compilerOptions.hasExplicitLib) return !libIncludesES2023(compilerOptions.lib ?? []);
7606
+ if (compilerOptions.target) return targetYearIsPreES2023(compilerOptions.target);
7607
+ return false;
7608
+ };
7609
+ const compilerOptionsDeclareTargetOrLib = (compilerOptions) => compilerOptions.hasExplicitLib || compilerOptions.target !== void 0;
7610
+ const detectPreES2023FromConfig = (tsConfigPath) => {
7611
+ const compilerOptions = readResolvedCompilerOptions(tsConfigPath, 0, /* @__PURE__ */ new Set());
7612
+ if (!compilerOptions) return false;
7613
+ if (!compilerOptionsDeclareTargetOrLib(compilerOptions)) return false;
7614
+ return compilerOptionsArePreES2023(compilerOptions);
7615
+ };
7616
+ const detectPreES2023Target = (directory) => {
7617
+ const tsConfigPath = path$1.join(directory, TSCONFIG_FILENAME);
7618
+ if (isFile(tsConfigPath)) return detectPreES2023FromConfig(tsConfigPath);
7619
+ return false;
7620
+ };
6067
7621
  const REACT_DEPENDENCY_NAMES = new Set([
6068
7622
  "react",
6069
7623
  "react-native",
@@ -6175,11 +7729,63 @@ const discoverReactSubprojects = (rootDirectory) => {
6175
7729
  return discoverReactSubprojectsByFilesystem(rootDirectory);
6176
7730
  };
6177
7731
  const cachedProjectInfos = /* @__PURE__ */ new Map();
7732
+ /**
7733
+ * Build a `ProjectInfo` for a directory that has no `package.json` of
7734
+ * its own — a monorepo subfolder like `repo/packages`, or any loose tree
7735
+ * of TypeScript/JavaScript files. Dependency + framework detection is
7736
+ * inherited from the enclosing workspace root when there is one, so
7737
+ * scanning a subdirectory of a React monorepo still gets the React
7738
+ * capabilities; a standalone non-React directory simply scans with the
7739
+ * framework-agnostic rules. Throws only when the directory has nothing
7740
+ * to scan (no enclosing project and no source files of its own).
7741
+ */
7742
+ const discoverProjectWithoutPackageJson = (directory) => {
7743
+ const sourceFileCount = countSourceFiles(directory);
7744
+ const hasOwnTsConfig = fs$1.existsSync(path$1.join(directory, "tsconfig.json"));
7745
+ const monorepoRoot = findMonorepoRoot(directory);
7746
+ const enclosingProject = monorepoRoot !== null && isFile(path$1.join(monorepoRoot, "package.json")) ? discoverProject(monorepoRoot) : null;
7747
+ if (enclosingProject !== null) return {
7748
+ ...enclosingProject,
7749
+ rootDirectory: directory,
7750
+ projectName: path$1.basename(directory),
7751
+ hasTypeScript: hasOwnTsConfig || enclosingProject.hasTypeScript,
7752
+ sourceFileCount
7753
+ };
7754
+ if (sourceFileCount === 0) throw new PackageJsonNotFoundError(directory);
7755
+ return {
7756
+ rootDirectory: directory,
7757
+ projectName: path$1.basename(directory),
7758
+ reactVersion: null,
7759
+ reactMajorVersion: null,
7760
+ tailwindVersion: null,
7761
+ zodVersion: null,
7762
+ zodMajorVersion: null,
7763
+ framework: "unknown",
7764
+ hasTypeScript: hasOwnTsConfig,
7765
+ hasReactCompiler: false,
7766
+ hasTanStackQuery: false,
7767
+ preactVersion: null,
7768
+ preactMajorVersion: null,
7769
+ hasReactNativeWorkspace: false,
7770
+ nextjsVersion: null,
7771
+ nextjsMajorVersion: null,
7772
+ expoVersion: null,
7773
+ shopifyFlashListVersion: null,
7774
+ shopifyFlashListMajorVersion: null,
7775
+ hasReanimated: false,
7776
+ isPreES2023Target: hasOwnTsConfig && detectPreES2023Target(directory),
7777
+ sourceFileCount
7778
+ };
7779
+ };
6178
7780
  const discoverProject = (directory) => {
6179
7781
  const cached = cachedProjectInfos.get(directory);
6180
7782
  if (cached !== void 0) return cached;
6181
7783
  const packageJsonPath = path$1.join(directory, "package.json");
6182
- if (!isFile(packageJsonPath)) throw new PackageJsonNotFoundError(directory);
7784
+ if (!isFile(packageJsonPath)) {
7785
+ const synthesized = discoverProjectWithoutPackageJson(directory);
7786
+ cachedProjectInfos.set(directory, synthesized);
7787
+ return synthesized;
7788
+ }
6183
7789
  const packageJson = readPackageJson$1(packageJsonPath);
6184
7790
  let { reactVersion, tailwindVersion, zodVersion, framework } = extractDependencyInfo(packageJson);
6185
7791
  const reactDeclaration = getDependencyDeclaration({
@@ -6265,6 +7871,7 @@ const discoverProject = (directory) => {
6265
7871
  version: findNextjsVersion(directory, packageJson)
6266
7872
  }) : null;
6267
7873
  const preactVersion = getPreactVersion(packageJson);
7874
+ const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
6268
7875
  const projectInfo = {
6269
7876
  rootDirectory: directory,
6270
7877
  projectName,
@@ -6286,12 +7893,22 @@ const discoverProject = (directory) => {
6286
7893
  shopifyFlashListVersion,
6287
7894
  shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
6288
7895
  hasReanimated,
7896
+ isPreES2023Target,
6289
7897
  sourceFileCount
6290
7898
  };
6291
7899
  cachedProjectInfos.set(directory, projectInfo);
6292
7900
  return projectInfo;
6293
7901
  };
6294
- const isAnalyzableProject = (project) => project.reactVersion !== null || project.preactVersion !== null;
7902
+ /**
7903
+ * A project is worth scanning when it has React/Preact (the framework-
7904
+ * specific rules apply) OR it simply has source files to lint. The
7905
+ * second arm is what lets a plain TypeScript/JavaScript codebase — no
7906
+ * React dependency at all — run the framework-agnostic rules
7907
+ * (security, architecture, zod, bundle-size, …) instead of hard-failing
7908
+ * with "No React dependency". Only a directory with neither React nor a
7909
+ * single source file has nothing to analyze.
7910
+ */
7911
+ const isAnalyzableProject = (project) => project.reactVersion !== null || project.preactVersion !== null || project.sourceFileCount > 0;
6295
7912
  const MAJOR_MINOR_PATTERN = /(\d{1,4})\.(\d{1,4})/;
6296
7913
  const MAJOR_ONLY_PATTERN = /(\d{1,4})/;
6297
7914
  const UPPER_BOUND_COMPARATOR_PATTERN = /<=?\s{0,8}\d{1,4}(?:\.\d{1,4}){0,2}(?:-[^\s,|]+)?/g;
@@ -6355,66 +7972,6 @@ const isTailwindAtLeast = (detected, required) => {
6355
7972
  if (detected.major !== required.major) return detected.major > required.major;
6356
7973
  return detected.minor >= required.minor;
6357
7974
  };
6358
- const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
6359
- const MILLISECONDS_PER_SECOND = 1e3;
6360
- const SCORE_API_URL = "https://www.react.doctor/api/score";
6361
- const ENTERPRISE_CONTACT_URL = "https://react.doctor/enterprise";
6362
- const SHARE_BASE_URL = "https://react.doctor/share";
6363
- const CI_URL = "https://react.doctor/ci";
6364
- const GITHUB_ACTIONS_SETUP_URL = "https://www.react.doctor/docs/ci-and-prs/github-actions-setup";
6365
- const DOCS_URL = "https://react.doctor/docs";
6366
- const DOCS_RULES_BASE_URL = `${DOCS_URL}/rules`;
6367
- const FETCH_TIMEOUT_MS = 1e4;
6368
- const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
6369
- const DEFAULT_BRANCH_CANDIDATES = ["main", "master"];
6370
- const ADOPTABLE_LINT_CONFIG_FILENAMES = [".oxlintrc.json", ".eslintrc.json"];
6371
- const OXLINT_NODE_REQUIREMENT = "^20.19.0 || >=22.12.0";
6372
- const GIT_SHOW_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
6373
- /**
6374
- * Project-config files that `StagedFiles.materialize` copies into
6375
- * the temp directory alongside staged sources so oxlint resolves
6376
- * `tsconfig` / `package.json` / lint configs the same way it would
6377
- * in the working tree. Hoisted out of the staged-files helper so
6378
- * the constant lives next to the rest of the IO budget knobs.
6379
- */
6380
- const STAGED_FILES_PROJECT_CONFIG_FILENAMES = [
6381
- "tsconfig.json",
6382
- "tsconfig.base.json",
6383
- "package.json",
6384
- "doctor.config.ts",
6385
- "doctor.config.mts",
6386
- "doctor.config.cts",
6387
- "doctor.config.js",
6388
- "doctor.config.mjs",
6389
- "doctor.config.cjs",
6390
- "doctor.config.json",
6391
- "doctor.config.jsonc",
6392
- "oxlint.json",
6393
- ".oxlintrc.json"
6394
- ];
6395
- const CANONICAL_GITHUB_URL = "https://github.com/millionco/react-doctor";
6396
- const CANONICAL_DISCORD_URL = "https://react.doctor/discord";
6397
- const SKILL_NAME = "react-doctor";
6398
- const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
6399
- const OXLINT_SPAWN_TIMEOUT_MS = 6e4;
6400
- const DEAD_CODE_WORKER_MAX_OLD_SPACE_MB = 8192;
6401
- const RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES = 10080;
6402
- const DIAGNOSTIC_CATEGORY_BUCKETS = [
6403
- "Security",
6404
- "Bugs",
6405
- "Performance",
6406
- "Accessibility",
6407
- "Maintainability"
6408
- ];
6409
- const APP_ONLY_RULE_KEYS = new Set([
6410
- "react-hooks-js/static-components",
6411
- "react-doctor/no-render-prop-children",
6412
- "react-doctor/prefer-explicit-variants"
6413
- ]);
6414
- const COMPILER_CLEANUP_BUCKET = "compiler-cleanup";
6415
- const COMPILER_CLEANUP_RULE_KEYS = new Set(["react-doctor/react-compiler-no-manual-memoization"]);
6416
- const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
6417
- const CONFIG_CACHE_TTL_MS = 300 * 1e3;
6418
7975
  var InvalidGlobPatternError = class extends Error {
6419
7976
  pattern;
6420
7977
  reason;
@@ -7920,51 +9477,51 @@ const FLAGGED_DEPENDENCIES = [
7920
9477
  {
7921
9478
  packageName: "expo-modules-autolinking",
7922
9479
  rule: "expo-no-redundant-dependency",
7923
- message: "\"expo-modules-autolinking\" should not be a direct dependency — Expo installs it transitively as needed",
9480
+ message: "\"expo-modules-autolinking\" should not be a direct dependency. Expo pins the compatible version through the SDK, and a direct entry can drift to a version that breaks prebuild, Metro, or native builds",
7924
9481
  help: "Remove `expo-modules-autolinking` from your package.json"
7925
9482
  },
7926
9483
  {
7927
9484
  packageName: "expo-dev-launcher",
7928
9485
  rule: "expo-no-redundant-dependency",
7929
- message: "\"expo-dev-launcher\" should not be a direct dependency — it is pulled in by `expo-dev-client`",
9486
+ message: "\"expo-dev-launcher\" should not be a direct dependency. `expo-dev-client` pins the compatible launcher, and a direct entry can drift to a version that breaks native builds",
7930
9487
  help: "Remove `expo-dev-launcher` and depend on `expo-dev-client` instead"
7931
9488
  },
7932
9489
  {
7933
9490
  packageName: "expo-dev-menu",
7934
9491
  rule: "expo-no-redundant-dependency",
7935
- message: "\"expo-dev-menu\" should not be a direct dependency — it is pulled in by `expo-dev-client`",
9492
+ message: "\"expo-dev-menu\" should not be a direct dependency. `expo-dev-client` pins the compatible dev menu, and a direct entry can drift to a version that breaks native builds",
7936
9493
  help: "Remove `expo-dev-menu` and depend on `expo-dev-client` instead"
7937
9494
  },
7938
9495
  {
7939
9496
  packageName: "expo-modules-core",
7940
9497
  rule: "expo-no-redundant-dependency",
7941
- message: "\"expo-modules-core\" should not be a direct dependency — use the API re-exported from the `expo` package",
9498
+ message: "\"expo-modules-core\" should not be a direct dependency. Expo pins the compatible native core, and a direct entry can drift to a version that breaks prebuild or native builds",
7942
9499
  help: "Remove `expo-modules-core` from your package.json and import from `expo` instead"
7943
9500
  },
7944
9501
  {
7945
9502
  packageName: "@expo/metro-config",
7946
9503
  rule: "expo-no-redundant-dependency",
7947
- message: "\"@expo/metro-config\" should not be a direct dependency — use the `expo/metro-config` sub-export of the `expo` package",
9504
+ message: "\"@expo/metro-config\" should not be a direct dependency. Expo pins the compatible Metro config, and a direct entry can drift to a version that breaks bundling",
7948
9505
  help: "Remove `@expo/metro-config` and import `expo/metro-config` in your metro.config.js"
7949
9506
  },
7950
9507
  {
7951
9508
  packageName: "@types/react-native",
7952
9509
  rule: "expo-no-redundant-dependency",
7953
- message: "\"@types/react-native\" should not be installed — React Native ships its own types since SDK 48",
9510
+ message: "\"@types/react-native\" should not be installed. React Native ships its own types since SDK 48, so the extra package can introduce duplicate or stale type definitions",
7954
9511
  help: "Remove `@types/react-native` from your package.json",
7955
9512
  minSdkMajor: 48
7956
9513
  },
7957
9514
  {
7958
9515
  packageName: "@expo/config-plugins",
7959
9516
  rule: "expo-no-redundant-dependency",
7960
- message: "\"@expo/config-plugins\" should not be a direct dependency — use the `expo/config-plugins` sub-export of the `expo` package",
9517
+ message: "\"@expo/config-plugins\" should not be a direct dependency. Expo pins the compatible config-plugin API, and a direct entry can drift to a version that breaks prebuild",
7961
9518
  help: "Remove `@expo/config-plugins`; config-plugin authors should import from `expo/config-plugins`. See https://github.com/expo/expo/pull/18855",
7962
9519
  minSdkMajor: 48
7963
9520
  },
7964
9521
  {
7965
9522
  packageName: "@expo/prebuild-config",
7966
9523
  rule: "expo-no-redundant-dependency",
7967
- message: "\"@expo/prebuild-config\" should not be a direct dependency — Expo installs it transitively",
9524
+ message: "\"@expo/prebuild-config\" should not be a direct dependency. Expo pins the compatible prebuild config, and a direct entry can drift to a version that breaks prebuild",
7968
9525
  help: "Remove `@expo/prebuild-config` from your package.json",
7969
9526
  minSdkMajor: 53
7970
9527
  },
@@ -7978,28 +9535,28 @@ const FLAGGED_DEPENDENCIES = [
7978
9535
  {
7979
9536
  packageName: "expo-app-loading",
7980
9537
  rule: "expo-no-redundant-dependency",
7981
- message: "\"expo-app-loading\" was removed in SDK 49",
9538
+ message: "\"expo-app-loading\" was removed in SDK 49, so keeping it can leave imports unresolved after upgrading Expo",
7982
9539
  help: "Remove `expo-app-loading` and use `expo-splash-screen` instead. See https://docs.expo.dev/versions/latest/sdk/splash-screen/",
7983
9540
  minSdkMajor: 49
7984
9541
  },
7985
9542
  {
7986
9543
  packageName: "expo-firebase-analytics",
7987
9544
  rule: "expo-no-redundant-dependency",
7988
- message: "\"expo-firebase-analytics\" was removed in SDK 48",
9545
+ message: "\"expo-firebase-analytics\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
7989
9546
  help: FIREBASE_HELP,
7990
9547
  minSdkMajor: 48
7991
9548
  },
7992
9549
  {
7993
9550
  packageName: "expo-firebase-recaptcha",
7994
9551
  rule: "expo-no-redundant-dependency",
7995
- message: "\"expo-firebase-recaptcha\" was removed in SDK 48",
9552
+ message: "\"expo-firebase-recaptcha\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
7996
9553
  help: FIREBASE_HELP,
7997
9554
  minSdkMajor: 48
7998
9555
  },
7999
9556
  {
8000
9557
  packageName: "expo-firebase-core",
8001
9558
  rule: "expo-no-redundant-dependency",
8002
- message: "\"expo-firebase-core\" was removed in SDK 48",
9559
+ message: "\"expo-firebase-core\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
8003
9560
  help: FIREBASE_HELP,
8004
9561
  minSdkMajor: 48
8005
9562
  }
@@ -8040,7 +9597,7 @@ const checkExpoGitignore = (context) => {
8040
9597
  }));
8041
9598
  if (findLocalModuleNativeFiles(rootDirectory).find((nativeFilePath) => isPathGitIgnored(rootDirectory, nativeFilePath) === true) !== void 0) diagnostics.push(buildExpoDiagnostic({
8042
9599
  rule: "expo-gitignore",
8043
- message: "The native `ios`/`android` directories of a local Expo module under `modules/` are gitignored — usually caused by an overly broad `ios`/`android` ignore rule",
9600
+ message: "The native `ios`/`android` directories of a local Expo module under `modules/` are gitignored, so required native code can be missing from CI or teammate checkouts.",
8044
9601
  help: "Use anchored patterns like `/ios` and `/android` in .gitignore so only the top-level native directories are excluded, not those inside `modules/`"
8045
9602
  }));
8046
9603
  return diagnostics;
@@ -8102,17 +9659,16 @@ const checkExpoPackageJsonConflicts = (context) => {
8102
9659
  const conflictingScriptNames = CONFLICTING_SCRIPT_NAMES.filter((scriptName) => Boolean(packageJson.scripts?.[scriptName]));
8103
9660
  if (conflictingScriptNames.length > 0) {
8104
9661
  const quotedNames = conflictingScriptNames.map((name) => `"${name}"`).join(", ");
8105
- const shadowsExpoCli = conflictingScriptNames.includes("expo");
8106
9662
  diagnostics.push(buildExpoDiagnostic({
8107
9663
  rule: "expo-package-json-conflict",
8108
- message: `package.json defines ${quotedNames} ${conflictingScriptNames.length === 1 ? "as a script that conflicts" : "as scripts that conflict"} with binaries in node_modules/.bin${shadowsExpoCli ? " — a `expo` script shadows the Expo CLI and will likely cause build failures" : ""}`,
9664
+ message: `package.json defines ${quotedNames} ${conflictingScriptNames.length === 1 ? "as a script that shadows" : "as scripts that shadow"} Expo/React Native binaries in node_modules/.bin, so tooling can run the local script instead of the expected CLI and fail builds.`,
8109
9665
  help: "Rename these scripts so they don't collide with the `expo` / `react-native` binaries"
8110
9666
  }));
8111
9667
  }
8112
9668
  const packageName = packageJson.name;
8113
9669
  if (typeof packageName === "string" && context.directDependencyNames.has(packageName)) diagnostics.push(buildExpoDiagnostic({
8114
9670
  rule: "expo-package-json-conflict",
8115
- message: `package.json "name" is "${packageName}", which collides with a dependency of the same name`,
9671
+ message: `package.json "name" is "${packageName}", which collides with a dependency of the same name, so package self-resolution can shadow the dependency and break imports that expect the installed package.`,
8116
9672
  help: "Rename your package so it no longer matches one of its dependencies"
8117
9673
  }));
8118
9674
  return diagnostics;
@@ -8183,7 +9739,7 @@ const checkExpoRouterReactNavigation = (context) => {
8183
9739
  if (reactNavigationNames.length === 0) return [];
8184
9740
  return [buildExpoDiagnostic({
8185
9741
  rule: "expo-router-no-react-navigation",
8186
- message: `As of SDK 56, expo-router is no longer compatible with react-navigation, but ${reactNavigationNames.map((name) => `"${name}"`).join(", ")} ${reactNavigationNames.length === 1 ? "is" : "are"} installed as direct ${reactNavigationNames.length === 1 ? "dependency" : "dependencies"}`,
9742
+ message: `As of SDK 56, expo-router is no longer compatible with directly installed @react-navigation packages, so keeping ${reactNavigationNames.map((name) => `"${name}"`).join(", ")} can break routing or linking behavior after the SDK upgrade.`,
8187
9743
  help: "Remove these `@react-navigation/*` packages and replace direct imports with their expo-router equivalents. See https://docs.expo.dev/router/migrate/sdk-55-to-56/"
8188
9744
  })];
8189
9745
  };
@@ -8406,6 +9962,168 @@ const checkReactNativeProject = (rootDirectory, project) => {
8406
9962
  if (!isReactNativeProject(project)) return [];
8407
9963
  return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
8408
9964
  };
9965
+ const RULE_KEY = "no-vulnerable-react-server-components";
9966
+ const DEPENDENCY_SECTIONS = [
9967
+ "dependencies",
9968
+ "devDependencies",
9969
+ "peerDependencies",
9970
+ "optionalDependencies"
9971
+ ];
9972
+ const REACT_RSC_ADVISORIES_BY_MINOR = {
9973
+ "19.0": {
9974
+ rceFixedVersion: "19.0.1",
9975
+ latestSafeVersion: "19.0.6"
9976
+ },
9977
+ "19.1": {
9978
+ rceFixedVersion: "19.1.2",
9979
+ latestSafeVersion: "19.1.7"
9980
+ },
9981
+ "19.2": {
9982
+ rceFixedVersion: "19.2.1",
9983
+ latestSafeVersion: "19.2.6"
9984
+ }
9985
+ };
9986
+ const NEXTJS_OLDEST_AFFECTED_MAJOR = 13;
9987
+ const NEXTJS_RCE_FIXED_BY_MINOR = {
9988
+ "15.0": "15.0.5",
9989
+ "15.1": "15.1.9",
9990
+ "15.2": "15.2.6",
9991
+ "15.3": "15.3.6",
9992
+ "15.4": "15.4.8",
9993
+ "15.5": "15.5.7",
9994
+ "16.0": "16.0.7"
9995
+ };
9996
+ const NEXTJS_LATEST_SAFE_BY_MAJOR = {
9997
+ 15: "15.5.18",
9998
+ 16: "16.2.6"
9999
+ };
10000
+ const NEXTJS_SUPPORTED_UPGRADE_TARGETS = "15.5.18 or 16.2.6";
10001
+ const buildAdvisoryDiagnostic = (input) => ({
10002
+ filePath: "package.json",
10003
+ plugin: "react-doctor",
10004
+ rule: RULE_KEY,
10005
+ severity: input.severity,
10006
+ message: input.message,
10007
+ help: input.help,
10008
+ line: 0,
10009
+ column: 0,
10010
+ category: "Security"
10011
+ });
10012
+ const enumerateWorkspaceDirectories = (workspaceRoot) => {
10013
+ const patterns = getWorkspacePatterns(workspaceRoot, readPackageJson$1(path$1.join(workspaceRoot, "package.json")));
10014
+ const directories = /* @__PURE__ */ new Set();
10015
+ for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
10016
+ return [...directories];
10017
+ };
10018
+ const readDeclaredSpec = (packageJson, packageName) => {
10019
+ for (const section of DEPENDENCY_SECTIONS) {
10020
+ const spec = packageJson[section]?.[packageName];
10021
+ if (typeof spec === "string") return spec;
10022
+ }
10023
+ return null;
10024
+ };
10025
+ const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
10026
+ const manifestPath = path$1.join(directory, "node_modules", packageName, "package.json");
10027
+ if (isFile(manifestPath)) {
10028
+ const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
10029
+ if (installedVersion !== null) return installedVersion;
10030
+ }
10031
+ const candidateSpecs = [readDeclaredSpec(readPackageJson$1(path$1.join(directory, "package.json")), packageName), declaredSpecOverride];
10032
+ for (const spec of candidateSpecs) {
10033
+ const pinnedVersion = spec === null ? null : import_semver.valid(spec);
10034
+ if (pinnedVersion !== null) return pinnedVersion;
10035
+ }
10036
+ return null;
10037
+ };
10038
+ const checkReactServerDomAdvisory = (packageName, version) => {
10039
+ const advisory = REACT_RSC_ADVISORIES_BY_MINOR[`${import_semver.major(version)}.${import_semver.minor(version)}`];
10040
+ if (advisory === void 0) return [];
10041
+ const installedDisplay = `${packageName}@${version}`;
10042
+ const lineDisplay = `${import_semver.major(version)}.${import_semver.minor(version)}`;
10043
+ if (import_semver.lt(version, advisory.rceFixedVersion)) return [buildAdvisoryDiagnostic({
10044
+ severity: "error",
10045
+ message: `${installedDisplay} has the critical React Server Components remote code execution vulnerability (CVE-2025-55182, CVSS 10.0) — an unauthenticated attacker can run arbitrary code on your server by sending a crafted payload to any Server Function endpoint`,
10046
+ help: `Upgrade React's Server Components runtime to ${advisory.latestSafeVersion} — a patch-level bump within ${lineDisplay} with no breaking changes. Run \`npm install ${packageName}@${advisory.latestSafeVersion}\` and pin \`react\`/\`react-dom\` to ${advisory.latestSafeVersion} too. See ${REACT_BLOG_RSC_ADVISORY_URL}`
10047
+ })];
10048
+ if (import_semver.lt(version, advisory.latestSafeVersion)) return [buildAdvisoryDiagnostic({
10049
+ severity: "warning",
10050
+ message: `${installedDisplay} is affected by a high-severity React Server Components denial-of-service vulnerability (CVE-2026-23870) patched in ${advisory.latestSafeVersion}`,
10051
+ help: `Upgrade to ${advisory.latestSafeVersion} — a patch-level bump within ${lineDisplay}. Run \`npm install ${packageName}@${advisory.latestSafeVersion}\` and align \`react\`/\`react-dom\`. See ${VERCEL_NEXTJS_SECURITY_RELEASE_URL}`
10052
+ })];
10053
+ return [];
10054
+ };
10055
+ const checkNextjsAdvisory = (version) => {
10056
+ const major = import_semver.major(version);
10057
+ if (major < NEXTJS_OLDEST_AFFECTED_MAJOR) return [];
10058
+ const installedDisplay = `next@${version}`;
10059
+ const latestSafeVersion = NEXTJS_LATEST_SAFE_BY_MAJOR[major];
10060
+ if (latestSafeVersion === void 0) {
10061
+ if (major >= 15) return [];
10062
+ return [buildAdvisoryDiagnostic({
10063
+ severity: "warning",
10064
+ message: `${installedDisplay} is on an unsupported Next.js release line affected by the React Server Components security advisories — there is no patched ${major}.x release`,
10065
+ help: `Upgrade to a patched Next.js release (${NEXTJS_SUPPORTED_UPGRADE_TARGETS}). Next.js bundles its own React Server Components runtime, so upgrading Next.js is what ships the fix. See ${VERCEL_NEXTJS_SECURITY_RELEASE_URL}`
10066
+ })];
10067
+ }
10068
+ const rceFixedVersion = NEXTJS_RCE_FIXED_BY_MINOR[`${major}.${import_semver.minor(version)}`];
10069
+ if (rceFixedVersion !== void 0 && import_semver.lt(version, rceFixedVersion)) return [buildAdvisoryDiagnostic({
10070
+ severity: "error",
10071
+ message: `${installedDisplay} bundles the React Server Components runtime affected by the critical remote code execution vulnerability (CVE-2025-55182, CVSS 10.0) — an unauthenticated attacker can run arbitrary code on your server by sending a crafted payload to any Server Function or Server Action endpoint`,
10072
+ help: `Upgrade Next.js to ${latestSafeVersion} (or newer). Next.js bundles its own React Server Components runtime, so bumping Next.js — not \`react\` — ships the fix. Run \`npm install next@${latestSafeVersion}\`. See ${VERCEL_NEXTJS_SECURITY_RELEASE_URL}`
10073
+ })];
10074
+ if (import_semver.lt(version, latestSafeVersion)) return [buildAdvisoryDiagnostic({
10075
+ severity: "warning",
10076
+ message: `${installedDisplay} bundles a React Server Components runtime affected by a high-severity denial-of-service vulnerability (CVE-2026-23870) patched in Next.js ${latestSafeVersion}`,
10077
+ help: `Upgrade Next.js to ${latestSafeVersion} (or newer). Next.js bundles its own React Server Components runtime, so bumping Next.js ships the fix. Run \`npm install next@${latestSafeVersion}\`. See ${VERCEL_NEXTJS_SECURITY_RELEASE_URL}`
10078
+ })];
10079
+ return [];
10080
+ };
10081
+ /**
10082
+ * Flags a project running React Server Components on a version with a known
10083
+ * security advisory — primarily the critical unauthenticated RCE
10084
+ * (CVE-2025-55182), plus the later high-severity DoS (CVE-2026-23870).
10085
+ *
10086
+ * Every candidate directory — the scan root and each workspace package — is
10087
+ * probed independently, so heterogeneous monorepo installs are all seen (a
10088
+ * vulnerable `next` in one workspace isn't masked by an inert one elsewhere).
10089
+ * Next.js vendors its own RSC runtime, so an affected `next` install in a
10090
+ * directory is reported by its `next` version (the fix is a Next.js bump) and
10091
+ * suppresses the standalone `react-server-dom-*` check for that directory only;
10092
+ * every other framework or bundler — Vite, Parcel, React Router, Waku,
10093
+ * RedwoodSDK — is reported by its `react-server-dom-*` version. Dispatch keys
10094
+ * on resolved installs rather than the root framework classification, so a
10095
+ * monorepo whose root is Vite but whose workspace runs Next.js is still
10096
+ * covered. Pure client-side React apps (no RSC packages, no Next.js) are not
10097
+ * affected and stay quiet.
10098
+ */
10099
+ const checkReactServerComponentsAdvisory = (scanDirectory, project) => {
10100
+ const workspaceRoot = findMonorepoRoot(scanDirectory) ?? project.rootDirectory;
10101
+ const candidateDirectories = [...new Set([
10102
+ scanDirectory,
10103
+ project.rootDirectory,
10104
+ workspaceRoot,
10105
+ ...enumerateWorkspaceDirectories(workspaceRoot)
10106
+ ])];
10107
+ const diagnostics = [];
10108
+ const seenMessages = /* @__PURE__ */ new Set();
10109
+ const pushUnique = (candidates) => {
10110
+ for (const candidate of candidates) {
10111
+ if (seenMessages.has(candidate.message)) continue;
10112
+ seenMessages.add(candidate.message);
10113
+ diagnostics.push(candidate);
10114
+ }
10115
+ };
10116
+ for (const directory of candidateDirectories) {
10117
+ const nextVersion = resolveVersionInDirectory(directory, "next", directory === scanDirectory ? project.nextjsVersion : null);
10118
+ if (nextVersion !== null) pushUnique(checkNextjsAdvisory(nextVersion));
10119
+ if (nextVersion !== null && import_semver.major(nextVersion) >= NEXTJS_OLDEST_AFFECTED_MAJOR) continue;
10120
+ for (const packageName of REACT_SERVER_DOM_PACKAGES) {
10121
+ const version = resolveVersionInDirectory(directory, packageName, null);
10122
+ if (version !== null) pushUnique(checkReactServerDomAdvisory(packageName, version));
10123
+ }
10124
+ }
10125
+ return diagnostics;
10126
+ };
8409
10127
  const REDUCED_MOTION_GREP_PATTERN = "prefers-reduced-motion|useReducedMotion|MotionConfig|reducedMotion";
8410
10128
  const REDUCED_MOTION_FILE_GLOBS = [
8411
10129
  "*.ts",
@@ -8637,7 +10355,7 @@ const collectIgnorePatterns = (rootDirectory) => {
8637
10355
  return patterns;
8638
10356
  };
8639
10357
  const KNIP_JSON_FILENAME = "knip.json";
8640
- const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
10358
+ const isRecord$1$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
8641
10359
  const readJsonFileSafe = (filePath) => {
8642
10360
  let rawContents;
8643
10361
  try {
@@ -8653,10 +10371,10 @@ const readJsonFileSafe = (filePath) => {
8653
10371
  };
8654
10372
  const readKnipConfig = (rootDirectory) => {
8655
10373
  const knipJson = readJsonFileSafe(path.join(rootDirectory, KNIP_JSON_FILENAME));
8656
- if (isRecord$1(knipJson)) return knipJson;
10374
+ if (isRecord$1$1(knipJson)) return knipJson;
8657
10375
  const packageJson = readJsonFileSafe(path.join(rootDirectory, "package.json"));
8658
- const packageKnipConfig = isRecord$1(packageJson) ? packageJson.knip : null;
8659
- return isRecord$1(packageKnipConfig) ? packageKnipConfig : null;
10376
+ const packageKnipConfig = isRecord$1$1(packageJson) ? packageJson.knip : null;
10377
+ return isRecord$1$1(packageKnipConfig) ? packageKnipConfig : null;
8660
10378
  };
8661
10379
  const normalizePatternList = (value) => {
8662
10380
  if (typeof value === "string" && value.length > 0) return [value];
@@ -8668,10 +10386,10 @@ const prefixWorkspacePatterns = (workspacePattern, patterns) => {
8668
10386
  return patterns.map((pattern) => pattern.startsWith("!") ? `!${normalizedWorkspacePattern}/${pattern.slice(1)}` : `${normalizedWorkspacePattern}/${pattern}`);
8669
10387
  };
8670
10388
  const collectKnipWorkspacePatterns = (workspaces, settingName) => {
8671
- if (!isRecord$1(workspaces)) return [];
10389
+ if (!isRecord$1$1(workspaces)) return [];
8672
10390
  const patterns = [];
8673
10391
  for (const [workspacePattern, workspaceConfig] of Object.entries(workspaces)) {
8674
- if (!isRecord$1(workspaceConfig)) continue;
10392
+ if (!isRecord$1$1(workspaceConfig)) continue;
8675
10393
  patterns.push(...prefixWorkspacePatterns(workspacePattern, normalizePatternList(workspaceConfig[settingName])));
8676
10394
  }
8677
10395
  return patterns;
@@ -8983,7 +10701,7 @@ const checkDeadCode = async (options) => {
8983
10701
  plugin: DEAD_CODE_PLUGIN,
8984
10702
  rule: "unused-file",
8985
10703
  severity: "warning",
8986
- message: "Unused file — not reachable from any entry point",
10704
+ message: "Unused file is not reachable from any entry point, so it adds maintenance surface without shipping any code.",
8987
10705
  help: "Delete the file if it is truly unreachable, or import it from an entry point.",
8988
10706
  line: 0,
8989
10707
  column: 0,
@@ -8996,7 +10714,7 @@ const checkDeadCode = async (options) => {
8996
10714
  plugin: DEAD_CODE_PLUGIN,
8997
10715
  rule: unusedExport.isTypeOnly ? "unused-type" : "unused-export",
8998
10716
  severity: "warning",
8999
- message: `Unused ${label}: \`${unusedExport.name}\``,
10717
+ message: `Unused ${label}: \`${unusedExport.name}\` is exported but no module imports it, so it expands the public surface and can mislead callers about supported API.`,
9000
10718
  help: "Drop the `export` keyword (or remove the declaration) if no other module uses this symbol.",
9001
10719
  line: unusedExport.line,
9002
10720
  column: unusedExport.column,
@@ -9011,7 +10729,7 @@ const checkDeadCode = async (options) => {
9011
10729
  rule: unusedDependency.isDevDependency ? "unused-dev-dependency" : "unused-dependency",
9012
10730
  severity: "warning",
9013
10731
  message: `Unused ${label}: \`${unusedDependency.name}\``,
9014
- help: "Remove the dependency from package.json if it is genuinely unused.",
10732
+ help: `An unused ${label} adds install time and supply-chain surface without being used; remove it from package.json if it is genuinely unused.`,
9015
10733
  line: 0,
9016
10734
  column: 0,
9017
10735
  category: DEAD_CODE_CATEGORY
@@ -9024,7 +10742,7 @@ const checkDeadCode = async (options) => {
9024
10742
  plugin: DEAD_CODE_PLUGIN,
9025
10743
  rule: "circular-dependency",
9026
10744
  severity: "warning",
9027
- message: `Circular import cycle: ${cycle.files.map(toRelative).join(" → ")}`,
10745
+ message: `Circular import cycle: ${cycle.files.map(toRelative).join(" → ")}. Modules in the cycle can observe partially initialized exports, causing order-dependent bugs.`,
9028
10746
  help: "Break the cycle by extracting the shared code into a third module that both files import.",
9029
10747
  line: 0,
9030
10748
  column: 0,
@@ -9814,6 +11532,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths) => {
9814
11532
  const buildCapabilities = (project) => {
9815
11533
  const capabilities = /* @__PURE__ */ new Set();
9816
11534
  capabilities.add(project.framework);
11535
+ if (project.reactVersion !== null || project.preactVersion !== null) capabilities.add("react");
9817
11536
  if (project.framework === "expo" || project.framework === "react-native" || project.hasReactNativeWorkspace) capabilities.add("react-native");
9818
11537
  if (project.expoVersion !== null) capabilities.add("expo");
9819
11538
  if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
@@ -9839,6 +11558,7 @@ const buildCapabilities = (project) => {
9839
11558
  capabilities.add("zod");
9840
11559
  if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
9841
11560
  }
11561
+ if (project.isPreES2023Target) capabilities.add("pre-es2023");
9842
11562
  if (project.hasReactCompiler) capabilities.add("react-compiler");
9843
11563
  if (project.hasTanStackQuery) capabilities.add("tanstack-query");
9844
11564
  if (project.hasTypeScript) capabilities.add("typescript");
@@ -9857,6 +11577,7 @@ const shouldEnableRule = (requires, tags, capabilities, ignoredTags, disabledBy)
9857
11577
  if (requires) {
9858
11578
  for (const capability of requires) if (!capabilities.has(capability)) return false;
9859
11579
  }
11580
+ if (tags?.includes("react-jsx-only") && !capabilities.has("react")) return false;
9860
11581
  if (disabledBy) {
9861
11582
  for (const capability of disabledBy) if (capabilities.has(capability)) return false;
9862
11583
  }
@@ -9891,16 +11612,16 @@ const readPluginShape = (pluginSpecifier, loadModule) => {
9891
11612
  ruleNames: new Set(Object.keys(rules))
9892
11613
  };
9893
11614
  };
9894
- const bundledRequire = createRequire(import.meta.url);
11615
+ const bundledRequire$1 = createRequire(import.meta.url);
9895
11616
  const resolveReactHooksJsPlugin = (hasReactCompiler, customRulesOnly) => {
9896
11617
  if (!hasReactCompiler || customRulesOnly) return null;
9897
11618
  let pluginSpecifier;
9898
11619
  try {
9899
- pluginSpecifier = bundledRequire.resolve("eslint-plugin-react-hooks");
11620
+ pluginSpecifier = bundledRequire$1.resolve("eslint-plugin-react-hooks");
9900
11621
  } catch {
9901
11622
  return null;
9902
11623
  }
9903
- const { ruleNames } = readPluginShape(pluginSpecifier, (spec) => bundledRequire(spec));
11624
+ const { ruleNames } = readPluginShape(pluginSpecifier, (spec) => bundledRequire$1(spec));
9904
11625
  return {
9905
11626
  entry: {
9906
11627
  name: "react-hooks-js",
@@ -11369,6 +13090,262 @@ var Score = class Score extends Context.Service()("react-doctor/Score") {
11369
13090
  }) }));
11370
13091
  static layerOf = (result) => Layer.succeed(Score, Score.of({ compute: () => Effect.succeed(result) }));
11371
13092
  };
13093
+ const SocketScoreSchema = Schema.Struct({
13094
+ overall: Schema.Number,
13095
+ license: Schema.Number,
13096
+ maintenance: Schema.Number,
13097
+ quality: Schema.Number,
13098
+ supplyChain: Schema.Number,
13099
+ vulnerability: Schema.Number
13100
+ });
13101
+ const SocketArtifactSchema = Schema.Struct({ score: Schema.optional(SocketScoreSchema) });
13102
+ const decodeArtifact = Schema.decodeUnknownOption(SocketArtifactSchema);
13103
+ const SCORE_AXES = [
13104
+ {
13105
+ key: "supplyChain",
13106
+ label: "supply chain"
13107
+ },
13108
+ {
13109
+ key: "vulnerability",
13110
+ label: "vulnerability"
13111
+ },
13112
+ {
13113
+ key: "maintenance",
13114
+ label: "maintenance"
13115
+ },
13116
+ {
13117
+ key: "quality",
13118
+ label: "quality"
13119
+ },
13120
+ {
13121
+ key: "license",
13122
+ label: "license"
13123
+ }
13124
+ ];
13125
+ const clampScore = (value) => {
13126
+ if (!Number.isFinite(value)) return 50;
13127
+ return Math.min(Math.max(value, 0), 100);
13128
+ };
13129
+ const toHundred = (normalizedScore) => Math.round(clampScore(normalizedScore * 100));
13130
+ const resolveOptions = (config) => {
13131
+ const supplyChain = config?.supplyChain ?? {};
13132
+ return {
13133
+ minScore: typeof supplyChain.minScore === "number" ? clampScore(supplyChain.minScore) : 50,
13134
+ severity: supplyChain.severity === "warning" ? "warning" : "error",
13135
+ includeDevDependencies: supplyChain.includeDevDependencies !== false
13136
+ };
13137
+ };
13138
+ const resolveConcreteVersion = (spec) => {
13139
+ const trimmed = spec.trim();
13140
+ if (trimmed.length === 0) return null;
13141
+ if (trimmed.includes(":")) return null;
13142
+ const match = trimmed.match(/\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?/);
13143
+ return match ? match[0] : null;
13144
+ };
13145
+ const locateDependencyKey = (packageJsonText, section, name) => {
13146
+ const needle = `"${name}"`;
13147
+ const sectionHeader = new RegExp(`"${section}"\\s*:\\s*\\{`);
13148
+ const lines = packageJsonText.split(/\r?\n/);
13149
+ let depth = 0;
13150
+ let insideSection = false;
13151
+ for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
13152
+ const lineText = lines[lineIndex];
13153
+ if (!insideSection) {
13154
+ if (sectionHeader.test(lineText)) {
13155
+ insideSection = true;
13156
+ depth = 1;
13157
+ }
13158
+ continue;
13159
+ }
13160
+ const columnIndex = lineText.indexOf(needle);
13161
+ if (columnIndex >= 0 && /^\s*:/.test(lineText.slice(columnIndex + needle.length))) return {
13162
+ line: lineIndex + 1,
13163
+ column: columnIndex + 1
13164
+ };
13165
+ for (const character of lineText) if (character === "{") depth += 1;
13166
+ else if (character === "}") depth -= 1;
13167
+ if (depth <= 0) return null;
13168
+ }
13169
+ return null;
13170
+ };
13171
+ const collectDependenciesToScore = (packageJson, packageJsonText, includeDevDependencies) => {
13172
+ const sectionByName = /* @__PURE__ */ new Map();
13173
+ for (const name of Object.keys(packageJson.dependencies ?? {})) sectionByName.set(name, "dependencies");
13174
+ if (includeDevDependencies) {
13175
+ for (const name of Object.keys(packageJson.devDependencies ?? {})) if (!sectionByName.has(name)) sectionByName.set(name, "devDependencies");
13176
+ }
13177
+ const dependencies = [];
13178
+ for (const [name, section] of sectionByName) {
13179
+ if (SUPPLY_CHAIN_IGNORED_PACKAGES.has(name)) continue;
13180
+ const spec = (packageJson[section] ?? {})[name] ?? "";
13181
+ const version = resolveConcreteVersion(spec);
13182
+ if (version === null) continue;
13183
+ const location = locateDependencyKey(packageJsonText, section, name);
13184
+ dependencies.push({
13185
+ name,
13186
+ version,
13187
+ spec,
13188
+ line: location?.line ?? 0,
13189
+ column: location?.column ?? 0
13190
+ });
13191
+ }
13192
+ return dependencies;
13193
+ };
13194
+ const readPackageJsonText = (packageJsonPath) => {
13195
+ try {
13196
+ return fs$1.readFileSync(packageJsonPath, "utf-8");
13197
+ } catch {
13198
+ return "";
13199
+ }
13200
+ };
13201
+ const collectWorkspaceDirectories = (startDirectory) => {
13202
+ const monorepoRoot = isMonorepoRoot(startDirectory) ? startDirectory : findMonorepoRoot(startDirectory) ?? startDirectory;
13203
+ const rootPackageJson = readPackageJson$1(path$1.join(monorepoRoot, "package.json"));
13204
+ const directories = [monorepoRoot];
13205
+ const visited = new Set([monorepoRoot]);
13206
+ for (const pattern of getWorkspacePatterns(monorepoRoot, rootPackageJson)) for (const workspaceDirectory of resolveWorkspaceDirectories(monorepoRoot, pattern)) {
13207
+ if (visited.has(workspaceDirectory)) continue;
13208
+ visited.add(workspaceDirectory);
13209
+ directories.push(workspaceDirectory);
13210
+ }
13211
+ return directories;
13212
+ };
13213
+ const collectMonorepoDependencies = (startDirectory, includeDevDependencies) => {
13214
+ const dependenciesByKey = /* @__PURE__ */ new Map();
13215
+ for (const directory of collectWorkspaceDirectories(startDirectory)) {
13216
+ const packageJsonPath = path$1.join(directory, "package.json");
13217
+ const packageJson = readPackageJson$1(packageJsonPath);
13218
+ const packageJsonText = readPackageJsonText(packageJsonPath);
13219
+ for (const dependency of collectDependenciesToScore(packageJson, packageJsonText, includeDevDependencies)) {
13220
+ const key = `${dependency.name}@${dependency.version}`;
13221
+ if (!dependenciesByKey.has(key)) dependenciesByKey.set(key, dependency);
13222
+ }
13223
+ }
13224
+ return [...dependenciesByKey.values()];
13225
+ };
13226
+ const toPurl = (dependency) => `pkg:npm/${dependency.name}@${dependency.version}`;
13227
+ const parseScoreFromBody = (body) => {
13228
+ for (const line of body.split("\n")) {
13229
+ if (line.trim().length === 0) continue;
13230
+ let parsed;
13231
+ try {
13232
+ parsed = JSON.parse(line);
13233
+ } catch {
13234
+ continue;
13235
+ }
13236
+ const artifact = Option.getOrNull(decodeArtifact(parsed));
13237
+ if (artifact?.score) return artifact.score;
13238
+ }
13239
+ return null;
13240
+ };
13241
+ const fetchSocketScore = (dependency) => Effect.tryPromise(async (signal) => {
13242
+ const requestUrl = `${SOCKET_FREE_PURL_API_BASE}/${encodeURIComponent(toPurl(dependency))}`;
13243
+ const response = await fetch(requestUrl, {
13244
+ headers: { "User-Agent": SOCKET_FREE_USER_AGENT },
13245
+ signal
13246
+ });
13247
+ if (!response.ok) return null;
13248
+ return parseScoreFromBody(await response.text());
13249
+ }).pipe(Effect.timeout(FETCH_TIMEOUT_MS), Effect.orElseSucceed(() => null), Effect.tap((score) => {
13250
+ const scoreAttributes = {};
13251
+ if (score !== null) {
13252
+ scoreAttributes["socket.score.overall"] = toHundred(score.overall);
13253
+ for (const axis of SCORE_AXES) scoreAttributes[`socket.score.${axis.key}`] = toHundred(score[axis.key]);
13254
+ }
13255
+ return Effect.annotateCurrentSpan({
13256
+ "socket.scored": score !== null,
13257
+ ...scoreAttributes
13258
+ });
13259
+ }), Effect.withSpan("SupplyChain.fetchScore", { attributes: {
13260
+ "socket.package": dependency.name,
13261
+ "socket.version": dependency.version,
13262
+ "socket.purl": toPurl(dependency)
13263
+ } }));
13264
+ const formatAxisScores = (score) => SCORE_AXES.map((axis) => `${axis.label} ${toHundred(score[axis.key])}`).join(", ");
13265
+ const buildLowScoreDiagnostic = (dependency, score, options) => {
13266
+ const overall = toHundred(score.overall);
13267
+ const packagePageUrl = `${SOCKET_PACKAGE_PAGE_BASE}/${dependency.name}/overview/${dependency.version}`;
13268
+ return {
13269
+ filePath: "package.json",
13270
+ plugin: SUPPLY_CHAIN_PLUGIN,
13271
+ rule: SUPPLY_CHAIN_RULE,
13272
+ severity: options.severity,
13273
+ message: `\`${dependency.name}\` (declared in package.json as "${dependency.spec}", scored at ${dependency.version}) has a Socket supply-chain score of ${overall}/100 (below the minimum of ${options.minScore}). Axis scores — ${formatAxisScores(score)}.`,
13274
+ help: `Update or replace the \`"${dependency.name}": "${dependency.spec}"\` entry in package.json. Review ${dependency.name} on Socket: ${packagePageUrl}. Or raise \`supplyChain.minScore\` if you have vetted and accepted this package.`,
13275
+ url: packagePageUrl,
13276
+ line: dependency.line,
13277
+ column: dependency.column,
13278
+ category: SUPPLY_CHAIN_CATEGORY
13279
+ };
13280
+ };
13281
+ /**
13282
+ * Fetches the Socket score of every direct dependency declared across the
13283
+ * whole monorepo (the workspace root plus every workspace package.json),
13284
+ * de-duplicated by `name@version` — not just the ones below a threshold —
13285
+ * via the same free, keyless endpoint as {@link checkSupplyChain}. Backs the
13286
+ * CLI's `--sfw` demo listing. Unknown packages and per-package failures come
13287
+ * back with `overall: null` rather than being dropped, so the caller can show
13288
+ * them explicitly.
13289
+ */
13290
+ const collectSupplyChainScores = (input) => Effect.gen(function* () {
13291
+ const options = resolveOptions(input.userConfig);
13292
+ const dependencies = collectMonorepoDependencies(input.rootDirectory, options.includeDevDependencies);
13293
+ if (dependencies.length === 0) return [];
13294
+ const scores = yield* Effect.forEach(dependencies, fetchSocketScore, { concurrency: 8 });
13295
+ return dependencies.map((dependency, index) => {
13296
+ const score = scores[index];
13297
+ return {
13298
+ name: dependency.name,
13299
+ version: dependency.version,
13300
+ overall: score ? toHundred(score.overall) : null
13301
+ };
13302
+ });
13303
+ });
13304
+ /**
13305
+ * Scores every direct dependency in the project's `package.json` against
13306
+ * Socket.dev's free PURL endpoint (the same one Socket Firewall's free tier
13307
+ * uses — no API key) and returns a diagnostic for each dependency whose
13308
+ * Socket `overall` score is below the configured `minScore`.
13309
+ *
13310
+ * Lookups run with bounded concurrency via `Effect.forEach`. The check is
13311
+ * total/fail-open: each per-package lookup already recovers to `null`
13312
+ * (skip) on timeout or network/parse failure, so a flaky Socket API never
13313
+ * sinks the scan. Diagnostics default to `"error"` severity, so a low score
13314
+ * fails the run at the standard `blocking` gate.
13315
+ */
13316
+ const checkSupplyChain = (input) => Effect.gen(function* () {
13317
+ const options = resolveOptions(input.userConfig);
13318
+ const packageJsonPath = path$1.join(input.rootDirectory, "package.json");
13319
+ const dependencies = collectDependenciesToScore(readPackageJson$1(packageJsonPath), readPackageJsonText(packageJsonPath), options.includeDevDependencies);
13320
+ if (dependencies.length === 0) return [];
13321
+ const scores = yield* Effect.forEach(dependencies, fetchSocketScore, { concurrency: 8 });
13322
+ const diagnostics = [];
13323
+ for (let index = 0; index < dependencies.length; index += 1) {
13324
+ const score = scores[index];
13325
+ if (!score) continue;
13326
+ if (toHundred(score.overall) >= options.minScore) continue;
13327
+ diagnostics.push(buildLowScoreDiagnostic(dependencies[index], score, options));
13328
+ }
13329
+ return diagnostics;
13330
+ });
13331
+ /**
13332
+ * `SupplyChain` scores the project's direct dependencies against Socket.dev's
13333
+ * free, keyless PURL endpoint — the same lookup Socket Firewall's free tier
13334
+ * (`sfw`) performs — and streams a diagnostic for each dependency whose
13335
+ * Socket score falls below the configured `supplyChain.minScore`.
13336
+ *
13337
+ * Runs by default (one network request per dependency); the orchestrator
13338
+ * provides `layerOf([])` only when the user opts out via
13339
+ * `supplyChain.enabled: false`, and always skips it in `--diff` / `--staged`
13340
+ * mode (dependency health is a whole-project property).
13341
+ * The underlying `checkSupplyChain` Effect is total/fail-open — per-package
13342
+ * timeouts and network failures recover to "skip" — so the stream never
13343
+ * fails, mirroring `DeadCode`'s stream shape so the two compose the same way.
13344
+ */
13345
+ var SupplyChain = class SupplyChain extends Context.Service()("react-doctor/SupplyChain") {
13346
+ static layerNode = Layer.succeed(SupplyChain, SupplyChain.of({ run: (input) => Stream.unwrap(checkSupplyChain(input).pipe(Effect.map((diagnostics) => Stream.fromIterable(diagnostics)), Effect.withSpan("SupplyChain.run"))) }));
13347
+ static layerOf = (diagnostics) => Layer.succeed(SupplyChain, SupplyChain.of({ run: () => Stream.fromIterable(diagnostics) }));
13348
+ };
11372
13349
  const getObjectProperty = (value, propertyName) => {
11373
13350
  if (typeof value !== "object" || value === null) return void 0;
11374
13351
  return Reflect.get(value, propertyName);
@@ -11446,6 +13423,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
11446
13423
  const reporterService = yield* Reporter;
11447
13424
  const scoreService = yield* Score;
11448
13425
  const deadCodeService = yield* DeadCode;
13426
+ const supplyChainService = yield* SupplyChain;
11449
13427
  const gitService = yield* Git;
11450
13428
  const progressService = yield* Progress;
11451
13429
  const partialFailuresRef = yield* LintPartialFailures;
@@ -11481,10 +13459,15 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
11481
13459
  const environmentDiagnostics = isDiffMode ? [] : [
11482
13460
  ...checkReducedMotion(scanDirectory),
11483
13461
  ...checkPnpmHardening(scanDirectory),
13462
+ ...checkReactServerComponentsAdvisory(scanDirectory, project),
11484
13463
  ...checkExpoProject(scanDirectory, project),
11485
13464
  ...checkReactNativeProject(scanDirectory, project)
11486
13465
  ];
11487
13466
  const envCollected = yield* Stream.runCollect(applyPerElementPipeline(Stream.fromIterable(environmentDiagnostics)));
13467
+ const supplyChainCollected = !isDiffMode || (input.supplyChainManifestChanged ?? false) ? yield* Stream.runCollect(applyPerElementPipeline(supplyChainService.run({
13468
+ rootDirectory: scanDirectory,
13469
+ userConfig: resolvedConfig.config
13470
+ }))) : [];
11488
13471
  const lintFailure = yield* Ref.make({
11489
13472
  didFail: false,
11490
13473
  reason: null,
@@ -11549,6 +13532,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
11549
13532
  yield* reporterService.finalize;
11550
13533
  const finalDiagnostics = [
11551
13534
  ...envCollected,
13535
+ ...supplyChainCollected,
11552
13536
  ...lintCollected,
11553
13537
  ...deadCodeCollected
11554
13538
  ];
@@ -12049,6 +14033,22 @@ const filterSourceFiles = (filePaths) => filePaths.filter(isLintableSourceFile);
12049
14033
  * instead of being improvised per diagnostic.
12050
14034
  */
12051
14035
  const buildRuleDocsUrl = (plugin, rule) => `${DOCS_RULES_BASE_URL}/${plugin}/${rule}`;
14036
+ const computeConfigFingerprint = (projectDirectory, version) => {
14037
+ const parts = [`v=${version}`];
14038
+ let directory = projectDirectory;
14039
+ for (;;) {
14040
+ for (const filename of CONFIG_FINGERPRINT_FILENAMES) try {
14041
+ const stat = fs.statSync(path.join(directory, filename));
14042
+ parts.push(`${directory}/${filename}=${stat.mtimeMs}:${stat.size}`);
14043
+ } catch {
14044
+ continue;
14045
+ }
14046
+ const parent = path.dirname(directory);
14047
+ if (parent === directory) break;
14048
+ directory = parent;
14049
+ }
14050
+ return crypto.createHash("sha1").update(parts.join("|")).digest("hex");
14051
+ };
12052
14052
  const groupBy = (items, keyFn) => {
12053
14053
  const groups = /* @__PURE__ */ new Map();
12054
14054
  for (const item of items) {
@@ -12066,8 +14066,9 @@ const groupBy = (items, keyFn) => {
12066
14066
  *
12067
14067
  * Recipes are generated from react-doctor's own engine rules, so only
12068
14068
  * those resolve. Dead-code (`deslop`), the synthetic environment and
12069
- * supply-chain checks (`require-reduced-motion`, `require-pnpm-hardening`
12070
- * — `react-doctor`-namespaced but not engine rules), and adopted
14069
+ * supply-chain checks (`require-reduced-motion`, `require-pnpm-hardening`,
14070
+ * `no-vulnerable-react-server-components` — `react-doctor`-namespaced but not
14071
+ * engine rules), and adopted
12071
14072
  * third-party plugins (`eslint`, `unicorn`, `react-hooks-js`, …) have no
12072
14073
  * recipe, so advertising "fetch the fix recipe" for them sends agents to
12073
14074
  * a 404. Gate the directive on this predicate.
@@ -12249,7 +14250,7 @@ const makeNoopConsole = () => ({
12249
14250
  });
12250
14251
  //#endregion
12251
14252
  //#region src/cli/utils/version.ts
12252
- const VERSION = "0.4.2-dev.98066c2";
14253
+ const VERSION = "0.4.2-dev.a254414";
12253
14254
  //#endregion
12254
14255
  //#region src/cli/utils/json-mode.ts
12255
14256
  let context = null;
@@ -12607,13 +14608,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
12607
14608
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
12608
14609
  * standard `SENTRY_RELEASE` override.
12609
14610
  */
12610
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.4.2-dev.98066c2`;
14611
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.4.2-dev.a254414`;
12611
14612
  /**
12612
14613
  * Deployment environment shown in Sentry's environment filter. Defaults to
12613
14614
  * `production` for tagged releases and `development` for dev/unbuilt versions,
12614
14615
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
12615
14616
  */
12616
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.4.2-dev.98066c2") ? "development" : "production");
14617
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.4.2-dev.a254414") ? "development" : "production");
12617
14618
  /**
12618
14619
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
12619
14620
  * (set to `0` to disable tracing) and falls back to
@@ -15876,6 +17877,7 @@ const buildRuntimeLayers = (input) => {
15876
17877
  const linterLayer = input.shouldSkipLint ? Linter.layerOf([]) : Linter.layerOxlint;
15877
17878
  const deadCodeLayer = input.shouldRunDeadCode ? DeadCode.layerNode : DeadCode.layerOf([]);
15878
17879
  const scoreLayer = input.shouldComputeScore ? Score.layerHttp : Score.layerOf(null);
17880
+ const supplyChainLayer = input.userConfig?.supplyChain?.enabled === false ? SupplyChain.layerOf([]) : SupplyChain.layerNode;
15879
17881
  const projectLayer = input.projectInfoOverride === void 0 ? Project.layerNode : Project.layerOf(input.projectInfoOverride);
15880
17882
  const progressLayer = input.shouldShowProgressSpinners ? Progress.layerOra(buildSpinnerProgressHandle) : Progress.layerNoop;
15881
17883
  const configLayer = input.hasConfigOverride ? Config.layerOf({
@@ -15883,7 +17885,7 @@ const buildRuntimeLayers = (input) => {
15883
17885
  resolvedDirectory: input.directory,
15884
17886
  configSourceDirectory: input.configSourceDirectory
15885
17887
  }) : Config.layerNode;
15886
- const baseLayers = Layer.mergeAll(projectLayer, configLayer, Files.layerNode, Git.layerNode, linterLayer, LintPartialFailures.layerLive, deadCodeLayer, progressLayer, Reporter.layerNoop, scoreLayer);
17888
+ const baseLayers = Layer.mergeAll(projectLayer, configLayer, Files.layerNode, Git.layerNode, linterLayer, LintPartialFailures.layerLive, deadCodeLayer, progressLayer, Reporter.layerNoop, scoreLayer, supplyChainLayer);
15887
17889
  return input.oxlintConcurrency === void 0 ? baseLayers : Layer.mergeAll(baseLayers, Layer.succeed(OxlintConcurrency, input.oxlintConcurrency));
15888
17890
  };
15889
17891
  //#endregion
@@ -16609,6 +18611,11 @@ const printCategoryCountUp = (tallies) => Effect.gen(function* () {
16609
18611
  });
16610
18612
  const TOP_ERROR_DETAIL_INDENT = " ";
16611
18613
  const pickRepresentativeDiagnostic = (ruleDiagnostics) => ruleDiagnostics.find((diagnostic) => diagnostic.line > 0) ?? ruleDiagnostics[0];
18614
+ const hasIndistinctSiteLocations = (ruleDiagnostics) => {
18615
+ const firstDiagnostic = ruleDiagnostics[0];
18616
+ if (firstDiagnostic === void 0) return false;
18617
+ return ruleDiagnostics.every((diagnostic) => diagnostic.line <= 0 && diagnostic.filePath === firstDiagnostic.filePath);
18618
+ };
16612
18619
  const FRAME_CONTEXT_REACH_LINES = 3;
16613
18620
  const clusterNearbyDiagnostics = (diagnostics) => {
16614
18621
  const byFile = groupBy(diagnostics, (diagnostic) => diagnostic.filePath);
@@ -16672,7 +18679,9 @@ const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, rende
16672
18679
  const learnMoreLine = formatLearnMoreLine(representative);
16673
18680
  if (learnMoreLine) lines.push(`${TOP_ERROR_DETAIL_INDENT}${highlighter.info(learnMoreLine)}`);
16674
18681
  }
16675
- if (!renderEverySite) for (const explanationLine of wrapTextToWidth(representative.message, resolveMeasureWidth(4), { breakLongWords: false })) lines.push(`${TOP_ERROR_DETAIL_INDENT}${explanationLine}`);
18682
+ const isCollapsedWarningGroup = severity === "warning" && hasIndistinctSiteLocations(ruleDiagnostics);
18683
+ const impactMessages = isCollapsedWarningGroup ? [...new Set(ruleDiagnostics.map((diagnostic) => diagnostic.message))] : [representative.message];
18684
+ for (const impactMessage of impactMessages) for (const explanationLine of wrapTextToWidth(impactMessage, resolveMeasureWidth(4), { breakLongWords: false })) lines.push(`${TOP_ERROR_DETAIL_INDENT}${explanationLine}`);
16676
18685
  if (representative.help) for (const fixLine of wrapTextToWidth(`→ ${representative.help}`, resolveMeasureWidth(4), { breakLongWords: false })) lines.push(highlighter.dim(`${TOP_ERROR_DETAIL_INDENT}${fixLine}`));
16677
18686
  if (renderEverySite && isAgentEnvironment) {
16678
18687
  const fixRecipeLine = formatFixRecipeLine(representative);
@@ -16680,7 +18689,7 @@ const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, rende
16680
18689
  }
16681
18690
  const renderCodeFrame = severity === "error";
16682
18691
  const sites = renderEverySite ? ruleDiagnostics : [representative];
16683
- for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, renderCodeFrame));
18692
+ if (!(isCollapsedWarningGroup && representative.help.includes(representative.filePath))) for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, renderCodeFrame));
16684
18693
  return lines;
16685
18694
  };
16686
18695
  const selectErrorRuleGroups = (diagnostics, rulePriority) => buildSortedRuleGroups(diagnostics.filter((diagnostic) => diagnostic.severity === "error"), rulePriority);
@@ -16809,6 +18818,9 @@ const computeProjectedScore = async (topErrorSource, rescoreSource, currentScore
16809
18818
  if (!potentialScore || potentialScore.score <= currentScore.score) return null;
16810
18819
  return potentialScore.score;
16811
18820
  };
18821
+ //#endregion
18822
+ //#region src/cli/utils/filter-diagnostics-by-categories.ts
18823
+ const filterDiagnosticsByCategories = (diagnostics, categories) => categories.size === 0 ? [...diagnostics] : diagnostics.filter((diagnostic) => categories.has(diagnostic.category));
16812
18824
  const FORCE_ONBOARDING_ENV_VAR = "REACT_DOCTOR_FORCE_ONBOARDING";
16813
18825
  const FALSY_FLAG_VALUES = new Set([
16814
18826
  "",
@@ -17239,11 +19251,260 @@ const resolveOxlintNodeEffect = (isLintEnabled, isQuiet) => Effect.gen(function*
17239
19251
  });
17240
19252
  const resolveOxlintNode = (isLintEnabled, isQuiet) => Effect.runPromise(resolveOxlintNodeEffect(isLintEnabled, isQuiet).pipe(Effect.provide(NodeResolver.layerNode)));
17241
19253
  //#endregion
19254
+ //#region src/cli/utils/cli-input-error.ts
19255
+ /**
19256
+ * A mistake in *how the CLI was invoked* — a malformed `<file>:<line>`
19257
+ * argument, mutually exclusive flags, or an unknown `--project` name. This is
19258
+ * user input, not a react-doctor bug, so `isExpectedUserError` routes it
19259
+ * through `handleUserError`: a clean, single-line message with no Sentry
19260
+ * report and no "Something went wrong, open a prefilled issue" block.
19261
+ *
19262
+ * The `message` is rendered verbatim, so it must read as a complete,
19263
+ * human-readable sentence that tells the user how to fix their invocation.
19264
+ */
19265
+ var CliInputError = class extends Error {
19266
+ name = "CliInputError";
19267
+ };
19268
+ //#endregion
19269
+ //#region src/cli/utils/resolve-cli-categories.ts
19270
+ const categoryByLowercase = new Map(DIAGNOSTIC_CATEGORY_BUCKETS.map((category) => [category.toLowerCase(), category]));
19271
+ const knownCategoryList = DIAGNOSTIC_CATEGORY_BUCKETS.join(", ");
19272
+ const splitCategoryFlagValue = (value) => value.split(",").map((category) => category.trim()).filter((category) => category.length > 0);
19273
+ const resolveCliCategories = (categoryFlag) => {
19274
+ const rawCategoryValues = categoryFlag === void 0 ? [] : Array.isArray(categoryFlag) ? categoryFlag : [categoryFlag];
19275
+ const resolvedCategories = [];
19276
+ const seenCategories = /* @__PURE__ */ new Set();
19277
+ for (const rawCategoryValue of rawCategoryValues) for (const categoryQuery of splitCategoryFlagValue(rawCategoryValue)) {
19278
+ const matchedCategory = categoryByLowercase.get(categoryQuery.toLowerCase());
19279
+ if (matchedCategory === void 0) throw new CliInputError(`Unknown category "${categoryQuery}". Expected one of: ${knownCategoryList}.`);
19280
+ if (!seenCategories.has(matchedCategory)) {
19281
+ seenCategories.add(matchedCategory);
19282
+ resolvedCategories.push(matchedCategory);
19283
+ }
19284
+ }
19285
+ if (rawCategoryValues.length > 0 && resolvedCategories.length === 0) throw new CliInputError(`--category requires one of: ${knownCategoryList}.`);
19286
+ return resolvedCategories.length > 0 ? resolvedCategories : void 0;
19287
+ };
19288
+ //#endregion
19289
+ //#region src/cli/utils/scan-result-cache.ts
19290
+ const CACHE_DISABLED_VALUES = new Set(["1", "true"]);
19291
+ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
19292
+ "oxlint",
19293
+ "oxlint/package.json",
19294
+ "oxlint-plugin-react-doctor",
19295
+ "deslop-js/package.json",
19296
+ "eslint-plugin-react-hooks/package.json"
19297
+ ];
19298
+ const bundledRequire = createRequire(import.meta.url);
19299
+ const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
19300
+ const normalizeForStableJson = (value) => {
19301
+ if (value === null) return null;
19302
+ if (value === void 0) return void 0;
19303
+ const valueType = typeof value;
19304
+ if (valueType === "string" || valueType === "number" || valueType === "boolean") return value;
19305
+ if (valueType === "bigint" || valueType === "function" || valueType === "symbol") throw new Error("Unsupported cache key value");
19306
+ if (Array.isArray(value)) return value.map((item) => {
19307
+ const normalized = normalizeForStableJson(item);
19308
+ return normalized === void 0 ? null : normalized;
19309
+ });
19310
+ const prototype = Object.getPrototypeOf(value);
19311
+ if (prototype !== Object.prototype && prototype !== null) throw new Error("Unsupported cache key object");
19312
+ const record = value;
19313
+ const normalizedRecord = {};
19314
+ for (const key of Object.keys(record).sort()) {
19315
+ const normalized = normalizeForStableJson(record[key]);
19316
+ if (normalized !== void 0) normalizedRecord[key] = normalized;
19317
+ }
19318
+ return normalizedRecord;
19319
+ };
19320
+ const stringifyStableJson = (value) => {
19321
+ try {
19322
+ return JSON.stringify(normalizeForStableJson(value));
19323
+ } catch {
19324
+ return null;
19325
+ }
19326
+ };
19327
+ const hashString = (value) => crypto.createHash("sha1").update(value).digest("hex");
19328
+ const runGit$1 = (directory, args) => {
19329
+ try {
19330
+ return execFileSync("git", [...args], {
19331
+ cwd: directory,
19332
+ encoding: "utf8",
19333
+ stdio: [
19334
+ "ignore",
19335
+ "pipe",
19336
+ "ignore"
19337
+ ]
19338
+ }).trim();
19339
+ } catch {
19340
+ return null;
19341
+ }
19342
+ };
19343
+ const readHeadSha = (projectDirectory) => runGit$1(projectDirectory, ["rev-parse", "HEAD"]);
19344
+ const isWorktreeClean = (projectDirectory) => {
19345
+ const status = runGit$1(projectDirectory, [
19346
+ "status",
19347
+ "--porcelain=v1",
19348
+ "--untracked-files=normal"
19349
+ ]);
19350
+ return status !== null && status.length === 0;
19351
+ };
19352
+ const hasHiddenTrackedFileState = (projectDirectory) => {
19353
+ const output = runGit$1(projectDirectory, ["ls-files", "-v"]);
19354
+ if (output === null) return true;
19355
+ return output.split("\n").some((line) => line.length > 0 && line[0] !== "H");
19356
+ };
19357
+ const resolveCacheFilePath = (projectDirectory) => {
19358
+ const nodeModulesDirectory = path.join(projectDirectory, "node_modules");
19359
+ if (fs.existsSync(nodeModulesDirectory)) return path.join(nodeModulesDirectory, ".cache", "react-doctor", "scan-cache.json");
19360
+ const projectHash = hashString(projectDirectory).slice(0, 16);
19361
+ return path.join(os.tmpdir(), "react-doctor-cache", `scan-${projectHash}.json`);
19362
+ };
19363
+ const readPersistedCache = (cacheFilePath) => {
19364
+ try {
19365
+ const parsed = JSON.parse(fs.readFileSync(cacheFilePath, "utf8"));
19366
+ if (!isRecord$1(parsed) || parsed.version !== 1) return {
19367
+ version: 1,
19368
+ entries: []
19369
+ };
19370
+ if (!Array.isArray(parsed.entries)) return {
19371
+ version: 1,
19372
+ entries: []
19373
+ };
19374
+ const entries = [];
19375
+ for (const entry of parsed.entries) {
19376
+ if (!isRecord$1(entry) || typeof entry.key !== "string" || typeof entry.createdAtMs !== "number") continue;
19377
+ if (!isRecord$1(entry.payload) || !Array.isArray(entry.payload.diagnostics)) continue;
19378
+ entries.push(entry);
19379
+ }
19380
+ return {
19381
+ version: 1,
19382
+ entries
19383
+ };
19384
+ } catch {
19385
+ return {
19386
+ version: 1,
19387
+ entries: []
19388
+ };
19389
+ }
19390
+ };
19391
+ const writePersistedCache = (cacheFilePath, cache) => {
19392
+ try {
19393
+ fs.mkdirSync(path.dirname(cacheFilePath), { recursive: true });
19394
+ const tempPath = `${cacheFilePath}.${process.pid}.tmp`;
19395
+ fs.writeFileSync(tempPath, JSON.stringify(cache));
19396
+ fs.renameSync(tempPath, cacheFilePath);
19397
+ } catch {
19398
+ return;
19399
+ }
19400
+ };
19401
+ const isScanResultCacheDisabled = () => CACHE_DISABLED_VALUES.has(process.env.REACT_DOCTOR_NO_CACHE?.toLowerCase() ?? "");
19402
+ const resolveProjectIdentity = (projectDirectory) => {
19403
+ try {
19404
+ return fs.realpathSync.native(projectDirectory);
19405
+ } catch {
19406
+ return path.resolve(projectDirectory);
19407
+ }
19408
+ };
19409
+ const fileFingerprint = (filePath) => {
19410
+ try {
19411
+ const stat = fs.statSync(filePath);
19412
+ return `${filePath}:${stat.mtimeMs}:${stat.size}`;
19413
+ } catch {
19414
+ return null;
19415
+ }
19416
+ };
19417
+ const resolveToolchainFingerprint = (nodeBinaryPath) => {
19418
+ const fingerprints = [];
19419
+ if (nodeBinaryPath !== null) {
19420
+ const fingerprint = fileFingerprint(nodeBinaryPath);
19421
+ if (fingerprint !== null) fingerprints.push(`node=${fingerprint}`);
19422
+ }
19423
+ for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
19424
+ const fingerprint = fileFingerprint(bundledRequire.resolve(specifier));
19425
+ if (fingerprint !== null) fingerprints.push(`${specifier}=${fingerprint}`);
19426
+ } catch {
19427
+ continue;
19428
+ }
19429
+ return fingerprints;
19430
+ };
19431
+ const buildScanResultCacheKey = (input) => {
19432
+ if (isScanResultCacheDisabled()) return null;
19433
+ if (!isWorktreeClean(input.projectDirectory)) return null;
19434
+ if (hasHiddenTrackedFileState(input.projectDirectory)) return null;
19435
+ const headSha = readHeadSha(input.projectDirectory);
19436
+ if (headSha === null) return null;
19437
+ if (stringifyStableJson(input.userConfig) === null) return null;
19438
+ const cacheKeyJson = stringifyStableJson({
19439
+ schemaVersion: 1,
19440
+ projectIdentity: resolveProjectIdentity(input.projectDirectory),
19441
+ headSha,
19442
+ reactDoctorVersion: input.version,
19443
+ nodeVersion: process.version,
19444
+ toolchainFingerprint: resolveToolchainFingerprint(input.nodeBinaryPath),
19445
+ configFingerprint: computeConfigFingerprint(input.projectDirectory, input.version),
19446
+ hasConfigOverride: input.hasConfigOverride,
19447
+ configSourceDirectory: input.configSourceDirectory,
19448
+ userConfig: input.userConfig,
19449
+ engineOptions: {
19450
+ lint: input.options.lint,
19451
+ deadCode: input.options.deadCode,
19452
+ includePaths: [...input.options.includePaths].sort(),
19453
+ customRulesOnly: input.options.customRulesOnly,
19454
+ respectInlineDisables: input.options.respectInlineDisables,
19455
+ warnings: input.options.warnings,
19456
+ adoptExistingLintConfig: input.options.adoptExistingLintConfig,
19457
+ ignoredTags: [...input.options.ignoredTags].sort(),
19458
+ concurrency: input.options.concurrency,
19459
+ baselineRef: input.options.baseline?.ref,
19460
+ noScore: input.options.noScore,
19461
+ isCi: input.options.isCi,
19462
+ suppressRendering: input.options.suppressRendering,
19463
+ supplyChainManifestChanged: input.options.supplyChainManifestChanged
19464
+ }
19465
+ });
19466
+ return cacheKeyJson === null ? null : hashString(cacheKeyJson);
19467
+ };
19468
+ const createScanResultCache = (projectDirectory) => {
19469
+ const cacheFilePath = resolveCacheFilePath(projectDirectory);
19470
+ const persistedCache = readPersistedCache(cacheFilePath);
19471
+ const entries = /* @__PURE__ */ new Map();
19472
+ for (const entry of persistedCache.entries) entries.set(entry.key, entry);
19473
+ const persist = () => {
19474
+ writePersistedCache(cacheFilePath, {
19475
+ version: 1,
19476
+ entries: [...entries.values()].sort((firstEntry, secondEntry) => secondEntry.createdAtMs - firstEntry.createdAtMs).slice(0, 20)
19477
+ });
19478
+ };
19479
+ return {
19480
+ lookup: (key) => entries.get(key)?.payload ?? null,
19481
+ store: (key, payload) => {
19482
+ entries.set(key, {
19483
+ key,
19484
+ createdAtMs: Date.now(),
19485
+ payload
19486
+ });
19487
+ persist();
19488
+ }
19489
+ };
19490
+ };
19491
+ const shouldStoreScanPayload = (payload) => !payload.didLintFail && !payload.didDeadCodeFail && payload.lintPartialFailures.length === 0;
19492
+ //#endregion
17242
19493
  //#region src/inspect.ts
17243
19494
  const silentConsole = makeNoopConsole();
17244
19495
  const runConsole = (effect) => {
17245
19496
  Effect.runSync(effect);
17246
19497
  };
19498
+ const recordOnboardingCompletion = (options) => {
19499
+ const forceOnboarding = isOnboardingForced();
19500
+ if (shouldRecordOnboarding({
19501
+ paceOnboardingSections: !options.silent && !options.scoreOnly && !options.suppressRendering && !options.verbose && canAnimateOnboarding(process.stdout) && (forceOnboarding || !hasCompletedOnboarding()),
19502
+ forceOnboarding,
19503
+ verbose: options.verbose,
19504
+ isNonInteractiveEnvironment: options.isNonInteractiveEnvironment
19505
+ })) markOnboardingComplete();
19506
+ };
19507
+ const formatCategorySelection = (categoryFilters) => [...categoryFilters].join(", ");
17247
19508
  const buildIgnoredTags = (userConfig) => {
17248
19509
  const tags = /* @__PURE__ */ new Set();
17249
19510
  if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
@@ -17264,12 +19525,14 @@ const mergeInspectOptions = (inputOptions, userConfig) => ({
17264
19525
  share: userConfig?.share ?? true,
17265
19526
  respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
17266
19527
  warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
19528
+ categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
17267
19529
  adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
17268
19530
  ignoredTags: buildIgnoredTags(userConfig),
17269
19531
  outputSurface: inputOptions.outputSurface ?? "cli",
17270
19532
  suppressRendering: inputOptions.suppressRendering ?? false,
17271
19533
  concurrency: inputOptions.concurrency,
17272
- baseline: inputOptions.baseline ?? null
19534
+ baseline: inputOptions.baseline ?? null,
19535
+ supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
17273
19536
  });
17274
19537
  const buildRunEventConfig = (options, userConfig, hasCustomConfig) => ({
17275
19538
  parallel: options.concurrency !== void 0,
@@ -17371,7 +19634,8 @@ const runBaselineComparison = async (params) => {
17371
19634
  doctorVersion: VERSION,
17372
19635
  runId: getRunId(),
17373
19636
  resolveLocalGithubViewerPermission: false,
17374
- suppressScanSummary: true
19637
+ suppressScanSummary: true,
19638
+ supplyChainManifestChanged: params.options.supplyChainManifestChanged
17375
19639
  }, {});
17376
19640
  const baseOutput = await Effect.runPromise(restoreLegacyThrow(baseProgram.pipe(Effect.provide(baseLayers), Effect.provideService(Console.Console, silentConsole))));
17377
19641
  if (baseOutput.didLintFail) return null;
@@ -17397,6 +19661,40 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
17397
19661
  const isDiffMode = options.includePaths.length > 0;
17398
19662
  const resolvedNodeBinaryPath = await resolveOxlintNode(options.lint, options.scoreOnly || options.silent);
17399
19663
  const lintBindingMissing = options.lint && !resolvedNodeBinaryPath;
19664
+ const cacheKey = buildScanResultCacheKey({
19665
+ projectDirectory: directory,
19666
+ version: VERSION,
19667
+ nodeBinaryPath: resolvedNodeBinaryPath,
19668
+ options,
19669
+ userConfig,
19670
+ hasConfigOverride,
19671
+ configSourceDirectory
19672
+ });
19673
+ const scanResultCache = cacheKey === null ? null : createScanResultCache(directory);
19674
+ const cachedPayload = cacheKey === null ? null : scanResultCache?.lookup(cacheKey) ?? null;
19675
+ if (cachedPayload) {
19676
+ recordSentryProjectContext(cachedPayload.project, rootSentrySpan);
19677
+ recordCount(METRIC.projectDetected, 1);
19678
+ await renderCachedProjectDetection({
19679
+ payload: cachedPayload,
19680
+ options,
19681
+ userConfig,
19682
+ isDiffMode
19683
+ });
19684
+ const baselineDegraded = Boolean(options.baseline) && isDiffMode && cachedPayload.baselineDelta === void 0;
19685
+ const result = await renderAndRecordScan({
19686
+ payload: cachedPayload,
19687
+ options,
19688
+ userConfig,
19689
+ hasCustomConfig: userConfig !== null,
19690
+ startTime,
19691
+ rootSentrySpan,
19692
+ scanMode: cachedPayload.baselineDelta ? "baseline" : isDiffMode ? "diff" : "full",
19693
+ baselineDegraded
19694
+ });
19695
+ recordOnboardingCompletion(options);
19696
+ return result;
19697
+ }
17400
19698
  const shouldShowProgressSpinners = !options.isCiOrCodingAgentEnvironment && !options.silent && !options.scoreOnly && options.lint && Boolean(resolvedNodeBinaryPath);
17401
19699
  const layers = buildRuntimeLayers({
17402
19700
  directory,
@@ -17423,7 +19721,8 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
17423
19721
  doctorVersion: VERSION,
17424
19722
  runId: getRunId(),
17425
19723
  resolveLocalGithubViewerPermission: !options.noScore,
17426
- suppressScanSummary: options.suppressRendering
19724
+ suppressScanSummary: options.suppressRendering,
19725
+ supplyChainManifestChanged: options.supplyChainManifestChanged
17427
19726
  }, { beforeLint: (projectInfo, lintIncludePaths) => Effect.gen(function* () {
17428
19727
  recordSentryProjectContext(projectInfo, rootSentrySpan);
17429
19728
  recordCount(METRIC.projectDetected, 1);
@@ -17462,12 +19761,7 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
17462
19761
  }
17463
19762
  const baselineDegraded = Boolean(options.baseline) && isDiffMode && baselineDelta === void 0;
17464
19763
  const score = didLintFail ? null : output.score;
17465
- const elapsedMilliseconds = performance.now() - startTime;
17466
- const forceOnboarding = isOnboardingForced();
17467
- const paceOnboardingSections = !options.silent && !options.scoreOnly && !options.suppressRendering && !options.verbose && canAnimateOnboarding(process.stdout) && (forceOnboarding || !hasCompletedOnboarding());
17468
- const finalizeInput = {
17469
- options,
17470
- elapsedMilliseconds,
19764
+ const payload = {
17471
19765
  diagnostics: inspectDiagnostics,
17472
19766
  score,
17473
19767
  project: output.project,
@@ -17481,39 +19775,77 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
17481
19775
  scannedFileCount: output.scannedFileCount,
17482
19776
  scannedFilePaths: output.scannedFilePaths,
17483
19777
  scanElapsedMilliseconds: output.scanElapsedMilliseconds,
17484
- baselineDelta
19778
+ baselineDelta,
19779
+ lintFailureReasonKind: lintBindingMissing ? "native-binding-missing" : output.lintFailureReasonKind
17485
19780
  };
17486
- const result = await Effect.runPromise(finalizeAndRender(finalizeInput).pipe(options.silent ? Effect.provideService(Console.Console, silentConsole) : (program) => program));
17487
- if (shouldRecordOnboarding({
17488
- paceOnboardingSections,
17489
- forceOnboarding,
17490
- verbose: options.verbose,
17491
- isNonInteractiveEnvironment: options.isNonInteractiveEnvironment
17492
- })) markOnboardingComplete();
17493
- const scanMode = baselineDelta ? "baseline" : isDiffMode ? "diff" : "full";
19781
+ if (cacheKey !== null && scanResultCache !== null && shouldStoreScanPayload(payload)) scanResultCache.store(cacheKey, payload);
19782
+ const result = await renderAndRecordScan({
19783
+ payload,
19784
+ options,
19785
+ userConfig,
19786
+ hasCustomConfig: userConfig !== null,
19787
+ startTime,
19788
+ rootSentrySpan,
19789
+ scanMode: baselineDelta ? "baseline" : isDiffMode ? "diff" : "full",
19790
+ baselineDegraded
19791
+ });
19792
+ recordOnboardingCompletion(options);
19793
+ return result;
19794
+ };
19795
+ const runMaybeSilent = (effect, silent) => silent ? effect.pipe(Effect.provideService(Console.Console, silentConsole)) : effect;
19796
+ const renderCachedProjectDetection = async (input) => {
19797
+ if (input.options.scoreOnly || input.options.suppressRendering) return;
19798
+ await Effect.runPromise(runMaybeSilent(printProjectDetection({
19799
+ projectInfo: input.payload.project,
19800
+ userConfig: input.userConfig,
19801
+ isDiffMode: input.isDiffMode,
19802
+ includePaths: input.options.includePaths,
19803
+ lintSourceFileCount: input.payload.scannedFileCount
19804
+ }), input.options.silent));
19805
+ };
19806
+ const renderAndRecordScan = async (input) => {
19807
+ const finalizeInput = {
19808
+ options: input.options,
19809
+ elapsedMilliseconds: performance.now() - input.startTime,
19810
+ diagnostics: input.payload.diagnostics,
19811
+ score: input.payload.score,
19812
+ project: input.payload.project,
19813
+ userConfig: input.payload.userConfig,
19814
+ didLintFail: input.payload.didLintFail,
19815
+ lintFailureReason: input.payload.lintFailureReason,
19816
+ lintPartialFailures: input.payload.lintPartialFailures,
19817
+ didDeadCodeFail: input.payload.didDeadCodeFail,
19818
+ deadCodeFailureReason: input.payload.deadCodeFailureReason,
19819
+ directory: input.payload.directory,
19820
+ scannedFileCount: input.payload.scannedFileCount,
19821
+ scannedFilePaths: input.payload.scannedFilePaths,
19822
+ scanElapsedMilliseconds: input.payload.scanElapsedMilliseconds,
19823
+ baselineDelta: input.payload.baselineDelta
19824
+ };
19825
+ const result = await Effect.runPromise(runMaybeSilent(finalizeAndRender(finalizeInput), input.options.silent));
17494
19826
  recordScanMetrics({
17495
19827
  result,
17496
- mode: scanMode,
17497
- baselineDegraded,
17498
- parallel: options.concurrency !== void 0,
17499
- workerCount: options.concurrency,
17500
- lint: options.lint,
17501
- deadCode: options.deadCode,
17502
- scoreOnly: options.scoreOnly,
17503
- noScore: options.noScore,
17504
- didLintFail,
17505
- lintFailureReasonKind: lintBindingMissing ? "native-binding-missing" : output.lintFailureReasonKind,
17506
- didDeadCodeFail: output.didDeadCodeFail
19828
+ mode: input.scanMode,
19829
+ baselineDegraded: input.baselineDegraded,
19830
+ parallel: input.options.concurrency !== void 0,
19831
+ workerCount: input.options.concurrency,
19832
+ lint: input.options.lint,
19833
+ deadCode: input.options.deadCode,
19834
+ scoreOnly: input.options.scoreOnly,
19835
+ noScore: input.options.noScore,
19836
+ didLintFail: input.payload.didLintFail,
19837
+ lintFailureReasonKind: input.payload.lintFailureReasonKind,
19838
+ didDeadCodeFail: input.payload.didDeadCodeFail
17507
19839
  });
17508
- recordRunEvent(rootSentrySpan, {
17509
- ...buildRunEventConfig(options, userConfig, userConfig !== null),
19840
+ recordRunEvent(input.rootSentrySpan, {
19841
+ ...buildRunEventConfig(input.options, input.userConfig, input.hasCustomConfig),
17510
19842
  result,
17511
- mode: scanMode,
17512
- gateExempt: baselineDegraded,
17513
- didLintFail,
17514
- lintFailureReasonKind: lintBindingMissing ? "native-binding-missing" : output.lintFailureReasonKind,
17515
- lintPartialFailureCount: output.lintPartialFailures.length,
17516
- didDeadCodeFail: output.didDeadCodeFail
19843
+ mode: input.scanMode,
19844
+ gateExempt: input.baselineDegraded,
19845
+ didLintFail: input.payload.didLintFail,
19846
+ lintFailureReasonKind: input.payload.lintFailureReasonKind,
19847
+ lintPartialFailureCount: input.payload.lintPartialFailures.length,
19848
+ didDeadCodeFail: input.payload.didDeadCodeFail
17517
19849
  });
17518
19850
  return result;
17519
19851
  };
@@ -17549,14 +19881,16 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
17549
19881
  const animateRender = !options.silent && !options.verbose && canAnimateOnboarding(process.stdout);
17550
19882
  const pause = onboardingSectionPause(animateRender);
17551
19883
  const surfaceDiagnostics = filterDiagnosticsForSurface([...diagnostics], options.outputSurface, userConfig);
19884
+ const printedDiagnostics = filterDiagnosticsByCategories(surfaceDiagnostics, options.categoryFilters);
17552
19885
  const demotedDiagnosticCount = diagnostics.length - surfaceDiagnostics.length;
17553
19886
  const lintSourceFileCount = options.includePaths.length > 0 ? options.includePaths.length : project.sourceFileCount;
17554
- if (surfaceDiagnostics.length === 0) {
19887
+ if (printedDiagnostics.length === 0) {
17555
19888
  yield* pause;
17556
19889
  if (hasSkippedChecks) {
17557
19890
  const skippedLabel = skippedChecks.join(" and ");
17558
19891
  yield* Console.warn(highlighter.warn(`No issues detected, but ${skippedLabel} checks failed — results are incomplete.`));
17559
- } else if (demotedDiagnosticCount > 0) yield* Console.log(highlighter.success(`No issues found! (${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface — see config.surfaces.)`));
19892
+ } else if (options.categoryFilters.size > 0) yield* Console.log(highlighter.success(`No issues found in category ${formatCategorySelection(options.categoryFilters)}!`));
19893
+ else if (demotedDiagnosticCount > 0) yield* Console.log(highlighter.success(`No issues found! (${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface — see config.surfaces.)`));
17560
19894
  else yield* Console.log(highlighter.success("No issues found!"));
17561
19895
  yield* Console.log("");
17562
19896
  yield* pause;
@@ -17569,20 +19903,20 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
17569
19903
  }
17570
19904
  yield* pause;
17571
19905
  yield* Console.log("");
17572
- yield* printDiagnostics([...surfaceDiagnostics], options.verbose, directory, buildRulePriorityMap([score]), isCodingAgentEnvironment(), {
19906
+ yield* printDiagnostics([...printedDiagnostics], options.verbose, directory, buildRulePriorityMap([score]), isCodingAgentEnvironment(), {
17573
19907
  sectionPause: pause,
17574
19908
  animateCountUp: animateRender
17575
19909
  });
17576
19910
  if (options.isNonInteractiveEnvironment && options.outputSurface !== "prComment") yield* printAgentGuidance();
17577
- if (demotedDiagnosticCount > 0) {
19911
+ if (options.categoryFilters.size === 0 && demotedDiagnosticCount > 0) {
17578
19912
  yield* Console.log(highlighter.gray(` ${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface (e.g. design cleanup) — run \`npx react-doctor@latest .\` locally for the full list.`));
17579
19913
  yield* Console.log("");
17580
19914
  }
17581
- const potentialScore = score ? yield* Effect.promise(() => computeProjectedScore([...surfaceDiagnostics], [...surfaceDiagnostics], score)) : null;
19915
+ const potentialScore = score ? yield* Effect.promise(() => computeProjectedScore([...printedDiagnostics], [...surfaceDiagnostics], score)) : null;
17582
19916
  const shouldShowShareLink = !options.noScore && options.share && !options.isCi;
17583
19917
  yield* pause;
17584
19918
  yield* printSummary({
17585
- diagnostics: [...surfaceDiagnostics],
19919
+ diagnostics: [...printedDiagnostics],
17586
19920
  elapsedMilliseconds,
17587
19921
  scoreResult: score,
17588
19922
  potentialScore,
@@ -17598,7 +19932,7 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
17598
19932
  }
17599
19933
  yield* pause;
17600
19934
  yield* printFooter({
17601
- diagnostics: [...surfaceDiagnostics],
19935
+ diagnostics: [...printedDiagnostics],
17602
19936
  scoreResult: score,
17603
19937
  projectName: project.projectName,
17604
19938
  isOffline: !shouldShowShareLink
@@ -17729,21 +20063,6 @@ const handleUserError = (error, options = {}) => {
17729
20063
  process.exitCode = 1;
17730
20064
  };
17731
20065
  //#endregion
17732
- //#region src/cli/utils/cli-input-error.ts
17733
- /**
17734
- * A mistake in *how the CLI was invoked* — a malformed `<file>:<line>`
17735
- * argument, mutually exclusive flags, or an unknown `--project` name. This is
17736
- * user input, not a react-doctor bug, so `isExpectedUserError` routes it
17737
- * through `handleUserError`: a clean, single-line message with no Sentry
17738
- * report and no "Something went wrong, open a prefilled issue" block.
17739
- *
17740
- * The `message` is rendered verbatim, so it must read as a complete,
17741
- * human-readable sentence that tells the user how to fix their invocation.
17742
- */
17743
- var CliInputError = class extends Error {
17744
- name = "CliInputError";
17745
- };
17746
- //#endregion
17747
20066
  //#region src/cli/utils/is-expected-user-error.ts
17748
20067
  /**
17749
20068
  * Whether `error` is an expected, user-actionable failure — the user's project
@@ -19932,8 +22251,9 @@ const findLowestScoredScan = (completedScans) => {
19932
22251
  };
19933
22252
  const printMultiProjectSummary = (input) => Effect.gen(function* () {
19934
22253
  const { completedScans, userConfig, verbose, isOffline, projectName } = input;
22254
+ const categoryFilters = input.categoryFilters ?? /* @__PURE__ */ new Set();
19935
22255
  const animateRender = !verbose && canAnimateOnboarding(process.stdout);
19936
- const surfaceDiagnostics = filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig);
22256
+ const displayDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig), categoryFilters);
19937
22257
  const projectRootByDiagnostic = /* @__PURE__ */ new WeakMap();
19938
22258
  for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
19939
22259
  const resolveDiagnosticSourceRoot = (diagnostic) => projectRootByDiagnostic.get(diagnostic) ?? "";
@@ -19947,29 +22267,30 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
19947
22267
  const totalScannedFileCount = uniqueScannedFilePaths.size + fileCountFromScansWithoutPaths;
19948
22268
  const totalScanElapsedMilliseconds = completedScans.reduce((sum, scan) => sum + (scan.result.scanElapsedMilliseconds ?? scan.result.elapsedMilliseconds), 0);
19949
22269
  yield* Console.log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalScanElapsedMilliseconds)}`);
19950
- if (surfaceDiagnostics.length > 0) {
22270
+ if (displayDiagnostics.length > 0) {
19951
22271
  yield* Console.log("");
19952
- yield* printDiagnostics(surfaceDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender });
22272
+ yield* printDiagnostics(displayDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender });
19953
22273
  }
19954
22274
  const lowestScoredScan = findLowestScoredScan(completedScans);
19955
22275
  const aggregateScore = lowestScoredScan?.result.score ?? null;
19956
22276
  const totalSourceFileCount = completedScans.reduce((sum, scan) => sum + scan.result.project.sourceFileCount, 0);
19957
22277
  yield* printSummary({
19958
- diagnostics: surfaceDiagnostics,
22278
+ diagnostics: displayDiagnostics,
19959
22279
  elapsedMilliseconds: completedScans.reduce((sum, scan) => sum + scan.result.elapsedMilliseconds, 0),
19960
22280
  scoreResult: aggregateScore,
19961
- potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(surfaceDiagnostics, lowestScoredScan.result.diagnostics, lowestScoredScan.result.score)) : null,
22281
+ potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(displayDiagnostics, filterDiagnosticsForSurface(lowestScoredScan.result.diagnostics, "cli", userConfig), lowestScoredScan.result.score)) : null,
19962
22282
  totalSourceFileCount,
19963
22283
  noScoreMessage: "Score unavailable.",
19964
22284
  verbose,
19965
22285
  animateProjection: animateRender
19966
22286
  });
19967
22287
  const entries = completedScans.map((scan) => {
19968
- const errorCount = scan.result.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
22288
+ const projectDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface([...scan.result.diagnostics], "cli", userConfig), categoryFilters);
22289
+ const errorCount = projectDiagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
19969
22290
  return {
19970
22291
  projectName: scan.result.project.projectName,
19971
22292
  score: scan.result.score?.score ?? null,
19972
- issueCount: scan.result.diagnostics.length,
22293
+ issueCount: projectDiagnostics.length,
19973
22294
  errorCount
19974
22295
  };
19975
22296
  });
@@ -19977,7 +22298,7 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
19977
22298
  yield* Console.log("");
19978
22299
  for (const entry of entries) yield* Console.log(buildSummaryLine(entry, longestProjectNameLength));
19979
22300
  yield* printFooter({
19980
- diagnostics: surfaceDiagnostics,
22301
+ diagnostics: displayDiagnostics,
19981
22302
  scoreResult: aggregateScore,
19982
22303
  projectName,
19983
22304
  isOffline
@@ -20067,7 +22388,8 @@ const resolveCliInspectOptions = (flags, userConfig) => {
20067
22388
  noScore: flags.score === false || flags.telemetry === false || (userConfig?.noScore ?? false),
20068
22389
  isCi: isCiEnvironment(),
20069
22390
  silent: Boolean(flags.json),
20070
- concurrency: resolveParallelFlag(flags.parallel)
22391
+ concurrency: resolveParallelFlag(flags.parallel),
22392
+ categoryFilters: resolveCliCategories(flags.category)
20071
22393
  };
20072
22394
  };
20073
22395
  //#endregion
@@ -20121,13 +22443,28 @@ const coerceDiffValue = (value) => {
20121
22443
  //#region src/cli/utils/resolve-effective-diff.ts
20122
22444
  const resolveEffectiveDiff = (flags, userConfig) => coerceDiffValue(flags.diff ?? userConfig?.diff);
20123
22445
  //#endregion
22446
+ //#region src/cli/utils/resolve-project-relative-directory.ts
22447
+ /**
22448
+ * The scanned project's directory relative to the diff root, forward-slashed —
22449
+ * or `null` when the project resolves outside the root (a `..` segment or an
22450
+ * absolute path, neither of which can be matched against repo-relative changed
22451
+ * files). An empty string means the project *is* the diff root. Shared by the
22452
+ * diff helpers that map changed files to a workspace (`resolveProjectDiffIncludePaths`,
22453
+ * `projectManifestChanged`) so the boundary rule lives in one place.
22454
+ */
22455
+ const resolveProjectRelativeDirectory = (rootDirectory, projectDirectory) => {
22456
+ const relativeProjectDirectory = toForwardSlashes(path$1.relative(rootDirectory, projectDirectory));
22457
+ if (relativeProjectDirectory === ".." || relativeProjectDirectory.startsWith("../")) return null;
22458
+ if (path$1.isAbsolute(relativeProjectDirectory)) return null;
22459
+ return relativeProjectDirectory;
22460
+ };
22461
+ //#endregion
20124
22462
  //#region src/cli/utils/resolve-project-diff-include-paths.ts
20125
22463
  const resolveProjectDiffIncludePaths = (rootDirectory, projectDirectory, diffInfo) => {
22464
+ const relativeProjectDirectory = resolveProjectRelativeDirectory(rootDirectory, projectDirectory);
22465
+ if (relativeProjectDirectory === null) return [];
20126
22466
  const changedSourceFiles = filterSourceFiles(diffInfo.changedFiles);
20127
- const relativeProjectDirectory = toForwardSlashes(path$1.relative(rootDirectory, projectDirectory));
20128
22467
  if (relativeProjectDirectory.length === 0) return changedSourceFiles;
20129
- if (relativeProjectDirectory.startsWith("../") || relativeProjectDirectory === "..") return [];
20130
- if (path$1.isAbsolute(relativeProjectDirectory)) return [];
20131
22468
  const projectPrefix = `${relativeProjectDirectory}/`;
20132
22469
  return changedSourceFiles.flatMap((filePath) => {
20133
22470
  const normalizedFilePath = toForwardSlashes(filePath);
@@ -20300,6 +22637,63 @@ const runExplain = async (fileLineArgument, context) => {
20300
22637
  }
20301
22638
  };
20302
22639
  //#endregion
22640
+ //#region src/cli/utils/project-manifest-changed.ts
22641
+ const PACKAGE_JSON = "package.json";
22642
+ /**
22643
+ * True when the scanned project's own `package.json` is among the diff's
22644
+ * changed files. Shares `resolveProjectRelativeDirectory`'s boundary handling
22645
+ * with `resolveProjectDiffIncludePaths` so a workspace package matches only
22646
+ * its own manifest (not the monorepo root's or a sibling's) — which is exactly
22647
+ * what that project's per-project supply-chain check scores.
22648
+ */
22649
+ const projectManifestChanged = (rootDirectory, projectDirectory, diffInfo) => {
22650
+ const relativeProjectDirectory = resolveProjectRelativeDirectory(rootDirectory, projectDirectory);
22651
+ if (relativeProjectDirectory === null) return false;
22652
+ const manifestPath = relativeProjectDirectory.length === 0 ? PACKAGE_JSON : `${relativeProjectDirectory}/${PACKAGE_JSON}`;
22653
+ return diffInfo.changedFiles.some((filePath) => toForwardSlashes(filePath) === manifestPath);
22654
+ };
22655
+ //#endregion
22656
+ //#region src/cli/utils/render-supply-chain-scores.ts
22657
+ const scoreLabel = (score) => {
22658
+ if (score >= 75) return "Healthy";
22659
+ if (score >= 50) return "Review";
22660
+ return "At risk";
22661
+ };
22662
+ const byRiskThenName = (left, right) => {
22663
+ if (left.overall === null) return right.overall === null ? 0 : 1;
22664
+ if (right.overall === null) return -1;
22665
+ if (left.overall !== right.overall) return left.overall - right.overall;
22666
+ return left.name.localeCompare(right.name);
22667
+ };
22668
+ /**
22669
+ * Renders the `--sfw` demo table: every direct dependency with its Socket.dev
22670
+ * supply-chain score (0–100), color-coded and labelled. Pure string builder —
22671
+ * the command prints the result through `cliLogger`.
22672
+ */
22673
+ const renderSupplyChainScores = (rows) => {
22674
+ if (rows.length === 0) return highlighter.dim(" No direct dependencies found in package.json.");
22675
+ const sorted = [...rows].sort(byRiskThenName);
22676
+ const nameWidth = Math.max(...sorted.map((row) => row.name.length));
22677
+ const versionWidth = Math.max(...sorted.map((row) => row.version.length));
22678
+ const lines = [
22679
+ highlighter.bold(" Socket supply-chain scores"),
22680
+ highlighter.dim(` ${rows.length} ${rows.length === 1 ? "dependency" : "dependencies"}`),
22681
+ ""
22682
+ ];
22683
+ for (const row of sorted) {
22684
+ const paddedName = row.name.padEnd(nameWidth);
22685
+ const paddedVersion = row.version.padEnd(versionWidth);
22686
+ if (row.overall === null) {
22687
+ lines.push(` ${highlighter.dim(paddedName)} ${highlighter.dim(paddedVersion)} ${highlighter.dim(" — no score")}`);
22688
+ continue;
22689
+ }
22690
+ const score = colorizeByScore(String(row.overall).padStart(3), row.overall);
22691
+ const label = colorizeByScore(scoreLabel(row.overall), row.overall);
22692
+ lines.push(` ${paddedName} ${highlighter.dim(paddedVersion)} ${score} ${label}`);
22693
+ }
22694
+ return lines.join("\n");
22695
+ };
22696
+ //#endregion
20303
22697
  //#region src/cli/utils/warn-deprecated-fail-on.ts
20304
22698
  const warnDeprecatedFailOn = (flags, userConfig) => {
20305
22699
  const usedFlag = flags.failOn !== void 0;
@@ -20317,9 +22711,28 @@ const validateModeFlags = (flags) => {
20317
22711
  if (exclusiveModes.length > 1) throw new CliInputError(`Cannot combine ${exclusiveModes.join(" and ")}; pick one mode.`);
20318
22712
  if (flags.score && flags.json) throw new CliInputError("Cannot combine --score and --json; pick one output mode.");
20319
22713
  if (flags.score && flags.telemetry === false) throw new CliInputError("Cannot combine --score with --no-telemetry; --score prints the score that --no-telemetry disables.");
22714
+ if (flags.sfw) {
22715
+ const conflictingFlag = [
22716
+ flags.json ? "--json" : null,
22717
+ flags.score ? "--score" : null,
22718
+ flags.staged ? "--staged" : null,
22719
+ coercedDiff !== void 0 && coercedDiff !== false ? "--diff" : null
22720
+ ].find((name) => name !== null);
22721
+ if (conflictingFlag) throw new CliInputError(`Cannot combine --sfw with ${conflictingFlag}; --sfw is a standalone demo listing.`);
22722
+ }
20320
22723
  };
20321
22724
  //#endregion
20322
22725
  //#region src/cli/commands/inspect.ts
22726
+ const filterCompletedScansByCategories = (completedScans, categoryFilters) => {
22727
+ if (categoryFilters.size === 0) return [...completedScans];
22728
+ return completedScans.map((scan) => ({
22729
+ ...scan,
22730
+ result: {
22731
+ ...scan.result,
22732
+ diagnostics: filterDiagnosticsByCategories(scan.result.diagnostics, categoryFilters)
22733
+ }
22734
+ }));
22735
+ };
20323
22736
  /**
20324
22737
  * Post-scan finalization shared by the staged-arm and project-loop
20325
22738
  * paths of `inspectAction`: emit the JSON report (when in JSON mode)
@@ -20332,6 +22745,7 @@ const finalizeScans = (input) => {
20332
22745
  const baselineComputed = input.completedScans.length > 0 && input.completedScans.every((scan) => scan.result.baselineDelta !== void 0);
20333
22746
  const baselineDegraded = input.baselineIntended && !baselineComputed;
20334
22747
  const mode = baselineDegraded ? "diff" : input.mode;
22748
+ const jsonCompletedScans = filterCompletedScansByCategories(input.completedScans, input.categoryFilters);
20335
22749
  if (input.isJsonMode) {
20336
22750
  const baseline = baselineComputed && baselineDeltas.length > 0 ? {
20337
22751
  baseRef: baselineDeltas[0].baseRef,
@@ -20343,7 +22757,7 @@ const finalizeScans = (input) => {
20343
22757
  directory: input.resolvedDirectory,
20344
22758
  mode,
20345
22759
  diff: input.diff,
20346
- scans: input.completedScans,
22760
+ scans: jsonCompletedScans,
20347
22761
  totalElapsedMilliseconds: performance.now() - input.startTime,
20348
22762
  baseline
20349
22763
  }));
@@ -20412,11 +22826,24 @@ const inspectAction = async (directory, flags) => {
20412
22826
  });
20413
22827
  return;
20414
22828
  }
22829
+ if (flags.sfw) {
22830
+ const sfwSpinner = spinner("Scoring dependencies against Socket.dev…").start();
22831
+ const scores = await Effect.runPromise(collectSupplyChainScores({
22832
+ rootDirectory: resolvedDirectory,
22833
+ userConfig
22834
+ }));
22835
+ sfwSpinner.stop();
22836
+ cliLogger.break();
22837
+ cliLogger.log(renderSupplyChainScores(scores));
22838
+ cliLogger.break();
22839
+ return;
22840
+ }
20415
22841
  if (!isQuiet) if (!flags.verbose && canAnimateOnboarding(process.stdout)) {
20416
22842
  const isReturningUser = !isOnboardingForced() && hasCompletedOnboarding();
20417
22843
  await Effect.runPromise(playWelcomeScene({ speedMultiplier: isReturningUser ? 2 : 1 }));
20418
22844
  } else Effect.runSync(printBrandedHeader);
20419
22845
  const scanOptions = resolveCliInspectOptions(flags, userConfig);
22846
+ const categoryFilters = new Set(scanOptions.categoryFilters ?? []);
20420
22847
  const skipPrompts = shouldSkipPrompts({
20421
22848
  yes: flags.yes,
20422
22849
  json: flags.json
@@ -20477,6 +22904,7 @@ const inspectAction = async (directory, flags) => {
20477
22904
  isJsonMode,
20478
22905
  isScoreOnly,
20479
22906
  flags,
22907
+ categoryFilters,
20480
22908
  userConfig,
20481
22909
  resolvedDirectory,
20482
22910
  startTime
@@ -20504,18 +22932,22 @@ const inspectAction = async (directory, flags) => {
20504
22932
  const allDiagnostics = [];
20505
22933
  const completedScans = [];
20506
22934
  const isMultiProject = projectDirectories.length > 1;
22935
+ const supplyChainEnabled = userConfig?.supplyChain?.enabled !== false;
20507
22936
  for (const projectDirectory of projectDirectories) {
20508
22937
  let includePaths;
22938
+ let supplyChainManifestChanged = false;
20509
22939
  if (isDiffMode) {
20510
22940
  const changedSourceFiles = diffInfo === null ? [] : resolveProjectDiffIncludePaths(resolvedDirectory, projectDirectory, diffInfo);
20511
- if (changedSourceFiles.length === 0) {
22941
+ supplyChainManifestChanged = supplyChainEnabled && diffInfo !== null && projectManifestChanged(resolvedDirectory, projectDirectory, diffInfo);
22942
+ if (changedSourceFiles.length === 0 && !supplyChainManifestChanged) {
20512
22943
  if (!isQuiet) {
20513
22944
  cliLogger.dim(`No changed source files in ${projectDirectory}, skipping.`);
20514
22945
  cliLogger.break();
20515
22946
  }
20516
22947
  continue;
20517
22948
  }
20518
- includePaths = changedSourceFiles;
22949
+ includePaths = [...changedSourceFiles];
22950
+ if (supplyChainManifestChanged) includePaths.push("package.json");
20519
22951
  }
20520
22952
  if (!isQuiet && !isMultiProject) cliLogger.dim(" ");
20521
22953
  const scanResult = await inspect(projectDirectory, {
@@ -20523,7 +22955,8 @@ const inspectAction = async (directory, flags) => {
20523
22955
  includePaths,
20524
22956
  configOverride: userConfig,
20525
22957
  suppressRendering: isMultiProject,
20526
- baseline: baselineRef ? { ref: baselineRef } : void 0
22958
+ baseline: baselineRef ? { ref: baselineRef } : void 0,
22959
+ supplyChainManifestChanged
20527
22960
  });
20528
22961
  allDiagnostics.push(...scanResult.diagnostics);
20529
22962
  completedScans.push({
@@ -20536,6 +22969,7 @@ const inspectAction = async (directory, flags) => {
20536
22969
  const shouldShowShareLink = !scanOptions.noScore && (userConfig?.share ?? true) && !scanOptions.isCi;
20537
22970
  await Effect.runPromise(printMultiProjectSummary({
20538
22971
  completedScans,
22972
+ categoryFilters,
20539
22973
  userConfig,
20540
22974
  verbose: Boolean(flags.verbose),
20541
22975
  isOffline: !shouldShowShareLink,
@@ -20551,14 +22985,15 @@ const inspectAction = async (directory, flags) => {
20551
22985
  isJsonMode,
20552
22986
  isScoreOnly,
20553
22987
  flags,
22988
+ categoryFilters,
20554
22989
  userConfig,
20555
22990
  resolvedDirectory,
20556
22991
  startTime
20557
22992
  });
20558
- const surfaceDiagnostics = filterDiagnosticsForSurface(allDiagnostics, scanOptions.outputSurface ?? "cli", userConfig);
20559
- if (!isQuiet && !skipPrompts && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment() && surfaceDiagnostics.length > 0) {
22993
+ const selectedSurfaceDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface(allDiagnostics, scanOptions.outputSurface ?? "cli", userConfig), categoryFilters);
22994
+ if (!isQuiet && !skipPrompts && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment() && selectedSurfaceDiagnostics.length > 0) {
20560
22995
  await handoffToAgent({
20561
- diagnostics: surfaceDiagnostics,
22996
+ diagnostics: selectedSurfaceDiagnostics,
20562
22997
  projectName: path$1.basename(resolvedDirectory),
20563
22998
  rootDirectory: resolvedDirectory,
20564
22999
  interactive: true
@@ -20989,7 +23424,7 @@ const rulesListAction = async (options) => {
20989
23424
  });
20990
23425
  const catalog = buildRuleCatalog();
20991
23426
  const config = validateConfigTypes((await resolveRuleConfigTarget(resolveProjectRoot(options))).config);
20992
- const categoryFilter = options.category?.toLowerCase();
23427
+ const categoryFilter = typeof options.category === "string" ? options.category.toLowerCase() : void 0;
20993
23428
  const frameworkFilter = options.framework?.toLowerCase();
20994
23429
  const rows = catalog.filter((entry) => {
20995
23430
  if (categoryFilter && entry.category.toLowerCase() !== categoryFilter) return false;
@@ -21345,6 +23780,7 @@ const ROOT_FLAG_SPEC = {
21345
23780
  "--no-telemetry",
21346
23781
  "--no-warnings",
21347
23782
  "--score",
23783
+ "--sfw",
21348
23784
  "--staged",
21349
23785
  "--verbose",
21350
23786
  "--version",
@@ -21352,6 +23788,7 @@ const ROOT_FLAG_SPEC = {
21352
23788
  "--yes"
21353
23789
  ]),
21354
23790
  longOptionsWithRequiredValues: new Set([
23791
+ "--category",
21355
23792
  "--changed-files-from",
21356
23793
  "--blocking",
21357
23794
  "--fail-on",
@@ -21508,6 +23945,7 @@ ${formatExampleLines([
21508
23945
  ["react-doctor ./apps/web", "scan a specific directory"],
21509
23946
  ["react-doctor --diff main", "scan only files changed vs. main"],
21510
23947
  ["react-doctor --staged", "scan staged files (pre-commit hook)"],
23948
+ ["react-doctor --category Security", "show only one diagnostic category"],
21511
23949
  ["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
21512
23950
  ["react-doctor --json > report.json", "write a machine-readable report"],
21513
23951
  ["react-doctor why src/App.tsx:42", "explain why a rule fired there"],
@@ -21536,7 +23974,8 @@ ${formatExampleLines([
21536
23974
  ${highlighter.dim("Learn more:")}
21537
23975
  ${highlighter.info(CANONICAL_GITHUB_URL)}
21538
23976
  `;
21539
- const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select workspace project (comma-separated for multiple)").option("--diff [base]", "scan only files changed vs base branch (pass `false` to force a full scan, overriding config)").addOption(new Option$1("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option$1("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
23977
+ const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
23978
+ const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select workspace project (comma-separated for multiple)").option("--diff [base]", "scan only files changed vs base branch (pass `false` to force a full scan, overriding config)").addOption(new Option$1("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").addOption(new Option$1("--category <category>", "only show diagnostics in a category (repeatable; e.g. Security)").argParser(collectCategoryOption)).option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option$1("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--sfw", "demo: print the Socket.dev supply-chain score of every direct dependency, then exit").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
21540
23979
  program.action(inspectAction);
21541
23980
  program.command("why <location>").description("Explain why a rule fired (or why a suppression didn't apply) at a file:line").option("--project <name>", "select workspace project (comma-separated for multiple)").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").action((location, options) => whyAction(location, options));
21542
23981
  program.command("install").alias("setup").description("Install the react-doctor skill into your coding agents and optional git hook").option("-y, --yes", "skip prompts, install for all detected agents").option("--dry-run", "show what would be installed without writing files").option("--agent-hooks", "install native non-blocking agent hooks for Claude Code and Cursor").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderInstallHelpEpilog).action(installAction);
@@ -21579,4 +24018,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
21579
24018
  export {};
21580
24019
 
21581
24020
  //# sourceMappingURL=cli.js.map
21582
- //# debugId=e1ad7784-a0ce-584d-ae5f-d37a821e4c57
24021
+ //# debugId=b818de08-3056-5722-a734-180e56f0923b