react-doctor 0.9.18 → 0.9.19-dev.8a7c60a

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.
Files changed (40) hide show
  1. package/dist/{build-section-divider-Dpv0R267.js → build-section-divider-D50AzyPE.js} +5 -5
  2. package/dist/{ci-GE7HpZZO.js → ci-B-Vk2Y1V.js} +13 -13
  3. package/dist/cli.js +25 -25
  4. package/dist/{constants-_b1h6lxa.js → constants-CBmbPBA4.js} +6 -5
  5. package/dist/constants-DNh19qg9.js +2 -2
  6. package/dist/{design-BEEzwtu-.js → design-DLqtMcHb.js} +4 -4
  7. package/dist/{exit-gracefully-Cp3r9mjN.js → exit-gracefully-XDYyTNxQ.js} +6 -6
  8. package/dist/{handle-error-UbC9DMvZ.js → handle-error-BjhbXbeV.js} +6 -6
  9. package/dist/index.d.ts +3 -2
  10. package/dist/index.js +304 -36
  11. package/dist/{inspect-BJleAXM5.js → inspect-BZgj7pYs.js} +16 -16
  12. package/dist/{install-YHgG6Rzc.js → install-Bkvun4dQ.js} +10 -10
  13. package/dist/{install-doctor-script-BvrxLUFo.js → install-doctor-script-NCrkwOdC.js} +5 -5
  14. package/dist/{install-github-workflow-BABtyGBR.js → install-github-workflow-Db6J6Aay.js} +6 -6
  15. package/dist/{install-react-doctor-WkrWOqc4.js → install-react-doctor-x0sJUV8V.js} +9 -9
  16. package/dist/{is-cache-globally-disabled-BTTLvugj.js → is-cache-globally-disabled-BbehqqPi.js} +4 -4
  17. package/dist/{jsx-runtime-mnxPtbiq.js → jsx-runtime-0hDBC8Ow.js} +6 -6
  18. package/dist/{print-branded-header-D1eqThu5.js → print-branded-header-BMDsGszW.js} +4 -4
  19. package/dist/{prompt-runtime-scan-url-DkntQoEi.js → prompt-runtime-scan-url-DAYaRdGj.js} +5 -5
  20. package/dist/{read-object-file-D9jF1KIF.js → read-object-file-KmNn6Q4M.js} +4 -4
  21. package/dist/{record-metric-AbxY4m3i.js → record-metric-CeCdEYTF.js} +337 -58
  22. package/dist/{report-error-D3uGbvdG.js → report-error-DO3lOtLR.js} +6 -6
  23. package/dist/{report-workflow-result-DQ2CaExl.js → report-workflow-result-BArFZTRg.js} +6 -6
  24. package/dist/{resolve-scan-exit-code-CKO-d5OH.js → resolve-scan-exit-code-DVDV6o_q.js} +14 -13
  25. package/dist/{resolve-scope-D27oa5iH.js → resolve-scope-DeehPKVU.js} +6 -6
  26. package/dist/{rules-DMV85h9u.js → rules-DFgp2oN-.js} +7 -7
  27. package/dist/{run-scan-app-BS_zTwT4.js → run-scan-app-ByKNBJEy.js} +11 -11
  28. package/dist/{runtime-scan-CNSkDPqQ.js → runtime-scan-CQ3vOW1J.js} +10 -10
  29. package/dist/{sanitize-runtime-url-RZN3i1Kf.js → sanitize-runtime-url-D3ochysD.js} +4 -4
  30. package/dist/{scan-CShLBeps.js → scan-CWgIkaD6.js} +10 -10
  31. package/dist/{should-skip-prompts-DrbDyg_I.js → should-skip-prompts-oA4AUDGE.js} +4 -4
  32. package/dist/{should-use-tui-ZZii9Kea.js → should-use-tui-CGgpjezM.js} +4 -4
  33. package/dist/skills/react-doctor/SKILL.md +6 -0
  34. package/dist/{start-scan-preamble-BbzEgrwo.js → start-scan-preamble-CC9PH7Zr.js} +5 -5
  35. package/dist/start-scan-preamble.js +3 -3
  36. package/dist/{telemetry-runtime-B0ira8s1.js → telemetry-runtime-JpnsKWVp.js} +7 -7
  37. package/dist/{version-DjYlkGhN.js → version-NdzQRzPp.js} +5 -5
  38. package/dist/{why-7TTdEYqN.js → why-D6Eri2xz.js} +4 -4
  39. package/dist/{with-run-span-353qeuiD.js → with-run-span-BtBin_Zx.js} +6 -6
  40. package/package.json +4 -4
