react-doctor 0.9.23-dev.dfffab3 → 0.9.23-dev.eeff4d4

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 (43) hide show
  1. package/dist/{build-section-divider-BFxWf70B.js → build-section-divider-M4JYIvJl.js} +5 -5
  2. package/dist/{ci-CLtdQCIE.js → ci-D7ljXIo9.js} +13 -13
  3. package/dist/cli.js +25 -25
  4. package/dist/{constants-BmD_c3Yq.js → constants-BXN6vJ3T.js} +25 -8
  5. package/dist/{constants-T2clfs7L.js → constants-zyF-Em_y.js} +10 -3
  6. package/dist/{design-BMqPn207.js → design-XQwuAooI.js} +4 -4
  7. package/dist/duplicate-jsx-worker.js +1 -1
  8. package/dist/{exit-gracefully-Bhyw-8gk.js → exit-gracefully-BOyeEcyb.js} +6 -6
  9. package/dist/{handle-error-BJ_4E2kS.js → handle-error-UWlOKn6r.js} +6 -6
  10. package/dist/index.d.ts +16 -1
  11. package/dist/index.js +998 -76
  12. package/dist/{inspect-BuLr42QI.js → inspect-F_2FwEY4.js} +16 -16
  13. package/dist/{install-DsuiRD1t.js → install-KoxCju0L.js} +10 -10
  14. package/dist/{install-doctor-script-DJ6UbhZJ.js → install-doctor-script-BrfKpUzQ.js} +5 -5
  15. package/dist/{install-github-workflow-BNRbJHjd.js → install-github-workflow-hAvw3S8o.js} +6 -6
  16. package/dist/{install-react-doctor-BcsOSw5y.js → install-react-doctor-Dt86VM3q.js} +9 -9
  17. package/dist/{is-cache-globally-disabled-CveNGcRi.js → is-cache-globally-disabled-DaT77eEZ.js} +4 -4
  18. package/dist/{jsx-runtime-BDdabT1T.js → jsx-runtime-BrXRMax1.js} +6 -6
  19. package/dist/oxlint-worker.js +1 -1
  20. package/dist/{print-branded-header-BFh1P9t6.js → print-branded-header-BtUUFoRA.js} +4 -4
  21. package/dist/project-analysis-worker.js +105 -7
  22. package/dist/{prompt-runtime-scan-url-CRx8qrV0.js → prompt-runtime-scan-url-Buwk-3bK.js} +5 -5
  23. package/dist/{read-object-file-D3pRnLyV.js → read-object-file-_cBPiQ53.js} +4 -4
  24. package/dist/{record-metric-CWxS2npr.js → record-metric-CqZ2oVM5.js} +983 -77
  25. package/dist/{report-error-DA8uMulb.js → report-error-TQ0RuHaV.js} +6 -6
  26. package/dist/{report-workflow-result-D6NNwRMm.js → report-workflow-result-AVT357TZ.js} +6 -6
  27. package/dist/{resolve-scan-exit-code-DE6AIQwU.js → resolve-scan-exit-code-DHwcZs-_.js} +14 -13
  28. package/dist/{resolve-scope-B3xmSQ0a.js → resolve-scope-C0xGQv5Z.js} +6 -6
  29. package/dist/{rules-CHxjoZwR.js → rules-DrN3BHA6.js} +7 -7
  30. package/dist/{run-scan-app-BuI_XZcx.js → run-scan-app-DgD9ZUcX.js} +45 -16
  31. package/dist/{runtime-scan-0pSZm3M0.js → runtime-scan-CUd9z8wt.js} +10 -10
  32. package/dist/{sanitize-runtime-url-BCw_Ixks.js → sanitize-runtime-url-BbR8vJyj.js} +4 -4
  33. package/dist/{scan-Be7a-iK7.js → scan-DStBkQc_.js} +10 -10
  34. package/dist/{should-skip-prompts-CDudIC40.js → should-skip-prompts-B3A5qWMu.js} +4 -4
  35. package/dist/{should-use-tui-HuQLii4U.js → should-use-tui-lowPvEnC.js} +4 -4
  36. package/dist/skills/react-doctor/references/explain.md +21 -0
  37. package/dist/{start-scan-preamble-DDAT_0oB.js → start-scan-preamble-CTa9UHkf.js} +5 -5
  38. package/dist/start-scan-preamble.js +3 -3
  39. package/dist/{telemetry-runtime-De9QafWu.js → telemetry-runtime-DJWGuzba.js} +7 -7
  40. package/dist/{version-uDDHk7KW.js → version-gbK4YNDr.js} +5 -5
  41. package/dist/{why-Dww_fJtq.js → why-Cdmh9drp.js} +4 -4
  42. package/dist/{with-run-span-CRYkeESN.js → with-run-span-CmXGFcgD.js} +6 -6
  43. package/package.json +2 -2
@@ -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]="f2b47816-a0c6-5228-a261-97a495a1bb85")}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]="4f395a61-8b10-59b6-9932-c6b841e1f49d")}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_SPLIT_TOTAL_BUDGET_MS, A as buildGitSourceListingRequest, An as TAILWIND_POSTCSS7_COMPAT_ALIAS, B as resolveGitCommand, Bt as MAINTAINABILITY_CATEGORY, Cn as SUPPLY_CHAIN_CACHE_SUBDIR, Dn as SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS, Dt as FILE_LINT_CACHE_MAX_FILE_COUNT, En as SUPPLY_CHAIN_IGNORED_PACKAGES, Et as FILE_LINT_CACHE_FILENAME, F as lowerChildProcessPriority, Fn as TYPESCRIPT_DECLARATION_FILE_PATTERN, Ft as GIT_SOURCE_LISTING_ARGUMENTS, G as resolvePluginPath, Gt as MILLISECONDS_PER_SECOND, H as resolveOxlintThreadCount, Ht as MAINTAINABILITY_PLUGIN, In as VERCEL_NEXTJS_SECURITY_RELEASE_URL, It as HTML_FILE_PATTERN, J as resolveTsConfigRelativePath, Jt as OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES, K as resolveReactDoctorCacheDir, Kt as MINIFIED_SNIFF_BYTES, Lt as IGNORED_DIRECTORIES, M as buildOxlintWorkerSpawnSpec, Mn as TELEMETRY_EXPORT_INTERVAL_MS, Mt as GIT_CHECK_ATTR_MAX_BUFFER_BYTES, Nn as TELEMETRY_SHUTDOWN_TIMEOUT_MS, Nt as GIT_LS_FILES_MAX_BUFFER_BYTES, On as SUPPLY_CHAIN_PLUGIN, Ot as GENERATED_BUNDLE_FILE_PATTERN, P as killUnadoptedOxlintWorkers, Pn as TSCONFIG_FILENAMES, Pt as GIT_SHOW_MAX_BUFFER_BYTES, Q as takeReactCompilerDetection, Qt as OXLINT_SPAWN_TIMEOUT_MS, R as readSystemConcurrencyFacts, Rt as JSX_DUPLICATION_SOURCE_FILE_PATTERN, Sn as STAGED_FILES_PROJECT_CONFIG_FILENAMES, St as DUPLICATE_JSX_WORKER_IDLE_TIMEOUT_MS, Tn as SUPPLY_CHAIN_CATEGORY, Tt as FETCH_TIMEOUT_MS, U as resolveOxlintToolchainVersions, V as resolveOxlintBinary, Vt as MAINTAINABILITY_DUPLICATE_JSX_RULE, W as resolveOxlintWorkerRuntime, Wt as MAX_GLOB_PATTERN_LENGTH_CHARS, X as spawnOxlintWorkerProcess, Xt as OXLINT_OOM_RESCUE_BUDGET_MS, Y as setChildProcessRef, Z as takePrespawnedOxlintWorker, Zt as OXLINT_OUTPUT_MAX_BYTES, _n as SOCKET_PACKAGE_PAGE_BASE, _t as DEFAULT_BRANCH_CANDIDATES, an as REACT_BLOG_RSC_ADVISORY_URL, bn as SPAWN_ARGS_MAX_LENGTH_CHARS_DARWIN, bt as DOCS_RULES_BASE_URL, cn as RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES, ct as AXIOM_TRACES_PATH, d as METRIC_DISTRIBUTION_BOUNDARIES, dn as SCORE_API_URL, en as OXLINT_WORKER_JOB_END_MARKER, et as ABORT_EXIT_CODES, ft as COMPILER_CLEANUP_BUCKET, gn as SOCKET_FREE_USER_AGENT, hn as SOCKET_FREE_PURL_API_BASE, ht as CONFIG_FINGERPRINT_FILENAMES, in as PROJECT_ANALYSIS_WORKER_TIMEOUT_MS, it as AXIOM_DATASET_HEADER, j as buildOxlintChildEnv, jn as TARGET_BLANK_BROWSER_SUPPORT, jt as GITHUB_VIEWER_PERMISSION_TIMEOUT_MS, kn as SUPPLY_CHAIN_RULE, kt as GENERATED_SOURCE_DIRECTORY_PATTERN, l as INTERNAL_ERROR_JSON_FALLBACK, ln as ROOT_CAUSE_GROUPABLE_RULE_KEYS, mt as CONFIG_CACHE_TTL_MS, nn as PROJECT_ANALYSIS_WORKER_MEMORY_BUDGET_BYTES, nt as ADOPTED_LINT_CONFIG_MAX_BYTES, on as REACT_ROUTER_CAPABILITY_THRESHOLDS, ot as AXIOM_METRICS_DATASET_HEADER, pn as SIDECAR_LINT_CACHE_FILENAME, pt as COMPILER_CLEANUP_RULE_KEYS, q as resolveScanConcurrency, qt as OCCURRENCE_MATCHED_CATEGORIES, rn as PROJECT_ANALYSIS_WORKER_TIMEOUT_CEILING_MS, rt as APP_ONLY_RULE_KEYS, sn as REACT_SERVER_DOM_PACKAGES, st as AXIOM_METRICS_PATH, tn as PROJECT_ANALYSIS_WORKER_MAX_OLD_SPACE_MB, tt as ADOPTABLE_LINT_CONFIG_FILENAMES, un as SCANNED_DOT_DIRECTORIES, vn as SOURCE_FILE_PATTERN, vt as DIAGNOSTIC_CATEGORY_BUCKETS, wn as SUPPLY_CHAIN_CACHE_TTL_MS, wt as ES_TARGET_YEAR_BY_NAME, xn as SPAWN_ARGS_MAX_LENGTH_CHARS_POSIX, yn as SPAWN_ARGS_MAX_LENGTH_CHARS, yt as DISABLE_DIRECTIVE_BACKUP_DIRECTORY_SEGMENTS, z as resolveConfiguredScanConcurrency } from "./constants-BmD_c3Yq.js";
4
+ import { $ as warmReactCompilerDetection, $t as OXLINT_OUTPUT_MAX_BYTES, A as buildGitSourceListingRequest, An as SUPPLY_CHAIN_PLUGIN, B as resolveGitCommand, Bn as VITE_ENTRY_DENSITY_SAMPLE_BYTES, Bt as LINT_IGNORE_STYLE_FILENAMES, Cn as SPAWN_ARGS_MAX_LENGTH_CHARS_POSIX, Dn as SUPPLY_CHAIN_CATEGORY, Dt as FILE_LINT_CACHE_MAX_FILE_COUNT, En as SUPPLY_CHAIN_CACHE_TTL_MS, Et as FILE_LINT_CACHE_FILENAME, F as lowerChildProcessPriority, Fn as TELEMETRY_SHUTDOWN_TIMEOUT_MS, Ft as GIT_SOURCE_LISTING_ARGUMENTS, G as resolvePluginPath, H as resolveOxlintThreadCount, Ht as MAINTAINABILITY_CATEGORY, In as TSCONFIG_FILENAMES, It as HTML_FILE_PATTERN, J as resolveTsConfigRelativePath, Jt as MINIFIED_SNIFF_BYTES, K as resolveReactDoctorCacheDir, Kt as MAX_GLOB_PATTERN_LENGTH_CHARS, Ln as TYPESCRIPT_DECLARATION_FILE_PATTERN, Lt as IGNORED_DIRECTORIES, M as buildOxlintWorkerSpawnSpec, Mn as TAILWIND_POSTCSS7_COMPAT_ALIAS, Mt as GIT_CHECK_ATTR_MAX_BUFFER_BYTES, Nn as TARGET_BLANK_BROWSER_SUPPORT, Nt as GIT_LS_FILES_MAX_BUFFER_BYTES, On as SUPPLY_CHAIN_IGNORED_PACKAGES, Ot as GENERATED_BUNDLE_FILE_PATTERN, P as killUnadoptedOxlintWorkers, Pn as TELEMETRY_EXPORT_INTERVAL_MS, Pt as GIT_SHOW_MAX_BUFFER_BYTES, Q as takeReactCompilerDetection, Qt as OXLINT_OOM_RESCUE_BUDGET_MS, R as readSystemConcurrencyFacts, Rn as VERCEL_NEXTJS_SECURITY_RELEASE_URL, Rt as JSX_DUPLICATION_SOURCE_FILE_PATTERN, Sn as SPAWN_ARGS_MAX_LENGTH_CHARS_DARWIN, St as DUPLICATE_JSX_WORKER_IDLE_TIMEOUT_MS, Tn as SUPPLY_CHAIN_CACHE_SUBDIR, Tt as FETCH_TIMEOUT_MS, U as resolveOxlintToolchainVersions, Ut as MAINTAINABILITY_DUPLICATE_JSX_RULE, V as resolveOxlintBinary, Vn as VITE_ENTRY_PRELUDE_SNIFF_BYTES, Vt as LINT_LINGUIST_FILENAME, W as resolveOxlintWorkerRuntime, Wt as MAINTAINABILITY_PLUGIN, X as spawnOxlintWorkerProcess, Xt as OXLINT_IGNORED_DECLARATION_DIAGNOSTIC_CODES, Y as setChildProcessRef, Yt as OCCURRENCE_MATCHED_CATEGORIES, Z as takePrespawnedOxlintWorker, _n as SOCKET_FREE_PURL_API_BASE, _t as DEFAULT_BRANCH_CANDIDATES, an as PROJECT_ANALYSIS_WORKER_TIMEOUT_CEILING_MS, bn as SOURCE_FILE_PATTERN, bt as DOCS_RULES_BASE_URL, cn as REACT_ROUTER_CAPABILITY_THRESHOLDS, ct as AXIOM_TRACES_PATH, d as METRIC_DISTRIBUTION_BOUNDARIES, dn as ROOT_CAUSE_GROUPABLE_RULE_KEYS, en as OXLINT_SPAWN_TIMEOUT_MS, et as ABORT_EXIT_CODES, fn as SCANNED_DOT_DIRECTORIES, ft as COMPILER_CLEANUP_BUCKET, hn as SIDECAR_LINT_CACHE_FILENAME, ht as CONFIG_FINGERPRINT_FILENAMES, in as PROJECT_ANALYSIS_WORKER_MEMORY_BUDGET_BYTES, it as AXIOM_DATASET_HEADER, j as buildOxlintChildEnv, jn as SUPPLY_CHAIN_RULE, jt as GITHUB_VIEWER_PERMISSION_TIMEOUT_MS, kn as SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS, kt as GENERATED_SOURCE_DIRECTORY_PATTERN, l as INTERNAL_ERROR_JSON_FALLBACK, ln as REACT_SERVER_DOM_PACKAGES, mt as CONFIG_CACHE_TTL_MS, nn as OXLINT_WORKER_JOB_END_MARKER, nt as ADOPTED_LINT_CONFIG_MAX_BYTES, on as PROJECT_ANALYSIS_WORKER_TIMEOUT_MS, ot as AXIOM_METRICS_DATASET_HEADER, pn as SCORE_API_URL, pt as COMPILER_CLEANUP_RULE_KEYS, q as resolveScanConcurrency, qt as MILLISECONDS_PER_SECOND, rn as PROJECT_ANALYSIS_WORKER_MAX_OLD_SPACE_MB, rt as APP_ONLY_RULE_KEYS, sn as REACT_BLOG_RSC_ADVISORY_URL, st as AXIOM_METRICS_PATH, tn as OXLINT_SPLIT_TOTAL_BUDGET_MS, tt as ADOPTABLE_LINT_CONFIG_FILENAMES, un as RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES, vn as SOCKET_FREE_USER_AGENT, vt as DIAGNOSTIC_CATEGORY_BUCKETS, wn as STAGED_FILES_PROJECT_CONFIG_FILENAMES, wt as ES_TARGET_YEAR_BY_NAME, xn as SPAWN_ARGS_MAX_LENGTH_CHARS, yn as SOCKET_PACKAGE_PAGE_BASE, yt as DISABLE_DIRECTIVE_BACKUP_DIRECTORY_SEGMENTS, z as resolveConfiguredScanConcurrency, zn as VITE_ENTRY_ASSET_FILE_PATTERN } from "./constants-BXN6vJ3T.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";
@@ -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-Z9dhela6.js
91
+ //#region ../core/dist/collect-unplugin-auto-import-global-scopes-nxDYvwKf.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([
@@ -192,6 +192,7 @@ const compileGlobPatternsLenient = (patterns, onInvalid) => {
192
192
  }
