deictic 0.8.1 → 0.10.0

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 (128) hide show
  1. package/API.md +81 -17
  2. package/README.md +1 -1
  3. package/dist/annotations/client.js +1 -1
  4. package/dist/bun.d.ts.map +1 -1
  5. package/dist/bun.js +26 -8
  6. package/dist/bun.js.map +1 -1
  7. package/dist/cli.js +1 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/client/index.d.ts +13 -13
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client/index.js +19 -7
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/next.d.ts.map +1 -1
  14. package/dist/next.js +45 -25
  15. package/dist/next.js.map +1 -1
  16. package/dist/react/client.d.ts +19 -0
  17. package/dist/react/client.d.ts.map +1 -0
  18. package/dist/react/client.js +504 -0
  19. package/dist/react/client.js.map +1 -0
  20. package/dist/react/index.d.ts +2 -0
  21. package/dist/react/index.js +1 -0
  22. package/dist/recommended/index.d.ts +15 -7
  23. package/dist/recommended/index.d.ts.map +1 -1
  24. package/dist/recommended/index.js +1 -1
  25. package/dist/recordings/client.d.ts.map +1 -1
  26. package/dist/recordings/client.js +48 -5
  27. package/dist/recordings/client.js.map +1 -1
  28. package/dist/screenshots/client.d.ts +9 -1
  29. package/dist/screenshots/client.d.ts.map +1 -1
  30. package/dist/screenshots/rrweb.d.ts +0 -6
  31. package/dist/screenshots/rrweb.d.ts.map +1 -1
  32. package/dist/screenshots/rrweb.js +46 -12
  33. package/dist/screenshots/rrweb.js.map +1 -1
  34. package/dist/shared/board.js +1 -1
  35. package/dist/shared/client.js +44 -2
  36. package/dist/shared/client.js.map +1 -1
  37. package/dist/shared/dom.js +7 -1
  38. package/dist/shared/dom.js.map +1 -1
  39. package/dist/shared/drawer.js +1 -1
  40. package/dist/shared/endpoints.js +15 -4
  41. package/dist/shared/endpoints.js.map +1 -1
  42. package/dist/shared/index.d.ts +11 -0
  43. package/dist/shared/index.d.ts.map +1 -1
  44. package/dist/shared/index10.d.ts +70 -0
  45. package/dist/shared/index10.d.ts.map +1 -0
  46. package/dist/shared/index3.d.ts +11 -0
  47. package/dist/shared/index3.d.ts.map +1 -1
  48. package/dist/shared/index7.d.ts +92 -312
  49. package/dist/shared/index7.d.ts.map +1 -1
  50. package/dist/shared/index8.d.ts +324 -47
  51. package/dist/shared/index8.d.ts.map +1 -1
  52. package/dist/shared/index9.d.ts +45 -63
  53. package/dist/shared/index9.d.ts.map +1 -1
  54. package/dist/shared/init.js +15 -11
  55. package/dist/shared/init.js.map +1 -1
  56. package/dist/shared/integration.d.ts +6 -0
  57. package/dist/shared/integration.d.ts.map +1 -1
  58. package/dist/shared/integration.js +28 -1
  59. package/dist/shared/integration.js.map +1 -1
  60. package/dist/shared/marks.js +7 -1
  61. package/dist/shared/marks.js.map +1 -1
  62. package/dist/shared/package.js +3 -1
  63. package/dist/shared/packages.js +1 -1
  64. package/dist/shared/playwright.js +39 -1
  65. package/dist/shared/playwright.js.map +1 -1
  66. package/dist/shared/react.js +25 -0
  67. package/dist/shared/react.js.map +1 -0
  68. package/dist/shared/recommended.js +6 -3
  69. package/dist/shared/recommended.js.map +1 -1
  70. package/dist/shared/recording.js +80 -3
  71. package/dist/shared/recording.js.map +1 -1
  72. package/dist/shared/recordings.js +30 -2
  73. package/dist/shared/recordings.js.map +1 -1
  74. package/dist/shared/screenshots.js.map +1 -1
  75. package/dist/shared/src.js.map +1 -1
  76. package/dist/shared/task.js +1 -0
  77. package/dist/shared/task.js.map +1 -1
  78. package/dist/shared/tasks.js +11 -0
  79. package/dist/shared/tasks.js.map +1 -1
  80. package/dist/shared/vite.d.ts +1 -1
  81. package/dist/shared/vite.d.ts.map +1 -1
  82. package/dist/shared/vite.js +28 -10
  83. package/dist/shared/vite.js.map +1 -1
  84. package/dist/tailwind/client.d.ts +1 -1
  85. package/dist/tailwind/index.d.ts +1 -1
  86. package/dist/tasks/client.d.ts +1 -1
  87. package/dist/tasks/client.js +45 -19
  88. package/dist/tasks/client.js.map +1 -1
  89. package/dist/tasks/index.d.ts +1 -1
  90. package/dist/voice/client.d.ts +1 -1
  91. package/dist/voice/client.js +1 -1
  92. package/dist/voice/index.d.ts +1 -1
  93. package/dist/webpack.d.ts +4 -0
  94. package/dist/webpack.d.ts.map +1 -1
  95. package/dist/webpack.js +37 -15
  96. package/dist/webpack.js.map +1 -1
  97. package/package.json +25 -1
  98. package/src/bun.ts +32 -8
  99. package/src/cli/bun.ts +2 -2
  100. package/src/cli/init.ts +14 -9
  101. package/src/cli/recording.ts +90 -4
  102. package/src/cli/task.ts +4 -0
  103. package/src/cli.ts +13 -6
  104. package/src/client/dom.ts +14 -0
  105. package/src/client/index.ts +25 -14
  106. package/src/index.ts +11 -0
  107. package/src/next.ts +34 -15
  108. package/src/plugins/react/client.ts +162 -0
  109. package/src/plugins/react/index.ts +130 -0
  110. package/src/plugins/react/renders.ts +219 -0
  111. package/src/plugins/react/serialize.ts +139 -0
  112. package/src/plugins/react/timeline.ts +143 -0
  113. package/src/plugins/recommended/index.ts +17 -5
  114. package/src/plugins/recordings/client.ts +64 -4
  115. package/src/plugins/recordings/marks.ts +7 -0
  116. package/src/plugins/recordings/replay.ts +30 -2
  117. package/src/plugins/screenshots/client.ts +42 -2
  118. package/src/plugins/screenshots/index.ts +11 -0
  119. package/src/plugins/screenshots/playwright.ts +65 -1
  120. package/src/plugins/screenshots/rrweb.ts +55 -28
  121. package/src/plugins/screenshots/states.ts +26 -0
  122. package/src/plugins/tasks/client.ts +41 -6
  123. package/src/plugins/tasks/composer.ts +24 -7
  124. package/src/plugins/tasks/index.ts +16 -2
  125. package/src/tools/integration.ts +33 -0
  126. package/src/tools/source.ts +14 -2
  127. package/src/vite.ts +31 -10
  128. package/src/webpack.ts +48 -16
@@ -0,0 +1,25 @@
1
+ import { r as definePlugin } from "./src.js";
2
+ // src/plugins/react/index.ts
3
+ /**
4
+ * `deictic/react`: what React's DevTools would show of the element a task is about, attached to the task as
5
+ * `react.json`. The component that wrote the element and the ones that wrote it in turn, each with its props, and
6
+ * its state: a class's, or a function's hooks, named as the code names them where the source says (`count`, not
7
+ * `State`). Read with bippy (an optional peer, imported as a task first asks for it) in development only, as React
8
+ * keeps who wrote an element only there. Each says how often it rendered, how long that took and why, as DevTools'
9
+ * profiler would, counted from React's commits. No tab, and nothing in the page of its own: the tasks plugin asks it, and
10
+ * sends what it answers beside the element's HTML, while the panel's HTML snapshot box is ticked.
11
+ *
12
+ * Values are what the page holds, so they're masked as the network plugin's are, by their names (`token`,
13
+ * `password`, `auth`…, and `mask`'s), and cut where they're deep or long.
14
+ */
15
+ function reactState(options = {}) {
16
+ return definePlugin({
17
+ name: "react",
18
+ client: "deictic/react/client",
19
+ packages: ["bippy"],
20
+ clientOptions: { ...options }
21
+ });
22
+ }
23
+ export { reactState as t };
24
+
25
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","names":[],"sources":["../../src/plugins/react/index.ts"],"sourcesContent":["/**\n * `deictic/react`: what React's DevTools would show of the element a task is about, attached to the task as\n * `react.json`. The component that wrote the element and the ones that wrote it in turn, each with its props, and\n * its state: a class's, or a function's hooks, named as the code names them where the source says (`count`, not\n * `State`). Read with bippy (an optional peer, imported as a task first asks for it) in development only, as React\n * keeps who wrote an element only there. Each says how often it rendered, how long that took and why, as DevTools'\n * profiler would, counted from React's commits. No tab, and nothing in the page of its own: the tasks plugin asks it, and\n * sends what it answers beside the element's HTML, while the panel's HTML snapshot box is ticked.\n *\n * Values are what the page holds, so they're masked as the network plugin's are, by their names (`token`,\n * `password`, `auth`…, and `mask`'s), and cut where they're deep or long.\n */\nimport { definePlugin } from '#src/index.ts';\n\nexport interface ReactOptions {\n /** How many components, out from the one that wrote the element: 4 by default. */\n components?: number;\n /** More names whose values are blanked: a part of the name, in any case. */\n mask?: string[];\n /**\n * Whether hooks are named as the code names them, read off the source and its map (fetched from the dev server, as\n * DevTools does): true by default. Without, each is its kind alone, `State` or `Memo`, in the order they're called.\n */\n names?: boolean;\n /**\n * Whether each component's renders are counted, timed and explained, from React's commits as DevTools' hook hears\n * them: true by default. That hook is React Refresh's, in development; without one there's nothing to count.\n */\n renders?: boolean;\n}\n\n/** What JSON holds of a value: anything it can't hold says what it was, in brackets (`[function onClick]`). */\nexport type Value = null | boolean | number | string | Value[] | { [key: string]: Value };\n\n/** A hook as DevTools lists it. */\nexport interface Hook {\n /** Its kind: `State`, `Memo`, `Context`, or a custom hook's name less `use` (`Auth`), whose `hooks` it called. */\n hook: string;\n /** What the code calls it: `const [count, setCount] = useState(0)` is `count`. */\n as?: string;\n value?: Value;\n hooks?: Hook[];\n}\n\n/** A component's renders, counted from when the page started deictic, not from its first. */\nexport interface Renders {\n count: number;\n /** In the 10 seconds before the task: a loop, or a burst on each keystroke. */\n recent: number;\n /** How long ago it last rendered, in milliseconds. */\n lastAgo: number;\n /** How long its last render took, with what it rendered, in milliseconds: where React times them. */\n lastMs?: number;\n /** Its own part of it. */\n selfMs?: number;\n /** Why it last rendered: `mounted`, `props changed: chosen`, `state changed`, `context changed`, `its parent rendered`. */\n why: string;\n}\n\n/** A component that rendered in a recording's commit, once for each time it did in the entry. */\nexport interface Rendered {\n name: string;\n /** Where its JSX has the first element it wrote, `src/Plan.tsx:12`, where it wrote one. */\n at?: string;\n /** How many times it rendered in the entry, where that's more than once. */\n count?: number;\n /** How long it took, with what it rendered, in milliseconds, all its renders in the entry together. */\n ms?: number;\n /** Its own part of it. */\n selfMs?: number;\n /** Why it last rendered, as `Renders.why`. */\n why: string;\n}\n\n/**\n * A recording's entry of React's commits, `deictic.react` events: commits a frame apart, as one, with the components\n * they rendered, the slowest first. `{ on: boolean }` events say where the recording starts and stops having them.\n */\nexport interface Commit {\n /** How many commits it is. */\n commits: number;\n /** How long rendering them took, in milliseconds, where React times it. */\n ms?: number;\n /** Of several, the slowest one's, in milliseconds: one past a frame is what makes a page stutter. */\n slowest?: number;\n /**\n * The rest of a busy second, past ten entries in it: how long it spans, in milliseconds, up to this entry's\n * moment. A page that renders without stop is ten entries and this one a second.\n */\n over?: number;\n /** React's scheduler priority for the last: `immediate` (a click, a key), `user-blocking`, `normal`, `low`, `idle`. */\n priority?: string;\n /** Twenty at most. */\n components: Rendered[];\n /** How many more components rendered than it names. */\n more?: number;\n}\n\n/** A component that wrote the element, or wrote one that did. */\nexport interface Component {\n name: string;\n /** Where its JSX has the nearest element around this one, `src/Plan.tsx:12`: none for one that only passed it on. */\n at?: string;\n /** A server component: React kept its name, and nothing of it is in the page. */\n server?: true;\n props?: Value;\n /** A class component's state. */\n state?: Value;\n /** A function component's hooks, in the order it calls them, effects left out. */\n hooks?: Hook[];\n renders?: Renders;\n /** Why what's missing is. */\n problem?: string;\n}\n\n/** `react.json`: the component that wrote the element first, then the one that wrote it, and on out. */\nexport interface Snapshot {\n components: Component[];\n}\n\nexport function reactState(options: ReactOptions = {}) {\n return definePlugin<never, never>({\n name: 'react',\n client: 'deictic/react/client',\n packages: ['bippy'],\n clientOptions: { ...options },\n });\n}\n\nexport default reactState;\n"],"mappings":";;;;;;;;;;;;;;AAwHA,SAAgB,WAAW,UAAwB,CAAC,GAAG;CACrD,OAAO,aAA2B;EAChC,MAAM;EACN,QAAQ;EACR,UAAU,CAAC,OAAO;EAClB,eAAe,EAAE,GAAG,QAAQ;CAC9B,CAAC;AACH"}
@@ -1,16 +1,18 @@
1
1
  import { t as annotations } from "./annotations.js";