@@ -1,7 +1,7 @@
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]="5292950b-6166-5ad7-8ea4-50e90df7f9ea")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8154e0e1-e33e-5d98-b6b7-4170996b4384")}catch(e){}}();
3
3
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-ChKA3wi6.js";
4
- import { $ as warmReactCompilerDetection, $t as OXLINT_WORKER_JOB_END_MARKER, A as buildGitSourceListingRequest, An as TARGET_BLANK_BROWSER_SUPPORT, At as GITHUB_VIEWER_PERMISSION_TIMEOUT_MS, B as resolveGitCommand, Bt as MAINTAINABILITY_DUPLICATE_JSX_RULE, Cn as SUPPLY_CHAIN_CACHE_TTL_MS, Ct as ES_TARGET_YEAR_BY_NAME, Dn as SUPPLY_CHAIN_PLUGIN, Dt as GENERATED_BUNDLE_FILE_PATTERN, En as SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS, Et as FILE_LINT_CACHE_MAX_FILE_COUNT, F as lowerChildProcessPriority, Fn as VERCEL_NEXTJS_SECURITY_RELEASE_URL, Ft as HTML_FILE_PATTERN, G as resolvePluginPath, Gt as MINIFIED_SNIFF_BYTES, H as resolveOxlintThreadCount, It as IGNORED_DIRECTORIES, J as resolveTsConfigRelativePath, K as resolveReactDoctorCacheDir, Kt as OCCURRENCE_MATCHED_CATEGORIES, Lt as JSX_DUPLICATION_SOURCE_FILE_PATTERN, M as buildOxlintWorkerSpawnSpec, Mn as TELEMETRY_SHUTDOWN_TIMEOUT_MS, Mt as GIT_LS_FILES_MAX_BUFFER_BYTES, Nn as TSCONFIG_FILENAMES, Nt as GIT_SHOW_MAX_BUFFER_BYTES, On as SUPPLY_CHAIN_RULE, Ot as GENERATED_SOURCE_DIRECTORY_PATTERN, P as killUnadoptedOxlintWorkers, Pn as TYPESCRIPT_DECLARATION_FILE_PATTERN, Pt as GIT_SOURCE_LISTING_ARGUMENTS, Q as takeReactCompilerDetection, Qt as OXLINT_SPLIT_TOTAL_BUDGET_MS, R as readSystemConcurrencyFacts, Sn as SUPPLY_CHAIN_CACHE_SUBDIR, Tn as SUPPLY_CHAIN_IGNORED_PACKAGES, Tt as FILE_LINT_CACHE_FILENAME, U as resolveOxlintToolchainVersions, Ut as MAX_GLOB_PATTERN_LENGTH_CHARS, V as resolveOxlintBinary, Vt as MAINTAINABILITY_PLUGIN, W as resolveOxlintWorkerRuntime, Wt as MILLISECONDS_PER_SECOND, X as spawnOxlintWorkerProcess, Xt as OXLINT_OUTPUT_MAX_BYTES, Y as setChildProcessRef, Yt as OXLINT_OOM_RESCUE_BUDGET_MS, Z as takePrespawnedOxlintWorker, Zt as OXLINT_SPAWN_TIMEOUT_MS, _n as SOURCE_FILE_PATTERN, _t as DIAGNOSTIC_CATEGORY_BUCKETS, an as REACT_ROUTER_CAPABILITY_THRESHOLDS, at as AXIOM_METRICS_DATASET_HEADER, bn as SPAWN_ARGS_MAX_LENGTH_CHARS_POSIX, cn as ROOT_CAUSE_GROUPABLE_RULE_KEYS, d as METRIC_DISTRIBUTION_BOUNDARIES, dt as COMPILER_CLEANUP_BUCKET, en as PROJECT_ANALYSIS_WORKER_MAX_OLD_SPACE_MB, et as ABORT_EXIT_CODES, fn as SIDECAR_LINT_CACHE_FILENAME, ft as COMPILER_CLEANUP_RULE_KEYS, gn as SOCKET_PACKAGE_PAGE_BASE, gt as DEFAULT_BRANCH_CANDIDATES, hn as SOCKET_FREE_USER_AGENT, in as REACT_BLOG_RSC_ADVISORY_URL, j as buildOxlintChildEnv, jn as TELEMETRY_EXPORT_INTERVAL_MS, jt as GIT_CHECK_ATTR_MAX_BUFFER_BYTES, kn as TAILWIND_POSTCSS7_COMPAT_ALIAS, l as INTERNAL_ERROR_JSON_FALLBACK, ln as SCANNED_DOT_DIRECTORIES, mn as SOCKET_FREE_PURL_API_BASE, mt as CONFIG_FINGERPRINT_FILENAMES, nn as PROJECT_ANALYSIS_WORKER_TIMEOUT_CEILING_MS, nt as APP_ONLY_RULE_KEYS, on as REACT_SERVER_DOM_PACKAGES, ot as AXIOM_METRICS_PATH, pt as CONFIG_CACHE_TTL_MS, q as resolveScanConcurrency, qt as OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES, rn as PROJECT_ANALYSIS_WORKER_TIMEOUT_MS, rt as AXIOM_DATASET_HEADER, sn as RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES, st as AXIOM_TRACES_PATH, tn as PROJECT_ANALYSIS_WORKER_MEMORY_BUDGET_BYTES, tt as ADOPTABLE_LINT_CONFIG_FILENAMES, un as SCORE_API_URL, vn as SPAWN_ARGS_MAX_LENGTH_CHARS, vt as DISABLE_DIRECTIVE_BACKUP_DIRECTORY_SEGMENTS, wn as SUPPLY_CHAIN_CATEGORY, wt as FETCH_TIMEOUT_MS, xn as STAGED_FILES_PROJECT_CONFIG_FILENAMES, xt as DUPLICATE_JSX_WORKER_IDLE_TIMEOUT_MS, yn as SPAWN_ARGS_MAX_LENGTH_CHARS_DARWIN, yt as DOCS_RULES_BASE_URL, z as resolveConfiguredScanConcurrency, zt as MAINTAINABILITY_CATEGORY } from "./constants-_b1h6lxa.js";
4
+ import { $ as warmReactCompilerDetection, $t as OXLINT_WORKER_JOB_END_MARKER, A as buildGitSourceListingRequest, An as TARGET_BLANK_BROWSER_SUPPORT, At as GITHUB_VIEWER_PERMISSION_TIMEOUT_MS, B as resolveGitCommand, Bt as MAINTAINABILITY_DUPLICATE_JSX_RULE, Cn as SUPPLY_CHAIN_CACHE_TTL_MS, Ct as ES_TARGET_YEAR_BY_NAME, Dn as SUPPLY_CHAIN_PLUGIN, Dt as GENERATED_BUNDLE_FILE_PATTERN, En as SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS, Et as FILE_LINT_CACHE_MAX_FILE_COUNT, F as lowerChildProcessPriority, Fn as VERCEL_NEXTJS_SECURITY_RELEASE_URL, Ft as HTML_FILE_PATTERN, G as resolvePluginPath, Gt as MINIFIED_SNIFF_BYTES, H as resolveOxlintThreadCount, It as IGNORED_DIRECTORIES, J as resolveTsConfigRelativePath, K as resolveReactDoctorCacheDir, Kt as OCCURRENCE_MATCHED_CATEGORIES, Lt as JSX_DUPLICATION_SOURCE_FILE_PATTERN, M as buildOxlintWorkerSpawnSpec, Mn as TELEMETRY_SHUTDOWN_TIMEOUT_MS, Mt as GIT_LS_FILES_MAX_BUFFER_BYTES, Nn as TSCONFIG_FILENAMES, Nt as GIT_SHOW_MAX_BUFFER_BYTES, On as SUPPLY_CHAIN_RULE, Ot as GENERATED_SOURCE_DIRECTORY_PATTERN, P as killUnadoptedOxlintWorkers, Pn as TYPESCRIPT_DECLARATION_FILE_PATTERN, Pt as GIT_SOURCE_LISTING_ARGUMENTS, Q as takeReactCompilerDetection, Qt as OXLINT_SPLIT_TOTAL_BUDGET_MS, R as readSystemConcurrencyFacts, Sn as SUPPLY_CHAIN_CACHE_SUBDIR, Tn as SUPPLY_CHAIN_IGNORED_PACKAGES, Tt as FILE_LINT_CACHE_FILENAME, U as resolveOxlintToolchainVersions, Ut as MAX_GLOB_PATTERN_LENGTH_CHARS, V as resolveOxlintBinary, Vt as MAINTAINABILITY_PLUGIN, W as resolveOxlintWorkerRuntime, Wt as MILLISECONDS_PER_SECOND, X as spawnOxlintWorkerProcess, Xt as OXLINT_OUTPUT_MAX_BYTES, Y as setChildProcessRef, Yt as OXLINT_OOM_RESCUE_BUDGET_MS, Z as takePrespawnedOxlintWorker, Zt as OXLINT_SPAWN_TIMEOUT_MS, _n as SOURCE_FILE_PATTERN, _t as DIAGNOSTIC_CATEGORY_BUCKETS, an as REACT_ROUTER_CAPABILITY_THRESHOLDS, at as AXIOM_METRICS_DATASET_HEADER, bn as SPAWN_ARGS_MAX_LENGTH_CHARS_POSIX, cn as ROOT_CAUSE_GROUPABLE_RULE_KEYS, d as METRIC_DISTRIBUTION_BOUNDARIES, dt as COMPILER_CLEANUP_BUCKET, en as PROJECT_ANALYSIS_WORKER_MAX_OLD_SPACE_MB, et as ABORT_EXIT_CODES, fn as SIDECAR_LINT_CACHE_FILENAME, ft as COMPILER_CLEANUP_RULE_KEYS, gn as SOCKET_PACKAGE_PAGE_BASE, gt as DEFAULT_BRANCH_CANDIDATES, hn as SOCKET_FREE_USER_AGENT, in as REACT_BLOG_RSC_ADVISORY_URL, j as buildOxlintChildEnv, jn as TELEMETRY_EXPORT_INTERVAL_MS, jt as GIT_CHECK_ATTR_MAX_BUFFER_BYTES, kn as TAILWIND_POSTCSS7_COMPAT_ALIAS, l as INTERNAL_ERROR_JSON_FALLBACK, ln as SCANNED_DOT_DIRECTORIES, mn as SOCKET_FREE_PURL_API_BASE, mt as CONFIG_FINGERPRINT_FILENAMES, nn as PROJECT_ANALYSIS_WORKER_TIMEOUT_CEILING_MS, nt as APP_ONLY_RULE_KEYS, on as REACT_SERVER_DOM_PACKAGES, ot as AXIOM_METRICS_PATH, pt as CONFIG_CACHE_TTL_MS, q as resolveScanConcurrency, qt as OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES, rn as PROJECT_ANALYSIS_WORKER_TIMEOUT_MS, rt as AXIOM_DATASET_HEADER, sn as RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES, st as AXIOM_TRACES_PATH, tn as PROJECT_ANALYSIS_WORKER_MEMORY_BUDGET_BYTES, tt as ADOPTABLE_LINT_CONFIG_FILENAMES, un as SCORE_API_URL, vn as SPAWN_ARGS_MAX_LENGTH_CHARS, vt as DISABLE_DIRECTIVE_BACKUP_DIRECTORY_SEGMENTS, wn as SUPPLY_CHAIN_CATEGORY, wt as FETCH_TIMEOUT_MS, xn as STAGED_FILES_PROJECT_CONFIG_FILENAMES, xt as DUPLICATE_JSX_WORKER_IDLE_TIMEOUT_MS, yn as SPAWN_ARGS_MAX_LENGTH_CHARS_DARWIN, yt as DOCS_RULES_BASE_URL, z as resolveConfiguredScanConcurrency, zt as MAINTAINABILITY_CATEGORY } from "./constants-CBmbPBA4.js";
5
5
  import { n as require_picomatch, t as require_semver } from "./semver-BZIuy1gP.js";
