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
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5255a206-f2ac-51fa-9a2f-9480ba58e9d7")}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]="835688e2-3e41-50bb-9c66-fa5b45d875d1")}catch(e){}}();
3
3
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-ChKA3wi6.js";
4
4
  import { createRequire } from "node:module";
5
5
  import * as fs$1$2 from "node:fs";
@@ -26,12 +26,16 @@ import { PassThrough } from "node:stream";
26
26
  import { convertToTSX } from "@astrojs/compiler/sync";
27
27
  import { STATUS_CODES } from "node:http";
28
28
  import { gzipSync } from "node:zlib";
29
- //#region ../core/dist/constants-BSeQaOcv.js
29
+ //#region ../core/dist/constants-BCogC6RN.js
30
30
  const HTML_FILE_PATTERN = /\.html$/i;
31
31
  const SOURCE_FILE_PATTERN = /\.(?:astro|tsx?|jsx?|mts|mjs|[hH][tT][mM][lL])$/;
32
32
  const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
33
33
  const GENERATED_SOURCE_DIRECTORY_PATTERN = /(?:^|\/)__generated__\//;
34
34
  const MINIFIED_SNIFF_BYTES = 65536;
35
+ const VITE_ENTRY_ASSET_FILE_PATTERN = /(?:^|[/\\])assets[/\\][^/\\]+-[\w-]{8}\.m?js$/;
36
+ const VITE_ENTRY_PRELUDE_SNIFF_BYTES = 1024;
37
+ const VITE_ENTRY_DENSITY_SAMPLE_BYTES = 32768;
38
+ MINIFIED_SNIFF_BYTES + 2 * VITE_ENTRY_DENSITY_SAMPLE_BYTES;
35
39
  const GIT_LS_FILES_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
36
40
  const GIT_SOURCE_LISTING_ARGUMENTS = [
37
41
  "ls-files",
@@ -304,6 +308,12 @@ const ES_TARGET_YEAR_BY_NAME = {
304
308
  */
305
309
  const TSCONFIG_FILENAMES = ["tsconfig.json", "tsconfig.base.json"];
306
310
  const DISABLE_DIRECTIVE_BACKUP_DIRECTORY_SEGMENTS = [".react-doctor", "audit-backups"];
311
+ const LINT_IGNORE_STYLE_FILENAMES = [
312
+ ".eslintignore",
313
+ ".oxlintignore",
314
+ ".prettierignore"
315
+ ];
316
+ const LINT_LINGUIST_FILENAME = ".gitattributes";
307
317
  /**
308
318
  * Project-config files that `StagedFiles.materialize` copies into
309
319
  * the temp directory alongside staged sources so oxlint resolves
@@ -315,6 +325,8 @@ const STAGED_FILES_PROJECT_CONFIG_FILENAMES = [
315
325
  "tsconfig.json",
316
326
  "tsconfig.base.json",
317
327
  "package.json",
328
+ "pnpm-workspace.yaml",
329
+ "nx.json",
318
330
  "doctor.config.ts",
319
331
  "doctor.config.mts",
320
332
  "doctor.config.cts",
@@ -324,8 +336,11 @@ const STAGED_FILES_PROJECT_CONFIG_FILENAMES = [
324
336
  "doctor.config.json",
325
337
  "doctor.config.jsonc",
326
338
  "oxlint.json",
327
- ".oxlintrc.json"
339
+ ".oxlintrc.json",
340
+ ...LINT_IGNORE_STYLE_FILENAMES,
341
+ LINT_LINGUIST_FILENAME
328
342
  ];
343
+ [...LINT_IGNORE_STYLE_FILENAMES];
329
344
  const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
330
345
  const OXLINT_SPAWN_TIMEOUT_MS = 6e4;
331
346
  const NODE_COMPILE_CACHE_DIR_NAME = "node-compile-cache";
@@ -441,7 +456,7 @@ const isPlainObject = (value) => {
441
456
  //#region ../core/dist/react-compiler-detection-worker-protocol-Dp5LlrE8.js
442
457
  const isReactCompilerDetectionReply = (value) => typeof value === "object" && value !== null && "id" in value && typeof value.id === "number" && "hasReactCompiler" in value && (typeof value.hasReactCompiler === "boolean" || value.hasReactCompiler === null);
443
458
  //#endregion
444
- //#region ../core/dist/react-compiler-detection-client-oiOwecj7.js
459
+ //#region ../core/dist/react-compiler-detection-client-Cdrl3lr2.js
445
460
  const pendingOutputsByRequestKey = /* @__PURE__ */ new Map();
446
461
  const toRequestKey = (request) => [
447
462
  request.directory,
@@ -2716,7 +2731,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2716
2731
  module.exports = picomatch;
2717
2732
  }));
2718
2733
  //#endregion
2719
- //#region ../core/dist/collect-unplugin-auto-import-global-scopes-Z9dhela6.js
2734
+ //#region ../core/dist/collect-unplugin-auto-import-global-scopes-nxDYvwKf.js
2720
2735
  var import_picomatch = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
2721
2736
  const pico = require_picomatch$1();
2722
2737
  const utils = require_utils();
@@ -2832,6 +2847,7 @@ const compileGlobPatternsLenient = (patterns, onInvalid) => {
2832
2847
  }
2833
2848
  return compiled;
2834
2849
  };
2850
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
2835
2851
  const isOxcAstNode = (value) => Boolean(value) && typeof value === "object" && typeof value.type === "string";
2836
2852
  const getStaticModuleSpecifier = (value) => {
2837
2853
  if (!isOxcAstNode(value)) return void 0;
@@ -3166,7 +3182,7 @@ const collectUnpluginAutoImportGlobalScopes = ({ rootDirectory, candidateFiles }
3166
3182
  return scopes.some((scope) => scope.names.length > 0) ? scopes : [];
3167
3183
  };
3168
3184
  //#endregion
3169
- //#region ../core/dist/detect-duplicate-jsx-subtrees-B5UWtUyz.js
3185
+ //#region ../core/dist/detect-duplicate-jsx-subtrees-DKRoO0e9.js
3170
3186
  const yieldToEventLoop = () => new Promise((resolve) => {
3171
3187
  setImmediate(resolve);
3172
3188
  });
@@ -3730,7 +3746,7 @@ const detectDuplicateJsxSubtreesCooperative = async (sourceReader, options = {})
3730
3746
  });
3731
3747
  };
3732
3748
  //#endregion
3733
- //#region ../core/dist/detect-react-compiler-DLpaU8gr.js
3749
+ //#region ../core/dist/detect-react-compiler-B2QVSnc0.js
3734
3750
  const NEXT_CONFIG_FILENAMES = [
3735
3751
  "next.config.js",
3736
3752
  "next.config.mjs",
@@ -12328,7 +12344,7 @@ const orDie$1 = (self) => catch_$2(self, die$1);
12328
12344
  /** @internal */
12329
12345
  const orElseSucceed$1 = /* @__PURE__ */ dual(2, (self, f) => catch_$2(self, (_) => sync$2(f)));
12330
12346
  /** @internal */
12331
- const ignore$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, options) => {
12347
+ const ignore$2 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, options) => {
12332
12348
  if (!options?.log) return matchEffect$2(self, {
12333
12349
  onFailure: (_) => void_$2,
12334
12350
  onSuccess: (_) => void_$2
@@ -17864,7 +17880,7 @@ const retry = retry$1;
17864
17880
  * @category error handling
17865
17881
  * @since 2.0.0
17866
17882
  */
17867
- const ignore = ignore$1;
17883
+ const ignore$1 = ignore$2;
17868
17884
  /**
17869
17885
  * Recovers from a typed failure by producing a fallback success value.
17870
17886
  *
@@ -63699,7 +63715,7 @@ const make$8 = /* @__PURE__ */ fnUntraced(function* (options) {
63699
63715
  if (disabledUntil !== void 0) return void_;
63700
63716
  runExportFork(runExport);
63701
63717
  return awaitEmpty(exportFibers);
63702
- }).pipe(ignore, interruptible, timeoutOption(options.shutdownTimeout)));
63718
+ }).pipe(ignore$1, interruptible, timeoutOption(options.shutdownTimeout)));
63703
63719
  yield* sleep(exportInterval).pipe(andThen(run(exportFibers, runExport)), flatMap$2(await_), forever, forkIn(scope));
