react-doctor 0.8.1-dev.3018538 → 0.8.1-dev.3598138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +41 -143
- package/dist/index.d.ts +0 -4
- package/dist/index.js +37 -137
- package/dist/lsp.js +37 -137
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
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]="cc020c29-7bf9-5ff5-867d-058ebf813fa9")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as NodeChildProcess from "node:child_process";
|
|
5
5
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -36571,10 +36571,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
36571
36571
|
const FRAMEWORK_PACKAGES = {
|
|
36572
36572
|
next: "nextjs",
|
|
36573
36573
|
"@tanstack/react-start": "tanstack-start",
|
|
36574
|
-
"@remix-run/react": "remix",
|
|
36575
|
-
gatsby: "gatsby",
|
|
36576
36574
|
vite: "vite",
|
|
36577
36575
|
"react-scripts": "cra",
|
|
36576
|
+
"@remix-run/react": "remix",
|
|
36577
|
+
gatsby: "gatsby",
|
|
36578
36578
|
expo: "expo",
|
|
36579
36579
|
"react-native": "react-native"
|
|
36580
36580
|
};
|
|
@@ -37101,6 +37101,19 @@ const getPreactVersion = (packageJson) => {
|
|
|
37101
37101
|
...packageJson.devDependencies
|
|
37102
37102
|
}.preact ?? null;
|
|
37103
37103
|
};
|
|
37104
|
+
const TANSTACK_QUERY_PACKAGES = new Set([
|
|
37105
|
+
"@tanstack/react-query",
|
|
37106
|
+
"@tanstack/query-core",
|
|
37107
|
+
"react-query"
|
|
37108
|
+
]);
|
|
37109
|
+
const hasTanStackQuery = (packageJson) => {
|
|
37110
|
+
const allDependencies = {
|
|
37111
|
+
...packageJson.peerDependencies,
|
|
37112
|
+
...packageJson.dependencies,
|
|
37113
|
+
...packageJson.devDependencies
|
|
37114
|
+
};
|
|
37115
|
+
return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
|
|
37116
|
+
};
|
|
37104
37117
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
37105
37118
|
if (version === null || !isCatalogReference(version)) return version;
|
|
37106
37119
|
const catalogName = extractCatalogName(version);
|
|
@@ -37303,67 +37316,6 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37303
37316
|
}
|
|
37304
37317
|
return packages;
|
|
37305
37318
|
};
|
|
37306
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
37307
|
-
const allDependencies = {
|
|
37308
|
-
...packageJson.devDependencies,
|
|
37309
|
-
...packageJson.peerDependencies,
|
|
37310
|
-
...packageJson.dependencies
|
|
37311
|
-
};
|
|
37312
|
-
for (const packageName of packageNames) {
|
|
37313
|
-
const version = allDependencies[packageName];
|
|
37314
|
-
if (version !== void 0) return version;
|
|
37315
|
-
}
|
|
37316
|
-
return null;
|
|
37317
|
-
};
|
|
37318
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
37319
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
37320
|
-
return getPreferredDependencyVersion({
|
|
37321
|
-
packageJson,
|
|
37322
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
37323
|
-
});
|
|
37324
|
-
};
|
|
37325
|
-
const MOBX_PACKAGES = [
|
|
37326
|
-
"mobx",
|
|
37327
|
-
"mobx-react",
|
|
37328
|
-
"mobx-react-lite",
|
|
37329
|
-
"mobx-state-tree"
|
|
37330
|
-
];
|
|
37331
|
-
const getMobxVersion = (packageJson) => {
|
|
37332
|
-
return getPreferredDependencyVersion({
|
|
37333
|
-
packageJson,
|
|
37334
|
-
packageNames: MOBX_PACKAGES
|
|
37335
|
-
});
|
|
37336
|
-
};
|
|
37337
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
37338
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
37339
|
-
return getPreferredDependencyVersion({
|
|
37340
|
-
packageJson,
|
|
37341
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
37342
|
-
});
|
|
37343
|
-
};
|
|
37344
|
-
const I18N_PACKAGES = [
|
|
37345
|
-
"i18next",
|
|
37346
|
-
"react-i18next",
|
|
37347
|
-
"next-i18next",
|
|
37348
|
-
"react-intl",
|
|
37349
|
-
"next-intl",
|
|
37350
|
-
"use-intl",
|
|
37351
|
-
"@formatjs/intl",
|
|
37352
|
-
"@lingui/core",
|
|
37353
|
-
"@lingui/react",
|
|
37354
|
-
"typesafe-i18n",
|
|
37355
|
-
"@tolgee/react",
|
|
37356
|
-
"react-intl-universal"
|
|
37357
|
-
];
|
|
37358
|
-
const hasI18nDependency = (packageJson) => {
|
|
37359
|
-
const allDependencies = {
|
|
37360
|
-
...packageJson.peerDependencies,
|
|
37361
|
-
...packageJson.dependencies,
|
|
37362
|
-
...packageJson.devDependencies,
|
|
37363
|
-
...packageJson.optionalDependencies
|
|
37364
|
-
};
|
|
37365
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
37366
|
-
};
|
|
37367
37319
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
37368
37320
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37369
37321
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
@@ -37383,14 +37335,6 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
37383
37335
|
if (nextMajor === null) return false;
|
|
37384
37336
|
return nextMajor < currentMajor;
|
|
37385
37337
|
};
|
|
37386
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
37387
|
-
if (!currentVersion) return true;
|
|
37388
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
37389
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
37390
|
-
if (currentMajor === null) return false;
|
|
37391
|
-
if (nextMajor === null) return true;
|
|
37392
|
-
return nextMajor < currentMajor;
|
|
37393
|
-
};
|
|
37394
37338
|
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
37395
37339
|
if (facts.expo.version === null) {
|
|
37396
37340
|
const spec = getDependencySpec(packageJson, "expo");
|
|
@@ -37417,11 +37361,6 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
37417
37361
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37418
37362
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37419
37363
|
}
|
|
37420
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
37421
|
-
facts.mobxVersion ??= getMobxVersion(packageJson);
|
|
37422
|
-
const styledComponentsVersion = getStyledComponentsVersion(packageJson);
|
|
37423
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
37424
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
37425
37364
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37426
37365
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37427
37366
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -37444,10 +37383,6 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37444
37383
|
version: null,
|
|
37445
37384
|
sourceDirectory: null
|
|
37446
37385
|
},
|
|
37447
|
-
tanstackQueryVersion: null,
|
|
37448
|
-
mobxVersion: null,
|
|
37449
|
-
styledComponentsVersion: null,
|
|
37450
|
-
hasI18nLibrary: false,
|
|
37451
37386
|
hasReactNativeAwarePackage: false,
|
|
37452
37387
|
hasReanimatedAwarePackage: false,
|
|
37453
37388
|
hasSsrDependency: false,
|
|
@@ -37688,10 +37623,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37688
37623
|
hasReactCompiler: false,
|
|
37689
37624
|
hasReactCompilerLintPlugin: false,
|
|
37690
37625
|
hasTanStackQuery: false,
|
|
37691
|
-
hasI18nLibrary: false,
|
|
37692
|
-
tanstackQueryVersion: null,
|
|
37693
|
-
mobxVersion: null,
|
|
37694
|
-
styledComponentsVersion: null,
|
|
37695
37626
|
hasSsrDependency: false,
|
|
37696
37627
|
preactVersion: null,
|
|
37697
37628
|
preactMajorVersion: null,
|
|
@@ -37799,7 +37730,6 @@ const discoverProject = (directory) => {
|
|
|
37799
37730
|
version: workspaceFacts.next.version
|
|
37800
37731
|
}) : null;
|
|
37801
37732
|
const preactVersion = getPreactVersion(packageJson);
|
|
37802
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
37803
37733
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
37804
37734
|
const projectInfo = {
|
|
37805
37735
|
rootDirectory: directory,
|
|
@@ -37813,11 +37743,7 @@ const discoverProject = (directory) => {
|
|
|
37813
37743
|
hasTypeScript,
|
|
37814
37744
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
37815
37745
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
37816
|
-
hasTanStackQuery:
|
|
37817
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
37818
|
-
tanstackQueryVersion,
|
|
37819
|
-
mobxVersion: workspaceFacts.mobxVersion,
|
|
37820
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
37746
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
37821
37747
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
37822
37748
|
preactVersion,
|
|
37823
37749
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -40372,9 +40298,25 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
40372
40298
|
".babelrc.json"
|
|
40373
40299
|
];
|
|
40374
40300
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
40301
|
+
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
40302
|
+
const REACT_NATIVE_PACKAGE = "react-native";
|
|
40303
|
+
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
40304
|
+
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
40375
40305
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
40376
40306
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
40307
|
+
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
40308
|
+
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
40309
|
+
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson$1(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
40310
|
+
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
40311
|
+
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
40312
|
+
if (normalizedVersionRange === null) return false;
|
|
40313
|
+
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
40314
|
+
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
40315
|
+
};
|
|
40316
|
+
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
40377
40317
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
40318
|
+
const packageJson = readPackageJson$1(Path.join(rootDirectory, "package.json"));
|
|
40319
|
+
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
40378
40320
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
40379
40321
|
const filePath = Path.join(rootDirectory, fileName);
|
|
40380
40322
|
if (!isFile(filePath)) continue;
|
|
@@ -40384,7 +40326,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
40384
40326
|
} catch {
|
|
40385
40327
|
continue;
|
|
40386
40328
|
}
|
|
40387
|
-
if (
|
|
40329
|
+
if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
|
|
40388
40330
|
filePath: fileName,
|
|
40389
40331
|
rule: "rn-no-metro-babel-preset",
|
|
40390
40332
|
severity: "error",
|
|
@@ -40407,12 +40349,6 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
40407
40349
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
40408
40350
|
};
|
|
40409
40351
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
40410
|
-
const DEPENDENCY_SECTIONS = [
|
|
40411
|
-
"dependencies",
|
|
40412
|
-
"devDependencies",
|
|
40413
|
-
"peerDependencies",
|
|
40414
|
-
"optionalDependencies"
|
|
40415
|
-
];
|
|
40416
40352
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
40417
40353
|
"19.0": {
|
|
40418
40354
|
rceFixedVersion: "19.0.1",
|
|
@@ -40459,20 +40395,13 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
40459
40395
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
40460
40396
|
return [...directories];
|
|
40461
40397
|
};
|
|
40462
|
-
const readDeclaredSpec = (packageJson, packageName) => {
|
|
40463
|
-
for (const section of DEPENDENCY_SECTIONS) {
|
|
40464
|
-
const spec = packageJson[section]?.[packageName];
|
|
40465
|
-
if (typeof spec === "string") return spec;
|
|
40466
|
-
}
|
|
40467
|
-
return null;
|
|
40468
|
-
};
|
|
40469
40398
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
40470
40399
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
40471
40400
|
if (isFile(manifestPath)) {
|
|
40472
40401
|
const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
|
|
40473
40402
|
if (installedVersion !== null) return installedVersion;
|
|
40474
40403
|
}
|
|
40475
|
-
const candidateSpecs = [
|
|
40404
|
+
const candidateSpecs = [getDependencySpec(readPackageJson$1(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
40476
40405
|
for (const spec of candidateSpecs) {
|
|
40477
40406
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
40478
40407
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -41140,7 +41069,6 @@ const buildCapabilities = (project) => {
|
|
|
41140
41069
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
41141
41070
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41142
41071
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
41143
|
-
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
41144
41072
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41145
41073
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41146
41074
|
major: 19,
|
|
@@ -41155,14 +41083,7 @@ const buildCapabilities = (project) => {
|
|
|
41155
41083
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
41156
41084
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41157
41085
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41158
|
-
if (
|
|
41159
|
-
if (project.mobxVersion) capabilities.add("mobx");
|
|
41160
|
-
if (project.styledComponentsVersion) {
|
|
41161
|
-
capabilities.add("styled-components");
|
|
41162
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
41163
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
41164
|
-
}
|
|
41165
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
41086
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41166
41087
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41167
41088
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41168
41089
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -43447,19 +43368,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
43447
43368
|
}
|
|
43448
43369
|
};
|
|
43449
43370
|
};
|
|
43450
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
43451
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
43452
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
43453
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
43454
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
43455
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
43456
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
43457
|
-
fingerprint,
|
|
43458
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
43459
|
-
sizeBytes: fileStats.size
|
|
43460
|
-
});
|
|
43461
|
-
return fingerprint;
|
|
43462
|
-
};
|
|
43463
43371
|
const bundledRequire$3 = createRequire(import.meta.url);
|
|
43464
43372
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
43465
43373
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -43483,13 +43391,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
|
|
|
43483
43391
|
"oxlint-plugin-react-doctor/package.json",
|
|
43484
43392
|
"eslint-plugin-react-hooks/package.json"
|
|
43485
43393
|
];
|
|
43486
|
-
const resolvePluginFingerprint = () => {
|
|
43487
|
-
try {
|
|
43488
|
-
return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
|
|
43489
|
-
} catch {
|
|
43490
|
-
return "unresolved";
|
|
43491
|
-
}
|
|
43492
|
-
};
|
|
43493
43394
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
43494
43395
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
43495
43396
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
|
|
@@ -43499,7 +43400,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
43499
43400
|
} catch {
|
|
43500
43401
|
versions.push(`${specifier}=missing`);
|
|
43501
43402
|
}
|
|
43502
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
43503
43403
|
return versions;
|
|
43504
43404
|
};
|
|
43505
43405
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -47467,7 +47367,7 @@ const makeNoopConsole = () => ({
|
|
|
47467
47367
|
});
|
|
47468
47368
|
//#endregion
|
|
47469
47369
|
//#region src/cli/utils/version.ts
|
|
47470
|
-
const VERSION = "0.8.1-dev.
|
|
47370
|
+
const VERSION = "0.8.1-dev.3598138";
|
|
47471
47371
|
//#endregion
|
|
47472
47372
|
//#region src/cli/utils/json-mode.ts
|
|
47473
47373
|
let context = null;
|
|
@@ -47638,9 +47538,7 @@ const buildSentryProjectContext = (projectInfo) => ({
|
|
|
47638
47538
|
reactMajorVersion: projectInfo.reactMajorVersion,
|
|
47639
47539
|
hasTypeScript: projectInfo.hasTypeScript,
|
|
47640
47540
|
hasReactCompiler: projectInfo.hasReactCompiler,
|
|
47641
|
-
|
|
47642
|
-
mobxVersion: projectInfo.mobxVersion,
|
|
47643
|
-
styledComponentsVersion: projectInfo.styledComponentsVersion,
|
|
47541
|
+
hasTanStackQuery: projectInfo.hasTanStackQuery,
|
|
47644
47542
|
tailwindVersion: projectInfo.tailwindVersion,
|
|
47645
47543
|
zodVersion: projectInfo.zodVersion,
|
|
47646
47544
|
preactVersion: projectInfo.preactVersion,
|
|
@@ -47821,13 +47719,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
47821
47719
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
47822
47720
|
* standard `SENTRY_RELEASE` override.
|
|
47823
47721
|
*/
|
|
47824
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47722
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.3598138`;
|
|
47825
47723
|
/**
|
|
47826
47724
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
47827
47725
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
47828
47726
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
47829
47727
|
*/
|
|
47830
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47728
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.3598138") ? "development" : "production");
|
|
47831
47729
|
/**
|
|
47832
47730
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
47833
47731
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -66507,4 +66405,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66507
66405
|
export {};
|
|
66508
66406
|
|
|
66509
66407
|
//# sourceMappingURL=cli.js.map
|
|
66510
|
-
//# debugId=
|
|
66408
|
+
//# debugId=cc020c29-7bf9-5ff5-867d-058ebf813fa9
|
package/dist/index.d.ts
CHANGED
|
@@ -9548,10 +9548,6 @@ interface ProjectInfo {
|
|
|
9548
9548
|
hasReactCompiler: boolean;
|
|
9549
9549
|
hasReactCompilerLintPlugin?: boolean;
|
|
9550
9550
|
hasTanStackQuery: boolean;
|
|
9551
|
-
hasI18nLibrary?: boolean;
|
|
9552
|
-
tanstackQueryVersion?: string | null;
|
|
9553
|
-
mobxVersion?: string | null;
|
|
9554
|
-
styledComponentsVersion?: string | null;
|
|
9555
9551
|
/**
|
|
9556
9552
|
* `true` when the project or a workspace declares a Vite-based SSR runtime
|
|
9557
9553
|
* such as React Router's Node adapter, Vike, or vite-plugin-ssr.
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
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]="ba0e3885-0c68-5322-b382-578d3d89d5c5")}catch(e){}}();
|
|
3
3
|
import { r as __toESM$1, t as __commonJSMin$1 } from "./chunk-N93fKeF6.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor";
|
|
@@ -33375,10 +33375,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
33375
33375
|
const FRAMEWORK_PACKAGES = {
|
|
33376
33376
|
next: "nextjs",
|
|
33377
33377
|
"@tanstack/react-start": "tanstack-start",
|
|
33378
|
-
"@remix-run/react": "remix",
|
|
33379
|
-
gatsby: "gatsby",
|
|
33380
33378
|
vite: "vite",
|
|
33381
33379
|
"react-scripts": "cra",
|
|
33380
|
+
"@remix-run/react": "remix",
|
|
33381
|
+
gatsby: "gatsby",
|
|
33382
33382
|
expo: "expo",
|
|
33383
33383
|
"react-native": "react-native"
|
|
33384
33384
|
};
|
|
@@ -33905,6 +33905,19 @@ const getPreactVersion = (packageJson) => {
|
|
|
33905
33905
|
...packageJson.devDependencies
|
|
33906
33906
|
}.preact ?? null;
|
|
33907
33907
|
};
|
|
33908
|
+
const TANSTACK_QUERY_PACKAGES = new Set([
|
|
33909
|
+
"@tanstack/react-query",
|
|
33910
|
+
"@tanstack/query-core",
|
|
33911
|
+
"react-query"
|
|
33912
|
+
]);
|
|
33913
|
+
const hasTanStackQuery = (packageJson) => {
|
|
33914
|
+
const allDependencies = {
|
|
33915
|
+
...packageJson.peerDependencies,
|
|
33916
|
+
...packageJson.dependencies,
|
|
33917
|
+
...packageJson.devDependencies
|
|
33918
|
+
};
|
|
33919
|
+
return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
|
|
33920
|
+
};
|
|
33908
33921
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33909
33922
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33910
33923
|
const catalogName = extractCatalogName(version);
|
|
@@ -34107,67 +34120,6 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34107
34120
|
}
|
|
34108
34121
|
return packages;
|
|
34109
34122
|
};
|
|
34110
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34111
|
-
const allDependencies = {
|
|
34112
|
-
...packageJson.devDependencies,
|
|
34113
|
-
...packageJson.peerDependencies,
|
|
34114
|
-
...packageJson.dependencies
|
|
34115
|
-
};
|
|
34116
|
-
for (const packageName of packageNames) {
|
|
34117
|
-
const version = allDependencies[packageName];
|
|
34118
|
-
if (version !== void 0) return version;
|
|
34119
|
-
}
|
|
34120
|
-
return null;
|
|
34121
|
-
};
|
|
34122
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
34123
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
34124
|
-
return getPreferredDependencyVersion({
|
|
34125
|
-
packageJson,
|
|
34126
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34127
|
-
});
|
|
34128
|
-
};
|
|
34129
|
-
const MOBX_PACKAGES = [
|
|
34130
|
-
"mobx",
|
|
34131
|
-
"mobx-react",
|
|
34132
|
-
"mobx-react-lite",
|
|
34133
|
-
"mobx-state-tree"
|
|
34134
|
-
];
|
|
34135
|
-
const getMobxVersion = (packageJson) => {
|
|
34136
|
-
return getPreferredDependencyVersion({
|
|
34137
|
-
packageJson,
|
|
34138
|
-
packageNames: MOBX_PACKAGES
|
|
34139
|
-
});
|
|
34140
|
-
};
|
|
34141
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34142
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
34143
|
-
return getPreferredDependencyVersion({
|
|
34144
|
-
packageJson,
|
|
34145
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
34146
|
-
});
|
|
34147
|
-
};
|
|
34148
|
-
const I18N_PACKAGES = [
|
|
34149
|
-
"i18next",
|
|
34150
|
-
"react-i18next",
|
|
34151
|
-
"next-i18next",
|
|
34152
|
-
"react-intl",
|
|
34153
|
-
"next-intl",
|
|
34154
|
-
"use-intl",
|
|
34155
|
-
"@formatjs/intl",
|
|
34156
|
-
"@lingui/core",
|
|
34157
|
-
"@lingui/react",
|
|
34158
|
-
"typesafe-i18n",
|
|
34159
|
-
"@tolgee/react",
|
|
34160
|
-
"react-intl-universal"
|
|
34161
|
-
];
|
|
34162
|
-
const hasI18nDependency = (packageJson) => {
|
|
34163
|
-
const allDependencies = {
|
|
34164
|
-
...packageJson.peerDependencies,
|
|
34165
|
-
...packageJson.dependencies,
|
|
34166
|
-
...packageJson.devDependencies,
|
|
34167
|
-
...packageJson.optionalDependencies
|
|
34168
|
-
};
|
|
34169
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34170
|
-
};
|
|
34171
34123
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34172
34124
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34173
34125
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
@@ -34187,14 +34139,6 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34187
34139
|
if (nextMajor === null) return false;
|
|
34188
34140
|
return nextMajor < currentMajor;
|
|
34189
34141
|
};
|
|
34190
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34191
|
-
if (!currentVersion) return true;
|
|
34192
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34193
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34194
|
-
if (currentMajor === null) return false;
|
|
34195
|
-
if (nextMajor === null) return true;
|
|
34196
|
-
return nextMajor < currentMajor;
|
|
34197
|
-
};
|
|
34198
34142
|
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34199
34143
|
if (facts.expo.version === null) {
|
|
34200
34144
|
const spec = getDependencySpec(packageJson, "expo");
|
|
@@ -34221,11 +34165,6 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34221
34165
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34222
34166
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34223
34167
|
}
|
|
34224
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34225
|
-
facts.mobxVersion ??= getMobxVersion(packageJson);
|
|
34226
|
-
const styledComponentsVersion = getStyledComponentsVersion(packageJson);
|
|
34227
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34228
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34229
34168
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34230
34169
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34231
34170
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -34248,10 +34187,6 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34248
34187
|
version: null,
|
|
34249
34188
|
sourceDirectory: null
|
|
34250
34189
|
},
|
|
34251
|
-
tanstackQueryVersion: null,
|
|
34252
|
-
mobxVersion: null,
|
|
34253
|
-
styledComponentsVersion: null,
|
|
34254
|
-
hasI18nLibrary: false,
|
|
34255
34190
|
hasReactNativeAwarePackage: false,
|
|
34256
34191
|
hasReanimatedAwarePackage: false,
|
|
34257
34192
|
hasSsrDependency: false,
|
|
@@ -34495,10 +34430,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34495
34430
|
hasReactCompiler: false,
|
|
34496
34431
|
hasReactCompilerLintPlugin: false,
|
|
34497
34432
|
hasTanStackQuery: false,
|
|
34498
|
-
hasI18nLibrary: false,
|
|
34499
|
-
tanstackQueryVersion: null,
|
|
34500
|
-
mobxVersion: null,
|
|
34501
|
-
styledComponentsVersion: null,
|
|
34502
34433
|
hasSsrDependency: false,
|
|
34503
34434
|
preactVersion: null,
|
|
34504
34435
|
preactMajorVersion: null,
|
|
@@ -34606,7 +34537,6 @@ const discoverProject = (directory) => {
|
|
|
34606
34537
|
version: workspaceFacts.next.version
|
|
34607
34538
|
}) : null;
|
|
34608
34539
|
const preactVersion = getPreactVersion(packageJson);
|
|
34609
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34610
34540
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34611
34541
|
const projectInfo = {
|
|
34612
34542
|
rootDirectory: directory,
|
|
@@ -34620,11 +34550,7 @@ const discoverProject = (directory) => {
|
|
|
34620
34550
|
hasTypeScript,
|
|
34621
34551
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34622
34552
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34623
|
-
hasTanStackQuery:
|
|
34624
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34625
|
-
tanstackQueryVersion,
|
|
34626
|
-
mobxVersion: workspaceFacts.mobxVersion,
|
|
34627
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34553
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34628
34554
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34629
34555
|
preactVersion,
|
|
34630
34556
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37144,9 +37070,25 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37144
37070
|
".babelrc.json"
|
|
37145
37071
|
];
|
|
37146
37072
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37073
|
+
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37074
|
+
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37075
|
+
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37076
|
+
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37147
37077
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37148
37078
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37079
|
+
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37080
|
+
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37081
|
+
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37082
|
+
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37083
|
+
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37084
|
+
if (normalizedVersionRange === null) return false;
|
|
37085
|
+
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37086
|
+
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37087
|
+
};
|
|
37088
|
+
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37149
37089
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37090
|
+
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37091
|
+
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37150
37092
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37151
37093
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37152
37094
|
if (!isFile(filePath)) continue;
|
|
@@ -37156,7 +37098,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37156
37098
|
} catch {
|
|
37157
37099
|
continue;
|
|
37158
37100
|
}
|
|
37159
|
-
if (
|
|
37101
|
+
if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
|
|
37160
37102
|
filePath: fileName,
|
|
37161
37103
|
rule: "rn-no-metro-babel-preset",
|
|
37162
37104
|
severity: "error",
|
|
@@ -37179,12 +37121,6 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37179
37121
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37180
37122
|
};
|
|
37181
37123
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37182
|
-
const DEPENDENCY_SECTIONS = [
|
|
37183
|
-
"dependencies",
|
|
37184
|
-
"devDependencies",
|
|
37185
|
-
"peerDependencies",
|
|
37186
|
-
"optionalDependencies"
|
|
37187
|
-
];
|
|
37188
37124
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37189
37125
|
"19.0": {
|
|
37190
37126
|
rceFixedVersion: "19.0.1",
|
|
@@ -37231,20 +37167,13 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37231
37167
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37232
37168
|
return [...directories];
|
|
37233
37169
|
};
|
|
37234
|
-
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37235
|
-
for (const section of DEPENDENCY_SECTIONS) {
|
|
37236
|
-
const spec = packageJson[section]?.[packageName];
|
|
37237
|
-
if (typeof spec === "string") return spec;
|
|
37238
|
-
}
|
|
37239
|
-
return null;
|
|
37240
|
-
};
|
|
37241
37170
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37242
37171
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37243
37172
|
if (isFile(manifestPath)) {
|
|
37244
37173
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37245
37174
|
if (installedVersion !== null) return installedVersion;
|
|
37246
37175
|
}
|
|
37247
|
-
const candidateSpecs = [
|
|
37176
|
+
const candidateSpecs = [getDependencySpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37248
37177
|
for (const spec of candidateSpecs) {
|
|
37249
37178
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37250
37179
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -37912,7 +37841,6 @@ const buildCapabilities = (project) => {
|
|
|
37912
37841
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
37913
37842
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
37914
37843
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
37915
|
-
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
37916
37844
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
37917
37845
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
37918
37846
|
major: 19,
|
|
@@ -37927,14 +37855,7 @@ const buildCapabilities = (project) => {
|
|
|
37927
37855
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
37928
37856
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37929
37857
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37930
|
-
if (
|
|
37931
|
-
if (project.mobxVersion) capabilities.add("mobx");
|
|
37932
|
-
if (project.styledComponentsVersion) {
|
|
37933
|
-
capabilities.add("styled-components");
|
|
37934
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
37935
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
37936
|
-
}
|
|
37937
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
37858
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
37938
37859
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37939
37860
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37940
37861
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -40203,19 +40124,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40203
40124
|
}
|
|
40204
40125
|
};
|
|
40205
40126
|
};
|
|
40206
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
40207
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
40208
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
40209
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
40210
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
40211
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
40212
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
40213
|
-
fingerprint,
|
|
40214
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
40215
|
-
sizeBytes: fileStats.size
|
|
40216
|
-
});
|
|
40217
|
-
return fingerprint;
|
|
40218
|
-
};
|
|
40219
40127
|
const bundledRequire = createRequire(import.meta.url);
|
|
40220
40128
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40221
40129
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40239,13 +40147,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40239
40147
|
"oxlint-plugin-react-doctor/package.json",
|
|
40240
40148
|
"eslint-plugin-react-hooks/package.json"
|
|
40241
40149
|
];
|
|
40242
|
-
const resolvePluginFingerprint = () => {
|
|
40243
|
-
try {
|
|
40244
|
-
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40245
|
-
} catch {
|
|
40246
|
-
return "unresolved";
|
|
40247
|
-
}
|
|
40248
|
-
};
|
|
40249
40150
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40250
40151
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40251
40152
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40255,7 +40156,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40255
40156
|
} catch {
|
|
40256
40157
|
versions.push(`${specifier}=missing`);
|
|
40257
40158
|
}
|
|
40258
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40259
40159
|
return versions;
|
|
40260
40160
|
};
|
|
40261
40161
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -43939,4 +43839,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43939
43839
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43940
43840
|
|
|
43941
43841
|
//# sourceMappingURL=index.js.map
|
|
43942
|
-
//# debugId=
|
|
43842
|
+
//# debugId=ba0e3885-0c68-5322-b382-578d3d89d5c5
|
package/dist/lsp.js
CHANGED
|
@@ -33427,10 +33427,10 @@ const FALLBACK_TSCONFIG_FILENAMES = ["tsconfig.app.json", "tsconfig.build.json"]
|
|
|
33427
33427
|
const FRAMEWORK_PACKAGES = {
|
|
33428
33428
|
next: "nextjs",
|
|
33429
33429
|
"@tanstack/react-start": "tanstack-start",
|
|
33430
|
-
"@remix-run/react": "remix",
|
|
33431
|
-
gatsby: "gatsby",
|
|
33432
33430
|
vite: "vite",
|
|
33433
33431
|
"react-scripts": "cra",
|
|
33432
|
+
"@remix-run/react": "remix",
|
|
33433
|
+
gatsby: "gatsby",
|
|
33434
33434
|
expo: "expo",
|
|
33435
33435
|
"react-native": "react-native"
|
|
33436
33436
|
};
|
|
@@ -33957,6 +33957,19 @@ const getPreactVersion = (packageJson) => {
|
|
|
33957
33957
|
...packageJson.devDependencies
|
|
33958
33958
|
}.preact ?? null;
|
|
33959
33959
|
};
|
|
33960
|
+
const TANSTACK_QUERY_PACKAGES = new Set([
|
|
33961
|
+
"@tanstack/react-query",
|
|
33962
|
+
"@tanstack/query-core",
|
|
33963
|
+
"react-query"
|
|
33964
|
+
]);
|
|
33965
|
+
const hasTanStackQuery = (packageJson) => {
|
|
33966
|
+
const allDependencies = {
|
|
33967
|
+
...packageJson.peerDependencies,
|
|
33968
|
+
...packageJson.dependencies,
|
|
33969
|
+
...packageJson.devDependencies
|
|
33970
|
+
};
|
|
33971
|
+
return Object.keys(allDependencies).some((packageName) => TANSTACK_QUERY_PACKAGES.has(packageName));
|
|
33972
|
+
};
|
|
33960
33973
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33961
33974
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33962
33975
|
const catalogName = extractCatalogName(version);
|
|
@@ -34159,67 +34172,6 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34159
34172
|
}
|
|
34160
34173
|
return packages;
|
|
34161
34174
|
};
|
|
34162
|
-
const getPreferredDependencyVersion = ({ packageJson, packageNames }) => {
|
|
34163
|
-
const allDependencies = {
|
|
34164
|
-
...packageJson.devDependencies,
|
|
34165
|
-
...packageJson.peerDependencies,
|
|
34166
|
-
...packageJson.dependencies
|
|
34167
|
-
};
|
|
34168
|
-
for (const packageName of packageNames) {
|
|
34169
|
-
const version = allDependencies[packageName];
|
|
34170
|
-
if (version !== void 0) return version;
|
|
34171
|
-
}
|
|
34172
|
-
return null;
|
|
34173
|
-
};
|
|
34174
|
-
const TANSTACK_REACT_QUERY_PACKAGES = ["@tanstack/react-query", "react-query"];
|
|
34175
|
-
const getTanStackQueryVersion = (packageJson) => {
|
|
34176
|
-
return getPreferredDependencyVersion({
|
|
34177
|
-
packageJson,
|
|
34178
|
-
packageNames: TANSTACK_REACT_QUERY_PACKAGES
|
|
34179
|
-
});
|
|
34180
|
-
};
|
|
34181
|
-
const MOBX_PACKAGES = [
|
|
34182
|
-
"mobx",
|
|
34183
|
-
"mobx-react",
|
|
34184
|
-
"mobx-react-lite",
|
|
34185
|
-
"mobx-state-tree"
|
|
34186
|
-
];
|
|
34187
|
-
const getMobxVersion = (packageJson) => {
|
|
34188
|
-
return getPreferredDependencyVersion({
|
|
34189
|
-
packageJson,
|
|
34190
|
-
packageNames: MOBX_PACKAGES
|
|
34191
|
-
});
|
|
34192
|
-
};
|
|
34193
|
-
const STYLED_COMPONENTS_PACKAGES = ["styled-components"];
|
|
34194
|
-
const getStyledComponentsVersion = (packageJson) => {
|
|
34195
|
-
return getPreferredDependencyVersion({
|
|
34196
|
-
packageJson,
|
|
34197
|
-
packageNames: STYLED_COMPONENTS_PACKAGES
|
|
34198
|
-
});
|
|
34199
|
-
};
|
|
34200
|
-
const I18N_PACKAGES = [
|
|
34201
|
-
"i18next",
|
|
34202
|
-
"react-i18next",
|
|
34203
|
-
"next-i18next",
|
|
34204
|
-
"react-intl",
|
|
34205
|
-
"next-intl",
|
|
34206
|
-
"use-intl",
|
|
34207
|
-
"@formatjs/intl",
|
|
34208
|
-
"@lingui/core",
|
|
34209
|
-
"@lingui/react",
|
|
34210
|
-
"typesafe-i18n",
|
|
34211
|
-
"@tolgee/react",
|
|
34212
|
-
"react-intl-universal"
|
|
34213
|
-
];
|
|
34214
|
-
const hasI18nDependency = (packageJson) => {
|
|
34215
|
-
const allDependencies = {
|
|
34216
|
-
...packageJson.peerDependencies,
|
|
34217
|
-
...packageJson.dependencies,
|
|
34218
|
-
...packageJson.devDependencies,
|
|
34219
|
-
...packageJson.optionalDependencies
|
|
34220
|
-
};
|
|
34221
|
-
return I18N_PACKAGES.some((packageName) => allDependencies[packageName] !== void 0);
|
|
34222
|
-
};
|
|
34223
34175
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34224
34176
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34225
34177
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
@@ -34239,14 +34191,6 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34239
34191
|
if (nextMajor === null) return false;
|
|
34240
34192
|
return nextMajor < currentMajor;
|
|
34241
34193
|
};
|
|
34242
|
-
const shouldReplaceStyledComponentsVersion = (currentVersion, nextVersion) => {
|
|
34243
|
-
if (!currentVersion) return true;
|
|
34244
|
-
const currentMajor = getLowestDependencyMajor(currentVersion);
|
|
34245
|
-
const nextMajor = getLowestDependencyMajor(nextVersion);
|
|
34246
|
-
if (currentMajor === null) return false;
|
|
34247
|
-
if (nextMajor === null) return true;
|
|
34248
|
-
return nextMajor < currentMajor;
|
|
34249
|
-
};
|
|
34250
34194
|
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34251
34195
|
if (facts.expo.version === null) {
|
|
34252
34196
|
const spec = getDependencySpec(packageJson, "expo");
|
|
@@ -34273,11 +34217,6 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34273
34217
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34274
34218
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34275
34219
|
}
|
|
34276
|
-
facts.tanstackQueryVersion ??= getTanStackQueryVersion(packageJson);
|
|
34277
|
-
facts.mobxVersion ??= getMobxVersion(packageJson);
|
|
34278
|
-
const styledComponentsVersion = getStyledComponentsVersion(packageJson);
|
|
34279
|
-
if (styledComponentsVersion && shouldReplaceStyledComponentsVersion(facts.styledComponentsVersion, styledComponentsVersion)) facts.styledComponentsVersion = styledComponentsVersion;
|
|
34280
|
-
facts.hasI18nLibrary = facts.hasI18nLibrary || hasI18nDependency(packageJson);
|
|
34281
34220
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34282
34221
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34283
34222
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -34300,10 +34239,6 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34300
34239
|
version: null,
|
|
34301
34240
|
sourceDirectory: null
|
|
34302
34241
|
},
|
|
34303
|
-
tanstackQueryVersion: null,
|
|
34304
|
-
mobxVersion: null,
|
|
34305
|
-
styledComponentsVersion: null,
|
|
34306
|
-
hasI18nLibrary: false,
|
|
34307
34242
|
hasReactNativeAwarePackage: false,
|
|
34308
34243
|
hasReanimatedAwarePackage: false,
|
|
34309
34244
|
hasSsrDependency: false,
|
|
@@ -34547,10 +34482,6 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34547
34482
|
hasReactCompiler: false,
|
|
34548
34483
|
hasReactCompilerLintPlugin: false,
|
|
34549
34484
|
hasTanStackQuery: false,
|
|
34550
|
-
hasI18nLibrary: false,
|
|
34551
|
-
tanstackQueryVersion: null,
|
|
34552
|
-
mobxVersion: null,
|
|
34553
|
-
styledComponentsVersion: null,
|
|
34554
34485
|
hasSsrDependency: false,
|
|
34555
34486
|
preactVersion: null,
|
|
34556
34487
|
preactMajorVersion: null,
|
|
@@ -34658,7 +34589,6 @@ const discoverProject = (directory) => {
|
|
|
34658
34589
|
version: workspaceFacts.next.version
|
|
34659
34590
|
}) : null;
|
|
34660
34591
|
const preactVersion = getPreactVersion(packageJson);
|
|
34661
|
-
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34662
34592
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34663
34593
|
const projectInfo = {
|
|
34664
34594
|
rootDirectory: directory,
|
|
@@ -34672,11 +34602,7 @@ const discoverProject = (directory) => {
|
|
|
34672
34602
|
hasTypeScript,
|
|
34673
34603
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34674
34604
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34675
|
-
hasTanStackQuery:
|
|
34676
|
-
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34677
|
-
tanstackQueryVersion,
|
|
34678
|
-
mobxVersion: workspaceFacts.mobxVersion,
|
|
34679
|
-
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34605
|
+
hasTanStackQuery: hasTanStackQuery(packageJson),
|
|
34680
34606
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34681
34607
|
preactVersion,
|
|
34682
34608
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37122,9 +37048,25 @@ const BABEL_CONFIG_FILE_NAMES = [
|
|
|
37122
37048
|
".babelrc.json"
|
|
37123
37049
|
];
|
|
37124
37050
|
const LEGACY_PRESET_SPEC = "module:metro-react-native-babel-preset";
|
|
37051
|
+
const LEGACY_PRESET_PACKAGE = "metro-react-native-babel-preset";
|
|
37052
|
+
const REACT_NATIVE_PACKAGE = "react-native";
|
|
37053
|
+
const PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION = "0.73.0";
|
|
37054
|
+
const LEGACY_PRESET_REFERENCE = new RegExp(`['"]${LEGACY_PRESET_SPEC}['"]`);
|
|
37125
37055
|
const MODERN_PRESET_REFERENCE = new RegExp(`['"]module:@react-native/babel-preset['"]`);
|
|
37126
37056
|
const ENABLE_BABEL_RUNTIME_VERSION = /enableBabelRuntime["']?\s*:\s*['"]/;
|
|
37057
|
+
const isReactNativeVersionAtLeastPresetRename = (rootDirectory, packageJson) => {
|
|
37058
|
+
const installedReactNativeManifestPath = Path.join(rootDirectory, "node_modules", REACT_NATIVE_PACKAGE, "package.json");
|
|
37059
|
+
const reactNativeVersionSpec = (isFile(installedReactNativeManifestPath) ? readPackageJson(installedReactNativeManifestPath).version : void 0) ?? getDependencySpec(packageJson, REACT_NATIVE_PACKAGE);
|
|
37060
|
+
if (reactNativeVersionSpec === null || reactNativeVersionSpec === void 0) return false;
|
|
37061
|
+
const normalizedVersionRange = import_semver.validRange(reactNativeVersionSpec);
|
|
37062
|
+
if (normalizedVersionRange === null) return false;
|
|
37063
|
+
const minimumVersion = import_semver.minVersion(normalizedVersionRange);
|
|
37064
|
+
return minimumVersion !== null && import_semver.gte(minimumVersion, PRESET_RENAME_MINIMUM_REACT_NATIVE_VERSION);
|
|
37065
|
+
};
|
|
37066
|
+
const canResolveLegacyPreset = (rootDirectory, packageJson) => getDependencySpec(packageJson, LEGACY_PRESET_PACKAGE) !== null || isFile(Path.join(rootDirectory, "node_modules", LEGACY_PRESET_PACKAGE, "package.json"));
|
|
37127
37067
|
const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
37068
|
+
const packageJson = readPackageJson(Path.join(rootDirectory, "package.json"));
|
|
37069
|
+
const shouldReportLegacyPreset = isReactNativeVersionAtLeastPresetRename(rootDirectory, packageJson) && !canResolveLegacyPreset(rootDirectory, packageJson);
|
|
37128
37070
|
for (const fileName of BABEL_CONFIG_FILE_NAMES) {
|
|
37129
37071
|
const filePath = Path.join(rootDirectory, fileName);
|
|
37130
37072
|
if (!isFile(filePath)) continue;
|
|
@@ -37134,7 +37076,7 @@ const checkReactNativeMetroBabelPreset = (rootDirectory) => {
|
|
|
37134
37076
|
} catch {
|
|
37135
37077
|
continue;
|
|
37136
37078
|
}
|
|
37137
|
-
if (
|
|
37079
|
+
if (shouldReportLegacyPreset && LEGACY_PRESET_REFERENCE.test(contents)) return [buildReactNativeDiagnostic({
|
|
37138
37080
|
filePath: fileName,
|
|
37139
37081
|
rule: "rn-no-metro-babel-preset",
|
|
37140
37082
|
severity: "error",
|
|
@@ -37157,12 +37099,6 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
37157
37099
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
37158
37100
|
};
|
|
37159
37101
|
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
37160
|
-
const DEPENDENCY_SECTIONS = [
|
|
37161
|
-
"dependencies",
|
|
37162
|
-
"devDependencies",
|
|
37163
|
-
"peerDependencies",
|
|
37164
|
-
"optionalDependencies"
|
|
37165
|
-
];
|
|
37166
37102
|
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
37167
37103
|
"19.0": {
|
|
37168
37104
|
rceFixedVersion: "19.0.1",
|
|
@@ -37209,20 +37145,13 @@ const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
|
37209
37145
|
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
37210
37146
|
return [...directories];
|
|
37211
37147
|
};
|
|
37212
|
-
const readDeclaredSpec = (packageJson, packageName) => {
|
|
37213
|
-
for (const section of DEPENDENCY_SECTIONS) {
|
|
37214
|
-
const spec = packageJson[section]?.[packageName];
|
|
37215
|
-
if (typeof spec === "string") return spec;
|
|
37216
|
-
}
|
|
37217
|
-
return null;
|
|
37218
|
-
};
|
|
37219
37148
|
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
37220
37149
|
const manifestPath = Path.join(directory, "node_modules", packageName, "package.json");
|
|
37221
37150
|
if (isFile(manifestPath)) {
|
|
37222
37151
|
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
37223
37152
|
if (installedVersion !== null) return installedVersion;
|
|
37224
37153
|
}
|
|
37225
|
-
const candidateSpecs = [
|
|
37154
|
+
const candidateSpecs = [getDependencySpec(readPackageJson(Path.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
37226
37155
|
for (const spec of candidateSpecs) {
|
|
37227
37156
|
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
37228
37157
|
if (pinnedVersion !== null) return pinnedVersion;
|
|
@@ -37890,7 +37819,6 @@ const buildCapabilities = (project) => {
|
|
|
37890
37819
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
37891
37820
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
37892
37821
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
37893
|
-
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
37894
37822
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
37895
37823
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
37896
37824
|
major: 19,
|
|
@@ -37905,14 +37833,7 @@ const buildCapabilities = (project) => {
|
|
|
37905
37833
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
37906
37834
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37907
37835
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37908
|
-
if (
|
|
37909
|
-
if (project.mobxVersion) capabilities.add("mobx");
|
|
37910
|
-
if (project.styledComponentsVersion) {
|
|
37911
|
-
capabilities.add("styled-components");
|
|
37912
|
-
const styledComponentsMajor = getLowestDependencyMajor(project.styledComponentsVersion);
|
|
37913
|
-
if (styledComponentsMajor !== null && styledComponentsMajor >= 6) capabilities.add("styled-components:6");
|
|
37914
|
-
}
|
|
37915
|
-
if (project.hasI18nLibrary) capabilities.add("i18n");
|
|
37836
|
+
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
37916
37837
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37917
37838
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37918
37839
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -40181,19 +40102,6 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40181
40102
|
}
|
|
40182
40103
|
};
|
|
40183
40104
|
};
|
|
40184
|
-
const fingerprintCacheByFilePath = /* @__PURE__ */ new Map();
|
|
40185
|
-
const fingerprintFileContents = (filePath, fingerprintLength) => {
|
|
40186
|
-
const fileStats = NFS.statSync(filePath, { bigint: true });
|
|
40187
|
-
const cachedFingerprint = fingerprintCacheByFilePath.get(filePath);
|
|
40188
|
-
if (cachedFingerprint?.modifiedTimeNanoseconds === fileStats.mtimeNs && cachedFingerprint.sizeBytes === fileStats.size) return cachedFingerprint.fingerprint;
|
|
40189
|
-
const fingerprint = crypto.createHash("sha256").update(NFS.readFileSync(filePath)).digest("hex").slice(0, fingerprintLength);
|
|
40190
|
-
fingerprintCacheByFilePath.set(filePath, {
|
|
40191
|
-
fingerprint,
|
|
40192
|
-
modifiedTimeNanoseconds: fileStats.mtimeNs,
|
|
40193
|
-
sizeBytes: fileStats.size
|
|
40194
|
-
});
|
|
40195
|
-
return fingerprint;
|
|
40196
|
-
};
|
|
40197
40105
|
const bundledRequire = createRequire(import.meta.url);
|
|
40198
40106
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40199
40107
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40217,13 +40125,6 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40217
40125
|
"oxlint-plugin-react-doctor/package.json",
|
|
40218
40126
|
"eslint-plugin-react-hooks/package.json"
|
|
40219
40127
|
];
|
|
40220
|
-
const resolvePluginFingerprint = () => {
|
|
40221
|
-
try {
|
|
40222
|
-
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40223
|
-
} catch {
|
|
40224
|
-
return "unresolved";
|
|
40225
|
-
}
|
|
40226
|
-
};
|
|
40227
40128
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40228
40129
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40229
40130
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40233,7 +40134,6 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40233
40134
|
} catch {
|
|
40234
40135
|
versions.push(`${specifier}=missing`);
|
|
40235
40136
|
}
|
|
40236
|
-
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40237
40137
|
return versions;
|
|
40238
40138
|
};
|
|
40239
40139
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -45559,5 +45459,5 @@ const startLanguageServer = () => {
|
|
|
45559
45459
|
};
|
|
45560
45460
|
//#endregion
|
|
45561
45461
|
export { startLanguageServer };
|
|
45562
|
-
!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]="
|
|
45563
|
-
//# debugId=
|
|
45462
|
+
!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]="4cc86e5a-4a16-5fc0-a4e8-998852b4f219")}catch(e){}}();
|
|
45463
|
+
//# debugId=4cc86e5a-4a16-5fc0-a4e8-998852b4f219
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.8.1-dev.
|
|
3
|
+
"version": "0.8.1-dev.3598138",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
67
|
"yaml": "^2.9.0",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
68
|
+
"deslop-js": "0.8.1",
|
|
69
|
+
"oxlint-plugin-react-doctor": "0.8.1-dev.3598138"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"@xterm/headless": "^6.0.0",
|
|
75
75
|
"commander": "^14.0.3",
|
|
76
76
|
"ora": "^9.4.0",
|
|
77
|
-
"@react-doctor/api": "0.8.1",
|
|
78
77
|
"@react-doctor/core": "0.8.1",
|
|
78
|
+
"@react-doctor/api": "0.8.1",
|
|
79
79
|
"@react-doctor/language-server": "0.8.1"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|