6
6
  import { createRequire } from "node:module";
7
7
  import * as fs$1$2 from "node:fs";
@@ -20,7 +20,7 @@ import { Worker } from "node:worker_threads";
20
20
  import { parseSync } from "oxc-parser";
21
21
  import * as fs$1$1 from "node:fs/promises";
22
22
  import { ResolverFactory } from "oxc-resolver";
23
- import { 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_OPT_IN_PROJECT_RULE_IDS, REACT_DOCTOR_PROJECT_RULES, REACT_DOCTOR_RULES, REACT_DOCTOR_RULE_REGISTRY, REACT_DOCTOR_SCAN_RULES, classifySecurityScanFile, collectCrossFileDependencyProbes, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor/core";
23
+ import { 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_OPT_IN_PROJECT_RULE_IDS, REACT_DOCTOR_PROJECT_RULES, REACT_DOCTOR_RULES, REACT_DOCTOR_RULE_REGISTRY, REACT_DOCTOR_SCAN_RULES, atomicWriteFile, classifySecurityScanFile, collectCrossFileDependencyProbes, getDiagnosticContextPath, resetManifestCaches, shouldReadSecurityScanContent } from "oxlint-plugin-react-doctor/core";
24
24
  import { parseJSON5, parseJSONC } from "confbox";
25
25
  import { createJiti } from "jiti";
26
26
  import { PassThrough } from "node:stream";
@@ -88,7 +88,7 @@ const unwrapTypescriptExpression = (expression) => {
88
88
  return currentExpression;
89
89
  };
90
90
  //#endregion
91
- //#region ../core/dist/collect-unplugin-auto-import-global-scopes-BhuBw8nC.js
91
+ //#region ../core/dist/collect-unplugin-auto-import-global-scopes-CxJHEp2_.js
92
92
  var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
93
93
  const LINGUIST_ATTRIBUTES = ["linguist-generated", "linguist-vendored"];
94
94
  const DISABLED_ATTRIBUTE_VALUES = new Set([
@@ -526,7 +526,7 @@ const collectUnpluginAutoImportGlobalScopes = ({ rootDirectory, candidateFiles }
526
526
  return scopes.some((scope) => scope.names.length > 0) ? scopes : [];
527
527
  };
528
528
  //#endregion
529
- //#region ../core/dist/detect-duplicate-jsx-subtrees-DcK8lwow.js
529
+ //#region ../core/dist/detect-duplicate-jsx-subtrees-CC2sqFAB.js
530
530
  const yieldToEventLoop = () => new Promise((resolve) => {
531
531
  setImmediate(resolve);
532
532
  });
@@ -1083,7 +1083,7 @@ const detectDuplicateJsxSubtreesCooperative = async (sourceReader, options = {})
1083
1083
  });
1084
1084
  };
1085
1085
  //#endregion
