react-doctor 0.9.12-dev.28a1a9f → 0.9.12-dev.6416370

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/README.md +27 -0
  2. package/dist/active-run-trace-dlIZeEvb.js +18 -0
  3. package/dist/active-scan-abort-registry-DwG6tSPy.js +28 -0
  4. package/dist/{build-section-divider-CdnczCsb.js → build-section-divider-CGqjqvEG.js} +8 -22
  5. package/dist/{ci-CvrWkFyG.js → ci-Btu-cSJ3.js} +12 -11
  6. package/dist/cli.js +76 -24
  7. package/dist/{design-C6QoD6j5.js → design-jjfUYQ1N.js} +4 -4
  8. package/dist/{devtools-D8NTVj81.js → devtools-BiC-AP3B.js} +3 -3
  9. package/dist/{exit-gracefully-dQBRJxyW.js → exit-gracefully-CptEwS9n.js} +15 -9
  10. package/dist/get-east-asian-width-Cglw13G7.js +444 -0
  11. package/dist/{report-error-DspMW6A2.js → handle-error-CJbBGFWV.js} +6 -61
  12. package/dist/index.d.ts +32 -0
  13. package/dist/index.js +76 -2
  14. package/dist/{inspect-CEYHtLuK.js → inspect-U8dPI4Kp.js} +16 -15
  15. package/dist/{install-doctor-script-BZJlaCgz.js → install-doctor-script-B94dXnbf.js} +6 -441
  16. package/dist/{install-github-workflow-DQIDvKig.js → install-github-workflow-PoJBXNVx.js} +6 -6
  17. package/dist/{install-react-doctor-C3iiSm4r.js → install-react-doctor-DhXGNP0G.js} +8 -8
  18. package/dist/{install-BPQG8X-S.js → install-zvV1U626.js} +9 -8
  19. package/dist/{run-scan-app-lYmDIiT4.js → jsx-runtime-rX-uyu-N.js} +280 -2774
  20. package/dist/{print-branded-header-B594Zejh.js → print-branded-header-DrTEqNzr.js} +4 -4
  21. package/dist/prompt-runtime-scan-url-DEAm_LGd.js +240 -0
  22. package/dist/{read-object-file-CIVH-Cg-.js → read-object-file-DRsmMnhh.js} +4 -4
  23. package/dist/{record-metric-CFPfyOEW.js → record-metric-DKzjNui-.js} +95 -8
  24. package/dist/report-error-Dd2AIOrT.js +64 -0
  25. package/dist/{report-workflow-result-GxDOhexG.js → report-workflow-result-Be-u7k5t.js} +5 -5
  26. package/dist/{resolve-scope-CNV3HRNo.js → resolve-scope-B6tfTUJj.js} +6 -6
  27. package/dist/{rules-C1Nt63By.js → rules-CdUg_ovk.js} +6 -6
  28. package/dist/run-scan-app-DqgVw6xW.js +2508 -0
  29. package/dist/runtime-scan/browser-probe.iife.js +855 -0
  30. package/dist/runtime-scan-CAZo4uiu.js +770 -0
  31. package/dist/sanitize-runtime-url-c17alaBD.js +76 -0
  32. package/dist/{scan-D-Y1Qifl.js → scan-BxtXorVy.js} +10 -22
  33. package/dist/{should-fail-scan-gate-XdfNPXf9.js → should-fail-scan-gate-ifL9wq2M.js} +12 -111
  34. package/dist/{should-skip-prompts-DXyhnzjP.js → should-skip-prompts-C7rPlQd4.js} +4 -4
  35. package/dist/should-use-tui-BQ2TXU_F.js +25 -0
  36. package/dist/skills/performance/SKILL.md +113 -0
  37. package/dist/skills/react-doctor/SKILL.md +6 -0
  38. package/dist/{unref-stdin-CwYEtpri.js → telemetry-runtime-DlKLQN-9.js} +5 -23
  39. package/dist/unref-stdin-BKT_s38a.js +12 -0
  40. package/dist/{version-tT7fsrFN.js → version-DTUTs2Wf.js} +4 -4
  41. package/dist/{why-4B0HPeQG.js → why-DlzjTUh4.js} +4 -4
  42. package/dist/with-run-span-BxZf1cDB.js +110 -0
  43. package/package.json +5 -4
