react-doctor 0.8.1-dev.26b4a0c → 0.8.1-dev.3018538
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 +128 -24
- package/dist/index.d.ts +4 -0
- package/dist/index.js +122 -20
- package/dist/lsp.js +122 -20
- package/package.json +5 -5
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]="263a3384-e99c-5526-89f9-c7e1a6bd4e76")}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
|
-
vite: "vite",
|
|
36575
|
-
"react-scripts": "cra",
|
|
36576
36574
|
"@remix-run/react": "remix",
|
|
36577
36575
|
gatsby: "gatsby",
|
|
36576
|
+
vite: "vite",
|
|
36577
|
+
"react-scripts": "cra",
|
|
36578
36578
|
expo: "expo",
|
|
36579
36579
|
"react-native": "react-native"
|
|
36580
36580
|
};
|
|
@@ -37101,19 +37101,6 @@ 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
|
-
};
|
|
37117
37104
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
37118
37105
|
if (version === null || !isCatalogReference(version)) return version;
|
|
37119
37106
|
const catalogName = extractCatalogName(version);
|
|
@@ -37316,6 +37303,67 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
37316
37303
|
}
|
|
37317
37304
|
return packages;
|
|
37318
37305
|
};
|
|
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
|
+
};
|
|
37319
37367
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
37320
37368
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
37321
37369
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
@@ -37335,6 +37383,14 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
37335
37383
|
if (nextMajor === null) return false;
|
|
37336
37384
|
return nextMajor < currentMajor;
|
|
37337
37385
|
};
|
|
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
|
+
};
|
|
37338
37394
|
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
37339
37395
|
if (facts.expo.version === null) {
|
|
37340
37396
|
const spec = getDependencySpec(packageJson, "expo");
|
|
@@ -37361,6 +37417,11 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
37361
37417
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
37362
37418
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
37363
37419
|
}
|
|
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);
|
|
37364
37425
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
37365
37426
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
37366
37427
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -37383,6 +37444,10 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
37383
37444
|
version: null,
|
|
37384
37445
|
sourceDirectory: null
|
|
37385
37446
|
},
|
|
37447
|
+
tanstackQueryVersion: null,
|
|
37448
|
+
mobxVersion: null,
|
|
37449
|
+
styledComponentsVersion: null,
|
|
37450
|
+
hasI18nLibrary: false,
|
|
37386
37451
|
hasReactNativeAwarePackage: false,
|
|
37387
37452
|
hasReanimatedAwarePackage: false,
|
|
37388
37453
|
hasSsrDependency: false,
|
|
@@ -37623,6 +37688,10 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
37623
37688
|
hasReactCompiler: false,
|
|
37624
37689
|
hasReactCompilerLintPlugin: false,
|
|
37625
37690
|
hasTanStackQuery: false,
|
|
37691
|
+
hasI18nLibrary: false,
|
|
37692
|
+
tanstackQueryVersion: null,
|
|
37693
|
+
mobxVersion: null,
|
|
37694
|
+
styledComponentsVersion: null,
|
|
37626
37695
|
hasSsrDependency: false,
|
|
37627
37696
|
preactVersion: null,
|
|
37628
37697
|
preactMajorVersion: null,
|
|
@@ -37730,6 +37799,7 @@ const discoverProject = (directory) => {
|
|
|
37730
37799
|
version: workspaceFacts.next.version
|
|
37731
37800
|
}) : null;
|
|
37732
37801
|
const preactVersion = getPreactVersion(packageJson);
|
|
37802
|
+
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
37733
37803
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
37734
37804
|
const projectInfo = {
|
|
37735
37805
|
rootDirectory: directory,
|
|
@@ -37743,7 +37813,11 @@ const discoverProject = (directory) => {
|
|
|
37743
37813
|
hasTypeScript,
|
|
37744
37814
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
37745
37815
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
37746
|
-
hasTanStackQuery:
|
|
37816
|
+
hasTanStackQuery: tanstackQueryVersion !== null,
|
|
37817
|
+
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
37818
|
+
tanstackQueryVersion,
|
|
37819
|
+
mobxVersion: workspaceFacts.mobxVersion,
|
|
37820
|
+
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
37747
37821
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
37748
37822
|
preactVersion,
|
|
37749
37823
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -37977,7 +38051,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
37977
38051
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
37978
38052
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
37979
38053
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
37980
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
37981
38054
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
37982
38055
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
37983
38056
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -41067,6 +41140,7 @@ const buildCapabilities = (project) => {
|
|
|
41067
41140
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
41068
41141
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
41069
41142
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
41143
|
+
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
41070
41144
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
41071
41145
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
41072
41146
|
major: 19,
|
|
@@ -41081,7 +41155,14 @@ const buildCapabilities = (project) => {
|
|
|
41081
41155
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
41082
41156
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
41083
41157
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
41084
|
-
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
41158
|
+
if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
|
|
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");
|
|
41085
41166
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
41086
41167
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
41087
41168
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -43366,6 +43447,19 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
43366
43447
|
}
|
|
43367
43448
|
};
|
|
43368
43449
|
};
|
|
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
|
+
};
|
|
43369
43463
|
const bundledRequire$3 = createRequire(import.meta.url);
|
|
43370
43464
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
43371
43465
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -43389,6 +43483,13 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS$1 = [
|
|
|
43389
43483
|
"oxlint-plugin-react-doctor/package.json",
|
|
43390
43484
|
"eslint-plugin-react-hooks/package.json"
|
|
43391
43485
|
];
|
|
43486
|
+
const resolvePluginFingerprint = () => {
|
|
43487
|
+
try {
|
|
43488
|
+
return fingerprintFileContents(bundledRequire$3.resolve("oxlint-plugin-react-doctor"), 16);
|
|
43489
|
+
} catch {
|
|
43490
|
+
return "unresolved";
|
|
43491
|
+
}
|
|
43492
|
+
};
|
|
43392
43493
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
43393
43494
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
43394
43495
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS$1) try {
|
|
@@ -43398,6 +43499,7 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
43398
43499
|
} catch {
|
|
43399
43500
|
versions.push(`${specifier}=missing`);
|
|
43400
43501
|
}
|
|
43502
|
+
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
43401
43503
|
return versions;
|
|
43402
43504
|
};
|
|
43403
43505
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -47365,7 +47467,7 @@ const makeNoopConsole = () => ({
|
|
|
47365
47467
|
});
|
|
47366
47468
|
//#endregion
|
|
47367
47469
|
//#region src/cli/utils/version.ts
|
|
47368
|
-
const VERSION = "0.8.1-dev.
|
|
47470
|
+
const VERSION = "0.8.1-dev.3018538";
|
|
47369
47471
|
//#endregion
|
|
47370
47472
|
//#region src/cli/utils/json-mode.ts
|
|
47371
47473
|
let context = null;
|
|
@@ -47536,7 +47638,9 @@ const buildSentryProjectContext = (projectInfo) => ({
|
|
|
47536
47638
|
reactMajorVersion: projectInfo.reactMajorVersion,
|
|
47537
47639
|
hasTypeScript: projectInfo.hasTypeScript,
|
|
47538
47640
|
hasReactCompiler: projectInfo.hasReactCompiler,
|
|
47539
|
-
|
|
47641
|
+
tanstackQueryVersion: projectInfo.tanstackQueryVersion,
|
|
47642
|
+
mobxVersion: projectInfo.mobxVersion,
|
|
47643
|
+
styledComponentsVersion: projectInfo.styledComponentsVersion,
|
|
47540
47644
|
tailwindVersion: projectInfo.tailwindVersion,
|
|
47541
47645
|
zodVersion: projectInfo.zodVersion,
|
|
47542
47646
|
preactVersion: projectInfo.preactVersion,
|
|
@@ -47717,13 +47821,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
47717
47821
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
47718
47822
|
* standard `SENTRY_RELEASE` override.
|
|
47719
47823
|
*/
|
|
47720
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.
|
|
47824
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.8.1-dev.3018538`;
|
|
47721
47825
|
/**
|
|
47722
47826
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
47723
47827
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
47724
47828
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
47725
47829
|
*/
|
|
47726
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.
|
|
47830
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.8.1-dev.3018538") ? "development" : "production");
|
|
47727
47831
|
/**
|
|
47728
47832
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
47729
47833
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -66403,4 +66507,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
66403
66507
|
export {};
|
|
66404
66508
|
|
|
66405
66509
|
//# sourceMappingURL=cli.js.map
|
|
66406
|
-
//# debugId=
|
|
66510
|
+
//# debugId=263a3384-e99c-5526-89f9-c7e1a6bd4e76
|
package/dist/index.d.ts
CHANGED
|
@@ -9548,6 +9548,10 @@ 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;
|
|
9551
9555
|
/**
|
|
9552
9556
|
* `true` when the project or a workspace declares a Vite-based SSR runtime
|
|
9553
9557
|
* 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]="d6253eef-925f-579a-9b36-3bbf313293f5")}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
|
-
vite: "vite",
|
|
33379
|
-
"react-scripts": "cra",
|
|
33380
33378
|
"@remix-run/react": "remix",
|
|
33381
33379
|
gatsby: "gatsby",
|
|
33380
|
+
vite: "vite",
|
|
33381
|
+
"react-scripts": "cra",
|
|
33382
33382
|
expo: "expo",
|
|
33383
33383
|
"react-native": "react-native"
|
|
33384
33384
|
};
|
|
@@ -33905,19 +33905,6 @@ 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
|
-
};
|
|
33921
33908
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33922
33909
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33923
33910
|
const catalogName = extractCatalogName(version);
|
|
@@ -34120,6 +34107,67 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34120
34107
|
}
|
|
34121
34108
|
return packages;
|
|
34122
34109
|
};
|
|
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
|
+
};
|
|
34123
34171
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34124
34172
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34125
34173
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
@@ -34139,6 +34187,14 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34139
34187
|
if (nextMajor === null) return false;
|
|
34140
34188
|
return nextMajor < currentMajor;
|
|
34141
34189
|
};
|
|
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
|
+
};
|
|
34142
34198
|
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34143
34199
|
if (facts.expo.version === null) {
|
|
34144
34200
|
const spec = getDependencySpec(packageJson, "expo");
|
|
@@ -34165,6 +34221,11 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34165
34221
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34166
34222
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34167
34223
|
}
|
|
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);
|
|
34168
34229
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34169
34230
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34170
34231
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -34187,6 +34248,10 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34187
34248
|
version: null,
|
|
34188
34249
|
sourceDirectory: null
|
|
34189
34250
|
},
|
|
34251
|
+
tanstackQueryVersion: null,
|
|
34252
|
+
mobxVersion: null,
|
|
34253
|
+
styledComponentsVersion: null,
|
|
34254
|
+
hasI18nLibrary: false,
|
|
34190
34255
|
hasReactNativeAwarePackage: false,
|
|
34191
34256
|
hasReanimatedAwarePackage: false,
|
|
34192
34257
|
hasSsrDependency: false,
|
|
@@ -34430,6 +34495,10 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34430
34495
|
hasReactCompiler: false,
|
|
34431
34496
|
hasReactCompilerLintPlugin: false,
|
|
34432
34497
|
hasTanStackQuery: false,
|
|
34498
|
+
hasI18nLibrary: false,
|
|
34499
|
+
tanstackQueryVersion: null,
|
|
34500
|
+
mobxVersion: null,
|
|
34501
|
+
styledComponentsVersion: null,
|
|
34433
34502
|
hasSsrDependency: false,
|
|
34434
34503
|
preactVersion: null,
|
|
34435
34504
|
preactMajorVersion: null,
|
|
@@ -34537,6 +34606,7 @@ const discoverProject = (directory) => {
|
|
|
34537
34606
|
version: workspaceFacts.next.version
|
|
34538
34607
|
}) : null;
|
|
34539
34608
|
const preactVersion = getPreactVersion(packageJson);
|
|
34609
|
+
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34540
34610
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34541
34611
|
const projectInfo = {
|
|
34542
34612
|
rootDirectory: directory,
|
|
@@ -34550,7 +34620,11 @@ const discoverProject = (directory) => {
|
|
|
34550
34620
|
hasTypeScript,
|
|
34551
34621
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34552
34622
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34553
|
-
hasTanStackQuery:
|
|
34623
|
+
hasTanStackQuery: tanstackQueryVersion !== null,
|
|
34624
|
+
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34625
|
+
tanstackQueryVersion,
|
|
34626
|
+
mobxVersion: workspaceFacts.mobxVersion,
|
|
34627
|
+
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34554
34628
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34555
34629
|
preactVersion,
|
|
34556
34630
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -34784,7 +34858,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
34784
34858
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
34785
34859
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
34786
34860
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34787
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
34788
34861
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
34789
34862
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
34790
34863
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -37839,6 +37912,7 @@ const buildCapabilities = (project) => {
|
|
|
37839
37912
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
37840
37913
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
37841
37914
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
37915
|
+
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
37842
37916
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
37843
37917
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
37844
37918
|
major: 19,
|
|
@@ -37853,7 +37927,14 @@ const buildCapabilities = (project) => {
|
|
|
37853
37927
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
37854
37928
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37855
37929
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37856
|
-
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
37930
|
+
if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
|
|
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");
|
|
37857
37938
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37858
37939
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37859
37940
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -40122,6 +40203,19 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40122
40203
|
}
|
|
40123
40204
|
};
|
|
40124
40205
|
};
|
|
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
|
+
};
|
|
40125
40219
|
const bundledRequire = createRequire(import.meta.url);
|
|
40126
40220
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40127
40221
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40145,6 +40239,13 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40145
40239
|
"oxlint-plugin-react-doctor/package.json",
|
|
40146
40240
|
"eslint-plugin-react-hooks/package.json"
|
|
40147
40241
|
];
|
|
40242
|
+
const resolvePluginFingerprint = () => {
|
|
40243
|
+
try {
|
|
40244
|
+
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40245
|
+
} catch {
|
|
40246
|
+
return "unresolved";
|
|
40247
|
+
}
|
|
40248
|
+
};
|
|
40148
40249
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40149
40250
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40150
40251
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40154,6 +40255,7 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40154
40255
|
} catch {
|
|
40155
40256
|
versions.push(`${specifier}=missing`);
|
|
40156
40257
|
}
|
|
40258
|
+
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40157
40259
|
return versions;
|
|
40158
40260
|
};
|
|
40159
40261
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -43837,4 +43939,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
43837
43939
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
43838
43940
|
|
|
43839
43941
|
//# sourceMappingURL=index.js.map
|
|
43840
|
-
//# debugId=
|
|
43942
|
+
//# debugId=d6253eef-925f-579a-9b36-3bbf313293f5
|
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
|
-
vite: "vite",
|
|
33431
|
-
"react-scripts": "cra",
|
|
33432
33430
|
"@remix-run/react": "remix",
|
|
33433
33431
|
gatsby: "gatsby",
|
|
33432
|
+
vite: "vite",
|
|
33433
|
+
"react-scripts": "cra",
|
|
33434
33434
|
expo: "expo",
|
|
33435
33435
|
"react-native": "react-native"
|
|
33436
33436
|
};
|
|
@@ -33957,19 +33957,6 @@ 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
|
-
};
|
|
33973
33960
|
const resolveCatalogBackedDependencyVersion = ({ rootDirectory, rootPackageJson, packageName, version }) => {
|
|
33974
33961
|
if (version === null || !isCatalogReference(version)) return version;
|
|
33975
33962
|
const catalogName = extractCatalogName(version);
|
|
@@ -34172,6 +34159,67 @@ const listWorkspacePackages = (rootDirectory) => {
|
|
|
34172
34159
|
}
|
|
34173
34160
|
return packages;
|
|
34174
34161
|
};
|
|
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
|
+
};
|
|
34175
34223
|
const REANIMATED_DEPENDENCY_NAME = "react-native-reanimated";
|
|
34176
34224
|
const SHOPIFY_FLASH_LIST_PACKAGE_NAME = "@shopify/flash-list";
|
|
34177
34225
|
const resolveWorkspaceDependencyVersion = ({ concreteVersion, packageName, rootDirectory, rootPackageJson, sections, workspaceDirectory, workspacePackageJson }) => {
|
|
@@ -34191,6 +34239,14 @@ const shouldReplaceReactVersion = (currentVersion, nextVersion) => {
|
|
|
34191
34239
|
if (nextMajor === null) return false;
|
|
34192
34240
|
return nextMajor < currentMajor;
|
|
34193
34241
|
};
|
|
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
|
+
};
|
|
34194
34250
|
const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
34195
34251
|
if (facts.expo.version === null) {
|
|
34196
34252
|
const spec = getDependencySpec(packageJson, "expo");
|
|
@@ -34217,6 +34273,11 @@ const evaluateManifestFacts = (facts, packageJson, directory) => {
|
|
|
34217
34273
|
const spec = getDependencySpec(packageJson, REANIMATED_DEPENDENCY_NAME);
|
|
34218
34274
|
if (spec !== null) facts.reanimatedVersion = spec;
|
|
34219
34275
|
}
|
|
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);
|
|
34220
34281
|
facts.hasReactNativeAwarePackage = facts.hasReactNativeAwarePackage || isPackageJsonReactNativeAware(packageJson);
|
|
34221
34282
|
facts.hasReanimatedAwarePackage = facts.hasReanimatedAwarePackage || isPackageJsonReanimatedAware(packageJson);
|
|
34222
34283
|
facts.hasSsrDependency = facts.hasSsrDependency || isPackageJsonSsrAware(packageJson);
|
|
@@ -34239,6 +34300,10 @@ const collectWorkspaceFacts = (rootDirectory, rootPackageJson, { collectReactGro
|
|
|
34239
34300
|
version: null,
|
|
34240
34301
|
sourceDirectory: null
|
|
34241
34302
|
},
|
|
34303
|
+
tanstackQueryVersion: null,
|
|
34304
|
+
mobxVersion: null,
|
|
34305
|
+
styledComponentsVersion: null,
|
|
34306
|
+
hasI18nLibrary: false,
|
|
34242
34307
|
hasReactNativeAwarePackage: false,
|
|
34243
34308
|
hasReanimatedAwarePackage: false,
|
|
34244
34309
|
hasSsrDependency: false,
|
|
@@ -34482,6 +34547,10 @@ const discoverProjectWithoutPackageJson = (directory) => {
|
|
|
34482
34547
|
hasReactCompiler: false,
|
|
34483
34548
|
hasReactCompilerLintPlugin: false,
|
|
34484
34549
|
hasTanStackQuery: false,
|
|
34550
|
+
hasI18nLibrary: false,
|
|
34551
|
+
tanstackQueryVersion: null,
|
|
34552
|
+
mobxVersion: null,
|
|
34553
|
+
styledComponentsVersion: null,
|
|
34485
34554
|
hasSsrDependency: false,
|
|
34486
34555
|
preactVersion: null,
|
|
34487
34556
|
preactMajorVersion: null,
|
|
@@ -34589,6 +34658,7 @@ const discoverProject = (directory) => {
|
|
|
34589
34658
|
version: workspaceFacts.next.version
|
|
34590
34659
|
}) : null;
|
|
34591
34660
|
const preactVersion = getPreactVersion(packageJson);
|
|
34661
|
+
const tanstackQueryVersion = getTanStackQueryVersion(packageJson) ?? workspaceFacts.tanstackQueryVersion;
|
|
34592
34662
|
const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
|
|
34593
34663
|
const projectInfo = {
|
|
34594
34664
|
rootDirectory: directory,
|
|
@@ -34602,7 +34672,11 @@ const discoverProject = (directory) => {
|
|
|
34602
34672
|
hasTypeScript,
|
|
34603
34673
|
hasReactCompiler: detectReactCompiler(directory, packageJson),
|
|
34604
34674
|
hasReactCompilerLintPlugin: detectReactCompilerLintPlugin(directory, packageJson),
|
|
34605
|
-
hasTanStackQuery:
|
|
34675
|
+
hasTanStackQuery: tanstackQueryVersion !== null,
|
|
34676
|
+
hasI18nLibrary: workspaceFacts.hasI18nLibrary,
|
|
34677
|
+
tanstackQueryVersion,
|
|
34678
|
+
mobxVersion: workspaceFacts.mobxVersion,
|
|
34679
|
+
styledComponentsVersion: workspaceFacts.styledComponentsVersion,
|
|
34606
34680
|
hasSsrDependency: workspaceFacts.hasSsrDependency,
|
|
34607
34681
|
preactVersion,
|
|
34608
34682
|
preactMajorVersion: parseReactMajor(preactVersion),
|
|
@@ -34836,7 +34910,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
|
|
|
34836
34910
|
"react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
|
|
34837
34911
|
"react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
|
|
34838
34912
|
"react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
|
|
34839
|
-
"react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
|
|
34840
34913
|
"react/jsx-no-undef": "react-doctor/jsx-no-undef",
|
|
34841
34914
|
"react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
|
|
34842
34915
|
"react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
|
|
@@ -37817,6 +37890,7 @@ const buildCapabilities = (project) => {
|
|
|
37817
37890
|
if (CLIENT_ONLY_FRAMEWORKS.has(project.framework)) capabilities.add("client-only");
|
|
37818
37891
|
if (project.isStaticExport) capabilities.add("nextjs:static-export");
|
|
37819
37892
|
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 15) capabilities.add("nextjs:15");
|
|
37893
|
+
if (project.nextjsMajorVersion !== null && project.nextjsMajorVersion >= 16) capabilities.add("nextjs:16");
|
|
37820
37894
|
addMajorLadder(capabilities, "react", project.reactMajorVersion, 17, 30);
|
|
37821
37895
|
if (project.reactMajorVersion !== null && project.reactMajorVersion >= 19 && isMajorMinorAtLeast(parseReactMajorMinor(project.reactVersion), {
|
|
37822
37896
|
major: 19,
|
|
@@ -37831,7 +37905,14 @@ const buildCapabilities = (project) => {
|
|
|
37831
37905
|
if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
|
|
37832
37906
|
if (project.isPreES2023Target) capabilities.add("pre-es2023");
|
|
37833
37907
|
if (project.hasReactCompiler) capabilities.add("react-compiler");
|
|
37834
|
-
if (project.hasTanStackQuery) capabilities.add("tanstack-query");
|
|
37908
|
+
if (Boolean(project.hasTanStackQuery) || Boolean(project.tanstackQueryVersion)) capabilities.add("tanstack-query");
|
|
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");
|
|
37835
37916
|
if (project.hasTypeScript) capabilities.add("typescript");
|
|
37836
37917
|
if (project.preactVersion !== null) capabilities.add("preact");
|
|
37837
37918
|
addMajorLadder(capabilities, "preact", project.preactMajorVersion, 10, 20);
|
|
@@ -40100,6 +40181,19 @@ const createSidecarLintCache = (cacheDirectory, rulesetHash) => {
|
|
|
40100
40181
|
}
|
|
40101
40182
|
};
|
|
40102
40183
|
};
|
|
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
|
+
};
|
|
40103
40197
|
const bundledRequire = createRequire(import.meta.url);
|
|
40104
40198
|
const childNodeVersionByBinaryPath = /* @__PURE__ */ new Map();
|
|
40105
40199
|
const resolveChildNodeVersion = (nodeBinaryPath) => {
|
|
@@ -40123,6 +40217,13 @@ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
|
|
|
40123
40217
|
"oxlint-plugin-react-doctor/package.json",
|
|
40124
40218
|
"eslint-plugin-react-hooks/package.json"
|
|
40125
40219
|
];
|
|
40220
|
+
const resolvePluginFingerprint = () => {
|
|
40221
|
+
try {
|
|
40222
|
+
return fingerprintFileContents(bundledRequire.resolve("oxlint-plugin-react-doctor"), 16);
|
|
40223
|
+
} catch {
|
|
40224
|
+
return "unresolved";
|
|
40225
|
+
}
|
|
40226
|
+
};
|
|
40126
40227
|
const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
40127
40228
|
const versions = [`node=${resolveChildNodeVersion(nodeBinaryPath)}`];
|
|
40128
40229
|
for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
|
|
@@ -40132,6 +40233,7 @@ const resolveOxlintToolchainVersions = (nodeBinaryPath = process.execPath) => {
|
|
|
40132
40233
|
} catch {
|
|
40133
40234
|
versions.push(`${specifier}=missing`);
|
|
40134
40235
|
}
|
|
40236
|
+
versions.push(`oxlint-plugin-react-doctor#fingerprint=${resolvePluginFingerprint()}`);
|
|
40135
40237
|
return versions;
|
|
40136
40238
|
};
|
|
40137
40239
|
const esmRequire = createRequire(import.meta.url);
|
|
@@ -45457,5 +45559,5 @@ const startLanguageServer = () => {
|
|
|
45457
45559
|
};
|
|
45458
45560
|
//#endregion
|
|
45459
45561
|
export { startLanguageServer };
|
|
45460
|
-
!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]="
|
|
45461
|
-
//# debugId=
|
|
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]="02e90846-98be-5fc3-82e6-cda81a2e7456")}catch(e){}}();
|
|
45563
|
+
//# debugId=02e90846-98be-5fc3-82e6-cda81a2e7456
|
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.3018538",
|
|
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
|
+
"oxlint-plugin-react-doctor": "0.8.1-dev.3018538",
|
|
69
|
+
"deslop-js": "0.8.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -74,9 +74,9 @@
|
|
|
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",
|
|
77
78
|
"@react-doctor/core": "0.8.1",
|
|
78
|
-
"@react-doctor/language-server": "0.8.1"
|
|
79
|
-
"@react-doctor/api": "0.8.1"
|
|
79
|
+
"@react-doctor/language-server": "0.8.1"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": "^20.19.0 || >=22.13.0"
|