react-doctor 0.2.18-dev.f375dbb → 0.3.0-dev.7593271

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/index.js CHANGED
@@ -1,10 +1,10 @@
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]="9b91fa51-6642-5351-a848-af91945dec6f")}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]="44e73f8d-b81f-599b-a04e-22497cd72bb2")}catch(e){}}();
3
3
  import { createRequire } from "node:module";
4
4
  import * as Schema from "effect/Schema";
5
5
  import * as fs$1 from "node:fs";
6
- import fs, { existsSync, readFileSync, readdirSync } from "node:fs";
7
- import * as Path from "node:path";
6
+ import fs from "node:fs";
7
+ import * as path$1 from "node:path";
8
8
  import path from "node:path";
9
9
  import { spawn, spawnSync } from "node:child_process";
10
10
  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";
@@ -33,6 +33,7 @@ import * as ChildProcess from "effect/unstable/process/ChildProcess";
33
33
  import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
34
34
  import * as ts from "typescript";
35
35
  import { gzipSync } from "node:zlib";
36
+ import "effect/Exit";
36
37
  //#region \0rolldown/runtime.js
37
38
  var __create$1 = Object.create;
38
39
  var __defProp$1 = Object.defineProperty;
@@ -58,6 +59,16 @@ var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(
58
59
  //#endregion
59
60
  //#region ../core/dist/schemas.js
60
61
  const Severity = Schema.Literals(["error", "warning"]);
62
+ var DiagnosticRelatedLocation = class extends Schema.Class("DiagnosticRelatedLocation")({
63
+ filePath: Schema.String,
64
+ line: Schema.Number,
65
+ column: Schema.Number,
66
+ offset: Schema.optional(Schema.Number),
67
+ length: Schema.optional(Schema.Number),
68
+ endLine: Schema.optional(Schema.Number),
69
+ endColumn: Schema.optional(Schema.Number),
70
+ message: Schema.String
71
+ }) {};
61
72
  var Diagnostic = class extends Schema.Class("Diagnostic")({
62
73
  filePath: Schema.String,
63
74
  plugin: Schema.String,
@@ -69,13 +80,19 @@ var Diagnostic = class extends Schema.Class("Diagnostic")({
69
80
  url: Schema.optional(Schema.String),
70
81
  line: Schema.Number,
71
82
  column: Schema.Number,
83
+ offset: Schema.optional(Schema.Number),
84
+ length: Schema.optional(Schema.Number),
85
+ endLine: Schema.optional(Schema.Number),
86
+ endColumn: Schema.optional(Schema.Number),
72
87
  category: Schema.String,
73
- suppressionHint: Schema.optional(Schema.String)
88
+ suppressionHint: Schema.optional(Schema.String),
89
+ relatedLocations: Schema.optional(Schema.Array(DiagnosticRelatedLocation))
74
90
  }) {};
75
91
  const JsonReportMode = Schema.Literals([
76
92
  "full",
77
93
  "diff",
78
- "staged"
94
+ "staged",
95
+ "baseline"
79
96
  ]);
80
97
  var JsonReportSummary = class extends Schema.Class("JsonReportSummary")({
81
98
  errorCount: Schema.Number,
@@ -94,7 +111,9 @@ var JsonReportDiffInfo = class extends Schema.Class("JsonReportDiffInfo")({
94
111
  var JsonReportError = class extends Schema.Class("JsonReportError")({
95
112
  message: Schema.String,
96
113
  name: Schema.String,
97
- chain: Schema.Array(Schema.String)
114
+ chain: Schema.Array(Schema.String),
115
+ /** Sentry event id for the crash, when one was reported. */
116
+ sentryEventId: Schema.optional(Schema.NullOr(Schema.String))
98
117
  }) {};
99
118
  /**
100
119
  * Schema for a single project entry within a JsonReport. `project` is
@@ -131,7 +150,33 @@ var JsonReportV1 = class extends Schema.Class("JsonReportV1")({
131
150
  elapsedMilliseconds: Schema.Number,
132
151
  error: Schema.NullOr(JsonReportError)
133
152
  }) {};
134
- Schema.Union([JsonReportV1]);
153
+ var JsonReportBaseline = class extends Schema.Class("JsonReportBaseline")({
154
+ baseRef: Schema.String,
155
+ newCount: Schema.Number,
156
+ fixedCount: Schema.Number,
157
+ baseTotalCount: Schema.Number
158
+ }) {};
159
+ /**
160
+ * Baseline (PR-introduced-issues-only) report — `schemaVersion: 2`. A
161
+ * superset of v1: same fields, plus a `baseline` block. `diagnostics` /
162
+ * `summary` counts are the introduced findings only; `summary.score` stays
163
+ * the head project-health score. Consumers branch on `schemaVersion`.
164
+ */
165
+ var JsonReportV2 = class extends Schema.Class("JsonReportV2")({
166
+ schemaVersion: Schema.Literal(2),
167
+ version: Schema.String,
168
+ ok: Schema.Boolean,
169
+ directory: Schema.String,
170
+ mode: JsonReportMode,
171
+ diff: Schema.NullOr(JsonReportDiffInfo),
172
+ baseline: JsonReportBaseline,
173
+ projects: Schema.Array(JsonReportProjectEntry),
174
+ diagnostics: Schema.Array(Diagnostic),
175
+ summary: JsonReportSummary,
176
+ elapsedMilliseconds: Schema.Number,
177
+ error: Schema.NullOr(JsonReportError)
178
+ }) {};
179
+ Schema.Union([JsonReportV1, JsonReportV2]);
135
180
  //#endregion
136
181
  //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
137
182
  var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
@@ -2075,7 +2120,7 @@ var AmbiguousProjectError = class extends Error {
2075
2120
  const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
2076
2121
  const isFile = (filePath) => {
2077
2122
  try {
2078
- return fs.statSync(filePath).isFile();
2123
+ return fs$1.statSync(filePath).isFile();
2079
2124
  } catch {
2080
2125
  return false;
2081
2126
  }
@@ -2102,9 +2147,9 @@ const isLintableSourceFile = (filePath) => SOURCE_FILE_PATTERN.test(filePath) &&
2102
2147
  const isMinifiedSource = (absolutePath) => {
2103
2148
  let fileDescriptor;
2104
2149
  try {
2105
- fileDescriptor = fs.openSync(absolutePath, "r");
2150
+ fileDescriptor = fs$1.openSync(absolutePath, "r");
2106
2151
  const buffer = Buffer.alloc(MINIFIED_SNIFF_BYTES);
2107
- const bytesRead = fs.readSync(fileDescriptor, buffer, 0, MINIFIED_SNIFF_BYTES, 0);
2152
+ const bytesRead = fs$1.readSync(fileDescriptor, buffer, 0, MINIFIED_SNIFF_BYTES, 0);
2108
2153
  const prefix = buffer.toString("utf8", 0, bytesRead);
2109
2154
  const lines = prefix.split("\n");
2110
2155
  const longestLineLength = lines.reduce((longest, line) => Math.max(longest, line.length), 0);
@@ -2113,13 +2158,13 @@ const isMinifiedSource = (absolutePath) => {
2113
2158
  } catch {
2114
2159
  return false;
2115
2160
  } finally {
2116
- if (fileDescriptor !== void 0) fs.closeSync(fileDescriptor);
2161
+ if (fileDescriptor !== void 0) fs$1.closeSync(fileDescriptor);
2117
2162
  }
2118
2163
  };
2119
2164
  const isLargeMinifiedFile = (absolutePath) => {
2120
2165
  let sizeBytes;
2121
2166
  try {
2122
- sizeBytes = fs.statSync(absolutePath).size;
2167
+ sizeBytes = fs$1.statSync(absolutePath).size;
2123
2168
  } catch {
2124
2169
  return false;
2125
2170
  }
@@ -2130,7 +2175,10 @@ const IGNORABLE_READDIR_ERROR_CODES = new Set([
2130
2175
  "EACCES",
2131
2176
  "EPERM",
2132
2177
  "ENOENT",
2133
- "ENOTDIR"
2178
+ "ENOTDIR",
2179
+ "EINVAL",
2180
+ "ELOOP",
2181
+ "ENAMETOOLONG"
2134
2182
  ]);
2135
2183
  const isIgnorableReaddirError = (error) => {
2136
2184
  if (typeof error !== "object" || error === null) return false;
@@ -2139,7 +2187,7 @@ const isIgnorableReaddirError = (error) => {
2139
2187
  };
2140
2188
  const readDirectoryEntries = (directoryPath) => {
2141
2189
  try {
2142
- return fs.readdirSync(directoryPath, { withFileTypes: true });
2190
+ return fs$1.readdirSync(directoryPath, { withFileTypes: true });
2143
2191
  } catch (error) {
2144
2192
  if (isIgnorableReaddirError(error)) return [];
2145
2193
  throw error;
@@ -2153,10 +2201,10 @@ const countSourceFilesViaFilesystem = (rootDirectory) => {
2153
2201
  const entries = readDirectoryEntries(currentDirectory);
2154
2202
  for (const entry of entries) {
2155
2203
  if (entry.isDirectory()) {
2156
- if (!entry.name.startsWith(".") && !IGNORED_DIRECTORIES.has(entry.name)) stack.push(path.join(currentDirectory, entry.name));
2204
+ if (!entry.name.startsWith(".") && !IGNORED_DIRECTORIES.has(entry.name)) stack.push(path$1.join(currentDirectory, entry.name));
2157
2205
  continue;
2158
2206
  }
2159
- if (entry.isFile() && isLintableSourceFile(entry.name) && !isLargeMinifiedFile(path.join(currentDirectory, entry.name))) count++;
2207
+ if (entry.isFile() && isLintableSourceFile(entry.name) && !isLargeMinifiedFile(path$1.join(currentDirectory, entry.name))) count++;
2160
2208
  }
2161
2209
  }
2162
2210
  return count;
@@ -2174,7 +2222,7 @@ const countSourceFilesViaGit = (rootDirectory) => {
2174
2222
  maxBuffer: GIT_LS_FILES_MAX_BUFFER_BYTES
2175
2223
  });
2176
2224
  if (result.error || result.status !== 0) return null;
2177
- return result.stdout.split("\0").filter((filePath) => filePath.length > 0 && isLintableSourceFile(filePath) && !isLargeMinifiedFile(path.resolve(rootDirectory, filePath))).length;
2225
+ return result.stdout.split("\0").filter((filePath) => filePath.length > 0 && isLintableSourceFile(filePath) && !isLargeMinifiedFile(path$1.resolve(rootDirectory, filePath))).length;
2178
2226
  };
2179
2227
  const countSourceFiles = (rootDirectory) => countSourceFilesViaGit(rootDirectory) ?? countSourceFilesViaFilesystem(rootDirectory);
2180
2228
  const cachedPackageJsons = /* @__PURE__ */ new Map();
@@ -2183,7 +2231,7 @@ const clearPackageJsonCache = () => {
2183
2231
  };
2184
2232
  const readPackageJsonUncached = (packageJsonPath) => {
2185
2233
  try {
2186
- return JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
2234
+ return JSON.parse(fs$1.readFileSync(packageJsonPath, "utf-8"));
2187
2235
  } catch (error) {
2188
2236
  if (error instanceof SyntaxError) return {};
2189
2237
  if (error instanceof Error && "code" in error) {
@@ -2194,7 +2242,7 @@ const readPackageJsonUncached = (packageJsonPath) => {
2194
2242
  }
2195
2243
  };
2196
2244
  const readPackageJson = (packageJsonPath) => {
2197
- const absolutePath = path.resolve(packageJsonPath);
2245
+ const absolutePath = path$1.resolve(packageJsonPath);
2198
2246
  const cached = cachedPackageJsons.get(absolutePath);
2199
2247
  if (cached !== void 0) return cached;
2200
2248
  const result = readPackageJsonUncached(absolutePath);
@@ -2202,18 +2250,18 @@ const readPackageJson = (packageJsonPath) => {
2202
2250
  return result;
2203
2251
  };
2204
2252
  const isMonorepoRoot = (directory) => {
2205
- if (isFile(path.join(directory, "pnpm-workspace.yaml"))) return true;
2206
- if (isFile(path.join(directory, "nx.json"))) return true;
2207
- const packageJsonPath = path.join(directory, "package.json");
2253
+ if (isFile(path$1.join(directory, "pnpm-workspace.yaml"))) return true;
2254
+ if (isFile(path$1.join(directory, "nx.json"))) return true;
2255
+ const packageJsonPath = path$1.join(directory, "package.json");
2208
2256
  if (!isFile(packageJsonPath)) return false;
2209
2257
  const packageJson = readPackageJson(packageJsonPath);
2210
2258
  return Array.isArray(packageJson.workspaces) || Boolean(packageJson.workspaces?.packages);
2211
2259
  };
2212
2260
  const findMonorepoRoot = (startDirectory) => {
2213
- let currentDirectory = path.dirname(startDirectory);
2214
- while (currentDirectory !== path.dirname(currentDirectory)) {
2261
+ let currentDirectory = path$1.dirname(startDirectory);
2262
+ while (currentDirectory !== path$1.dirname(currentDirectory)) {
2215
2263
  if (isMonorepoRoot(currentDirectory)) return currentDirectory;
2216
- currentDirectory = path.dirname(currentDirectory);
2264
+ currentDirectory = path$1.dirname(currentDirectory);
2217
2265
  }
2218
2266
  return null;
2219
2267
  };
@@ -2227,7 +2275,7 @@ const findMonorepoRoot = (startDirectory) => {
2227
2275
  * `detectReactCompiler`. All three previously inlined their own
2228
2276
  * byte-equivalent copy.
2229
2277
  */
2230
- const isProjectBoundary = (directory) => fs.existsSync(path.join(directory, ".git")) || isMonorepoRoot(directory);
2278
+ const isProjectBoundary = (directory) => fs$1.existsSync(path$1.join(directory, ".git")) || isMonorepoRoot(directory);
2231
2279
  const REACT_COMPILER_PACKAGES = new Set([
2232
2280
  "babel-plugin-react-compiler",
2233
2281
  "react-compiler-runtime",
@@ -2274,10 +2322,10 @@ const hasCompilerPackage = (packageJson) => {
2274
2322
  };
2275
2323
  const hasCompilerInConfigFile = (filePath) => {
2276
2324
  if (!isFile(filePath)) return false;
2277
- const content = fs.readFileSync(filePath, "utf-8");
2325
+ const content = fs$1.readFileSync(filePath, "utf-8");
2278
2326
  return REACT_COMPILER_ENABLED_FLAG_PATTERN.test(content) || REACT_COMPILER_PACKAGE_REFERENCE_PATTERN.test(content);
2279
2327
  };
2280
- const hasCompilerInConfigFiles = (directory, filenames) => filenames.some((filename) => hasCompilerInConfigFile(path.join(directory, filename)));
2328
+ const hasCompilerInConfigFiles = (directory, filenames) => filenames.some((filename) => hasCompilerInConfigFile(path$1.join(directory, filename)));
2281
2329
  const detectReactCompiler = (directory, packageJson) => {
2282
2330
  if (hasCompilerPackage(packageJson)) return true;
2283
2331
  if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
@@ -2285,14 +2333,14 @@ const detectReactCompiler = (directory, packageJson) => {
2285
2333
  if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
2286
2334
  if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
2287
2335
  if (isProjectBoundary(directory)) return false;
2288
- let ancestorDirectory = path.dirname(directory);
2289
- while (ancestorDirectory !== path.dirname(ancestorDirectory)) {
2290
- const ancestorPackagePath = path.join(ancestorDirectory, "package.json");
2336
+ let ancestorDirectory = path$1.dirname(directory);
2337
+ while (ancestorDirectory !== path$1.dirname(ancestorDirectory)) {
2338
+ const ancestorPackagePath = path$1.join(ancestorDirectory, "package.json");
2291
2339
  if (isFile(ancestorPackagePath)) {
2292
2340
  if (hasCompilerPackage(readPackageJson(ancestorPackagePath))) return true;
2293
2341
  }
2294
2342
  if (isProjectBoundary(ancestorDirectory)) return false;
2295
- ancestorDirectory = path.dirname(ancestorDirectory);
2343
+ ancestorDirectory = path$1.dirname(ancestorDirectory);
2296
2344
  }
2297
2345
  return false;
2298
2346
  };
@@ -2478,12 +2526,12 @@ const resolveVersionFromCatalog = (catalog, packageName) => {
2478
2526
  return null;
2479
2527
  };
2480
2528
  const parsePnpmWorkspaceCatalogs = (rootDirectory) => {
2481
- const workspacePath = path.join(rootDirectory, "pnpm-workspace.yaml");
2529
+ const workspacePath = path$1.join(rootDirectory, "pnpm-workspace.yaml");
2482
2530
  if (!isFile(workspacePath)) return {
2483
2531
  defaultCatalog: {},
2484
2532
  namedCatalogs: {}
2485
2533
  };
2486
- const content = fs.readFileSync(workspacePath, "utf-8");
2534
+ const content = fs$1.readFileSync(workspacePath, "utf-8");
2487
2535
  const defaultCatalog = {};
2488
2536
  const namedCatalogs = {};
2489
2537
  let currentSection = "none";
@@ -2664,7 +2712,7 @@ const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
2664
2712
  };
2665
2713
  const isDirectory = (directoryPath) => {
2666
2714
  try {
2667
- return fs.statSync(directoryPath).isDirectory();
2715
+ return fs$1.statSync(directoryPath).isDirectory();
2668
2716
  } catch {
2669
2717
  return false;
2670
2718
  }
@@ -2675,23 +2723,23 @@ const NX_PROJECT_DISCOVERY_DIRS = [
2675
2723
  "packages"
2676
2724
  ];
2677
2725
  const getNxWorkspaceDirectories = (rootDirectory) => {
2678
- if (!isFile(path.join(rootDirectory, "nx.json"))) return [];
2726
+ if (!isFile(path$1.join(rootDirectory, "nx.json"))) return [];
2679
2727
  const collected = [];
2680
2728
  for (const candidate of NX_PROJECT_DISCOVERY_DIRS) {
2681
- const candidatePath = path.join(rootDirectory, candidate);
2729
+ const candidatePath = path$1.join(rootDirectory, candidate);
2682
2730
  if (!isDirectory(candidatePath)) continue;
2683
2731
  for (const entry of readDirectoryEntries(candidatePath)) {
2684
2732
  if (!entry.isDirectory()) continue;
2685
- const projectDirectory = path.join(candidatePath, entry.name);
2686
- if (isFile(path.join(projectDirectory, "project.json")) || isFile(path.join(projectDirectory, "package.json"))) collected.push(`${candidate}/${entry.name}`);
2733
+ const projectDirectory = path$1.join(candidatePath, entry.name);
2734
+ if (isFile(path$1.join(projectDirectory, "project.json")) || isFile(path$1.join(projectDirectory, "package.json"))) collected.push(`${candidate}/${entry.name}`);
2687
2735
  }
2688
2736
  }
2689
2737
  return collected;
2690
2738
  };
2691
2739
  const parsePnpmWorkspacePatterns = (rootDirectory) => {
2692
- const workspacePath = path.join(rootDirectory, "pnpm-workspace.yaml");
2740
+ const workspacePath = path$1.join(rootDirectory, "pnpm-workspace.yaml");
2693
2741
  if (!isFile(workspacePath)) return [];
2694
- const content = fs.readFileSync(workspacePath, "utf-8");
2742
+ const content = fs$1.readFileSync(workspacePath, "utf-8");
2695
2743
  const patterns = [];
2696
2744
  let isInsidePackagesBlock = false;
2697
2745
  for (const line of content.split("\n")) {
@@ -2721,18 +2769,18 @@ const parseReactMajor = (reactVersion) => {
2721
2769
  const resolveWorkspaceDirectories = (rootDirectory, pattern) => {
2722
2770
  const cleanPattern = pattern.replace(/["']/g, "").replace(/\/\*\*$/, "/*");
2723
2771
  if (!cleanPattern.includes("*")) {
2724
- const directoryPath = path.join(rootDirectory, cleanPattern);
2725
- if (isDirectory(directoryPath) && isFile(path.join(directoryPath, "package.json"))) return [directoryPath];
2772
+ const directoryPath = path$1.join(rootDirectory, cleanPattern);
2773
+ if (isDirectory(directoryPath) && isFile(path$1.join(directoryPath, "package.json"))) return [directoryPath];
2726
2774
  return [];
2727
2775
  }
2728
2776
  const wildcardIndex = cleanPattern.indexOf("*");
2729
- const baseDirectory = path.join(rootDirectory, cleanPattern.slice(0, wildcardIndex));
2777
+ const baseDirectory = path$1.join(rootDirectory, cleanPattern.slice(0, wildcardIndex));
2730
2778
  const suffixAfterWildcard = cleanPattern.slice(wildcardIndex + 1);
2731
2779
  if (!isDirectory(baseDirectory)) return [];
2732
2780
  const resolved = [];
2733
2781
  for (const entry of readDirectoryEntries(baseDirectory)) {
2734
- const entryPath = path.join(baseDirectory, entry.name, suffixAfterWildcard);
2735
- if (isDirectory(entryPath) && isFile(path.join(entryPath, "package.json"))) resolved.push(entryPath);
2782
+ const entryPath = path$1.join(baseDirectory, entry.name, suffixAfterWildcard);
2783
+ if (isDirectory(entryPath) && isFile(path$1.join(entryPath, "package.json"))) resolved.push(entryPath);
2736
2784
  }
2737
2785
  return resolved;
2738
2786
  };
@@ -2759,7 +2807,7 @@ const findReactInWorkspaces = (rootDirectory, packageJson) => {
2759
2807
  for (const pattern of patterns) {
2760
2808
  const directories = resolveWorkspaceDirectories(rootDirectory, pattern);
2761
2809
  for (const workspaceDirectory of directories) {
2762
- const workspacePackageJson = readPackageJson(path.join(workspaceDirectory, "package.json"));
2810
+ const workspacePackageJson = readPackageJson(path$1.join(workspaceDirectory, "package.json"));
2763
2811
  const info = extractDependencyInfo(workspacePackageJson);
2764
2812
  const reactVersion = resolveWorkspaceDependencyVersion({
2765
2813
  concreteVersion: info.reactVersion,
@@ -2813,11 +2861,11 @@ const findReactInWorkspaces = (rootDirectory, packageJson) => {
2813
2861
  const findDependencyInfoFromMonorepoRoot = (directory) => {
2814
2862
  const monorepoRoot = findMonorepoRoot(directory);
2815
2863
  if (!monorepoRoot) return EMPTY_DEPENDENCY_INFO;
2816
- const monorepoPackageJsonPath = path.join(monorepoRoot, "package.json");
2864
+ const monorepoPackageJsonPath = path$1.join(monorepoRoot, "package.json");
2817
2865
  if (!isFile(monorepoPackageJsonPath)) return EMPTY_DEPENDENCY_INFO;
2818
2866
  const rootPackageJson = readPackageJson(monorepoPackageJsonPath);
2819
2867
  const rootInfo = extractDependencyInfo(rootPackageJson);
2820
- const leafPackageJsonPath = path.join(directory, "package.json");
2868
+ const leafPackageJsonPath = path$1.join(directory, "package.json");
2821
2869
  const leafPackageJson = isFile(leafPackageJsonPath) ? readPackageJson(leafPackageJsonPath) : null;
2822
2870
  const leafReactDeclaration = leafPackageJson ? getDependencyDeclaration({
2823
2871
  packageJson: leafPackageJson,
@@ -2871,7 +2919,7 @@ const findInWorkspacePackageJsons = (rootDirectory, rootPackageJson, select) =>
2871
2919
  for (const workspaceDirectory of directories) {
2872
2920
  if (visitedDirectories.has(workspaceDirectory)) continue;
2873
2921
  visitedDirectories.add(workspaceDirectory);
2874
- const value = select(readPackageJson(path.join(workspaceDirectory, "package.json")));
2922
+ const value = select(readPackageJson(path$1.join(workspaceDirectory, "package.json")));
2875
2923
  if (value !== null) return value;
2876
2924
  }
2877
2925
  }
@@ -2916,6 +2964,23 @@ const getExpoDependencySpec = (packageJson) => {
2916
2964
  return typeof spec === "string" ? spec : null;
2917
2965
  };
2918
2966
  const findExpoVersion = (rootDirectory, rootPackageJson) => findInWorkspacePackageJsons(rootDirectory, rootPackageJson, getExpoDependencySpec);
2967
+ const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
2968
+ const getShopifyFlashListDependencySpec = (packageJson) => {
2969
+ const spec = packageJson.dependencies?.["@shopify/flash-list"] ?? packageJson.devDependencies?.["@shopify/flash-list"] ?? packageJson.peerDependencies?.["@shopify/flash-list"] ?? packageJson.optionalDependencies?.["@shopify/flash-list"];
2970
+ return typeof spec === "string" ? spec : null;
2971
+ };
2972
+ const findShopifyFlashListVersion = (rootDirectory, rootPackageJson) => findInWorkspacePackageJsons(rootDirectory, rootPackageJson, getShopifyFlashListDependencySpec);
2973
+ const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
2974
+ if (version === null || !isCatalogReference(version)) return version;
2975
+ const catalogName = extractCatalogName(version);
2976
+ const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
2977
+ if (resolvedLocalVersion) return resolvedLocalVersion;
2978
+ const monorepoRoot = findMonorepoRoot(rootDirectory);
2979
+ if (!monorepoRoot) return version;
2980
+ const monorepoPackageJsonPath = path.join(monorepoRoot, "package.json");
2981
+ if (!isFile(monorepoPackageJsonPath)) return version;
2982
+ return resolveCatalogVersion(readPackageJson(monorepoPackageJsonPath), packageName, monorepoRoot, catalogName) ?? version;
2983
+ };
2919
2984
  const getPreactVersion = (packageJson) => {
2920
2985
  return {
2921
2986
  ...packageJson.peerDependencies,
@@ -2986,7 +3051,7 @@ const hasReactDependency = (packageJson) => {
2986
3051
  return Object.keys(allDependencies).some((packageName) => REACT_DEPENDENCY_NAMES.has(packageName));
2987
3052
  };
2988
3053
  const listWorkspacePackages = (rootDirectory) => {
2989
- const packageJsonPath = path.join(rootDirectory, "package.json");
3054
+ const packageJsonPath = path$1.join(rootDirectory, "package.json");
2990
3055
  if (!isFile(packageJsonPath)) return [];
2991
3056
  const packageJson = readPackageJson(packageJsonPath);
2992
3057
  const patterns = getWorkspacePatterns(rootDirectory, packageJson);
@@ -2999,16 +3064,16 @@ const listWorkspacePackages = (rootDirectory) => {
2999
3064
  packages.push(workspacePackage);
3000
3065
  };
3001
3066
  if (hasReactDependency(packageJson)) pushIfNew({
3002
- name: packageJson.name ?? path.basename(rootDirectory),
3067
+ name: packageJson.name ?? path$1.basename(rootDirectory),
3003
3068
  directory: rootDirectory
3004
3069
  });
3005
3070
  for (const pattern of patterns) {
3006
3071
  const directories = resolveWorkspaceDirectories(rootDirectory, pattern);
3007
3072
  for (const workspaceDirectory of directories) {
3008
- const workspacePackageJson = readPackageJson(path.join(workspaceDirectory, "package.json"));
3073
+ const workspacePackageJson = readPackageJson(path$1.join(workspaceDirectory, "package.json"));
3009
3074
  if (!hasReactDependency(workspacePackageJson)) continue;
3010
3075
  pushIfNew({
3011
- name: workspacePackageJson.name ?? path.basename(workspaceDirectory),
3076
+ name: workspacePackageJson.name ?? path$1.basename(workspaceDirectory),
3012
3077
  directory: workspaceDirectory
3013
3078
  });
3014
3079
  }
@@ -3018,11 +3083,11 @@ const listWorkspacePackages = (rootDirectory) => {
3018
3083
  const toReactWorkspacePackages = (directories) => {
3019
3084
  const packages = [];
3020
3085
  for (const directory of directories) {
3021
- const packageJsonPath = path.join(directory, "package.json");
3086
+ const packageJsonPath = path$1.join(directory, "package.json");
3022
3087
  if (!isFile(packageJsonPath)) continue;
3023
3088
  const packageJson = readPackageJson(packageJsonPath);
3024
3089
  if (!hasReactDependency(packageJson)) continue;
3025
- const name = packageJson.name ?? path.basename(directory);
3090
+ const name = packageJson.name ?? path$1.basename(directory);
3026
3091
  packages.push({
3027
3092
  name,
3028
3093
  directory
@@ -3031,7 +3096,7 @@ const toReactWorkspacePackages = (directories) => {
3031
3096
  return packages;
3032
3097
  };
3033
3098
  const listManifestWorkspacePackages = (rootDirectory) => {
3034
- if (isFile(path.join(rootDirectory, "package.json"))) return listWorkspacePackages(rootDirectory);
3099
+ if (isFile(path$1.join(rootDirectory, "package.json"))) return listWorkspacePackages(rootDirectory);
3035
3100
  const patterns = parsePnpmWorkspacePatterns(rootDirectory);
3036
3101
  const nxPatterns = patterns.length > 0 ? [] : getNxWorkspaceDirectories(rootDirectory);
3037
3102
  return toReactWorkspacePackages((patterns.length > 0 ? patterns : nxPatterns).flatMap((pattern) => resolveWorkspaceDirectories(rootDirectory, pattern)));
@@ -3052,11 +3117,11 @@ const discoverReactSubprojectsByFilesystem = (rootDirectory) => {
3052
3117
  const current = pendingDirectories.pop();
3053
3118
  if (!current) continue;
3054
3119
  const { directory: currentDirectory, depth } = current;
3055
- const packageJsonPath = path.join(currentDirectory, "package.json");
3120
+ const packageJsonPath = path$1.join(currentDirectory, "package.json");
3056
3121
  if (isFile(packageJsonPath)) {
3057
3122
  const packageJson = readPackageJson(packageJsonPath);
3058
3123
  if (hasReactDependency(packageJson)) {
3059
- const name = packageJson.name ?? path.basename(currentDirectory);
3124
+ const name = packageJson.name ?? path$1.basename(currentDirectory);
3060
3125
  packages.push({
3061
3126
  name,
3062
3127
  directory: currentDirectory
@@ -3068,7 +3133,7 @@ const discoverReactSubprojectsByFilesystem = (rootDirectory) => {
3068
3133
  for (const entry of entries) {
3069
3134
  if (!entry.isDirectory() || entry.name.startsWith(".") || IGNORED_DIRECTORIES.has(entry.name) || NON_PROJECT_DIRECTORIES.has(entry.name)) continue;
3070
3135
  pendingDirectories.push({
3071
- directory: path.join(currentDirectory, entry.name),
3136
+ directory: path$1.join(currentDirectory, entry.name),
3072
3137
  depth: depth + 1
3073
3138
  });
3074
3139
  }
@@ -3088,7 +3153,7 @@ const clearProjectCache = () => {
3088
3153
  const discoverProject = (directory) => {
3089
3154
  const cached = cachedProjectInfos.get(directory);
3090
3155
  if (cached !== void 0) return cached;
3091
- const packageJsonPath = path.join(directory, "package.json");
3156
+ const packageJsonPath = path$1.join(directory, "package.json");
3092
3157
  if (!isFile(packageJsonPath)) throw new PackageJsonNotFoundError(directory);
3093
3158
  const packageJson = readPackageJson(packageJsonPath);
3094
3159
  let { reactVersion, tailwindVersion, zodVersion, framework } = extractDependencyInfo(packageJson);
@@ -3125,7 +3190,7 @@ const discoverProject = (directory) => {
3125
3190
  if (!reactVersion || !tailwindVersion || !zodVersion) {
3126
3191
  const monorepoRoot = findMonorepoRoot(directory);
3127
3192
  if (monorepoRoot) {
3128
- const monorepoPackageJsonPath = path.join(monorepoRoot, "package.json");
3193
+ const monorepoPackageJsonPath = path$1.join(monorepoRoot, "package.json");
3129
3194
  if (isFile(monorepoPackageJsonPath)) {
3130
3195
  const rootPackageJson = readPackageJson(monorepoPackageJsonPath);
3131
3196
  if (!reactVersion && reactDeclaration.hasDeclaration) reactVersion = resolveCatalogVersion(rootPackageJson, "react", monorepoRoot, reactDeclaration.catalogReference);
@@ -3151,23 +3216,22 @@ const discoverProject = (directory) => {
3151
3216
  if (!reactVersion && reactDeclaration.version && !isCatalogReference(reactDeclaration.version)) reactVersion = reactDeclaration.version;
3152
3217
  if (!tailwindVersion && tailwindDeclaration.version && !isCatalogReference(tailwindDeclaration.version)) tailwindVersion = tailwindDeclaration.version;
3153
3218
  if (!zodVersion && zodDeclaration.version && !isCatalogReference(zodDeclaration.version)) zodVersion = zodDeclaration.version;
3154
- const projectName = packageJson.name ?? path.basename(directory);
3155
- const hasTypeScript = fs.existsSync(path.join(directory, "tsconfig.json"));
3219
+ const projectName = packageJson.name ?? path$1.basename(directory);
3220
+ const hasTypeScript = fs$1.existsSync(path$1.join(directory, "tsconfig.json"));
3156
3221
  const sourceFileCount = countSourceFiles(directory);
3157
3222
  const hasReactNativeWorkspace = framework === "expo" || framework === "react-native" || hasReactNativeWorkspaceAnywhere(directory, packageJson);
3158
- let expoVersion = hasReactNativeWorkspace ? findExpoVersion(directory, packageJson) : null;
3159
- if (expoVersion !== null && isCatalogReference(expoVersion)) {
3160
- const catalogName = extractCatalogName(expoVersion);
3161
- let resolvedExpoVersion = resolveCatalogVersion(packageJson, "expo", directory, catalogName);
3162
- if (!resolvedExpoVersion) {
3163
- const monorepoRoot = findMonorepoRoot(directory);
3164
- if (monorepoRoot) {
3165
- const monorepoPackageJsonPath = path.join(monorepoRoot, "package.json");
3166
- if (isFile(monorepoPackageJsonPath)) resolvedExpoVersion = resolveCatalogVersion(readPackageJson(monorepoPackageJsonPath), "expo", monorepoRoot, catalogName);
3167
- }
3168
- }
3169
- expoVersion = resolvedExpoVersion ?? expoVersion;
3170
- }
3223
+ const expoVersion = hasReactNativeWorkspace ? resolveCatalogBackedDependencyVersion({
3224
+ rootDirectory: directory,
3225
+ rootPackageJson: packageJson,
3226
+ packageName: "expo",
3227
+ version: findExpoVersion(directory, packageJson)
3228
+ }) : null;
3229
+ const shopifyFlashListVersion = hasReactNativeWorkspace ? resolveCatalogBackedDependencyVersion({
3230
+ rootDirectory: directory,
3231
+ rootPackageJson: packageJson,
3232
+ packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
3233
+ version: findShopifyFlashListVersion(directory, packageJson)
3234
+ }) : null;
3171
3235
  const hasReanimated = hasReactNativeWorkspace && someWorkspacePackageJson(directory, packageJson, isPackageJsonReanimatedAware);
3172
3236
  const preactVersion = getPreactVersion(packageJson);
3173
3237
  const projectInfo = {
@@ -3186,6 +3250,8 @@ const discoverProject = (directory) => {
3186
3250
  preactMajorVersion: parseReactMajor(preactVersion),
3187
3251
  hasReactNativeWorkspace,
3188
3252
  expoVersion,
3253
+ shopifyFlashListVersion,
3254
+ shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
3189
3255
  hasReanimated,
3190
3256
  sourceFileCount
3191
3257
  };
@@ -3793,12 +3859,12 @@ const findNearestPackageDirectory = (filename) => {
3793
3859
  if (!filename) return null;
3794
3860
  const fromCache = cachedPackageDirectoryByFilename.get(filename);
3795
3861
  if (fromCache !== void 0) return fromCache;
3796
- let currentDirectory = path.dirname(filename);
3862
+ let currentDirectory = path$1.dirname(filename);
3797
3863
  while (true) {
3798
- const candidatePackageJsonPath = path.join(currentDirectory, "package.json");
3864
+ const candidatePackageJsonPath = path$1.join(currentDirectory, "package.json");
3799
3865
  let hasPackageJson = false;
3800
3866
  try {
3801
- hasPackageJson = fs.statSync(candidatePackageJsonPath).isFile();
3867
+ hasPackageJson = fs$1.statSync(candidatePackageJsonPath).isFile();
3802
3868
  } catch {
3803
3869
  hasPackageJson = false;
3804
3870
  }
@@ -3806,7 +3872,7 @@ const findNearestPackageDirectory = (filename) => {
3806
3872
  cachedPackageDirectoryByFilename.set(filename, currentDirectory);
3807
3873
  return currentDirectory;
3808
3874
  }
3809
- const parentDirectory = path.dirname(currentDirectory);
3875
+ const parentDirectory = path$1.dirname(currentDirectory);
3810
3876
  if (parentDirectory === currentDirectory) {
3811
3877
  cachedPackageDirectoryByFilename.set(filename, null);
3812
3878
  return null;
@@ -3816,7 +3882,7 @@ const findNearestPackageDirectory = (filename) => {
3816
3882
  };
3817
3883
  const readManifest = (packageJsonPath) => {
3818
3884
  try {
3819
- const parsed = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
3885
+ const parsed = JSON.parse(fs$1.readFileSync(packageJsonPath, "utf-8"));
3820
3886
  if (typeof parsed === "object" && parsed !== null) return parsed;
3821
3887
  return null;
3822
3888
  } catch {
@@ -3827,8 +3893,8 @@ const hasPublishContract = (manifest) => typeof manifest.name === "string" && ma
3827
3893
  const classifyByDirectoryCohort = (packageDirectory) => {
3828
3894
  let current = packageDirectory;
3829
3895
  while (true) {
3830
- if (path.basename(current) === "apps") return "app";
3831
- const parent = path.dirname(current);
3896
+ if (path$1.basename(current) === "apps") return "app";
3897
+ const parent = path$1.dirname(current);
3832
3898
  if (parent === current) return null;
3833
3899
  current = parent;
3834
3900
  }
@@ -3843,10 +3909,10 @@ const classifyPackageRole = (filename) => {
3843
3909
  if (!packageDirectory) return "unknown";
3844
3910
  const cached = cachedRoleByPackageDirectory.get(packageDirectory);
3845
3911
  if (cached !== void 0) return cached;
3846
- const manifest = readManifest(path.join(packageDirectory, "package.json"));
3912
+ const manifest = readManifest(path$1.join(packageDirectory, "package.json"));
3847
3913
  let result;
3848
3914
  if (manifest && hasPublishContract(manifest)) result = "library";
3849
- else result = classifyByDirectoryCohort(path.dirname(packageDirectory)) ?? "unknown";
3915
+ else result = classifyByDirectoryCohort(path$1.dirname(packageDirectory)) ?? "unknown";
3850
3916
  cachedRoleByPackageDirectory.set(packageDirectory, result);
3851
3917
  return result;
3852
3918
  };
@@ -4498,12 +4564,12 @@ const loadModuleConfig = async (filePath) => {
4498
4564
  const imported = await jiti.import(filePath);
4499
4565
  return imported?.default ?? imported;
4500
4566
  };
4501
- const readDataConfig = (filePath) => parseJSON5(fs.readFileSync(filePath, "utf-8"));
4567
+ const readDataConfig = (filePath) => parseJSON5(fs$1.readFileSync(filePath, "utf-8"));
4502
4568
  const readEmbeddedPackageJsonConfig = (directory) => {
4503
- const packageJsonPath = path.join(directory, PACKAGE_JSON_FILENAME);
4569
+ const packageJsonPath = path$1.join(directory, PACKAGE_JSON_FILENAME);
4504
4570
  if (!isFile(packageJsonPath)) return null;
4505
4571
  try {
4506
- const packageJson = parseJSON5(fs.readFileSync(packageJsonPath, "utf-8"));
4572
+ const packageJson = parseJSON5(fs$1.readFileSync(packageJsonPath, "utf-8"));
4507
4573
  if (isPlainObject(packageJson)) {
4508
4574
  const embeddedConfig = packageJson[PACKAGE_JSON_CONFIG_KEY];
4509
4575
  if (isPlainObject(embeddedConfig)) return embeddedConfig;
@@ -4517,14 +4583,14 @@ const loadPackageJsonConfig = (directory) => {
4517
4583
  return {
4518
4584
  config: validateConfigTypes(embeddedConfig),
4519
4585
  sourceDirectory: directory,
4520
- configFilePath: path.join(directory, PACKAGE_JSON_FILENAME),
4586
+ configFilePath: path$1.join(directory, PACKAGE_JSON_FILENAME),
4521
4587
  format: "package-json"
4522
4588
  };
4523
4589
  };
4524
4590
  const loadConfigFromDirectory = async (directory) => {
4525
4591
  let sawBrokenConfigFile = false;
4526
4592
  for (const extension of CONFIG_EXTENSIONS) {
4527
- const filePath = path.join(directory, `${CONFIG_BASENAME}.${extension}`);
4593
+ const filePath = path$1.join(directory, `${CONFIG_BASENAME}.${extension}`);
4528
4594
  if (!isFile(filePath)) continue;
4529
4595
  const isDataFile = DATA_CONFIG_EXTENSIONS.has(extension);
4530
4596
  try {
@@ -4550,7 +4616,7 @@ const loadConfigFromDirectory = async (directory) => {
4550
4616
  status: "found",
4551
4617
  loaded: packageJsonConfig
4552
4618
  };
4553
- if (isFile(path.join(directory, LEGACY_CONFIG_FILENAME))) warn(`${LEGACY_CONFIG_FILENAME} is no longer read — rename it to ${CONFIG_BASENAME}.json (or author a ${CONFIG_BASENAME}.ts).`);
4619
+ if (isFile(path$1.join(directory, LEGACY_CONFIG_FILENAME))) warn(`${LEGACY_CONFIG_FILENAME} is no longer read — rename it to ${CONFIG_BASENAME}.json (or author a ${CONFIG_BASENAME}.ts).`);
4554
4620
  return {
4555
4621
  status: sawBrokenConfigFile ? "invalid" : "absent",
4556
4622
  loaded: null
@@ -4564,12 +4630,12 @@ const loadConfigWalkingUp = async (rootDirectory) => {
4564
4630
  const localResult = await loadConfigFromDirectory(rootDirectory);
4565
4631
  if (localResult.status === "found") return localResult.loaded;
4566
4632
  if (localResult.status === "invalid" || isProjectBoundary(rootDirectory)) return null;
4567
- let ancestorDirectory = path.dirname(rootDirectory);
4568
- while (ancestorDirectory !== path.dirname(ancestorDirectory)) {
4633
+ let ancestorDirectory = path$1.dirname(rootDirectory);
4634
+ while (ancestorDirectory !== path$1.dirname(ancestorDirectory)) {
4569
4635
  const ancestorResult = await loadConfigFromDirectory(ancestorDirectory);
4570
4636
  if (ancestorResult.status === "found") return ancestorResult.loaded;
4571
4637
  if (isProjectBoundary(ancestorDirectory)) return null;
4572
- ancestorDirectory = path.dirname(ancestorDirectory);
4638
+ ancestorDirectory = path$1.dirname(ancestorDirectory);
4573
4639
  }
4574
4640
  return null;
4575
4641
  };
@@ -4586,7 +4652,7 @@ const resolveConfigRootDir = (config, configSourceDirectory) => {
4586
4652
  if (typeof rawRootDir !== "string") return null;
4587
4653
  const trimmedRootDir = rawRootDir.trim();
4588
4654
  if (trimmedRootDir.length === 0) return null;
4589
- const resolvedRootDir = path.isAbsolute(trimmedRootDir) ? trimmedRootDir : path.resolve(configSourceDirectory, trimmedRootDir);
4655
+ const resolvedRootDir = path$1.isAbsolute(trimmedRootDir) ? trimmedRootDir : path$1.resolve(configSourceDirectory, trimmedRootDir);
4590
4656
  if (resolvedRootDir === configSourceDirectory) return null;
4591
4657
  if (!isDirectory(resolvedRootDir)) {
4592
4658
  Effect.runSync(Console.warn(`react-doctor config "rootDir" points to "${rawRootDir}" (resolved to ${resolvedRootDir}), which is not a directory. Ignoring.`));
@@ -4595,12 +4661,12 @@ const resolveConfigRootDir = (config, configSourceDirectory) => {
4595
4661
  return resolvedRootDir;
4596
4662
  };
4597
4663
  const resolveDiagnoseTarget = (directory, options = {}) => {
4598
- if (isFile(path.join(directory, "package.json"))) return directory;
4664
+ if (isFile(path$1.join(directory, "package.json"))) return directory;
4599
4665
  const reactSubprojects = discoverReactSubprojects(directory);
4600
4666
  if (reactSubprojects.length === 0) return null;
4601
4667
  if (reactSubprojects.length === 1) return reactSubprojects[0].directory;
4602
4668
  if (options.allowAmbiguous === true) return null;
4603
- throw new AmbiguousProjectError(directory, reactSubprojects.map((subproject) => path.relative(directory, subproject.directory)).toSorted());
4669
+ throw new AmbiguousProjectError(directory, reactSubprojects.map((subproject) => path$1.relative(directory, subproject.directory)).toSorted());
4604
4670
  };
4605
4671
  /**
4606
4672
  * The canonical entry-point translation shared by every public shell
@@ -4626,14 +4692,14 @@ const resolveDiagnoseTarget = (directory, options = {}) => {
4626
4692
  * shell in agreement on what "the scan directory" means.
4627
4693
  */
4628
4694
  const resolveScanTarget = async (requestedDirectory, options = {}) => {
4629
- const absoluteRequested = path.resolve(requestedDirectory);
4695
+ const absoluteRequested = path$1.resolve(requestedDirectory);
4630
4696
  const loadedConfig = await loadConfigWithSource(absoluteRequested);
4631
4697
  const userConfig = loadedConfig?.config ?? null;
4632
4698
  const configSourceDirectory = loadedConfig?.sourceDirectory ?? null;
4633
4699
  const redirectedDirectory = resolveConfigRootDir(userConfig, configSourceDirectory);
4634
4700
  const directoryAfterRedirect = redirectedDirectory ?? absoluteRequested;
4635
4701
  const resolvedDirectory = resolveDiagnoseTarget(directoryAfterRedirect, options) ?? directoryAfterRedirect;
4636
- if (!isDirectory(resolvedDirectory)) throw existsSync(resolvedDirectory) ? new NotADirectoryError(resolvedDirectory) : new ProjectNotFoundError(resolvedDirectory, { kind: "missing-path" });
4702
+ if (!isDirectory(resolvedDirectory)) throw fs$1.existsSync(resolvedDirectory) ? new NotADirectoryError(resolvedDirectory) : new ProjectNotFoundError(resolvedDirectory, { kind: "missing-path" });
4637
4703
  return {
4638
4704
  resolvedDirectory,
4639
4705
  requestedDirectory: absoluteRequested,
@@ -4644,7 +4710,7 @@ const resolveScanTarget = async (requestedDirectory, options = {}) => {
4644
4710
  };
4645
4711
  const getDirectDependencyNames = (packageJson) => new Set([...Object.keys(packageJson.dependencies ?? {}), ...Object.keys(packageJson.devDependencies ?? {})]);
4646
4712
  const buildExpoCheckContext = (rootDirectory, expoVersion) => {
4647
- const packageJson = readPackageJson(path.join(rootDirectory, "package.json"));
4713
+ const packageJson = readPackageJson(path$1.join(rootDirectory, "package.json"));
4648
4714
  return {
4649
4715
  rootDirectory,
4650
4716
  packageJson,
@@ -4714,7 +4780,7 @@ const LOCAL_ENV_FILE_NAMES = [
4714
4780
  const checkExpoEnvLocalFiles = (context) => {
4715
4781
  const { rootDirectory } = context;
4716
4782
  const committedEnvFiles = LOCAL_ENV_FILE_NAMES.filter((fileName) => {
4717
- const filePath = path.join(rootDirectory, fileName);
4783
+ const filePath = path$1.join(rootDirectory, fileName);
4718
4784
  if (!isFile(filePath)) return false;
4719
4785
  return isPathGitIgnored(rootDirectory, filePath) === false;
4720
4786
  });
@@ -4848,17 +4914,17 @@ const checkExpoFlaggedDependencies = (context) => FLAGGED_DEPENDENCIES.filter((f
4848
4914
  help: flaggedDependency.help
4849
4915
  }));
4850
4916
  const findLocalModuleNativeFiles = (rootDirectory) => {
4851
- const modulesDirectory = path.join(rootDirectory, "modules");
4917
+ const modulesDirectory = path$1.join(rootDirectory, "modules");
4852
4918
  if (!isDirectory(modulesDirectory)) return [];
4853
4919
  const nativeFilePaths = [];
4854
4920
  for (const moduleEntry of readDirectoryEntries(modulesDirectory)) {
4855
4921
  if (!moduleEntry.isDirectory()) continue;
4856
- const moduleDirectory = path.join(modulesDirectory, moduleEntry.name);
4857
- const gradlePath = path.join(moduleDirectory, "android", "build.gradle");
4922
+ const moduleDirectory = path$1.join(modulesDirectory, moduleEntry.name);
4923
+ const gradlePath = path$1.join(moduleDirectory, "android", "build.gradle");
4858
4924
  if (isFile(gradlePath)) nativeFilePaths.push(gradlePath);
4859
- const iosDirectory = path.join(moduleDirectory, "ios");
4925
+ const iosDirectory = path$1.join(moduleDirectory, "ios");
4860
4926
  if (isDirectory(iosDirectory)) {
4861
- for (const iosEntry of readDirectoryEntries(iosDirectory)) if (iosEntry.isFile() && iosEntry.name.endsWith(".podspec")) nativeFilePaths.push(path.join(iosDirectory, iosEntry.name));
4927
+ for (const iosEntry of readDirectoryEntries(iosDirectory)) if (iosEntry.isFile() && iosEntry.name.endsWith(".podspec")) nativeFilePaths.push(path$1.join(iosDirectory, iosEntry.name));
4862
4928
  }
4863
4929
  }
4864
4930
  return nativeFilePaths;
@@ -4866,7 +4932,7 @@ const findLocalModuleNativeFiles = (rootDirectory) => {
4866
4932
  const checkExpoGitignore = (context) => {
4867
4933
  const { rootDirectory } = context;
4868
4934
  const diagnostics = [];
4869
- const expoStateDirectory = path.join(rootDirectory, ".expo");
4935
+ const expoStateDirectory = path$1.join(rootDirectory, ".expo");
4870
4936
  if (isDirectory(expoStateDirectory) && isPathGitIgnored(rootDirectory, expoStateDirectory) === false) diagnostics.push(buildExpoDiagnostic({
4871
4937
  rule: "expo-gitignore",
4872
4938
  message: "The `.expo` directory is not ignored by Git — it holds machine-specific device history and dev-server settings that should not be committed",
@@ -4888,7 +4954,7 @@ const LOCKFILE_NAMES = [
4888
4954
  ];
4889
4955
  const checkExpoLockfile = (context) => {
4890
4956
  const workspaceRoot = isMonorepoRoot(context.rootDirectory) ? context.rootDirectory : findMonorepoRoot(context.rootDirectory) ?? context.rootDirectory;
4891
- const presentLockfiles = LOCKFILE_NAMES.filter((lockfileName) => isFile(path.join(workspaceRoot, lockfileName)));
4957
+ const presentLockfiles = LOCKFILE_NAMES.filter((lockfileName) => isFile(path$1.join(workspaceRoot, lockfileName)));
4892
4958
  if (presentLockfiles.length === 0) return [buildExpoDiagnostic({
4893
4959
  rule: "expo-lockfile",
4894
4960
  message: "No lock file detected at the project root — installs are not reproducible, and EAS Build cannot infer your package manager",
@@ -4913,18 +4979,18 @@ const EXPO_METRO_CONFIG_EXTEND_SIGNALS = [
4913
4979
  "getSentryExpoConfig"
4914
4980
  ];
4915
4981
  const checkExpoMetroConfig = (context) => {
4916
- const metroConfigPath = METRO_CONFIG_FILE_NAMES.map((fileName) => path.join(context.rootDirectory, fileName)).find((candidatePath) => isFile(candidatePath));
4982
+ const metroConfigPath = METRO_CONFIG_FILE_NAMES.map((fileName) => path$1.join(context.rootDirectory, fileName)).find((candidatePath) => isFile(candidatePath));
4917
4983
  if (metroConfigPath === void 0) return [];
4918
4984
  let contents;
4919
4985
  try {
4920
- contents = fs.readFileSync(metroConfigPath, "utf-8");
4986
+ contents = fs$1.readFileSync(metroConfigPath, "utf-8");
4921
4987
  } catch {
4922
4988
  return [];
4923
4989
  }
4924
4990
  if (EXPO_METRO_CONFIG_EXTEND_SIGNALS.some((signal) => contents.includes(signal))) return [];
4925
4991
  return [buildExpoDiagnostic({
4926
4992
  rule: "expo-metro-config",
4927
- filePath: path.basename(metroConfigPath),
4993
+ filePath: path$1.basename(metroConfigPath),
4928
4994
  message: "Your metro.config does not extend `expo/metro-config` — a custom Metro config that doesn't extend Expo's leads to unexpected, hard-to-debug bundling issues",
4929
4995
  help: "Update your metro config to extend `expo/metro-config`. See https://docs.expo.dev/guides/customizing-metro/"
4930
4996
  })];
@@ -4970,16 +5036,16 @@ const NO_CONFIG = {
4970
5036
  const decodeExpoConfig = (filePath) => {
4971
5037
  let raw;
4972
5038
  try {
4973
- raw = JSON.parse(fs.readFileSync(filePath, "utf-8"));
5039
+ raw = JSON.parse(fs$1.readFileSync(filePath, "utf-8"));
4974
5040
  } catch {
4975
5041
  return null;
4976
5042
  }
4977
5043
  return Option.getOrNull(Schema.decodeUnknownOption(AppManifestSchema)(raw))?.expo ?? null;
4978
5044
  };
4979
5045
  const readExpoAppConfig = (rootDirectory) => {
4980
- if (APP_CONFIG_DYNAMIC_FILES.some((fileName) => isFile(path.join(rootDirectory, fileName)))) return NO_CONFIG;
5046
+ if (APP_CONFIG_DYNAMIC_FILES.some((fileName) => isFile(path$1.join(rootDirectory, fileName)))) return NO_CONFIG;
4981
5047
  for (const fileName of APP_CONFIG_JSON_FILES) {
4982
- const filePath = path.join(rootDirectory, fileName);
5048
+ const filePath = path$1.join(rootDirectory, fileName);
4983
5049
  if (!isFile(filePath)) continue;
4984
5050
  const config = decodeExpoConfig(filePath);
4985
5051
  if (config) return {
@@ -5126,12 +5192,12 @@ const parseHardeningSettings = (content) => {
5126
5192
  };
5127
5193
  };
5128
5194
  const isPnpmManagedProject = (rootDirectory) => {
5129
- if (isFile(path.join(rootDirectory, PNPM_LOCKFILE))) return true;
5130
- if (isFile(path.join(rootDirectory, PNPM_WORKSPACE_FILE))) return true;
5131
- const packageJsonPath = path.join(rootDirectory, PACKAGE_JSON_FILE);
5195
+ if (isFile(path$1.join(rootDirectory, PNPM_LOCKFILE))) return true;
5196
+ if (isFile(path$1.join(rootDirectory, PNPM_WORKSPACE_FILE))) return true;
5197
+ const packageJsonPath = path$1.join(rootDirectory, PACKAGE_JSON_FILE);
5132
5198
  if (!isFile(packageJsonPath)) return false;
5133
5199
  try {
5134
- const packageJsonRaw = fs.readFileSync(packageJsonPath, "utf-8");
5200
+ const packageJsonRaw = fs$1.readFileSync(packageJsonPath, "utf-8");
5135
5201
  const packageJson = JSON.parse(packageJsonRaw);
5136
5202
  if (packageJson !== null && typeof packageJson === "object" && "packageManager" in packageJson && typeof packageJson.packageManager === "string" && packageJson.packageManager.startsWith("pnpm@")) return true;
5137
5203
  } catch {
@@ -5152,8 +5218,8 @@ const buildHardeningDiagnostic = (input) => ({
5152
5218
  });
5153
5219
  const checkPnpmHardening = (rootDirectory) => {
5154
5220
  if (!isPnpmManagedProject(rootDirectory)) return [];
5155
- const workspacePath = path.join(rootDirectory, PNPM_WORKSPACE_FILE);
5156
- const settings = parseHardeningSettings(isFile(workspacePath) ? fs.readFileSync(workspacePath, "utf-8") : "");
5221
+ const workspacePath = path$1.join(rootDirectory, PNPM_WORKSPACE_FILE);
5222
+ const settings = parseHardeningSettings(isFile(workspacePath) ? fs$1.readFileSync(workspacePath, "utf-8") : "");
5157
5223
  const diagnostics = [];
5158
5224
  if (settings.minimumReleaseAge === null) diagnostics.push(buildHardeningDiagnostic({
5159
5225
  message: "pnpm-workspace.yaml is missing `minimumReleaseAge` — newly published versions can ship malware that gets caught and unpublished within hours",
@@ -5183,7 +5249,7 @@ const isBuilderBobLibrary = (packageJson) => {
5183
5249
  return typeof bobConfig === "object" && bobConfig !== null;
5184
5250
  };
5185
5251
  const checkReactNativeLibraryDependencies = (rootDirectory) => {
5186
- const packageJson = readPackageJson(path.join(rootDirectory, "package.json"));
5252
+ const packageJson = readPackageJson(path$1.join(rootDirectory, "package.json"));
5187
5253
  if (!isBuilderBobLibrary(packageJson)) return [];
5188
5254
  const misplaced = ["react", "react-native"].filter((name) => packageJson.dependencies?.[name] !== void 0);
5189
5255
  if (misplaced.length === 0) return [];
@@ -5212,11 +5278,11 @@ const BABEL_CONFIG_FILE_NAMES = [
5212
5278
  const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
5213
5279
  const checkReactNativeMetroBabelPreset = (rootDirectory) => {
5214
5280
  for (const fileName of BABEL_CONFIG_FILE_NAMES) {
5215
- const filePath = path.join(rootDirectory, fileName);
5281
+ const filePath = path$1.join(rootDirectory, fileName);
5216
5282
  if (!isFile(filePath)) continue;
5217
5283
  let contents;
5218
5284
  try {
5219
- contents = fs.readFileSync(filePath, "utf-8");
5285
+ contents = fs$1.readFileSync(filePath, "utf-8");
5220
5286
  } catch {
5221
5287
  continue;
5222
5288
  }
@@ -5261,7 +5327,7 @@ const MISSING_REDUCED_MOTION_DIAGNOSTIC = {
5261
5327
  category: "Accessibility"
5262
5328
  };
5263
5329
  const checkReducedMotion = (rootDirectory) => {
5264
- const packageJsonPath = path.join(rootDirectory, "package.json");
5330
+ const packageJsonPath = path$1.join(rootDirectory, "package.json");
5265
5331
  if (!isFile(packageJsonPath)) return [];
5266
5332
  let hasMotionLibrary = false;
5267
5333
  try {
@@ -5386,7 +5452,7 @@ const isTruthyLinguistAttribute = (token) => {
5386
5452
  const parseGitattributesLinguistPaths = (filePath) => {
5387
5453
  let content;
5388
5454
  try {
5389
- content = fs.readFileSync(filePath, "utf-8");
5455
+ content = fs$1.readFileSync(filePath, "utf-8");
5390
5456
  } catch {
5391
5457
  return [];
5392
5458
  }
@@ -5408,7 +5474,7 @@ const stripGitignoreEscape = (pattern) => {
5408
5474
  const readIgnoreFile = (filePath) => {
5409
5475
  let content;
5410
5476
  try {
5411
- content = fs.readFileSync(filePath, "utf-8");
5477
+ content = fs$1.readFileSync(filePath, "utf-8");
5412
5478
  } catch (error) {
5413
5479
  const errnoCode = error?.code;
5414
5480
  if (errnoCode && errnoCode !== "ENOENT") Effect.runSync(Console.warn(`Could not read ignore file ${filePath}: ${errnoCode}`));
@@ -5440,8 +5506,8 @@ const computeIgnorePatterns = (rootDirectory) => {
5440
5506
  seen.add(pattern);
5441
5507
  patterns.push(pattern);
5442
5508
  };
5443
- for (const filename of IGNORE_FILENAMES) for (const pattern of readIgnoreFile(path.join(rootDirectory, filename))) addPattern(pattern);
5444
- for (const linguistPath of parseGitattributesLinguistPaths(path.join(rootDirectory, ".gitattributes"))) addPattern(linguistPath);
5509
+ for (const filename of IGNORE_FILENAMES) for (const pattern of readIgnoreFile(path$1.join(rootDirectory, filename))) addPattern(pattern);
5510
+ for (const linguistPath of parseGitattributesLinguistPaths(path$1.join(rootDirectory, ".gitattributes"))) addPattern(linguistPath);
5445
5511
  return patterns;
5446
5512
  };
5447
5513
  const collectIgnorePatterns = (rootDirectory) => {
@@ -5451,6 +5517,63 @@ const collectIgnorePatterns = (rootDirectory) => {
5451
5517
  cachedPatternsByRoot.set(rootDirectory, patterns);
5452
5518
  return patterns;
5453
5519
  };
5520
+ const KNIP_JSON_FILENAME = "knip.json";
5521
+ const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5522
+ const readJsonFileSafe = (filePath) => {
5523
+ let rawContents;
5524
+ try {
5525
+ rawContents = fs.readFileSync(filePath, "utf-8");
5526
+ } catch {
5527
+ return null;
5528
+ }
5529
+ try {
5530
+ return JSON.parse(rawContents);
5531
+ } catch {
5532
+ return null;
5533
+ }
5534
+ };
5535
+ const readKnipConfig = (rootDirectory) => {
5536
+ const knipJson = readJsonFileSafe(path.join(rootDirectory, KNIP_JSON_FILENAME));
5537
+ if (isRecord$1(knipJson)) return knipJson;
5538
+ const packageJson = readJsonFileSafe(path.join(rootDirectory, "package.json"));
5539
+ const packageKnipConfig = isRecord$1(packageJson) ? packageJson.knip : null;
5540
+ return isRecord$1(packageKnipConfig) ? packageKnipConfig : null;
5541
+ };
5542
+ const normalizePatternList = (value) => {
5543
+ if (typeof value === "string" && value.length > 0) return [value];
5544
+ if (!Array.isArray(value)) return [];
5545
+ return value.filter((entry) => typeof entry === "string" && entry.length > 0);
5546
+ };
5547
+ const prefixWorkspacePatterns = (workspacePattern, patterns) => {
5548
+ const normalizedWorkspacePattern = workspacePattern.replace(/\/+$/, "");
5549
+ return patterns.map((pattern) => pattern.startsWith("!") ? `!${normalizedWorkspacePattern}/${pattern.slice(1)}` : `${normalizedWorkspacePattern}/${pattern}`);
5550
+ };
5551
+ const collectKnipWorkspacePatterns = (workspaces, settingName) => {
5552
+ if (!isRecord$1(workspaces)) return [];
5553
+ const patterns = [];
5554
+ for (const [workspacePattern, workspaceConfig] of Object.entries(workspaces)) {
5555
+ if (!isRecord$1(workspaceConfig)) continue;
5556
+ patterns.push(...prefixWorkspacePatterns(workspacePattern, normalizePatternList(workspaceConfig[settingName])));
5557
+ }
5558
+ return patterns;
5559
+ };
5560
+ const collectKnipPatterns = (rootDirectory, settingName) => {
5561
+ const config = readKnipConfig(rootDirectory);
5562
+ if (!config) return [];
5563
+ return [...normalizePatternList(config[settingName]), ...collectKnipWorkspacePatterns(config.workspaces, settingName)];
5564
+ };
5565
+ const collectDeadCodeIgnorePatterns = (rootDirectory, userConfig) => {
5566
+ const seen = /* @__PURE__ */ new Set();
5567
+ const sources = [
5568
+ readIgnoreFile(path.join(rootDirectory, ".gitignore")),
5569
+ collectIgnorePatterns(rootDirectory),
5570
+ userConfig?.ignore?.files ?? [],
5571
+ collectKnipPatterns(rootDirectory, "ignore")
5572
+ ];
5573
+ for (const source of sources) for (const pattern of source) seen.add(pattern);
5574
+ return [...seen].filter((pattern) => pattern.length > 0);
5575
+ };
5576
+ const collectDeadCodeEntryPatterns = (rootDirectory) => [...new Set(collectKnipPatterns(rootDirectory, "entry"))].filter((pattern) => pattern.length > 0);
5454
5577
  /**
5455
5578
  * Resolves a path to its canonical, symlink-free form, falling back to
5456
5579
  * the input when it cannot be realpath'd (broken symlink, permission
@@ -5468,7 +5591,7 @@ const collectIgnorePatterns = (rootDirectory) => {
5468
5591
  */
5469
5592
  const toCanonicalPath = (filePath) => {
5470
5593
  try {
5471
- return fs.realpathSync(filePath);
5594
+ return fs$1.realpathSync(filePath);
5472
5595
  } catch {
5473
5596
  return filePath;
5474
5597
  }
@@ -5476,6 +5599,7 @@ const toCanonicalPath = (filePath) => {
5476
5599
  const DEAD_CODE_PLUGIN = "deslop";
5477
5600
  const DEAD_CODE_CATEGORY = "Maintainability";
5478
5601
  const TSCONFIG_FILENAMES$1 = ["tsconfig.json", "tsconfig.base.json"];
5602
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5479
5603
  const DEAD_CODE_WORKER_SCRIPT = `
5480
5604
  const inputChunks = [];
5481
5605
  process.stdin.on("data", (chunk) => inputChunks.push(chunk));
@@ -5516,6 +5640,9 @@ process.stdin.on("end", () => {
5516
5640
  const { analyze, defineConfig } = await import(workerInput.deslopJsModuleSpecifier);
5517
5641
  const config = {
5518
5642
  rootDir: workerInput.rootDirectory,
5643
+ ...(workerInput.entryPatterns.length > 0
5644
+ ? { entryPatterns: workerInput.entryPatterns }
5645
+ : {}),
5519
5646
  ...(workerInput.tsConfigPath ? { tsConfigPath: workerInput.tsConfigPath } : {}),
5520
5647
  ...(workerInput.ignorePatterns.length > 0
5521
5648
  ? { ignorePatterns: workerInput.ignorePatterns }
@@ -5531,25 +5658,14 @@ process.stdin.on("end", () => {
5531
5658
  `;
5532
5659
  const resolveTsConfigPath = (rootDirectory) => {
5533
5660
  for (const filename of TSCONFIG_FILENAMES$1) {
5534
- const candidate = path.join(rootDirectory, filename);
5535
- if (fs.existsSync(candidate)) return candidate;
5661
+ const candidate = path$1.join(rootDirectory, filename);
5662
+ if (fs$1.existsSync(candidate)) return candidate;
5536
5663
  }
5537
5664
  };
5538
- const collectDeadCodeIgnorePatterns = (rootDirectory, userConfig) => {
5539
- const seen = /* @__PURE__ */ new Set();
5540
- const sources = [
5541
- readIgnoreFile(path.join(rootDirectory, ".gitignore")),
5542
- collectIgnorePatterns(rootDirectory),
5543
- userConfig?.ignore?.files ?? []
5544
- ];
5545
- for (const source of sources) for (const pattern of source) seen.add(pattern);
5546
- return [...seen].filter((pattern) => pattern.length > 0);
5547
- };
5548
5665
  const toRelativeFilePath = (rootDirectory, filePath) => {
5549
5666
  const relative = toRelativePath(filePath, rootDirectory);
5550
5667
  return relative.length > 0 ? relative : filePath.replace(/\\/g, "/");
5551
5668
  };
5552
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5553
5669
  const parseArray = (value, label) => {
5554
5670
  if (!Array.isArray(value)) throw new Error(`Dead-code worker returned invalid ${label}.`);
5555
5671
  return value;
@@ -5731,10 +5847,12 @@ const runDeadCodeWorkerWithTimeout = (handle, timeoutMs) => new Promise((resolve
5731
5847
  const checkDeadCode = async (options) => {
5732
5848
  const { userConfig } = options;
5733
5849
  const rootDirectory = toCanonicalPath(options.rootDirectory);
5734
- if (!fs.existsSync(path.join(rootDirectory, "package.json"))) return [];
5850
+ if (!fs$1.existsSync(path$1.join(rootDirectory, "package.json"))) return [];
5851
+ const entryPatterns = collectDeadCodeEntryPatterns(rootDirectory);
5735
5852
  const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory, userConfig);
5736
5853
  const result = parseDeadCodeWorkerResult(await runDeadCodeWorkerWithTimeout((options.createWorker ?? createDeadCodeWorker)({
5737
5854
  rootDirectory,
5855
+ entryPatterns,
5738
5856
  tsConfigPath: resolveTsConfigPath(rootDirectory),
5739
5857
  ignorePatterns,
5740
5858
  deslopJsModuleSpecifier: options.deslopJsModuleSpecifier ?? import.meta.resolve("deslop-js")
@@ -5836,7 +5954,7 @@ const isDiagnosticOnSurface = (diagnostic, surface, config) => {
5836
5954
  return true;
5837
5955
  };
5838
5956
  const filterDiagnosticsForSurface = (diagnostics, surface, config) => diagnostics.filter((diagnostic) => isDiagnosticOnSurface(diagnostic, surface, config));
5839
- const excludeMinifiedFiles = (rootDirectory, relativePaths) => relativePaths.filter((relativePath) => !isLargeMinifiedFile(path.resolve(rootDirectory, relativePath)));
5957
+ const excludeMinifiedFiles = (rootDirectory, relativePaths) => relativePaths.filter((relativePath) => !isLargeMinifiedFile(path$1.resolve(rootDirectory, relativePath)));
5840
5958
  const listSourceFilesViaGit = (rootDirectory) => {
5841
5959
  const result = spawnSync("git", [
5842
5960
  "ls-files",
@@ -5859,12 +5977,12 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
5859
5977
  const currentDirectory = stack.pop();
5860
5978
  const entries = readDirectoryEntries(currentDirectory);
5861
5979
  for (const entry of entries) {
5862
- const absolutePath = path.join(currentDirectory, entry.name);
5980
+ const absolutePath = path$1.join(currentDirectory, entry.name);
5863
5981
  if (entry.isDirectory()) {
5864
5982
  if (!entry.name.startsWith(".") && !IGNORED_DIRECTORIES.has(entry.name)) stack.push(absolutePath);
5865
5983
  continue;
5866
5984
  }
5867
- if (entry.isFile() && isLintableSourceFile(entry.name)) filePaths.push(path.relative(rootDirectory, absolutePath).replace(/\\/g, "/"));
5985
+ if (entry.isFile() && isLintableSourceFile(entry.name)) filePaths.push(path$1.relative(rootDirectory, absolutePath).replace(/\\/g, "/"));
5868
5986
  }
5869
5987
  }
5870
5988
  return filePaths;
@@ -5923,9 +6041,9 @@ var DeadCode = class DeadCode extends Context.Service()("react-doctor/DeadCode")
5923
6041
  };
5924
6042
  const createNodeReadFileLinesSync = (rootDirectory) => {
5925
6043
  return (filePath) => {
5926
- const absolutePath = path.isAbsolute(filePath) ? filePath : path.join(rootDirectory, filePath);
6044
+ const absolutePath = path$1.isAbsolute(filePath) ? filePath : path$1.join(rootDirectory, filePath);
5927
6045
  try {
5928
- return fs.readFileSync(absolutePath, "utf-8").split("\n");
6046
+ return fs$1.readFileSync(absolutePath, "utf-8").split("\n");
5929
6047
  } catch {
5930
6048
  return null;
5931
6049
  }
@@ -5945,7 +6063,7 @@ var Files = class Files extends Context.Service()("react-doctor/Files") {
5945
6063
  * pattern in react-doctor-evals' test layers.
5946
6064
  */
5947
6065
  static layerInMemory = (tree) => {
5948
- const resolveAbsolute = (filePath, rootDirectory) => Path.isAbsolute(filePath) ? filePath : `${rootDirectory}/${filePath}`;
6066
+ const resolveAbsolute = (filePath, rootDirectory) => path$1.isAbsolute(filePath) ? filePath : `${rootDirectory}/${filePath}`;
5949
6067
  return Layer.succeed(Files, Files.of({
5950
6068
  readLines: (input) => Effect.sync(() => {
5951
6069
  const absolute = resolveAbsolute(input.filePath, input.rootDirectory);
@@ -6140,6 +6258,11 @@ var Git = class Git extends Context.Service()("react-doctor/Git") {
6140
6258
  branch
6141
6259
  ]).pipe(Effect.map((result) => result.status === 0));
6142
6260
  const headSha = (directory) => runGit(directory, ["rev-parse", "HEAD"]).pipe(Effect.map((result) => result.status === 0 ? trimOrNull(result.stdout) : null));
6261
+ const mergeBase = (input) => isSafeGitRevision(input.ref) ? runGit(input.directory, [
6262
+ "merge-base",
6263
+ input.ref,
6264
+ "HEAD"
6265
+ ]).pipe(Effect.map((result) => result.status === 0 ? trimOrNull(result.stdout) : null)) : Effect.succeed(null);
6143
6266
  const githubRepo = (directory) => runGit(directory, [
6144
6267
  "config",
6145
6268
  "--get",
@@ -6215,6 +6338,7 @@ var Git = class Git extends Context.Service()("react-doctor/Git") {
6215
6338
  return {
6216
6339
  currentBranch: yield* currentBranch(input.directory),
6217
6340
  baseBranch: baseRef,
6341
+ diffBaseRef,
6218
6342
  changedFiles: splitNullSeparated(diff.stdout),
6219
6343
  isCurrentChanges: false
6220
6344
  };
@@ -6226,6 +6350,7 @@ var Git = class Git extends Context.Service()("react-doctor/Git") {
6226
6350
  githubRepo,
6227
6351
  githubViewerPermission,
6228
6352
  branchExists,
6353
+ mergeBase,
6229
6354
  diffSelection: ({ directory, explicitBaseBranch }) => Effect.gen(function* () {
6230
6355
  if (explicitBaseBranch !== void 0 && explicitBaseBranch.trim().length === 0) return yield* Effect.fail(new ReactDoctorError({ reason: new GitBaseBranchInvalid({ detail: "Diff base branch cannot be empty." }) }));
6231
6356
  if (explicitBaseBranch !== void 0) {
@@ -6283,6 +6408,7 @@ var Git = class Git extends Context.Service()("react-doctor/Git") {
6283
6408
  return {
6284
6409
  currentBranch: resolvedCurrentBranch,
6285
6410
  baseBranch,
6411
+ diffBaseRef: mergeBaseRef,
6286
6412
  changedFiles: splitNullSeparated(diff.stdout),
6287
6413
  isCurrentChanges: false
6288
6414
  };
@@ -6304,6 +6430,12 @@ var Git = class Git extends Context.Service()("react-doctor/Git") {
6304
6430
  directory,
6305
6431
  maxStdoutBytes: options?.maxBufferBytes
6306
6432
  }).pipe(Effect.map((result) => result.status === 0 ? result.stdout : null)),
6433
+ showRefContent: ({ directory, ref, relativePath, options }) => isSafeGitRevision(ref) ? runCommand({
6434
+ command: "git",
6435
+ args: ["show", `${ref}:./${relativePath}`],
6436
+ directory,
6437
+ maxStdoutBytes: options?.maxBufferBytes
6438
+ }).pipe(Effect.map((result) => result.status === 0 ? result.stdout : null)) : Effect.succeed(null),
6307
6439
  grep: (input) => Effect.gen(function* () {
6308
6440
  const args = ["grep"];
6309
6441
  if (input.listMatchingFiles ?? true) args.push("-l");
@@ -6339,9 +6471,11 @@ var Git = class Git extends Context.Service()("react-doctor/Git") {
6339
6471
  githubRepo: () => Effect.succeed(snapshot.githubRepo ?? null),
6340
6472
  githubViewerPermission: () => Effect.succeed(snapshot.githubViewerPermission ?? null),
6341
6473
  branchExists: (_directory, branch) => Effect.succeed(snapshot.branchExists?.get(branch) ?? false),
6474
+ mergeBase: ({ ref }) => Effect.succeed(snapshot.mergeBase?.get(ref) ?? null),
6342
6475
  diffSelection: () => Effect.succeed(snapshot.diffSelection ?? null),
6343
6476
  stagedFilePaths: () => Effect.succeed(snapshot.stagedFiles ?? []),
6344
6477
  showStagedContent: (_directory, relativePath) => Effect.succeed(snapshot.stagedContent?.get(relativePath) ?? null),
6478
+ showRefContent: ({ ref, relativePath }) => Effect.succeed(snapshot.refContent?.get(`${ref}:${relativePath}`) ?? null),
6345
6479
  grep: () => Effect.sync(() => {
6346
6480
  const matches = snapshot.grepMatches;
6347
6481
  if (matches === null || matches === void 0) return null;
@@ -6435,7 +6569,7 @@ const canOxlintExtendConfig = (configPath) => {
6435
6569
  if (!configPath.endsWith(".eslintrc.json")) return true;
6436
6570
  let parsed;
6437
6571
  try {
6438
- parsed = parseJsonOrJsonc(fs.readFileSync(configPath, "utf-8"));
6572
+ parsed = parseJsonOrJsonc(fs$1.readFileSync(configPath, "utf-8"));
6439
6573
  } catch {
6440
6574
  return true;
6441
6575
  }
@@ -6448,7 +6582,7 @@ const canOxlintExtendConfig = (configPath) => {
6448
6582
  };
6449
6583
  const findFirstLintConfigInDirectory = (directory) => {
6450
6584
  for (const filename of ADOPTABLE_LINT_CONFIG_FILENAMES) {
6451
- const candidatePath = path.join(directory, filename);
6585
+ const candidatePath = path$1.join(directory, filename);
6452
6586
  if (isFile(candidatePath)) return candidatePath;
6453
6587
  }
6454
6588
  return null;
@@ -6457,12 +6591,12 @@ const detectUserLintConfigPaths = (rootDirectory) => {
6457
6591
  const directLintConfig = findFirstLintConfigInDirectory(rootDirectory);
6458
6592
  if (directLintConfig) return [directLintConfig];
6459
6593
  if (isProjectBoundary(rootDirectory)) return [];
6460
- let ancestorDirectory = path.dirname(rootDirectory);
6461
- while (ancestorDirectory !== path.dirname(ancestorDirectory)) {
6594
+ let ancestorDirectory = path$1.dirname(rootDirectory);
6595
+ while (ancestorDirectory !== path$1.dirname(ancestorDirectory)) {
6462
6596
  const ancestorLintConfig = findFirstLintConfigInDirectory(ancestorDirectory);
6463
6597
  if (ancestorLintConfig) return [ancestorLintConfig];
6464
6598
  if (isProjectBoundary(ancestorDirectory)) return [];
6465
- ancestorDirectory = path.dirname(ancestorDirectory);
6599
+ ancestorDirectory = path$1.dirname(ancestorDirectory);
6466
6600
  }
6467
6601
  return [];
6468
6602
  };
@@ -6491,10 +6625,10 @@ const findFilesWithDisableDirectivesViaFilesystem = (rootDirectory, includePaths
6491
6625
  const matches = [];
6492
6626
  const checkFile = (relativePath) => {
6493
6627
  if (!isLintableSourceFile(relativePath)) return;
6494
- const absolutePath = path.join(rootDirectory, relativePath);
6628
+ const absolutePath = path$1.join(rootDirectory, relativePath);
6495
6629
  let content;
6496
6630
  try {
6497
- content = fs.readFileSync(absolutePath, "utf-8");
6631
+ content = fs$1.readFileSync(absolutePath, "utf-8");
6498
6632
  } catch {
6499
6633
  return;
6500
6634
  }
@@ -6512,12 +6646,12 @@ const findFilesWithDisableDirectivesViaFilesystem = (rootDirectory, includePaths
6512
6646
  for (const entry of entries) {
6513
6647
  if (entry.isDirectory()) {
6514
6648
  if (entry.name.startsWith(".") || IGNORED_DIRECTORIES.has(entry.name)) continue;
6515
- stack.push(path.join(current, entry.name));
6649
+ stack.push(path$1.join(current, entry.name));
6516
6650
  continue;
6517
6651
  }
6518
6652
  if (!entry.isFile()) continue;
6519
- const absolute = path.join(current, entry.name);
6520
- checkFile(path.relative(rootDirectory, absolute));
6653
+ const absolute = path$1.join(current, entry.name);
6654
+ checkFile(path$1.relative(rootDirectory, absolute));
6521
6655
  }
6522
6656
  }
6523
6657
  return matches;
@@ -6532,7 +6666,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths) => {
6532
6666
  if (isRestored) return;
6533
6667
  isRestored = true;
6534
6668
  for (const [absolutePath, originalContent] of originalContents) try {
6535
- fs.writeFileSync(absolutePath, originalContent);
6669
+ fs$1.writeFileSync(absolutePath, originalContent);
6536
6670
  } catch (error) {
6537
6671
  process.stderr.write(`[react-doctor] Failed to restore inline disable directives in ${absolutePath}: ${error instanceof Error ? error.message : String(error)}\n[react-doctor] Run: git checkout -- ${absolutePath}\n`);
6538
6672
  }
@@ -6540,17 +6674,17 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths) => {
6540
6674
  const onExit = () => restore();
6541
6675
  process.once("exit", onExit);
6542
6676
  for (const relativePath of filePaths) {
6543
- const absolutePath = path.join(rootDirectory, relativePath);
6677
+ const absolutePath = path$1.join(rootDirectory, relativePath);
6544
6678
  let originalContent;
6545
6679
  try {
6546
- originalContent = fs.readFileSync(absolutePath, "utf-8");
6680
+ originalContent = fs$1.readFileSync(absolutePath, "utf-8");
6547
6681
  } catch {
6548
6682
  continue;
6549
6683
  }
6550
6684
  const neutralizedContent = neutralizeContent(originalContent);
6551
6685
  if (neutralizedContent !== originalContent) {
6552
6686
  originalContents.set(absolutePath, originalContent);
6553
- fs.writeFileSync(absolutePath, neutralizedContent);
6687
+ fs$1.writeFileSync(absolutePath, neutralizedContent);
6554
6688
  }
6555
6689
  }
6556
6690
  return () => {
@@ -6687,11 +6821,11 @@ const filterRulesToAvailable = (rules, pluginNamespace, availableRuleNames) => {
6687
6821
  * renamed.
6688
6822
  */
6689
6823
  const resolveUserPlugin = (spec, configSourceDirectory) => {
6690
- const isRelative = spec.startsWith("./") || spec.startsWith("../") || path.isAbsolute(spec);
6691
- const candidateRequire = createRequire(path.join(configSourceDirectory, "noop.js"));
6824
+ const isRelative = spec.startsWith("./") || spec.startsWith("../") || path$1.isAbsolute(spec);
6825
+ const candidateRequire = createRequire(path$1.join(configSourceDirectory, "noop.js"));
6692
6826
  let resolvedSpecifier;
6693
6827
  try {
6694
- resolvedSpecifier = isRelative ? path.resolve(configSourceDirectory, spec) : candidateRequire.resolve(spec);
6828
+ resolvedSpecifier = isRelative ? path$1.resolve(configSourceDirectory, spec) : candidateRequire.resolve(spec);
6695
6829
  } catch (error) {
6696
6830
  warnConfigIssue(`config.plugins entry "${spec}" could not be resolved from ${configSourceDirectory}: ${error instanceof Error ? error.message : String(error)}`);
6697
6831
  return null;
@@ -6731,8 +6865,8 @@ const resolveUserPlugins = (specs, configSourceDirectory) => {
6731
6865
  return resolved;
6732
6866
  };
6733
6867
  const resolveSettingsRootDirectory = (rootDirectory) => {
6734
- if (!fs.existsSync(rootDirectory)) return rootDirectory;
6735
- return fs.realpathSync(rootDirectory);
6868
+ if (!fs$1.existsSync(rootDirectory)) return rootDirectory;
6869
+ return fs$1.realpathSync(rootDirectory);
6736
6870
  };
6737
6871
  const resolveCompilerCleanupBucketSeverity = (ruleKey, severityControls) => {
6738
6872
  if (!COMPILER_CLEANUP_RULE_KEYS.has(ruleKey)) return void 0;
@@ -6808,6 +6942,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
6808
6942
  settings: { "react-doctor": {
6809
6943
  framework: project.framework,
6810
6944
  rootDirectory: resolveSettingsRootDirectory(project.rootDirectory),
6945
+ ...project.shopifyFlashListMajorVersion !== null ? { shopifyFlashListMajorVersion: project.shopifyFlashListMajorVersion } : {},
6811
6946
  ...serverAuthFunctionNames && serverAuthFunctionNames.length > 0 ? { serverAuthFunctionNames: [...serverAuthFunctionNames] } : {}
6812
6947
  } },
6813
6948
  rules: {
@@ -6820,13 +6955,13 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
6820
6955
  const esmRequire = createRequire(import.meta.url);
6821
6956
  const resolveOxlintBinary = () => {
6822
6957
  const oxlintMainPath = esmRequire.resolve("oxlint");
6823
- const oxlintPackageDirectory = path.resolve(path.dirname(oxlintMainPath), "..");
6824
- return path.join(oxlintPackageDirectory, "bin", "oxlint");
6958
+ const oxlintPackageDirectory = path$1.resolve(path$1.dirname(oxlintMainPath), "..");
6959
+ return path$1.join(oxlintPackageDirectory, "bin", "oxlint");
6825
6960
  };
6826
6961
  const resolvePluginPath = () => esmRequire.resolve("oxlint-plugin-react-doctor");
6827
6962
  const TSCONFIG_FILENAMES = ["tsconfig.json", "tsconfig.base.json"];
6828
6963
  const resolveTsConfigRelativePath = (rootDirectory) => {
6829
- for (const filename of TSCONFIG_FILENAMES) if (fs.existsSync(path.join(rootDirectory, filename))) return `./${filename}`;
6964
+ for (const filename of TSCONFIG_FILENAMES) if (fs$1.existsSync(path$1.join(rootDirectory, filename))) return `./${filename}`;
6830
6965
  return null;
6831
6966
  };
6832
6967
  const dedupeDiagnostics = (diagnostics) => {
@@ -7326,10 +7461,10 @@ const shouldSuppressLocalUseHookDiagnostic = (diagnostic, rootDirectory) => {
7326
7461
  if (!diagnostic.message.startsWith(REACT_HOOK_USE_MESSAGE_PREFIX)) return false;
7327
7462
  const primaryLabel = diagnostic.labels[0];
7328
7463
  if (!primaryLabel) return false;
7329
- const absolutePath = path.isAbsolute(diagnostic.filename) ? diagnostic.filename : path.join(rootDirectory, diagnostic.filename);
7464
+ const absolutePath = path$1.isAbsolute(diagnostic.filename) ? diagnostic.filename : path$1.join(rootDirectory, diagnostic.filename);
7330
7465
  let sourceText;
7331
7466
  try {
7332
- sourceText = fs.readFileSync(absolutePath, "utf-8");
7467
+ sourceText = fs$1.readFileSync(absolutePath, "utf-8");
7333
7468
  } catch {
7334
7469
  return false;
7335
7470
  }
@@ -7395,6 +7530,30 @@ const parseRuleCode = (code) => {
7395
7530
  };
7396
7531
  };
7397
7532
  const resolveDiagnosticCategory = (plugin, rule) => getRuleCategory(rule) ?? lookupOwnString(PLUGIN_CATEGORY_MAP, plugin) ?? "Bugs";
7533
+ /**
7534
+ * Maps oxlint's non-primary labels (`labels[1..]`) into related source
7535
+ * locations. Editors surface these as a diagnostic's
7536
+ * `relatedInformation`; non-editor consumers ignore the field. Labels
7537
+ * with empty text still carry a useful jump target, so they're kept
7538
+ * with a neutral message.
7539
+ */
7540
+ const buildRelatedLocations = (labels, filePath) => {
7541
+ if (labels.length <= 1) return [];
7542
+ const related = [];
7543
+ for (let labelIndex = 1; labelIndex < labels.length; labelIndex++) {
7544
+ const label = labels[labelIndex];
7545
+ if (!label?.span) continue;
7546
+ related.push({
7547
+ filePath,
7548
+ line: label.span.line ?? 0,
7549
+ column: label.span.column ?? 0,
7550
+ offset: label.span.offset,
7551
+ length: label.span.length,
7552
+ message: label.label ?? ""
7553
+ });
7554
+ }
7555
+ return related;
7556
+ };
7398
7557
  const isOxlintOutput = (value) => {
7399
7558
  if (typeof value !== "object" || value === null) return false;
7400
7559
  const candidate = value;
@@ -7420,7 +7579,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
7420
7579
  if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 200) }) });
7421
7580
  const minifiedFileCache = /* @__PURE__ */ new Map();
7422
7581
  const isMinifiedDiagnosticFile = (filename) => {
7423
- const absolutePath = path.isAbsolute(filename) ? filename : path.resolve(rootDirectory || ".", filename);
7582
+ const absolutePath = path$1.isAbsolute(filename) ? filename : path$1.resolve(rootDirectory || ".", filename);
7424
7583
  const cached = minifiedFileCache.get(absolutePath);
7425
7584
  if (cached !== void 0) return cached;
7426
7585
  const minified = isMinifiedSource(absolutePath);
@@ -7431,8 +7590,11 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
7431
7590
  const { plugin, rule } = parseRuleCode(diagnostic.code);
7432
7591
  const primaryLabel = diagnostic.labels[0];
7433
7592
  const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
7593
+ const normalizedFilePath = diagnostic.filename.replaceAll("\\", "/");
7594
+ const primarySpan = primaryLabel?.span;
7595
+ const relatedLocations = buildRelatedLocations(diagnostic.labels, normalizedFilePath);
7434
7596
  return {
7435
- filePath: diagnostic.filename.replaceAll("\\", "/"),
7597
+ filePath: normalizedFilePath,
7436
7598
  plugin,
7437
7599
  rule,
7438
7600
  severity: diagnostic.severity,
@@ -7440,9 +7602,14 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
7440
7602
  message: cleaned.message,
7441
7603
  help: cleaned.help,
7442
7604
  url: diagnostic.url,
7443
- line: primaryLabel?.span.line ?? 0,
7444
- column: primaryLabel?.span.column ?? 0,
7445
- category: resolveDiagnosticCategory(plugin, rule)
7605
+ line: primarySpan?.line ?? 0,
7606
+ column: primarySpan?.column ?? 0,
7607
+ ...primarySpan ? {
7608
+ offset: primarySpan.offset,
7609
+ length: primarySpan.length
7610
+ } : {},
7611
+ category: resolveDiagnosticCategory(plugin, rule),
7612
+ ...relatedLocations.length > 0 ? { relatedLocations } : {}
7446
7613
  };
7447
7614
  });
7448
7615
  };
@@ -7687,12 +7854,12 @@ const validateRuleRegistration = () => {
7687
7854
  * legitimate overwriter is `this` runner inside the same temp dir.
7688
7855
  */
7689
7856
  const writeOxlintConfig = (configPath, configToWrite) => {
7690
- fs.rmSync(configPath, { force: true });
7691
- const fileHandle = fs.openSync(configPath, "wx", 384);
7857
+ fs$1.rmSync(configPath, { force: true });
7858
+ const fileHandle = fs$1.openSync(configPath, "wx", 384);
7692
7859
  try {
7693
- fs.writeFileSync(fileHandle, JSON.stringify(configToWrite));
7860
+ fs$1.writeFileSync(fileHandle, JSON.stringify(configToWrite));
7694
7861
  } finally {
7695
- fs.closeSync(fileHandle);
7862
+ fs$1.closeSync(fileHandle);
7696
7863
  }
7697
7864
  };
7698
7865
  /**
@@ -7733,8 +7900,8 @@ const runOxlint = async (options) => {
7733
7900
  userPlugins
7734
7901
  });
7735
7902
  const restoreDisableDirectives = respectInlineDisables ? () => {} : await neutralizeDisableDirectives(rootDirectory, includePaths);
7736
- const configDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "react-doctor-oxlintrc-"));
7737
- const configPath = path.join(configDirectory, "oxlintrc.json");
7903
+ const configDirectory = fs$1.mkdtempSync(path$1.join(os.tmpdir(), "react-doctor-oxlintrc-"));
7904
+ const configPath = path$1.join(configDirectory, "oxlintrc.json");
7738
7905
  try {
7739
7906
  const baseArgs = [
7740
7907
  resolveOxlintBinary(),
@@ -7749,8 +7916,8 @@ const runOxlint = async (options) => {
7749
7916
  }
7750
7917
  const combinedPatterns = collectIgnorePatterns(rootDirectory);
7751
7918
  if (combinedPatterns.length > 0) {
7752
- const combinedIgnorePath = path.join(configDirectory, "combined.ignore");
7753
- fs.writeFileSync(combinedIgnorePath, `${combinedPatterns.join("\n")}\n`);
7919
+ const combinedIgnorePath = path$1.join(configDirectory, "combined.ignore");
7920
+ fs$1.writeFileSync(combinedIgnorePath, `${combinedPatterns.join("\n")}\n`);
7754
7921
  baseArgs.push("--ignore-path", combinedIgnorePath);
7755
7922
  }
7756
7923
  const fileBatches = batchIncludePaths(baseArgs, includePaths !== void 0 ? includePaths : listSourceFiles(rootDirectory));
@@ -7776,7 +7943,7 @@ const runOxlint = async (options) => {
7776
7943
  }
7777
7944
  } finally {
7778
7945
  restoreDisableDirectives();
7779
- fs.rmSync(configDirectory, {
7946
+ fs$1.rmSync(configDirectory, {
7780
7947
  recursive: true,
7781
7948
  force: true
7782
7949
  });
@@ -7978,7 +8145,7 @@ var Reporter = class Reporter extends Context.Service()("react-doctor/Reporter")
7978
8145
  * `Diagnostic` schema.
7979
8146
  */
7980
8147
  static layerNdjson = (filePath) => Layer.effect(Reporter, Effect.sync(() => {
7981
- fs$1.mkdirSync(Path.dirname(filePath), { recursive: true });
8148
+ fs$1.mkdirSync(path$1.dirname(filePath), { recursive: true });
7982
8149
  const handle = fs$1.openSync(filePath, "a");
7983
8150
  const encode = Schema.encodeUnknownSync(Diagnostic);
7984
8151
  const emit = (diagnostic) => Effect.sync(() => {
@@ -8029,6 +8196,7 @@ const calculateScore = async (diagnostics, options = {}) => {
8029
8196
  ...typeof options.metadata?.sourceFileCount === "number" ? { sourceFileCount: options.metadata.sourceFileCount } : {},
8030
8197
  ...options.metadata?.defaultBranch ? { defaultBranch: options.metadata.defaultBranch } : {},
8031
8198
  ...options.metadata?.doctorVersion ? { doctorVersion: options.metadata.doctorVersion } : {},
8199
+ ...options.metadata?.runId ? { runId: options.metadata.runId } : {},
8032
8200
  ...options.metadata?.githubEventName ? { githubEventName: options.metadata.githubEventName } : {},
8033
8201
  ...options.metadata?.githubActorAssociation ? { githubActorAssociation: options.metadata.githubActorAssociation } : {},
8034
8202
  ...options.metadata?.githubViewerPermission ? { githubViewerPermission: options.metadata.githubViewerPermission } : {}
@@ -8087,7 +8255,7 @@ const getStringProperty = (value, propertyName) => {
8087
8255
  const readGithubEventPayload = (eventPath) => {
8088
8256
  if (eventPath === void 0 || eventPath.length === 0) return null;
8089
8257
  try {
8090
- return JSON.parse(readFileSync(eventPath, "utf8"));
8258
+ return JSON.parse(fs$1.readFileSync(eventPath, "utf8"));
8091
8259
  } catch {
8092
8260
  return null;
8093
8261
  }
@@ -8170,8 +8338,8 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
8170
8338
  directory: scanDirectory,
8171
8339
  repo
8172
8340
  }).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
8173
- const lintIncludePaths = computeJsxIncludePaths([...input.includePaths]) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config);
8174
- const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path.resolve(scanDirectory, relativePath)) : [];
8341
+ const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeJsxIncludePaths([...input.includePaths])) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config);
8342
+ const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
8175
8343
  const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
8176
8344
  const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
8177
8345
  yield* beforeLint(project, lintIncludePaths ?? void 0);
@@ -8268,6 +8436,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
8268
8436
  sourceFileCount: project.sourceFileCount,
8269
8437
  ...defaultBranch !== null ? { defaultBranch } : {},
8270
8438
  ...input.doctorVersion !== void 0 ? { doctorVersion: input.doctorVersion } : {},
8439
+ ...input.runId !== void 0 ? { runId: input.runId } : {},
8271
8440
  ...githubActionsScoreMetadata,
8272
8441
  ...githubViewerPermission !== null ? { githubViewerPermission } : {}
8273
8442
  };
@@ -8321,25 +8490,25 @@ const isNodeVersionCompatibleWithOxlint = ({ major, minor }) => {
8321
8490
  const isCurrentNodeCompatibleWithOxlint = () => isNodeVersionCompatibleWithOxlint(parseNodeVersion(process.version));
8322
8491
  const getNvmDirectory = () => {
8323
8492
  const envNvmDirectory = process.env.NVM_DIR;
8324
- if (envNvmDirectory && existsSync(envNvmDirectory)) return envNvmDirectory;
8325
- const defaultNvmDirectory = path.join(os.homedir(), ".nvm");
8326
- if (existsSync(defaultNvmDirectory)) return defaultNvmDirectory;
8493
+ if (envNvmDirectory && fs$1.existsSync(envNvmDirectory)) return envNvmDirectory;
8494
+ const defaultNvmDirectory = path$1.join(os.homedir(), ".nvm");
8495
+ if (fs$1.existsSync(defaultNvmDirectory)) return defaultNvmDirectory;
8327
8496
  return null;
8328
8497
  };
8329
8498
  const isNvmInstalled = () => getNvmDirectory() !== null;
8330
8499
  const findCompatibleNvmBinary = () => {
8331
8500
  const nvmDirectory = getNvmDirectory();
8332
8501
  if (!nvmDirectory) return null;
8333
- const versionsDirectory = path.join(nvmDirectory, "versions", "node");
8334
- if (!existsSync(versionsDirectory)) return null;
8335
- const compatibleVersions = readdirSync(versionsDirectory).filter((directoryName) => directoryName.startsWith("v")).map((directoryName) => ({
8502
+ const versionsDirectory = path$1.join(nvmDirectory, "versions", "node");
8503
+ if (!fs$1.existsSync(versionsDirectory)) return null;
8504
+ const compatibleVersions = fs$1.readdirSync(versionsDirectory).filter((directoryName) => directoryName.startsWith("v")).map((directoryName) => ({
8336
8505
  directoryName,
8337
8506
  ...parseNodeVersion(directoryName)
8338
8507
  })).filter((version) => isNodeVersionCompatibleWithOxlint(version)).sort((versionA, versionB) => versionB.major - versionA.major || versionB.minor - versionA.minor || versionB.patch - versionA.patch);
8339
8508
  if (compatibleVersions.length === 0) return null;
8340
8509
  const bestVersion = compatibleVersions[0];
8341
- const binaryPath = path.join(versionsDirectory, bestVersion.directoryName, "bin", "node");
8342
- return existsSync(binaryPath) ? binaryPath : null;
8510
+ const binaryPath = path$1.join(versionsDirectory, bestVersion.directoryName, "bin", "node");
8511
+ return fs$1.existsSync(binaryPath) ? binaryPath : null;
8343
8512
  };
8344
8513
  const getNodeVersionFromBinary = (binaryPath) => {
8345
8514
  const result = spawnSync(binaryPath, ["--version"], { encoding: "utf-8" });
@@ -8349,8 +8518,8 @@ const getNodeVersionFromBinary = (binaryPath) => {
8349
8518
  const installNodeViaNvm = () => {
8350
8519
  const nvmDirectory = getNvmDirectory();
8351
8520
  if (!nvmDirectory) return false;
8352
- const nvmScript = path.join(nvmDirectory, "nvm.sh");
8353
- if (!existsSync(nvmScript)) return false;
8521
+ const nvmScript = path$1.join(nvmDirectory, "nvm.sh");
8522
+ if (!fs$1.existsSync(nvmScript)) return false;
8354
8523
  const result = spawnSync("bash", ["-c", ". \"$NVM_SCRIPT\" && nvm install \"$NODE_MAJOR\""], {
8355
8524
  stdio: "inherit",
8356
8525
  env: {
@@ -8404,57 +8573,74 @@ const resolveNodeForOxlint = () => {
8404
8573
  });
8405
8574
  });
8406
8575
  /**
8407
- * Zip-Slip defense: `git diff --cached --name-only` is the source
8408
- * of `relativePath`, and git normalizes paths during ordinary
8409
- * `git add`. But a deliberately crafted index entry (via
8410
- * `git update-index --add`, a malicious pack, or a symlinked
8411
- * working tree) can include `..` segments that escape the temp
8412
- * tree. Resolve the candidate against the temp dir and reject any
8413
- * result that lands outside it before `writeFileSync` runs.
8576
+ * Zip-Slip defense: relative paths come from git (`diff --name-only`), which
8577
+ * normalizes during ordinary adds, but a crafted index/pack/symlinked tree can
8578
+ * smuggle `..` segments that escape the temp root. Resolve against the temp dir
8579
+ * and reject anything that lands outside before writing.
8414
8580
  */
8415
8581
  const isPathInsideDirectory = (childAbsolutePath, parentAbsolutePath) => {
8416
8582
  const relative = path.relative(parentAbsolutePath, childAbsolutePath);
8417
8583
  return Boolean(relative) && !relative.startsWith("..") && !path.isAbsolute(relative);
8418
8584
  };
8585
+ /**
8586
+ * Writes a set of source files (supplied by `readContent` — e.g.
8587
+ * `git show <ref>:<path>` for a baseline tree, or `git show :<path>` for the
8588
+ * index) into a temp tree that mirrors the project layout, copying the
8589
+ * well-known project-config files from `directory` so oxlint resolves
8590
+ * tsconfig / lint config identically to the working tree. Shared by the staged
8591
+ * and baseline scan paths so the zip-slip guard lives in one audited place.
8592
+ * Per-file read failures skip that file (the scan proceeds with whatever read
8593
+ * cleanly) rather than sinking the whole snapshot.
8594
+ */
8595
+ const materializeSourceTree = (input) => Effect.gen(function* () {
8596
+ const materializedFiles = [];
8597
+ const resolvedTempDirectory = path.resolve(input.tempDirectory);
8598
+ for (const relativePath of input.files) {
8599
+ const content = yield* input.readContent(relativePath).pipe(Effect.orElseSucceed(() => null));
8600
+ if (content === null) continue;
8601
+ const candidateTargetPath = path.resolve(resolvedTempDirectory, relativePath);
8602
+ if (!isPathInsideDirectory(candidateTargetPath, resolvedTempDirectory)) continue;
8603
+ yield* Effect.sync(() => {
8604
+ fs.mkdirSync(path.dirname(candidateTargetPath), { recursive: true });
8605
+ fs.writeFileSync(candidateTargetPath, content);
8606
+ });
8607
+ materializedFiles.push(relativePath);
8608
+ }
8609
+ yield* Effect.sync(() => {
8610
+ for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
8611
+ const sourcePath = path.join(input.directory, configFilename);
8612
+ const targetPath = path.join(resolvedTempDirectory, configFilename);
8613
+ if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) fs.cpSync(sourcePath, targetPath);
8614
+ }
8615
+ });
8616
+ return {
8617
+ tempDirectory: input.tempDirectory,
8618
+ materializedFiles,
8619
+ cleanup: () => {
8620
+ try {
8621
+ fs.rmSync(input.tempDirectory, {
8622
+ recursive: true,
8623
+ force: true
8624
+ });
8625
+ } catch {}
8626
+ }
8627
+ };
8628
+ });
8419
8629
  (class StagedFiles extends Context.Service()("react-doctor/StagedFiles") {
8420
8630
  static layerNode = Layer.effect(StagedFiles, Effect.gen(function* () {
8421
8631
  const git = yield* Git;
8422
8632
  return StagedFiles.of({
8423
8633
  discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(Effect.map((entries) => entries.filter(isLintableSourceFile))),
8424
- materialize: ({ directory, stagedFiles, tempDirectory }) => Effect.gen(function* () {
8425
- const materializedFiles = [];
8426
- const resolvedTempDirectory = path.resolve(tempDirectory);
8427
- for (const relativePath of stagedFiles) {
8428
- const content = yield* git.showStagedContent(directory, relativePath, { maxBufferBytes: GIT_SHOW_MAX_BUFFER_BYTES }).pipe(Effect.orElseSucceed(() => null));
8429
- if (content === null) continue;
8430
- const candidateTargetPath = path.resolve(resolvedTempDirectory, relativePath);
8431
- if (!isPathInsideDirectory(candidateTargetPath, resolvedTempDirectory)) continue;
8432
- yield* Effect.sync(() => {
8433
- fs.mkdirSync(path.dirname(candidateTargetPath), { recursive: true });
8434
- fs.writeFileSync(candidateTargetPath, content);
8435
- });
8436
- materializedFiles.push(relativePath);
8437
- }
8438
- yield* Effect.sync(() => {
8439
- for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
8440
- const sourcePath = path.join(directory, configFilename);
8441
- const targetPath = path.join(resolvedTempDirectory, configFilename);
8442
- if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) fs.cpSync(sourcePath, targetPath);
8443
- }
8444
- });
8445
- return {
8446
- tempDirectory,
8447
- stagedFiles: materializedFiles,
8448
- cleanup: () => {
8449
- try {
8450
- fs.rmSync(tempDirectory, {
8451
- recursive: true,
8452
- force: true
8453
- });
8454
- } catch {}
8455
- }
8456
- };
8457
- })
8634
+ materialize: ({ directory, stagedFiles, tempDirectory }) => materializeSourceTree({
8635
+ directory,
8636
+ files: stagedFiles,
8637
+ tempDirectory,
8638
+ readContent: (relativePath) => git.showStagedContent(directory, relativePath, { maxBufferBytes: GIT_SHOW_MAX_BUFFER_BYTES })
8639
+ }).pipe(Effect.map((tree) => ({
8640
+ tempDirectory: tree.tempDirectory,
8641
+ stagedFiles: tree.materializedFiles,
8642
+ cleanup: tree.cleanup
8643
+ })))
8458
8644
  });
8459
8645
  }));
8460
8646
  /**
@@ -8500,18 +8686,22 @@ const safeGetErrorChain = (error) => {
8500
8686
  };
8501
8687
  const buildJsonReportError = (input) => {
8502
8688
  const chain = safeGetErrorChain(input.error);
8689
+ const sentryEventId = input.sentryEventId ?? null;
8503
8690
  const errorPayload = isReactDoctorError(input.error) ? {
8504
8691
  message: formatReactDoctorError(input.error),
8505
8692
  name: `ReactDoctorError(${input.error.reason._tag})`,
8506
- chain
8693
+ chain,
8694
+ sentryEventId
8507
8695
  } : input.error instanceof Error ? {
8508
8696
  message: input.error.message || input.error.name || "Error",
8509
8697
  name: input.error.name || "Error",
8510
- chain
8698
+ chain,
8699
+ sentryEventId
8511
8700
  } : {
8512
8701
  message: safeStringify(input.error),
8513
8702
  name: "Error",
8514
- chain
8703
+ chain,
8704
+ sentryEventId
8515
8705
  };
8516
8706
  return {
8517
8707
  schemaVersion: 1,
@@ -8587,12 +8777,10 @@ const buildJsonReport = (input) => {
8587
8777
  const flattenedDiagnostics = projects.flatMap((entry) => entry.diagnostics);
8588
8778
  const worstScoredProject = findWorstScoredProject(projects);
8589
8779
  const summary = summarizeDiagnostics(flattenedDiagnostics, worstScoredProject?.score?.score ?? null, worstScoredProject?.score?.label ?? null);
8590
- return {
8591
- schemaVersion: 1,
8780
+ const shared = {
8592
8781
  version: input.version,
8593
8782
  ok: true,
8594
8783
  directory: input.directory,
8595
- mode: input.mode,
8596
8784
  diff: toJsonDiff(input.diff),
8597
8785
  projects,
8598
8786
  diagnostics: flattenedDiagnostics,
@@ -8600,6 +8788,22 @@ const buildJsonReport = (input) => {
8600
8788
  elapsedMilliseconds: input.totalElapsedMilliseconds,
8601
8789
  error: null
8602
8790
  };
8791
+ if (input.baseline) return {
8792
+ schemaVersion: 2,
8793
+ mode: "baseline",
8794
+ baseline: {
8795
+ baseRef: input.baseline.baseRef,
8796
+ newCount: summary.totalDiagnosticCount,
8797
+ fixedCount: input.baseline.fixedCount,
8798
+ baseTotalCount: input.baseline.baseTotalCount
8799
+ },
8800
+ ...shared
8801
+ };
8802
+ return {
8803
+ schemaVersion: 1,
8804
+ mode: input.mode,
8805
+ ...shared
8806
+ };
8603
8807
  };
8604
8808
  /**
8605
8809
  * Single source of truth for the skipped-check accounting shared by the
@@ -8643,6 +8847,7 @@ const getDiffInfo = (directory, explicitBaseBranch) => Effect.runPromise(Effect.
8643
8847
  return {
8644
8848
  currentBranch: selection.currentBranch,
8645
8849
  baseBranch: selection.baseBranch,
8850
+ ...selection.diffBaseRef !== void 0 ? { diffBaseRef: selection.diffBaseRef } : {},
8646
8851
  changedFiles: [...selection.changedFiles],
8647
8852
  ...selection.isCurrentChanges ? { isCurrentChanges: true } : {}
8648
8853
  };
@@ -8724,4 +8929,4 @@ const toJsonReport = (result, options) => buildJsonReport({
8724
8929
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
8725
8930
 
8726
8931
  //# sourceMappingURL=index.js.map
8727
- //# debugId=9b91fa51-6642-5351-a848-af91945dec6f
8932
+ //# debugId=44e73f8d-b81f-599b-a04e-22497cd72bb2