@@ -0,0 +1,110 @@
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]="3331ff49-b86d-575b-8721-fada0c83b956")}catch(e){}}();
3
+ import { D as NANOSECONDS_PER_MILLISECOND, In as provideContext, Xn as void_, Yn as fail, c as setSentryProjectInfo, jn as makeSpan, o as buildSentryScope, r as toSpanAttributes, s as buildSentryProjectContext, zn as runSync } from "./record-metric-DKzjNui-.js";
4
+ import { t as getTelemetryContext } from "./telemetry-runtime-DlKLQN-9.js";
5
+ import { i as setActiveRunTrace, r as recordRunTraceId } from "./active-run-trace-dlIZeEvb.js";
6
+ //#region src/cli/utils/with-run-span.ts
7
+ /**
8
+ * Ends the run span without letting a telemetry failure change the run's
9
+ * outcome — the invariant every other emit site here already holds.
10
+ *
11
+ * The failure path is the reason this matters most: a throw from `end` there
12
+ * would replace the user's original scan error, so a project-config mistake
13
+ * could surface as an exporter stack trace, be reclassified as a crash, and get
14
+ * reported as one.
15
+ */
16
+ const endSpanSafely = (span, exit) => {
17
+ try {
18
+ span.end(BigInt(Date.now()) * NANOSECONDS_PER_MILLISECOND, exit);
19
+ } catch {}
20
+ };
21
+ /**
22
+ * Clears the module-level run-scoped telemetry state — the current scanned
23
+ * project and the active run trace. `inspect()` calls this at the start of every
24
+ * run and again after a clean one, so a prior or just-finished scan can't attach
25
+ * its project tags / trace to a later run or to a non-scan error (e.g.
26
+ * inspectAction's post-loop finalize/handoff steps). A thrown scan error skips
27
+ * the post-run reset, leaving the state for the command catch to attribute and
28
+ * link the crash. Concurrent batch members (`concurrentScan`) never touch this
29
+ * state — they neither write nor reset it. Safe to call when telemetry is off
30
+ * (the refs are read only when an event is built).
31
+ */
32
+ const resetSentryRunState = () => {
33
+ setSentryProjectInfo(null);
34
+ setActiveRunTrace(null);
35
+ };
36
+ /**
37
+ * Runs an inspect invocation inside a root span so each `react-doctor` run is a
38
+ * first-class trace with timing and the run snapshot as attributes. The span is
39
+ * handed to `run` so the scan's Effect spans parent under it and so the wide
40
+ * event can be stamped onto it once the outcome is known.
41
+ *
42
+ * A no-op pass-through when telemetry is off (`--no-telemetry`, tests, or an
43
+ * unconfigured build) — `run` receives `undefined` and no span is created, so
44
+ * there's no added exit latency.
45
+ *
46
+ * The span is created against the shared telemetry context rather than a
47
+ * freshly-provided layer, so it lives in the same tracer as the scan program's
48
+ * spans; see `telemetry-runtime.ts` for why that matters. It is started and
49
+ * ended manually because the body it wraps is a promise-returning imperative
50
+ * function, not an Effect — the same shape the Sentry inactive span had.
51
+ *
52
+ * While the span runs, its trace context is recorded as the active run trace so
53
+ * `reportErrorToSentry` can attach a crash thrown during the scan back to this
54
+ * trace (errors surface in the command catch, after the span has ended).
55
+ *
56
+ * A `concurrentScan` (one member of the CLI's multi-project pool) still gets its
57
+ * own root span, but skips recording the active run trace — the module-level
58
+ * handle has single-scan semantics, and overlapping writers would link a crash
59
+ * to an arbitrary sibling's trace.
60
+ */
61
+ const withRunSpan = async (run, options = {}) => {
62
+ const telemetryContext = getTelemetryContext();
63
+ if (telemetryContext === null) return run(void 0);
64
+ const { tags } = buildSentryScope();
65
+ const command = typeof tags.command === "string" ? tags.command : "inspect";
66
+ let rootSpan;
67
+ try {
68
+ rootSpan = runSync(makeSpan(`react-doctor ${command}`, { attributes: toSpanAttributes(tags) }).pipe(provideContext(telemetryContext)));
69
+ } catch {
70
+ return run(void 0);
71
+ }
72
+ recordRunTraceId(rootSpan.traceId);
73
+ if (options.concurrentScan !== true) setActiveRunTrace({
74
+ traceId: rootSpan.traceId,
75
+ spanId: rootSpan.spanId,
76
+ sampled: rootSpan.sampled
77
+ });
78
+ try {
79
+ const result = await run(rootSpan);
80
+ endSpanSafely(rootSpan, void_);
81
+ return result;
82
+ } catch (error) {
83
+ endSpanSafely(rootSpan, fail(options.mapErrorForSpan?.(error) ?? error));
84
+ throw error;
85
+ }
86
+ };
87
+ /**
88
+ * Records the scanned project (discovered in the `beforeLint` hook): remembers
89
+ * it for the lazy Sentry error-capture path (`buildSentryScope` folds it into
90
+ * exception events) and for per-emit metric attributes, and sets it on the run's
91
+ * root span so the trace carries the project shape too. Always cheap — the span
92
+ * attributes are skipped when `rootSpan` is absent (telemetry off), and storing
93
+ * the info is a plain assignment.
94
+ *
95
+ * A `concurrentScan` only sets the span attributes: the module-level project ref
96
+ * has single-scan semantics, and overlapping writers would stamp events and
97
+ * metrics with an arbitrary sibling's project. Wide events keep full attribution
98
+ * (they ride the span); per-emit metrics simply omit the project shape during a
99
+ * concurrent batch (absent, never wrong).
100
+ */
101
+ const recordSentryProjectContext = (projectInfo, rootSpan, options = {}) => {
102
+ if (options.concurrentScan !== true) setSentryProjectInfo(projectInfo);
103
+ if (rootSpan === void 0) return;
104
+ for (const [key, value] of Object.entries(toSpanAttributes(buildSentryProjectContext(projectInfo).tags))) rootSpan.attribute(key, value);
105
+ };
106
+ //#endregion
107
+ export { resetSentryRunState as n, withRunSpan as r, recordSentryProjectContext as t };
108
+
109
+ //# sourceMappingURL=with-run-span-BxZf1cDB.js.map
110
+ //# debugId=3331ff49-b86d-575b-8721-fada0c83b956
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.9.12-dev.28a1a9f",
3
+ "version": "0.9.12-dev.6416370",
4
4
  "description": "Your agent writes bad React. This catches it",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -62,11 +62,12 @@
62
62
  "oxc-parser": "^0.144.0",
63
63
  "oxc-resolver": "^11.24.2",
64
64
  "oxlint": ">=1.78.0 <1.79.0",
65
+ "playwright-core": "^1.62.1",
65
66
  "prompts": "^2.4.2",
66
67
  "typescript": ">=5.0.4 <6",
67
68
  "yaml": "^2.9.0",
68
69
  "yoga-layout": "~3.2.1",
69
- "oxlint-plugin-react-doctor": "0.9.12-dev.28a1a9f"
70
+ "oxlint-plugin-react-doctor": "0.9.12-dev.6416370"
70
71
  },
71
72
  "devDependencies": {
72
73
  "@types/babel__code-frame": "^7.27.0",
@@ -79,8 +80,8 @@
79
80
  "ora": "^9.4.0",
80
81
  "react": "19.2.5",
81
82
  "react-devtools-core": "^7.0.1",
82
- "@react-doctor/core": "0.9.12",
83
- "@react-doctor/api": "0.9.12"
83
+ "@react-doctor/api": "0.9.12",
84
+ "@react-doctor/core": "0.9.12"
84
85
  },
85
86
  "engines": {
86
87
  "node": "^20.19.0 || >=22.13.0"