2
2
  import { t as logs } from "./logs.js";
3
3
  import { t as network } from "./network.js";
4
+ import { t as reactState } from "./react.js";
4
5
  import { t as recordings } from "./recordings.js";
5
6
  import { r as screenshots } from "./screenshots.js";
6
7
  import { t as tasks } from "./tasks.js";
7
8
  import { t as voice } from "./voice.js";
9
+ import { r as installed } from "./packages.js";
8
10
  // src/plugins/recommended/index.ts
9
11
  /**
10
12
  * Tasks, screenshots, annotations, recordings and voice, in that order, the order of their tabs, then what a
11
- * recording has besides the page: logs and network.
13
+ * recording has besides the page: logs and network, and React's state where the project has React.
12
14
  */
13
- function recommended(options = {}) {
15
+ function deicticRecommended(options = {}) {
14
16
  const plugins = [];
15
17
  if (options.tasks !== false) plugins.push(tasks(options.tasks));
16
18
  if (options.screenshots !== false) plugins.push(screenshots(options.screenshots));
@@ -19,8 +21,9 @@ function recommended(options = {}) {
19
21
  if (options.voice !== false) plugins.push(voice(options.voice));
20
22
  if (options.recordings !== false && options.logs !== false) plugins.push(logs(options.logs));
21
23
  if (options.recordings !== false && options.network !== false) plugins.push(network(options.network));
24
+ if (options.react !== false && (options.react !== void 0 || installed(process.cwd(), "react"))) plugins.push(reactState(options.react));
22
25
  return plugins;
23
26
  }
24
- export { recommended as t };
27
+ export { deicticRecommended as t };
25
28
 
26
29
  //# sourceMappingURL=recommended.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recommended.js","names":[],"sources":["../../src/plugins/recommended/index.ts"],"sourcesContent":["/**\n * `deictic/recommended`: the plugins for describing a change rather than making it. Alt-click an element, say what\n * should change, attach a screenshot to draw on, a screen recording or your voice, and it goes to a Vercel Board.\n * A recording has the page's console and its requests in it too.\n *\n * Only the server halves, as every factory is: each names its page half, which the integration imports. A plugin\n * outside the preset (Tailwind, your own) goes beside it: `plugins: [...recommended(), tailwind()]`.\n */\nimport type { ServerPlugin } from '#src/index.ts';\nimport { annotations, type AnnotationsOptions } from '#src/plugins/annotations/index.ts';\nimport { logs, type LogsOptions } from '#src/plugins/logs/index.ts';\nimport { network, type NetworkOptions } from '#src/plugins/network/index.ts';\nimport { recordings, type RecordingsOptions } from '#src/plugins/recordings/index.ts';\nimport { screenshots, type ScreenshotsOptions } from '#src/plugins/screenshots/index.ts';\nimport { tasks, type TasksOptions } from '#src/plugins/tasks/index.ts';\nimport { voice, type VoiceOptions } from '#src/plugins/voice/index.ts';\n\n/** Each plugin's options, by its name, or `false` to leave it out. */\nexport interface RecommendedOptions {\n tasks?: TasksOptions | false;\n screenshots?: ScreenshotsOptions | false;\n annotations?: AnnotationsOptions | false;\n recordings?: RecordingsOptions | false;\n voice?: VoiceOptions | false;\n /** The console's lines in a recording. */\n logs?: LogsOptions | false;\n /** The page's requests in a recording, masked. */\n network?: NetworkOptions | false;\n}\n\n/**\n * Tasks, screenshots, annotations, recordings and voice, in that order, the order of their tabs, then what a\n * recording has besides the page: logs and network.\n */\nexport function recommended(options: RecommendedOptions = {}): ServerPlugin[] {\n const plugins: ServerPlugin[] = [];\n if (options.tasks !== false) plugins.push(tasks(options.tasks));\n if (options.screenshots !== false) plugins.push(screenshots(options.screenshots));\n if (options.annotations !== false) plugins.push(annotations(options.annotations));\n if (options.recordings !== false) plugins.push(recordings(options.recordings));\n if (options.voice !== false) plugins.push(voice(options.voice));\n // Nothing without recordings to be in.\n if (options.recordings !== false && options.logs !== false) plugins.push(logs(options.logs));\n if (options.recordings !== false && options.network !== false) plugins.push(network(options.network));\n return plugins;\n}\n\nexport default recommended;\n"],"mappings":";;;;;;;;;;;;AAkCA,SAAgB,YAAY,UAA8B,CAAC,GAAmB;CAC5E,MAAM,UAA0B,CAAC;CACjC,IAAI,QAAQ,UAAU,OAAO,QAAQ,KAAK,MAAM,QAAQ,KAAK,CAAC;CAC9D,IAAI,QAAQ,gBAAgB,OAAO,QAAQ,KAAK,YAAY,QAAQ,WAAW,CAAC;CAChF,IAAI,QAAQ,gBAAgB,OAAO,QAAQ,KAAK,YAAY,QAAQ,WAAW,CAAC;CAChF,IAAI,QAAQ,eAAe,OAAO,QAAQ,KAAK,WAAW,QAAQ,UAAU,CAAC;CAC7E,IAAI,QAAQ,UAAU,OAAO,QAAQ,KAAK,MAAM,QAAQ,KAAK,CAAC;CAE9D,IAAI,QAAQ,eAAe,SAAS,QAAQ,SAAS,OAAO,QAAQ,KAAK,KAAK,QAAQ,IAAI,CAAC;CAC3F,IAAI,QAAQ,eAAe,SAAS,QAAQ,YAAY,OAAO,QAAQ,KAAK,QAAQ,QAAQ,OAAO,CAAC;CACpG,OAAO;AACT"}
1
+ {"version":3,"file":"recommended.js","names":[],"sources":["../../src/plugins/recommended/index.ts"],"sourcesContent":["/**\n * `deictic/recommended`: the plugins for describing a change rather than making it. Alt-click an element, say what\n * should change, attach a screenshot to draw on, a screen recording or your voice, and it goes to a Vercel Board.\n * A recording has the page's console and its requests in it too, and in a React project a task has the props and\n * state of the components that wrote its element.\n *\n * Only the server halves, as every factory is: each names its page half, which the integration imports. A plugin\n * outside the preset (Tailwind, your own) goes beside it: `plugins: [...deicticRecommended(), tailwind()]`. Named for\n * deictic, as a config imports other presets called `recommended`.\n */\nimport type { ServerPlugin } from '#src/index.ts';\nimport { annotations, type AnnotationsOptions } from '#src/plugins/annotations/index.ts';\nimport { logs, type LogsOptions } from '#src/plugins/logs/index.ts';\nimport { network, type NetworkOptions } from '#src/plugins/network/index.ts';\nimport { type ReactOptions, reactState } from '#src/plugins/react/index.ts';\nimport { recordings, type RecordingsOptions } from '#src/plugins/recordings/index.ts';\nimport { screenshots, type ScreenshotsOptions } from '#src/plugins/screenshots/index.ts';\nimport { tasks, type TasksOptions } from '#src/plugins/tasks/index.ts';\nimport { voice, type VoiceOptions } from '#src/plugins/voice/index.ts';\nimport { installed } from '#src/tools/packages.ts';\n\n/** Each plugin's options, by its name, or `false` to leave it out. */\nexport interface RecommendedOptions {\n tasks?: TasksOptions | false;\n screenshots?: ScreenshotsOptions | false;\n annotations?: AnnotationsOptions | false;\n recordings?: RecordingsOptions | false;\n voice?: VoiceOptions | false;\n /** The console's lines in a recording. */\n logs?: LogsOptions | false;\n /** The page's requests in a recording, masked. */\n network?: NetworkOptions | false;\n /**\n * The props, state and hooks of the components that wrote a task's element: where the project has React (found from\n * the working directory, where the dev server starts), unless it's `false`.\n */\n react?: ReactOptions | false;\n}\n\n/**\n * Tasks, screenshots, annotations, recordings and voice, in that order, the order of their tabs, then what a\n * recording has besides the page: logs and network, and React's state where the project has React.\n */\nexport function deicticRecommended(options: RecommendedOptions = {}): ServerPlugin[] {\n const plugins: ServerPlugin[] = [];\n if (options.tasks !== false) plugins.push(tasks(options.tasks));\n if (options.screenshots !== false) plugins.push(screenshots(options.screenshots));\n if (options.annotations !== false) plugins.push(annotations(options.annotations));\n if (options.recordings !== false) plugins.push(recordings(options.recordings));\n if (options.voice !== false) plugins.push(voice(options.voice));\n // Nothing without recordings to be in.\n if (options.recordings !== false && options.logs !== false) plugins.push(logs(options.logs));\n if (options.recordings !== false && options.network !== false) plugins.push(network(options.network));\n // Its page half reads React's fibers: nothing to read without React, and bippy to install for nothing.\n if (options.react !== false && (options.react !== undefined || installed(process.cwd(), 'react')))\n plugins.push(reactState(options.react));\n return plugins;\n}\n\nexport default deicticRecommended;\n"],"mappings":";;;;;;;;;;;;;;AA2CA,SAAgB,mBAAmB,UAA8B,CAAC,GAAmB;CACnF,MAAM,UAA0B,CAAC;CACjC,IAAI,QAAQ,UAAU,OAAO,QAAQ,KAAK,MAAM,QAAQ,KAAK,CAAC;CAC9D,IAAI,QAAQ,gBAAgB,OAAO,QAAQ,KAAK,YAAY,QAAQ,WAAW,CAAC;CAChF,IAAI,QAAQ,gBAAgB,OAAO,QAAQ,KAAK,YAAY,QAAQ,WAAW,CAAC;CAChF,IAAI,QAAQ,eAAe,OAAO,QAAQ,KAAK,WAAW,QAAQ,UAAU,CAAC;CAC7E,IAAI,QAAQ,UAAU,OAAO,QAAQ,KAAK,MAAM,QAAQ,KAAK,CAAC;CAE9D,IAAI,QAAQ,eAAe,SAAS,QAAQ,SAAS,OAAO,QAAQ,KAAK,KAAK,QAAQ,IAAI,CAAC;CAC3F,IAAI,QAAQ,eAAe,SAAS,QAAQ,YAAY,OAAO,QAAQ,KAAK,QAAQ,QAAQ,OAAO,CAAC;CAEpG,IAAI,QAAQ,UAAU,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,QAAQ,IAAI,GAAG,OAAO,IAC7F,QAAQ,KAAK,WAAW,QAAQ,KAAK,CAAC;CACxC,OAAO;AACT"}
@@ -1,13 +1,64 @@
1
1
  import { relative } from "node:path";
2
+ import "./marks.js";
2
3
  import { a as clock, l as fail, t as ME } from "./board.js";
3
4
  import { r as loadRecording } from "./find.js";
4
5
  // src/cli/recording.ts
5
6
  /**
6
7
  * `deictic recording`: a recording as a timeline: the page, each click and field typed in (with the element's place
7
8
  * in the source), scrolls, resizes, each change to the marks (what was drawn, where, and the notes' text), the voice
8
- * clips, the page's console and its requests where the project records them, and the end. Or the part of it asked
9
- * for: `--only`, `--problems`, `--from`, `--to`, `--around`, `--grep`, and `--full` for all of each line.
9
+ * clips, the page's console and its requests where the project records them, React's commits where the recording had
10
+ * them on, and the end. Or the part of it asked
11
+ * for: `--only`, `--problems`, `--from`, `--to`, `--around`, `--grep`, `--all`, and `--full` for all of each line.
12
+ *
13
+ * Asked for nothing, it's what the person did and what went wrong: the page's requests, its console's lines and
14
+ * React's commits, which a dev server makes hundreds of, are left out where they're not a problem, and counted at
15
+ * the end with what lists them. An agent asks for them where the task needs them. `--json` has every line.
10
16
  */
17
+ /**
18
+ * The kinds left out of a timeline asked for nothing in particular, where a line of them isn't a problem: a dev
19
+ * server's page makes hundreds of requests (its modules, its hot updates), logs what its tools do, and commits
20
+ * React each frame it animates. Counted, with what lists them.
21
+ */
22
+ const QUIET = [
23
+ {
24
+ kind: "request",
25
+ noun: "request"
26
+ },
27
+ {
28
+ kind: "console",
29
+ noun: "console line"
30
+ },
31
+ {
32
+ kind: "react",
33
+ noun: "React line"
34
+ }
35
+ ];
36
+ /** A commit past this took longer than a frame: a problem, as it's what makes a page stutter. */
37
+ const FRAME = 16;
38
+ const ms = (n) => `${n < 10 ? n.toFixed(1) : round(n)}ms`;
39
+ /** A React commit entry, as a line: how long, why it ran, and what rendered, the slowest first. */
40
+ function commitLine(c) {
41
+ const components = c.components ?? [];
42
+ const many = (c.commits ?? 1) > 1;
43
+ const head = [
44
+ c.priority,
45
+ many ? `${c.commits} commits${c.over === void 0 ? "" : ` over ${(c.over / 1e3).toFixed(1)}s`}` : void 0,
46
+ c.slowest === void 0 ? void 0 : `slowest ${ms(c.slowest)}`
47
+ ].filter(Boolean).join(", ");
48
+ const slow = c.slowest ?? c.ms;
49
+ const named = components.map((r) => `${r.name}${(r.count ?? 1) > 1 ? ` ×${r.count}` : ""}${r.selfMs === void 0 ? "" : ` ${ms(r.selfMs)}`} (${r.why})`);
50
+ const rest = c.more === void 0 ? "" : named.length === 0 ? `${c.more} components` : `, and ${c.more} more`;
51
+ return {
52
+ text: `${c.ms === void 0 ? "commit" : ms(c.ms)}${head === "" ? "" : ` (${head})`}: ${named.join(", ")}${rest}`,
53
+ details: components.map((r) => [
54
+ `${r.name}${(r.count ?? 1) > 1 ? ` ×${r.count}` : ""}`,
55
+ r.at,
56
+ r.ms === void 0 ? void 0 : `${ms(r.ms)} with what it rendered`,
57
+ r.why
58
+ ].filter(Boolean).join(" · ")),
59
+ ...slow !== void 0 && slow > FRAME ? { problem: true } : {}
60
+ };
61
+ }
11
62
  const round = Math.round;
12
63
  /** The marks, as data where the recording has it. */
13
64
  function shapeOf({ shape }) {
@@ -185,6 +236,10 @@ function timelineOf(events, voice) {
185
236
  ...payload.isInitial === true ? { before: "made as the page loaded, before this moment" } : {}
186
237
  });
187
238
  }
239
+ if (e.type === 5 && d.tag === "deictic.react") {
240
+ if (payload.on !== void 0) push(t, "react", payload.on ? "commits recorded from here" : "commits no longer recorded");
241
+ else push(t, "react", "", commitLine(payload));
242
+ }
188
243
  if (e.type === 5 && d.tag === "deictic.end") push(t, "end", "recording stopped");
189
244
  if (e.type !== 3) continue;
190
245
  if (d.source === 0) {
@@ -272,7 +327,22 @@ async function run(named, values) {
272
327
  const only = (values.only ?? []).flatMap((list) => list.split(",")).filter(Boolean);
273
328
  const grep = values.grep?.toLowerCase();
274
329
  const isKind = (kind, asked) => kind === asked || kind.startsWith(`${asked}.`) || kind.endsWith(`-${asked}`);
330
+ const whole = values.all === true || only.length > 0 || from !== void 0 || to !== void 0 || grep !== void 0;
331
+ const left = /* @__PURE__ */ new Map();
332
+ const listed = (e) => {
333
+ if (whole || e.problem === true) return true;
334
+ const quiet = QUIET.find((q) => isKind(e.kind, q.kind));
335
+ if (quiet === void 0) return true;
336
+ const held = left.get(quiet.kind) ?? {
337
+ count: 0,
338
+ noun: quiet.noun
339
+ };
340
+ held.count++;
341
+ left.set(quiet.kind, held);
342
+ return false;
343
+ };
275
344
  const shown = timeline.filter((e) => (only.length === 0 || only.some((asked) => isKind(e.kind, asked))) && (values.problems !== true || e.problem === true) && (from === void 0 || e.t >= from) && (to === void 0 || e.t <= to) && (grep === void 0 || `${e.kind} ${e.text}`.toLowerCase().includes(grep)));
345
+ const listing = values.json === true ? shown : shown.filter(listed);
276
346
  const colorScheme = kept.colorScheme ?? "light";
277
347
  const startedAt = new Date(kept.startedAt ?? events[0].timestamp).toISOString();
278
348
  if (values.json) {
@@ -297,12 +367,14 @@ async function run(named, values) {
297
367
  console.log(`viewport ${kept.viewport.width}×${kept.viewport.height}, ${colorScheme}, started ${startedAt}`);
298
368
  if (replay !== void 0) console.log(`replays at ${replay} (add ?t=<seconds> to open it paused there)`);
299
369
  if (shown.length < timeline.length) console.log(`${shown.length} of its ${timeline.length} lines, as asked`);
370
+ else if (listing.length < shown.length) console.log(`${listing.length} of its ${timeline.length} lines: what the person did, and what went wrong`);
300
371
  console.log();
301
372
  const short = shortener(kept.page);
302
373
  const under = (line) => console.log(`${" ".repeat(22)}${short(line)}`);
303
- for (const e of shown) {
374
+ for (const e of listing) {
304
375
  console.log(`${e.at.padStart(6)} ${e.kind.padEnd(13)} ${short(e.text)}`);
305
376
  if (e.trace && (values.full === true || e.problem === true)) for (const line of values.full ? e.trace : e.trace.slice(0, 5)) under(`at ${line}`);
377
+ if (values.full === true) for (const line of e.details ?? []) under(line);
306
378
  if (values.full !== true || e.request === void 0) continue;
307
379
  const r = e.request;
308
380
  if (e.before !== void 0) under(e.before);
@@ -311,6 +383,11 @@ async function run(named, values) {
311
383
  if (r.responseBody !== void 0) under(`response body ${r.responseBody}`);
312
384
  }
313
385
  if (shown.length === 0) console.log(timeline.length === 0 ? "Nothing in it." : "No line of it is what was asked for.");
386
+ if (left.size > 0) {
387
+ const counted = [...left.entries()].map(([kind, { count, noun }]) => `${count} ${noun}${count === 1 ? "" : "s"} (--only ${kind})`);
388
+ console.log(`
389
+ Not listed: ${counted.join(", ")}; --all lists every line, --around <seconds> every line of a moment.`);
390
+ }
314
391
  const problems = timeline.filter((e) => e.problem === true).length;
315
392
  if (problems === 0 || shown.length < timeline.length) return;
316
393
  const ref = task?.id ?? id;
@@ -1 +1 @@
1
- {"version":3,"file":"recording.js","names":[],"sources":["../../src/cli/recording.ts"],"sourcesContent":["/**\n * `deictic recording`: a recording as a timeline: the page, each click and field typed in (with the element's place\n * in the source), scrolls, resizes, each change to the marks (what was drawn, where, and the notes' text), the voice\n * clips, the page's console and its requests where the project records them, and the end. Or the part of it asked\n * for: `--only`, `--problems`, `--from`, `--to`, `--around`, `--grep`, and `--full` for all of each line.\n */\nimport { relative } from 'node:path';\n\nimport type { Shape } from '#src/plugins/annotations/index.ts';\n\nimport { clock, fail, ME } from './board.ts';\nimport { loadRecording } from './find.ts';\n\n/** A node of rrweb's snapshot. */\ninterface SnapNode {\n id: number;\n type: number;\n tagName?: string;\n textContent?: string;\n attributes?: Record<string, string>;\n childNodes?: SnapNode[];\n}\n\ninterface Known extends Omit<SnapNode, 'childNodes'> {\n parent: number | undefined;\n kids: number[];\n}\n\n/** A request rrweb's network plugin kept. */\ninterface Request {\n name: string;\n method?: string;\n initiatorType?: string;\n status?: number;\n duration?: number;\n requestHeaders?: Record<string, string>;\n responseHeaders?: Record<string, string>;\n requestBody?: string;\n responseBody?: string;\n}\n\n/** What rrweb's events carry that the timeline reads: each kind has some of it. */\ninterface Data {\n href?: string;\n width?: number;\n height?: number;\n node?: SnapNode;\n tag?: string;\n plugin?: string;\n payload?: {\n annotations?: Annotation[];\n svg?: string;\n href?: string;\n level?: string;\n payload?: string[];\n trace?: string[];\n requests?: Request[];\n isInitial?: boolean;\n };\n source?: number;\n type?: number;\n id?: number;\n x?: number;\n y?: number;\n adds?: { node: SnapNode; parentId: number }[];\n attributes?: { id: number; attributes: Record<string, string> }[];\n texts?: { id: number; value: string }[];\n isChecked?: boolean;\n text?: string;\n}\n\ninterface Event {\n type: number;\n timestamp: number;\n data: Data;\n}\n\ninterface Annotation {\n id?: string;\n shape: Shape;\n}\n\ninterface Line {\n t: number;\n at: string;\n kind: string;\n text: string;\n problem?: boolean;\n trace?: string[];\n request?: Request;\n before?: string;\n marks?: Shape[];\n node?: number;\n}\n\ntype Point = { x: number; y: number };\n\nconst round = Math.round;\n\n/** The marks, as data where the recording has it. */\nfunction shapeOf({ shape }: Annotation): string {\n const bounds = (points: Point[]) => {\n const xs = points.map((p) => p.x);\n const ys = points.map((p) => p.y);\n return `(${round(Math.min(...xs))},${round(Math.min(...ys))})–(${round(Math.max(...xs))},${round(Math.max(...ys))})`;\n };\n if (shape.kind === 'box') return `box ${bounds([shape, { x: shape.x + shape.width, y: shape.y + shape.height }])}`;\n if (shape.kind === 'arrow')\n return `arrow from (${round(shape.from.x)},${round(shape.from.y)}) to (${round(shape.to.x)},${round(shape.to.y)})`;\n if (shape.kind === 'pen') return `pen stroke over ${bounds(shape.points)}`;\n return `note at (${round(shape.at.x)},${round(shape.at.y)}): ${JSON.stringify(shape.text)}`;\n}\n\nconst pairs = (s: string): Point[] => [...s.matchAll(/(-?[\\d.]+)[ ,](-?[\\d.]+)/g)].map((m) => ({ x: Number(m[1]), y: Number(m[2]) }));\n\n/** The marks read off the SVG, for a recording older than the marks as data. */\nfunction shapesInSvg(svg: string): Annotation[] {\n const out: Annotation[] = [];\n const unescape = (t: string) => t.replaceAll('&lt;', '<').replaceAll('&gt;', '>').replaceAll('&quot;', '\"').replaceAll('&amp;', '&');\n for (const [, tag, attrs = '', inner = ''] of svg.matchAll(/<(rect|path|polyline|text)\\b([^>]*)>(?:(.*?)<\\/text>)?/g)) {\n const num = (name: string) => Number(new RegExp(`\\\\b${name}=\"(-?[\\\\d.]+)\"`).exec(attrs)?.[1]);\n if (tag === 'rect' && attrs.includes('fill=\"none\"'))\n out.push({ shape: { kind: 'box', x: num('x'), y: num('y'), width: num('width'), height: num('height') } });\n if (tag === 'path') {\n const [from, to] = pairs(/d=\"([^\"]*)\"/.exec(attrs)?.[1] ?? '');\n if (from !== undefined && to !== undefined) out.push({ shape: { kind: 'arrow', from, to } });\n }\n if (tag === 'polyline') out.push({ shape: { kind: 'pen', points: pairs(/points=\"([^\"]*)\"/.exec(attrs)?.[1] ?? '') } });\n if (tag === 'text') {\n const lines = [...inner.matchAll(/<tspan[^>]*>(.*?)<\\/tspan>/g)].map((l) => unescape(l[1] ?? ''));\n const xy = /x=\"(-?[\\d.]+)\" y=\"(-?[\\d.]+)\"/.exec(inner);\n out.push({ shape: { kind: 'note', at: { x: Number(xy?.[1] ?? 0), y: Number(xy?.[2] ?? 0) }, text: lines.join('\\n') } });\n }\n }\n return out;\n}\n\n/** The page's nodes by rrweb's IDs, from the full snapshot and each mutation: enough to name an element. */\nclass Nodes {\n #nodes = new Map<number, Known>();\n\n clear(): void {\n this.#nodes.clear();\n }\n\n add(node: SnapNode, parent: number | undefined): void {\n const { childNodes = [], ...rest } = node;\n this.#nodes.set(node.id, { ...rest, parent, kids: childNodes.map((c) => c.id) });\n for (const c of childNodes) this.add(c, node.id);\n }\n\n get(id: number): Known | undefined {\n return this.#nodes.get(id);\n }\n\n text(id: number, max = 60): string {\n let out = '';\n const walk = (n: number) => {\n const node = this.#nodes.get(n);\n if (node === undefined || out.length > max) return;\n if (node.type === 3) out += node.textContent ?? '';\n for (const k of node.kids) walk(k);\n };\n walk(id);\n const text = out.replace(/\\s+/g, ' ').trim();\n return text.length > max ? `${text.slice(0, max)}…` : text;\n }\n\n /** `<button> \"Save\" at src/App.tsx:9:7`: the element, its text, and the nearest place deictic marked. */\n describe(id: number | undefined): string {\n const node = id === undefined ? undefined : this.#nodes.get(id);\n if (id === undefined || node === undefined) return `node ${id}`;\n if (node.type === 0) return 'the page';\n let at: string | undefined;\n for (\n let n: Known | undefined = node;\n n !== undefined && at === undefined;\n n = n.parent === undefined ? undefined : this.#nodes.get(n.parent)\n )\n at = n.attributes?.['data-deictic'];\n const tag = node.tagName === undefined ? 'text' : `<${node.tagName}>`;\n const text = this.text(id);\n return `${tag}${text ? ` \"${text}\"` : ''}${at === undefined ? '' : ` at ${at}`}`;\n }\n}\n\n/** The page's console's arguments, each as JSON: a string without its quotes. */\nconst plain = (arg: string) => {\n try {\n const value: unknown = JSON.parse(arg);\n return typeof value === 'string' ? value : arg;\n } catch {\n return arg;\n }\n};\n\n/** Every line of the recording, in time. */\nfunction timelineOf(events: Event[], voice: { id: string; at: number; duration: number }[]): Line[] {\n const t0 = events[0]!.timestamp;\n const timeline: Line[] = [];\n const nodes = new Nodes();\n const push = (t: number, kind: string, text: string, extra: Partial<Line> = {}) =>\n timeline.push({ t, at: clock(t), kind, text, ...extra });\n let marks: Annotation[] = [];\n let scroll: { t: number; id: number | undefined; x: number; y: number } | undefined;\n let typing: { t: number; id: number | undefined; value: string } | undefined;\n const flushScroll = () => {\n if (scroll) push(scroll.t, 'scroll', `${nodes.describe(scroll.id)} to (${scroll.x},${scroll.y})`);\n scroll = undefined;\n };\n const flushTyping = () => {\n if (typing) push(typing.t, 'input', `${nodes.describe(typing.id)}: ${typing.value}`);\n typing = undefined;\n };\n\n for (const e of events) {\n const t = e.timestamp - t0;\n const d = e.data;\n const payload = d.payload ?? {};\n if (e.type === 4) push(t, 'page', `${d.href} at ${d.width}×${d.height}`);\n if (e.type === 2 && d.node !== undefined) {\n nodes.clear();\n nodes.add(d.node, undefined);\n }\n if (e.type === 5 && d.tag === 'deictic.annotations') {\n const now = payload.annotations ?? shapesInSvg(payload.svg ?? '');\n const key = (a: Annotation) => a.id ?? JSON.stringify(a.shape);\n const before = new Set(marks.map(key));\n const after = new Set(now.map(key));\n const added = now.filter((a) => !before.has(key(a)));\n const removed = marks.filter((a) => !after.has(key(a)));\n if (added.length > 0 || removed.length > 0) {\n // All of them cleared (a task added, the page left) is said as that: each was said as it was drawn.\n const gone = now.length === 0 && removed.length > 1 ? [`− all ${removed.length} marks`] : removed.map((a) => `− ${shapeOf(a)}`);\n const text = [...added.map((a) => `+ ${shapeOf(a)}`), ...gone].join('; ');\n push(t, 'marks', text, { marks: now.map((a) => a.shape) });\n }\n marks = now;\n }\n // The address changed with no load: a route of the app's.\n if (e.type === 5 && d.tag === 'deictic.page') push(t, 'page', `${payload.href} (a route change, no load)`);\n // The page's console, and errors nothing caught (rrweb's console plugin), and where it was logged from, which goes\n // under a warning or an error.\n if (e.type === 6 && d.plugin === 'rrweb/console@1') {\n const level = payload.level ?? 'log';\n push(t, `console.${level}`, (payload.payload ?? []).map(plain).join(' '), {\n trace: payload.trace ?? [],\n ...(['error', 'assert', 'warn'].includes(level) ? { problem: true } : {}),\n });\n }\n // The page's requests (rrweb's network plugin), masked as they were kept: each as it ended. One the browser\n // reported of itself has no method; headers and bodies, where kept, are in `--json`.\n if (e.type === 6 && d.plugin === 'rrweb/network@1') {\n for (const r of payload.requests ?? []) {\n const took = r.duration !== undefined && Number.isFinite(r.duration) ? ` in ${round(r.duration)} ms` : '';\n const status = r.status === undefined || r.status === 0 ? 'no status (failed, blocked, or another origin’s)' : r.status;\n push(t, 'request', `${r.method ?? r.initiatorType ?? ''} ${r.name} → ${status}${took}`.trim(), {\n request: r,\n ...((r.status ?? 0) >= 400 ? { problem: true } : {}),\n ...(payload.isInitial === true ? { before: 'made as the page loaded, before this moment' } : {}),\n });\n }\n }\n if (e.type === 5 && d.tag === 'deictic.end') push(t, 'end', 'recording stopped');\n if (e.type !== 3) continue;\n if (d.source === 0) {\n for (const a of d.adds ?? []) nodes.add(a.node, a.parentId);\n for (const a of d.attributes ?? []) {\n const node = nodes.get(a.id);\n if (node) node.attributes = { ...node.attributes, ...a.attributes };\n }\n for (const x of d.texts ?? []) {\n const node = nodes.get(x.id);\n if (node) node.textContent = x.value;\n }\n }\n if (d.source === 2 && (d.type === 2 || d.type === 3 || d.type === 4)) {\n flushScroll();\n flushTyping();\n const what = { 2: 'click', 3: 'right-click', 4: 'double-click' }[d.type];\n // A click a key made (Enter on a button) has no position.\n const where = d.x === 0 && d.y === 0 ? ' by keyboard' : ` at (${round(d.x ?? 0)},${round(d.y ?? 0)}) in the viewport`;\n push(t, what, `${nodes.describe(d.id)}${where}`, { node: d.id });\n }\n if (d.source === 3) {\n if (scroll && scroll.id !== d.id) flushScroll();\n scroll = { t: scroll?.t ?? t, id: d.id, x: round(d.x ?? 0), y: round(d.y ?? 0) };\n }\n if (d.source === 4) push(t, 'resize', `viewport ${d.width}×${d.height}`);\n if (d.source === 5) {\n if (typing && typing.id !== d.id) flushTyping();\n const value = d.isChecked !== undefined && d.text === undefined ? String(d.isChecked) : JSON.stringify(d.text);\n typing = { t: typing?.t ?? t, id: d.id, value };\n }\n }\n flushScroll();\n flushTyping();\n for (const c of voice) push(c.at, 'voice', `clip ${c.id}, ${clock(c.duration)} long, until ${clock(c.at + c.duration)}`);\n return timeline.sort((a, b) => a.t - b.t);\n}\n\n/**\n * The page's own URLs as paths, in a line of text: `http://localhost:5180/src/App.tsx?t=1712:9:7` is `/src/App.tsx:9:7`,\n * and a file Vite serves from outside its root (`/@fs/S:/…/dist/client.js`) is that file's path from here. The header\n * says the origin once; `--json` keeps every URL whole.\n */\nfunction shortener(page: string): (text: string) => string {\n let origin: string;\n try {\n origin = new URL(page).origin;\n } catch {\n return (text) => text;\n }\n const quoted = origin.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n // A Windows path has a drive's colon in it, which a line and column also follow.\n const fs = new RegExp(`${quoted}/@fs/([A-Za-z]:)?([^\\\\s?:)]+)`, 'g');\n const own = new RegExp(`${quoted}(?=/)`, 'g');\n return (text) =>\n text\n .replace(fs, (_, drive: string | undefined, rest: string) =>\n relative(process.cwd(), drive ? `${drive}${rest}` : `/${rest}`).replaceAll('\\\\', '/'),\n )\n .replace(own, '')\n // A bundler's cache-busting query, between a module's path and its line.\n .replace(/(\\.[cm]?[jt]sx?)\\?[tv]=[\\w.-]+/g, '$1');\n}\n\nexport interface Options {\n nth: string;\n json?: boolean;\n only?: string[];\n problems?: boolean;\n from?: string;\n to?: string;\n around?: string;\n grep?: string;\n full?: boolean;\n}\n\nexport async function run(named: string, values: Options): Promise<void> {\n const { kept, id, replay, task } = await loadRecording(named, Number(values.nth));\n const events = kept.events as Event[];\n if (!Array.isArray(events) || events.length === 0) fail(`Recording ${id} has no events.`);\n const timeline = timelineOf(events, kept.voice ?? []);\n\n // The part asked for. Seconds, as the replay's `?t=` and `frame --at` take them.\n const seconds = (name: 'from' | 'to' | 'around') => {\n const given = values[name];\n if (given === undefined) return undefined;\n const value = Number(given);\n if (!Number.isFinite(value)) fail(`--${name} takes seconds from the recording's start, as 12 or 4.5: not ${given}`);\n return value * 1000;\n };\n const around = seconds('around');\n const from = seconds('from') ?? (around === undefined ? undefined : around - 3000);\n const to = seconds('to') ?? (around === undefined ? undefined : around + 3000);\n const only = (values.only ?? []).flatMap((list) => list.split(',')).filter(Boolean);\n const grep = values.grep?.toLowerCase();\n // `console` is every level's lines, `click` a right or a double one too.\n const isKind = (kind: string, asked: string) => kind === asked || kind.startsWith(`${asked}.`) || kind.endsWith(`-${asked}`);\n const shown = timeline.filter(\n (e) =>\n (only.length === 0 || only.some((asked) => isKind(e.kind, asked))) &&\n (values.problems !== true || e.problem === true) &&\n (from === undefined || e.t >= from) &&\n (to === undefined || e.t <= to) &&\n (grep === undefined || `${e.kind} ${e.text}`.toLowerCase().includes(grep)),\n );\n\n const colorScheme = kept.colorScheme ?? 'light';\n const startedAt = new Date(kept.startedAt ?? events[0]!.timestamp).toISOString();\n if (values.json) {\n const head = { id, page: kept.page, viewport: kept.viewport, colorScheme, startedAt, duration: kept.duration, replay, task: task?.id };\n console.log(JSON.stringify({ ...head, lines: timeline.length, timeline: shown }, null, 2));\n return;\n }\n console.log(`Recording ${id}${task ? ` on task #${task.id}` : ''}: ${clock(kept.duration)} of ${kept.page}`);\n console.log(`viewport ${kept.viewport.width}×${kept.viewport.height}, ${colorScheme}, started ${startedAt}`);\n if (replay !== undefined) console.log(`replays at ${replay} (add ?t=<seconds> to open it paused there)`);\n if (shown.length < timeline.length) console.log(`${shown.length} of its ${timeline.length} lines, as asked`);\n console.log();\n const short = shortener(kept.page);\n const under = (line: string) => console.log(`${' '.repeat(22)}${short(line)}`);\n for (const e of shown) {\n console.log(`${e.at.padStart(6)} ${e.kind.padEnd(13)} ${short(e.text)}`);\n // Where a warning or an error came from, its nearest few places: all of them, and every line's, with `--full`.\n if (e.trace && (values.full === true || e.problem === true))\n for (const line of values.full ? e.trace : e.trace.slice(0, 5)) under(`at ${line}`);\n if (values.full !== true || e.request === undefined) continue;\n const r = e.request;\n if (e.before !== undefined) under(e.before);\n for (const [title, held] of [\n ['request headers', r.requestHeaders],\n ['response headers', r.responseHeaders],\n ] as const)\n for (const [name, value] of Object.entries(held ?? {})) under(`${title} ${name}: ${value}`);\n if (r.requestBody !== undefined) under(`request body ${r.requestBody}`);\n if (r.responseBody !== undefined) under(`response body ${r.responseBody}`);\n }\n if (shown.length === 0) console.log(timeline.length === 0 ? 'Nothing in it.' : 'No line of it is what was asked for.');\n // Where something went wrong, how to get to it: what led up to it, and what the page looked like.\n const problems = timeline.filter((e) => e.problem === true).length;\n if (problems === 0 || shown.length < timeline.length) return;\n const ref = task?.id ?? id;\n console.log(\n `\\n${problems} problem${problems === 1 ? '' : 's'}: --problems lists them, --around <seconds> shows what led to one, and ${ME} frame ${ref} --at <seconds> the page then.`,\n );\n}\n"],"mappings":";;;;;;;;;;AAiGA,MAAM,QAAQ,KAAK;;AAGnB,SAAS,QAAQ,EAAE,SAA6B;CAC9C,MAAM,UAAU,WAAoB;EAClC,MAAM,KAAK,OAAO,KAAK,MAAM,EAAE,CAAC;EAChC,MAAM,KAAK,OAAO,KAAK,MAAM,EAAE,CAAC;EAChC,OAAO,IAAI,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC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I,EAAE,UAAU,OAAO,SAAS,QAAQ,EAAE,YAAY,OACpD,KAAK,MAAM,QAAQ,OAAO,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,MAAM,MAAM;EACpF,IAAI,OAAO,SAAS,QAAQ,EAAE,YAAY,KAAA,GAAW;EACrD,MAAM,IAAI,EAAE;EACZ,IAAI,EAAE,WAAW,KAAA,GAAW,MAAM,EAAE,MAAM;EAC1C,KAAK,MAAM,CAAC,OAAO,SAAS,CAC1B,CAAC,mBAAmB,EAAE,cAAc,GACpC,CAAC,oBAAoB,EAAE,eAAe,CACxC,GACE,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,IAAI,KAAK,IAAI,OAAO;EAC7F,IAAI,EAAE,gBAAgB,KAAA,GAAW,MAAM,iBAAiB,EAAE,aAAa;EACvE,IAAI,EAAE,iBAAiB,KAAA,GAAW,MAAM,kBAAkB,EAAE,cAAc;CAC5E;CACA,IAAI,MAAM,WAAW,GAAG,QAAQ,IAAI,SAAS,WAAW,IAAI,mBAAmB,sCAAsC;CAErH,MAAM,WAAW,SAAS,QAAQ,MAAM,EAAE,YAAY,IAAI,CAAC,CAAC;CAC5D,IAAI,aAAa,KAAK,MAAM,SAAS,SAAS,QAAQ;CACtD,MAAM,MAAM,MAAM,MAAM;CACxB,QAAQ,IACN,KAAK,SAAS,UAAU,aAAa,IAAI,KAAK,IAAI,yEAAyE,GAAG,SAAS,IAAI,+BAC7I;AACF"}
1
+ {"version":3,"file":"recording.js","names":[],"sources":["../../src/cli/recording.ts"],"sourcesContent":["/**\n * `deictic recording`: a recording as a timeline: the page, each click and field typed in (with the element's place\n * in the source), scrolls, resizes, each change to the marks (what was drawn, where, and the notes' text), the voice\n * clips, the page's console and its requests where the project records them, React's commits where the recording had\n * them on, and the end. Or the part of it asked\n * for: `--only`, `--problems`, `--from`, `--to`, `--around`, `--grep`, `--all`, and `--full` for all of each line.\n *\n * Asked for nothing, it's what the person did and what went wrong: the page's requests, its console's lines and\n * React's commits, which a dev server makes hundreds of, are left out where they're not a problem, and counted at\n * the end with what lists them. An agent asks for them where the task needs them. `--json` has every line.\n */\nimport { relative } from 'node:path';\n\nimport type { Shape } from '#src/plugins/annotations/index.ts';\nimport type { Commit } from '#src/plugins/react/index.ts';\nimport { REACT } from '#src/plugins/recordings/marks.ts';\n\nimport { clock, fail, ME } from './board.ts';\nimport { loadRecording } from './find.ts';\n\n/** A node of rrweb's snapshot. */\ninterface SnapNode {\n id: number;\n type: number;\n tagName?: string;\n textContent?: string;\n attributes?: Record<string, string>;\n childNodes?: SnapNode[];\n}\n\ninterface Known extends Omit<SnapNode, 'childNodes'> {\n parent: number | undefined;\n kids: number[];\n}\n\n/** A request rrweb's network plugin kept. */\ninterface Request {\n name: string;\n method?: string;\n initiatorType?: string;\n status?: number;\n duration?: number;\n requestHeaders?: Record<string, string>;\n responseHeaders?: Record<string, string>;\n requestBody?: string;\n responseBody?: string;\n}\n\n/** What rrweb's events carry that the timeline reads: each kind has some of it. */\ninterface Data {\n href?: string;\n width?: number;\n height?: number;\n node?: SnapNode;\n tag?: string;\n plugin?: string;\n payload?: {\n annotations?: Annotation[];\n svg?: string;\n href?: string;\n level?: string;\n payload?: string[];\n trace?: string[];\n requests?: Request[];\n isInitial?: boolean;\n } & Partial<Commit> & { on?: boolean };\n source?: number;\n type?: number;\n id?: number;\n x?: number;\n y?: number;\n adds?: { node: SnapNode; parentId: number }[];\n attributes?: { id: number; attributes: Record<string, string> }[];\n texts?: { id: number; value: string }[];\n isChecked?: boolean;\n text?: string;\n}\n\ninterface Event {\n type: number;\n timestamp: number;\n data: Data;\n}\n\ninterface Annotation {\n id?: string;\n shape: Shape;\n}\n\ninterface Line {\n t: number;\n at: string;\n kind: string;\n text: string;\n problem?: boolean;\n trace?: string[];\n request?: Request;\n before?: string;\n marks?: Shape[];\n node?: number;\n /** A React commit entry's components, one line each: under it with `--full`. */\n details?: string[];\n}\n\n/**\n * The kinds left out of a timeline asked for nothing in particular, where a line of them isn't a problem: a dev\n * server's page makes hundreds of requests (its modules, its hot updates), logs what its tools do, and commits\n * React each frame it animates. Counted, with what lists them.\n */\nconst QUIET = [\n { kind: 'request', noun: 'request' },\n { kind: 'console', noun: 'console line' },\n { kind: 'react', noun: 'React line' },\n];\n\n/** A commit past this took longer than a frame: a problem, as it's what makes a page stutter. */\nconst FRAME = 16;\n\nconst ms = (n: number) => `${n < 10 ? n.toFixed(1) : round(n)}ms`;\n\n/** A React commit entry, as a line: how long, why it ran, and what rendered, the slowest first. */\nfunction commitLine(c: Partial<Commit>): Pick<Line, 'text' | 'details' | 'problem'> {\n const components = c.components ?? [];\n const many = (c.commits ?? 1) > 1;\n const head = [\n c.priority,\n many ? `${c.commits} commits${c.over === undefined ? '' : ` over ${(c.over / 1000).toFixed(1)}s`}` : undefined,\n c.slowest === undefined ? undefined : `slowest ${ms(c.slowest)}`,\n ]\n .filter(Boolean)\n .join(', ');\n // One slow commit is what makes a page stutter, not many quick ones.\n const slow = c.slowest ?? c.ms;\n const named = components.map(\n (r) => `${r.name}${(r.count ?? 1) > 1 ? ` ×${r.count}` : ''}${r.selfMs === undefined ? '' : ` ${ms(r.selfMs)}`} (${r.why})`,\n );\n const rest = c.more === undefined ? '' : named.length === 0 ? `${c.more} components` : `, and ${c.more} more`;\n return {\n text: `${c.ms === undefined ? 'commit' : ms(c.ms)}${head === '' ? '' : ` (${head})`}: ${named.join(', ')}${rest}`,\n details: components.map((r) =>\n [\n `${r.name}${(r.count ?? 1) > 1 ? ` ×${r.count}` : ''}`,\n r.at,\n r.ms === undefined ? undefined : `${ms(r.ms)} with what it rendered`,\n r.why,\n ]\n .filter(Boolean)\n .join(' · '),\n ),\n ...(slow !== undefined && slow > FRAME ? { problem: true } : {}),\n };\n}\n\ntype Point = { x: number; y: number };\n\nconst round = Math.round;\n\n/** The marks, as data where the recording has it. */\nfunction shapeOf({ shape }: Annotation): string {\n const bounds = (points: Point[]) => {\n const xs = points.map((p) => p.x);\n const ys = points.map((p) => p.y);\n return `(${round(Math.min(...xs))},${round(Math.min(...ys))})–(${round(Math.max(...xs))},${round(Math.max(...ys))})`;\n };\n if (shape.kind === 'box') return `box ${bounds([shape, { x: shape.x + shape.width, y: shape.y + shape.height }])}`;\n if (shape.kind === 'arrow')\n return `arrow from (${round(shape.from.x)},${round(shape.from.y)}) to (${round(shape.to.x)},${round(shape.to.y)})`;\n if (shape.kind === 'pen') return `pen stroke over ${bounds(shape.points)}`;\n return `note at (${round(shape.at.x)},${round(shape.at.y)}): ${JSON.stringify(shape.text)}`;\n}\n\nconst pairs = (s: string): Point[] => [...s.matchAll(/(-?[\\d.]+)[ ,](-?[\\d.]+)/g)].map((m) => ({ x: Number(m[1]), y: Number(m[2]) }));\n\n/** The marks read off the SVG, for a recording older than the marks as data. */\nfunction shapesInSvg(svg: string): Annotation[] {\n const out: Annotation[] = [];\n const unescape = (t: string) => t.replaceAll('&lt;', '<').replaceAll('&gt;', '>').replaceAll('&quot;', '\"').replaceAll('&amp;', '&');\n for (const [, tag, attrs = '', inner = ''] of svg.matchAll(/<(rect|path|polyline|text)\\b([^>]*)>(?:(.*?)<\\/text>)?/g)) {\n const num = (name: string) => Number(new RegExp(`\\\\b${name}=\"(-?[\\\\d.]+)\"`).exec(attrs)?.[1]);\n if (tag === 'rect' && attrs.includes('fill=\"none\"'))\n out.push({ shape: { kind: 'box', x: num('x'), y: num('y'), width: num('width'), height: num('height') } });\n if (tag === 'path') {\n const [from, to] = pairs(/d=\"([^\"]*)\"/.exec(attrs)?.[1] ?? '');\n if (from !== undefined && to !== undefined) out.push({ shape: { kind: 'arrow', from, to } });\n }\n if (tag === 'polyline') out.push({ shape: { kind: 'pen', points: pairs(/points=\"([^\"]*)\"/.exec(attrs)?.[1] ?? '') } });\n if (tag === 'text') {\n const lines = [...inner.matchAll(/<tspan[^>]*>(.*?)<\\/tspan>/g)].map((l) => unescape(l[1] ?? ''));\n const xy = /x=\"(-?[\\d.]+)\" y=\"(-?[\\d.]+)\"/.exec(inner);\n out.push({ shape: { kind: 'note', at: { x: Number(xy?.[1] ?? 0), y: Number(xy?.[2] ?? 0) }, text: lines.join('\\n') } });\n }\n }\n return out;\n}\n\n/** The page's nodes by rrweb's IDs, from the full snapshot and each mutation: enough to name an element. */\nclass Nodes {\n #nodes = new Map<number, Known>();\n\n clear(): void {\n this.#nodes.clear();\n }\n\n add(node: SnapNode, parent: number | undefined): void {\n const { childNodes = [], ...rest } = node;\n this.#nodes.set(node.id, { ...rest, parent, kids: childNodes.map((c) => c.id) });\n for (const c of childNodes) this.add(c, node.id);\n }\n\n get(id: number): Known | undefined {\n return this.#nodes.get(id);\n }\n\n text(id: number, max = 60): string {\n let out = '';\n const walk = (n: number) => {\n const node = this.#nodes.get(n);\n if (node === undefined || out.length > max) return;\n if (node.type === 3) out += node.textContent ?? '';\n for (const k of node.kids) walk(k);\n };\n walk(id);\n const text = out.replace(/\\s+/g, ' ').trim();\n return text.length > max ? `${text.slice(0, max)}…` : text;\n }\n\n /** `<button> \"Save\" at src/App.tsx:9:7`: the element, its text, and the nearest place deictic marked. */\n describe(id: number | undefined): string {\n const node = id === undefined ? undefined : this.#nodes.get(id);\n if (id === undefined || node === undefined) return `node ${id}`;\n if (node.type === 0) return 'the page';\n let at: string | undefined;\n for (\n let n: Known | undefined = node;\n n !== undefined && at === undefined;\n n = n.parent === undefined ? undefined : this.#nodes.get(n.parent)\n )\n at = n.attributes?.['data-deictic'];\n const tag = node.tagName === undefined ? 'text' : `<${node.tagName}>`;\n const text = this.text(id);\n return `${tag}${text ? ` \"${text}\"` : ''}${at === undefined ? '' : ` at ${at}`}`;\n }\n}\n\n/** The page's console's arguments, each as JSON: a string without its quotes. */\nconst plain = (arg: string) => {\n try {\n const value: unknown = JSON.parse(arg);\n return typeof value === 'string' ? value : arg;\n } catch {\n return arg;\n }\n};\n\n/** Every line of the recording, in time. */\nfunction timelineOf(events: Event[], voice: { id: string; at: number; duration: number }[]): Line[] {\n const t0 = events[0]!.timestamp;\n const timeline: Line[] = [];\n const nodes = new Nodes();\n const push = (t: number, kind: string, text: string, extra: Partial<Line> = {}) =>\n timeline.push({ t, at: clock(t), kind, text, ...extra });\n let marks: Annotation[] = [];\n let scroll: { t: number; id: number | undefined; x: number; y: number } | undefined;\n let typing: { t: number; id: number | undefined; value: string } | undefined;\n const flushScroll = () => {\n if (scroll) push(scroll.t, 'scroll', `${nodes.describe(scroll.id)} to (${scroll.x},${scroll.y})`);\n scroll = undefined;\n };\n const flushTyping = () => {\n if (typing) push(typing.t, 'input', `${nodes.describe(typing.id)}: ${typing.value}`);\n typing = undefined;\n };\n\n for (const e of events) {\n const t = e.timestamp - t0;\n const d = e.data;\n const payload = d.payload ?? {};\n if (e.type === 4) push(t, 'page', `${d.href} at ${d.width}×${d.height}`);\n if (e.type === 2 && d.node !== undefined) {\n nodes.clear();\n nodes.add(d.node, undefined);\n }\n if (e.type === 5 && d.tag === 'deictic.annotations') {\n const now = payload.annotations ?? shapesInSvg(payload.svg ?? '');\n const key = (a: Annotation) => a.id ?? JSON.stringify(a.shape);\n const before = new Set(marks.map(key));\n const after = new Set(now.map(key));\n const added = now.filter((a) => !before.has(key(a)));\n const removed = marks.filter((a) => !after.has(key(a)));\n if (added.length > 0 || removed.length > 0) {\n // All of them cleared (a task added, the page left) is said as that: each was said as it was drawn.\n const gone = now.length === 0 && removed.length > 1 ? [`− all ${removed.length} marks`] : removed.map((a) => `− ${shapeOf(a)}`);\n const text = [...added.map((a) => `+ ${shapeOf(a)}`), ...gone].join('; ');\n push(t, 'marks', text, { marks: now.map((a) => a.shape) });\n }\n marks = now;\n }\n // The address changed with no load: a route of the app's.\n if (e.type === 5 && d.tag === 'deictic.page') push(t, 'page', `${payload.href} (a route change, no load)`);\n // The page's console, and errors nothing caught (rrweb's console plugin), and where it was logged from, which goes\n // under a warning or an error.\n if (e.type === 6 && d.plugin === 'rrweb/console@1') {\n const level = payload.level ?? 'log';\n push(t, `console.${level}`, (payload.payload ?? []).map(plain).join(' '), {\n trace: payload.trace ?? [],\n ...(['error', 'assert', 'warn'].includes(level) ? { problem: true } : {}),\n });\n }\n // The page's requests (rrweb's network plugin), masked as they were kept: each as it ended. One the browser\n // reported of itself has no method; headers and bodies, where kept, are in `--json`.\n if (e.type === 6 && d.plugin === 'rrweb/network@1') {\n for (const r of payload.requests ?? []) {\n const took = r.duration !== undefined && Number.isFinite(r.duration) ? ` in ${round(r.duration)} ms` : '';\n const status = r.status === undefined || r.status === 0 ? 'no status (failed, blocked, or another origin’s)' : r.status;\n push(t, 'request', `${r.method ?? r.initiatorType ?? ''} ${r.name} → ${status}${took}`.trim(), {\n request: r,\n ...((r.status ?? 0) >= 400 ? { problem: true } : {}),\n ...(payload.isInitial === true ? { before: 'made as the page loaded, before this moment' } : {}),\n });\n }\n }\n if (e.type === 5 && d.tag === REACT) {\n if (payload.on !== undefined) push(t, 'react', payload.on ? 'commits recorded from here' : 'commits no longer recorded');\n else push(t, 'react', '', commitLine(payload));\n }\n if (e.type === 5 && d.tag === 'deictic.end') push(t, 'end', 'recording stopped');\n if (e.type !== 3) continue;\n if (d.source === 0) {\n for (const a of d.adds ?? []) nodes.add(a.node, a.parentId);\n for (const a of d.attributes ?? []) {\n const node = nodes.get(a.id);\n if (node) node.attributes = { ...node.attributes, ...a.attributes };\n }\n for (const x of d.texts ?? []) {\n const node = nodes.get(x.id);\n if (node) node.textContent = x.value;\n }\n }\n if (d.source === 2 && (d.type === 2 || d.type === 3 || d.type === 4)) {\n flushScroll();\n flushTyping();\n const what = { 2: 'click', 3: 'right-click', 4: 'double-click' }[d.type];\n // A click a key made (Enter on a button) has no position.\n const where = d.x === 0 && d.y === 0 ? ' by keyboard' : ` at (${round(d.x ?? 0)},${round(d.y ?? 0)}) in the viewport`;\n push(t, what, `${nodes.describe(d.id)}${where}`, { node: d.id });\n }\n if (d.source === 3) {\n if (scroll && scroll.id !== d.id) flushScroll();\n scroll = { t: scroll?.t ?? t, id: d.id, x: round(d.x ?? 0), y: round(d.y ?? 0) };\n }\n if (d.source === 4) push(t, 'resize', `viewport ${d.width}×${d.height}`);\n if (d.source === 5) {\n if (typing && typing.id !== d.id) flushTyping();\n const value = d.isChecked !== undefined && d.text === undefined ? String(d.isChecked) : JSON.stringify(d.text);\n typing = { t: typing?.t ?? t, id: d.id, value };\n }\n }\n flushScroll();\n flushTyping();\n for (const c of voice) push(c.at, 'voice', `clip ${c.id}, ${clock(c.duration)} long, until ${clock(c.at + c.duration)}`);\n return timeline.sort((a, b) => a.t - b.t);\n}\n\n/**\n * The page's own URLs as paths, in a line of text: `http://localhost:5180/src/App.tsx?t=1712:9:7` is `/src/App.tsx:9:7`,\n * and a file Vite serves from outside its root (`/@fs/S:/…/dist/client.js`) is that file's path from here. The header\n * says the origin once; `--json` keeps every URL whole.\n */\nfunction shortener(page: string): (text: string) => string {\n let origin: string;\n try {\n origin = new URL(page).origin;\n } catch {\n return (text) => text;\n }\n const quoted = origin.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n // A Windows path has a drive's colon in it, which a line and column also follow.\n const fs = new RegExp(`${quoted}/@fs/([A-Za-z]:)?([^\\\\s?:)]+)`, 'g');\n const own = new RegExp(`${quoted}(?=/)`, 'g');\n return (text) =>\n text\n .replace(fs, (_, drive: string | undefined, rest: string) =>\n relative(process.cwd(), drive ? `${drive}${rest}` : `/${rest}`).replaceAll('\\\\', '/'),\n )\n .replace(own, '')\n // A bundler's cache-busting query, between a module's path and its line.\n .replace(/(\\.[cm]?[jt]sx?)\\?[tv]=[\\w.-]+/g, '$1');\n}\n\nexport interface Options {\n nth: string;\n json?: boolean;\n all?: boolean;\n only?: string[];\n problems?: boolean;\n from?: string;\n to?: string;\n around?: string;\n grep?: string;\n full?: boolean;\n}\n\nexport async function run(named: string, values: Options): Promise<void> {\n const { kept, id, replay, task } = await loadRecording(named, Number(values.nth));\n const events = kept.events as Event[];\n if (!Array.isArray(events) || events.length === 0) fail(`Recording ${id} has no events.`);\n const timeline = timelineOf(events, kept.voice ?? []);\n\n // The part asked for. Seconds, as the replay's `?t=` and `frame --at` take them.\n const seconds = (name: 'from' | 'to' | 'around') => {\n const given = values[name];\n if (given === undefined) return undefined;\n const value = Number(given);\n if (!Number.isFinite(value)) fail(`--${name} takes seconds from the recording's start, as 12 or 4.5: not ${given}`);\n return value * 1000;\n };\n const around = seconds('around');\n const from = seconds('from') ?? (around === undefined ? undefined : around - 3000);\n const to = seconds('to') ?? (around === undefined ? undefined : around + 3000);\n const only = (values.only ?? []).flatMap((list) => list.split(',')).filter(Boolean);\n const grep = values.grep?.toLowerCase();\n // `console` is every level's lines, `click` a right or a double one too.\n const isKind = (kind: string, asked: string) => kind === asked || kind.startsWith(`${asked}.`) || kind.endsWith(`-${asked}`);\n // Asked for nothing in particular: what the person did and what went wrong, the rest counted. A slice of time, a\n // word or kinds asked for are every line of it.\n const whole = values.all === true || only.length > 0 || from !== undefined || to !== undefined || grep !== undefined;\n const left = new Map<string, { count: number; noun: string }>();\n const listed = (e: Line) => {\n if (whole || e.problem === true) return true;\n const quiet = QUIET.find((q) => isKind(e.kind, q.kind));\n if (quiet === undefined) return true;\n const held = left.get(quiet.kind) ?? { count: 0, noun: quiet.noun };\n held.count++;\n left.set(quiet.kind, held);\n return false;\n };\n const shown = timeline.filter(\n (e) =>\n (only.length === 0 || only.some((asked) => isKind(e.kind, asked))) &&\n (values.problems !== true || e.problem === true) &&\n (from === undefined || e.t >= from) &&\n (to === undefined || e.t <= to) &&\n (grep === undefined || `${e.kind} ${e.text}`.toLowerCase().includes(grep)),\n );\n // Not in `--json`, which is for a script, and has every line it was asked for.\n const listing = values.json === true ? shown : shown.filter(listed);\n\n const colorScheme = kept.colorScheme ?? 'light';\n const startedAt = new Date(kept.startedAt ?? events[0]!.timestamp).toISOString();\n if (values.json) {\n const head = { id, page: kept.page, viewport: kept.viewport, colorScheme, startedAt, duration: kept.duration, replay, task: task?.id };\n console.log(JSON.stringify({ ...head, lines: timeline.length, timeline: shown }, null, 2));\n return;\n }\n console.log(`Recording ${id}${task ? ` on task #${task.id}` : ''}: ${clock(kept.duration)} of ${kept.page}`);\n console.log(`viewport ${kept.viewport.width}×${kept.viewport.height}, ${colorScheme}, started ${startedAt}`);\n if (replay !== undefined) console.log(`replays at ${replay} (add ?t=<seconds> to open it paused there)`);\n if (shown.length < timeline.length) console.log(`${shown.length} of its ${timeline.length} lines, as asked`);\n else if (listing.length < shown.length)\n console.log(`${listing.length} of its ${timeline.length} lines: what the person did, and what went wrong`);\n console.log();\n const short = shortener(kept.page);\n const under = (line: string) => console.log(`${' '.repeat(22)}${short(line)}`);\n for (const e of listing) {\n console.log(`${e.at.padStart(6)} ${e.kind.padEnd(13)} ${short(e.text)}`);\n // Where a warning or an error came from, its nearest few places: all of them, and every line's, with `--full`.\n if (e.trace && (values.full === true || e.problem === true))\n for (const line of values.full ? e.trace : e.trace.slice(0, 5)) under(`at ${line}`);\n if (values.full === true) for (const line of e.details ?? []) under(line);\n if (values.full !== true || e.request === undefined) continue;\n const r = e.request;\n if (e.before !== undefined) under(e.before);\n for (const [title, held] of [\n ['request headers', r.requestHeaders],\n ['response headers', r.responseHeaders],\n ] as const)\n for (const [name, value] of Object.entries(held ?? {})) under(`${title} ${name}: ${value}`);\n if (r.requestBody !== undefined) under(`request body ${r.requestBody}`);\n if (r.responseBody !== undefined) under(`response body ${r.responseBody}`);\n }\n if (shown.length === 0) console.log(timeline.length === 0 ? 'Nothing in it.' : 'No line of it is what was asked for.');\n if (left.size > 0) {\n const counted = [...left.entries()].map(([kind, { count, noun }]) => `${count} ${noun}${count === 1 ? '' : 's'} (--only ${kind})`);\n console.log(`\nNot listed: ${counted.join(', ')}; --all lists every line, --around <seconds> every line of a moment.`);\n }\n // Where something went wrong, how to get to it: what led up to it, and what the page looked like.\n const problems = timeline.filter((e) => e.problem === true).length;\n if (problems === 0 || shown.length < timeline.length) return;\n const ref = task?.id ?? id;\n console.log(\n `\\n${problems} problem${problems === 1 ? '' : 's'}: --problems lists them, --around <seconds> shows what led to one, and ${ME} frame ${ref} --at <seconds> the page then.`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6GA,MAAM,QAAQ;CACZ;EAAE,MAAM;EAAW,MAAM;CAAU;CACnC;EAAE,MAAM;EAAW,MAAM;CAAe;CACxC;EAAE,MAAM;EAAS,MAAM;CAAa;AACtC;;AAGA,MAAM,QAAQ;AAEd,MAAM,MAAM,MAAc,GAAG,IAAI,KAAK,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,EAAE;;AAG9D,SAAS,WAAW,GAAgE;CAClF,MAAM,aAAa,EAAE,cAAc,CAAC;CACpC,MAAM,QAAQ,EAAE,WAAW,KAAK;CAChC,MAAM,OAAO;EACX,EAAE;EACF,OAAO,GAAG,EAAE,QAAQ,UAAU,EAAE,SAAS,KAAA,IAAY,KAAK,UAAU,EAAE,OAAO,IAAA,CAAM,QAAQ,CAAC,EAAE,OAAO,KAAA;EACrG,EAAE,YAAY,KAAA,IAAY,KAAA,IAAY,WAAW,GAAG,EAAE,OAAO;CAC/D,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,IAAI;CAEZ,MAAM,OAAO,EAAE,WAAW,EAAE;CAC5B,MAAM,QAAQ,WAAW,KACtB,MAAM,GAAG,EAAE,QAAQ,EAAE,SAAS,KAAK,IAAI,KAAK,EAAE,UAAU,KAAK,EAAE,WAAW,KAAA,IAAY,KAAK,IAAI,GAAG,EAAE,MAAM,IAAI,IAAI,EAAE,IAAI,EAC3H;CACA,MAAM,OAAO,EAAE,SAAS,KAAA,IAAY,KAAK,MAAM,WAAW,IAAI,GAAG,EAAE,KAAK,eAAe,SAAS,EAAE,KAAK;CACvG,OAAO;EACL,MAAM,GAAG,EAAE,OAAO,KAAA,IAAY,WAAW,GAAG,EAAE,EAAE,IAAI,SAAS,KAAK,KAAK,KAAK,KAAK,GAAG,IAAI,MAAM,KAAK,IAA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AAM,WAAW,SAAS,QAAQ,MAAM,EAAE,YAAY,IAAI,CAAC,CAAC;CAC5D,IAAI,aAAa,KAAK,MAAM,SAAS,SAAS,QAAQ;CACtD,MAAM,MAAM,MAAM,MAAM;CACxB,QAAQ,IACN,KAAK,SAAS,UAAU,aAAa,IAAI,KAAK,IAAI,yEAAyE,GAAG,SAAS,IAAI,+BAC7I;AACF"}
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
3
3
  import { dirname, join, resolve } from "node:path";
4
4
  import { r as definePlugin } from "./src.js";
5
5
  import { t as keptIn } from "./kept.js";
6
- import { n as MARKS } from "./marks.js";
6
+ import { i as REACT, n as MARKS } from "./marks.js";
7
7
  // src/plugins/recordings/replay.ts
8
8
  /**
9
9
  * The replay page, `replay/<id>`: rrweb's own player (`rrweb-player`), its timeline, speeds, skipping idle
@@ -70,7 +70,10 @@ const replayPage = ({ player = "..", source } = {}) => `<!doctype html>
70
70
  #log .text { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
71
71
  #log li.open .text { display: block; white-space: pre-wrap; }
72
72
  #log pre { margin: 0; padding: 2px 8px 8px calc(8px + 6ch + 8px); color: #a1a1aa; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
73
- #log.no-console li.console, #log.no-network li.network, #log.only-bad li:not(.bad) { display: none; }
73
+ #log.no-console li.console, #log.no-network li.network, #log.no-react li.react, #log.only-bad li:not(.bad) { display: none; }
74
+ #log li.react .label { color: #58c4dc; }
75
+ #log li.react.warn .label { color: #fbbf24; }
76
+ #main .rr-player .rr-progress .slow-mark { position: absolute; top: -3px; width: 3px; height: 10px; margin-left: -1px; border-radius: 1px; background: #fbbf24; pointer-events: none; }
74
77
  #main .rr-player .rr-progress .bad-mark { position: absolute; top: -3px; width: 3px; height: 10px; margin-left: -1px; border-radius: 1px; background: #f87171; pointer-events: none; }
75
78
  body.embed #main .rr-player { box-shadow: none; border-radius: 0; }
76
79
  #marks { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 3; }
@@ -106,6 +109,7 @@ const replayPage = ({ player = "..", source } = {}) => `<!doctype html>
106
109
  <div class="filters">
107
110
  <button type="button" data-hides="no-console" aria-pressed="true">Console</button>
108
111
  <button type="button" data-hides="no-network" aria-pressed="true">Network</button>
112
+ <button type="button" data-hides="no-react" aria-pressed="true" hidden title="React's commits: what rendered, how long it took, and why">React</button>
109
113
  <button type="button" data-shows="only-bad" aria-pressed="false" title="Errors, and requests that failed">Problems</button>
110
114
  </div>
111
115
  <ol></ol>
@@ -144,6 +148,27 @@ const replayPage = ({ player = "..", source } = {}) => `<!doctype html>
144
148
  const origin = (() => { try { return new URL(kept.page).origin; } catch { return ''; } })();
145
149
  const fields = (title, held) => (held && Object.keys(held).length > 0 ? [title, ...Object.entries(held).map(([k, v]) => ' ' + k + ': ' + v)] : []);
146
150
  const rows = [];
151
+ // React's commits, where the recording had them on: a row an entry, slow ones (past a frame) marked.
152
+ const ms = (n) => (n === undefined ? '' : (n < 10 ? n.toFixed(1) : Math.round(n)) + ' ms');
153
+ for (const e of events) {
154
+ if (e.type !== 5 || bare || e.data.tag !== ${JSON.stringify(REACT)}) continue;
155
+ const at = e.timestamp - t0;
156
+ const c = e.data.payload;
157
+ if (c.on !== undefined) {
158
+ rows.push({ at, kind: 'react', label: 'React', text: c.on ? 'commits recorded from here' : 'commits no longer recorded', more: [] });
159
+ continue;
160
+ }
161
+ const named = (c.components ?? []).map((r) => r.name + (r.count > 1 ? ' ×' + r.count : '') + ' (' + r.why + ')');
162
+ const text = (named.length > 0 ? named.slice(0, 3).join(', ') : (c.more ?? 0) + ' components') + (named.length > 3 || (c.more && named.length > 0) ? ', …' : '');
163
+ const more = [
164
+ [c.commits > 1 ? c.commits + ' commits' + (c.over === undefined ? '' : ' over ' + (c.over / 1000).toFixed(1) + ' s') : '1 commit', c.priority, ms(c.ms), c.slowest === undefined ? '' : 'slowest ' + ms(c.slowest)].filter(Boolean).join(' · '),
165
+ ...(c.components ?? []).map((r) => [r.name + (r.count > 1 ? ' ×' + r.count : ''), r.at, ms(r.ms), r.selfMs === undefined ? '' : ms(r.selfMs) + ' own', r.why].filter(Boolean).join(' · ')),
166
+ ...(c.more ? ['and ' + c.more + ' more'] : []),
167
+ ];
168
+ // One slow commit is what makes a page stutter, not many quick ones.
169
+ const slow = (c.slowest ?? c.ms) > 16;
170
+ rows.push({ at, kind: 'react', label: c.ms === undefined ? 'React' : ms(c.ms), warn: slow, slow, text: (c.over === undefined ? '' : c.commits + ' commits: ') + text, more });
171
+ }
147
172
  for (const e of events) {
148
173
  if (e.type !== 6 || bare) continue;
149
174
  const at = e.timestamp - t0;
@@ -169,8 +194,10 @@ const replayPage = ({ player = "..", source } = {}) => `<!doctype html>
169
194
  }
170
195
  }
171
196
  }
197
+ rows.sort((a, b) => a.at - b.at);
172
198
  const logged = rows.length > 0;
173
199
  const log = document.getElementById('log');
200
+ if (rows.some((r) => r.kind === 'react')) log.querySelector('[data-hides="no-react"]').hidden = false;
174
201
  if (logged) document.body.classList.add('logged');
175
202
  // The panel's room, where the window is wide enough to show it (as the stylesheet has it).
176
203
  const side = () => (logged && innerWidth >= 900 ? 340 : 0);
@@ -231,6 +258,7 @@ const replayPage = ({ player = "..", source } = {}) => `<!doctype html>
231
258
  row.el.append(go, more);
232
259
  list.append(row.el);
233
260
  // An error, or a request that failed, is a mark on the timeline too.
261
+ if (row.slow && bar) bar.append(Object.assign(cell('i', 'slow-mark', ''), { title: row.label + ': ' + row.text.slice(0, 200), style: 'left:' + (total > 0 ? (row.at / total) * 100 : 0) + '%' }));
234
262
  if (row.bad && bar) bar.append(Object.assign(cell('i', 'bad-mark', ''), { title: row.text.slice(0, 200), style: 'left:' + (total > 0 ? (row.at / total) * 100 : 0) + '%' }));
235
263
  }
236
264
  for (const button of log.querySelectorAll('.filters button')) {