193
193
  return compiled;
194
194
  };
195
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
195
196
  const isOxcAstNode = (value) => Boolean(value) && typeof value === "object" && typeof value.type === "string";
196
197
  const getStaticModuleSpecifier = (value) => {
197
198
  if (!isOxcAstNode(value)) return void 0;
@@ -526,7 +527,7 @@ const collectUnpluginAutoImportGlobalScopes = ({ rootDirectory, candidateFiles }
526
527
  return scopes.some((scope) => scope.names.length > 0) ? scopes : [];
527
528
  };
528
529
  //#endregion
529
- //#region ../core/dist/detect-duplicate-jsx-subtrees-B5UWtUyz.js
530
+ //#region ../core/dist/detect-duplicate-jsx-subtrees-DKRoO0e9.js
530
531
  const yieldToEventLoop = () => new Promise((resolve) => {
531
532
  setImmediate(resolve);
532
533
  });
@@ -1090,7 +1091,7 @@ const detectDuplicateJsxSubtreesCooperative = async (sourceReader, options = {})
1090
1091
  });
1091
1092
  };
1092
1093
  //#endregion
1093
- //#region ../core/dist/detect-react-compiler-DLpaU8gr.js
1094
+ //#region ../core/dist/detect-react-compiler-B2QVSnc0.js
1094
1095
  const NEXT_CONFIG_FILENAMES = [
1095
1096
  "next.config.js",
1096
1097
  "next.config.mjs",
@@ -9718,7 +9719,7 @@ const orDie$1 = (self) => catch_$2(self, die$1);
9718
9719
  /** @internal */
9719
9720
  const orElseSucceed$1 = /* @__PURE__ */ dual(2, (self, f) => catch_$2(self, (_) => sync$2(f)));
9720
9721
  /** @internal */
9721
- const ignore$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, options) => {
9722
+ const ignore$2 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, options) => {
9722
9723
  if (!options?.log) return matchEffect$2(self, {
9723
9724
  onFailure: (_) => void_$2,
9724
9725
  onSuccess: (_) => void_$2
@@ -15759,7 +15760,7 @@ const retry = retry$1;
15759
15760
  * @category error handling
15760
15761
  * @since 2.0.0
15761
15762
  */
15762
- const ignore = ignore$1;
15763
+ const ignore$1 = ignore$2;
15763
15764
  /**
15764
15765
  * Recovers from a typed failure by producing a fallback success value.
15765
15766
  *
@@ -60339,7 +60340,7 @@ const make$8 = /* @__PURE__ */ fnUntraced(function* (options) {
60339
60340
  if (disabledUntil !== void 0) return void_;
60340
60341
  runExportFork(runExport);
60341
60342
  return awaitEmpty(exportFibers);
60342
- }).pipe(ignore, interruptible, timeoutOption(options.shutdownTimeout)));
60343
+ }).pipe(ignore$1, interruptible, timeoutOption(options.shutdownTimeout)));
60343
60344
  yield* sleep(exportInterval).pipe(andThen(run(exportFibers, runExport)), flatMap$2(await_), forever, forkIn(scope));