1086
- //#region ../core/dist/detect-react-compiler-DDLkt9mH.js
1086
+ //#region ../core/dist/detect-react-compiler-CTmgM0WG.js
1087
1087
  const NEXT_CONFIG_FILENAMES = [
1088
1088
  "next.config.js",
1089
1089
  "next.config.mjs",
@@ -5202,6 +5202,37 @@ const mapInput = /* @__PURE__ */ dual(2, (self, f) => make$37((b1, b2) => self(f
5202
5202
  */
5203
5203
  const isGreaterThan$1 = (O) => dual(2, (self, that) => O(self, that) === 1);
5204
5204
  /**
5205
+ * Checks whether one value is greater than or equal to another according to the given order.
5206
+ *
5207
+ * **When to use**
5208
+ *
5209
+ * Use when you need a boolean greater-than-or-equal predicate using an
5210
+ * `Order`.
5211
+ *
5212
+ * **Details**
5213
+ *
5214
+ * Returns `true` if the order returns `1` or `0`, and returns `false` only if
5215
+ * the order returns `-1`.
5216
+ *
5217
+ * **Example** (Checking greater-than-or-equal comparisons)
5218
+ *
5219
+ * ```ts
5220
+ * import { Order } from "effect"
5221
+ *
5222
+ * const isGreaterThanOrEqualToNumber = Order.isGreaterThanOrEqualTo(Order.Number)
5223
+ *
5224
+ * console.log(isGreaterThanOrEqualToNumber(2, 1)) // true
5225
+ * console.log(isGreaterThanOrEqualToNumber(1, 1)) // true
5226
+ * console.log(isGreaterThanOrEqualToNumber(1, 2)) // false
5227
+ * ```
5228
+ *
5229
+ * @see {@link isGreaterThan} for strict greater than
5230
+ * @see {@link isLessThanOrEqualTo} for less than or equal
5231
+ * @category predicates
5232
+ * @since 4.0.0
5233
+ */
5234
+ const isGreaterThanOrEqualTo$1 = (O) => dual(2, (self, that) => O(self, that) !== -1);
5235
+ /**
5205
5236
  * Returns the maximum of two values according to the given order. If they are equal, returns the first argument.
5206
5237
  *
5207
5238
  * **When to use**
@@ -22707,6 +22738,203 @@ function link$1() {
22707
22738
  };
22708
22739
  }
22709
22740
  /**
22741
+ * Creates a custom validation filter from a predicate function.
22742
+ *
22743
+ * **Details**
22744
+ *
22745
+ * The predicate receives the decoded input value, the schema AST, and parse
22746
+ * options, and returns a `FilterOutput`. Non-success outputs are normalized into
22747
+ * schema issues. The `annotations` parameter annotates the filter itself; with
22748
+ * the default formatter, failures use `message` first, `expected` second, and
22749
+ * `<filter>` when neither is provided.
22750
+ *
22751
+ * When `abort` is `true`, parsing stops after this filter fails instead of
22752
+ * collecting later check failures.
22753
+ *
22754
+ * **Example** (Reporting failure at a nested path)
22755
+ *
22756
+ * ```ts
22757
+ * import { Schema } from "effect"
22758
+ *
22759
+ * const schema = Schema.Struct({ password: Schema.String, confirmPassword: Schema.String }).check(
22760
+ * Schema.makeFilter((o) =>
22761
+ * o.password === o.confirmPassword
22762
+ * ? undefined
22763
+ * : { path: ["password"], issue: "password and confirmPassword must match" }
22764
+ * )
22765
+ * )
22766
+ *
22767
+ * console.log(String(Schema.decodeUnknownExit(schema)({ password: "123456", confirmPassword: "1234567" })))
22768
+ * // Failure(Cause([Fail(SchemaError: password and confirmPassword must match
22769
+ * // at ["password"])]))
22770
+ * ```
22771
+ *
22772
+ * **Example** (Reporting multiple failures at once)
22773
+ *
22774
+ * ```ts
22775
+ * import { Schema } from "effect"
22776
+ *
22777
+ * const schema = Schema.Struct({ a: Schema.Finite, b: Schema.Finite, c: Schema.Finite }).check(
22778
+ * Schema.makeFilter((o) => {
22779
+ * const issues: Array<Schema.FilterIssue> = []
22780
+ * if (o.a > 0) {
22781
+ * if (o.b <= 0) issues.push({ path: ["b"], issue: "b must be greater than 0" })
22782
+ * if (o.c <= 0) issues.push({ path: ["c"], issue: "c must be greater than 0" })
22783
+ * }
22784
+ * return issues
22785
+ * })
22786
+ * )
22787
+ *
22788
+ * console.log(String(Schema.decodeUnknownExit(schema)({ a: 1, b: 0, c: 0 })))
22789
+ * // Failure(Cause([Fail(SchemaError: b must be greater than 0
22790
+ * // at ["b"]
22791
+ * // c must be greater than 0
22792
+ * // at ["c"])]))
22793
+ * ```
22794
+ *
22795
+ * @category constructors
22796
+ * @since 4.0.0
22797
+ */
22798
+ const makeFilter = makeFilter$1;
22799
+ /**
22800
+ * Creates a greater-than (`>`) check for any ordered type from an
22801
+ * `Order.Order` instance.
22802
+ *
22803
+ * @category Order checks
22804
+ * @since 4.0.0
22805
+ */
22806
+ function makeIsGreaterThan(options) {
22807
+ const gt = isGreaterThan$1(options.order);
22808
+ const formatter = options.formatter ?? format$1;
22809
+ return (exclusiveMinimum, annotations) => {
22810
+ return makeFilter((input) => gt(input, exclusiveMinimum), {
22811
+ expected: `a value greater than ${formatter(exclusiveMinimum)}`,
22812
+ arbitrary: { constraint: { ordered: {
22813
+ order: options.order,
22814
+ minimum: exclusiveMinimum,
22815
+ exclusiveMinimum: true
22816
+ } } },
22817
+ ...options.annotate?.(exclusiveMinimum),
22818
+ ...annotations
22819
+ });
22820
+ };
22821
+ }
22822
+ /**
22823
+ * Creates a greater-than-or-equal-to (`>=`) check for any ordered type from an
22824
+ * `Order.Order` instance.
22825
+ *
22826
+ * @category Order checks
22827
+ * @since 4.0.0
22828
+ */
22829
+ function makeIsGreaterThanOrEqualTo(options) {
22830
+ const gte = isGreaterThanOrEqualTo$1(options.order);
22831
+ const formatter = options.formatter ?? format$1;
22832
+ return (minimum, annotations) => {
22833
+ return makeFilter((input) => gte(input, minimum), {
22834
+ expected: `a value greater than or equal to ${formatter(minimum)}`,
22835
+ arbitrary: { constraint: { ordered: {
22836
+ order: options.order,
22837
+ minimum
22838
+ } } },
22839
+ ...options.annotate?.(minimum),
22840
+ ...annotations
22841
+ });
22842
+ };
22843
+ }
22844
+ function encodeNumberPayload(number) {
22845
+ if (!globalThis.Number.isFinite(number)) throw new globalThis.RangeError(`Expected a finite number, got ${format$1(number)}`);
22846
+ return number;
22847
+ }
22848
+ /**
22849
+ * Validates that a number is greater than the specified value (exclusive).
22850
+ *
22851
+ * **Details**
22852
+ *
22853
+ * JSON Schema:
22854
+ *
22855
+ * This check corresponds to the `exclusiveMinimum` constraint in JSON Schema.
22856
+ *
22857
+ * Arbitrary:
22858
+ *
22859
+ * When generating test data with fast-check, this applies an
22860
+ * `exclusiveMinimum` constraint to ensure generated numbers are greater than
22861
+ * the specified value.
22862
+ *
22863
+ * @category Number checks
22864
+ * @since 4.0.0
22865
+ */
22866
+ const isGreaterThan = /* @__PURE__ */ makeIsGreaterThan({
22867
+ order: Number$5,
22868
+ annotate: (exclusiveMinimum) => ({
22869
+ representation: {
22870
+ id: "effect/schema/isGreaterThan",
22871
+ payload: { exclusiveMinimum: encodeNumberPayload(exclusiveMinimum) }
22872
+ },
22873
+ toJsonSchema: () => ({ exclusiveMinimum }),
22874
+ toCode: () => ({ runtime: `Schema.isGreaterThan(${format$1(exclusiveMinimum)})` })
22875
+ })
22876
+ });
22877
+ /**
22878
+ * Validates that a number is greater than or equal to the specified value
22879
+ * (inclusive).
22880
+ *
22881
+ * **Details**
22882
+ *
22883
+ * JSON Schema:
22884
+ *
22885
+ * This check corresponds to the `minimum` constraint in JSON Schema.
22886
+ *
22887
+ * Arbitrary:
22888
+ *
22889
+ * When generating test data with fast-check, this applies a `minimum` constraint
22890
+ * to ensure generated numbers are greater than or equal to the specified value.
22891
+ *
22892
+ * @category Number checks
22893
+ * @since 4.0.0
22894
+ */
22895
+ const isGreaterThanOrEqualTo = /* @__PURE__ */ makeIsGreaterThanOrEqualTo({
22896
+ order: Number$5,
22897
+ annotate: (minimum) => ({
22898
+ representation: {
22899
+ id: "effect/schema/isGreaterThanOrEqualTo",
22900
+ payload: { minimum: encodeNumberPayload(minimum) }
22901
+ },
22902
+ toJsonSchema: () => ({ minimum }),
22903
+ toCode: () => ({ runtime: `Schema.isGreaterThanOrEqualTo(${format$1(minimum)})` })
22904
+ })
22905
+ });
22906
+ /**
22907
+ * Validates that a number is a safe integer (within the safe integer range
22908
+ * that can be exactly represented in JavaScript).
22909
+ *
22910
+ * **Details**
22911
+ *
22912
+ * JSON Schema:
22913
+ *
22914
+ * This check corresponds to the `type: "integer"` constraint in JSON Schema.
22915
+ *
22916
+ * Arbitrary:
22917
+ *
22918
+ * When generating test data with fast-check, this applies an `integer: true`
22919
+ * constraint to ensure generated numbers are integers.
22920
+ *
22921
+ * @category Integer checks
22922
+ * @since 4.0.0
22923
+ */
22924
+ function isInt(annotations) {
22925
+ return makeFilter((n) => globalThis.Number.isSafeInteger(n), {
22926
+ expected: "an integer",
22927
+ representation: {
22928
+ id: "effect/schema/isInt",
22929
+ payload: null
22930
+ },
22931
+ toJsonSchema: () => ({ type: "integer" }),
22932
+ toCode: () => ({ runtime: "Schema.isInt()" }),
22933
+ arbitrary: { constraint: { integer: true } },
22934
+ ...annotations
22935
+ });
22936
+ }
22937
+ /**
22710
22938
  * Schema for values that hide sensitive information from error output and
22711
22939
  * inspection.
22712
22940
  *
@@ -69610,6 +69838,7 @@ const SECURITY_SCAN_MAX_FILE_SIZE_BYTES = 2 * 1024 * 1024;
69610
69838
  const SECURITY_SCAN_MAX_BUNDLE_FILE_SIZE_BYTES = 8 * 1024 * 1024;
69611
69839
  const SKIPPED_DIRECTORY_NAMES = new Set([
69612
69840
  ".git",
69841
+ ".open-next",
69613
69842
  ".turbo",
69614
69843
  ".vercel",
69615
69844
  "coverage",
@@ -71730,6 +71959,7 @@ const normalizeConfigForHash = (config) => {
71730
71959
  const clone = JSON.parse(JSON.stringify(config));
71731
71960
  if (clone?.settings?.["react-doctor"]) {
71732
71961
  const reactDoctorSettings = clone.settings["react-doctor"];
71962
+ delete reactDoctorSettings.diagnosticContextDirectory;
71733
71963
  reactDoctorSettings.rootDirectory = ROOT_DIRECTORY_PLACEHOLDER;
71734
71964
  if (Array.isArray(reactDoctorSettings.unpluginAutoImportRootDirectories)) reactDoctorSettings.unpluginAutoImportRootDirectories = [ROOT_DIRECTORY_PLACEHOLDER];
71735
71965
  }
@@ -71891,7 +72121,7 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
71891
72121
  }
71892
72122
  return enabled;
71893
72123
  };
71894
- const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, runtimeGlobals, unpluginAutoImportGlobalScopes, serverAuthFunctionNames, projectIndexModuleSources, severityControls, adoptedSettings = {}, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
72124
+ const createOxlintConfig = ({ pluginPath, diagnosticContextDirectory, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, runtimeGlobals, unpluginAutoImportGlobalScopes, serverAuthFunctionNames, projectIndexModuleSources, severityControls, adoptedSettings = {}, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
71895
72125
  const hasIncludedTags = includedTags.size > 0;
71896
72126
  const reactHooksJsPlugin = disableReactHooksJsPlugin || ruleSelection === "sidecar" || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
71897
72127
  const reactCompilerRules = reactHooksJsPlugin ? applyRuleSeverityControls(filterRulesToAvailable(REACT_COMPILER_RULES, "react-hooks-js", reactHooksJsPlugin.availableRuleNames), severityControls) : {};
@@ -71951,6 +72181,7 @@ const createOxlintConfig = ({ pluginPath, project, customRulesOnly = false, exte
71951
72181
  ...adoptedSettings,
71952
72182
  "react-doctor": {
71953
72183
  portedRuleMode: "curated",
72184
+ ...diagnosticContextDirectory ? { diagnosticContextDirectory } : {},
71954
72185
  framework: project.framework,
71955
72186
  rootDirectory: settingsRootDirectory,
71956
72187
  capabilities: [...capabilities].sort(),
@@ -72624,22 +72855,14 @@ const runOxlintProbeJob = async (input) => {
72624
72855
  if (!isProbeResult(parsed) || parsed.traces.length !== input.probeRequest.files.length) throw new Error("oxlint worker returned a malformed probe result");
72625
72856
  return parsed;
72626
72857
  };
72627
- const atomicWriteFile = (filePath, contents) => {
72628
- let temporaryPath = null;
72629
- try {
72630
- fs$1$2.mkdirSync(path$1$1.dirname(filePath), { recursive: true });
72631
- temporaryPath = `${filePath}.${process.pid}.${randomUUID()}.tmp`;
72632
- fs$1$2.writeFileSync(temporaryPath, contents);
72633
- fs$1$2.renameSync(temporaryPath, filePath);
72634
- temporaryPath = null;
72635
- } catch {
72636
- return;
72637
- } finally {
72638
- if (temporaryPath !== null) try {
72639
- fs$1$2.rmSync(temporaryPath, { force: true });
72640
- } catch {}
72641
- }
72642
- };
72858
+ var DiagnosticContextRangeSchema = class extends Class("DiagnosticContextRange")({
72859
+ offset: Number$1.check(isInt(), isGreaterThanOrEqualTo(0)),
72860
+ length: Number$1.check(isInt(), isGreaterThan(0))
72861
+ }) {};
72862
+ var CachedDiagnostic = class extends Class("CachedDiagnostic")({
72863
+ ...Diagnostic.fields,
72864
+ contextRanges: optional(ArraySchema(DiagnosticContextRangeSchema))
72865
+ }) {};
72643
72866
  const atomicWriteJson = (filePath, value) => {
72644
72867
  try {
72645
72868
  atomicWriteFile(filePath, JSON.stringify(value));
@@ -72647,7 +72870,7 @@ const atomicWriteJson = (filePath, value) => {
72647
72870
  return;
72648
72871
  }
72649
72872
  };
72650
- const validateDiagnostic$1 = decodeUnknownSync(Diagnostic);
72873
+ const validateDiagnostic$1 = decodeUnknownSync(CachedDiagnostic);
72651
72874
  const decodeDiagnostic = (raw) => {
72652
72875
  const diagnostic = validateDiagnostic$1(raw);
72653
72876
  return {
@@ -72767,7 +72990,7 @@ const createSidecarProbeAnswerResolver = (input) => {
72767
72990
  toRelativePath
72768
72991
  };
72769
72992
  };
72770
- const validateDiagnostic = decodeUnknownSync(Diagnostic);
72993
+ const validateDiagnostic = decodeUnknownSync(CachedDiagnostic);
72771
72994
  const isProbeKind = (value) => value === "content" || value === "exists";
72772
72995
  const isProbeIdArray = (value, probeCount) => Array.isArray(value) && value.every((probeId) => typeof probeId === "number" && Number.isInteger(probeId) && probeId >= 0 && probeId < probeCount);
72773
72996
  const createProbeTable = () => {
@@ -73009,6 +73232,29 @@ const columnOfUtf8Offset = (sourceBuffer, utf8Offset) => {
73009
73232
  while (lineStartOffset > 0 && sourceBuffer[lineStartOffset - 1] !== 10) lineStartOffset--;
73010
73233
  return sourceBuffer.subarray(lineStartOffset, boundedOffset).toString("utf8").length + 1;
73011
73234
  };
73235
+ const decodeRanges = decodeUnknownSync(ArraySchema(DiagnosticContextRangeSchema));
73236
+ const createDiagnosticContextReader = (directory) => {
73237
+ const recordedRules = /* @__PURE__ */ new Set();
73238
+ if (directory) try {
73239
+ for (const filename of fs$1$2.readdirSync(directory)) {
73240
+ if (!filename.endsWith(".json")) continue;
73241
+ recordedRules.add(filename.slice(0, filename.lastIndexOf("-")));
73242
+ }
73243
+ } catch {
73244
+ recordedRules.clear();
73245
+ }
73246
+ return (identity) => {
73247
+ if (!directory || !recordedRules.has(encodeURIComponent(identity.rule))) return [];
73248
+ try {
73249
+ return decodeRanges(failOpenReadJson(getDiagnosticContextPath({
73250
+ ...identity,
73251
+ directory
73252
+ }), []));
73253
+ } catch {
73254
+ return [];
73255
+ }
73256
+ };
73257
+ };
73012
73258
  const utf8OffsetFromSourcePosition = (sourceBuffer, lineNumber, zeroBasedColumn) => {
73013
73259
  if (lineNumber < 1 || zeroBasedColumn < 0) return null;
73014
73260
  const sourceLines = sourceBuffer.toString("utf8").split("\n");
@@ -73650,7 +73896,7 @@ const isOxlintOutput = (value) => isRecord(value) && Array.isArray(value.diagnos
73650
73896
  * to the first `{`. Raises `OxlintOutputUnparseable` when the
73651
73897
  * stdout isn't valid JSON or doesn't carry a `diagnostics` array.
73652
73898
  */
73653
- const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath) => {
73899
+ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath, diagnosticContextDirectory) => {
73654
73900
  if (!stdout) return [];
73655
73901
  const jsonStart = stdout.indexOf("{");
73656
73902
  const sanitizedStdout = jsonStart > 0 ? stdout.slice(jsonStart) : stdout;
@@ -73700,19 +73946,33 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath,
73700
73946
  minifiedFileCache.set(absolutePath, minified);
73701
73947
  return minified;
73702
73948
  };
73703
- return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((diagnostic) => {
73949
+ const readContextRanges = createDiagnosticContextReader(diagnosticContextDirectory);
73950
+ return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((rawDiagnostic) => {
73951
+ if (!isMappableOxlintDiagnostic(rawDiagnostic)) return [];
73952
+ const { plugin, rule } = parseRuleCode(rawDiagnostic.code);
73953
+ const primarySpan = rawDiagnostic.labels[0]?.span;
73954
+ const contextRanges = diagnosticContextDirectory && plugin === "react-doctor" && primarySpan ? readContextRanges({
73955
+ filename: resolveAbsolutePath(rawDiagnostic.filename),
73956
+ rule,
73957
+ offset: primarySpan.offset,
73958
+ message: rawDiagnostic.message
73959
+ }) : [];
73960
+ const diagnostic = {
73961
+ ...rawDiagnostic,
73962
+ contextRanges
73963
+ };
73704
73964
  const preparedSourceMap = resolvePreparedSourceMap(diagnostic.filename);
73705
73965
  if (preparedSourceMap === void 0) return [diagnostic];
73706
- const { plugin, rule } = parseRuleCode(diagnostic.code);
73707
73966
  if (plugin !== "react-doctor" || !REACT_DOCTOR_RULE_REGISTRY[rule]?.tags?.includes("design")) return [];
73708
73967
  const labels = mapPreparedSourceLabels(diagnostic.labels, preparedSourceMap);
73709
73968
  const sourceFilename = resolveMappedSourceFilename(diagnostic.filename);
73710
73969
  return labels === null || sourceFilename === void 0 ? [] : [{
73711
73970
  ...diagnostic,
73712
73971
  filename: sourceFilename,
73713
- labels
73972
+ labels,
73973
+ contextRanges: []
73714
73974
  }];
73715
- }).filter((diagnostic) => isMappableOxlintDiagnostic(diagnostic) && isLintableSourceFile(resolveSourceFilename(diagnostic.filename)) && !(TYPESCRIPT_DECLARATION_FILE_PATTERN.test(diagnostic.filename) && OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES.has(diagnostic.code)) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
73975
+ }).filter((diagnostic) => isLintableSourceFile(resolveSourceFilename(diagnostic.filename)) && !(TYPESCRIPT_DECLARATION_FILE_PATTERN.test(diagnostic.filename) && OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES.has(diagnostic.code)) && !isMinifiedDiagnosticFile(diagnostic.filename) && !shouldSuppressLocalUseHookDiagnostic(diagnostic, rootDirectory) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
73716
73976
  const { plugin, rule } = parseRuleCode(diagnostic.code);
73717
73977
  const primaryLabel = diagnostic.labels[0];
73718
73978
  const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
@@ -73749,6 +74009,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath,
73749
74009
  ...primarySpanEndLine !== void 0 ? { endLine: primarySpanEndLine } : {}
73750
74010
  } : {},
73751
74011
  category,
74012
+ ...diagnostic.contextRanges.length > 0 ? { contextRanges: diagnostic.contextRanges } : {},
73752
74013
  ...matchByOccurrence ? { matchByOccurrence: true } : {},
73753
74014
  ...relatedLocations.length > 0 ? { relatedLocations } : {}
73754
74015
  };
@@ -73861,7 +74122,7 @@ const spawnLintBatches = async (input) => {
73861
74122
  };
73862
74123
  const stdout = input.spawnSlots === void 0 ? await spawnBatch() : await input.spawnSlots.run(spawnBatch, signal);
73863
74124
  if (stdout === null) return [];
73864
- return parseOxlintOutput(stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath);
74125
+ return parseOxlintOutput(stdout, project, rootDirectory, sourcePathByLintPath, sourceMapByLintPath, input.diagnosticContextDirectory);
73865
74126
  } catch (error) {
73866
74127
  if (!isSplittableReactDoctorError(error)) throw error;
73867
74128
  if (isPastDeadline()) {
@@ -74590,6 +74851,8 @@ const runOxlint = async (options) => {
74590
74851
  const configDirectory = fs$1$2.mkdtempSync(path$1$1.join(os.tmpdir(), "react-doctor-oxlintrc-"));
74591
74852
  const configPath = path$1$1.join(configDirectory, "oxlintrc.json");
74592
74853
  try {
74854
+ const diagnosticContextDirectory = path$1$1.join(configDirectory, "contexts");
74855
+ fs$1$2.mkdirSync(diagnosticContextDirectory);
74593
74856
  const oxlintBinary = resolveOxlintBinary();
74594
74857
  const sharedArgs = [];
74595
74858
  let tsconfigContent = null;
@@ -74638,6 +74901,7 @@ const runOxlint = async (options) => {
74638
74901
  } : project;
74639
74902
  const buildConfig = (overrides) => createOxlintConfig({
74640
74903
  pluginPath,
74904
+ diagnosticContextDirectory,
74641
74905
  project: lintProject,
74642
74906
  customRulesOnly,
74643
74907
  extendsPaths: overrides.extendsPaths,
@@ -74689,6 +74953,7 @@ const runOxlint = async (options) => {
74689
74953
  project: lintProject,
74690
74954
  sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
74691
74955
  sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
74956
+ diagnosticContextDirectory,
74692
74957
  onPartialFailure: reportPartialFailure,
74693
74958
  onAnalyzedFiles: (filePaths) => {
74694
74959
  analyzedFiles = filePaths;
@@ -74916,6 +75181,7 @@ const runOxlint = async (options) => {
74916
75181
  project: lintProject,
74917
75182
  sourcePathByLintPath: preparedLintSources.sourcePathByLintPath,
74918
75183
  sourceMapByLintPath: preparedLintSources.sourceMapByLintPath,
75184
+ diagnosticContextDirectory,
74919
75185
  onPartialFailure,
74920
75186
  onAnalyzedFiles: (filePaths) => {
74921
75187
  analyzedFiles = filePaths;
@@ -75212,7 +75478,7 @@ const ScoreApiResponseSchema = Struct({
75212
75478
  });
75213
75479
  const EMPTY_SCORE_REQUEST_METADATA = {};
75214
75480
  const parseScoreResult = (value) => getOrNull(decodeUnknownOption(ScoreApiResponseSchema)(value));
75215
- const sanitizeScoreDiagnostics = (diagnostics) => diagnostics.map(({ filePath, fileContext: _fileContext, fixGroupId: _fixGroupId, ...rest }) => ({
75481
+ const sanitizeScoreDiagnostics = (diagnostics) => diagnostics.map(({ filePath, fileContext: _fileContext, fixGroupId: _fixGroupId, contextRanges: _contextRanges, ...rest }) => ({
75216
75482
  ...rest,
75217
75483
  filePath: redactSensitiveText(scrubSensitivePaths(filePath))
75218
75484
  }));
@@ -76492,12 +76758,13 @@ const findWorstScoredProject = (projects) => {
76492
76758
  return worst;
76493
76759
  };
76494
76760
  const toJsonReportDiagnostic = (diagnostic, projectRoot, reportRoot) => {
76761
+ const { contextRanges: _contextRanges, ...publicDiagnostic } = diagnostic;
76495
76762
  const resolvedFilePath = resolveCandidateReadPath(projectRoot, diagnostic.filePath);
76496
76763
  const normalizedFilePath = toNormalizedRelativePath(resolvedFilePath, projectRoot);
76497
76764
  const reportRelativeFilePath = toNormalizedRelativePath(resolvedFilePath, reportRoot);
76498
76765
  const ruleIdentity = getDiagnosticRuleIdentity(diagnostic);
76499
76766
  return {
76500
- ...diagnostic,
76767
+ ...publicDiagnostic,
76501
76768
  id: buildDiagnosticIdentity({
76502
76769
  filePath: reportRelativeFilePath,
76503
76770
  line: diagnostic.line,
@@ -76669,22 +76936,11 @@ const getRuleMetadata = (plugin, rule) => {
76669
76936
  defaultEnabled: definition.defaultEnabled ?? true
76670
76937
  };
76671
76938
  };
76672
- const doesContextIntersectChanges = ({ sourceFile, owner, changes, isBoundary }) => {
76673
- const startLine = sourceFile.getLineAndCharacterOfPosition(owner.getStart(sourceFile)).line + 1;
76674
- const endLine = sourceFile.getLineAndCharacterOfPosition(owner.getEnd() - 1).line + 1;
76675
- const childRanges = [];
76676
- const collectChildren = (node) => {
76677
- if (isBoundary(node)) {
76678
- childRanges.push([sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1, sourceFile.getLineAndCharacterOfPosition(node.getEnd() - 1).line + 1]);
76679
- return;
76680
- }
76681
- typescriptBinding.forEachChild(node, collectChildren);
76682
- };
76683
- typescriptBinding.forEachChild(owner, collectChildren);
76939
+ const doesContextIntersectChanges = ({ contexts, changes }) => contexts.some(({ range: [startLine, endLine], excludedRanges = [] }) => {
76684
76940
  for (const [changedStart, changedEnd] of changes.ranges) {
76685
76941
  let remainingStart = Math.max(startLine, changedStart);
76686
76942
  const remainingEnd = Math.min(endLine, changedEnd);
76687
- for (const [childStart, childEnd] of childRanges) {
76943
+ for (const [childStart, childEnd] of excludedRanges) {
76688
76944
  if (childEnd < remainingStart) continue;
76689
76945
  if (childStart > remainingEnd) break;
76690
76946
  if (childStart > remainingStart) return true;
@@ -76692,12 +76948,27 @@ const doesContextIntersectChanges = ({ sourceFile, owner, changes, isBoundary })
76692
76948
  }
76693
76949
  if (remainingStart <= remainingEnd) return true;
76694
76950
  }
76695
- return (changes.deletionLines ?? []).some((deletionLine) => deletionLine >= startLine && deletionLine < endLine && !childRanges.some(([childStart, childEnd]) => deletionLine >= childStart && deletionLine < childEnd));
76696
- };
76951
+ return (changes.deletionLines ?? []).some((deletionLine) => deletionLine >= startLine && deletionLine < endLine && !excludedRanges.some(([childStart, childEnd]) => deletionLine >= childStart && deletionLine < childEnd));
76952
+ });
76697
76953
  const diagnosticIntersectsLineRanges = (diagnostic, lineRanges) => {
76698
76954
  const diagnosticEndLine = Math.max(diagnostic.line, diagnostic.endLine ?? diagnostic.line);
76699
76955
  return lineRanges.some(([rangeStartLine, rangeEndLine]) => diagnostic.line <= rangeEndLine && diagnosticEndLine >= rangeStartLine);
76700
76956
  };
76957
+ const getOwnedContext = ({ sourceFile, owner, isBoundary }) => {
76958
+ const excludedRanges = [];
76959
+ const collectChildren = (node) => {
76960
+ if (isBoundary(node)) {
76961
+ excludedRanges.push([sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1, sourceFile.getLineAndCharacterOfPosition(node.getEnd() - 1).line + 1]);
76962
+ return;
76963
+ }
76964
+ typescriptBinding.forEachChild(node, collectChildren);
76965
+ };
76966
+ typescriptBinding.forEachChild(owner, collectChildren);
76967
+ return {
76968
+ range: [sourceFile.getLineAndCharacterOfPosition(owner.getStart(sourceFile)).line + 1, sourceFile.getLineAndCharacterOfPosition(owner.getEnd() - 1).line + 1],
76969
+ excludedRanges
76970
+ };
76971
+ };
76701
76972
  const createChangedLineMatcher = ({ directory, changedLineRanges, contextual = false }) => {
76702
76973
  const changesByFile = new Map(changedLineRanges.map((entry) => [path$1$1.resolve(directory, entry.file.replaceAll("\\", "/")), entry]));
76703
76974
  const sourceFiles = /* @__PURE__ */ new Map();
@@ -76707,9 +76978,11 @@ const createChangedLineMatcher = ({ directory, changedLineRanges, contextual = f
76707
76978
  if (!changes) return false;
76708
76979
  if (diagnosticIntersectsLineRanges(diagnostic, changes.ranges)) return true;
76709
76980
  if (!contextual) return false;
76710
- const scope = getRuleMetadata(diagnostic.plugin, diagnostic.rule)?.diffScope ?? "line";
76711
- if (scope === "file") return true;
76712
- if (scope === "line" || !/\.[cm]?[jt]sx?$/i.test(filePath)) return false;
76981
+ const ruleMetadata = getRuleMetadata(diagnostic.plugin, diagnostic.rule);
76982
+ const scope = ruleMetadata?.diffScope ?? "line";
76983
+ const explicitContextRanges = ruleMetadata ? diagnostic.contextRanges : void 0;
76984
+ if (!explicitContextRanges && scope === "file") return true;
76985
+ if (!explicitContextRanges && scope === "line" || !/\.[cm]?[jt]sx?$/i.test(filePath)) return false;
76713
76986
  if (!sourceFiles.has(filePath)) try {
76714
76987
  const sourceFile = typescriptBinding.createSourceFile(filePath, fs$1$2.readFileSync(filePath, "utf8"), typescriptBinding.ScriptTarget.Latest, true, getTypescriptScriptKind(filePath));
76715
76988
  const hasParseErrors = "parseDiagnostics" in sourceFile && Array.isArray(sourceFile.parseDiagnostics) && sourceFile.parseDiagnostics.length > 0;
@@ -76720,6 +76993,10 @@ const createChangedLineMatcher = ({ directory, changedLineRanges, contextual = f
76720
76993
  const sourceFile = sourceFiles.get(filePath);
76721
76994
  if (!sourceFile) return false;
76722
76995
  const sourceBuffer = Buffer.from(sourceFile.text);
76996
+ if (explicitContextRanges) return doesContextIntersectChanges({
76997
+ contexts: explicitContextRanges.filter(({ offset, length }) => Number.isSafeInteger(offset) && Number.isSafeInteger(length) && offset >= 0 && length > 0 && offset + length <= sourceBuffer.length).map(({ offset, length }) => ({ range: [lineOfUtf8Offset(sourceBuffer, offset), lineOfUtf8Offset(sourceBuffer, offset + length - 1)] })),
76998
+ changes
76999
+ });
76723
77000
  const byteOffset = diagnostic.offset ?? utf8OffsetFromSourcePosition(sourceBuffer, diagnostic.line, diagnostic.column - 1);
76724
77001
  if (byteOffset === null || byteOffset < 0 || byteOffset >= sourceBuffer.length) return false;
76725
77002
  const position = sourceBuffer.subarray(0, byteOffset).toString("utf8").length;
@@ -76733,10 +77010,12 @@ const createChangedLineMatcher = ({ directory, changedLineRanges, contextual = f
76733
77010
  findOwner(sourceFile);
76734
77011
  if (!owner) return false;
76735
77012
  return doesContextIntersectChanges({
76736
- sourceFile,
76737
- owner,
76738
- changes,
76739
- isBoundary
77013
+ contexts: [getOwnedContext({
77014
+ sourceFile,
77015
+ owner,
77016
+ isBoundary
77017
+ })],
77018
+ changes
76740
77019
  });
76741
77020
  };
76742
77021
  };
@@ -77171,7 +77450,7 @@ const makeNoopConsole = () => ({
77171
77450
  });
77172
77451
  //#endregion
77173
77452
  //#region src/cli/utils/version.ts
77174
- const VERSION = "0.9.18";
77453
+ const VERSION = "0.9.19-dev.8a7c60a";
77175
77454
  //#endregion
77176
77455
  //#region src/cli/utils/json-mode.ts
77177
77456
  let context = null;
@@ -77515,5 +77794,5 @@ const recordDistribution = (name, value, options = {}) => {
77515
77794
  //#endregion
77516
77795
  export { buildRuleSeverityControls as $, scrubSensitivePaths as $t, Files as A, mergeAll$1 as An, hasSupportedFrameworkOrLibrary as At, PerFileLintCacheEnabled as B, messageFromUnknown as Bn, listSourceFilesCooperative as Bt, ACTION_INPUT_ENVIRONMENT_VARIABLES as C, provideService as Cn, getChangedLineRanges as Ct, isCodingAgentEnvironment as D, try_ as Dn, getRuleMetadata as Dt, isCiOrCodingAgentEnvironment as E, sync as En, getEquivalentRuleKeys as Et, Linter as F, fail$5 as Fn, isReactDoctorError as Ft, SidecarLintCacheEnabled as G, isPlainObject as Gn, mergeAndFilterDiagnostics as Gt, Project as H, isDirectory as Hn, loadConfigWithSource as Ht, Maintainability as I, void_$1 as In, isSameRuleKey as It, anonymizeInPlace as J, resolveGithubActionsScoreMetadata as Jt, StagedFiles as K, mergeReactDoctorConfigs as Kt, NodeResolver as L, ParentSpan as Ln, isScanComplete as Lt, InvocationCaches as M, succeed$3 as Mn, highlighter as Mt, LEGACY_CONFIG_FILENAME as N, close as Nn, isPathInsideDirectory as Nt, Config as O, void_ as On, groupBy as Ot, LintPartialFailures as P, makeUnsafe$5 as Pn, isProjectDiscoveryError as Pt, buildRuleDocsUrl as Q, runInspect as Qt, OxlintConcurrency as R, isMonorepoRoot as Rn, layerObservability as Rt, isDebugFlagEnabled as S, provideContext as Sn, getBaselineDiffPlan as St, isCiEnvironment as T, runSync as Tn, getDiffInfo as Tt, Reporter as U, isErrnoException as Un, mapWithConcurrency as Ut, Progress as V, toCanonicalPath as Vn, listWorkspacePackages as Vt, Score as W, isFile as Wn, materializeSourceTree as Wt, atomicWriteJson as X, resolveScanTarget as Xt, anonymizeText as Y, resolveLintBatchOrdering as Yt, buildJsonReport as Z, restoreLegacyThrow as Zt, VERSION as _, makeSpan$1 as _n, findGitRepositoryRoot as _t, isEnvFlagEnabled as a, warmDuplicateJsxWorker as an, collectSourceFilesByDirectory as at, isNonInteractiveEnvironment as b, promise as bn, formatErrorChain as bt, setSentryProjectInfo as c, error as cn, countOptInProjectRuleSelections as ct, isJsonModeActive as d, warn$1 as dn, createOxlintSpawnSlots as dt, setColorEnabled as en, buildSkippedChecks as et, setJsonReportDirectory as f, Diagnostic as fn, detectAiTrainingEnvironment as ft, writeJsonReport as g, gen as gn, filterSourceFiles as gt, writeJsonErrorReport as h, make$30 as hn, filterPathsOutsideDirectories as ht, isTelemetryEnabled as i, validateConfigTypes as in, clearConfigCache as it, Git as j, provide$2 as jn, hashFileContents as jt, DIAGNOSTIC_DELTA_IDENTITY as k, buildWithScope as kn, hasPublishedFixRecipe as kt, getRunId as l, info as ln, createChangedLineMatcher as lt, writeJsonCancellationReport as m, decodeUnknownSync as mn, filterDiagnosticsForSurface as mt, recordDistribution as n, summarizeDiagnostics as nn, canonicalizeUserRuleKey as nt, buildSentryScope as o, warmOxlintWorkerPool as on, computeConfigFingerprint as ot, setJsonReportMode as p, JsonReport as pn, discoverSupportedSubprojects as pt, SupplyChain as q, remainingDeadlineBudgetMs as qt, toSpanAttributes as r, toRelativePath as rn, classifyFileContext as rt, buildSentryProjectContext as s, Console as sn, computeDiagnosticDelta as st, recordCount as t, shouldUseMaintainabilityLayer as tn, calculateScore as tt, enableJsonMode as u, log as un, createInvocationCaches as ut, makeNoopConsole as v, map$3 as vn, findLegacyConfig as vt, detectRunnerOs as w, runPromise as wn, getDiagnosticRuleIdentity as wt, isGitHookEnvironment as x, provide as xn, formatReactDoctorError as xt, CliInputError as y, orElseSucceed as yn, fingerprintDiagnosticEvidence as yt, OxlintSpawnSlots as z, yieldToEventLoop as zn, listSourceFiles as zt };
77517
77796
 
77518
- //# sourceMappingURL=record-metric-AbxY4m3i.js.map
77519
- //# debugId=5292950b-6166-5ad7-8ea4-50e90df7f9ea
77797
+ //# sourceMappingURL=record-metric-CeCdEYTF.js.map
77798
+ //# debugId=8154e0e1-e33e-5d98-b6b7-4170996b4384