63704
63720
  return { push(data) {
63705
63721
  if (disabledUntil !== void 0) return;
@@ -65757,11 +65773,11 @@ const layer$2 = /* @__PURE__ */ effect(ChildProcessSpawner, /* @__PURE__ */ gen(
65757
65773
  const killWithTimeout = withTimeout(childProcess, cmd, cmd.options);
65758
65774
  if (exited) {
65759
65775
  const [code] = yield* _await(exitSignal);
65760
- if (code !== 0 && isNotNull(code)) return yield* ignore(killWithTimeout(killProcessGroup));
65776
+ if (code !== 0 && isNotNull(code)) return yield* ignore$1(killWithTimeout(killProcessGroup));
65761
65777
  return yield* void_;
65762
65778
  }
65763
65779
  if (!isReferenced) return yield* void_;
65764
- return yield* killWithTimeout((command, childProcess, signal) => killProcessGroup(command, childProcess, signal).pipe(catch_$1(() => killProcess(command, childProcess, signal)), andThen(_await(exitSignal)))).pipe(ignore);
65780
+ return yield* killWithTimeout((command, childProcess, signal) => killProcessGroup(command, childProcess, signal).pipe(catch_$1(() => killProcess(command, childProcess, signal)), andThen(_await(exitSignal)))).pipe(ignore$1);
65765
65781
  }));
65766
65782
  const pid = ProcessId(childProcess.pid);
65767
65783
  childProcess.on("exit", (code) => {
@@ -66307,6 +66323,571 @@ const layer = /* @__PURE__ */ succeed$3(Path)({
66307
66323
  });
66308
66324
  //#endregion
66309
66325
  //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
66326
+ var import_ignore = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
66327
+ function makeArray(subject) {
66328
+ return Array.isArray(subject) ? subject : [subject];
66329
+ }
66330
+ const UNDEFINED = void 0;
66331
+ const EMPTY = "";
66332
+ const SPACE = " ";
66333
+ const ESCAPE = "\\";
66334
+ const REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
66335
+ const BOM = "";
66336
+ const REGEX_ANCHORED_GLOBSTAR = /^\/\*{2,}$/;
66337
+ const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
66338
+ const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
66339
+ const REGEX_SPLITALL_CRLF = /\r?\n/g;
66340
+ const DOUBLE_SLASH = "//";
66341
+ const SLASH_CODE = 47;
66342
+ const DOT_CODE = 46;
66343
+ const SLASH = "/";
66344
+ let TMP_KEY_IGNORE = "node-ignore";
66345
+ /* istanbul ignore else */
66346
+ if (typeof Symbol !== "undefined") TMP_KEY_IGNORE = Symbol.for("node-ignore");
66347
+ const KEY_IGNORE = TMP_KEY_IGNORE;
66348
+ const define = (object, key, value) => {
66349
+ Object.defineProperty(object, key, { value });
66350
+ return value;
66351
+ };
66352
+ const RETURN_FALSE = () => false;
66353
+ const POSIX_CLASSES = {
66354
+ alnum: "0-9A-Za-z",
66355
+ alpha: "A-Za-z",
66356
+ blank: " \\t",
66357
+ cntrl: "\\x00-\\x1f\\x7f",
66358
+ digit: "0-9",
66359
+ graph: "!-.0-~",
66360
+ lower: "a-z",
66361
+ print: " -.0-~",
66362
+ punct: "!-.:-@\\[-`{-~",
66363
+ space: " \\t\\n\\r",
66364
+ upper: "A-Z",
66365
+ xdigit: "0-9A-Fa-f"
66366
+ };
66367
+ const CLASS_MEMBERS_TO_ESCAPE = "\\]^-[";
66368
+ const escapeMember = (char) => CLASS_MEMBERS_TO_ESCAPE.indexOf(char) < 0 ? char : ESCAPE + char;
66369
+ const NON_SLASH = "(?!\\/)";
66370
+ const classSource = (negated, body) => {
66371
+ if (negated) return `[^\\/${body}]`;
66372
+ const source = `[${body}]`;
66373
+ return new RegExp(source).test("/") ? NON_SLASH + source : source;
66374
+ };
66375
+ const scanBracket = (pattern, start) => {
66376
+ const { length } = pattern;
66377
+ let index = start + 1;
66378
+ let negated = EMPTY;
66379
+ const lead = pattern[index];
66380
+ if (lead === "!" || lead === "^") {
66381
+ negated = "^";
66382
+ index++;
66383
+ }
66384
+ let body = EMPTY;
66385
+ let prev = EMPTY;
66386
+ for (;;) {
66387
+ const char = pattern[index];
66388
+ if (char === UNDEFINED) return null;
66389
+ if (char === ESCAPE) {
66390
+ const escaped = pattern[++index];
66391
+ body += escapeMember(escaped);
66392
+ prev = escaped;
66393
+ } else if (char === "-" && prev && index + 1 < length && pattern[index + 1] !== "]") {
66394
+ index++;
66395
+ let to = pattern[index];
66396
+ if (to === ESCAPE) to = pattern[index += 1];
66397
+ if (prev <= to) body += `-${escapeMember(to)}`;
66398
+ prev = EMPTY;
66399
+ } else if (char === "[" && pattern[index + 1] === ":") {
66400
+ const nameStart = index + 2;
66401
+ let end = nameStart;
66402
+ while (end < length && pattern[end] !== "]") end++;
66403
+ if (end === length) return null;
66404
+ if (end > nameStart && pattern[end - 1] === ":") {
66405
+ const name = pattern.slice(nameStart, end - 1);
66406
+ if (!Object.prototype.hasOwnProperty.call(POSIX_CLASSES, name)) return null;
66407
+ body += POSIX_CLASSES[name];
66408
+ prev = EMPTY;
66409
+ index = end;
66410
+ } else {
66411
+ body += escapeMember("[");
66412
+ prev = "[";
66413
+ index = nameStart - 2;
66414
+ }
66415
+ } else {
66416
+ body += escapeMember(char);
66417
+ prev = char;
66418
+ }
66419
+ index++;
66420
+ if (pattern[index] === "]") return {
66421
+ end: index,
66422
+ source: classSource(negated, body)
66423
+ };
66424
+ }
66425
+ };
66426
+ const NEVER_MATCH = "[]";
66427
+ const PLACEHOLDER = "\0";
66428
+ const REGEX_RESTORE_PLACEHOLDER = new RegExp(`${PLACEHOLDER}(\\d+)${PLACEHOLDER}`, "g");
66429
+ const TRAILING_WILDCARD = "";
66430
+ const TRAILING_DOUBLESTAR = "";
66431
+ const isReserved = (char) => char === PLACEHOLDER || char === TRAILING_WILDCARD || char === TRAILING_DOUBLESTAR;
66432
+ const extractBrackets = (pattern) => {
66433
+ const sources = [];
66434
+ const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
66435
+ const { length } = pattern;
66436
+ let out = EMPTY;
66437
+ let index = 0;
66438
+ while (index < length) {
66439
+ const char = pattern[index];
66440
+ if (char === ESCAPE) {
66441
+ const escaped = pattern[index + 1];
66442
+ if (escaped === SLASH && index + 2 === length) out += hold(NEVER_MATCH);
66443
+ else if (escaped === "*" || escaped === "[" || escaped === SPACE) out += pattern.slice(index, index + 2);
66444
+ else out += hold(REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : isReserved(escaped) ? `[${escaped}]` : escaped);
66445
+ index += 2;
66446
+ } else if (isReserved(char)) {
66447
+ out += hold(`[${char}]`);
66448
+ index++;
66449
+ } else if (char === "[") {
66450
+ const scanned = scanBracket(pattern, index);
66451
+ if (scanned === null) {
66452
+ out += hold(NEVER_MATCH);
66453
+ index = length;
66454
+ } else {
66455
+ out += hold(scanned.source);
66456
+ index = scanned.end + 1;
66457
+ }
66458
+ } else {
66459
+ out += char;
66460
+ index++;
66461
+ }
66462
+ }
66463
+ return {
66464
+ source: out,
66465
+ sources
66466
+ };
66467
+ };
66468
+ const DIRECT = null;
66469
+ const REGEX_INNER_SLASH = /\/(?!$)/;
66470
+ const WILDCARD = "[^\\/]*";
66471
+ const REPLACERS = [
66472
+ [
66473
+ /(\\+)( ?)/g,
66474
+ (_, run, space) => space ? run.slice(0, run.length - run.length % 2) + SPACE : run,
66475
+ ESCAPE + SPACE
66476
+ ],
66477
+ [
66478
+ /(^|\/)\*{3,}(?=\/|$)/g,
66479
+ (_, start) => `${start}**`,
66480
+ "*"
66481
+ ],
66482
+ [/[\\$.|*+(){^]/g, (match) => `\\${match}`],
66483
+ [
66484
+ /(?!\\)\?/g,
66485
+ () => "[^/]",
66486
+ "?"
66487
+ ],
66488
+ [
66489
+ /^\//,
66490
+ () => "^",
66491
+ SLASH
66492
+ ],
66493
+ [
66494
+ /\//g,
66495
+ () => "\\/",
66496
+ SLASH
66497
+ ],
66498
+ [
66499
+ /^\^*(?:\\\*\\\*\\\/)+/,
66500
+ () => "(?:^|\\/)",
66501
+ "*"
66502
+ ],
66503
+ [DIRECT, (source, pattern) => {
66504
+ if (!source || source[0] === "^" || source[0] === "(") return source;
66505
+ return (!REGEX_INNER_SLASH.test(pattern) ? "(?:^|\\/)" : "^") + source;
66506
+ }],
66507
+ [
66508
+ /\\\/\\\*\\\*(?=\\\/|$)/g,
66509
+ (_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : `\\/${TRAILING_DOUBLESTAR}`,
66510
+ "*"
66511
+ ],
66512
+ [
66513
+ /(^|[^\\])(?:\\\*)+(?!$)/g,
66514
+ (_, p1) => p1 + WILDCARD,
66515
+ "*"
66516
+ ],
66517
+ [
66518
+ /(^|[^\\])((?:\\\\)*)\\\*$/,
66519
+ (match, p1, p2) => p2 === EMPTY ? p1 + TRAILING_WILDCARD : match,
66520
+ "*"
66521
+ ],
66522
+ [
66523
+ /\\\\\\(?=[$.|*+(){^])/g,
66524
+ () => ESCAPE,
66525
+ ESCAPE + ESCAPE
66526
+ ],
66527
+ [
66528
+ /\\\\/g,
66529
+ () => ESCAPE,
66530
+ ESCAPE + ESCAPE
66531
+ ],
66532
+ [
66533
+ /\\\[([^\]/]*?)($|\])/g,
66534
+ (match, range, close) => `\\[${range}${close}`,
66535
+ "["
66536
+ ],
66537
+ [DIRECT, (source) => {
66538
+ const last = source[source.length - 1];
66539
+ if (!last || last === TRAILING_WILDCARD || last === TRAILING_DOUBLESTAR) return source;
66540
+ return last === SLASH ? `${source}$` : `${source}(?=$|\\/$)`;
66541
+ }]
66542
+ ];
66543
+ const REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\uE000$/;
66544
+ const MODE_IGNORE = "regex";
66545
+ const MODE_CHECK_IGNORE = "checkRegex";
66546
+ const UNDERSCORE = "_";
66547
+ const replaceTrailingWildcard = (_, p1) => {
66548
+ return `${p1 ? `${p1}[^/]+` : "[^/]*"}(?=$|\\/$)`;
66549
+ };
66550
+ const REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
66551
+ const replaceTrailingDoublestar = () => "[\\s\\S]";
66552
+ const separatorAfter = (run, at) => {
66553
+ let separator = EMPTY;
66554
+ for (let index = at + 1; index < run.length && !run[index].wildcard; index++) separator += run[index].single;
66555
+ return separator;
66556
+ };
66557
+ const pinWildcards = (source) => {
66558
+ if (source.indexOf(WILDCARD) < 0) return source;
66559
+ const tokens = [];
66560
+ const { length } = source;
66561
+ let index = 0;
66562
+ while (index < length) {
66563
+ const char = source[index];
66564
+ if (source.startsWith(WILDCARD, index)) {
66565
+ tokens.push({ wildcard: true });
66566
+ index += 6;
66567
+ } else if (char === "[") {
66568
+ let end = index + 1;
66569
+ if (source[end] === "^") end++;
66570
+ if (source[end] === "]") end++;
66571
+ while (end < length && source[end] !== "]") end += source[end] === ESCAPE ? 2 : 1;
66572
+ end++;
66573
+ tokens.push({ single: source.slice(index, end) });
66574
+ index = end;
66575
+ } else if (char === ESCAPE) {
66576
+ tokens.push({ single: source.slice(index, index + 2) });
66577
+ index += 2;
66578
+ } else if (char === "(") {
66579
+ let depth = 0;
66580
+ let end = index;
66581
+ do {
66582
+ if (source[end] === ESCAPE) end++;
66583
+ else if (source[end] === "(") depth++;
66584
+ else if (source[end] === ")") depth--;
66585
+ end++;
66586
+ } while (end < length && depth > 0);
66587
+ if ("*+?".indexOf(source[end]) >= 0) end++;
66588
+ tokens.push({ boundary: source.slice(index, end) });
66589
+ index = end;
66590
+ } else if (char === "^" || char === "$") {
66591
+ tokens.push({ boundary: char });
66592
+ index++;
66593
+ } else {
66594
+ tokens.push({ single: char });
66595
+ index++;
66596
+ }
66597
+ }
66598
+ let out = EMPTY;
66599
+ let run = [];
66600
+ const flush = () => {
66601
+ let lastWildcard;
66602
+ run.forEach((token, at) => {
66603
+ if (token.wildcard) lastWildcard = at;
66604
+ });
66605
+ run.forEach((token, at) => {
66606
+ if (!token.wildcard) {
66607
+ out += token.single;
66608
+ return;
66609
+ }
66610
+ out += at === lastWildcard ? WILDCARD : `(?:(?!${separatorAfter(run, at)})[^\\/])*`;
66611
+ });
66612
+ run = [];
66613
+ };
66614
+ tokens.forEach((token) => {
66615
+ if (token.boundary === void 0) {
66616
+ run.push(token);
66617
+ return;
66618
+ }
66619
+ flush();
66620
+ out += token.boundary;
66621
+ });
66622
+ flush();
66623
+ return out;
66624
+ };
66625
+ const makeRegexPrefix = (pattern) => {
66626
+ if (REGEX_ANCHORED_GLOBSTAR.test(pattern)) pattern = "**";
66627
+ const { source, sources } = extractBrackets(pattern);
66628
+ const replaced = REPLACERS.reduce((prev, [matcher, replacer, required]) => {
66629
+ if (matcher === DIRECT) return replacer(prev, pattern);
66630
+ if (required !== UNDEFINED && prev.indexOf(required) < 0) return prev;
66631
+ return matcher.test(prev) ? prev.replace(matcher, replacer.bind(pattern)) : prev;
66632
+ }, source);
66633
+ return sources.length ? replaced.replace(REGEX_RESTORE_PLACEHOLDER, (match, index) => sources[index]) : replaced;
66634
+ };
66635
+ const checkSourceOf = (body, prefix) => {
66636
+ if (body[body.length - 1] === SLASH) prefix = makeRegexPrefix(body.slice(0, -1));
66637
+ const head = prefix.slice(0, -1);
66638
+ const last = prefix[prefix.length - 1];
66639
+ return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? head : NEVER_MATCH;
66640
+ };
66641
+ const matchesBasename = (body) => {
66642
+ const index = body.indexOf(SLASH);
66643
+ return index < 0 || index === body.length - 1;
66644
+ };
66645
+ const basenameOf = (path) => {
66646
+ const end = path.length - 1;
66647
+ const index = path.lastIndexOf(SLASH, path[end] === SLASH ? end - 1 : end);
66648
+ return index < 0 ? path : path.slice(index + 1);
66649
+ };
66650
+ const parentOf = (path) => {
66651
+ if (path.charCodeAt(0) === SLASH_CODE || path.indexOf(DOUBLE_SLASH) >= 0) {
66652
+ const slices = path.split(SLASH).filter(Boolean);
66653
+ slices.pop();
66654
+ return slices.length ? slices.join(SLASH) + SLASH : EMPTY;
66655
+ }
66656
+ const end = path.length - 1;
66657
+ const cut = path.lastIndexOf(SLASH, path.charCodeAt(end) === SLASH_CODE ? end - 1 : end);
66658
+ return cut < 0 ? EMPTY : path.slice(0, cut + 1);
66659
+ };
66660
+ const isString = (subject) => typeof subject === "string";
66661
+ const checkPattern = (pattern) => pattern && isString(pattern);
66662
+ const splitPattern = (pattern) => (pattern[pattern.length - 1] === "\r" ? pattern.slice(0, -1) : pattern).split(REGEX_SPLITALL_CRLF).filter(Boolean);
66663
+ var IgnoreRule = class {
66664
+ constructor(pattern, mark, body, ignoreCase, negative, prefix) {
66665
+ this.pattern = pattern;
66666
+ this.mark = mark;
66667
+ this.negative = negative;
66668
+ define(this, "body", body);
66669
+ define(this, "ignoreCase", ignoreCase);
66670
+ define(this, "regexPrefix", prefix);
66671
+ }
66672
+ get _basenameOnly() {
66673
+ return define(this, "_basenameOnly", matchesBasename(this.body));
66674
+ }
66675
+ get regex() {
66676
+ const key = UNDERSCORE + MODE_IGNORE;
66677
+ if (this[key]) return this[key];
66678
+ return this._make(MODE_IGNORE, key);
66679
+ }
66680
+ get checkRegex() {
66681
+ const key = UNDERSCORE + MODE_CHECK_IGNORE;
66682
+ if (this[key]) return this[key];
66683
+ return this._make(MODE_CHECK_IGNORE, key);
66684
+ }
66685
+ _make(mode, key) {
66686
+ 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));
66687
+ const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
66688
+ return define(this, key, regex);
66689
+ }
66690
+ };
66691
+ const hasTrailingBackslash = (str) => {
66692
+ let count = 0;
66693
+ while (str[str.length - count - 1] === ESCAPE) count++;
66694
+ return count % 2 === 1;
66695
+ };
66696
+ const trimEnd = (body, stripLineEnd) => {
66697
+ let lineEnd = body.length;
66698
+ let end;
66699
+ for (;;) {
66700
+ if (stripLineEnd && body[lineEnd - 1] === "\r") lineEnd--;
66701
+ end = lineEnd;
66702
+ while (body[end - 1] === SPACE) end--;
66703
+ if (!stripLineEnd || body[end - 1] !== "\n") break;
66704
+ lineEnd = end - 1;
66705
+ }
66706
+ if (end === lineEnd) return body.slice(0, lineEnd);
66707
+ let backslashes = 0;
66708
+ while (body[end - backslashes - 1] === ESCAPE) backslashes++;
66709
+ return backslashes % 2 ? body.slice(0, end - 1) + SPACE : body.slice(0, end);
66710
+ };
66711
+ const createRule = (pattern, mark, ignoreCase, stripLineEnd, stripBOM) => {
66712
+ let body = stripBOM && pattern[0] === BOM ? pattern.slice(1) : pattern;
66713
+ if (body[0] === "#") return;
66714
+ let negative = false;
66715
+ if (body[0] === "!") {
66716
+ negative = true;
66717
+ body = body.slice(1);
66718
+ }
66719
+ const last = body[body.length - 1];
66720
+ if (last === SPACE || stripLineEnd && (last === "\r" || last === "\n")) body = trimEnd(body, stripLineEnd);
66721
+ if (!body || hasTrailingBackslash(body)) return;
66722
+ body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
66723
+ const regexPrefix = makeRegexPrefix(body);
66724
+ return new IgnoreRule(pattern, mark, body, ignoreCase, negative, regexPrefix);
66725
+ };
66726
+ var RuleManager = class {
66727
+ constructor(ignoreCase) {
66728
+ this._ignoreCase = ignoreCase;
66729
+ this._rules = [];
66730
+ this._basenameCount = 0;
66731
+ }
66732
+ _add(pattern, index) {
66733
+ if (pattern && pattern[KEY_IGNORE]) {
66734
+ this._rules = this._rules.concat(pattern._rules._rules);
66735
+ this._basenameCount += pattern._rules._basenameCount;
66736
+ this._added = true;
66737
+ return;
66738
+ }
66739
+ const isStr = isString(pattern);
66740
+ const raw = isStr ? pattern : pattern.pattern;
66741
+ const rule = checkPattern(raw) && createRule(raw, isStr ? UNDEFINED : pattern.mark, this._ignoreCase, !this._split, this._stripBOM && !index);
66742
+ if (rule) {
66743
+ this._added = true;
66744
+ this._rules.push(rule);
66745
+ if (matchesBasename(rule.body)) this._basenameCount++;
66746
+ }
66747
+ }
66748
+ add(pattern) {
66749
+ this._added = false;
66750
+ this._split = isString(pattern);
66751
+ this._stripBOM = !this._split || pattern[0] === BOM;
66752
+ makeArray(this._split ? splitPattern(pattern) : pattern).forEach(this._add, this);
66753
+ if (this._added) this._literalRules = UNDEFINED;
66754
+ return this._added;
66755
+ }
66756
+ testLiteral(path) {
66757
+ const rules = this._literalRules || (this._literalRules = this._rules.filter(({ body }) => body[body.length - (body[body.length - 1] === SLASH ? 2 : 1)] === "*"));
66758
+ let ignored = false;
66759
+ let unignored = false;
66760
+ let matchedRule;
66761
+ for (let index = rules.length - 1; index >= 0; index--) {
66762
+ const rule = rules[index];
66763
+ if (rule.checkRegex.test(path)) {
66764
+ ignored = !rule.negative;
66765
+ unignored = rule.negative;
66766
+ matchedRule = rule.negative ? UNDEFINED : rule;
66767
+ break;
66768
+ }
66769
+ }
66770
+ const ret = {
66771
+ ignored,
66772
+ unignored
66773
+ };
66774
+ if (matchedRule) ret.rule = matchedRule;
66775
+ return ret;
66776
+ }
66777
+ test(path, mode) {
66778
+ const rules = this._rules;
66779
+ const { length } = rules;
66780
+ const shortcut = this._basenameCount * 2 >= length;
66781
+ const basename = shortcut ? basenameOf(path) : path;
66782
+ for (let index = length - 1; index >= 0; index--) {
66783
+ const rule = rules[index];
66784
+ if (rule[mode].test(shortcut && rule._basenameOnly ? basename : path)) {
66785
+ const { negative } = rule;
66786
+ const ret = {
66787
+ ignored: !negative,
66788
+ unignored: negative
66789
+ };
66790
+ if (!negative) ret.rule = rule;
66791
+ return ret;
66792
+ }
66793
+ }
66794
+ return {
66795
+ ignored: false,
66796
+ unignored: false
66797
+ };
66798
+ }
66799
+ };
66800
+ const throwError = (message, Ctor) => {
66801
+ throw new Ctor(message);
66802
+ };
66803
+ const checkPath = (path, originalPath, doThrow) => {
66804
+ if (!isString(path)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
66805
+ if (!path) return doThrow(`path must not be empty`, TypeError);
66806
+ if (checkPath.isNotRelative(path)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
66807
+ return true;
66808
+ };
66809
+ const isNotRelative = (path) => {
66810
+ const first = path.charCodeAt(0);
66811
+ if (first === SLASH_CODE) return true;
66812
+ if (first !== DOT_CODE) return false;
66813
+ if (path.length === 1) return true;
66814
+ const second = path.charCodeAt(1);
66815
+ if (second === SLASH_CODE) return true;
66816
+ if (second !== DOT_CODE) return false;
66817
+ return path.length === 2 || path.charCodeAt(2) === SLASH_CODE;
66818
+ };
66819
+ checkPath.isNotRelative = isNotRelative;
66820
+ /* istanbul ignore next */
66821
+ checkPath.convert = (p) => p;
66822
+ const convertPath = (target) => isString(target) && checkPath.convert(target);
66823
+ var Ignore = class {
66824
+ constructor({ ignorecase = true, ignoreCase = ignorecase, allowRelativePaths = false } = {}) {
66825
+ define(this, KEY_IGNORE, true);
66826
+ this._rules = new RuleManager(ignoreCase);
66827
+ this._strictPathCheck = !allowRelativePaths;
66828
+ this._initCache();
66829
+ }
66830
+ _initCache() {
66831
+ this._ignoreCache = Object.create(null);
66832
+ this._testCache = Object.create(null);
66833
+ }
66834
+ add(pattern) {
66835
+ if (this._rules.add(pattern)) this._initCache();
66836
+ return this;
66837
+ }
66838
+ addPattern(pattern) {
66839
+ return this.add(pattern);
66840
+ }
66841
+ _test(originalPath, cache, path) {
66842
+ checkPath(path, originalPath, this._strictPathCheck ? throwError : RETURN_FALSE);
66843
+ return path ? this._t(path, cache) : {
66844
+ ignored: false,
66845
+ unignored: false
66846
+ };
66847
+ }
66848
+ checkIgnore(target) {
66849
+ const path = convertPath(target);
66850
+ if (!path || path.charCodeAt(path.length - 1) !== SLASH_CODE) return this._test(target, this._testCache, path);
66851
+ const dir = this._t(path, this._testCache);
66852
+ if (dir.ignored) return dir;
66853
+ const literal = this._rules.testLiteral(path);
66854
+ return literal.ignored || literal.unignored ? literal : dir;
66855
+ }
66856
+ _t(path, cache) {
66857
+ if (path in cache) return cache[path];
66858
+ const parentPath = parentOf(path);
66859
+ const parent = parentPath ? this._t(parentPath, cache) : UNDEFINED;
66860
+ return cache[path] = parent && parent.ignored ? parent : this._rules.test(path, MODE_IGNORE);
66861
+ }
66862
+ ignores(path) {
66863
+ return this._test(path, this._ignoreCache, convertPath(path)).ignored;
66864
+ }
66865
+ createFilter() {
66866
+ return (path) => !this.ignores(path);
66867
+ }
66868
+ filter(paths) {
66869
+ return makeArray(paths).filter(this.createFilter());
66870
+ }
66871
+ test(path) {
66872
+ return this._test(path, this._testCache, convertPath(path));
66873
+ }
66874
+ };
66875
+ const factory = (options) => new Ignore(options);
66876
+ const isPathValid = (path) => checkPath(convertPath(path), path, RETURN_FALSE);
66877
+ /* istanbul ignore next */
66878
+ const setupWindows = () => {
66879
+ const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
66880
+ checkPath.convert = makePosix;
66881
+ const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
66882
+ checkPath.isNotRelative = (path) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
66883
+ };
66884
+ /* istanbul ignore next */
66885
+ if (typeof process !== "undefined" && process.platform === "win32") setupWindows();
66886
+ module.exports = factory;
66887
+ factory.default = factory;
66888
+ module.exports.isPathValid = isPathValid;
66889
+ define(module.exports, Symbol.for("setupWindows"), setupWindows);
66890
+ })))(), 1);
66310
66891
  var comma = ",".charCodeAt(0);