60344
60345
  return { push(data) {
60345
60346
  if (disabledUntil !== void 0) return;
@@ -63009,11 +63010,11 @@ const layer$2 = /* @__PURE__ */ effect(ChildProcessSpawner, /* @__PURE__ */ gen(
63009
63010
  const killWithTimeout = withTimeout(childProcess, cmd, cmd.options);
63010
63011
  if (exited) {
63011
63012
  const [code] = yield* _await(exitSignal);
63012
- if (code !== 0 && isNotNull(code)) return yield* ignore(killWithTimeout(killProcessGroup));
63013
+ if (code !== 0 && isNotNull(code)) return yield* ignore$1(killWithTimeout(killProcessGroup));
63013
63014
  return yield* void_;
63014
63015
  }
63015
63016
  if (!isReferenced) return yield* void_;
63016
- return yield* killWithTimeout((command, childProcess, signal) => killProcessGroup(command, childProcess, signal).pipe(catch_$1(() => killProcess(command, childProcess, signal)), andThen(_await(exitSignal)))).pipe(ignore);
63017
+ return yield* killWithTimeout((command, childProcess, signal) => killProcessGroup(command, childProcess, signal).pipe(catch_$1(() => killProcess(command, childProcess, signal)), andThen(_await(exitSignal)))).pipe(ignore$1);
63017
63018
  }));
63018
63019
  const pid = ProcessId(childProcess.pid);
63019
63020
  childProcess.on("exit", (code) => {
@@ -63559,6 +63560,571 @@ const layer = /* @__PURE__ */ succeed$3(Path)({
63559
63560
  });
63560
63561
  //#endregion
63561
63562
  //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
63563
+ var import_ignore = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
63564
+ function makeArray(subject) {
63565
+ return Array.isArray(subject) ? subject : [subject];
63566
+ }
63567
+ const UNDEFINED = void 0;
63568
+ const EMPTY = "";
63569
+ const SPACE = " ";
63570
+ const ESCAPE = "\\";
63571
+ const REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
63572
+ const BOM = "";
63573
+ const REGEX_ANCHORED_GLOBSTAR = /^\/\*{2,}$/;
63574
+ const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
63575
+ const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
63576
+ const REGEX_SPLITALL_CRLF = /\r?\n/g;
63577
+ const DOUBLE_SLASH = "//";
63578
+ const SLASH_CODE = 47;
63579
+ const DOT_CODE = 46;
63580
+ const SLASH = "/";
63581
+ let TMP_KEY_IGNORE = "node-ignore";
63582
+ /* istanbul ignore else */
63583
+ if (typeof Symbol !== "undefined") TMP_KEY_IGNORE = Symbol.for("node-ignore");
63584
+ const KEY_IGNORE = TMP_KEY_IGNORE;
63585
+ const define = (object, key, value) => {
63586
+ Object.defineProperty(object, key, { value });
63587
+ return value;
63588
+ };
63589
+ const RETURN_FALSE = () => false;
63590
+ const POSIX_CLASSES = {
63591
+ alnum: "0-9A-Za-z",
63592
+ alpha: "A-Za-z",
63593
+ blank: " \\t",
63594
+ cntrl: "\\x00-\\x1f\\x7f",
63595
+ digit: "0-9",
63596
+ graph: "!-.0-~",
63597
+ lower: "a-z",
63598
+ print: " -.0-~",
63599
+ punct: "!-.:-@\\[-`{-~",
63600
+ space: " \\t\\n\\r",
63601
+ upper: "A-Z",
63602
+ xdigit: "0-9A-Fa-f"
63603
+ };
63604
+ const CLASS_MEMBERS_TO_ESCAPE = "\\]^-[";
63605
+ const escapeMember = (char) => CLASS_MEMBERS_TO_ESCAPE.indexOf(char) < 0 ? char : ESCAPE + char;
63606
+ const NON_SLASH = "(?!\\/)";
63607
+ const classSource = (negated, body) => {
63608
+ if (negated) return `[^\\/${body}]`;
63609
+ const source = `[${body}]`;
63610
+ return new RegExp(source).test("/") ? NON_SLASH + source : source;
63611
+ };
63612
+ const scanBracket = (pattern, start) => {
63613
+ const { length } = pattern;
63614
+ let index = start + 1;
63615
+ let negated = EMPTY;
63616
+ const lead = pattern[index];
63617
+ if (lead === "!" || lead === "^") {
63618
+ negated = "^";
63619
+ index++;
63620
+ }
63621
+ let body = EMPTY;
63622
+ let prev = EMPTY;
63623
+ for (;;) {
63624
+ const char = pattern[index];
63625
+ if (char === UNDEFINED) return null;
63626
+ if (char === ESCAPE) {
63627
+ const escaped = pattern[++index];
63628
+ body += escapeMember(escaped);
63629
+ prev = escaped;
63630
+ } else if (char === "-" && prev && index + 1 < length && pattern[index + 1] !== "]") {
63631
+ index++;
63632
+ let to = pattern[index];
63633
+ if (to === ESCAPE) to = pattern[index += 1];
63634
+ if (prev <= to) body += `-${escapeMember(to)}`;
63635
+ prev = EMPTY;
63636
+ } else if (char === "[" && pattern[index + 1] === ":") {
63637
+ const nameStart = index + 2;
63638
+ let end = nameStart;
63639
+ while (end < length && pattern[end] !== "]") end++;
63640
+ if (end === length) return null;
63641
+ if (end > nameStart && pattern[end - 1] === ":") {
63642
+ const name = pattern.slice(nameStart, end - 1);
63643
+ if (!Object.prototype.hasOwnProperty.call(POSIX_CLASSES, name)) return null;
63644
+ body += POSIX_CLASSES[name];
63645
+ prev = EMPTY;
63646
+ index = end;
63647
+ } else {
63648
+ body += escapeMember("[");
63649
+ prev = "[";
63650
+ index = nameStart - 2;
63651
+ }
63652
+ } else {
63653
+ body += escapeMember(char);
63654
+ prev = char;
63655
+ }
63656
+ index++;
63657
+ if (pattern[index] === "]") return {
63658
+ end: index,
63659
+ source: classSource(negated, body)
63660
+ };
63661
+ }
63662
+ };
63663
+ const NEVER_MATCH = "[]";
63664
+ const PLACEHOLDER = "\0";
63665
+ const REGEX_RESTORE_PLACEHOLDER = new RegExp(`${PLACEHOLDER}(\\d+)${PLACEHOLDER}`, "g");
63666
+ const TRAILING_WILDCARD = "";
63667
+ const TRAILING_DOUBLESTAR = "";
63668
+ const isReserved = (char) => char === PLACEHOLDER || char === TRAILING_WILDCARD || char === TRAILING_DOUBLESTAR;
63669
+ const extractBrackets = (pattern) => {
63670
+ const sources = [];
63671
+ const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
63672
+ const { length } = pattern;
63673
+ let out = EMPTY;
63674
+ let index = 0;
63675
+ while (index < length) {
63676
+ const char = pattern[index];
63677
+ if (char === ESCAPE) {
63678
+ const escaped = pattern[index + 1];
63679
+ if (escaped === SLASH && index + 2 === length) out += hold(NEVER_MATCH);
63680
+ else if (escaped === "*" || escaped === "[" || escaped === SPACE) out += pattern.slice(index, index + 2);
63681
+ else out += hold(REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : isReserved(escaped) ? `[${escaped}]` : escaped);
63682
+ index += 2;
63683
+ } else if (isReserved(char)) {
63684
+ out += hold(`[${char}]`);
63685
+ index++;
63686
+ } else if (char === "[") {
63687
+ const scanned = scanBracket(pattern, index);
63688
+ if (scanned === null) {
63689
+ out += hold(NEVER_MATCH);
63690
+ index = length;
63691
+ } else {
63692
+ out += hold(scanned.source);
63693
+ index = scanned.end + 1;
63694
+ }
63695
+ } else {
63696
+ out += char;
63697
+ index++;
63698
+ }
63699
+ }
63700
+ return {
63701
+ source: out,
63702
+ sources
63703
+ };
63704
+ };
63705
+ const DIRECT = null;
63706
+ const REGEX_INNER_SLASH = /\/(?!$)/;
63707
+ const WILDCARD = "[^\\/]*";
63708
+ const REPLACERS = [
63709
+ [
63710
+ /(\\+)( ?)/g,
63711
+ (_, run, space) => space ? run.slice(0, run.length - run.length % 2) + SPACE : run,
63712
+ ESCAPE + SPACE
63713
+ ],
63714
+ [
63715
+ /(^|\/)\*{3,}(?=\/|$)/g,
63716
+ (_, start) => `${start}**`,
63717
+ "*"
63718
+ ],
63719
+ [/[\\$.|*+(){^]/g, (match) => `\\${match}`],
63720
+ [
63721
+ /(?!\\)\?/g,
63722
+ () => "[^/]",
63723
+ "?"
63724
+ ],
63725
+ [
63726
+ /^\//,
63727
+ () => "^",
63728
+ SLASH
63729
+ ],
63730
+ [
63731
+ /\//g,
63732
+ () => "\\/",
63733
+ SLASH
63734
+ ],
63735
+ [
63736
+ /^\^*(?:\\\*\\\*\\\/)+/,
63737
+ () => "(?:^|\\/)",
63738
+ "*"
63739
+ ],
63740
+ [DIRECT, (source, pattern) => {
63741
+ if (!source || source[0] === "^" || source[0] === "(") return source;
63742
+ return (!REGEX_INNER_SLASH.test(pattern) ? "(?:^|\\/)" : "^") + source;
63743
+ }],
63744
+ [
63745
+ /\\\/\\\*\\\*(?=\\\/|$)/g,
63746
+ (_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : `\\/${TRAILING_DOUBLESTAR}`,
63747
+ "*"
63748
+ ],
63749
+ [
63750
+ /(^|[^\\])(?:\\\*)+(?!$)/g,
63751
+ (_, p1) => p1 + WILDCARD,
63752
+ "*"
63753
+ ],
63754
+ [
63755
+ /(^|[^\\])((?:\\\\)*)\\\*$/,
63756
+ (match, p1, p2) => p2 === EMPTY ? p1 + TRAILING_WILDCARD : match,
63757
+ "*"
63758
+ ],
63759
+ [
63760
+ /\\\\\\(?=[$.|*+(){^])/g,
63761
+ () => ESCAPE,
63762
+ ESCAPE + ESCAPE
63763
+ ],
63764
+ [
63765
+ /\\\\/g,
63766
+ () => ESCAPE,
63767
+ ESCAPE + ESCAPE
63768
+ ],
63769
+ [
63770
+ /\\\[([^\]/]*?)($|\])/g,
63771
+ (match, range, close) => `\\[${range}${close}`,
63772
+ "["
63773
+ ],
63774
+ [DIRECT, (source) => {
63775
+ const last = source[source.length - 1];
63776
+ if (!last || last === TRAILING_WILDCARD || last === TRAILING_DOUBLESTAR) return source;
63777
+ return last === SLASH ? `${source}$` : `${source}(?=$|\\/$)`;
63778
+ }]
63779
+ ];
63780
+ const REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\uE000$/;
63781
+ const MODE_IGNORE = "regex";
63782
+ const MODE_CHECK_IGNORE = "checkRegex";
63783
+ const UNDERSCORE = "_";
63784
+ const replaceTrailingWildcard = (_, p1) => {
63785
+ return `${p1 ? `${p1}[^/]+` : "[^/]*"}(?=$|\\/$)`;
63786
+ };
63787
+ const REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
63788
+ const replaceTrailingDoublestar = () => "[\\s\\S]";
63789
+ const separatorAfter = (run, at) => {
63790
+ let separator = EMPTY;
63791
+ for (let index = at + 1; index < run.length && !run[index].wildcard; index++) separator += run[index].single;
63792
+ return separator;
63793
+ };
63794
+ const pinWildcards = (source) => {
63795
+ if (source.indexOf(WILDCARD) < 0) return source;
63796
+ const tokens = [];
63797
+ const { length } = source;
63798
+ let index = 0;
63799
+ while (index < length) {
63800
+ const char = source[index];
63801
+ if (source.startsWith(WILDCARD, index)) {
63802
+ tokens.push({ wildcard: true });
63803
+ index += 6;
63804
+ } else if (char === "[") {
63805
+ let end = index + 1;
63806
+ if (source[end] === "^") end++;
63807
+ if (source[end] === "]") end++;
63808
+ while (end < length && source[end] !== "]") end += source[end] === ESCAPE ? 2 : 1;
63809
+ end++;
63810
+ tokens.push({ single: source.slice(index, end) });
63811
+ index = end;
63812
+ } else if (char === ESCAPE) {
63813
+ tokens.push({ single: source.slice(index, index + 2) });
63814
+ index += 2;
63815
+ } else if (char === "(") {
63816
+ let depth = 0;
63817
+ let end = index;
63818
+ do {
63819
+ if (source[end] === ESCAPE) end++;
63820
+ else if (source[end] === "(") depth++;
63821
+ else if (source[end] === ")") depth--;
63822
+ end++;
63823
+ } while (end < length && depth > 0);
63824
+ if ("*+?".indexOf(source[end]) >= 0) end++;
63825
+ tokens.push({ boundary: source.slice(index, end) });
63826
+ index = end;
63827
+ } else if (char === "^" || char === "$") {
63828
+ tokens.push({ boundary: char });
63829
+ index++;
63830
+ } else {
63831
+ tokens.push({ single: char });
63832
+ index++;
63833
+ }
63834
+ }
63835
+ let out = EMPTY;
63836
+ let run = [];
63837
+ const flush = () => {
63838
+ let lastWildcard;
63839
+ run.forEach((token, at) => {
63840
+ if (token.wildcard) lastWildcard = at;
63841
+ });
63842
+ run.forEach((token, at) => {
63843
+ if (!token.wildcard) {
63844
+ out += token.single;
63845
+ return;
63846
+ }
63847
+ out += at === lastWildcard ? WILDCARD : `(?:(?!${separatorAfter(run, at)})[^\\/])*`;
63848
+ });
63849
+ run = [];
63850
+ };
63851
+ tokens.forEach((token) => {
63852
+ if (token.boundary === void 0) {
63853
+ run.push(token);
63854
+ return;
63855
+ }
63856
+ flush();
63857
+ out += token.boundary;
63858
+ });
63859
+ flush();
63860
+ return out;
63861
+ };
63862
+ const makeRegexPrefix = (pattern) => {
63863
+ if (REGEX_ANCHORED_GLOBSTAR.test(pattern)) pattern = "**";
63864
+ const { source, sources } = extractBrackets(pattern);
63865
+ const replaced = REPLACERS.reduce((prev, [matcher, replacer, required]) => {
63866
+ if (matcher === DIRECT) return replacer(prev, pattern);
63867
+ if (required !== UNDEFINED && prev.indexOf(required) < 0) return prev;
63868
+ return matcher.test(prev) ? prev.replace(matcher, replacer.bind(pattern)) : prev;
63869
+ }, source);
63870
+ return sources.length ? replaced.replace(REGEX_RESTORE_PLACEHOLDER, (match, index) => sources[index]) : replaced;
63871
+ };
63872
+ const checkSourceOf = (body, prefix) => {
63873
+ if (body[body.length - 1] === SLASH) prefix = makeRegexPrefix(body.slice(0, -1));
63874
+ const head = prefix.slice(0, -1);
63875
+ const last = prefix[prefix.length - 1];
63876
+ return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? head : NEVER_MATCH;
63877
+ };
63878
+ const matchesBasename = (body) => {
63879
+ const index = body.indexOf(SLASH);
63880
+ return index < 0 || index === body.length - 1;
63881
+ };
63882
+ const basenameOf = (path) => {
63883
+ const end = path.length - 1;
63884
+ const index = path.lastIndexOf(SLASH, path[end] === SLASH ? end - 1 : end);
63885
+ return index < 0 ? path : path.slice(index + 1);
63886
+ };
63887
+ const parentOf = (path) => {
63888
+ if (path.charCodeAt(0) === SLASH_CODE || path.indexOf(DOUBLE_SLASH) >= 0) {
63889
+ const slices = path.split(SLASH).filter(Boolean);
63890
+ slices.pop();
63891
+ return slices.length ? slices.join(SLASH) + SLASH : EMPTY;
63892
+ }
63893
+ const end = path.length - 1;
63894
+ const cut = path.lastIndexOf(SLASH, path.charCodeAt(end) === SLASH_CODE ? end - 1 : end);
63895
+ return cut < 0 ? EMPTY : path.slice(0, cut + 1);
63896
+ };
63897
+ const isString = (subject) => typeof subject === "string";
63898
+ const checkPattern = (pattern) => pattern && isString(pattern);
63899
+ const splitPattern = (pattern) => (pattern[pattern.length - 1] === "\r" ? pattern.slice(0, -1) : pattern).split(REGEX_SPLITALL_CRLF).filter(Boolean);
63900
+ var IgnoreRule = class {
63901
+ constructor(pattern, mark, body, ignoreCase, negative, prefix) {
63902
+ this.pattern = pattern;
63903
+ this.mark = mark;
63904
+ this.negative = negative;
63905
+ define(this, "body", body);
63906
+ define(this, "ignoreCase", ignoreCase);
63907
+ define(this, "regexPrefix", prefix);
63908
+ }
63909
+ get _basenameOnly() {
63910
+ return define(this, "_basenameOnly", matchesBasename(this.body));
63911
+ }
63912
+ get regex() {
63913
+ const key = UNDERSCORE + MODE_IGNORE;
63914
+ if (this[key]) return this[key];
63915
+ return this._make(MODE_IGNORE, key);
63916
+ }
63917
+ get checkRegex() {
63918
+ const key = UNDERSCORE + MODE_CHECK_IGNORE;
63919
+ if (this[key]) return this[key];
63920
+ return this._make(MODE_CHECK_IGNORE, key);
63921
+ }
63922
+ _make(mode, key) {
63923
+ const str = pinWildcards(mode === MODE_IGNORE ? this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, replaceTrailingWildcard).replace(REGEX_REPLACE_TRAILING_DOUBLESTAR, replaceTrailingDoublestar) : checkSourceOf(this.body, this.regexPrefix));
63924
+ const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
63925
+ return define(this, key, regex);
63926
+ }
63927
+ };
63928
+ const hasTrailingBackslash = (str) => {
63929
+ let count = 0;
63930
+ while (str[str.length - count - 1] === ESCAPE) count++;
63931
+ return count % 2 === 1;
63932
+ };
63933
+ const trimEnd = (body, stripLineEnd) => {
63934
+ let lineEnd = body.length;
63935
+ let end;
63936
+ for (;;) {
63937
+ if (stripLineEnd && body[lineEnd - 1] === "\r") lineEnd--;
63938
+ end = lineEnd;
63939
+ while (body[end - 1] === SPACE) end--;
63940
+ if (!stripLineEnd || body[end - 1] !== "\n") break;
63941
+ lineEnd = end - 1;
63942
+ }
63943
+ if (end === lineEnd) return body.slice(0, lineEnd);
63944
+ let backslashes = 0;
63945
+ while (body[end - backslashes - 1] === ESCAPE) backslashes++;
63946
+ return backslashes % 2 ? body.slice(0, end - 1) + SPACE : body.slice(0, end);
63947
+ };
63948
+ const createRule = (pattern, mark, ignoreCase, stripLineEnd, stripBOM) => {
63949
+ let body = stripBOM && pattern[0] === BOM ? pattern.slice(1) : pattern;
63950
+ if (body[0] === "#") return;
63951
+ let negative = false;
63952
+ if (body[0] === "!") {
63953
+ negative = true;
63954
+ body = body.slice(1);
63955
+ }
63956
+ const last = body[body.length - 1];
63957
+ if (last === SPACE || stripLineEnd && (last === "\r" || last === "\n")) body = trimEnd(body, stripLineEnd);
63958
+ if (!body || hasTrailingBackslash(body)) return;
63959
+ body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
63960
+ const regexPrefix = makeRegexPrefix(body);
63961
+ return new IgnoreRule(pattern, mark, body, ignoreCase, negative, regexPrefix);
63962
+ };
63963
+ var RuleManager = class {
63964
+ constructor(ignoreCase) {
63965
+ this._ignoreCase = ignoreCase;
63966
+ this._rules = [];
63967
+ this._basenameCount = 0;
63968
+ }
63969
+ _add(pattern, index) {
63970
+ if (pattern && pattern[KEY_IGNORE]) {
63971
+ this._rules = this._rules.concat(pattern._rules._rules);
63972
+ this._basenameCount += pattern._rules._basenameCount;
63973
+ this._added = true;
63974
+ return;
63975
+ }
63976
+ const isStr = isString(pattern);
63977
+ const raw = isStr ? pattern : pattern.pattern;
63978
+ const rule = checkPattern(raw) && createRule(raw, isStr ? UNDEFINED : pattern.mark, this._ignoreCase, !this._split, this._stripBOM && !index);
63979
+ if (rule) {
63980
+ this._added = true;
63981
+ this._rules.push(rule);
63982
+ if (matchesBasename(rule.body)) this._basenameCount++;
63983
+ }
63984
+ }
63985
+ add(pattern) {
63986
+ this._added = false;
63987
+ this._split = isString(pattern);
63988
+ this._stripBOM = !this._split || pattern[0] === BOM;
63989
+ makeArray(this._split ? splitPattern(pattern) : pattern).forEach(this._add, this);
63990
+ if (this._added) this._literalRules = UNDEFINED;
63991
+ return this._added;
63992
+ }
63993
+ testLiteral(path) {
63994
+ const rules = this._literalRules || (this._literalRules = this._rules.filter(({ body }) => body[body.length - (body[body.length - 1] === SLASH ? 2 : 1)] === "*"));
63995
+ let ignored = false;
63996
+ let unignored = false;
63997
+ let matchedRule;
63998
+ for (let index = rules.length - 1; index >= 0; index--) {
63999
+ const rule = rules[index];
64000
+ if (rule.checkRegex.test(path)) {
64001
+ ignored = !rule.negative;
64002
+ unignored = rule.negative;
64003
+ matchedRule = rule.negative ? UNDEFINED : rule;
64004
+ break;
64005
+ }
64006
+ }
64007
+ const ret = {
64008
+ ignored,
64009
+ unignored
64010
+ };
64011
+ if (matchedRule) ret.rule = matchedRule;
64012
+ return ret;
64013
+ }
64014
+ test(path, mode) {
64015
+ const rules = this._rules;
64016
+ const { length } = rules;
64017
+ const shortcut = this._basenameCount * 2 >= length;
64018
+ const basename = shortcut ? basenameOf(path) : path;
64019
+ for (let index = length - 1; index >= 0; index--) {
64020
+ const rule = rules[index];
64021
+ if (rule[mode].test(shortcut && rule._basenameOnly ? basename : path)) {
64022
+ const { negative } = rule;
64023
+ const ret = {
64024
+ ignored: !negative,
64025
+ unignored: negative
64026
+ };
64027
+ if (!negative) ret.rule = rule;
64028
+ return ret;
64029
+ }
64030
+ }
64031
+ return {
64032
+ ignored: false,
64033
+ unignored: false
64034
+ };
64035
+ }
64036
+ };
64037
+ const throwError = (message, Ctor) => {
64038
+ throw new Ctor(message);
64039
+ };
64040
+ const checkPath = (path, originalPath, doThrow) => {
64041
+ if (!isString(path)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
64042
+ if (!path) return doThrow(`path must not be empty`, TypeError);
64043
+ if (checkPath.isNotRelative(path)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
64044
+ return true;
64045
+ };
64046
+ const isNotRelative = (path) => {
64047
+ const first = path.charCodeAt(0);
64048
+ if (first === SLASH_CODE) return true;
64049
+ if (first !== DOT_CODE) return false;
64050
+ if (path.length === 1) return true;
64051
+ const second = path.charCodeAt(1);
64052
+ if (second === SLASH_CODE) return true;
64053
+ if (second !== DOT_CODE) return false;
64054
+ return path.length === 2 || path.charCodeAt(2) === SLASH_CODE;
64055
+ };
64056
+ checkPath.isNotRelative = isNotRelative;
64057
+ /* istanbul ignore next */
64058
+ checkPath.convert = (p) => p;
64059
+ const convertPath = (target) => isString(target) && checkPath.convert(target);
64060
+ var Ignore = class {
64061
+ constructor({ ignorecase = true, ignoreCase = ignorecase, allowRelativePaths = false } = {}) {
64062
+ define(this, KEY_IGNORE, true);
64063
+ this._rules = new RuleManager(ignoreCase);
64064
+ this._strictPathCheck = !allowRelativePaths;
64065
+ this._initCache();
64066
+ }
64067
+ _initCache() {
64068
+ this._ignoreCache = Object.create(null);
64069
+ this._testCache = Object.create(null);
64070
+ }
64071
+ add(pattern) {
64072
+ if (this._rules.add(pattern)) this._initCache();
64073
+ return this;
64074
+ }
64075
+ addPattern(pattern) {
64076
+ return this.add(pattern);
64077
+ }
64078
+ _test(originalPath, cache, path) {
64079
+ checkPath(path, originalPath, this._strictPathCheck ? throwError : RETURN_FALSE);
64080
+ return path ? this._t(path, cache) : {
64081
+ ignored: false,
64082
+ unignored: false
64083
+ };
64084
+ }
64085
+ checkIgnore(target) {
64086
+ const path = convertPath(target);
64087
+ if (!path || path.charCodeAt(path.length - 1) !== SLASH_CODE) return this._test(target, this._testCache, path);
64088
+ const dir = this._t(path, this._testCache);
64089
+ if (dir.ignored) return dir;
64090
+ const literal = this._rules.testLiteral(path);
64091
+ return literal.ignored || literal.unignored ? literal : dir;
64092
+ }
64093
+ _t(path, cache) {
64094
+ if (path in cache) return cache[path];
64095
+ const parentPath = parentOf(path);
64096
+ const parent = parentPath ? this._t(parentPath, cache) : UNDEFINED;
64097
+ return cache[path] = parent && parent.ignored ? parent : this._rules.test(path, MODE_IGNORE);
64098
+ }
64099
+ ignores(path) {
64100
+ return this._test(path, this._ignoreCache, convertPath(path)).ignored;
64101
+ }
64102
+ createFilter() {
64103
+ return (path) => !this.ignores(path);
64104
+ }
64105
+ filter(paths) {
64106
+ return makeArray(paths).filter(this.createFilter());
64107
+ }
64108
+ test(path) {
64109
+ return this._test(path, this._testCache, convertPath(path));
64110
+ }
64111
+ };
64112
+ const factory = (options) => new Ignore(options);
64113
+ const isPathValid = (path) => checkPath(convertPath(path), path, RETURN_FALSE);
64114
+ /* istanbul ignore next */
64115
+ const setupWindows = () => {
64116
+ const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
64117
+ checkPath.convert = makePosix;
64118
+ const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
64119
+ checkPath.isNotRelative = (path) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
64120
+ };
64121
+ /* istanbul ignore next */
64122
+ if (typeof process !== "undefined" && process.platform === "win32") setupWindows();
64123
+ module.exports = factory;
64124
+ factory.default = factory;
64125
+ module.exports.isPathValid = isPathValid;
64126
+ define(module.exports, Symbol.for("setupWindows"), setupWindows);
64127
+ })))(), 1);
63562
64128
  var comma = ",".charCodeAt(0);
63563
64129
  ";".charCodeAt(0);
63564
64130
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -64077,17 +64643,19 @@ const collectTypeScriptEmitDuplicateJsPaths = (input) => {
64077
64643
  const isIgnoredDirectoryName = (directoryName) => IGNORED_DIRECTORIES.has(directoryName) || directoryName.startsWith(".") && !SCANNED_DOT_DIRECTORIES.has(directoryName);
64078
64644
  const hasIgnoredPathSegment = (relativePath) => relativePath.split(/[/\\]/).slice(0, -1).some((segment) => isIgnoredDirectoryName(segment));
64079
64645
  const isLintableSourceFile = (filePath) => SOURCE_FILE_PATTERN.test(filePath) && !GENERATED_BUNDLE_FILE_PATTERN.test(filePath) && !GENERATED_SOURCE_DIRECTORY_PATTERN.test(filePath);
64646
+ const hasMinifiedSample = (sample) => {
64647
+ const lines = sample.split("\n");
64648
+ const longestLineLength = lines.reduce((longest, line) => Math.max(longest, line.length), 0);
64649
+ const averageLineLength = sample.length / lines.length;
64650
+ return longestLineLength > 1e3 && averageLineLength > 500;
64651
+ };
64080
64652
  const isMinifiedSource = (absolutePath) => {
64081
64653
  let fileDescriptor;
64082
64654
  try {
64083
64655
  fileDescriptor = fs$1$2.openSync(absolutePath, "r");
64084
64656
  const buffer = Buffer.alloc(MINIFIED_SNIFF_BYTES);
64085
64657
  const bytesRead = fs$1$2.readSync(fileDescriptor, buffer, 0, MINIFIED_SNIFF_BYTES, 0);
64086
- const prefix = buffer.toString("utf8", 0, bytesRead);
64087
- const lines = prefix.split("\n");
64088
- const longestLineLength = lines.reduce((longest, line) => Math.max(longest, line.length), 0);
64089
- const averageLineLength = prefix.length / lines.length;
64090
- return longestLineLength > 1e3 && averageLineLength > 500;
64658
+ return hasMinifiedSample(buffer.toString("utf8", 0, bytesRead));
64091
64659
  } catch {
64092
64660
  return false;
64093
64661
  } finally {
@@ -64110,6 +64678,37 @@ const isLargeMinifiedFile = (absolutePath, knownSizeBytes) => {
64110
64678
  cachedIsLargeMinifiedByPath.set(absolutePath, result);
64111
64679
  return result;
64112
64680
  };
64681
+ const MODULE_PRELOAD_POLYFILL_START = /^\(function\(\)\{(?:const|let|var) [\w$]+=document\.createElement\((?:"link"|'link')\)\.relList;/;
64682
+ const MODULE_PRELOAD_POLYFILL_MARKERS = [
64683
+ /\.supports\((?:"modulepreload"|'modulepreload')\)/,
64684
+ /document\.querySelectorAll\([^)]*link\[rel=["']modulepreload["']\]/,
64685
+ /new MutationObserver\(/,
64686
+ /\.observe\(document,/
64687
+ ];
64688
+ const isMinifiedViteEntry = (absolutePath, knownSizeBytes) => {
64689
+ if (!VITE_ENTRY_ASSET_FILE_PATTERN.test(absolutePath)) return false;
64690
+ const sizeBytes = knownSizeBytes === void 0 ? statSourceFileSize(absolutePath) : knownSizeBytes;
64691
+ if (sizeBytes === null || sizeBytes < 131072) return false;
64692
+ let fileDescriptor;
64693
+ try {
64694
+ fileDescriptor = fs$1$2.openSync(absolutePath, "r");
64695
+ const buffer = Buffer.alloc(VITE_ENTRY_DENSITY_SAMPLE_BYTES);
64696
+ const preludeBytesRead = fs$1$2.readSync(fileDescriptor, buffer, 0, VITE_ENTRY_PRELUDE_SNIFF_BYTES, 0);
64697
+ const prelude = buffer.toString("utf8", 0, preludeBytesRead);
64698
+ const polyfillEndOffset = prelude.indexOf("})();");
64699
+ if (polyfillEndOffset === -1) return false;
64700
+ const polyfill = prelude.slice(0, polyfillEndOffset);
64701
+ if (!MODULE_PRELOAD_POLYFILL_START.test(polyfill) || !MODULE_PRELOAD_POLYFILL_MARKERS.every((marker) => marker.test(polyfill))) return false;
64702
+ const middleOffset = Math.max(MINIFIED_SNIFF_BYTES, Math.floor((sizeBytes - VITE_ENTRY_DENSITY_SAMPLE_BYTES) / 2));
64703
+ const tailOffset = sizeBytes - VITE_ENTRY_DENSITY_SAMPLE_BYTES;
64704
+ for (const offset of [middleOffset, tailOffset]) if (fs$1$2.readSync(fileDescriptor, buffer, 0, 32768, offset) !== 32768 || !hasMinifiedSample(buffer.toString("utf8"))) return false;
64705
+ return true;
64706
+ } catch {
64707
+ return false;
64708
+ } finally {
64709
+ if (fileDescriptor !== void 0) fs$1$2.closeSync(fileDescriptor);
64710
+ }
64711
+ };
64113
64712
  const isMissingPath = (absolutePath) => {
64114
64713
  try {
64115
64714
  fs$1$2.statSync(absolutePath);
@@ -64140,7 +64739,7 @@ const toSizedSourceFileEntry = (rootDirectory, relativePath) => {
64140
64739
  const absolutePath = path$1$1.resolve(rootDirectory, relativePath);
64141
64740
  const sizeBytes = statSourceFileSize(absolutePath);
64142
64741
  if (sizeBytes === null && isMissingPath(absolutePath)) return null;
64143
- if (isLargeMinifiedFile(absolutePath, sizeBytes)) return null;
64742
+ if (isLargeMinifiedFile(absolutePath, sizeBytes) || isMinifiedViteEntry(absolutePath, sizeBytes)) return null;
64144
64743
  return {
64145
64744
  path: relativePath,
64146
64745
  sizeBytes: sizeBytes ?? 0
@@ -67807,7 +68406,6 @@ const DEFAULT_SURFACE_EXCLUDED_TAGS = {
67807
68406
  score: ["design"],
67808
68407
  ciFailure: ["design"]
67809
68408
  };
67810
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
67811
68409
  const KNOWN_RULE_KEYS = new Set([...ALL_REACT_DOCTOR_RULE_KEYS, ...EXTERNAL_RULES.map((rule) => rule.key)]);
67812
68410
  const BUNDLED_RULE_NAMESPACES = new Set([...KNOWN_RULE_KEYS].flatMap(getEquivalentRuleKeys).map((key) => key.slice(0, key.lastIndexOf("/"))));
67813
68411
  const getUnknownBundledRuleKeys = (rules) => Object.keys(rules ?? {}).filter((key) => {
@@ -67983,6 +68581,32 @@ const validateSeverityMap = (fieldName, rawMap, keysAreCategories = false) => {
67983
68581
  }
67984
68582
  return validated;
67985
68583
  };
68584
+ const ONLY_EXPORT_COMPONENTS_STRING_ARRAY_KEYS = ["allowExportNames", "customHOCs"];
68585
+ const ONLY_EXPORT_COMPONENTS_BOOLEAN_KEYS = ["allowConstantExport", "checkJS"];
68586
+ const validateOnlyExportComponentsField = (rawOptions) => {
68587
+ if (!isRecord(rawOptions)) {
68588
+ warnConfigIssue(`config field "onlyExportComponents" must be an object (got ${typeof rawOptions}); ignoring this field.`);
68589
+ return;
68590
+ }
68591
+ const validated = {};
68592
+ for (const [key, value] of Object.entries(rawOptions)) {
68593
+ const fieldName = `onlyExportComponents.${key}`;
68594
+ const stringArrayKey = ONLY_EXPORT_COMPONENTS_STRING_ARRAY_KEYS.find((candidateKey) => candidateKey === key);
68595
+ if (stringArrayKey !== void 0) {
68596
+ const entries = validateStringArrayField(fieldName, value);
68597
+ if (entries !== void 0) validated[stringArrayKey] = entries;
68598
+ continue;
68599
+ }
68600
+ const booleanKey = ONLY_EXPORT_COMPONENTS_BOOLEAN_KEYS.find((candidateKey) => candidateKey === key);
68601
+ if (booleanKey !== void 0) {
68602
+ const flag = coerceMaybeBooleanString(fieldName, value);
68603
+ if (flag !== void 0) validated[booleanKey] = flag;
68604
+ continue;
68605
+ }
68606
+ warnConfigIssue(`config field "${fieldName}" is not a known option (expected one of: ${[...ONLY_EXPORT_COMPONENTS_STRING_ARRAY_KEYS, ...ONLY_EXPORT_COMPONENTS_BOOLEAN_KEYS].join(", ")}); ignoring.`);
68607
+ }
68608
+ return validated;
68609
+ };
67986
68610
  const applyFieldValidator = (config, validated, fieldName, validator) => {
67987
68611
  const raw = config[fieldName];
67988
68612
  if (raw === void 0) return;
@@ -67997,6 +68621,7 @@ const validateConfigTypes = (config) => {
67997
68621
  for (const fieldName of STRING_ARRAY_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => validateStringArrayField(fieldName, value));
67998
68622
  applyFieldValidator(config, validated, "ignore", validateIgnoreField);
67999
68623
  applyFieldValidator(config, validated, "surfaces", validateSurfacesField);
68624
+ applyFieldValidator(config, validated, "onlyExportComponents", validateOnlyExportComponentsField);
68000
68625
  for (const fieldName of SEVERITY_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => validateSeverityMap(fieldName, value, fieldName === "categories"));
68001
68626
  applyFieldValidator(config, validated, "plugins", (value) => validateStringArrayField("plugins", value));
68002
68627
  for (const ruleKey of getUnknownBundledRuleKeys(validated.rules)) warnConfigIssue(`config field "rules.${ruleKey}" is not a known bundled rule; this override has no effect. Run "react-doctor rules list" to find its rule ID.`);
@@ -70197,7 +70822,7 @@ const createSecurityScanSession = (rootDirectory, options) => {
70197
70822
  entry,
70198
70823
  scan,
70199
70824
  severityOverride,
70200
- committedFilesOnly: rule.committedFilesOnly === true
70825
+ committedFilesOnly: rule.committedFilesOnly !== false
70201
70826
  }];
70202
70827
  });
70203
70828
  if (enabledScanRules.length === 0) return null;
@@ -70216,7 +70841,7 @@ const createSecurityScanSession = (rootDirectory, options) => {
70216
70841
  if (file === null) return;
70217
70842
  for (const { entry, scan, severityOverride, committedFilesOnly } of enabledScanRules) {
70218
70843
  for (const finding of scan(file)) {
70219
- if (committedFilesOnly && isFileGitIgnored(file)) continue;
70844
+ if ((finding.committedFilesOnly ?? committedFilesOnly) && isFileGitIgnored(file)) continue;
70220
70845
  const diagnostic = buildSecurityScanDiagnostic(severityOverride === void 0 ? finding : {
70221
70846
  ...finding,
70222
70847
  severity: severityOverride
@@ -71807,7 +72432,7 @@ const stripGitignoreEscape = (pattern) => {
71807
72432
  if (pattern.startsWith("\\#") || pattern.startsWith("\\!")) return pattern.slice(1);
71808
72433
  return pattern;
71809
72434
  };
71810
- const readIgnoreFile = (filePath) => {
72435
+ const readIgnoreFile = (filePath, { preserveSyntax = false } = {}) => {
71811
72436
  let content;
71812
72437
  try {
71813
72438
  content = fs$1$2.readFileSync(filePath, "utf-8");
@@ -71817,7 +72442,13 @@ const readIgnoreFile = (filePath) => {
71817
72442
  return [];
71818
72443
  }
71819
72444
  const patterns = [];
71820
- for (const line of content.split("\n")) {
72445
+ const source = preserveSyntax ? stripUtf8Bom(content) : content;
72446
+ for (const line of source.split("\n")) {
72447
+ if (preserveSyntax) {
72448
+ const pattern = line.replace(/\r$/, "");
72449
+ if (pattern.length > 0 && !pattern.startsWith("#")) patterns.push(pattern);
72450
+ continue;
72451
+ }
71821
72452
  const trimmed = line.trim();
71822
72453
  if (trimmed.length === 0) continue;
71823
72454
  if (trimmed.startsWith("#")) continue;
@@ -71825,30 +72456,48 @@ const readIgnoreFile = (filePath) => {
71825
72456
  }
71826
72457
  return patterns;
71827
72458
  };
71828
- const IGNORE_FILENAMES = [
71829
- ".eslintignore",
71830
- ".oxlintignore",
71831
- ".prettierignore"
71832
- ];
71833
- const cachedPatternsByRoot = /* @__PURE__ */ new Map();
71834
- const computeIgnorePatterns = (rootDirectory) => {
71835
- const seen = /* @__PURE__ */ new Set();
71836
- const patterns = [];
71837
- const addPattern = (pattern) => {
71838
- if (seen.has(pattern)) return;
71839
- seen.add(pattern);
71840
- patterns.push(pattern);
72459
+ const readLintIgnorePatterns = (rootDirectory, { preserveSyntax = false } = {}) => [...LINT_IGNORE_STYLE_FILENAMES.flatMap((filename) => readIgnoreFile(path$1$1.join(rootDirectory, filename), { preserveSyntax })), ...parseGitattributesLinguistPaths(path$1$1.join(rootDirectory, LINT_LINGUIST_FILENAME))];
72460
+ const rebasePattern = (pattern, directoryPrefix) => {
72461
+ const isNegated = pattern.startsWith("!");
72462
+ const body = isNegated ? pattern.slice(1) : pattern;
72463
+ const effectiveBody = body.replace(/ +$/, "");
72464
+ if (!effectiveBody.trim() || effectiveBody === "/") return null;
72465
+ const isAnchored = effectiveBody.startsWith("/") || effectiveBody.slice(0, -1).includes("/");
72466
+ const relativePattern = body.startsWith("/") ? body.slice(1) : body;
72467
+ return `${isNegated ? "!" : ""}/${directoryPrefix}/${isAnchored ? "" : "**/"}${relativePattern}`;
72468
+ };
72469
+ const readRebasedPatterns = (directory, boundary) => {
72470
+ const directoryPrefix = path$1$1.relative(boundary, directory).split(path$1$1.sep).join("/").replace(/[\\*?[\]]/g, "\\$&");
72471
+ return readLintIgnorePatterns(directory, { preserveSyntax: true }).map((pattern) => rebasePattern(pattern, directoryPrefix)).filter((pattern) => pattern !== null);
72472
+ };
72473
+ const resolveIgnoreBoundaryIndex = (directories) => {
72474
+ const boundaryIndex = directories.findIndex(isProjectBoundary);
72475
+ if (boundaryIndex <= 0) return 0;
72476
+ const packageDirectory = directories.slice(0, boundaryIndex).find((directory) => isFile(path$1$1.join(directory, "package.json")));
72477
+ if (!packageDirectory) return 0;
72478
+ const boundary = directories[boundaryIndex];
72479
+ return getWorkspacePatterns(boundary, readPackageJson(path$1$1.join(boundary, "package.json"))).some((pattern) => resolveWorkspaceDirectories(boundary, pattern).includes(packageDirectory)) ? boundaryIndex : 0;
72480
+ };
72481
+ const collectLintIgnorePolicy = (rootDirectory) => {
72482
+ const scanDirectory = path$1$1.resolve(rootDirectory);
72483
+ const directories = ancestorDirectories(scanDirectory, { includeStart: true });
72484
+ const boundaryIndex = resolveIgnoreBoundaryIndex(directories);
72485
+ const boundary = directories[boundaryIndex];
72486
+ const patterns = readLintIgnorePatterns(boundary, { preserveSyntax: true });
72487
+ for (const directory of directories.slice(0, boundaryIndex).reverse()) patterns.push(...readRebasedPatterns(directory, boundary));
72488
+ if (patterns.length === 0) return null;
72489
+ const matcher = (0, import_ignore.default)({
72490
+ ignorecase: false,
72491
+ allowRelativePaths: true
72492
+ }).add(patterns);
72493
+ return {
72494
+ patterns,
72495
+ includesFile: (filePath) => {
72496
+ const absolutePath = path$1$1.resolve(scanDirectory, filePath);
72497
+ if (!isPathInsideDirectory(absolutePath, scanDirectory)) return true;
72498
+ return !matcher.ignores(path$1$1.relative(boundary, absolutePath).split(path$1$1.sep).join("/"));
72499
+ }
71841
72500
  };
71842
- for (const filename of IGNORE_FILENAMES) for (const pattern of readIgnoreFile(path$1$1.join(rootDirectory, filename))) addPattern(pattern);
71843
- for (const linguistPath of parseGitattributesLinguistPaths(path$1$1.join(rootDirectory, ".gitattributes"))) addPattern(linguistPath);
71844
- return patterns;
71845
- };
71846
- const collectIgnorePatterns = (rootDirectory) => {
71847
- const cached = cachedPatternsByRoot.get(rootDirectory);
71848
- if (cached !== void 0) return cached;
71849
- const patterns = computeIgnorePatterns(rootDirectory);
71850
- cachedPatternsByRoot.set(rootDirectory, patterns);
71851
- return patterns;
71852
72501
  };
71853
72502
  const findFirstLintConfigInDirectory = (directory) => {
71854
72503
  for (const filename of ADOPTABLE_LINT_CONFIG_FILENAMES) {
@@ -72149,6 +72798,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths, options
72149
72798
  const onExit = () => restore();
72150
72799
  process.once("exit", onExit);
72151
72800
  const leaseCandidatePath = (absolutePath) => {
72801
+ if (options.includesFile?.(path$1$1.relative(resolvedRootDirectory, absolutePath)) === false) return;
72152
72802
  if (!isSymlinkFreePath(absolutePath, resolvedRootDirectory)) return;
72153
72803
  if (leasedPaths.has(absolutePath)) return;
72154
72804
  if (blockedPaths.has(absolutePath)) return;
@@ -72378,7 +73028,7 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
72378
73028
  }
72379
73029
  return enabled;
72380
73030
  };
72381
- 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 }) => {
73031
+ const createOxlintConfig = ({ pluginPath, diagnosticContextDirectory, project, customRulesOnly = false, extendsPaths = [], ignoredTags = /* @__PURE__ */ new Set(), includedTags = /* @__PURE__ */ new Set(), includeTagDefaults = false, runtimeGlobals, unpluginAutoImportGlobalScopes, serverAuthFunctionNames, onlyExportComponents, projectIndexModuleSources, severityControls, adoptedSettings = {}, userPlugins = [], disableReactHooksJsPlugin = false, ruleSelection, sidecarRuleIdFilter }) => {
72382
73032
  const hasIncludedTags = includedTags.size > 0;
72383
73033
  const resolvedReactHooksJsPlugin = disableReactHooksJsPlugin || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
72384
73034
  const reactHooksJsPlugin = ruleSelection === "sidecar" ? null : resolvedReactHooksJsPlugin;
@@ -72461,6 +73111,7 @@ const createOxlintConfig = ({ pluginPath, diagnosticContextDirectory, project, c
72461
73111
  } : {},
72462
73112
  ...project.shopifyFlashListMajorVersion !== null ? { shopifyFlashListMajorVersion: project.shopifyFlashListMajorVersion } : {},
72463
73113
  ...serverAuthFunctionNames && serverAuthFunctionNames.length > 0 ? { serverAuthFunctionNames: [...serverAuthFunctionNames] } : {},
73114
+ ...onlyExportComponents !== void 0 ? { onlyExportComponents } : {},
72464
73115
  ...projectIndexModuleSources !== void 0 ? { projectIndexModuleSources: [...projectIndexModuleSources] } : {}
72465
73116
  }
72466
73117
  },
@@ -72471,6 +73122,12 @@ const createOxlintConfig = ({ pluginPath, diagnosticContextDirectory, project, c
72471
73122
  }
72472
73123
  };
72473
73124
  };
73125
+ const internWorkerSidecarProbeIds = (result, trace, internRelativeProbe) => {
73126
+ const probeIds = [];
73127
+ for (const pathIndex of trace.content) probeIds.push(internRelativeProbe("content", result.paths[pathIndex], null));
73128
+ for (const pathIndex of trace.existence) probeIds.push(internRelativeProbe("exists", result.paths[pathIndex], result.existenceAnswers[pathIndex]));
73129
+ return probeIds;
73130
+ };
72474
73131
  const TIMELINE_PATH = process.env.REACT_DOCTOR_OXLINT_SPAWN_LOG;
72475
73132
  const isOxlintJobTimelineEnabled = TIMELINE_PATH !== void 0;
72476
73133
  const appendTimelineLine = (entry) => {
@@ -73579,6 +74236,7 @@ const bridgeReactCompilerDiagnostic = (diagnostic) => {
73579
74236
  url: bridgeRule.compilerUrl
73580
74237
  };
73581
74238
  };
74239
+ const getUtf16Offset = (sourceText, utf8Offset) => Buffer.from(sourceText).subarray(0, utf8Offset).toString("utf8").length;
73582
74240
  const REACT_MODULE_SOURCE = "react";
73583
74241
  const REQUIRE_IDENTIFIER = "require";
73584
74242
  const USE_IDENTIFIER = "use";
@@ -73594,7 +74252,6 @@ const REACT_USE_BINDING_RESOLUTION = {
73594
74252
  isReactUseBinding: true,
73595
74253
  isReactNamespaceBinding: false
73596
74254
  };
73597
- const getUtf16Offset$1 = (sourceText, utf8Offset) => Buffer.from(sourceText).subarray(0, utf8Offset).toString("utf8").length;
73598
74255
  const getStaticPropertyName = (node) => {
73599
74256
  if (!node) return null;
73600
74257
  if (typescriptBinding.isIdentifier(node) || typescriptBinding.isStringLiteral(node) || typescriptBinding.isNumericLiteral(node)) return node.text;
@@ -73831,7 +74488,7 @@ const findUseCallIdentifier = (sourceFile, useOffset) => {
73831
74488
  };
73832
74489
  const resolveUseCallBinding = (sourceText, filename, utf8Offset) => {
73833
74490
  const sourceFile = typescriptBinding.createSourceFile(filename, sourceText, typescriptBinding.ScriptTarget.Latest, true, getTypescriptScriptKind(filename));
73834
- const useIdentifier = findUseCallIdentifier(sourceFile, getUtf16Offset$1(sourceText, utf8Offset));
74491
+ const useIdentifier = findUseCallIdentifier(sourceFile, getUtf16Offset(sourceText, utf8Offset));
73835
74492
  if (!useIdentifier) return null;
73836
74493
  return resolveIdentifierBinding(useIdentifier, collectReactImportBindings(sourceFile), sourceFile);
73837
74494
  };
@@ -73866,7 +74523,6 @@ const WORKLET_ACCEPTING_CALLEES = new Set([
73866
74523
  "executeOnUIRuntimeSync"
73867
74524
  ]);
73868
74525
  const GESTURE_ROOT_IDENTIFIER = "Gesture";
73869
- const getUtf16Offset = (sourceText, utf8Offset) => Buffer.from(sourceText).subarray(0, utf8Offset).toString("utf8").length;
73870
74526
  const hasWorkletDirective = (node) => {
73871
74527
  if (!typescriptBinding.isFunctionDeclaration(node) && !typescriptBinding.isFunctionExpression(node) && !typescriptBinding.isArrowFunction(node) && !typescriptBinding.isMethodDeclaration(node)) return false;
73872
74528
  const body = node.body;
@@ -73939,6 +74595,228 @@ const shouldSuppressCompilerFindingInWorklet = (diagnostic, project, rootDirecto
73939
74595
  }
73940
74596
  return isOffsetInsideWorklet(typescriptBinding.createSourceFile(absolutePath, sourceText, typescriptBinding.ScriptTarget.Latest, true, getTypescriptScriptKind(absolutePath)), getUtf16Offset(sourceText, primaryLabel.span.offset));
73941
74597
  };
74598
+ const REFLECTION_NAMES = new Set([
74599
+ "eval",
74600
+ "require",
74601
+ "Function",
74602
+ "Object",
74603
+ "Reflect",
74604
+ "Promise",
74605
+ "globalThis",
74606
+ "global",
74607
+ "window",
74608
+ "self",
74609
+ "constructor",
74610
+ "prototype",
74611
+ "__proto__",
74612
+ "__defineGetter__",
74613
+ "__defineSetter__",
74614
+ "__lookupGetter__",
74615
+ "__lookupSetter__"
74616
+ ]);
74617
+ const collectEffectSourceIndex = (sourceFile) => {
74618
+ const identifiers = /* @__PURE__ */ new Map();
74619
+ const calls = [];
74620
+ const pendingNodes = [sourceFile];
74621
+ let hasReflection = false;
74622
+ while (pendingNodes.length > 0) {
74623
+ const node = pendingNodes.pop();
74624
+ if (!node) continue;
74625
+ if (typescriptBinding.isIdentifier(node)) {
74626
+ const sameNameIdentifiers = identifiers.get(node.text) ?? /* @__PURE__ */ new Set();
74627
+ sameNameIdentifiers.add(node);
74628
+ identifiers.set(node.text, sameNameIdentifiers);
74629
+ if (REFLECTION_NAMES.has(node.text)) hasReflection = true;
74630
+ }
74631
+ let memberName;
74632
+ if (typescriptBinding.isPropertyAccessExpression(node)) memberName = node.name.text;
74633
+ else if (typescriptBinding.isElementAccessExpression(node)) {
74634
+ const memberArgument = unwrapTypescriptExpression(node.argumentExpression);
74635
+ if (typescriptBinding.isStringLiteral(memberArgument)) memberName = memberArgument.text;
74636
+ else hasReflection = true;
74637
+ } else if (typescriptBinding.isBindingElement(node) && node.propertyName && typescriptBinding.isStringLiteral(node.propertyName)) memberName = node.propertyName.text;
74638
+ else if (typescriptBinding.isPropertyAssignment(node) && typescriptBinding.isStringLiteral(node.name)) memberName = node.name.text;
74639
+ if (memberName && REFLECTION_NAMES.has(memberName)) hasReflection = true;
74640
+ if (typescriptBinding.isComputedPropertyName(node)) hasReflection = true;
74641
+ if (typescriptBinding.isWithStatement(node)) hasReflection = true;
74642
+ if (typescriptBinding.isCallExpression(node)) {
74643
+ calls.push(node);
74644
+ if (node.expression.kind === typescriptBinding.SyntaxKind.ImportKeyword) hasReflection = true;
74645
+ }
74646
+ typescriptBinding.forEachChild(node, (child) => {
74647
+ pendingNodes.push(child);
74648
+ });
74649
+ }
74650
+ return {
74651
+ identifiers,
74652
+ calls,
74653
+ hasReflection
74654
+ };
74655
+ };
74656
+ const isInertPrimitive = (expression) => {
74657
+ const unwrapped = unwrapTypescriptExpression(expression);
74658
+ return typescriptBinding.isStringLiteral(unwrapped) || typescriptBinding.isNoSubstitutionTemplateLiteral(unwrapped) || typescriptBinding.isNumericLiteral(unwrapped) || unwrapped.kind === typescriptBinding.SyntaxKind.TrueKeyword || unwrapped.kind === typescriptBinding.SyntaxKind.FalseKeyword || unwrapped.kind === typescriptBinding.SyntaxKind.NullKeyword || typescriptBinding.isPrefixUnaryExpression(unwrapped) && (unwrapped.operator === typescriptBinding.SyntaxKind.PlusToken || unwrapped.operator === typescriptBinding.SyntaxKind.MinusToken) && typescriptBinding.isNumericLiteral(unwrapped.operand);
74659
+ };
74660
+ const isAsyncZeroParameterFunction = (node) => (typescriptBinding.isArrowFunction(node) || typescriptBinding.isFunctionExpression(node)) && node.parameters.length === 0 && !(typescriptBinding.isFunctionExpression(node) && node.asteriskToken) && Boolean(node.modifiers?.some((modifier) => modifier.kind === typescriptBinding.SyntaxKind.AsyncKeyword));
74661
+ const getSoleCall = (body) => {
74662
+ if (body.statements.length !== 1) return null;
74663
+ const statement = body.statements[0];
74664
+ if (!typescriptBinding.isExpressionStatement(statement)) return null;
74665
+ let expression = unwrapTypescriptExpression(statement.expression);
74666
+ if (typescriptBinding.isVoidExpression(expression)) expression = unwrapTypescriptExpression(expression.expression);
74667
+ return typescriptBinding.isCallExpression(expression) && !expression.questionDotToken ? expression : null;
74668
+ };
74669
+ const findDirectConst = (body, name, beforeStatement) => {
74670
+ for (const statement of body.statements) {
74671
+ if (statement === beforeStatement) return null;
74672
+ if (!typescriptBinding.isVariableStatement(statement)) continue;
74673
+ if (!(statement.declarationList.flags & typescriptBinding.NodeFlags.Const)) continue;
74674
+ for (const declaration of statement.declarationList.declarations) if (typescriptBinding.isIdentifier(declaration.name) && declaration.name.text === name) return declaration;
74675
+ }
74676
+ return null;
74677
+ };
74678
+ const hasOnlyAllowedIdentifiers = (index, name, allowedIdentifiers) => {
74679
+ const allowed = new Set(allowedIdentifiers);
74680
+ return [...index.identifiers.get(name) ?? []].every((identifier) => allowed.has(identifier));
74681
+ };
74682
+ const isNativeReactCall = (call, importedName, sourceFile, index) => {
74683
+ const callee = unwrapTypescriptExpression(call.expression);
74684
+ if (!typescriptBinding.isIdentifier(callee) || call.questionDotToken) return false;
74685
+ let matchingImport = null;
74686
+ for (const statement of sourceFile.statements) {
74687
+ if (!typescriptBinding.isImportDeclaration(statement)) continue;
74688
+ if (!typescriptBinding.isStringLiteral(statement.moduleSpecifier) || statement.moduleSpecifier.text !== "react") continue;
74689
+ const clause = statement.importClause;
74690
+ if (!clause || clause.isTypeOnly) continue;
74691
+ if (clause.name || clause.namedBindings && typescriptBinding.isNamespaceImport(clause.namedBindings)) return false;
74692
+ if (!clause.namedBindings || !typescriptBinding.isNamedImports(clause.namedBindings)) continue;
74693
+ for (const specifier of clause.namedBindings.elements) {
74694
+ if (specifier.name.text !== callee.text) continue;
74695
+ if (matchingImport || specifier.isTypeOnly || (specifier.propertyName?.text ?? specifier.name.text) !== importedName || getImportModuleSource(specifier) !== "react") return false;
74696
+ matchingImport = specifier;
74697
+ }
74698
+ }
74699
+ if (!matchingImport) return false;
74700
+ const allowed = [matchingImport.name];
74701
+ if (matchingImport.propertyName && typescriptBinding.isIdentifier(matchingImport.propertyName)) allowed.push(matchingImport.propertyName);
74702
+ for (const candidateCall of index.calls) {
74703
+ const candidateCallee = unwrapTypescriptExpression(candidateCall.expression);
74704
+ if (typescriptBinding.isIdentifier(candidateCallee) && candidateCallee.text === callee.text) allowed.push(candidateCallee);
74705
+ }
74706
+ return hasOnlyAllowedIdentifiers(index, callee.text, allowed);
74707
+ };
74708
+ const hasDeferredLocalHelper = (helperCall, sourceFile, index) => {
74709
+ const helperIdentifier = unwrapTypescriptExpression(helperCall.expression);
74710
+ if (!typescriptBinding.isIdentifier(helperIdentifier) || helperCall.arguments.length !== 0) return false;
74711
+ let callbackNode = helperCall.parent;
74712
+ while (callbackNode && !typescriptBinding.isArrowFunction(callbackNode) && !typescriptBinding.isFunctionExpression(callbackNode)) callbackNode = callbackNode.parent;
74713
+ if (!callbackNode || !typescriptBinding.isBlock(callbackNode.body) || callbackNode.parameters.length !== 0 || callbackNode.modifiers?.some((modifier) => modifier.kind === typescriptBinding.SyntaxKind.AsyncKeyword) || typescriptBinding.isFunctionExpression(callbackNode) && callbackNode.asteriskToken || getSoleCall(callbackNode.body) !== helperCall) return false;
74714
+ const effectCall = callbackNode.parent;
74715
+ if (!typescriptBinding.isCallExpression(effectCall) || effectCall.arguments[0] !== callbackNode || effectCall.arguments.length !== 2 || !isNativeReactCall(effectCall, "useEffect", sourceFile, index) || !typescriptBinding.isExpressionStatement(effectCall.parent) || !typescriptBinding.isBlock(effectCall.parent.parent)) return false;
74716
+ const ownerBody = effectCall.parent.parent;
74717
+ if (!typescriptBinding.isArrowFunction(ownerBody.parent) && !typescriptBinding.isFunctionExpression(ownerBody.parent) && !typescriptBinding.isFunctionDeclaration(ownerBody.parent)) return false;
74718
+ if (ownerBody.parent.modifiers?.some((modifier) => modifier.kind === typescriptBinding.SyntaxKind.AsyncKeyword) || !typescriptBinding.isArrowFunction(ownerBody.parent) && ownerBody.parent.asteriskToken) return false;
74719
+ const dependencies = unwrapTypescriptExpression(effectCall.arguments[1]);
74720
+ if (!typescriptBinding.isArrayLiteralExpression(dependencies)) return false;
74721
+ const helperReferences = [helperIdentifier];
74722
+ for (const dependency of dependencies.elements) {
74723
+ const unwrappedDependency = unwrapTypescriptExpression(dependency);
74724
+ if (!typescriptBinding.isIdentifier(unwrappedDependency) || unwrappedDependency.text !== helperIdentifier.text) return false;
74725
+ helperReferences.push(unwrappedDependency);
74726
+ }
74727
+ const declaration = findDirectConst(ownerBody, helperIdentifier.text, effectCall.parent);
74728
+ if (!declaration?.initializer || !typescriptBinding.isIdentifier(declaration.name)) return false;
74729
+ helperReferences.push(declaration.name);
74730
+ if (!hasOnlyAllowedIdentifiers(index, helperIdentifier.text, helperReferences)) return false;
74731
+ let helper = unwrapTypescriptExpression(declaration.initializer);
74732
+ if (typescriptBinding.isCallExpression(helper)) {
74733
+ if (!isNativeReactCall(helper, "useCallback", sourceFile, index) || helper.arguments.length !== 2 || !typescriptBinding.isArrayLiteralExpression(helper.arguments[1]) || helper.arguments[1].elements.length !== 0) return false;
74734
+ helper = unwrapTypescriptExpression(helper.arguments[0]);
74735
+ }
74736
+ if (!isAsyncZeroParameterFunction(helper) || !typescriptBinding.isBlock(helper.body)) return false;
74737
+ if (helper.body.statements.length !== 1) return false;
74738
+ const tryStatement = helper.body.statements[0];
74739
+ if (!typescriptBinding.isTryStatement(tryStatement) || tryStatement.finallyBlock || !tryStatement.catchClause || tryStatement.catchClause.variableDeclaration) return false;
74740
+ const successCall = getSoleCall(tryStatement.tryBlock);
74741
+ const failureCall = getSoleCall(tryStatement.catchClause.block);
74742
+ if (!successCall || !failureCall || successCall.arguments.length !== 1 || failureCall.arguments.length !== 1) return false;
74743
+ const setterIdentifier = unwrapTypescriptExpression(successCall.expression);
74744
+ const failureSetter = unwrapTypescriptExpression(failureCall.expression);
74745
+ if (!typescriptBinding.isIdentifier(setterIdentifier) || !typescriptBinding.isIdentifier(failureSetter) || setterIdentifier.text !== failureSetter.text || !isInertPrimitive(failureCall.arguments[0])) return false;
74746
+ const awaitedValue = unwrapTypescriptExpression(successCall.arguments[0]);
74747
+ if (!typescriptBinding.isAwaitExpression(awaitedValue)) return false;
74748
+ const producerCall = unwrapTypescriptExpression(awaitedValue.expression);
74749
+ if (!typescriptBinding.isCallExpression(producerCall) || producerCall.questionDotToken || producerCall.arguments.length !== 0) return false;
74750
+ const producerIdentifier = unwrapTypescriptExpression(producerCall.expression);
74751
+ if (!typescriptBinding.isIdentifier(producerIdentifier)) return false;
74752
+ const producerDeclaration = findDirectConst(ownerBody, producerIdentifier.text, effectCall.parent);
74753
+ if (!producerDeclaration?.initializer || !typescriptBinding.isIdentifier(producerDeclaration.name)) return false;
74754
+ const producer = unwrapTypescriptExpression(producerDeclaration.initializer);
74755
+ if (!isAsyncZeroParameterFunction(producer)) return false;
74756
+ let producedValue;
74757
+ if (typescriptBinding.isBlock(producer.body)) {
74758
+ if (producer.body.statements.length !== 1) return false;
74759
+ const statement = producer.body.statements[0];
74760
+ if (!typescriptBinding.isReturnStatement(statement)) return false;
74761
+ producedValue = statement.expression;
74762
+ } else producedValue = producer.body;
74763
+ if (!producedValue || !isInertPrimitive(producedValue)) return false;
74764
+ if (!hasOnlyAllowedIdentifiers(index, producerIdentifier.text, [producerDeclaration.name, producerIdentifier])) return false;
74765
+ for (const statement of ownerBody.statements) {
74766
+ if (statement === effectCall.parent) return false;
74767
+ if (!typescriptBinding.isVariableStatement(statement) || !(statement.declarationList.flags & typescriptBinding.NodeFlags.Const)) continue;
74768
+ for (const stateDeclaration of statement.declarationList.declarations) {
74769
+ if (!typescriptBinding.isArrayBindingPattern(stateDeclaration.name) || stateDeclaration.name.elements.length !== 2 || !stateDeclaration.initializer) continue;
74770
+ const setterBinding = stateDeclaration.name.elements[1];
74771
+ if (typescriptBinding.isOmittedExpression(setterBinding) || !typescriptBinding.isIdentifier(setterBinding.name) || setterBinding.name.text !== setterIdentifier.text || setterBinding.initializer || setterBinding.dotDotDotToken || setterBinding.propertyName) continue;
74772
+ const stateInitializer = unwrapTypescriptExpression(stateDeclaration.initializer);
74773
+ if (!typescriptBinding.isCallExpression(stateInitializer) || !isNativeReactCall(stateInitializer, "useState", sourceFile, index)) continue;
74774
+ return hasOnlyAllowedIdentifiers(index, setterIdentifier.text, [
74775
+ setterBinding.name,
74776
+ setterIdentifier,
74777
+ failureSetter
74778
+ ]);
74779
+ }
74780
+ }
74781
+ return false;
74782
+ };
74783
+ const createDeferredEffectStateDiagnosticChecker = (rootDirectory) => {
74784
+ const parsedFiles = /* @__PURE__ */ new Map();
74785
+ const readAndParse = (filename) => {
74786
+ const cached = parsedFiles.get(filename);
74787
+ if (cached !== void 0) return cached;
74788
+ let parsed;
74789
+ try {
74790
+ const sourceText = fs$1$2.readFileSync(filename, "utf8");
74791
+ const sourceFile = typescriptBinding.createSourceFile(filename, sourceText, typescriptBinding.ScriptTarget.Latest, true, getTypescriptScriptKind(filename));
74792
+ parsed = "parseDiagnostics" in sourceFile && Array.isArray(sourceFile.parseDiagnostics) && sourceFile.parseDiagnostics.length > 0 ? null : {
74793
+ sourceText,
74794
+ sourceFile,
74795
+ index: collectEffectSourceIndex(sourceFile)
74796
+ };
74797
+ } catch {
74798
+ parsed = null;
74799
+ }
74800
+ parsedFiles.set(filename, parsed);
74801
+ return parsed;
74802
+ };
74803
+ return (diagnostic) => {
74804
+ if (diagnostic.code !== "react-hooks-js(set-state-in-effect)") return false;
74805
+ const span = diagnostic.labels[0]?.span;
74806
+ if (!span || !Number.isInteger(span.offset) || !Number.isInteger(span.length) || span.offset < 0 || span.length <= 0) return false;
74807
+ const parsed = readAndParse(path$1$1.resolve(rootDirectory, diagnostic.filename));
74808
+ if (!parsed || parsed.index.hasReflection) return false;
74809
+ const { sourceText, sourceFile, index } = parsed;
74810
+ const calleeOffset = getUtf16Offset(sourceText, span.offset);
74811
+ const helperCall = index.calls.find((call) => {
74812
+ const callee = unwrapTypescriptExpression(call.expression);
74813
+ return typescriptBinding.isIdentifier(callee) && callee.getStart(sourceFile) === calleeOffset;
74814
+ });
74815
+ if (!helperCall || helperCall.questionDotToken) return false;
74816
+ const callee = unwrapTypescriptExpression(helperCall.expression);
74817
+ return Buffer.byteLength(sourceText.slice(0, calleeOffset)) === span.offset && Buffer.byteLength(callee.getText(sourceFile)) === span.length && hasDeferredLocalHelper(helperCall, sourceFile, index);
74818
+ };
74819
+ };
73942
74820
  const MANUAL_MEMOIZATION_PLUGIN = "react-doctor";
73943
74821
  const MANUAL_MEMOIZATION_RULE = "react-compiler-no-manual-memoization";
73944
74822
  const REACT_COMPILER_PLUGIN = "react-hooks-js";
@@ -74035,8 +74913,8 @@ const REACT_COMPILER_TITLE = "React Compiler can't optimize this";
74035
74913
  const REACT_COMPILER_TODO_TITLE = "React Compiler doesn't support this syntax";
74036
74914
  const REACT_ERROR_BOUNDARY_TITLE = "JSX render errors need an Error Boundary";
74037
74915
  const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown while the JSX child renders. Use an Error Boundary instead.";
74038
- const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
74039
- const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
74916
+ const REACT_COMPILER_IMPACT = "React Compiler flagged this code during analysis";
74917
+ const REACT_COMPILER_ACTION = "Review the compiler's reason before changing the code.";
74040
74918
  const REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION = "It's how the library works, not a bug in your code. Memoize values you pass from it into other memoized components, or suppress it with `// react-doctor-disable-next-line react-hooks-js/incompatible-library`.";
74041
74919
  const SET_STATE_IN_EFFECT_ACTION = "Prefer deriving or initializing the value before render. If the effect must read a browser API after mount, treat this as advisory or suppress it with `// react-doctor-disable-next-line react-hooks-js/set-state-in-effect`.";
74042
74920
  const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
@@ -74222,12 +75100,12 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath,
74222
75100
  const absolutePath = resolveAbsolutePath(resolveSourceFilename(filename));
74223
75101
  const cached = minifiedFileCache.get(absolutePath);
74224
75102
  if (cached !== void 0) return cached;
74225
- const minified = isMinifiedSource(absolutePath);
75103
+ const minified = isMinifiedSource(absolutePath) || isMinifiedViteEntry(absolutePath);
74226
75104
  minifiedFileCache.set(absolutePath, minified);
74227
75105
  return minified;
74228
75106
  };
74229
75107
  const readContextRanges = createDiagnosticContextReader(diagnosticContextDirectory);
74230
- return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((unbridgedDiagnostic) => {
75108
+ const sourceMappedDiagnostics = parsed.diagnostics.flatMap((unbridgedDiagnostic) => {
74231
75109
  if (!isMappableOxlintDiagnostic(unbridgedDiagnostic)) return [];
74232
75110
  const rawDiagnostic = bridgeReactCompilerDiagnostic(unbridgedDiagnostic);
74233
75111
  const { plugin, rule } = parseRuleCode(rawDiagnostic.code);
@@ -74253,7 +75131,9 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath,
74253
75131
  labels,
74254
75132
  contextRanges: []
74255
75133
  }];
74256
- }).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) => {
75134
+ });
75135
+ const shouldSuppressDeferredEffectStateDiagnostic = createDeferredEffectStateDiagnosticChecker(rootDirectory);
75136
+ return suppressMemoizationInBailedOutFunctions(sourceMappedDiagnostics.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) && !shouldSuppressDeferredEffectStateDiagnostic(diagnostic) && !shouldSuppressCompilerFindingInWorklet(diagnostic, project, rootDirectory)).map((diagnostic) => {
74257
75137
  const { plugin, rule } = parseRuleCode(diagnostic.code);
74258
75138
  const primaryLabel = diagnostic.labels[0];
74259
75139
  const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
@@ -75041,10 +75921,7 @@ const collectSidecarProbesForFiles = async (input) => {
75041
75921
  probeIdsByFile.set(file, null);
75042
75922
  continue;
75043
75923
  }
75044
- const probeIds = [];
75045
- for (const pathIndex of trace.content) probeIds.push(internRelativeProbe("content", result.paths[pathIndex], result.existenceAnswers[pathIndex]));
75046
- for (const pathIndex of trace.existence) probeIds.push(internRelativeProbe("exists", result.paths[pathIndex], result.existenceAnswers[pathIndex]));
75047
- probeIdsByFile.set(file, probeIds);
75924
+ probeIdsByFile.set(file, internWorkerSidecarProbeIds(result, trace, internRelativeProbe));
75048
75925
  }
75049
75926
  };
75050
75927
  const runParentLane = async () => {
@@ -75157,7 +76034,11 @@ const runOxlint = async (options) => {
75157
76034
  const adoptableConfigPaths = detectedConfigPaths.filter(canOxlintExtendConfig);
75158
76035
  const adoptedSettings = detectedConfigPaths.length > 0 ? readAdoptedLintConfigSettings(detectedConfigPaths) : {};
75159
76036
  const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
75160
- const restoreDisableDirectives = await neutralizeDisableDirectives(rootDirectory, includePaths ?? options.precomputedSourceFiles?.map((sourceFile) => sourceFile.path), { recoverOnly: respectInlineDisables });
76037
+ const lintIgnorePolicy = collectLintIgnorePolicy(rootDirectory);
76038
+ const restoreDisableDirectives = await neutralizeDisableDirectives(rootDirectory, includePaths ?? options.precomputedSourceFiles?.map((sourceFile) => sourceFile.path), {
76039
+ recoverOnly: respectInlineDisables,
76040
+ includesFile: lintIgnorePolicy?.includesFile
76041
+ });
75161
76042
  const configDirectory = fs$1$2.mkdtempSync(path$1$1.join(os.tmpdir(), "react-doctor-oxlintrc-"));
75162
76043
  const configPath = path$1$1.join(configDirectory, "oxlintrc.json");
75163
76044
  const workingDirectory = fs$1$2.existsSync(path$1$1.join(rootDirectory, "oxlint-suppressions.json")) ? configDirectory : void 0;
@@ -75183,10 +76064,10 @@ const runOxlint = async (options) => {
75183
76064
  }
75184
76065
  }
75185
76066
  }
75186
- const combinedPatterns = collectIgnorePatterns(rootDirectory);
75187
- if (combinedPatterns.length > 0) {
76067
+ const combinedPatterns = lintIgnorePolicy?.patterns ?? [];
76068
+ if (lintIgnorePolicy) {
75188
76069
  const combinedIgnorePath = path$1$1.join(configDirectory, "combined.ignore");
75189
- fs$1$2.writeFileSync(combinedIgnorePath, `${combinedPatterns.join("\n")}\n`);
76070
+ fs$1$2.writeFileSync(combinedIgnorePath, "");
75190
76071
  sharedArgs.push("--ignore-path", combinedIgnorePath);
75191
76072
  }
75192
76073
  const lintWorkerCount = resolveScanConcurrency(options.concurrency ?? 1);
@@ -75202,8 +76083,9 @@ const runOxlint = async (options) => {
75202
76083
  ];
75203
76084
  await yieldToEventLoop();
75204
76085
  const sizedScanFiles = options.precomputedSourceFiles ?? (includePaths === void 0 ? listSourceFilesWithSize(rootDirectory) : null);
75205
- const candidateFiles = sizedScanFiles === null ? includePaths ?? [] : sizedScanFiles.map((entry) => entry.path);
75206
- const projectIndexModuleSources = includePaths === void 0 && options.deadlineEpochMs === void 0 ? await collectProjectIndexModuleSources(rootDirectory, candidateFiles) : void 0;
76086
+ const discoveredFiles = sizedScanFiles === null ? includePaths ?? [] : sizedScanFiles.map((entry) => entry.path);
76087
+ const candidateFiles = lintIgnorePolicy ? discoveredFiles.filter(lintIgnorePolicy.includesFile) : discoveredFiles;
76088
+ const projectIndexModuleSources = includePaths === void 0 && options.deadlineEpochMs === void 0 ? await collectProjectIndexModuleSources(rootDirectory, discoveredFiles) : void 0;
75207
76089
  unpluginAutoImportGlobalScopes = collectUnpluginAutoImportGlobalScopes({
75208
76090
  rootDirectory,
75209
76091
  candidateFiles
@@ -75227,6 +76109,7 @@ const runOxlint = async (options) => {
75227
76109
  runtimeGlobals,
75228
76110
  unpluginAutoImportGlobalScopes,
75229
76111
  serverAuthFunctionNames,
76112
+ onlyExportComponents: userConfig?.onlyExportComponents,
75230
76113
  projectIndexModuleSources,
75231
76114
  severityControls,
75232
76115
  adoptedSettings,
@@ -76648,10 +77531,11 @@ const runInspect = (input, hooks = {}) => gen(function* () {
76648
77531
  const lintFailureState = yield* get$2(lintFailure);
76649
77532
  yield* afterLint(lintFailureState.didFail);
76650
77533
  if (lintFailureState.didFail) yield* scanProgress.fail(formatLintFailText(lintFailureState.reasonTag, process.version));
76651
- const candidateFiles = lintFileCoverageState.value === null ? [] : [...new Set(lintFileCoverageState.value.candidateFiles.map((filePath) => toNormalizedRelativePath(filePath, scanDirectory)))];
76652
- const analyzedFiles = lintFileCoverageState.value === null ? [] : [...new Set(lintFileCoverageState.value.analyzedFiles.map((filePath) => toNormalizedRelativePath(filePath, scanDirectory)))].sort();
76653
- const totalFileCount = candidateFiles.length || lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
76654
- const scannedFilePaths = input.suppressScanSummary ? candidateFiles.length > 0 ? candidateFiles.map((filePath) => path$1$1.resolve(scanDirectory, filePath)) : fallbackScannedFilePaths : [];
77534
+ const lintFileCoverage = lintFileCoverageState.value;
77535
+ const candidateFiles = lintFileCoverage === null ? [] : [...new Set(lintFileCoverage.candidateFiles.map((filePath) => toNormalizedRelativePath(filePath, scanDirectory)))];
77536
+ const analyzedFiles = lintFileCoverage === null ? [] : [...new Set(lintFileCoverage.analyzedFiles.map((filePath) => toNormalizedRelativePath(filePath, scanDirectory)))].sort();
77537
+ const totalFileCount = lintFileCoverage === null ? lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount) : candidateFiles.length;
77538
+ const scannedFilePaths = input.suppressScanSummary ? lintFileCoverage === null ? fallbackScannedFilePaths : candidateFiles.map((filePath) => path$1$1.resolve(scanDirectory, filePath)) : [];
76655
77539
  const scannedFilesLabel = `${totalFileCount} ${totalFileCount === 1 ? "file" : "files"}`;
76656
77540
  let maintainabilityCollected = [];
76657
77541
  if (lintFailureState.didFail) yield* interrupt(maintainabilityFiber);
@@ -76898,15 +77782,37 @@ const materializeSourceTree = (input) => gen(function* () {
76898
77782
  materializedFiles.push(relativePath);
76899
77783
  }
76900
77784
  yield* sync(() => {
76901
- for (const subdirectory of ["", ...input.configSubdirectories ?? []]) for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
76902
- const sourcePath = path.join(input.directory, subdirectory, configFilename);
76903
- const targetPath = path.resolve(resolvedTempDirectory, subdirectory, configFilename);
76904
- if (!isPathInsideDirectory(targetPath, resolvedTempDirectory)) continue;
76905
- if (isFile(sourcePath) && !fs.existsSync(targetPath)) {
76906
- fs.mkdirSync(path.dirname(targetPath), { recursive: true });
76907
- fs.cpSync(sourcePath, targetPath);
77785
+ const sourceDirectory = path.resolve(input.directory);
77786
+ const projectDirectories = new Set(["", ...input.configSubdirectories ?? []]);
77787
+ const intermediateDirectories = /* @__PURE__ */ new Set();
77788
+ for (const subdirectory of projectDirectories) {
77789
+ const projectDirectory = path.resolve(sourceDirectory, subdirectory);
77790
+ if (!isPathInsideDirectory(projectDirectory, sourceDirectory)) continue;
77791
+ for (const ancestor of ancestorDirectories(projectDirectory, { includeStart: false })) {
77792
+ if (!isPathInsideDirectory(ancestor, sourceDirectory)) break;
77793
+ const relativeDirectory = path.relative(sourceDirectory, ancestor);
77794
+ if (!projectDirectories.has(relativeDirectory)) intermediateDirectories.add(relativeDirectory);
76908
77795
  }
76909
77796
  }
77797
+ const copyConfigs = (subdirectory, filenames) => {
77798
+ for (const configFilename of filenames) {
77799
+ const sourcePath = path.join(input.directory, subdirectory, configFilename);
77800
+ const targetPath = path.resolve(resolvedTempDirectory, subdirectory, configFilename);
77801
+ if (!isPathInsideDirectory(targetPath, resolvedTempDirectory)) continue;
77802
+ if (isFile(sourcePath) && !fs.existsSync(targetPath)) {
77803
+ fs.mkdirSync(path.dirname(targetPath), { recursive: true });
77804
+ fs.cpSync(sourcePath, targetPath);
77805
+ }
77806
+ }
77807
+ };
77808
+ for (const subdirectory of projectDirectories) copyConfigs(subdirectory, STAGED_FILES_PROJECT_CONFIG_FILENAMES);
77809
+ for (const subdirectory of intermediateDirectories) copyConfigs(subdirectory, [
77810
+ "package.json",
77811
+ "pnpm-workspace.yaml",
77812
+ "nx.json",
77813
+ ...LINT_IGNORE_STYLE_FILENAMES,
77814
+ LINT_LINGUIST_FILENAME
77815
+ ]);
76910
77816
  });
76911
77817
  return {
76912
77818
  tempDirectory: input.tempDirectory,
@@ -77771,7 +78677,7 @@ const makeNoopConsole = () => ({
77771
78677
  });
77772
78678
  //#endregion
77773
78679
  //#region src/cli/utils/version.ts
77774
- const VERSION = "0.9.23-dev.dfffab3";
78680
+ const VERSION = "0.9.23-dev.eeff4d4";
77775
78681
  //#endregion
77776
78682
  //#region src/cli/utils/json-mode.ts
77777
78683
  let context = null;
@@ -78115,5 +79021,5 @@ const recordDistribution = (name, value, options = {}) => {
78115
79021
  //#endregion
78116
79022
  export { buildRuleSeverityControls as $, runInspect as $t, Files as A, buildWithScope as An, hasPublishedFixRecipe as At, PerFileLintCacheEnabled as B, yieldToEventLoop as Bn, listSourceFiles as Bt, ACTION_INPUT_ENVIRONMENT_VARIABLES as C, provideContext as Cn, getChangedLineRanges as Ct, isCodingAgentEnvironment as D, sync as Dn, getRuleMetadata as Dt, isCiOrCodingAgentEnvironment as E, runSync as En, getEquivalentRuleKeys as Et, Linter as F, makeUnsafe$5 as Fn, isProjectDiscoveryError as Ft, SidecarLintCacheEnabled as G, isFile as Gn, materializeSourceTree as Gt, Project as H, toCanonicalPath as Hn, listWorkspacePackages as Ht, Maintainability as I, fail$5 as In, isReactDoctorError as It, anonymizeInPlace as J, remainingDeadlineBudgetMs as Jt, StagedFiles as K, isPlainObject as Kn, mergeAndFilterDiagnostics as Kt, NodeResolver as L, void_$1 as Ln, isSameRuleKey as Lt, InvocationCaches as M, provide$2 as Mn, hashFileContents as Mt, LEGACY_CONFIG_FILENAME as N, succeed$3 as Nn, highlighter as Nt, Config as O, try_ as On, getUnknownBundledRuleKeys as Ot, LintPartialFailures as P, close as Pn, isPathInsideDirectory as Pt, buildRuleDocsUrl as Q, restoreLegacyThrow as Qt, OxlintConcurrency as R, ParentSpan as Rn, isScanComplete as Rt, isDebugFlagEnabled as S, provide as Sn, getBaselineDiffPlan as St, isCiEnvironment as T, runPromise as Tn, getDiffInfo as Tt, Reporter as U, isDirectory as Un, loadConfigWithSource as Ut, Progress as V, messageFromUnknown as Vn, listSourceFilesCooperative as Vt, Score as W, isErrnoException as Wn, mapWithConcurrency as Wt, atomicWriteJson as X, resolveLintBatchOrdering as Xt, anonymizeText as Y, resolveGithubActionsScoreMetadata as Yt, buildJsonReport as Z, resolveScanTarget as Zt, VERSION as _, gen as _n, findGitRepositoryRoot as _t, isEnvFlagEnabled as a, validateConfigTypes as an, collectSourceFilesByDirectory as at, isNonInteractiveEnvironment as b, orElseSucceed as bn, formatErrorChain as bt, setSentryProjectInfo as c, Console as cn, countOptInProjectRuleSelections as ct, isJsonModeActive as d, log as dn, createOxlintSpawnSlots as dt, scrubSensitivePaths as en, buildSkippedChecks as et, setJsonReportDirectory as f, warn$1 as fn, detectAiTrainingEnvironment as ft, writeJsonReport as g, make$30 as gn, filterSourceFiles as gt, writeJsonErrorReport as h, decodeUnknownSync as hn, filterPathsOutsideDirectories as ht, isTelemetryEnabled as i, toRelativePath as in, clearConfigCache as it, Git as j, mergeAll$1 as jn, hasSupportedFrameworkOrLibrary as jt, DIAGNOSTIC_DELTA_IDENTITY as k, void_ as kn, groupBy as kt, getRunId as l, error as ln, createChangedLineMatcher as lt, writeJsonCancellationReport as m, JsonReport as mn, filterDiagnosticsForSurface as mt, recordDistribution as n, shouldUseMaintainabilityLayer as nn, canonicalizeUserRuleKey as nt, buildSentryScope as o, warmDuplicateJsxWorker as on, computeConfigFingerprint as ot, setJsonReportMode as p, Diagnostic as pn, discoverSupportedSubprojects as pt, SupplyChain as q, mergeReactDoctorConfigs as qt, toSpanAttributes as r, summarizeDiagnostics as rn, classifyFileContext as rt, buildSentryProjectContext as s, warmOxlintWorkerPool as sn, computeDiagnosticDelta as st, recordCount as t, setColorEnabled as tn, calculateScore as tt, enableJsonMode as u, info as un, createInvocationCaches as ut, makeNoopConsole as v, makeSpan$1 as vn, findLegacyConfig as vt, detectRunnerOs as w, provideService as wn, getDiagnosticRuleIdentity as wt, isGitHookEnvironment as x, promise as xn, formatReactDoctorError as xt, CliInputError as y, map$3 as yn, fingerprintDiagnosticEvidence as yt, OxlintSpawnSlots as z, isMonorepoRoot as zn, layerObservability as zt };
78117
79023
 
78118
- //# sourceMappingURL=record-metric-CWxS2npr.js.map
78119
- //# debugId=f2b47816-a0c6-5228-a261-97a495a1bb85
79024
+ //# sourceMappingURL=record-metric-CqZ2oVM5.js.map
79025
+ //# debugId=4f395a61-8b10-59b6-9932-c6b841e1f49d