react-doctor 0.2.18-dev.f375dbb → 0.3.0

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]="78466bb6-1333-5899-a21b-ca9ce49351a3")}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";
@@ -2075,7 +2075,7 @@ var AmbiguousProjectError = class extends Error {
2075
2075
  const isProjectDiscoveryError = (value) => value instanceof ProjectNotFoundError || value instanceof NoReactDependencyError || value instanceof PackageJsonNotFoundError || value instanceof NotADirectoryError || value instanceof AmbiguousProjectError;
2076
2076
  const isFile = (filePath) => {
2077
2077
  try {
2078
- return fs.statSync(filePath).isFile();
2078
+ return fs$1.statSync(filePath).isFile();
2079
2079
  } catch {
2080
2080
  return false;
2081
2081
  }
@@ -2102,9 +2102,9 @@ const isLintableSourceFile = (filePath) => SOURCE_FILE_PATTERN.test(filePath) &&
2102
2102
  const isMinifiedSource = (absolutePath) => {
2103
2103
  let fileDescriptor;
2104
2104
  try {
2105
- fileDescriptor = fs.openSync(absolutePath, "r");
2105
+ fileDescriptor = fs$1.openSync(absolutePath, "r");
2106
2106
  const buffer = Buffer.alloc(MINIFIED_SNIFF_BYTES);
2107
- const bytesRead = fs.readSync(fileDescriptor, buffer, 0, MINIFIED_SNIFF_BYTES, 0);
2107
+ const bytesRead = fs$1.readSync(fileDescriptor, buffer, 0, MINIFIED_SNIFF_BYTES, 0);
2108
2108
  const prefix = buffer.toString("utf8", 0, bytesRead);
2109
2109
  const lines = prefix.split("\n");
2110
2110
  const longestLineLength = lines.reduce((longest, line) => Math.max(longest, line.length), 0);
@@ -2113,13 +2113,13 @@ const isMinifiedSource = (absolutePath) => {
2113
2113
  } catch {
2114
2114
  return false;
2115
2115
  } finally {
2116
- if (fileDescriptor !== void 0) fs.closeSync(fileDescriptor);
2116
+ if (fileDescriptor !== void 0) fs$1.closeSync(fileDescriptor);
2117
2117
  }
2118
2118
  };
2119
2119
  const isLargeMinifiedFile = (absolutePath) => {
2120
2120
  let sizeBytes;
2121
2121
  try {
2122
- sizeBytes = fs.statSync(absolutePath).size;
2122
+ sizeBytes = fs$1.statSync(absolutePath).size;
2123
2123
  } catch {
2124
2124
  return false;
2125
2125
  }
@@ -2130,7 +2130,10 @@ const IGNORABLE_READDIR_ERROR_CODES = new Set([
2130
2130
  "EACCES",
2131
2131
  "EPERM",
2132
2132
  "ENOENT",
2133
- "ENOTDIR"
2133
+ "ENOTDIR",
2134
+ "EINVAL",
2135
+ "ELOOP",
2136
+ "ENAMETOOLONG"
2134
2137
  ]);
2135
2138
  const isIgnorableReaddirError = (error) => {
2136
2139
  if (typeof error !== "object" || error === null) return false;
@@ -2139,7 +2142,7 @@ const isIgnorableReaddirError = (error) => {
2139
2142
  };
2140
2143
  const readDirectoryEntries = (directoryPath) => {
2141
2144
  try {
2142
- return fs.readdirSync(directoryPath, { withFileTypes: true });
2145
+ return fs$1.readdirSync(directoryPath, { withFileTypes: true });
2143
2146
  } catch (error) {
2144
2147
  if (isIgnorableReaddirError(error)) return [];
2145
2148
  throw error;
@@ -2153,10 +2156,10 @@ const countSourceFilesViaFilesystem = (rootDirectory) => {
2153
2156
  const entries = readDirectoryEntries(currentDirectory);
2154
2157
  for (const entry of entries) {
2155
2158
  if (entry.isDirectory()) {
2156
- if (!entry.name.startsWith(".") && !IGNORED_DIRECTORIES.has(entry.name)) stack.push(path.join(currentDirectory, entry.name));
2159
+ if (!entry.name.startsWith(".") && !IGNORED_DIRECTORIES.has(entry.name)) stack.push(path$1.join(currentDirectory, entry.name));
2157
2160
  continue;
2158
2161
  }
2159
- if (entry.isFile() && isLintableSourceFile(entry.name) && !isLargeMinifiedFile(path.join(currentDirectory, entry.name))) count++;
2162
+ if (entry.isFile() && isLintableSourceFile(entry.name) && !isLargeMinifiedFile(path$1.join(currentDirectory, entry.name))) count++;
2160
2163
  }
2161
2164
  }
2162
2165
  return count;
@@ -2174,7 +2177,7 @@ const countSourceFilesViaGit = (rootDirectory) => {
2174
2177
  maxBuffer: GIT_LS_FILES_MAX_BUFFER_BYTES
2175
2178
  });
2176
2179
  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;
2180
+ return result.stdout.split("\0").filter((filePath) => filePath.length > 0 && isLintableSourceFile(filePath) && !isLargeMinifiedFile(path$1.resolve(rootDirectory, filePath))).length;
2178
2181
  };
2179
2182
  const countSourceFiles = (rootDirectory) => countSourceFilesViaGit(rootDirectory) ?? countSourceFilesViaFilesystem(rootDirectory);
2180
2183
  const cachedPackageJsons = /* @__PURE__ */ new Map();
@@ -2183,7 +2186,7 @@ const clearPackageJsonCache = () => {
2183
2186
  };
2184
2187
  const readPackageJsonUncached = (packageJsonPath) => {
2185
2188
  try {
2186
- return JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
2189
+ return JSON.parse(fs$1.readFileSync(packageJsonPath, "utf-8"));
2187
2190
  } catch (error) {
2188
2191
  if (error instanceof SyntaxError) return {};
2189
2192
  if (error instanceof Error && "code" in error) {
@@ -2194,7 +2197,7 @@ const readPackageJsonUncached = (packageJsonPath) => {
2194
2197
  }
2195
2198
  };
2196
2199
  const readPackageJson = (packageJsonPath) => {
2197
- const absolutePath = path.resolve(packageJsonPath);
2200
+ const absolutePath = path$1.resolve(packageJsonPath);
2198
2201
  const cached = cachedPackageJsons.get(absolutePath);
2199
2202
  if (cached !== void 0) return cached;
2200
2203
  const result = readPackageJsonUncached(absolutePath);
@@ -2202,18 +2205,18 @@ const readPackageJson = (packageJsonPath) => {
2202
2205
  return result;
2203
2206
  };
2204
2207
  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");
2208
+ if (isFile(path$1.join(directory, "pnpm-workspace.yaml"))) return true;
2209
+ if (isFile(path$1.join(directory, "nx.json"))) return true;
2210
+ const packageJsonPath = path$1.join(directory, "package.json");
2208
2211
  if (!isFile(packageJsonPath)) return false;
2209
2212
  const packageJson = readPackageJson(packageJsonPath);
2210
2213
  return Array.isArray(packageJson.workspaces) || Boolean(packageJson.workspaces?.packages);
2211
2214
  };
2212
2215
  const findMonorepoRoot = (startDirectory) => {
2213
- let currentDirectory = path.dirname(startDirectory);
2214
- while (currentDirectory !== path.dirname(currentDirectory)) {
2216
+ let currentDirectory = path$1.dirname(startDirectory);
2217
+ while (currentDirectory !== path$1.dirname(currentDirectory)) {
2215
2218
  if (isMonorepoRoot(currentDirectory)) return currentDirectory;
2216
- currentDirectory = path.dirname(currentDirectory);
2219
+ currentDirectory = path$1.dirname(currentDirectory);
2217
2220
  }
2218
2221
  return null;
2219
2222
  };
@@ -2227,7 +2230,7 @@ const findMonorepoRoot = (startDirectory) => {
2227
2230
  * `detectReactCompiler`. All three previously inlined their own
2228
2231
  * byte-equivalent copy.
2229
2232
  */
2230
- const isProjectBoundary = (directory) => fs.existsSync(path.join(directory, ".git")) || isMonorepoRoot(directory);
2233
+ const isProjectBoundary = (directory) => fs$1.existsSync(path$1.join(directory, ".git")) || isMonorepoRoot(directory);
2231
2234
  const REACT_COMPILER_PACKAGES = new Set([
2232
2235
  "babel-plugin-react-compiler",
2233
2236
  "react-compiler-runtime",
@@ -2274,10 +2277,10 @@ const hasCompilerPackage = (packageJson) => {
2274
2277
  };
2275
2278
  const hasCompilerInConfigFile = (filePath) => {
2276
2279
  if (!isFile(filePath)) return false;
2277
- const content = fs.readFileSync(filePath, "utf-8");
2280
+ const content = fs$1.readFileSync(filePath, "utf-8");
2278
2281
  return REACT_COMPILER_ENABLED_FLAG_PATTERN.test(content) || REACT_COMPILER_PACKAGE_REFERENCE_PATTERN.test(content);
2279
2282
  };
2280
- const hasCompilerInConfigFiles = (directory, filenames) => filenames.some((filename) => hasCompilerInConfigFile(path.join(directory, filename)));
2283
+ const hasCompilerInConfigFiles = (directory, filenames) => filenames.some((filename) => hasCompilerInConfigFile(path$1.join(directory, filename)));
2281
2284
  const detectReactCompiler = (directory, packageJson) => {
2282
2285
  if (hasCompilerPackage(packageJson)) return true;
2283
2286
  if (hasCompilerInConfigFiles(directory, NEXT_CONFIG_FILENAMES)) return true;
@@ -2285,14 +2288,14 @@ const detectReactCompiler = (directory, packageJson) => {
2285
2288
  if (hasCompilerInConfigFiles(directory, VITE_CONFIG_FILENAMES)) return true;
2286
2289
  if (hasCompilerInConfigFiles(directory, EXPO_APP_CONFIG_FILENAMES)) return true;
2287
2290
  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");
2291
+ let ancestorDirectory = path$1.dirname(directory);
2292
+ while (ancestorDirectory !== path$1.dirname(ancestorDirectory)) {
2293
+ const ancestorPackagePath = path$1.join(ancestorDirectory, "package.json");
2291
2294
  if (isFile(ancestorPackagePath)) {
2292
2295
  if (hasCompilerPackage(readPackageJson(ancestorPackagePath))) return true;
2293
2296
  }
2294
2297
  if (isProjectBoundary(ancestorDirectory)) return false;
2295
- ancestorDirectory = path.dirname(ancestorDirectory);
2298
+ ancestorDirectory = path$1.dirname(ancestorDirectory);
2296
2299
  }
2297
2300
  return false;
2298
2301
  };
@@ -2478,12 +2481,12 @@ const resolveVersionFromCatalog = (catalog, packageName) => {
2478
2481
  return null;
2479
2482
  };
2480
2483
  const parsePnpmWorkspaceCatalogs = (rootDirectory) => {
2481
- const workspacePath = path.join(rootDirectory, "pnpm-workspace.yaml");
2484
+ const workspacePath = path$1.join(rootDirectory, "pnpm-workspace.yaml");
2482
2485
  if (!isFile(workspacePath)) return {
2483
2486
  defaultCatalog: {},
2484
2487
  namedCatalogs: {}
2485
2488
  };
2486
- const content = fs.readFileSync(workspacePath, "utf-8");
2489
+ const content = fs$1.readFileSync(workspacePath, "utf-8");
2487
2490
  const defaultCatalog = {};
2488
2491
  const namedCatalogs = {};
2489
2492
  let currentSection = "none";
@@ -2664,7 +2667,7 @@ const getDependencyDeclaration = ({ packageJson, packageName, sections }) => {
2664
2667
  };
2665
2668
  const isDirectory = (directoryPath) => {
2666
2669
  try {
2667
- return fs.statSync(directoryPath).isDirectory();
2670
+ return fs$1.statSync(directoryPath).isDirectory();
2668
2671
  } catch {
2669
2672
  return false;
2670
2673
  }
@@ -2675,23 +2678,23 @@ const NX_PROJECT_DISCOVERY_DIRS = [
2675
2678
  "packages"
2676
2679
  ];
2677
2680
  const getNxWorkspaceDirectories = (rootDirectory) => {
2678
- if (!isFile(path.join(rootDirectory, "nx.json"))) return [];
2681
+ if (!isFile(path$1.join(rootDirectory, "nx.json"))) return [];
2679
2682
  const collected = [];
2680
2683
  for (const candidate of NX_PROJECT_DISCOVERY_DIRS) {
2681
- const candidatePath = path.join(rootDirectory, candidate);
2684
+ const candidatePath = path$1.join(rootDirectory, candidate);
2682
2685
  if (!isDirectory(candidatePath)) continue;
2683
2686
  for (const entry of readDirectoryEntries(candidatePath)) {
2684
2687
  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}`);
2688
+ const projectDirectory = path$1.join(candidatePath, entry.name);
2689
+ if (isFile(path$1.join(projectDirectory, "project.json")) || isFile(path$1.join(projectDirectory, "package.json"))) collected.push(`${candidate}/${entry.name}`);
2687
2690
  }
2688
2691
  }
2689
2692
  return collected;
2690
2693
  };
2691
2694
  const parsePnpmWorkspacePatterns = (rootDirectory) => {
2692
- const workspacePath = path.join(rootDirectory, "pnpm-workspace.yaml");
2695
+ const workspacePath = path$1.join(rootDirectory, "pnpm-workspace.yaml");
2693
2696
  if (!isFile(workspacePath)) return [];
2694
- const content = fs.readFileSync(workspacePath, "utf-8");
2697
+ const content = fs$1.readFileSync(workspacePath, "utf-8");
2695
2698
  const patterns = [];
2696
2699
  let isInsidePackagesBlock = false;
2697
2700
  for (const line of content.split("\n")) {
@@ -2721,18 +2724,18 @@ const parseReactMajor = (reactVersion) => {
2721
2724
  const resolveWorkspaceDirectories = (rootDirectory, pattern) => {
2722
2725
  const cleanPattern = pattern.replace(/["']/g, "").replace(/\/\*\*$/, "/*");
2723
2726
  if (!cleanPattern.includes("*")) {
2724
- const directoryPath = path.join(rootDirectory, cleanPattern);
2725
- if (isDirectory(directoryPath) && isFile(path.join(directoryPath, "package.json"))) return [directoryPath];
2727
+ const directoryPath = path$1.join(rootDirectory, cleanPattern);
2728
+ if (isDirectory(directoryPath) && isFile(path$1.join(directoryPath, "package.json"))) return [directoryPath];
2726
2729
  return [];
2727
2730
  }
2728
2731
  const wildcardIndex = cleanPattern.indexOf("*");
2729
- const baseDirectory = path.join(rootDirectory, cleanPattern.slice(0, wildcardIndex));
2732
+ const baseDirectory = path$1.join(rootDirectory, cleanPattern.slice(0, wildcardIndex));
2730
2733
  const suffixAfterWildcard = cleanPattern.slice(wildcardIndex + 1);
2731
2734
  if (!isDirectory(baseDirectory)) return [];
2732
2735
  const resolved = [];
2733
2736
  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);
2737
+ const entryPath = path$1.join(baseDirectory, entry.name, suffixAfterWildcard);
2738
+ if (isDirectory(entryPath) && isFile(path$1.join(entryPath, "package.json"))) resolved.push(entryPath);
2736
2739
  }
2737
2740
  return resolved;
2738
2741
  };
@@ -2759,7 +2762,7 @@ const findReactInWorkspaces = (rootDirectory, packageJson) => {
2759
2762
  for (const pattern of patterns) {
2760
2763
  const directories = resolveWorkspaceDirectories(rootDirectory, pattern);
2761
2764
  for (const workspaceDirectory of directories) {
2762
- const workspacePackageJson = readPackageJson(path.join(workspaceDirectory, "package.json"));
2765
+ const workspacePackageJson = readPackageJson(path$1.join(workspaceDirectory, "package.json"));
2763
2766
  const info = extractDependencyInfo(workspacePackageJson);
2764
2767
  const reactVersion = resolveWorkspaceDependencyVersion({
2765
2768
  concreteVersion: info.reactVersion,
@@ -2813,11 +2816,11 @@ const findReactInWorkspaces = (rootDirectory, packageJson) => {
2813
2816
  const findDependencyInfoFromMonorepoRoot = (directory) => {
2814
2817
  const monorepoRoot = findMonorepoRoot(directory);
2815
2818
  if (!monorepoRoot) return EMPTY_DEPENDENCY_INFO;
2816
- const monorepoPackageJsonPath = path.join(monorepoRoot, "package.json");
2819
+ const monorepoPackageJsonPath = path$1.join(monorepoRoot, "package.json");
2817
2820
  if (!isFile(monorepoPackageJsonPath)) return EMPTY_DEPENDENCY_INFO;
2818
2821
  const rootPackageJson = readPackageJson(monorepoPackageJsonPath);
2819
2822
  const rootInfo = extractDependencyInfo(rootPackageJson);
2820
- const leafPackageJsonPath = path.join(directory, "package.json");
2823
+ const leafPackageJsonPath = path$1.join(directory, "package.json");
2821
2824
  const leafPackageJson = isFile(leafPackageJsonPath) ? readPackageJson(leafPackageJsonPath) : null;
2822
2825
  const leafReactDeclaration = leafPackageJson ? getDependencyDeclaration({
2823
2826
  packageJson: leafPackageJson,
@@ -2871,7 +2874,7 @@ const findInWorkspacePackageJsons = (rootDirectory, rootPackageJson, select) =>
2871
2874
  for (const workspaceDirectory of directories) {
2872
2875
  if (visitedDirectories.has(workspaceDirectory)) continue;
2873
2876
  visitedDirectories.add(workspaceDirectory);
2874
- const value = select(readPackageJson(path.join(workspaceDirectory, "package.json")));
2877
+ const value = select(readPackageJson(path$1.join(workspaceDirectory, "package.json")));
2875
2878
  if (value !== null) return value;
2876
2879
  }
2877
2880
  }
@@ -2916,6 +2919,23 @@ const getExpoDependencySpec = (packageJson) => {
2916
2919
  return typeof spec === "string" ? spec : null;
2917
2920
  };
2918
2921
  const findExpoVersion = (rootDirectory, rootPackageJson) => findInWorkspacePackageJsons(rootDirectory, rootPackageJson, getExpoDependencySpec);
2922
+ const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
2923
+ const getShopifyFlashListDependencySpec = (packageJson) => {
2924
+ const spec = packageJson.dependencies?.["@shopify/flash-list"] ?? packageJson.devDependencies?.["@shopify/flash-list"] ?? packageJson.peerDependencies?.["@shopify/flash-list"] ?? packageJson.optionalDependencies?.["@shopify/flash-list"];
2925
+ return typeof spec === "string" ? spec : null;
2926
+ };
2927
+ const findShopifyFlashListVersion = (rootDirectory, rootPackageJson) => findInWorkspacePackageJsons(rootDirectory, rootPackageJson, getShopifyFlashListDependencySpec);
2928
+ const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
2929
+ if (version === null || !isCatalogReference(version)) return version;
2930
+ const catalogName = extractCatalogName(version);
2931
+ const resolvedLocalVersion = resolveCatalogVersion(rootPackageJson, packageName, rootDirectory, catalogName);
2932
+ if (resolvedLocalVersion) return resolvedLocalVersion;
2933
+ const monorepoRoot = findMonorepoRoot(rootDirectory);
2934
+ if (!monorepoRoot) return version;
2935
+ const monorepoPackageJsonPath = path.join(monorepoRoot, "package.json");
2936
+ if (!isFile(monorepoPackageJsonPath)) return version;
2937
+ return resolveCatalogVersion(readPackageJson(monorepoPackageJsonPath), packageName, monorepoRoot, catalogName) ?? version;
2938
+ };
2919
2939
  const getPreactVersion = (packageJson) => {
2920
2940
  return {
2921
2941
  ...packageJson.peerDependencies,
@@ -2986,7 +3006,7 @@ const hasReactDependency = (packageJson) => {
2986
3006
  return Object.keys(allDependencies).some((packageName) => REACT_DEPENDENCY_NAMES.has(packageName));
2987
3007
  };
2988
3008
  const listWorkspacePackages = (rootDirectory) => {
2989
- const packageJsonPath = path.join(rootDirectory, "package.json");
3009
+ const packageJsonPath = path$1.join(rootDirectory, "package.json");
2990
3010
  if (!isFile(packageJsonPath)) return [];
2991
3011
  const packageJson = readPackageJson(packageJsonPath);
2992
3012
  const patterns = getWorkspacePatterns(rootDirectory, packageJson);
@@ -2999,16 +3019,16 @@ const listWorkspacePackages = (rootDirectory) => {
2999
3019
  packages.push(workspacePackage);
3000
3020
  };
3001
3021
  if (hasReactDependency(packageJson)) pushIfNew({
3002
- name: packageJson.name ?? path.basename(rootDirectory),
3022
+ name: packageJson.name ?? path$1.basename(rootDirectory),
3003
3023
  directory: rootDirectory
3004
3024
  });
3005
3025
  for (const pattern of patterns) {
3006
3026
  const directories = resolveWorkspaceDirectories(rootDirectory, pattern);
3007
3027
  for (const workspaceDirectory of directories) {
3008
- const workspacePackageJson = readPackageJson(path.join(workspaceDirectory, "package.json"));
3028
+ const workspacePackageJson = readPackageJson(path$1.join(workspaceDirectory, "package.json"));
3009
3029
  if (!hasReactDependency(workspacePackageJson)) continue;
3010
3030
  pushIfNew({
3011
- name: workspacePackageJson.name ?? path.basename(workspaceDirectory),
3031
+ name: workspacePackageJson.name ?? path$1.basename(workspaceDirectory),
3012
3032
  directory: workspaceDirectory
3013
3033
  });
3014
3034
  }
@@ -3018,11 +3038,11 @@ const listWorkspacePackages = (rootDirectory) => {
3018
3038
  const toReactWorkspacePackages = (directories) => {
3019
3039
  const packages = [];
3020
3040
  for (const directory of directories) {
3021
- const packageJsonPath = path.join(directory, "package.json");
3041
+ const packageJsonPath = path$1.join(directory, "package.json");
3022
3042
  if (!isFile(packageJsonPath)) continue;
3023
3043
  const packageJson = readPackageJson(packageJsonPath);
3024
3044
  if (!hasReactDependency(packageJson)) continue;
3025
- const name = packageJson.name ?? path.basename(directory);
3045
+ const name = packageJson.name ?? path$1.basename(directory);
3026
3046
  packages.push({
3027
3047
  name,
3028
3048
  directory
@@ -3031,7 +3051,7 @@ const toReactWorkspacePackages = (directories) => {
3031
3051
  return packages;
3032
3052
  };
3033
3053
  const listManifestWorkspacePackages = (rootDirectory) => {
3034
- if (isFile(path.join(rootDirectory, "package.json"))) return listWorkspacePackages(rootDirectory);
3054
+ if (isFile(path$1.join(rootDirectory, "package.json"))) return listWorkspacePackages(rootDirectory);
3035
3055
  const patterns = parsePnpmWorkspacePatterns(rootDirectory);
3036
3056
  const nxPatterns = patterns.length > 0 ? [] : getNxWorkspaceDirectories(rootDirectory);
3037
3057
  return toReactWorkspacePackages((patterns.length > 0 ? patterns : nxPatterns).flatMap((pattern) => resolveWorkspaceDirectories(rootDirectory, pattern)));
@@ -3052,11 +3072,11 @@ const discoverReactSubprojectsByFilesystem = (rootDirectory) => {
3052
3072
  const current = pendingDirectories.pop();
3053
3073
  if (!current) continue;
3054
3074
  const { directory: currentDirectory, depth } = current;
3055
- const packageJsonPath = path.join(currentDirectory, "package.json");
3075
+ const packageJsonPath = path$1.join(currentDirectory, "package.json");
3056
3076
  if (isFile(packageJsonPath)) {
3057
3077
  const packageJson = readPackageJson(packageJsonPath);
3058
3078
  if (hasReactDependency(packageJson)) {
3059
- const name = packageJson.name ?? path.basename(currentDirectory);
3079
+ const name = packageJson.name ?? path$1.basename(currentDirectory);
3060
3080
  packages.push({
3061
3081
  name,
3062
3082
  directory: currentDirectory
@@ -3068,7 +3088,7 @@ const discoverReactSubprojectsByFilesystem = (rootDirectory) => {
3068
3088
  for (const entry of entries) {
3069
3089
  if (!entry.isDirectory() || entry.name.startsWith(".") || IGNORED_DIRECTORIES.has(entry.name) || NON_PROJECT_DIRECTORIES.has(entry.name)) continue;
3070
3090
  pendingDirectories.push({
3071
- directory: path.join(currentDirectory, entry.name),
3091
+ directory: path$1.join(currentDirectory, entry.name),
3072
3092
  depth: depth + 1
3073
3093
  });
3074
3094
  }
@@ -3088,7 +3108,7 @@ const clearProjectCache = () => {
3088
3108
  const discoverProject = (directory) => {
3089
3109
  const cached = cachedProjectInfos.get(directory);
3090
3110
  if (cached !== void 0) return cached;
3091
- const packageJsonPath = path.join(directory, "package.json");
3111
+ const packageJsonPath = path$1.join(directory, "package.json");
3092
3112
  if (!isFile(packageJsonPath)) throw new PackageJsonNotFoundError(directory);
3093
3113
  const packageJson = readPackageJson(packageJsonPath);
3094
3114
  let { reactVersion, tailwindVersion, zodVersion, framework } = extractDependencyInfo(packageJson);
@@ -3125,7 +3145,7 @@ const discoverProject = (directory) => {
3125
3145
  if (!reactVersion || !tailwindVersion || !zodVersion) {
3126
3146
  const monorepoRoot = findMonorepoRoot(directory);
3127
3147
  if (monorepoRoot) {
3128
- const monorepoPackageJsonPath = path.join(monorepoRoot, "package.json");
3148
+ const monorepoPackageJsonPath = path$1.join(monorepoRoot, "package.json");
3129
3149
  if (isFile(monorepoPackageJsonPath)) {
3130
3150
  const rootPackageJson = readPackageJson(monorepoPackageJsonPath);
3131
3151
  if (!reactVersion && reactDeclaration.hasDeclaration) reactVersion = resolveCatalogVersion(rootPackageJson, "react", monorepoRoot, reactDeclaration.catalogReference);
@@ -3151,23 +3171,22 @@ const discoverProject = (directory) => {
3151
3171
  if (!reactVersion && reactDeclaration.version && !isCatalogReference(reactDeclaration.version)) reactVersion = reactDeclaration.version;
3152
3172
  if (!tailwindVersion && tailwindDeclaration.version && !isCatalogReference(tailwindDeclaration.version)) tailwindVersion = tailwindDeclaration.version;
3153
3173
  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"));
3174
+ const projectName = packageJson.name ?? path$1.basename(directory);
3175
+ const hasTypeScript = fs$1.existsSync(path$1.join(directory, "tsconfig.json"));
3156
3176
  const sourceFileCount = countSourceFiles(directory);
3157
3177
  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
- }
3178
+ const expoVersion = hasReactNativeWorkspace ? resolveCatalogBackedDependencyVersion({
3179
+ rootDirectory: directory,
3180
+ rootPackageJson: packageJson,
3181
+ packageName: "expo",
3182
+ version: findExpoVersion(directory, packageJson)
3183
+ }) : null;
3184
+ const shopifyFlashListVersion = hasReactNativeWorkspace ? resolveCatalogBackedDependencyVersion({
3185
+ rootDirectory: directory,
3186
+ rootPackageJson: packageJson,
3187
+ packageName: SHOPIFY_FLASH_LIST_PACKAGE_NAME,
3188
+ version: findShopifyFlashListVersion(directory, packageJson)
3189
+ }) : null;
3171
3190
  const hasReanimated = hasReactNativeWorkspace && someWorkspacePackageJson(directory, packageJson, isPackageJsonReanimatedAware);
3172
3191
  const preactVersion = getPreactVersion(packageJson);
3173
3192
  const projectInfo = {
@@ -3186,6 +3205,8 @@ const discoverProject = (directory) => {
3186
3205
  preactMajorVersion: parseReactMajor(preactVersion),
3187
3206
  hasReactNativeWorkspace,
3188
3207
  expoVersion,
3208
+ shopifyFlashListVersion,
3209
+ shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
3189
3210
  hasReanimated,
3190
3211
  sourceFileCount
3191
3212
  };
@@ -3793,12 +3814,12 @@ const findNearestPackageDirectory = (filename) => {
3793
3814
  if (!filename) return null;
3794
3815
  const fromCache = cachedPackageDirectoryByFilename.get(filename);
3795
3816
  if (fromCache !== void 0) return fromCache;
3796
- let currentDirectory = path.dirname(filename);
3817
+ let currentDirectory = path$1.dirname(filename);
3797
3818
  while (true) {
3798
- const candidatePackageJsonPath = path.join(currentDirectory, "package.json");
3819
+ const candidatePackageJsonPath = path$1.join(currentDirectory, "package.json");
3799
3820
  let hasPackageJson = false;
3800
3821
  try {
3801
- hasPackageJson = fs.statSync(candidatePackageJsonPath).isFile();
3822
+ hasPackageJson = fs$1.statSync(candidatePackageJsonPath).isFile();
3802
3823
  } catch {
3803
3824
  hasPackageJson = false;
3804
3825
  }
@@ -3806,7 +3827,7 @@ const findNearestPackageDirectory = (filename) => {
3806
3827
  cachedPackageDirectoryByFilename.set(filename, currentDirectory);
3807
3828
  return currentDirectory;
3808
3829
  }
3809
- const parentDirectory = path.dirname(currentDirectory);
3830
+ const parentDirectory = path$1.dirname(currentDirectory);
3810
3831
  if (parentDirectory === currentDirectory) {
3811
3832
  cachedPackageDirectoryByFilename.set(filename, null);
3812
3833
  return null;
@@ -3816,7 +3837,7 @@ const findNearestPackageDirectory = (filename) => {
3816
3837
  };
3817
3838
  const readManifest = (packageJsonPath) => {
3818
3839
  try {
3819
- const parsed = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
3840
+ const parsed = JSON.parse(fs$1.readFileSync(packageJsonPath, "utf-8"));
3820
3841
  if (typeof parsed === "object" && parsed !== null) return parsed;
3821
3842
  return null;
3822
3843
  } catch {
@@ -3827,8 +3848,8 @@ const hasPublishContract = (manifest) => typeof manifest.name === "string" && ma
3827
3848
  const classifyByDirectoryCohort = (packageDirectory) => {
3828
3849
  let current = packageDirectory;
3829
3850
  while (true) {
3830
- if (path.basename(current) === "apps") return "app";
3831
- const parent = path.dirname(current);
3851
+ if (path$1.basename(current) === "apps") return "app";
3852
+ const parent = path$1.dirname(current);
3832
3853
  if (parent === current) return null;
3833
3854
  current = parent;
3834
3855
  }
@@ -3843,10 +3864,10 @@ const classifyPackageRole = (filename) => {
3843
3864
  if (!packageDirectory) return "unknown";
3844
3865
  const cached = cachedRoleByPackageDirectory.get(packageDirectory);
3845
3866
  if (cached !== void 0) return cached;
3846
- const manifest = readManifest(path.join(packageDirectory, "package.json"));
3867
+ const manifest = readManifest(path$1.join(packageDirectory, "package.json"));
3847
3868
  let result;
3848
3869
  if (manifest && hasPublishContract(manifest)) result = "library";
3849
- else result = classifyByDirectoryCohort(path.dirname(packageDirectory)) ?? "unknown";
3870
+ else result = classifyByDirectoryCohort(path$1.dirname(packageDirectory)) ?? "unknown";
3850
3871
  cachedRoleByPackageDirectory.set(packageDirectory, result);
3851
3872
  return result;
3852
3873
  };
@@ -4498,12 +4519,12 @@ const loadModuleConfig = async (filePath) => {
4498
4519
  const imported = await jiti.import(filePath);
4499
4520
  return imported?.default ?? imported;
4500
4521
  };
4501
- const readDataConfig = (filePath) => parseJSON5(fs.readFileSync(filePath, "utf-8"));
4522
+ const readDataConfig = (filePath) => parseJSON5(fs$1.readFileSync(filePath, "utf-8"));
4502
4523
  const readEmbeddedPackageJsonConfig = (directory) => {
4503
- const packageJsonPath = path.join(directory, PACKAGE_JSON_FILENAME);
4524
+ const packageJsonPath = path$1.join(directory, PACKAGE_JSON_FILENAME);
4504
4525
  if (!isFile(packageJsonPath)) return null;
4505
4526
  try {
4506
- const packageJson = parseJSON5(fs.readFileSync(packageJsonPath, "utf-8"));
4527
+ const packageJson = parseJSON5(fs$1.readFileSync(packageJsonPath, "utf-8"));
4507
4528
  if (isPlainObject(packageJson)) {
4508
4529
  const embeddedConfig = packageJson[PACKAGE_JSON_CONFIG_KEY];
4509
4530
  if (isPlainObject(embeddedConfig)) return embeddedConfig;
@@ -4517,14 +4538,14 @@ const loadPackageJsonConfig = (directory) => {
4517
4538
  return {
4518
4539
  config: validateConfigTypes(embeddedConfig),
4519
4540
  sourceDirectory: directory,
4520
- configFilePath: path.join(directory, PACKAGE_JSON_FILENAME),
4541
+ configFilePath: path$1.join(directory, PACKAGE_JSON_FILENAME),
4521
4542
  format: "package-json"
4522
4543
  };
4523
4544
  };
4524
4545
  const loadConfigFromDirectory = async (directory) => {
4525
4546
  let sawBrokenConfigFile = false;
4526
4547
  for (const extension of CONFIG_EXTENSIONS) {
4527
- const filePath = path.join(directory, `${CONFIG_BASENAME}.${extension}`);
4548
+ const filePath = path$1.join(directory, `${CONFIG_BASENAME}.${extension}`);
4528
4549
  if (!isFile(filePath)) continue;
4529
4550
  const isDataFile = DATA_CONFIG_EXTENSIONS.has(extension);
4530
4551
  try {
@@ -4550,7 +4571,7 @@ const loadConfigFromDirectory = async (directory) => {
4550
4571
  status: "found",
4551
4572
  loaded: packageJsonConfig
4552
4573
  };
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).`);
4574
+ 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
4575
  return {
4555
4576
  status: sawBrokenConfigFile ? "invalid" : "absent",
4556
4577
  loaded: null
@@ -4564,12 +4585,12 @@ const loadConfigWalkingUp = async (rootDirectory) => {
4564
4585
  const localResult = await loadConfigFromDirectory(rootDirectory);
4565
4586
  if (localResult.status === "found") return localResult.loaded;
4566
4587
  if (localResult.status === "invalid" || isProjectBoundary(rootDirectory)) return null;
4567
- let ancestorDirectory = path.dirname(rootDirectory);
4568
- while (ancestorDirectory !== path.dirname(ancestorDirectory)) {
4588
+ let ancestorDirectory = path$1.dirname(rootDirectory);
4589
+ while (ancestorDirectory !== path$1.dirname(ancestorDirectory)) {
4569
4590
  const ancestorResult = await loadConfigFromDirectory(ancestorDirectory);
4570
4591
  if (ancestorResult.status === "found") return ancestorResult.loaded;
4571
4592
  if (isProjectBoundary(ancestorDirectory)) return null;
4572
- ancestorDirectory = path.dirname(ancestorDirectory);
4593
+ ancestorDirectory = path$1.dirname(ancestorDirectory);
4573
4594
  }
4574
4595
  return null;
4575
4596
  };
@@ -4586,7 +4607,7 @@ const resolveConfigRootDir = (config, configSourceDirectory) => {
4586
4607
  if (typeof rawRootDir !== "string") return null;
4587
4608
  const trimmedRootDir = rawRootDir.trim();
4588
4609
  if (trimmedRootDir.length === 0) return null;
4589
- const resolvedRootDir = path.isAbsolute(trimmedRootDir) ? trimmedRootDir : path.resolve(configSourceDirectory, trimmedRootDir);
4610
+ const resolvedRootDir = path$1.isAbsolute(trimmedRootDir) ? trimmedRootDir : path$1.resolve(configSourceDirectory, trimmedRootDir);
4590
4611
  if (resolvedRootDir === configSourceDirectory) return null;
4591
4612
  if (!isDirectory(resolvedRootDir)) {
4592
4613
  Effect.runSync(Console.warn(`react-doctor config "rootDir" points to "${rawRootDir}" (resolved to ${resolvedRootDir}), which is not a directory. Ignoring.`));
@@ -4595,12 +4616,12 @@ const resolveConfigRootDir = (config, configSourceDirectory) => {
4595
4616
  return resolvedRootDir;
4596
4617
  };
4597
4618
  const resolveDiagnoseTarget = (directory, options = {}) => {
4598
- if (isFile(path.join(directory, "package.json"))) return directory;
4619
+ if (isFile(path$1.join(directory, "package.json"))) return directory;
4599
4620
  const reactSubprojects = discoverReactSubprojects(directory);
4600
4621
  if (reactSubprojects.length === 0) return null;
4601
4622
  if (reactSubprojects.length === 1) return reactSubprojects[0].directory;
4602
4623
  if (options.allowAmbiguous === true) return null;
4603
- throw new AmbiguousProjectError(directory, reactSubprojects.map((subproject) => path.relative(directory, subproject.directory)).toSorted());
4624
+ throw new AmbiguousProjectError(directory, reactSubprojects.map((subproject) => path$1.relative(directory, subproject.directory)).toSorted());
4604
4625
  };
4605
4626
  /**
4606
4627
  * The canonical entry-point translation shared by every public shell
@@ -4626,14 +4647,14 @@ const resolveDiagnoseTarget = (directory, options = {}) => {
4626
4647
  * shell in agreement on what "the scan directory" means.
4627
4648
  */
4628
4649
  const resolveScanTarget = async (requestedDirectory, options = {}) => {
4629
- const absoluteRequested = path.resolve(requestedDirectory);
4650
+ const absoluteRequested = path$1.resolve(requestedDirectory);
4630
4651
  const loadedConfig = await loadConfigWithSource(absoluteRequested);
4631
4652
  const userConfig = loadedConfig?.config ?? null;
4632
4653
  const configSourceDirectory = loadedConfig?.sourceDirectory ?? null;
4633
4654
  const redirectedDirectory = resolveConfigRootDir(userConfig, configSourceDirectory);
4634
4655
  const directoryAfterRedirect = redirectedDirectory ?? absoluteRequested;
4635
4656
  const resolvedDirectory = resolveDiagnoseTarget(directoryAfterRedirect, options) ?? directoryAfterRedirect;
4636
- if (!isDirectory(resolvedDirectory)) throw existsSync(resolvedDirectory) ? new NotADirectoryError(resolvedDirectory) : new ProjectNotFoundError(resolvedDirectory, { kind: "missing-path" });
4657
+ if (!isDirectory(resolvedDirectory)) throw fs$1.existsSync(resolvedDirectory) ? new NotADirectoryError(resolvedDirectory) : new ProjectNotFoundError(resolvedDirectory, { kind: "missing-path" });
4637
4658
  return {
4638
4659
  resolvedDirectory,
4639
4660
  requestedDirectory: absoluteRequested,
@@ -4644,7 +4665,7 @@ const resolveScanTarget = async (requestedDirectory, options = {}) => {
4644
4665
  };
4645
4666
  const getDirectDependencyNames = (packageJson) => new Set([...Object.keys(packageJson.dependencies ?? {}), ...Object.keys(packageJson.devDependencies ?? {})]);
4646
4667
  const buildExpoCheckContext = (rootDirectory, expoVersion) => {
4647
- const packageJson = readPackageJson(path.join(rootDirectory, "package.json"));
4668
+ const packageJson = readPackageJson(path$1.join(rootDirectory, "package.json"));
4648
4669
  return {
4649
4670
  rootDirectory,
4650
4671
  packageJson,
@@ -4714,7 +4735,7 @@ const LOCAL_ENV_FILE_NAMES = [
4714
4735
  const checkExpoEnvLocalFiles = (context) => {
4715
4736
  const { rootDirectory } = context;
4716
4737
  const committedEnvFiles = LOCAL_ENV_FILE_NAMES.filter((fileName) => {
4717
- const filePath = path.join(rootDirectory, fileName);
4738
+ const filePath = path$1.join(rootDirectory, fileName);
4718
4739
  if (!isFile(filePath)) return false;
4719
4740
  return isPathGitIgnored(rootDirectory, filePath) === false;
4720
4741
  });
@@ -4848,17 +4869,17 @@ const checkExpoFlaggedDependencies = (context) => FLAGGED_DEPENDENCIES.filter((f
4848
4869
  help: flaggedDependency.help
4849
4870
  }));
4850
4871
  const findLocalModuleNativeFiles = (rootDirectory) => {
4851
- const modulesDirectory = path.join(rootDirectory, "modules");
4872
+ const modulesDirectory = path$1.join(rootDirectory, "modules");
4852
4873
  if (!isDirectory(modulesDirectory)) return [];
4853
4874
  const nativeFilePaths = [];
4854
4875
  for (const moduleEntry of readDirectoryEntries(modulesDirectory)) {
4855
4876
  if (!moduleEntry.isDirectory()) continue;
4856
- const moduleDirectory = path.join(modulesDirectory, moduleEntry.name);
4857
- const gradlePath = path.join(moduleDirectory, "android", "build.gradle");
4877
+ const moduleDirectory = path$1.join(modulesDirectory, moduleEntry.name);
4878
+ const gradlePath = path$1.join(moduleDirectory, "android", "build.gradle");
4858
4879
  if (isFile(gradlePath)) nativeFilePaths.push(gradlePath);
4859
- const iosDirectory = path.join(moduleDirectory, "ios");
4880
+ const iosDirectory = path$1.join(moduleDirectory, "ios");
4860
4881
  if (isDirectory(iosDirectory)) {
4861
- for (const iosEntry of readDirectoryEntries(iosDirectory)) if (iosEntry.isFile() && iosEntry.name.endsWith(".podspec")) nativeFilePaths.push(path.join(iosDirectory, iosEntry.name));
4882
+ for (const iosEntry of readDirectoryEntries(iosDirectory)) if (iosEntry.isFile() && iosEntry.name.endsWith(".podspec")) nativeFilePaths.push(path$1.join(iosDirectory, iosEntry.name));
4862
4883
  }
4863
4884
  }
4864
4885
  return nativeFilePaths;
@@ -4866,7 +4887,7 @@ const findLocalModuleNativeFiles = (rootDirectory) => {
4866
4887
  const checkExpoGitignore = (context) => {
4867
4888
  const { rootDirectory } = context;
4868
4889
  const diagnostics = [];
4869
- const expoStateDirectory = path.join(rootDirectory, ".expo");
4890
+ const expoStateDirectory = path$1.join(rootDirectory, ".expo");
4870
4891
  if (isDirectory(expoStateDirectory) && isPathGitIgnored(rootDirectory, expoStateDirectory) === false) diagnostics.push(buildExpoDiagnostic({
4871
4892
  rule: "expo-gitignore",
4872
4893
  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 +4909,7 @@ const LOCKFILE_NAMES = [
4888
4909
  ];
4889
4910
  const checkExpoLockfile = (context) => {
4890
4911
  const workspaceRoot = isMonorepoRoot(context.rootDirectory) ? context.rootDirectory : findMonorepoRoot(context.rootDirectory) ?? context.rootDirectory;
4891
- const presentLockfiles = LOCKFILE_NAMES.filter((lockfileName) => isFile(path.join(workspaceRoot, lockfileName)));
4912
+ const presentLockfiles = LOCKFILE_NAMES.filter((lockfileName) => isFile(path$1.join(workspaceRoot, lockfileName)));
4892
4913
  if (presentLockfiles.length === 0) return [buildExpoDiagnostic({
4893
4914
  rule: "expo-lockfile",
4894
4915
  message: "No lock file detected at the project root — installs are not reproducible, and EAS Build cannot infer your package manager",
@@ -4913,18 +4934,18 @@ const EXPO_METRO_CONFIG_EXTEND_SIGNALS = [
4913
4934
  "getSentryExpoConfig"
4914
4935
  ];
4915
4936
  const checkExpoMetroConfig = (context) => {
4916
- const metroConfigPath = METRO_CONFIG_FILE_NAMES.map((fileName) => path.join(context.rootDirectory, fileName)).find((candidatePath) => isFile(candidatePath));
4937
+ const metroConfigPath = METRO_CONFIG_FILE_NAMES.map((fileName) => path$1.join(context.rootDirectory, fileName)).find((candidatePath) => isFile(candidatePath));
4917
4938
  if (metroConfigPath === void 0) return [];
4918
4939
  let contents;
4919
4940
  try {
4920
- contents = fs.readFileSync(metroConfigPath, "utf-8");
4941
+ contents = fs$1.readFileSync(metroConfigPath, "utf-8");
4921
4942
  } catch {
4922
4943
  return [];
4923
4944
  }
4924
4945
  if (EXPO_METRO_CONFIG_EXTEND_SIGNALS.some((signal) => contents.includes(signal))) return [];
4925
4946
  return [buildExpoDiagnostic({
4926
4947
  rule: "expo-metro-config",
4927
- filePath: path.basename(metroConfigPath),
4948
+ filePath: path$1.basename(metroConfigPath),
4928
4949
  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
4950
  help: "Update your metro config to extend `expo/metro-config`. See https://docs.expo.dev/guides/customizing-metro/"
4930
4951
  })];
@@ -4970,16 +4991,16 @@ const NO_CONFIG = {
4970
4991
  const decodeExpoConfig = (filePath) => {
4971
4992
  let raw;
4972
4993
  try {
4973
- raw = JSON.parse(fs.readFileSync(filePath, "utf-8"));
4994
+ raw = JSON.parse(fs$1.readFileSync(filePath, "utf-8"));
4974
4995
  } catch {
4975
4996
  return null;
4976
4997
  }
4977
4998
  return Option.getOrNull(Schema.decodeUnknownOption(AppManifestSchema)(raw))?.expo ?? null;
4978
4999
  };
4979
5000
  const readExpoAppConfig = (rootDirectory) => {
4980
- if (APP_CONFIG_DYNAMIC_FILES.some((fileName) => isFile(path.join(rootDirectory, fileName)))) return NO_CONFIG;
5001
+ if (APP_CONFIG_DYNAMIC_FILES.some((fileName) => isFile(path$1.join(rootDirectory, fileName)))) return NO_CONFIG;
4981
5002
  for (const fileName of APP_CONFIG_JSON_FILES) {
4982
- const filePath = path.join(rootDirectory, fileName);
5003
+ const filePath = path$1.join(rootDirectory, fileName);
4983
5004
  if (!isFile(filePath)) continue;
4984
5005
  const config = decodeExpoConfig(filePath);
4985
5006
  if (config) return {
@@ -5126,12 +5147,12 @@ const parseHardeningSettings = (content) => {
5126
5147
  };
5127
5148
  };
5128
5149
  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);
5150
+ if (isFile(path$1.join(rootDirectory, PNPM_LOCKFILE))) return true;
5151
+ if (isFile(path$1.join(rootDirectory, PNPM_WORKSPACE_FILE))) return true;
5152
+ const packageJsonPath = path$1.join(rootDirectory, PACKAGE_JSON_FILE);
5132
5153
  if (!isFile(packageJsonPath)) return false;
5133
5154
  try {
5134
- const packageJsonRaw = fs.readFileSync(packageJsonPath, "utf-8");
5155
+ const packageJsonRaw = fs$1.readFileSync(packageJsonPath, "utf-8");
5135
5156
  const packageJson = JSON.parse(packageJsonRaw);
5136
5157
  if (packageJson !== null && typeof packageJson === "object" && "packageManager" in packageJson && typeof packageJson.packageManager === "string" && packageJson.packageManager.startsWith("pnpm@")) return true;
5137
5158
  } catch {
@@ -5152,8 +5173,8 @@ const buildHardeningDiagnostic = (input) => ({
5152
5173
  });
5153
5174
  const checkPnpmHardening = (rootDirectory) => {
5154
5175
  if (!isPnpmManagedProject(rootDirectory)) return [];
5155
- const workspacePath = path.join(rootDirectory, PNPM_WORKSPACE_FILE);
5156
- const settings = parseHardeningSettings(isFile(workspacePath) ? fs.readFileSync(workspacePath, "utf-8") : "");
5176
+ const workspacePath = path$1.join(rootDirectory, PNPM_WORKSPACE_FILE);
5177
+ const settings = parseHardeningSettings(isFile(workspacePath) ? fs$1.readFileSync(workspacePath, "utf-8") : "");
5157
5178
  const diagnostics = [];
5158
5179
  if (settings.minimumReleaseAge === null) diagnostics.push(buildHardeningDiagnostic({
5159
5180
  message: "pnpm-workspace.yaml is missing `minimumReleaseAge` — newly published versions can ship malware that gets caught and unpublished within hours",
@@ -5183,7 +5204,7 @@ const isBuilderBobLibrary = (packageJson) => {
5183
5204
  return typeof bobConfig === "object" && bobConfig !== null;
5184
5205
  };
5185
5206
  const checkReactNativeLibraryDependencies = (rootDirectory) => {
5186
- const packageJson = readPackageJson(path.join(rootDirectory, "package.json"));
5207
+ const packageJson = readPackageJson(path$1.join(rootDirectory, "package.json"));
5187
5208
  if (!isBuilderBobLibrary(packageJson)) return [];
5188
5209
  const misplaced = ["react", "react-native"].filter((name) => packageJson.dependencies?.[name] !== void 0);
5189
5210
  if (misplaced.length === 0) return [];
@@ -5212,11 +5233,11 @@ const BABEL_CONFIG_FILE_NAMES = [
5212
5233
  const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
5213
5234
  const checkReactNativeMetroBabelPreset = (rootDirectory) => {
5214
5235
  for (const fileName of BABEL_CONFIG_FILE_NAMES) {
5215
- const filePath = path.join(rootDirectory, fileName);
5236
+ const filePath = path$1.join(rootDirectory, fileName);
5216
5237
  if (!isFile(filePath)) continue;
5217
5238
  let contents;
5218
5239
  try {
5219
- contents = fs.readFileSync(filePath, "utf-8");
5240
+ contents = fs$1.readFileSync(filePath, "utf-8");
5220
5241
  } catch {
5221
5242
  continue;
5222
5243
  }
@@ -5261,7 +5282,7 @@ const MISSING_REDUCED_MOTION_DIAGNOSTIC = {
5261
5282
  category: "Accessibility"
5262
5283
  };
5263
5284
  const checkReducedMotion = (rootDirectory) => {
5264
- const packageJsonPath = path.join(rootDirectory, "package.json");
5285
+ const packageJsonPath = path$1.join(rootDirectory, "package.json");
5265
5286
  if (!isFile(packageJsonPath)) return [];
5266
5287
  let hasMotionLibrary = false;
5267
5288
  try {
@@ -5386,7 +5407,7 @@ const isTruthyLinguistAttribute = (token) => {
5386
5407
  const parseGitattributesLinguistPaths = (filePath) => {
5387
5408
  let content;
5388
5409
  try {
5389
- content = fs.readFileSync(filePath, "utf-8");
5410
+ content = fs$1.readFileSync(filePath, "utf-8");
5390
5411
  } catch {
5391
5412
  return [];
5392
5413
  }
@@ -5408,7 +5429,7 @@ const stripGitignoreEscape = (pattern) => {
5408
5429
  const readIgnoreFile = (filePath) => {
5409
5430
  let content;
5410
5431
  try {
5411
- content = fs.readFileSync(filePath, "utf-8");
5432
+ content = fs$1.readFileSync(filePath, "utf-8");
5412
5433
  } catch (error) {
5413
5434
  const errnoCode = error?.code;
5414
5435
  if (errnoCode && errnoCode !== "ENOENT") Effect.runSync(Console.warn(`Could not read ignore file ${filePath}: ${errnoCode}`));
@@ -5440,8 +5461,8 @@ const computeIgnorePatterns = (rootDirectory) => {
5440
5461
  seen.add(pattern);
5441
5462
  patterns.push(pattern);
5442
5463
  };
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);
5464
+ for (const filename of IGNORE_FILENAMES) for (const pattern of readIgnoreFile(path$1.join(rootDirectory, filename))) addPattern(pattern);
5465
+ for (const linguistPath of parseGitattributesLinguistPaths(path$1.join(rootDirectory, ".gitattributes"))) addPattern(linguistPath);
5445
5466
  return patterns;
5446
5467
  };
5447
5468
  const collectIgnorePatterns = (rootDirectory) => {
@@ -5451,6 +5472,63 @@ const collectIgnorePatterns = (rootDirectory) => {
5451
5472
  cachedPatternsByRoot.set(rootDirectory, patterns);
5452
5473
  return patterns;
5453
5474
  };
5475
+ const KNIP_JSON_FILENAME = "knip.json";
5476
+ const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5477
+ const readJsonFileSafe = (filePath) => {
5478
+ let rawContents;
5479
+ try {
5480
+ rawContents = fs.readFileSync(filePath, "utf-8");
5481
+ } catch {
5482
+ return null;
5483
+ }
5484
+ try {
5485
+ return JSON.parse(rawContents);
5486
+ } catch {
5487
+ return null;
5488
+ }
5489
+ };
5490
+ const readKnipConfig = (rootDirectory) => {
5491
+ const knipJson = readJsonFileSafe(path.join(rootDirectory, KNIP_JSON_FILENAME));
5492
+ if (isRecord$1(knipJson)) return knipJson;
5493
+ const packageJson = readJsonFileSafe(path.join(rootDirectory, "package.json"));
5494
+ const packageKnipConfig = isRecord$1(packageJson) ? packageJson.knip : null;
5495
+ return isRecord$1(packageKnipConfig) ? packageKnipConfig : null;
5496
+ };
5497
+ const normalizePatternList = (value) => {
5498
+ if (typeof value === "string" && value.length > 0) return [value];
5499
+ if (!Array.isArray(value)) return [];
5500
+ return value.filter((entry) => typeof entry === "string" && entry.length > 0);
5501
+ };
5502
+ const prefixWorkspacePatterns = (workspacePattern, patterns) => {
5503
+ const normalizedWorkspacePattern = workspacePattern.replace(/\/+$/, "");
5504
+ return patterns.map((pattern) => pattern.startsWith("!") ? `!${normalizedWorkspacePattern}/${pattern.slice(1)}` : `${normalizedWorkspacePattern}/${pattern}`);
5505
+ };
5506
+ const collectKnipWorkspacePatterns = (workspaces, settingName) => {
5507
+ if (!isRecord$1(workspaces)) return [];
5508
+ const patterns = [];
5509
+ for (const [workspacePattern, workspaceConfig] of Object.entries(workspaces)) {
5510
+ if (!isRecord$1(workspaceConfig)) continue;
5511
+ patterns.push(...prefixWorkspacePatterns(workspacePattern, normalizePatternList(workspaceConfig[settingName])));
5512
+ }
5513
+ return patterns;
5514
+ };
5515
+ const collectKnipPatterns = (rootDirectory, settingName) => {
5516
+ const config = readKnipConfig(rootDirectory);
5517
+ if (!config) return [];
5518
+ return [...normalizePatternList(config[settingName]), ...collectKnipWorkspacePatterns(config.workspaces, settingName)];
5519
+ };
5520
+ const collectDeadCodeIgnorePatterns = (rootDirectory, userConfig) => {
5521
+ const seen = /* @__PURE__ */ new Set();
5522
+ const sources = [
5523
+ readIgnoreFile(path.join(rootDirectory, ".gitignore")),
5524
+ collectIgnorePatterns(rootDirectory),
5525
+ userConfig?.ignore?.files ?? [],
5526
+ collectKnipPatterns(rootDirectory, "ignore")
5527
+ ];
5528
+ for (const source of sources) for (const pattern of source) seen.add(pattern);
5529
+ return [...seen].filter((pattern) => pattern.length > 0);
5530
+ };
5531
+ const collectDeadCodeEntryPatterns = (rootDirectory) => [...new Set(collectKnipPatterns(rootDirectory, "entry"))].filter((pattern) => pattern.length > 0);
5454
5532
  /**
5455
5533
  * Resolves a path to its canonical, symlink-free form, falling back to
5456
5534
  * the input when it cannot be realpath'd (broken symlink, permission
@@ -5468,7 +5546,7 @@ const collectIgnorePatterns = (rootDirectory) => {
5468
5546
  */
5469
5547
  const toCanonicalPath = (filePath) => {
5470
5548
  try {
5471
- return fs.realpathSync(filePath);
5549
+ return fs$1.realpathSync(filePath);
5472
5550
  } catch {
5473
5551
  return filePath;
5474
5552
  }
@@ -5476,6 +5554,7 @@ const toCanonicalPath = (filePath) => {
5476
5554
  const DEAD_CODE_PLUGIN = "deslop";
5477
5555
  const DEAD_CODE_CATEGORY = "Maintainability";
5478
5556
  const TSCONFIG_FILENAMES$1 = ["tsconfig.json", "tsconfig.base.json"];
5557
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5479
5558
  const DEAD_CODE_WORKER_SCRIPT = `
5480
5559
  const inputChunks = [];
5481
5560
  process.stdin.on("data", (chunk) => inputChunks.push(chunk));
@@ -5516,6 +5595,9 @@ process.stdin.on("end", () => {
5516
5595
  const { analyze, defineConfig } = await import(workerInput.deslopJsModuleSpecifier);
5517
5596
  const config = {
5518
5597
  rootDir: workerInput.rootDirectory,
5598
+ ...(workerInput.entryPatterns.length > 0
5599
+ ? { entryPatterns: workerInput.entryPatterns }
5600
+ : {}),
5519
5601
  ...(workerInput.tsConfigPath ? { tsConfigPath: workerInput.tsConfigPath } : {}),
5520
5602
  ...(workerInput.ignorePatterns.length > 0
5521
5603
  ? { ignorePatterns: workerInput.ignorePatterns }
@@ -5531,25 +5613,14 @@ process.stdin.on("end", () => {
5531
5613
  `;
5532
5614
  const resolveTsConfigPath = (rootDirectory) => {
5533
5615
  for (const filename of TSCONFIG_FILENAMES$1) {
5534
- const candidate = path.join(rootDirectory, filename);
5535
- if (fs.existsSync(candidate)) return candidate;
5616
+ const candidate = path$1.join(rootDirectory, filename);
5617
+ if (fs$1.existsSync(candidate)) return candidate;
5536
5618
  }
5537
5619
  };
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
5620
  const toRelativeFilePath = (rootDirectory, filePath) => {
5549
5621
  const relative = toRelativePath(filePath, rootDirectory);
5550
5622
  return relative.length > 0 ? relative : filePath.replace(/\\/g, "/");
5551
5623
  };
5552
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5553
5624
  const parseArray = (value, label) => {
5554
5625
  if (!Array.isArray(value)) throw new Error(`Dead-code worker returned invalid ${label}.`);
5555
5626
  return value;
@@ -5731,10 +5802,12 @@ const runDeadCodeWorkerWithTimeout = (handle, timeoutMs) => new Promise((resolve
5731
5802
  const checkDeadCode = async (options) => {
5732
5803
  const { userConfig } = options;
5733
5804
  const rootDirectory = toCanonicalPath(options.rootDirectory);
5734
- if (!fs.existsSync(path.join(rootDirectory, "package.json"))) return [];
5805
+ if (!fs$1.existsSync(path$1.join(rootDirectory, "package.json"))) return [];
5806
+ const entryPatterns = collectDeadCodeEntryPatterns(rootDirectory);
5735
5807
  const ignorePatterns = collectDeadCodeIgnorePatterns(rootDirectory, userConfig);
5736
5808
  const result = parseDeadCodeWorkerResult(await runDeadCodeWorkerWithTimeout((options.createWorker ?? createDeadCodeWorker)({
5737
5809
  rootDirectory,
5810
+ entryPatterns,
5738
5811
  tsConfigPath: resolveTsConfigPath(rootDirectory),
5739
5812
  ignorePatterns,
5740
5813
  deslopJsModuleSpecifier: options.deslopJsModuleSpecifier ?? import.meta.resolve("deslop-js")
@@ -5836,7 +5909,7 @@ const isDiagnosticOnSurface = (diagnostic, surface, config) => {
5836
5909
  return true;
5837
5910
  };
5838
5911
  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)));
5912
+ const excludeMinifiedFiles = (rootDirectory, relativePaths) => relativePaths.filter((relativePath) => !isLargeMinifiedFile(path$1.resolve(rootDirectory, relativePath)));
5840
5913
  const listSourceFilesViaGit = (rootDirectory) => {
5841
5914
  const result = spawnSync("git", [
5842
5915
  "ls-files",
@@ -5859,12 +5932,12 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
5859
5932
  const currentDirectory = stack.pop();
5860
5933
  const entries = readDirectoryEntries(currentDirectory);
5861
5934
  for (const entry of entries) {
5862
- const absolutePath = path.join(currentDirectory, entry.name);
5935
+ const absolutePath = path$1.join(currentDirectory, entry.name);
5863
5936
  if (entry.isDirectory()) {
5864
5937
  if (!entry.name.startsWith(".") && !IGNORED_DIRECTORIES.has(entry.name)) stack.push(absolutePath);
5865
5938
  continue;
5866
5939
  }
5867
- if (entry.isFile() && isLintableSourceFile(entry.name)) filePaths.push(path.relative(rootDirectory, absolutePath).replace(/\\/g, "/"));
5940
+ if (entry.isFile() && isLintableSourceFile(entry.name)) filePaths.push(path$1.relative(rootDirectory, absolutePath).replace(/\\/g, "/"));
5868
5941
  }
5869
5942
  }
5870
5943
  return filePaths;
@@ -5923,9 +5996,9 @@ var DeadCode = class DeadCode extends Context.Service()("react-doctor/DeadCode")
5923
5996
  };
5924
5997
  const createNodeReadFileLinesSync = (rootDirectory) => {
5925
5998
  return (filePath) => {
5926
- const absolutePath = path.isAbsolute(filePath) ? filePath : path.join(rootDirectory, filePath);
5999
+ const absolutePath = path$1.isAbsolute(filePath) ? filePath : path$1.join(rootDirectory, filePath);
5927
6000
  try {
5928
- return fs.readFileSync(absolutePath, "utf-8").split("\n");
6001
+ return fs$1.readFileSync(absolutePath, "utf-8").split("\n");
5929
6002
  } catch {
5930
6003
  return null;
5931
6004
  }
@@ -5945,7 +6018,7 @@ var Files = class Files extends Context.Service()("react-doctor/Files") {
5945
6018
  * pattern in react-doctor-evals' test layers.
5946
6019
  */
5947
6020
  static layerInMemory = (tree) => {
5948
- const resolveAbsolute = (filePath, rootDirectory) => Path.isAbsolute(filePath) ? filePath : `${rootDirectory}/${filePath}`;
6021
+ const resolveAbsolute = (filePath, rootDirectory) => path$1.isAbsolute(filePath) ? filePath : `${rootDirectory}/${filePath}`;
5949
6022
  return Layer.succeed(Files, Files.of({
5950
6023
  readLines: (input) => Effect.sync(() => {
5951
6024
  const absolute = resolveAbsolute(input.filePath, input.rootDirectory);
@@ -6435,7 +6508,7 @@ const canOxlintExtendConfig = (configPath) => {
6435
6508
  if (!configPath.endsWith(".eslintrc.json")) return true;
6436
6509
  let parsed;
6437
6510
  try {
6438
- parsed = parseJsonOrJsonc(fs.readFileSync(configPath, "utf-8"));
6511
+ parsed = parseJsonOrJsonc(fs$1.readFileSync(configPath, "utf-8"));
6439
6512
  } catch {
6440
6513
  return true;
6441
6514
  }
@@ -6448,7 +6521,7 @@ const canOxlintExtendConfig = (configPath) => {
6448
6521
  };
6449
6522
  const findFirstLintConfigInDirectory = (directory) => {
6450
6523
  for (const filename of ADOPTABLE_LINT_CONFIG_FILENAMES) {
6451
- const candidatePath = path.join(directory, filename);
6524
+ const candidatePath = path$1.join(directory, filename);
6452
6525
  if (isFile(candidatePath)) return candidatePath;
6453
6526
  }
6454
6527
  return null;
@@ -6457,12 +6530,12 @@ const detectUserLintConfigPaths = (rootDirectory) => {
6457
6530
  const directLintConfig = findFirstLintConfigInDirectory(rootDirectory);
6458
6531
  if (directLintConfig) return [directLintConfig];
6459
6532
  if (isProjectBoundary(rootDirectory)) return [];
6460
- let ancestorDirectory = path.dirname(rootDirectory);
6461
- while (ancestorDirectory !== path.dirname(ancestorDirectory)) {
6533
+ let ancestorDirectory = path$1.dirname(rootDirectory);
6534
+ while (ancestorDirectory !== path$1.dirname(ancestorDirectory)) {
6462
6535
  const ancestorLintConfig = findFirstLintConfigInDirectory(ancestorDirectory);
6463
6536
  if (ancestorLintConfig) return [ancestorLintConfig];
6464
6537
  if (isProjectBoundary(ancestorDirectory)) return [];
6465
- ancestorDirectory = path.dirname(ancestorDirectory);
6538
+ ancestorDirectory = path$1.dirname(ancestorDirectory);
6466
6539
  }
6467
6540
  return [];
6468
6541
  };
@@ -6491,10 +6564,10 @@ const findFilesWithDisableDirectivesViaFilesystem = (rootDirectory, includePaths
6491
6564
  const matches = [];
6492
6565
  const checkFile = (relativePath) => {
6493
6566
  if (!isLintableSourceFile(relativePath)) return;
6494
- const absolutePath = path.join(rootDirectory, relativePath);
6567
+ const absolutePath = path$1.join(rootDirectory, relativePath);
6495
6568
  let content;
6496
6569
  try {
6497
- content = fs.readFileSync(absolutePath, "utf-8");
6570
+ content = fs$1.readFileSync(absolutePath, "utf-8");
6498
6571
  } catch {
6499
6572
  return;
6500
6573
  }
@@ -6512,12 +6585,12 @@ const findFilesWithDisableDirectivesViaFilesystem = (rootDirectory, includePaths
6512
6585
  for (const entry of entries) {
6513
6586
  if (entry.isDirectory()) {
6514
6587
  if (entry.name.startsWith(".") || IGNORED_DIRECTORIES.has(entry.name)) continue;
6515
- stack.push(path.join(current, entry.name));
6588
+ stack.push(path$1.join(current, entry.name));
6516
6589
  continue;
6517
6590
  }
6518
6591
  if (!entry.isFile()) continue;
6519
- const absolute = path.join(current, entry.name);
6520
- checkFile(path.relative(rootDirectory, absolute));
6592
+ const absolute = path$1.join(current, entry.name);
6593
+ checkFile(path$1.relative(rootDirectory, absolute));
6521
6594
  }
6522
6595
  }
6523
6596
  return matches;
@@ -6532,7 +6605,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths) => {
6532
6605
  if (isRestored) return;
6533
6606
  isRestored = true;
6534
6607
  for (const [absolutePath, originalContent] of originalContents) try {
6535
- fs.writeFileSync(absolutePath, originalContent);
6608
+ fs$1.writeFileSync(absolutePath, originalContent);
6536
6609
  } catch (error) {
6537
6610
  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
6611
  }
@@ -6540,17 +6613,17 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths) => {
6540
6613
  const onExit = () => restore();
6541
6614
  process.once("exit", onExit);
6542
6615
  for (const relativePath of filePaths) {
6543
- const absolutePath = path.join(rootDirectory, relativePath);
6616
+ const absolutePath = path$1.join(rootDirectory, relativePath);
6544
6617
  let originalContent;
6545
6618
  try {
6546
- originalContent = fs.readFileSync(absolutePath, "utf-8");
6619
+ originalContent = fs$1.readFileSync(absolutePath, "utf-8");
6547
6620
  } catch {
6548
6621
  continue;
6549
6622
  }
6550
6623
  const neutralizedContent = neutralizeContent(originalContent);
6551
6624
  if (neutralizedContent !== originalContent) {
6552
6625
  originalContents.set(absolutePath, originalContent);
6553
- fs.writeFileSync(absolutePath, neutralizedContent);
6626
+ fs$1.writeFileSync(absolutePath, neutralizedContent);
6554
6627
  }
6555
6628
  }
6556
6629
  return () => {
@@ -6687,11 +6760,11 @@ const filterRulesToAvailable = (rules, pluginNamespace, availableRuleNames) => {
6687
6760
  * renamed.
6688
6761
  */
6689
6762
  const resolveUserPlugin = (spec, configSourceDirectory) => {
6690
- const isRelative = spec.startsWith("./") || spec.startsWith("../") || path.isAbsolute(spec);
6691
- const candidateRequire = createRequire(path.join(configSourceDirectory, "noop.js"));
6763
+ const isRelative = spec.startsWith("./") || spec.startsWith("../") || path$1.isAbsolute(spec);
6764
+ const candidateRequire = createRequire(path$1.join(configSourceDirectory, "noop.js"));
6692
6765
  let resolvedSpecifier;
6693
6766
  try {
6694
- resolvedSpecifier = isRelative ? path.resolve(configSourceDirectory, spec) : candidateRequire.resolve(spec);
6767
+ resolvedSpecifier = isRelative ? path$1.resolve(configSourceDirectory, spec) : candidateRequire.resolve(spec);
6695
6768
  } catch (error) {
6696
6769
  warnConfigIssue(`config.plugins entry "${spec}" could not be resolved from ${configSourceDirectory}: ${error instanceof Error ? error.message : String(error)}`);
6697
6770
  return null;
@@ -6731,8 +6804,8 @@ const resolveUserPlugins = (specs, configSourceDirectory) => {
6731
6804
  return resolved;
6732
6805
  };
6733
6806
  const resolveSettingsRootDirectory = (rootDirectory) => {
6734
- if (!fs.existsSync(rootDirectory)) return rootDirectory;
6735
- return fs.realpathSync(rootDirectory);
6807
+ if (!fs$1.existsSync(rootDirectory)) return rootDirectory;
6808
+ return fs$1.realpathSync(rootDirectory);
6736
6809
  };
6737
6810
  const resolveCompilerCleanupBucketSeverity = (ruleKey, severityControls) => {
6738
6811
  if (!COMPILER_CLEANUP_RULE_KEYS.has(ruleKey)) return void 0;
@@ -6808,6 +6881,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
6808
6881
  settings: { "react-doctor": {
6809
6882
  framework: project.framework,
6810
6883
  rootDirectory: resolveSettingsRootDirectory(project.rootDirectory),
6884
+ ...project.shopifyFlashListMajorVersion !== null ? { shopifyFlashListMajorVersion: project.shopifyFlashListMajorVersion } : {},
6811
6885
  ...serverAuthFunctionNames && serverAuthFunctionNames.length > 0 ? { serverAuthFunctionNames: [...serverAuthFunctionNames] } : {}
6812
6886
  } },
6813
6887
  rules: {
@@ -6820,13 +6894,13 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
6820
6894
  const esmRequire = createRequire(import.meta.url);
6821
6895
  const resolveOxlintBinary = () => {
6822
6896
  const oxlintMainPath = esmRequire.resolve("oxlint");
6823
- const oxlintPackageDirectory = path.resolve(path.dirname(oxlintMainPath), "..");
6824
- return path.join(oxlintPackageDirectory, "bin", "oxlint");
6897
+ const oxlintPackageDirectory = path$1.resolve(path$1.dirname(oxlintMainPath), "..");
6898
+ return path$1.join(oxlintPackageDirectory, "bin", "oxlint");
6825
6899
  };
6826
6900
  const resolvePluginPath = () => esmRequire.resolve("oxlint-plugin-react-doctor");
6827
6901
  const TSCONFIG_FILENAMES = ["tsconfig.json", "tsconfig.base.json"];
6828
6902
  const resolveTsConfigRelativePath = (rootDirectory) => {
6829
- for (const filename of TSCONFIG_FILENAMES) if (fs.existsSync(path.join(rootDirectory, filename))) return `./${filename}`;
6903
+ for (const filename of TSCONFIG_FILENAMES) if (fs$1.existsSync(path$1.join(rootDirectory, filename))) return `./${filename}`;
6830
6904
  return null;
6831
6905
  };
6832
6906
  const dedupeDiagnostics = (diagnostics) => {
@@ -7326,10 +7400,10 @@ const shouldSuppressLocalUseHookDiagnostic = (diagnostic, rootDirectory) => {
7326
7400
  if (!diagnostic.message.startsWith(REACT_HOOK_USE_MESSAGE_PREFIX)) return false;
7327
7401
  const primaryLabel = diagnostic.labels[0];
7328
7402
  if (!primaryLabel) return false;
7329
- const absolutePath = path.isAbsolute(diagnostic.filename) ? diagnostic.filename : path.join(rootDirectory, diagnostic.filename);
7403
+ const absolutePath = path$1.isAbsolute(diagnostic.filename) ? diagnostic.filename : path$1.join(rootDirectory, diagnostic.filename);
7330
7404
  let sourceText;
7331
7405
  try {
7332
- sourceText = fs.readFileSync(absolutePath, "utf-8");
7406
+ sourceText = fs$1.readFileSync(absolutePath, "utf-8");
7333
7407
  } catch {
7334
7408
  return false;
7335
7409
  }
@@ -7420,7 +7494,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
7420
7494
  if (!isOxlintOutput(parsed)) throw new ReactDoctorError({ reason: new OxlintOutputUnparseable({ preview: stdout.slice(0, 200) }) });
7421
7495
  const minifiedFileCache = /* @__PURE__ */ new Map();
7422
7496
  const isMinifiedDiagnosticFile = (filename) => {
7423
- const absolutePath = path.isAbsolute(filename) ? filename : path.resolve(rootDirectory || ".", filename);
7497
+ const absolutePath = path$1.isAbsolute(filename) ? filename : path$1.resolve(rootDirectory || ".", filename);
7424
7498
  const cached = minifiedFileCache.get(absolutePath);
7425
7499
  if (cached !== void 0) return cached;
7426
7500
  const minified = isMinifiedSource(absolutePath);
@@ -7687,12 +7761,12 @@ const validateRuleRegistration = () => {
7687
7761
  * legitimate overwriter is `this` runner inside the same temp dir.
7688
7762
  */
7689
7763
  const writeOxlintConfig = (configPath, configToWrite) => {
7690
- fs.rmSync(configPath, { force: true });
7691
- const fileHandle = fs.openSync(configPath, "wx", 384);
7764
+ fs$1.rmSync(configPath, { force: true });
7765
+ const fileHandle = fs$1.openSync(configPath, "wx", 384);
7692
7766
  try {
7693
- fs.writeFileSync(fileHandle, JSON.stringify(configToWrite));
7767
+ fs$1.writeFileSync(fileHandle, JSON.stringify(configToWrite));
7694
7768
  } finally {
7695
- fs.closeSync(fileHandle);
7769
+ fs$1.closeSync(fileHandle);
7696
7770
  }
7697
7771
  };
7698
7772
  /**
@@ -7733,8 +7807,8 @@ const runOxlint = async (options) => {
7733
7807
  userPlugins
7734
7808
  });
7735
7809
  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");
7810
+ const configDirectory = fs$1.mkdtempSync(path$1.join(os.tmpdir(), "react-doctor-oxlintrc-"));
7811
+ const configPath = path$1.join(configDirectory, "oxlintrc.json");
7738
7812
  try {
7739
7813
  const baseArgs = [
7740
7814
  resolveOxlintBinary(),
@@ -7749,8 +7823,8 @@ const runOxlint = async (options) => {
7749
7823
  }
7750
7824
  const combinedPatterns = collectIgnorePatterns(rootDirectory);
7751
7825
  if (combinedPatterns.length > 0) {
7752
- const combinedIgnorePath = path.join(configDirectory, "combined.ignore");
7753
- fs.writeFileSync(combinedIgnorePath, `${combinedPatterns.join("\n")}\n`);
7826
+ const combinedIgnorePath = path$1.join(configDirectory, "combined.ignore");
7827
+ fs$1.writeFileSync(combinedIgnorePath, `${combinedPatterns.join("\n")}\n`);
7754
7828
  baseArgs.push("--ignore-path", combinedIgnorePath);
7755
7829
  }
7756
7830
  const fileBatches = batchIncludePaths(baseArgs, includePaths !== void 0 ? includePaths : listSourceFiles(rootDirectory));
@@ -7776,7 +7850,7 @@ const runOxlint = async (options) => {
7776
7850
  }
7777
7851
  } finally {
7778
7852
  restoreDisableDirectives();
7779
- fs.rmSync(configDirectory, {
7853
+ fs$1.rmSync(configDirectory, {
7780
7854
  recursive: true,
7781
7855
  force: true
7782
7856
  });
@@ -7978,7 +8052,7 @@ var Reporter = class Reporter extends Context.Service()("react-doctor/Reporter")
7978
8052
  * `Diagnostic` schema.
7979
8053
  */
7980
8054
  static layerNdjson = (filePath) => Layer.effect(Reporter, Effect.sync(() => {
7981
- fs$1.mkdirSync(Path.dirname(filePath), { recursive: true });
8055
+ fs$1.mkdirSync(path$1.dirname(filePath), { recursive: true });
7982
8056
  const handle = fs$1.openSync(filePath, "a");
7983
8057
  const encode = Schema.encodeUnknownSync(Diagnostic);
7984
8058
  const emit = (diagnostic) => Effect.sync(() => {
@@ -8029,6 +8103,7 @@ const calculateScore = async (diagnostics, options = {}) => {
8029
8103
  ...typeof options.metadata?.sourceFileCount === "number" ? { sourceFileCount: options.metadata.sourceFileCount } : {},
8030
8104
  ...options.metadata?.defaultBranch ? { defaultBranch: options.metadata.defaultBranch } : {},
8031
8105
  ...options.metadata?.doctorVersion ? { doctorVersion: options.metadata.doctorVersion } : {},
8106
+ ...options.metadata?.runId ? { runId: options.metadata.runId } : {},
8032
8107
  ...options.metadata?.githubEventName ? { githubEventName: options.metadata.githubEventName } : {},
8033
8108
  ...options.metadata?.githubActorAssociation ? { githubActorAssociation: options.metadata.githubActorAssociation } : {},
8034
8109
  ...options.metadata?.githubViewerPermission ? { githubViewerPermission: options.metadata.githubViewerPermission } : {}
@@ -8087,7 +8162,7 @@ const getStringProperty = (value, propertyName) => {
8087
8162
  const readGithubEventPayload = (eventPath) => {
8088
8163
  if (eventPath === void 0 || eventPath.length === 0) return null;
8089
8164
  try {
8090
- return JSON.parse(readFileSync(eventPath, "utf8"));
8165
+ return JSON.parse(fs$1.readFileSync(eventPath, "utf8"));
8091
8166
  } catch {
8092
8167
  return null;
8093
8168
  }
@@ -8171,7 +8246,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
8171
8246
  repo
8172
8247
  }).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
8173
8248
  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)) : [];
8249
+ const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
8175
8250
  const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
8176
8251
  const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
8177
8252
  yield* beforeLint(project, lintIncludePaths ?? void 0);
@@ -8268,6 +8343,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
8268
8343
  sourceFileCount: project.sourceFileCount,
8269
8344
  ...defaultBranch !== null ? { defaultBranch } : {},
8270
8345
  ...input.doctorVersion !== void 0 ? { doctorVersion: input.doctorVersion } : {},
8346
+ ...input.runId !== void 0 ? { runId: input.runId } : {},
8271
8347
  ...githubActionsScoreMetadata,
8272
8348
  ...githubViewerPermission !== null ? { githubViewerPermission } : {}
8273
8349
  };
@@ -8321,25 +8397,25 @@ const isNodeVersionCompatibleWithOxlint = ({ major, minor }) => {
8321
8397
  const isCurrentNodeCompatibleWithOxlint = () => isNodeVersionCompatibleWithOxlint(parseNodeVersion(process.version));
8322
8398
  const getNvmDirectory = () => {
8323
8399
  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;
8400
+ if (envNvmDirectory && fs$1.existsSync(envNvmDirectory)) return envNvmDirectory;
8401
+ const defaultNvmDirectory = path$1.join(os.homedir(), ".nvm");
8402
+ if (fs$1.existsSync(defaultNvmDirectory)) return defaultNvmDirectory;
8327
8403
  return null;
8328
8404
  };
8329
8405
  const isNvmInstalled = () => getNvmDirectory() !== null;
8330
8406
  const findCompatibleNvmBinary = () => {
8331
8407
  const nvmDirectory = getNvmDirectory();
8332
8408
  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) => ({
8409
+ const versionsDirectory = path$1.join(nvmDirectory, "versions", "node");
8410
+ if (!fs$1.existsSync(versionsDirectory)) return null;
8411
+ const compatibleVersions = fs$1.readdirSync(versionsDirectory).filter((directoryName) => directoryName.startsWith("v")).map((directoryName) => ({
8336
8412
  directoryName,
8337
8413
  ...parseNodeVersion(directoryName)
8338
8414
  })).filter((version) => isNodeVersionCompatibleWithOxlint(version)).sort((versionA, versionB) => versionB.major - versionA.major || versionB.minor - versionA.minor || versionB.patch - versionA.patch);
8339
8415
  if (compatibleVersions.length === 0) return null;
8340
8416
  const bestVersion = compatibleVersions[0];
8341
- const binaryPath = path.join(versionsDirectory, bestVersion.directoryName, "bin", "node");
8342
- return existsSync(binaryPath) ? binaryPath : null;
8417
+ const binaryPath = path$1.join(versionsDirectory, bestVersion.directoryName, "bin", "node");
8418
+ return fs$1.existsSync(binaryPath) ? binaryPath : null;
8343
8419
  };
8344
8420
  const getNodeVersionFromBinary = (binaryPath) => {
8345
8421
  const result = spawnSync(binaryPath, ["--version"], { encoding: "utf-8" });
@@ -8349,8 +8425,8 @@ const getNodeVersionFromBinary = (binaryPath) => {
8349
8425
  const installNodeViaNvm = () => {
8350
8426
  const nvmDirectory = getNvmDirectory();
8351
8427
  if (!nvmDirectory) return false;
8352
- const nvmScript = path.join(nvmDirectory, "nvm.sh");
8353
- if (!existsSync(nvmScript)) return false;
8428
+ const nvmScript = path$1.join(nvmDirectory, "nvm.sh");
8429
+ if (!fs$1.existsSync(nvmScript)) return false;
8354
8430
  const result = spawnSync("bash", ["-c", ". \"$NVM_SCRIPT\" && nvm install \"$NODE_MAJOR\""], {
8355
8431
  stdio: "inherit",
8356
8432
  env: {
@@ -8413,8 +8489,8 @@ const resolveNodeForOxlint = () => {
8413
8489
  * result that lands outside it before `writeFileSync` runs.
8414
8490
  */
8415
8491
  const isPathInsideDirectory = (childAbsolutePath, parentAbsolutePath) => {
8416
- const relative = path.relative(parentAbsolutePath, childAbsolutePath);
8417
- return Boolean(relative) && !relative.startsWith("..") && !path.isAbsolute(relative);
8492
+ const relative = path$1.relative(parentAbsolutePath, childAbsolutePath);
8493
+ return Boolean(relative) && !relative.startsWith("..") && !path$1.isAbsolute(relative);
8418
8494
  };
8419
8495
  (class StagedFiles extends Context.Service()("react-doctor/StagedFiles") {
8420
8496
  static layerNode = Layer.effect(StagedFiles, Effect.gen(function* () {
@@ -8423,23 +8499,23 @@ const isPathInsideDirectory = (childAbsolutePath, parentAbsolutePath) => {
8423
8499
  discoverSourceFiles: (directory) => git.stagedFilePaths(directory).pipe(Effect.map((entries) => entries.filter(isLintableSourceFile))),
8424
8500
  materialize: ({ directory, stagedFiles, tempDirectory }) => Effect.gen(function* () {
8425
8501
  const materializedFiles = [];
8426
- const resolvedTempDirectory = path.resolve(tempDirectory);
8502
+ const resolvedTempDirectory = path$1.resolve(tempDirectory);
8427
8503
  for (const relativePath of stagedFiles) {
8428
8504
  const content = yield* git.showStagedContent(directory, relativePath, { maxBufferBytes: GIT_SHOW_MAX_BUFFER_BYTES }).pipe(Effect.orElseSucceed(() => null));
8429
8505
  if (content === null) continue;
8430
- const candidateTargetPath = path.resolve(resolvedTempDirectory, relativePath);
8506
+ const candidateTargetPath = path$1.resolve(resolvedTempDirectory, relativePath);
8431
8507
  if (!isPathInsideDirectory(candidateTargetPath, resolvedTempDirectory)) continue;
8432
8508
  yield* Effect.sync(() => {
8433
- fs.mkdirSync(path.dirname(candidateTargetPath), { recursive: true });
8434
- fs.writeFileSync(candidateTargetPath, content);
8509
+ fs$1.mkdirSync(path$1.dirname(candidateTargetPath), { recursive: true });
8510
+ fs$1.writeFileSync(candidateTargetPath, content);
8435
8511
  });
8436
8512
  materializedFiles.push(relativePath);
8437
8513
  }
8438
8514
  yield* Effect.sync(() => {
8439
8515
  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);
8516
+ const sourcePath = path$1.join(directory, configFilename);
8517
+ const targetPath = path$1.join(resolvedTempDirectory, configFilename);
8518
+ if (fs$1.existsSync(sourcePath) && !fs$1.existsSync(targetPath)) fs$1.cpSync(sourcePath, targetPath);
8443
8519
  }
8444
8520
  });
8445
8521
  return {
@@ -8447,7 +8523,7 @@ const isPathInsideDirectory = (childAbsolutePath, parentAbsolutePath) => {
8447
8523
  stagedFiles: materializedFiles,
8448
8524
  cleanup: () => {
8449
8525
  try {
8450
- fs.rmSync(tempDirectory, {
8526
+ fs$1.rmSync(tempDirectory, {
8451
8527
  recursive: true,
8452
8528
  force: true
8453
8529
  });
@@ -8724,4 +8800,4 @@ const toJsonReport = (result, options) => buildJsonReport({
8724
8800
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
8725
8801
 
8726
8802
  //# sourceMappingURL=index.js.map
8727
- //# debugId=9b91fa51-6642-5351-a848-af91945dec6f
8803
+ //# debugId=78466bb6-1333-5899-a21b-ca9ce49351a3