66311
66892
  ";".charCodeAt(0);
66312
66893
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -66825,17 +67406,19 @@ const collectTypeScriptEmitDuplicateJsPaths = (input) => {
66825
67406
  const isIgnoredDirectoryName = (directoryName) => IGNORED_DIRECTORIES.has(directoryName) || directoryName.startsWith(".") && !SCANNED_DOT_DIRECTORIES.has(directoryName);
66826
67407
  const hasIgnoredPathSegment = (relativePath) => relativePath.split(/[/\\]/).slice(0, -1).some((segment) => isIgnoredDirectoryName(segment));
66827
67408
  const isLintableSourceFile = (filePath) => SOURCE_FILE_PATTERN.test(filePath) && !GENERATED_BUNDLE_FILE_PATTERN.test(filePath) && !GENERATED_SOURCE_DIRECTORY_PATTERN.test(filePath);
67409
+ const hasMinifiedSample = (sample) => {
67410
+ const lines = sample.split("\n");
67411
+ const longestLineLength = lines.reduce((longest, line) => Math.max(longest, line.length), 0);
67412
+ const averageLineLength = sample.length / lines.length;
67413
+ return longestLineLength > 1e3 && averageLineLength > 500;
67414
+ };
66828
67415
  const isMinifiedSource = (absolutePath) => {
66829
67416
  let fileDescriptor;
66830
67417
  try {
66831
67418
  fileDescriptor = fs$1$2.openSync(absolutePath, "r");
66832
67419
  const buffer = Buffer.alloc(MINIFIED_SNIFF_BYTES);
66833
67420
  const bytesRead = fs$1$2.readSync(fileDescriptor, buffer, 0, MINIFIED_SNIFF_BYTES, 0);
66834
- const prefix = buffer.toString("utf8", 0, bytesRead);
66835
- const lines = prefix.split("\n");
66836
- const longestLineLength = lines.reduce((longest, line) => Math.max(longest, line.length), 0);
66837
- const averageLineLength = prefix.length / lines.length;
66838
- return longestLineLength > 1e3 && averageLineLength > 500;
67421
+ return hasMinifiedSample(buffer.toString("utf8", 0, bytesRead));
66839
67422
  } catch {
66840
67423
  return false;
66841
67424
  } finally {
@@ -66861,6 +67444,37 @@ const isLargeMinifiedFile = (absolutePath, knownSizeBytes) => {
66861
67444
  cachedIsLargeMinifiedByPath.set(absolutePath, result);
66862
67445
  return result;
66863
67446
  };
67447
+ const MODULE_PRELOAD_POLYFILL_START = /^\(function\(\)\{(?:const|let|var) [\w$]+=document\.createElement\((?:"link"|'link')\)\.relList;/;
67448
+ const MODULE_PRELOAD_POLYFILL_MARKERS = [
67449
+ /\.supports\((?:"modulepreload"|'modulepreload')\)/,
67450
+ /document\.querySelectorAll\([^)]*link\[rel=["']modulepreload["']\]/,
67451
+ /new MutationObserver\(/,
67452
+ /\.observe\(document,/
67453
+ ];
67454
+ const isMinifiedViteEntry = (absolutePath, knownSizeBytes) => {
67455
+ if (!VITE_ENTRY_ASSET_FILE_PATTERN.test(absolutePath)) return false;
67456
+ const sizeBytes = knownSizeBytes === void 0 ? statSourceFileSize(absolutePath) : knownSizeBytes;
67457
+ if (sizeBytes === null || sizeBytes < 131072) return false;
67458
+ let fileDescriptor;
67459
+ try {
67460
+ fileDescriptor = fs$1$2.openSync(absolutePath, "r");
67461
+ const buffer = Buffer.alloc(VITE_ENTRY_DENSITY_SAMPLE_BYTES);
67462
+ const preludeBytesRead = fs$1$2.readSync(fileDescriptor, buffer, 0, VITE_ENTRY_PRELUDE_SNIFF_BYTES, 0);
67463
+ const prelude = buffer.toString("utf8", 0, preludeBytesRead);
67464
+ const polyfillEndOffset = prelude.indexOf("})();");
67465
+ if (polyfillEndOffset === -1) return false;
67466
+ const polyfill = prelude.slice(0, polyfillEndOffset);
67467
+ if (!MODULE_PRELOAD_POLYFILL_START.test(polyfill) || !MODULE_PRELOAD_POLYFILL_MARKERS.every((marker) => marker.test(polyfill))) return false;
67468
+ const middleOffset = Math.max(MINIFIED_SNIFF_BYTES, Math.floor((sizeBytes - VITE_ENTRY_DENSITY_SAMPLE_BYTES) / 2));
67469
+ const tailOffset = sizeBytes - VITE_ENTRY_DENSITY_SAMPLE_BYTES;
67470
+ for (const offset of [middleOffset, tailOffset]) if (fs$1$2.readSync(fileDescriptor, buffer, 0, 32768, offset) !== 32768 || !hasMinifiedSample(buffer.toString("utf8"))) return false;
67471
+ return true;
67472
+ } catch {
67473
+ return false;
67474
+ } finally {
67475
+ if (fileDescriptor !== void 0) fs$1$2.closeSync(fileDescriptor);
67476
+ }
67477
+ };
66864
67478
  const isMissingPath = (absolutePath) => {
66865
67479
  try {
66866
67480
  fs$1$2.statSync(absolutePath);
@@ -66891,7 +67505,7 @@ const toSizedSourceFileEntry = (rootDirectory, relativePath) => {
66891
67505
  const absolutePath = path$1$1.resolve(rootDirectory, relativePath);
66892
67506
  const sizeBytes = statSourceFileSize(absolutePath);
66893
67507
  if (sizeBytes === null && isMissingPath(absolutePath)) return null;
66894
- if (isLargeMinifiedFile(absolutePath, sizeBytes)) return null;
67508
+ if (isLargeMinifiedFile(absolutePath, sizeBytes) || isMinifiedViteEntry(absolutePath, sizeBytes)) return null;
66895
67509
  return {
66896
67510
  path: relativePath,
66897
67511
  sizeBytes: sizeBytes ?? 0
@@ -70348,7 +70962,6 @@ const DEFAULT_SURFACE_EXCLUDED_TAGS = {
70348
70962
  score: ["design"],
70349
70963
  ciFailure: ["design"]
70350
70964
  };
70351
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
70352
70965
  const KNOWN_RULE_KEYS = new Set([...ALL_REACT_DOCTOR_RULE_KEYS, ...EXTERNAL_RULES.map((rule) => rule.key)]);
70353
70966
  const BUNDLED_RULE_NAMESPACES = new Set([...KNOWN_RULE_KEYS].flatMap(getEquivalentRuleKeys).map((key) => key.slice(0, key.lastIndexOf("/"))));
70354
70967
  const getUnknownBundledRuleKeys = (rules) => Object.keys(rules ?? {}).filter((key) => {
@@ -70524,6 +71137,32 @@ const validateSeverityMap = (fieldName, rawMap, keysAreCategories = false) => {
70524
71137
  }
70525
71138
  return validated;
70526
71139
  };
71140
+ const ONLY_EXPORT_COMPONENTS_STRING_ARRAY_KEYS = ["allowExportNames", "customHOCs"];
71141
+ const ONLY_EXPORT_COMPONENTS_BOOLEAN_KEYS = ["allowConstantExport", "checkJS"];
71142
+ const validateOnlyExportComponentsField = (rawOptions) => {
71143
+ if (!isRecord(rawOptions)) {
71144
+ warnConfigIssue(`config field "onlyExportComponents" must be an object (got ${typeof rawOptions}); ignoring this field.`);
71145
+ return;
71146
+ }
71147
+ const validated = {};
71148
+ for (const [key, value] of Object.entries(rawOptions)) {
71149
+ const fieldName = `onlyExportComponents.${key}`;
71150
+ const stringArrayKey = ONLY_EXPORT_COMPONENTS_STRING_ARRAY_KEYS.find((candidateKey) => candidateKey === key);
71151
+ if (stringArrayKey !== void 0) {
71152
+ const entries = validateStringArrayField(fieldName, value);
71153
+ if (entries !== void 0) validated[stringArrayKey] = entries;
71154
+ continue;
71155
+ }
71156
+ const booleanKey = ONLY_EXPORT_COMPONENTS_BOOLEAN_KEYS.find((candidateKey) => candidateKey === key);
71157
+ if (booleanKey !== void 0) {
71158
+ const flag = coerceMaybeBooleanString(fieldName, value);
71159
+ if (flag !== void 0) validated[booleanKey] = flag;
71160
+ continue;
71161
+ }
71162
+ 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.`);
71163
+ }
71164
+ return validated;
71165
+ };
70527
71166
  const applyFieldValidator = (config, validated, fieldName, validator) => {
70528
71167
  const raw = config[fieldName];
70529
71168
  if (raw === void 0) return;
@@ -70538,6 +71177,7 @@ const validateConfigTypes = (config) => {
70538
71177
  for (const fieldName of STRING_ARRAY_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => validateStringArrayField(fieldName, value));
70539
71178
  applyFieldValidator(config, validated, "ignore", validateIgnoreField);
70540
71179
  applyFieldValidator(config, validated, "surfaces", validateSurfacesField);
71180
+ applyFieldValidator(config, validated, "onlyExportComponents", validateOnlyExportComponentsField);
70541
71181
  for (const fieldName of SEVERITY_FIELD_NAMES) applyFieldValidator(config, validated, fieldName, (value) => validateSeverityMap(fieldName, value, fieldName === "categories"));
70542
71182
  applyFieldValidator(config, validated, "plugins", (value) => validateStringArrayField("plugins", value));
70543
71183
  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.`);
@@ -72710,7 +73350,7 @@ const createSecurityScanSession = (rootDirectory, options) => {
72710
73350
  entry,
72711
73351
  scan,
72712
73352
  severityOverride,
72713
- committedFilesOnly: rule.committedFilesOnly === true
73353
+ committedFilesOnly: rule.committedFilesOnly !== false
72714
73354
  }];
72715
73355
  });
72716
73356
  if (enabledScanRules.length === 0) return null;
@@ -72729,7 +73369,7 @@ const createSecurityScanSession = (rootDirectory, options) => {
72729
73369
  if (file === null) return;
72730
73370
  for (const { entry, scan, severityOverride, committedFilesOnly } of enabledScanRules) {
72731
73371
  for (const finding of scan(file)) {
72732
- if (committedFilesOnly && isFileGitIgnored(file)) continue;
73372
+ if ((finding.committedFilesOnly ?? committedFilesOnly) && isFileGitIgnored(file)) continue;
72733
73373
  const diagnostic = buildSecurityScanDiagnostic(severityOverride === void 0 ? finding : {
72734
73374
  ...finding,
72735
73375
  severity: severityOverride
@@ -74182,7 +74822,7 @@ const stripGitignoreEscape = (pattern) => {
74182
74822
  if (pattern.startsWith("\\#") || pattern.startsWith("\\!")) return pattern.slice(1);
74183
74823
  return pattern;
74184
74824
  };
74185
- const readIgnoreFile = (filePath) => {
74825
+ const readIgnoreFile = (filePath, { preserveSyntax = false } = {}) => {
74186
74826
  let content;
74187
74827
  try {
74188
74828
  content = fs$1$2.readFileSync(filePath, "utf-8");
@@ -74192,7 +74832,13 @@ const readIgnoreFile = (filePath) => {
74192
74832
  return [];
74193
74833
  }
74194
74834
  const patterns = [];
74195
- for (const line of content.split("\n")) {
74835
+ const source = preserveSyntax ? stripUtf8Bom(content) : content;
74836
+ for (const line of source.split("\n")) {
74837
+ if (preserveSyntax) {
74838
+ const pattern = line.replace(/\r$/, "");
74839
+ if (pattern.length > 0 && !pattern.startsWith("#")) patterns.push(pattern);
74840
+ continue;
74841
+ }
74196
74842
  const trimmed = line.trim();
74197
74843
  if (trimmed.length === 0) continue;
74198
74844
  if (trimmed.startsWith("#")) continue;
@@ -74200,33 +74846,52 @@ const readIgnoreFile = (filePath) => {
74200
74846
  }
74201
74847
  return patterns;
74202
74848
  };
74203
- const IGNORE_FILENAMES = [
74204
- ".eslintignore",
74205
- ".oxlintignore",
74206
- ".prettierignore"
74207
- ];
74208
74849
  const cachedPatternsByRoot = /* @__PURE__ */ new Map();
74209
74850
  const clearIgnorePatternsCache = () => {
74210
74851
  cachedPatternsByRoot.clear();
74211
74852
  };
74212
- const computeIgnorePatterns = (rootDirectory) => {
74213
- const seen = /* @__PURE__ */ new Set();
74214
- const patterns = [];
74215
- const addPattern = (pattern) => {
74216
- if (seen.has(pattern)) return;
74217
- seen.add(pattern);
74218
- patterns.push(pattern);
74853
+ 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))];
74854
+ const rebasePattern = (pattern, directoryPrefix) => {
74855
+ const isNegated = pattern.startsWith("!");
74856
+ const body = isNegated ? pattern.slice(1) : pattern;
74857
+ const effectiveBody = body.replace(/ +$/, "");
74858
+ if (!effectiveBody.trim() || effectiveBody === "/") return null;
74859
+ const isAnchored = effectiveBody.startsWith("/") || effectiveBody.slice(0, -1).includes("/");
74860
+ const relativePattern = body.startsWith("/") ? body.slice(1) : body;
74861
+ return `${isNegated ? "!" : ""}/${directoryPrefix}/${isAnchored ? "" : "**/"}${relativePattern}`;
74862
+ };
74863
+ const readRebasedPatterns = (directory, boundary) => {
74864
+ const directoryPrefix = path$1$1.relative(boundary, directory).split(path$1$1.sep).join("/").replace(/[\\*?[\]]/g, "\\$&");
74865
+ return readLintIgnorePatterns(directory, { preserveSyntax: true }).map((pattern) => rebasePattern(pattern, directoryPrefix)).filter((pattern) => pattern !== null);
74866
+ };
74867
+ const resolveIgnoreBoundaryIndex = (directories) => {
74868
+ const boundaryIndex = directories.findIndex(isProjectBoundary);
74869
+ if (boundaryIndex <= 0) return 0;
74870
+ const packageDirectory = directories.slice(0, boundaryIndex).find((directory) => isFile(path$1$1.join(directory, "package.json")));
74871
+ if (!packageDirectory) return 0;
74872
+ const boundary = directories[boundaryIndex];
74873
+ return getWorkspacePatterns(boundary, readPackageJson(path$1$1.join(boundary, "package.json"))).some((pattern) => resolveWorkspaceDirectories(boundary, pattern).includes(packageDirectory)) ? boundaryIndex : 0;
74874
+ };
74875
+ const collectLintIgnorePolicy = (rootDirectory) => {
74876
+ const scanDirectory = path$1$1.resolve(rootDirectory);
74877
+ const directories = ancestorDirectories(scanDirectory, { includeStart: true });
74878
+ const boundaryIndex = resolveIgnoreBoundaryIndex(directories);
74879
+ const boundary = directories[boundaryIndex];
74880
+ const patterns = readLintIgnorePatterns(boundary, { preserveSyntax: true });
74881
+ for (const directory of directories.slice(0, boundaryIndex).reverse()) patterns.push(...readRebasedPatterns(directory, boundary));
74882
+ if (patterns.length === 0) return null;
74883
+ const matcher = (0, import_ignore.default)({
74884
+ ignorecase: false,
74885
+ allowRelativePaths: true
74886
+ }).add(patterns);
74887
+ return {
74888
+ patterns,
74889
+ includesFile: (filePath) => {
74890
+ const absolutePath = path$1$1.resolve(scanDirectory, filePath);
74891
+ if (!isPathInsideDirectory(absolutePath, scanDirectory)) return true;
74892
+ return !matcher.ignores(path$1$1.relative(boundary, absolutePath).split(path$1$1.sep).join("/"));
74893
+ }
74219
74894
  };
74220
- for (const filename of IGNORE_FILENAMES) for (const pattern of readIgnoreFile(path$1$1.join(rootDirectory, filename))) addPattern(pattern);
74221
- for (const linguistPath of parseGitattributesLinguistPaths(path$1$1.join(rootDirectory, ".gitattributes"))) addPattern(linguistPath);
74222
- return patterns;
74223
- };
74224
- const collectIgnorePatterns = (rootDirectory) => {
74225
- const cached = cachedPatternsByRoot.get(rootDirectory);
74226
- if (cached !== void 0) return cached;
74227
- const patterns = computeIgnorePatterns(rootDirectory);
74228
- cachedPatternsByRoot.set(rootDirectory, patterns);
74229
- return patterns;
74230
74895
  };
74231
74896
  const findFirstLintConfigInDirectory = (directory) => {
74232
74897
  for (const filename of ADOPTABLE_LINT_CONFIG_FILENAMES) {
@@ -74527,6 +75192,7 @@ const neutralizeDisableDirectives = async (rootDirectory, includePaths, options
74527
75192
  const onExit = () => restore();
74528
75193
  process.once("exit", onExit);
74529
75194
  const leaseCandidatePath = (absolutePath) => {
75195
+ if (options.includesFile?.(path$1$1.relative(resolvedRootDirectory, absolutePath)) === false) return;
74530
75196
  if (!isSymlinkFreePath(absolutePath, resolvedRootDirectory)) return;
74531
75197
  if (leasedPaths.has(absolutePath)) return;
74532
75198
  if (blockedPaths.has(absolutePath)) return;
@@ -74756,7 +75422,7 @@ const buildUserPluginRules = (userPlugin, severityControls) => {
74756
75422
  }
74757
75423
  return enabled;
74758
75424
  };
74759
- 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 }) => {
75425
+ 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 }) => {
74760
75426
  const hasIncludedTags = includedTags.size > 0;
74761
75427
  const resolvedReactHooksJsPlugin = disableReactHooksJsPlugin || hasIncludedTags ? null : resolveReactHooksJsPlugin(project.hasReactCompiler || project.hasReactCompilerLintPlugin === true, customRulesOnly);
74762
75428
  const reactHooksJsPlugin = ruleSelection === "sidecar" ? null : resolvedReactHooksJsPlugin;
@@ -74839,6 +75505,7 @@ const createOxlintConfig = ({ pluginPath, diagnosticContextDirectory, project, c
74839
75505
  } : {},
74840
75506
  ...project.shopifyFlashListMajorVersion !== null ? { shopifyFlashListMajorVersion: project.shopifyFlashListMajorVersion } : {},
74841
75507
  ...serverAuthFunctionNames && serverAuthFunctionNames.length > 0 ? { serverAuthFunctionNames: [...serverAuthFunctionNames] } : {},
75508
+ ...onlyExportComponents !== void 0 ? { onlyExportComponents } : {},
74842
75509
  ...projectIndexModuleSources !== void 0 ? { projectIndexModuleSources: [...projectIndexModuleSources] } : {}
74843
75510
  }
74844
75511
  },
@@ -74849,6 +75516,12 @@ const createOxlintConfig = ({ pluginPath, diagnosticContextDirectory, project, c
74849
75516
  }
74850
75517
  };
74851
75518
  };
75519
+ const internWorkerSidecarProbeIds = (result, trace, internRelativeProbe) => {
75520
+ const probeIds = [];
75521
+ for (const pathIndex of trace.content) probeIds.push(internRelativeProbe("content", result.paths[pathIndex], null));
75522
+ for (const pathIndex of trace.existence) probeIds.push(internRelativeProbe("exists", result.paths[pathIndex], result.existenceAnswers[pathIndex]));
75523
+ return probeIds;
75524
+ };
74852
75525
  const TIMELINE_PATH = process.env.REACT_DOCTOR_OXLINT_SPAWN_LOG;
74853
75526
  const isOxlintJobTimelineEnabled = TIMELINE_PATH !== void 0;
74854
75527
  const appendTimelineLine = (entry) => {
@@ -75953,6 +76626,7 @@ const bridgeReactCompilerDiagnostic = (diagnostic) => {
75953
76626
  url: bridgeRule.compilerUrl
75954
76627
  };
75955
76628
  };
76629
+ const getUtf16Offset = (sourceText, utf8Offset) => Buffer.from(sourceText).subarray(0, utf8Offset).toString("utf8").length;
75956
76630
  const REACT_MODULE_SOURCE = "react";
75957
76631
  const REQUIRE_IDENTIFIER = "require";
75958
76632
  const USE_IDENTIFIER = "use";
@@ -75968,7 +76642,6 @@ const REACT_USE_BINDING_RESOLUTION = {
75968
76642
  isReactUseBinding: true,
75969
76643
  isReactNamespaceBinding: false
75970
76644
  };
75971
- const getUtf16Offset$1 = (sourceText, utf8Offset) => Buffer.from(sourceText).subarray(0, utf8Offset).toString("utf8").length;
75972
76645
  const getStaticPropertyName = (node) => {
75973
76646
  if (!node) return null;
75974
76647
  if (typescriptBinding.isIdentifier(node) || typescriptBinding.isStringLiteral(node) || typescriptBinding.isNumericLiteral(node)) return node.text;
@@ -76205,7 +76878,7 @@ const findUseCallIdentifier = (sourceFile, useOffset) => {
76205
76878
  };
76206
76879
  const resolveUseCallBinding = (sourceText, filename, utf8Offset) => {
76207
76880
  const sourceFile = typescriptBinding.createSourceFile(filename, sourceText, typescriptBinding.ScriptTarget.Latest, true, getTypescriptScriptKind(filename));
76208
- const useIdentifier = findUseCallIdentifier(sourceFile, getUtf16Offset$1(sourceText, utf8Offset));
76881
+ const useIdentifier = findUseCallIdentifier(sourceFile, getUtf16Offset(sourceText, utf8Offset));
76209
76882
  if (!useIdentifier) return null;
76210
76883
  return resolveIdentifierBinding(useIdentifier, collectReactImportBindings(sourceFile), sourceFile);
76211
76884
  };
@@ -76240,7 +76913,6 @@ const WORKLET_ACCEPTING_CALLEES = new Set([
76240
76913
  "executeOnUIRuntimeSync"
76241
76914
  ]);
76242
76915
  const GESTURE_ROOT_IDENTIFIER = "Gesture";
76243
- const getUtf16Offset = (sourceText, utf8Offset) => Buffer.from(sourceText).subarray(0, utf8Offset).toString("utf8").length;
76244
76916
  const hasWorkletDirective = (node) => {
76245
76917
  if (!typescriptBinding.isFunctionDeclaration(node) && !typescriptBinding.isFunctionExpression(node) && !typescriptBinding.isArrowFunction(node) && !typescriptBinding.isMethodDeclaration(node)) return false;
76246
76918
  const body = node.body;
@@ -76313,6 +76985,228 @@ const shouldSuppressCompilerFindingInWorklet = (diagnostic, project, rootDirecto
76313
76985
  }
76314
76986
  return isOffsetInsideWorklet(typescriptBinding.createSourceFile(absolutePath, sourceText, typescriptBinding.ScriptTarget.Latest, true, getTypescriptScriptKind(absolutePath)), getUtf16Offset(sourceText, primaryLabel.span.offset));
76315
76987
  };
76988
+ const REFLECTION_NAMES = new Set([
76989
+ "eval",
76990
+ "require",
76991
+ "Function",
76992
+ "Object",
76993
+ "Reflect",
76994
+ "Promise",
76995
+ "globalThis",
76996
+ "global",
76997
+ "window",
76998
+ "self",
76999
+ "constructor",
77000
+ "prototype",
77001
+ "__proto__",
77002
+ "__defineGetter__",
77003
+ "__defineSetter__",
77004
+ "__lookupGetter__",
77005
+ "__lookupSetter__"
77006
+ ]);
77007
+ const collectEffectSourceIndex = (sourceFile) => {
77008
+ const identifiers = /* @__PURE__ */ new Map();
77009
+ const calls = [];
77010
+ const pendingNodes = [sourceFile];
77011
+ let hasReflection = false;
77012
+ while (pendingNodes.length > 0) {
77013
+ const node = pendingNodes.pop();
77014
+ if (!node) continue;
77015
+ if (typescriptBinding.isIdentifier(node)) {
77016
+ const sameNameIdentifiers = identifiers.get(node.text) ?? /* @__PURE__ */ new Set();
77017
+ sameNameIdentifiers.add(node);
77018
+ identifiers.set(node.text, sameNameIdentifiers);
77019
+ if (REFLECTION_NAMES.has(node.text)) hasReflection = true;
77020
+ }
77021
+ let memberName;
77022
+ if (typescriptBinding.isPropertyAccessExpression(node)) memberName = node.name.text;
77023
+ else if (typescriptBinding.isElementAccessExpression(node)) {
77024
+ const memberArgument = unwrapTypescriptExpression(node.argumentExpression);
77025
+ if (typescriptBinding.isStringLiteral(memberArgument)) memberName = memberArgument.text;
77026
+ else hasReflection = true;
77027
+ } else if (typescriptBinding.isBindingElement(node) && node.propertyName && typescriptBinding.isStringLiteral(node.propertyName)) memberName = node.propertyName.text;
77028
+ else if (typescriptBinding.isPropertyAssignment(node) && typescriptBinding.isStringLiteral(node.name)) memberName = node.name.text;
77029
+ if (memberName && REFLECTION_NAMES.has(memberName)) hasReflection = true;
77030
+ if (typescriptBinding.isComputedPropertyName(node)) hasReflection = true;
77031
+ if (typescriptBinding.isWithStatement(node)) hasReflection = true;
77032
+ if (typescriptBinding.isCallExpression(node)) {
77033
+ calls.push(node);
77034
+ if (node.expression.kind === typescriptBinding.SyntaxKind.ImportKeyword) hasReflection = true;
77035
+ }
77036
+ typescriptBinding.forEachChild(node, (child) => {
77037
+ pendingNodes.push(child);
77038
+ });
77039
+ }
77040
+ return {
77041
+ identifiers,
77042
+ calls,
77043
+ hasReflection
77044
+ };
77045
+ };
77046
+ const isInertPrimitive = (expression) => {
77047
+ const unwrapped = unwrapTypescriptExpression(expression);
77048
+ 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);
77049
+ };
77050
+ 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));
77051
+ const getSoleCall = (body) => {
77052
+ if (body.statements.length !== 1) return null;
77053
+ const statement = body.statements[0];
77054
+ if (!typescriptBinding.isExpressionStatement(statement)) return null;
77055
+ let expression = unwrapTypescriptExpression(statement.expression);
77056
+ if (typescriptBinding.isVoidExpression(expression)) expression = unwrapTypescriptExpression(expression.expression);
77057
+ return typescriptBinding.isCallExpression(expression) && !expression.questionDotToken ? expression : null;
77058
+ };
77059
+ const findDirectConst = (body, name, beforeStatement) => {
77060
+ for (const statement of body.statements) {
77061
+ if (statement === beforeStatement) return null;
77062
+ if (!typescriptBinding.isVariableStatement(statement)) continue;
77063
+ if (!(statement.declarationList.flags & typescriptBinding.NodeFlags.Const)) continue;
77064
+ for (const declaration of statement.declarationList.declarations) if (typescriptBinding.isIdentifier(declaration.name) && declaration.name.text === name) return declaration;
77065
+ }
77066
+ return null;
77067
+ };
77068
+ const hasOnlyAllowedIdentifiers = (index, name, allowedIdentifiers) => {
77069
+ const allowed = new Set(allowedIdentifiers);
77070
+ return [...index.identifiers.get(name) ?? []].every((identifier) => allowed.has(identifier));
77071
+ };
77072
+ const isNativeReactCall = (call, importedName, sourceFile, index) => {
77073
+ const callee = unwrapTypescriptExpression(call.expression);
77074
+ if (!typescriptBinding.isIdentifier(callee) || call.questionDotToken) return false;
77075
+ let matchingImport = null;
77076
+ for (const statement of sourceFile.statements) {
77077
+ if (!typescriptBinding.isImportDeclaration(statement)) continue;
77078
+ if (!typescriptBinding.isStringLiteral(statement.moduleSpecifier) || statement.moduleSpecifier.text !== "react") continue;
77079
+ const clause = statement.importClause;
77080
+ if (!clause || clause.isTypeOnly) continue;
77081
+ if (clause.name || clause.namedBindings && typescriptBinding.isNamespaceImport(clause.namedBindings)) return false;
77082
+ if (!clause.namedBindings || !typescriptBinding.isNamedImports(clause.namedBindings)) continue;
77083
+ for (const specifier of clause.namedBindings.elements) {
77084
+ if (specifier.name.text !== callee.text) continue;
77085
+ if (matchingImport || specifier.isTypeOnly || (specifier.propertyName?.text ?? specifier.name.text) !== importedName || getImportModuleSource(specifier) !== "react") return false;
77086
+ matchingImport = specifier;
77087
+ }
77088
+ }
77089
+ if (!matchingImport) return false;
77090
+ const allowed = [matchingImport.name];
77091
+ if (matchingImport.propertyName && typescriptBinding.isIdentifier(matchingImport.propertyName)) allowed.push(matchingImport.propertyName);
77092
+ for (const candidateCall of index.calls) {
77093
+ const candidateCallee = unwrapTypescriptExpression(candidateCall.expression);
77094
+ if (typescriptBinding.isIdentifier(candidateCallee) && candidateCallee.text === callee.text) allowed.push(candidateCallee);
77095
+ }
77096
+ return hasOnlyAllowedIdentifiers(index, callee.text, allowed);
77097
+ };
77098
+ const hasDeferredLocalHelper = (helperCall, sourceFile, index) => {
77099
+ const helperIdentifier = unwrapTypescriptExpression(helperCall.expression);
77100
+ if (!typescriptBinding.isIdentifier(helperIdentifier) || helperCall.arguments.length !== 0) return false;
77101
+ let callbackNode = helperCall.parent;
77102
+ while (callbackNode && !typescriptBinding.isArrowFunction(callbackNode) && !typescriptBinding.isFunctionExpression(callbackNode)) callbackNode = callbackNode.parent;
77103
+ 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;
77104
+ const effectCall = callbackNode.parent;
77105
+ 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;
77106
+ const ownerBody = effectCall.parent.parent;
77107
+ if (!typescriptBinding.isArrowFunction(ownerBody.parent) && !typescriptBinding.isFunctionExpression(ownerBody.parent) && !typescriptBinding.isFunctionDeclaration(ownerBody.parent)) return false;
77108
+ if (ownerBody.parent.modifiers?.some((modifier) => modifier.kind === typescriptBinding.SyntaxKind.AsyncKeyword) || !typescriptBinding.isArrowFunction(ownerBody.parent) && ownerBody.parent.asteriskToken) return false;
77109
+ const dependencies = unwrapTypescriptExpression(effectCall.arguments[1]);
77110
+ if (!typescriptBinding.isArrayLiteralExpression(dependencies)) return false;
77111
+ const helperReferences = [helperIdentifier];
77112
+ for (const dependency of dependencies.elements) {
77113
+ const unwrappedDependency = unwrapTypescriptExpression(dependency);
77114
+ if (!typescriptBinding.isIdentifier(unwrappedDependency) || unwrappedDependency.text !== helperIdentifier.text) return false;
77115
+ helperReferences.push(unwrappedDependency);
77116
+ }
77117
+ const declaration = findDirectConst(ownerBody, helperIdentifier.text, effectCall.parent);
77118
+ if (!declaration?.initializer || !typescriptBinding.isIdentifier(declaration.name)) return false;
77119
+ helperReferences.push(declaration.name);
77120
+ if (!hasOnlyAllowedIdentifiers(index, helperIdentifier.text, helperReferences)) return false;
77121
+ let helper = unwrapTypescriptExpression(declaration.initializer);
77122
+ if (typescriptBinding.isCallExpression(helper)) {
77123
+ if (!isNativeReactCall(helper, "useCallback", sourceFile, index) || helper.arguments.length !== 2 || !typescriptBinding.isArrayLiteralExpression(helper.arguments[1]) || helper.arguments[1].elements.length !== 0) return false;
77124
+ helper = unwrapTypescriptExpression(helper.arguments[0]);
77125
+ }
77126
+ if (!isAsyncZeroParameterFunction(helper) || !typescriptBinding.isBlock(helper.body)) return false;
77127
+ if (helper.body.statements.length !== 1) return false;
77128
+ const tryStatement = helper.body.statements[0];
77129
+ if (!typescriptBinding.isTryStatement(tryStatement) || tryStatement.finallyBlock || !tryStatement.catchClause || tryStatement.catchClause.variableDeclaration) return false;
77130
+ const successCall = getSoleCall(tryStatement.tryBlock);
77131
+ const failureCall = getSoleCall(tryStatement.catchClause.block);
77132
+ if (!successCall || !failureCall || successCall.arguments.length !== 1 || failureCall.arguments.length !== 1) return false;
77133
+ const setterIdentifier = unwrapTypescriptExpression(successCall.expression);
77134
+ const failureSetter = unwrapTypescriptExpression(failureCall.expression);
77135
+ if (!typescriptBinding.isIdentifier(setterIdentifier) || !typescriptBinding.isIdentifier(failureSetter) || setterIdentifier.text !== failureSetter.text || !isInertPrimitive(failureCall.arguments[0])) return false;
77136
+ const awaitedValue = unwrapTypescriptExpression(successCall.arguments[0]);
77137
+ if (!typescriptBinding.isAwaitExpression(awaitedValue)) return false;
77138
+ const producerCall = unwrapTypescriptExpression(awaitedValue.expression);
77139
+ if (!typescriptBinding.isCallExpression(producerCall) || producerCall.questionDotToken || producerCall.arguments.length !== 0) return false;
77140
+ const producerIdentifier = unwrapTypescriptExpression(producerCall.expression);
77141
+ if (!typescriptBinding.isIdentifier(producerIdentifier)) return false;
77142
+ const producerDeclaration = findDirectConst(ownerBody, producerIdentifier.text, effectCall.parent);
77143
+ if (!producerDeclaration?.initializer || !typescriptBinding.isIdentifier(producerDeclaration.name)) return false;
77144
+ const producer = unwrapTypescriptExpression(producerDeclaration.initializer);
77145
+ if (!isAsyncZeroParameterFunction(producer)) return false;
77146
+ let producedValue;
77147
+ if (typescriptBinding.isBlock(producer.body)) {
77148
+ if (producer.body.statements.length !== 1) return false;
77149
+ const statement = producer.body.statements[0];
77150
+ if (!typescriptBinding.isReturnStatement(statement)) return false;
77151
+ producedValue = statement.expression;
77152
+ } else producedValue = producer.body;
77153
+ if (!producedValue || !isInertPrimitive(producedValue)) return false;
77154
+ if (!hasOnlyAllowedIdentifiers(index, producerIdentifier.text, [producerDeclaration.name, producerIdentifier])) return false;
77155
+ for (const statement of ownerBody.statements) {
77156
+ if (statement === effectCall.parent) return false;
77157
+ if (!typescriptBinding.isVariableStatement(statement) || !(statement.declarationList.flags & typescriptBinding.NodeFlags.Const)) continue;
77158
+ for (const stateDeclaration of statement.declarationList.declarations) {
77159
+ if (!typescriptBinding.isArrayBindingPattern(stateDeclaration.name) || stateDeclaration.name.elements.length !== 2 || !stateDeclaration.initializer) continue;
77160
+ const setterBinding = stateDeclaration.name.elements[1];
77161
+ if (typescriptBinding.isOmittedExpression(setterBinding) || !typescriptBinding.isIdentifier(setterBinding.name) || setterBinding.name.text !== setterIdentifier.text || setterBinding.initializer || setterBinding.dotDotDotToken || setterBinding.propertyName) continue;
77162
+ const stateInitializer = unwrapTypescriptExpression(stateDeclaration.initializer);
77163
+ if (!typescriptBinding.isCallExpression(stateInitializer) || !isNativeReactCall(stateInitializer, "useState", sourceFile, index)) continue;
77164
+ return hasOnlyAllowedIdentifiers(index, setterIdentifier.text, [
77165
+ setterBinding.name,
77166
+ setterIdentifier,
77167
+ failureSetter
77168
+ ]);
77169
+ }
77170
+ }
77171
+ return false;
77172
+ };
77173
+ const createDeferredEffectStateDiagnosticChecker = (rootDirectory) => {
77174
+ const parsedFiles = /* @__PURE__ */ new Map();
77175
+ const readAndParse = (filename) => {
77176
+ const cached = parsedFiles.get(filename);
77177
+ if (cached !== void 0) return cached;
77178
+ let parsed;
77179
+ try {
77180
+ const sourceText = fs$1$2.readFileSync(filename, "utf8");
77181
+ const sourceFile = typescriptBinding.createSourceFile(filename, sourceText, typescriptBinding.ScriptTarget.Latest, true, getTypescriptScriptKind(filename));
77182
+ parsed = "parseDiagnostics" in sourceFile && Array.isArray(sourceFile.parseDiagnostics) && sourceFile.parseDiagnostics.length > 0 ? null : {
77183
+ sourceText,
77184
+ sourceFile,
77185
+ index: collectEffectSourceIndex(sourceFile)
77186
+ };
77187
+ } catch {
77188
+ parsed = null;
77189
+ }
77190
+ parsedFiles.set(filename, parsed);
77191
+ return parsed;
77192
+ };
77193
+ return (diagnostic) => {
77194
+ if (diagnostic.code !== "react-hooks-js(set-state-in-effect)") return false;
77195
+ const span = diagnostic.labels[0]?.span;
77196
+ if (!span || !Number.isInteger(span.offset) || !Number.isInteger(span.length) || span.offset < 0 || span.length <= 0) return false;
77197
+ const parsed = readAndParse(path$1$1.resolve(rootDirectory, diagnostic.filename));
77198
+ if (!parsed || parsed.index.hasReflection) return false;
77199
+ const { sourceText, sourceFile, index } = parsed;
77200
+ const calleeOffset = getUtf16Offset(sourceText, span.offset);
77201
+ const helperCall = index.calls.find((call) => {
77202
+ const callee = unwrapTypescriptExpression(call.expression);
77203
+ return typescriptBinding.isIdentifier(callee) && callee.getStart(sourceFile) === calleeOffset;
77204
+ });
77205
+ if (!helperCall || helperCall.questionDotToken) return false;
77206
+ const callee = unwrapTypescriptExpression(helperCall.expression);
77207
+ return Buffer.byteLength(sourceText.slice(0, calleeOffset)) === span.offset && Buffer.byteLength(callee.getText(sourceFile)) === span.length && hasDeferredLocalHelper(helperCall, sourceFile, index);
77208
+ };
77209
+ };
76316
77210
  const MANUAL_MEMOIZATION_PLUGIN = "react-doctor";
76317
77211
  const MANUAL_MEMOIZATION_RULE = "react-compiler-no-manual-memoization";
76318
77212
  const REACT_COMPILER_PLUGIN = "react-hooks-js";
@@ -76409,8 +77303,8 @@ const REACT_COMPILER_TITLE = "React Compiler can't optimize this";
76409
77303
  const REACT_COMPILER_TODO_TITLE = "React Compiler doesn't support this syntax";
76410
77304
  const REACT_ERROR_BOUNDARY_TITLE = "JSX render errors need an Error Boundary";
76411
77305
  const REACT_ERROR_BOUNDARY_MESSAGE = "This try/catch cannot catch errors thrown while the JSX child renders. Use an Error Boundary instead.";
76412
- const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
76413
- const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
77306
+ const REACT_COMPILER_IMPACT = "React Compiler flagged this code during analysis";
77307
+ const REACT_COMPILER_ACTION = "Review the compiler's reason before changing the code.";
76414
77308
  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`.";
76415
77309
  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`.";
76416
77310
  const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
@@ -76596,12 +77490,12 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath,
76596
77490
  const absolutePath = resolveAbsolutePath(resolveSourceFilename(filename));
76597
77491
  const cached = minifiedFileCache.get(absolutePath);
76598
77492
  if (cached !== void 0) return cached;
76599
- const minified = isMinifiedSource(absolutePath);
77493
+ const minified = isMinifiedSource(absolutePath) || isMinifiedViteEntry(absolutePath);
76600
77494
  minifiedFileCache.set(absolutePath, minified);
76601
77495
  return minified;
76602
77496
  };
76603
77497
  const readContextRanges = createDiagnosticContextReader(diagnosticContextDirectory);
76604
- return suppressMemoizationInBailedOutFunctions(parsed.diagnostics.flatMap((unbridgedDiagnostic) => {
77498
+ const sourceMappedDiagnostics = parsed.diagnostics.flatMap((unbridgedDiagnostic) => {
76605
77499
  if (!isMappableOxlintDiagnostic(unbridgedDiagnostic)) return [];
76606
77500
  const rawDiagnostic = bridgeReactCompilerDiagnostic(unbridgedDiagnostic);
76607
77501
  const { plugin, rule } = parseRuleCode(rawDiagnostic.code);
@@ -76627,7 +77521,9 @@ const parseOxlintOutput = (stdout, project, rootDirectory, sourcePathByLintPath,
76627
77521
  labels,
76628
77522
  contextRanges: []
76629
77523
  }];
76630
- }).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) => {
77524
+ });
77525
+ const shouldSuppressDeferredEffectStateDiagnostic = createDeferredEffectStateDiagnosticChecker(rootDirectory);
77526
+ 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) => {
76631
77527
  const { plugin, rule } = parseRuleCode(diagnostic.code);
76632
77528
  const primaryLabel = diagnostic.labels[0];
76633
77529
  const cleaned = cleanDiagnosticMessage(diagnostic.message, diagnostic.help, plugin, rule, project);
@@ -77415,10 +78311,7 @@ const collectSidecarProbesForFiles = async (input) => {
77415
78311
  probeIdsByFile.set(file, null);
77416
78312
  continue;
77417
78313
  }
77418
- const probeIds = [];
77419
- for (const pathIndex of trace.content) probeIds.push(internRelativeProbe("content", result.paths[pathIndex], result.existenceAnswers[pathIndex]));
77420
- for (const pathIndex of trace.existence) probeIds.push(internRelativeProbe("exists", result.paths[pathIndex], result.existenceAnswers[pathIndex]));
77421
- probeIdsByFile.set(file, probeIds);
78314
+ probeIdsByFile.set(file, internWorkerSidecarProbeIds(result, trace, internRelativeProbe));
77422
78315
  }
77423
78316
  };
77424
78317
  const runParentLane = async () => {
@@ -77531,7 +78424,11 @@ const runOxlint = async (options) => {
77531
78424
  const adoptableConfigPaths = detectedConfigPaths.filter(canOxlintExtendConfig);
77532
78425
  const adoptedSettings = detectedConfigPaths.length > 0 ? readAdoptedLintConfigSettings(detectedConfigPaths) : {};
77533
78426
  const userPlugins = includedTags.size > 0 ? [] : resolveUserPlugins(userConfig?.plugins, configSourceDirectory);
77534
- const restoreDisableDirectives = await neutralizeDisableDirectives(rootDirectory, includePaths ?? options.precomputedSourceFiles?.map((sourceFile) => sourceFile.path), { recoverOnly: respectInlineDisables });
78427
+ const lintIgnorePolicy = collectLintIgnorePolicy(rootDirectory);
78428
+ const restoreDisableDirectives = await neutralizeDisableDirectives(rootDirectory, includePaths ?? options.precomputedSourceFiles?.map((sourceFile) => sourceFile.path), {
78429
+ recoverOnly: respectInlineDisables,
78430
+ includesFile: lintIgnorePolicy?.includesFile
78431
+ });
77535
78432
  const configDirectory = fs$1$2.mkdtempSync(path$1$1.join(os.tmpdir(), "react-doctor-oxlintrc-"));
77536
78433
  const configPath = path$1$1.join(configDirectory, "oxlintrc.json");
77537
78434
  const workingDirectory = fs$1$2.existsSync(path$1$1.join(rootDirectory, "oxlint-suppressions.json")) ? configDirectory : void 0;
@@ -77557,10 +78454,10 @@ const runOxlint = async (options) => {
77557
78454
  }
77558
78455
  }
77559
78456
  }
77560
- const combinedPatterns = collectIgnorePatterns(rootDirectory);
77561
- if (combinedPatterns.length > 0) {
78457
+ const combinedPatterns = lintIgnorePolicy?.patterns ?? [];
78458
+ if (lintIgnorePolicy) {
77562
78459
  const combinedIgnorePath = path$1$1.join(configDirectory, "combined.ignore");
77563
- fs$1$2.writeFileSync(combinedIgnorePath, `${combinedPatterns.join("\n")}\n`);
78460
+ fs$1$2.writeFileSync(combinedIgnorePath, "");
77564
78461
  sharedArgs.push("--ignore-path", combinedIgnorePath);
77565
78462
  }
77566
78463
  const lintWorkerCount = resolveScanConcurrency(options.concurrency ?? 1);
@@ -77576,8 +78473,9 @@ const runOxlint = async (options) => {
77576
78473
  ];
77577
78474
  await yieldToEventLoop();
77578
78475
  const sizedScanFiles = options.precomputedSourceFiles ?? (includePaths === void 0 ? listSourceFilesWithSize(rootDirectory) : null);
77579
- const candidateFiles = sizedScanFiles === null ? includePaths ?? [] : sizedScanFiles.map((entry) => entry.path);
77580
- const projectIndexModuleSources = includePaths === void 0 && options.deadlineEpochMs === void 0 ? await collectProjectIndexModuleSources(rootDirectory, candidateFiles) : void 0;
78476
+ const discoveredFiles = sizedScanFiles === null ? includePaths ?? [] : sizedScanFiles.map((entry) => entry.path);
78477
+ const candidateFiles = lintIgnorePolicy ? discoveredFiles.filter(lintIgnorePolicy.includesFile) : discoveredFiles;
78478
+ const projectIndexModuleSources = includePaths === void 0 && options.deadlineEpochMs === void 0 ? await collectProjectIndexModuleSources(rootDirectory, discoveredFiles) : void 0;
77581
78479
  unpluginAutoImportGlobalScopes = collectUnpluginAutoImportGlobalScopes({
77582
78480
  rootDirectory,
77583
78481
  candidateFiles
@@ -77601,6 +78499,7 @@ const runOxlint = async (options) => {
77601
78499
  runtimeGlobals,
77602
78500
  unpluginAutoImportGlobalScopes,
77603
78501
  serverAuthFunctionNames,
78502
+ onlyExportComponents: userConfig?.onlyExportComponents,
77604
78503
  projectIndexModuleSources,
77605
78504
  severityControls,
77606
78505
  adoptedSettings,
@@ -79022,10 +79921,11 @@ const runInspect = (input, hooks = {}) => gen(function* () {
79022
79921
  const lintFailureState = yield* get$2(lintFailure);
79023
79922
  yield* afterLint(lintFailureState.didFail);
79024
79923
  if (lintFailureState.didFail) yield* scanProgress.fail(formatLintFailText(lintFailureState.reasonTag, process.version));
79025
- const candidateFiles = lintFileCoverageState.value === null ? [] : [...new Set(lintFileCoverageState.value.candidateFiles.map((filePath) => toNormalizedRelativePath(filePath, scanDirectory)))];
79026
- const analyzedFiles = lintFileCoverageState.value === null ? [] : [...new Set(lintFileCoverageState.value.analyzedFiles.map((filePath) => toNormalizedRelativePath(filePath, scanDirectory)))].sort();
79027
- const totalFileCount = candidateFiles.length || lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount);
79028
- const scannedFilePaths = input.suppressScanSummary ? candidateFiles.length > 0 ? candidateFiles.map((filePath) => path$1$1.resolve(scanDirectory, filePath)) : fallbackScannedFilePaths : [];
79924
+ const lintFileCoverage = lintFileCoverageState.value;
79925
+ const candidateFiles = lintFileCoverage === null ? [] : [...new Set(lintFileCoverage.candidateFiles.map((filePath) => toNormalizedRelativePath(filePath, scanDirectory)))];
79926
+ const analyzedFiles = lintFileCoverage === null ? [] : [...new Set(lintFileCoverage.analyzedFiles.map((filePath) => toNormalizedRelativePath(filePath, scanDirectory)))].sort();
79927
+ const totalFileCount = lintFileCoverage === null ? lastReportedTotalFileCount || (lintIncludePaths?.length ?? project.sourceFileCount) : candidateFiles.length;
79928
+ const scannedFilePaths = input.suppressScanSummary ? lintFileCoverage === null ? fallbackScannedFilePaths : candidateFiles.map((filePath) => path$1$1.resolve(scanDirectory, filePath)) : [];
79029
79929
  const scannedFilesLabel = `${totalFileCount} ${totalFileCount === 1 ? "file" : "files"}`;
79030
79930
  let maintainabilityCollected = [];
79031
79931
  if (lintFailureState.didFail) yield* interrupt(maintainabilityFiber);
@@ -79261,15 +80161,37 @@ const materializeSourceTree = (input) => gen(function* () {
79261
80161
  materializedFiles.push(relativePath);
79262
80162
  }
79263
80163
  yield* sync(() => {
79264
- for (const subdirectory of ["", ...input.configSubdirectories ?? []]) for (const configFilename of STAGED_FILES_PROJECT_CONFIG_FILENAMES) {
79265
- const sourcePath = path.join(input.directory, subdirectory, configFilename);
79266
- const targetPath = path.resolve(resolvedTempDirectory, subdirectory, configFilename);
79267
- if (!isPathInsideDirectory(targetPath, resolvedTempDirectory)) continue;
79268
- if (isFile(sourcePath) && !fs.existsSync(targetPath)) {
79269
- fs.mkdirSync(path.dirname(targetPath), { recursive: true });
79270
- fs.cpSync(sourcePath, targetPath);
80164
+ const sourceDirectory = path.resolve(input.directory);
80165
+ const projectDirectories = new Set(["", ...input.configSubdirectories ?? []]);
80166
+ const intermediateDirectories = /* @__PURE__ */ new Set();
80167
+ for (const subdirectory of projectDirectories) {
80168
+ const projectDirectory = path.resolve(sourceDirectory, subdirectory);
80169
+ if (!isPathInsideDirectory(projectDirectory, sourceDirectory)) continue;
80170
+ for (const ancestor of ancestorDirectories(projectDirectory, { includeStart: false })) {
80171
+ if (!isPathInsideDirectory(ancestor, sourceDirectory)) break;
80172
+ const relativeDirectory = path.relative(sourceDirectory, ancestor);
80173
+ if (!projectDirectories.has(relativeDirectory)) intermediateDirectories.add(relativeDirectory);
79271
80174
  }
79272
80175
  }
80176
+ const copyConfigs = (subdirectory, filenames) => {
80177
+ for (const configFilename of filenames) {
80178
+ const sourcePath = path.join(input.directory, subdirectory, configFilename);
80179
+ const targetPath = path.resolve(resolvedTempDirectory, subdirectory, configFilename);
80180
+ if (!isPathInsideDirectory(targetPath, resolvedTempDirectory)) continue;
80181
+ if (isFile(sourcePath) && !fs.existsSync(targetPath)) {
80182
+ fs.mkdirSync(path.dirname(targetPath), { recursive: true });
80183
+ fs.cpSync(sourcePath, targetPath);
80184
+ }
80185
+ }
80186
+ };
80187
+ for (const subdirectory of projectDirectories) copyConfigs(subdirectory, STAGED_FILES_PROJECT_CONFIG_FILENAMES);
80188
+ for (const subdirectory of intermediateDirectories) copyConfigs(subdirectory, [
80189
+ "package.json",
80190
+ "pnpm-workspace.yaml",
80191
+ "nx.json",
80192
+ ...LINT_IGNORE_STYLE_FILENAMES,
80193
+ LINT_LINGUIST_FILENAME
80194
+ ]);
79273
80195
  });
79274
80196
  return {
79275
80197
  tempDirectory: input.tempDirectory,
@@ -79927,4 +80849,4 @@ const toJsonReport = (result, options) => buildJsonReport({
79927
80849
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
79928
80850
 
79929
80851
  //# sourceMappingURL=index.js.map
79930
- //# debugId=5255a206-f2ac-51fa-9a2f-9480ba58e9d7
80852
+ //# debugId=835688e2-3e41-50bb-9c66-fa5b45d875d1