deictic 0.1.0 → 0.3.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 (166) hide show
  1. package/API.md +303 -0
  2. package/README.md +56 -104
  3. package/dist/annotations/index.d.ts +1 -1
  4. package/dist/astro.d.ts +1 -1
  5. package/dist/bun.d.ts +1 -1
  6. package/dist/bun.js +2 -2
  7. package/dist/client/index.d.ts +4 -2
  8. package/dist/client/index.d.ts.map +1 -1
  9. package/dist/client/index.js +130 -16
  10. package/dist/client/index.js.map +1 -1
  11. package/dist/index.d.ts +21 -218
  12. package/dist/index.js.map +1 -1
  13. package/dist/loader.js +1 -1
  14. package/dist/logs/client.d.ts +4 -0
  15. package/dist/logs/client.d.ts.map +1 -0
  16. package/dist/logs/client.js +16 -0
  17. package/dist/logs/client.js.map +1 -0
  18. package/dist/logs/index.d.ts +18 -0
  19. package/dist/logs/index.d.ts.map +1 -0
  20. package/dist/logs/index.js +21 -0
  21. package/dist/logs/index.js.map +1 -0
  22. package/dist/network/client.d.ts +4 -0
  23. package/dist/network/client.d.ts.map +1 -0
  24. package/dist/network/client.js +29 -0
  25. package/dist/network/client.js.map +1 -0
  26. package/dist/network/index.d.ts +2 -0
  27. package/dist/network/index.js +39 -0
  28. package/dist/network/index.js.map +1 -0
  29. package/dist/next.d.ts +1 -1
  30. package/dist/next.js +2 -2
  31. package/dist/recommended/index.d.ts +15 -5
  32. package/dist/recommended/index.d.ts.map +1 -1
  33. package/dist/recommended/index.js +10 -3
  34. package/dist/recommended/index.js.map +1 -1
  35. package/dist/recordings/client.d.ts +1 -1
  36. package/dist/recordings/client.d.ts.map +1 -1
  37. package/dist/recordings/client.js +177 -48
  38. package/dist/recordings/client.js.map +1 -1
  39. package/dist/recordings/index.d.ts +2 -2
  40. package/dist/recordings/index.js +3 -3
  41. package/dist/screenshots/client.d.ts +7 -1
  42. package/dist/screenshots/client.d.ts.map +1 -1
  43. package/dist/screenshots/client.js +36 -4
  44. package/dist/screenshots/client.js.map +1 -1
  45. package/dist/screenshots/dom.d.ts +1 -1
  46. package/dist/screenshots/dom.d.ts.map +1 -1
  47. package/dist/screenshots/dom.js +1 -28
  48. package/dist/screenshots/dom.js.map +1 -1
  49. package/dist/screenshots/index.d.ts +1 -1
  50. package/dist/screenshots/index.js +2 -2
  51. package/dist/screenshots/index.js.map +1 -1
  52. package/dist/screenshots/rrweb.d.ts +2 -2
  53. package/dist/screenshots/rrweb.js +5 -1
  54. package/dist/screenshots/rrweb.js.map +1 -1
  55. package/dist/{endpoints.js → shared/endpoints.js} +1 -1
  56. package/dist/shared/endpoints.js.map +1 -0
  57. package/dist/shared/index.d.ts +238 -0
  58. package/dist/shared/index.d.ts.map +1 -0
  59. package/dist/{index3.d.ts → shared/index2.d.ts} +3 -1
  60. package/dist/shared/index2.d.ts.map +1 -0
  61. package/dist/shared/index3.d.ts +112 -0
  62. package/dist/shared/index3.d.ts.map +1 -0
  63. package/dist/shared/index4.d.ts +64 -0
  64. package/dist/shared/index4.d.ts.map +1 -0
  65. package/dist/shared/index5.d.ts +220 -0
  66. package/dist/shared/index5.d.ts.map +1 -0
  67. package/dist/{index5.d.ts → shared/index6.d.ts} +2 -2
  68. package/dist/shared/index6.d.ts.map +1 -0
  69. package/dist/{integration.d.ts → shared/integration.d.ts} +4 -3
  70. package/dist/shared/integration.d.ts.map +1 -0
  71. package/dist/{integration.js → shared/integration.js} +5 -3
  72. package/dist/shared/integration.js.map +1 -0
  73. package/dist/{kept.js → shared/kept.js} +2 -2
  74. package/dist/shared/kept.js.map +1 -0
  75. package/dist/{marks.js → shared/marks.js} +6 -1
  76. package/dist/shared/marks.js.map +1 -0
  77. package/dist/shared/mask.js +107 -0
  78. package/dist/shared/mask.js.map +1 -0
  79. package/dist/{playwright.js → shared/playwright.js} +19 -4
  80. package/dist/shared/playwright.js.map +1 -0
  81. package/dist/shared/recordings.js +437 -0
  82. package/dist/shared/recordings.js.map +1 -0
  83. package/dist/shared/shortcut.js.map +1 -0
  84. package/dist/shared/tasks.js +632 -0
  85. package/dist/shared/tasks.js.map +1 -0
  86. package/dist/shared/waveform.js.map +1 -0
  87. package/dist/tailwind/client.d.ts +1 -1
  88. package/dist/tailwind/index.d.ts +1 -1
  89. package/dist/tasks/client.d.ts +1 -1
  90. package/dist/tasks/client.d.ts.map +1 -1
  91. package/dist/tasks/client.js +272 -57
  92. package/dist/tasks/client.js.map +1 -1
  93. package/dist/tasks/index.d.ts +2 -159
  94. package/dist/tasks/index.js +1 -348
  95. package/dist/vite.d.ts +11 -12
  96. package/dist/vite.d.ts.map +1 -1
  97. package/dist/vite.js +21 -4
  98. package/dist/vite.js.map +1 -1
  99. package/dist/voice/client.d.ts.map +1 -1
  100. package/dist/voice/client.js +36 -15
  101. package/dist/voice/client.js.map +1 -1
  102. package/dist/voice/index.d.ts +6 -1
  103. package/dist/voice/index.d.ts.map +1 -1
  104. package/dist/voice/index.js +13 -3
  105. package/dist/voice/index.js.map +1 -1
  106. package/dist/webpack.d.ts +1 -1
  107. package/dist/webpack.js +2 -2
  108. package/package.json +41 -2
  109. package/skills/deictic/SKILL.md +20 -14
  110. package/skills/deictic/references/install.md +32 -10
  111. package/skills/deictic/references/recordings.md +29 -0
  112. package/skills/deictic/references/tasks.md +49 -21
  113. package/skills/deictic/references/watch.md +38 -11
  114. package/skills/deictic/scripts/lib.mjs +88 -4
  115. package/skills/deictic/scripts/recording.mjs +84 -4
  116. package/skills/deictic/scripts/task.mjs +36 -7
  117. package/skills/deictic/scripts/vb.mjs +12 -0
  118. package/skills/deictic/scripts/watch.mjs +74 -10
  119. package/src/client/away.ts +105 -0
  120. package/src/client/index.ts +60 -16
  121. package/src/client/style.ts +1 -0
  122. package/src/index.ts +21 -2
  123. package/src/plugins/logs/client.ts +18 -0
  124. package/src/plugins/logs/index.ts +55 -0
  125. package/src/plugins/network/client.ts +30 -0
  126. package/src/plugins/network/index.ts +69 -0
  127. package/src/plugins/network/mask.ts +133 -0
  128. package/src/plugins/recommended/index.ts +14 -1
  129. package/src/plugins/recordings/client.ts +220 -40
  130. package/src/plugins/recordings/index.ts +111 -25
  131. package/src/plugins/recordings/marks.ts +6 -0
  132. package/src/plugins/recordings/replay.ts +159 -10
  133. package/src/plugins/screenshots/client.ts +38 -2
  134. package/src/plugins/screenshots/dom.ts +1 -32
  135. package/src/plugins/screenshots/index.ts +2 -0
  136. package/src/plugins/screenshots/playwright.ts +15 -4
  137. package/src/plugins/screenshots/rrweb.ts +2 -1
  138. package/src/plugins/tasks/client.ts +273 -41
  139. package/src/plugins/tasks/index.ts +207 -47
  140. package/src/plugins/tasks/local.ts +170 -0
  141. package/src/plugins/tasks/watchers.ts +36 -0
  142. package/src/plugins/voice/client.ts +33 -10
  143. package/src/plugins/voice/index.ts +21 -4
  144. package/src/tools/integration.ts +5 -3
  145. package/src/tools/kept.ts +2 -2
  146. package/src/vite.ts +23 -4
  147. package/dist/endpoints.js.map +0 -1
  148. package/dist/index.d.ts.map +0 -1
  149. package/dist/index2.d.ts +0 -23
  150. package/dist/index3.d.ts.map +0 -1
  151. package/dist/index4.d.ts +0 -74
  152. package/dist/index4.d.ts.map +0 -1
  153. package/dist/index5.d.ts.map +0 -1
  154. package/dist/integration.d.ts.map +0 -1
  155. package/dist/integration.js.map +0 -1
  156. package/dist/kept.js.map +0 -1
  157. package/dist/marks.js.map +0 -1
  158. package/dist/playwright.js.map +0 -1
  159. package/dist/recordings.js +0 -235
  160. package/dist/recordings.js.map +0 -1
  161. package/dist/shortcut.js.map +0 -1
  162. package/dist/tasks/index.d.ts.map +0 -1
  163. package/dist/tasks/index.js.map +0 -1
  164. package/dist/waveform.js.map +0 -1
  165. /package/dist/{shortcut.js → shared/shortcut.js} +0 -0
  166. /package/dist/{waveform.js → shared/waveform.js} +0 -0
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * The voice plugin's page half: `start()` asks for the mic (the browser asks the user the first time) and
3
- * records it with `MediaRecorder`. `stop` sends the take to the `add` route and lets the mic go, so the
4
- * browser's recording light goes out between takes.
3
+ * records it with `MediaRecorder`, sending what's spoken each second: the take's start to the `add` route,
4
+ * the rest to `more/<id>`. So a take the page leaves in the middle of (a recording that goes on to another
5
+ * page) is kept up to there. `stop` sends the last of it and lets the mic go, so the browser's recording
6
+ * light goes out between takes.
5
7
  */
6
8
  import { defineClientPlugin } from '#src/index.ts';
7
9
 
@@ -9,6 +11,8 @@ import type { Clip, Voice } from './index.ts';
9
11
 
10
12
  /** What the browser can record, best first: Opus in WebM where it can (Chrome, Firefox), else MP4 (Safari). */
11
13
  const TYPES = ['audio/webm;codecs=opus', 'audio/webm', 'audio/ogg;codecs=opus', 'audio/mp4'];
14
+ /** How often what's spoken is sent, in milliseconds: what a page load can lose of a take. */
15
+ const EVERY = 1000;
12
16
 
13
17
  export default defineClientPlugin<never, never, Voice>({
14
18
  name: 'voice',
@@ -21,10 +25,30 @@ export default defineClientPlugin<never, never, Voice>({
21
25
  });
22
26
  const mimeType = TYPES.find((t) => MediaRecorder.isTypeSupported(t));
23
27
  const recorder = new MediaRecorder(stream, mimeType === undefined ? {} : { mimeType });
24
- const chunks: Blob[] = [];
25
- recorder.addEventListener('dataavailable', (e) => chunks.push(e.data));
28
+ const typeOf = () => (recorder.mimeType || mimeType || 'audio/webm').split(';')[0]!;
29
+ // The clip, once its start is kept, and where it is, where what keeps it says (a `standalone` build's does).
30
+ let id: string | undefined;
31
+ let url: string | undefined;
32
+ // One request at a time, in the order spoken: the audio is its pieces end to end. The first problem ends the sending.
33
+ let sent: Promise<void> = Promise.resolve();
34
+ const send = (body: Blob | undefined, last = false) => {
35
+ sent = sent.then(async () => {
36
+ if (id === undefined && body === undefined) throw new Error('voice: the clip is empty: speak for a moment longer');
37
+ const route = id === undefined ? 'add' : `more/${id}${last ? '?last' : ''}`;
38
+ const res = await request(route, { method: 'POST', headers: { 'content-type': typeOf() }, ...(body ? { body } : {}) });
39
+ const answer = (await res.json()) as { id?: string; url?: string; problem?: string };
40
+ if (answer.id === undefined) throw new Error(`voice: ${answer.problem ?? res.statusText}`);
41
+ id = answer.id;
42
+ url = answer.url ?? url;
43
+ });
44
+ return sent;
45
+ };
46
+ recorder.addEventListener('dataavailable', (e) => {
47
+ // Heard only at `stop`, with the rest: a problem here is that one's.
48
+ if (e.data.size > 0) send(new Blob([e.data], { type: typeOf() })).catch(() => {});
49
+ });
26
50
  const started = Date.now();
27
- recorder.start();
51
+ recorder.start(EVERY);
28
52
  const release = () => {
29
53
  for (const track of stream.getTracks()) track.stop();
30
54
  };
@@ -38,6 +62,7 @@ export default defineClientPlugin<never, never, Voice>({
38
62
  return {
39
63
  started,
40
64
  stream,
65
+ soFar: () => (id === undefined ? undefined : { id, duration: Date.now() - started }),
41
66
  cancel: () => {
42
67
  void ended().then(release);
43
68
  },
@@ -45,11 +70,9 @@ export default defineClientPlugin<never, never, Voice>({
45
70
  await ended();
46
71
  release();
47
72
  const duration = Date.now() - started;
48
- const type = (recorder.mimeType || mimeType || 'audio/webm').split(';')[0]!;
49
- const res = await request('add', { method: 'POST', headers: { 'content-type': type }, body: new Blob(chunks, { type }) });
50
- const { id, problem } = (await res.json()) as { id?: string; problem?: string };
51
- if (id === undefined) throw new Error(`voice: ${problem ?? res.statusText}`);
52
- return { id, url: `${base}__deictic/plugins/voice/clip/${id}`, duration, type };
73
+ // The last piece came as it stopped. This says it's over, to what names the clip's place only then.
74
+ await send(undefined, true);
75
+ return { id: id!, url: url ?? `${base}__deictic/plugins/voice/clip/${id}`, duration, type: typeOf() };
53
76
  },
54
77
  };
55
78
  },
@@ -1,10 +1,11 @@
1
1
  /**
2
2
  * `deictic/voice`: records the mic, for other plugins to attach (tasks does) or play along with
3
3
  * something (a recording does). No tab of its own. The page half asks for the mic the first time, records
4
- * with `MediaRecorder` and sends each take to the `add` route; the server half keeps the latest `keep`
4
+ * with `MediaRecorder` and sends each take as it's spoken, its start to the `add` route and the rest to
5
+ * `more/<id>`, so one a page load cuts short is kept up to there; the server half keeps the latest `keep`
5
6
  * clips under `.deictic/voice` and serves them at `clip/<id>`.
6
7
  */
7
- import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
8
+ import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
8
9
  import { join, resolve } from 'node:path';
9
10
 
10
11
  import { definePlugin } from '#src/index.ts';
@@ -18,12 +19,17 @@ export interface Clip {
18
19
  type: string;
19
20
  }
20
21
 
21
- /** A take going on: `stop` ends it and keeps it, `cancel` ends it and keeps nothing. */
22
+ /** A take going on: `stop` ends it and answers its clip, `cancel` ends it with none (what was sent of it goes as the oldest clips do). */
22
23
  export interface Take {
23
24
  /** When it started, as `Date.now()`. */
24
25
  started: number;
25
26
  /** The mic, while it's recorded: to show it's heard (`liveWaveform` from `deictic/client`). */
26
27
  stream: MediaStream;
28
+ /**
29
+ * What's kept of it by now, as the clip it would be if it ended here, or nothing before its first second is:
30
+ * for a page that's going, with no time left to `stop` it.
31
+ */
32
+ soFar(): Pick<Clip, 'id' | 'duration'> | undefined;
27
33
  stop(): Promise<Clip>;
28
34
  cancel(): void;
29
35
  }
@@ -91,7 +97,7 @@ export function voice(options: VoiceOptions = {}) {
91
97
  return { read };
92
98
  },
93
99
  routes: {
94
- // A take the page recorded, as the audio type its `MediaRecorder` made.
100
+ // A take the page is recording, as the audio type its `MediaRecorder` makes: its start, the rest to `more`.
95
101
  add: async (req) => {
96
102
  const type = (req.headers.get('content-type') ?? '').split(';')[0]!.trim();
97
103
  const ext = Object.keys(TYPES).find((e) => TYPES[e] === type);
@@ -101,6 +107,17 @@ export function voice(options: VoiceOptions = {}) {
101
107
  if (body.byteLength > MAX) return Response.json({ problem: `a clip may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });
102
108
  return Response.json({ id: keepClip(body, ext) });
103
109
  },
110
+ // `more/<id>`: the take goes on, and this is the next of its audio. With `?last`, and maybe nothing, it's over.
111
+ more: async (req) => {
112
+ const id = new URL(req.url).pathname.split('/').at(-1) ?? '';
113
+ const file = fileOf(id);
114
+ if (file === undefined) return Response.json({ problem: `clip ${id} isn't kept any more: record it again` }, { status: 404 });
115
+ const body = new Uint8Array(await req.arrayBuffer());
116
+ if (statSync(join(dir, file)).size + body.byteLength > MAX)
117
+ return Response.json({ problem: `a clip may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });
118
+ appendFileSync(join(dir, file), body);
119
+ return Response.json({ id });
120
+ },
104
121
  // `clip/<id>`: the audio, to play back.
105
122
  clip: (req) => {
106
123
  const found = read(new URL(req.url).pathname.split('/').at(-1) ?? '');
@@ -36,9 +36,10 @@ export function prepare(options: DeicticOptions): { plugins: ServerPlugin[]; sho
36
36
 
37
37
  /**
38
38
  * The client module: the overlay, started with deictic's own shortcut and each plugin that has a half
39
- * in the page, with its shortcut, checked.
39
+ * in the page, with its shortcut, checked; and with `server`, a module of the page's that answers its requests
40
+ * where no dev server does.
40
41
  */
41
- export const clientModule = (plugins: ServerPlugin[], base: string, own?: Shortcut | false) => {
42
+ export const clientModule = (plugins: ServerPlugin[], base: string, own?: Shortcut | false, server?: string) => {
42
43
  const [shortcut, ...shortcuts] = checkShortcuts([{ name: OWN, shortcut: ownShortcut(own) }, ...plugins]);
43
44
  const paged = plugins.flatMap((p, i) =>
44
45
  p.client === undefined ? [] : [{ client: p.client, rest: { shortcut: shortcuts[i], options: p.clientOptions } }],
@@ -46,8 +47,9 @@ export const clientModule = (plugins: ServerPlugin[], base: string, own?: Shortc
46
47
  return [
47
48
  `import { start } from 'deictic/client';`,
48
49
  ...paged.map((p, i) => `import p${i} from ${JSON.stringify(p.client)};`),
50
+ ...(server === undefined ? [] : [`import server from ${JSON.stringify(server)};`]),
49
51
  // Its shortcut and options as JSON, where it has them: `JSON.stringify` leaves out what's undefined.
50
- `start({ base: ${JSON.stringify(base)}, shortcut: ${JSON.stringify(shortcut) ?? 'undefined'}, plugins: [${paged.map((p, i) => `{ plugin: p${i}, ...${JSON.stringify(p.rest)} }`).join(', ')}] });`,
52
+ `start({ base: ${JSON.stringify(base)}, shortcut: ${JSON.stringify(shortcut) ?? 'undefined'}, plugins: [${paged.map((p, i) => `{ plugin: p${i}, ...${JSON.stringify(p.rest)} }`).join(', ')}]${server === undefined ? '' : ', server'} });`,
51
53
  ].join('\n');
52
54
  };
53
55
 
package/src/tools/kept.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Where deictic keeps what it makes for a project: `.deictic/` at its root, beside `.board/` and the like,
3
- * rather than in `node_modules`, which an install may clear. The history is there, and the shots,
4
- * recordings and voice clips plugins keep. It ignores itself in git: the history holds whole files, and
3
+ * rather than in `node_modules`, which an install may clear. The history is there, the shots,
4
+ * recordings and voice clips plugins keep, and the tasks plugin's own board. It ignores itself in git: the history holds whole files, and
5
5
  * the rest is the page as it looked, neither of which belongs in a commit.
6
6
  */
7
7
  import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
package/src/vite.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `deictic/vite`: deictic in Vite's dev server. Nothing runs in a build.
2
+ * `deictic/vite`: deictic in Vite's dev server. Nothing runs in a build, unless `standalone` asks for it.
3
3
  *
4
4
  * Its transform runs `pre`, so each JSX module's host elements are marked with their place in the
5
5
  * source as written (`tools/locate.ts`). In the browser each marked module also imports the client
@@ -8,6 +8,8 @@
8
8
  * Vite's server, and a place opens through Vite's own `/__open-in-editor`, so the editor is whichever
9
9
  * Vite already launches. A write reaches the page through Vite's usual update for the file.
10
10
  */
11
+ import { resolve } from 'node:path';
12
+
11
13
  import type { Plugin } from 'vite';
12
14
 
13
15
  import { endpoints, nodeMiddleware, redirect } from './tools/endpoints.ts';
@@ -15,23 +17,35 @@ import { clientModule, type DeicticOptions, mark, markAstro, prepare } from './t
15
17
 
16
18
  export { clientModule, type DeicticOptions };
17
19
 
20
+ export interface ViteOptions extends DeicticOptions {
21
+ /**
22
+ * deictic in a build too, for a page that shows it with no dev server behind it (a deployed demo): a module of
23
+ * the page's, from the root, whose default export answers the overlay's requests there (a `Standalone`, from
24
+ * `deictic`). The build's elements are marked and the overlay is in its bundle. The dev server answers as ever.
25
+ * Without it, the default, nothing of deictic is in a build.
26
+ */
27
+ standalone?: string;
28
+ }
29
+
18
30
  /** The client module's ID, which a page can import itself where nothing it bundles is JSX (Astro's pages). */
19
31
  export const CLIENT = 'virtual:deictic/client';
20
32
  const CLIENT_ID = '\0deictic/client';
21
33
 
22
- export function deictic(options: DeicticOptions = {}): Plugin {
34
+ export function deictic(options: ViteOptions = {}): Plugin {
23
35
  const { plugins, shortcut } = prepare(options);
24
36
  let root = '';
25
37
  let base = '/';
38
+ let building = false;
26
39
  return {
27
40
  name: 'deictic',
28
41
  enforce: 'pre',
29
- apply: 'serve',
42
+ apply: (_, { command }) => command === 'serve' || options.standalone !== undefined,
30
43
  // The client is the app's to bundle as it changes, not a dependency to prebundle once.
31
44
  config: () => ({ optimizeDeps: { exclude: ['deictic'] } }),
32
45
  configResolved(config) {
33
46
  root = config.root;
34
47
  base = config.base;
48
+ building = config.command === 'build';
35
49
  },
36
50
  configureServer(server) {
37
51
  const handle = endpoints({
@@ -43,7 +57,12 @@ export function deictic(options: DeicticOptions = {}): Plugin {
43
57
  server.middlewares.use(nodeMiddleware(handle));
44
58
  },
45
59
  resolveId: (id) => (id === CLIENT ? CLIENT_ID : undefined),
46
- load: (id) => (id === CLIENT_ID ? clientModule(plugins, base, shortcut) : undefined),
60
+ load(id) {
61
+ if (id !== CLIENT_ID) return undefined;
62
+ // Only a build's page asks the module: the dev server is there to answer.
63
+ const server = building && options.standalone !== undefined ? resolve(root, options.standalone).replaceAll('\\', '/') : undefined;
64
+ return clientModule(plugins, base, shortcut, server);
65
+ },
47
66
  transform: {
48
67
  // First of all, not only first of the `pre` plugins: the React Compiler (`react({ compiler: true })`) is
49
68
  // `pre` too and compiles the JSX away, so after it there'd be no element to mark, wherever deictic is listed.
@@ -1 +0,0 @@
1
- {"version":3,"file":"endpoints.js","names":[],"sources":["../src/tools/source.ts","../src/tools/history.ts","../src/tools/endpoints.ts"],"sourcesContent":["/**\n * The source a server half reads: a target's file, parsed, and the opening tag the page's attribute\n * points at. Files are only ever read and written under the project's root, outside `node_modules`.\n */\nimport { readFileSync } from 'node:fs';\nimport { isAbsolute, relative, resolve, sep } from 'node:path';\n\nimport { Refusal, type Source, type Target, type TextEdit } from '#src/index.ts';\n\nimport { ASTRO, parseAstro, type Parsed } from './astro.ts';\nimport { isHost, lineStarts, offsetOf, openingsIn, parse } from './locate.ts';\n\n/** A file from the project's root, as an absolute path; refused anywhere the page has no business writing. */\nexport function resolveFile(root: string, file: string): string {\n const path = resolve(root, file);\n const from = relative(root, path);\n // `relative` gives an absolute path for another drive.\n if (from === '' || from.startsWith('..') || isAbsolute(from) || from.split(sep).includes('node_modules'))\n throw new Refusal(`${file} is not a file of this project's own`);\n return path;\n}\n\nexport function readSource(root: string, file: string): string {\n try {\n return readFileSync(resolveFile(root, file), 'utf8');\n } catch (e) {\n if (e instanceof Refusal) throw e;\n throw new Refusal(`can't read ${file}: has it moved since the page loaded?`, { cause: e });\n }\n}\n\n/** The target's file and element, as they are on disk now. */\nexport function sourceAt(root: string, target: Target): Source {\n const { file, line, column } = target.loc;\n const code = readSource(root, file);\n const offset = offsetOf(lineStarts(code), line, column);\n const { program, elements } = ASTRO.test(file) ? astro(root, file, code) : jsx(file, code);\n const element = elements.find((el) => el.start === offset && isHost(el));\n if (element === undefined || (element.name.type === 'JSXIdentifier' && element.name.name !== target.tag))\n throw new Refusal(`no <${target.tag}> at ${file}:${line}:${column} any more: the file changed since the page loaded, so reload it`);\n return { file, code, program, element, read: (other) => readSource(root, other) };\n}\n\nfunction jsx(file: string, code: string): Parsed {\n const { program, errors } = parse(file, code);\n if (errors.length > 0) throw new Refusal(`${file} doesn't parse: fix it first (${errors[0]!.message})`);\n return { program, elements: openingsIn(program) };\n}\n\nfunction astro(root: string, file: string, code: string): Parsed {\n const parsed = parseAstro(root, code);\n if ('problem' in parsed) throw new Refusal(`${file} can't be read: ${parsed.problem}`);\n return parsed;\n}\n\n/** Each file's text after its edits, which must not overlap. */\nexport function applyEdits(source: Source, edits: TextEdit[]): Map<string, string> {\n const byFile = Map.groupBy(edits, (e) => e.file ?? source.file);\n const out = new Map<string, string>();\n for (const [file, list] of byFile) {\n const sorted = list.toSorted((a, b) => b.start - a.start);\n let code = file === source.file ? source.code : source.read(file);\n let floor = Infinity;\n for (const edit of sorted) {\n if (edit.end > floor) throw new Error(`deictic: edits to ${file} overlap at ${edit.end}`);\n code = code.slice(0, edit.start) + edit.text + code.slice(edit.end);\n floor = edit.start;\n }\n out.set(file, code);\n }\n return out;\n}\n","/**\n * Every change deictic made, to undo and redo. A change to files holds each file's whole text\n * before and after: source files are small, and the texts make undo exact without a diff to go stale.\n * A change a plugin made itself (`Done`) holds the plugin's name and its record, and undoing it is the\n * plugin's `undo`.\n *\n * Each change has a scope, the plugin and the element it was made on, and the popup undoes and redoes\n * within its own: the latest change of this tab on this element, not the latest of all. So a change\n * is taken back out of order, with later ones to the same file still in it. Then only the lines the\n * change wrote go back to what they were, where they're still in the file as it wrote them, once.\n *\n * Anything else is refused, not merged: a file whose lines were edited since has the editor's own undo\n * for it; and a redo likewise. A plugin's undo refuses on its own terms. Kept under `.deictic`, so it\n * outlives a restart of the dev server and stays out of git.\n */\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { dirname } from 'node:path';\n\nimport { Refusal, type ServerPlugin } from '#src/index.ts';\n\nimport { keptIn } from './kept.ts';\nimport { resolveFile } from './source.ts';\n\nexport interface FileChange {\n file: string;\n /** The text before, or nothing for a file the change made. */\n before: string | null;\n after: string;\n}\n\n/** Whose a change is: the plugin whose tab made it, and the element it was open on, as `file:line:column`. */\nexport interface Scope {\n plugin: string;\n target: string;\n}\n\ninterface Base {\n id: number;\n at: string;\n label: string;\n /** None on a change made without one, which only an undo of the whole history reaches. */\n scope?: Scope;\n}\n\nexport type Change = Base & ({ files: FileChange[] } | { plugin: string; record: unknown });\n\n/** A change as the page lists it. `files` is empty for one a plugin made itself. */\nexport interface Summary {\n id: number;\n at: string;\n label: string;\n files: string[];\n}\n\nexport interface HistoryOptions {\n /** Whose `undo` and `redo` take back the changes they made themselves. */\n plugins?: ServerPlugin[];\n store?: string;\n}\n\nconst LIMIT = 200;\n\n/** Whether a change is in a scope: any is in none. */\nconst within = (scope: Scope | undefined) => (c: Change) =>\n scope === undefined || (c.scope?.plugin === scope.plugin && c.scope.target === scope.target);\n\nconst summary = (c: Change): Summary => ({ id: c.id, at: c.at, label: c.label, files: 'files' in c ? c.files.map((f) => f.file) : [] });\n\nexport class History {\n #done: Change[] = [];\n #undone: Change[] = [];\n readonly #root: string;\n readonly #store: string;\n readonly #plugins: Map<string, ServerPlugin>;\n\n constructor(root: string, { plugins = [], store = keptIn(root, 'history.json') }: HistoryOptions = {}) {\n this.#root = root;\n this.#store = store;\n this.#plugins = new Map(plugins.map((p) => [p.name, p]));\n if (!existsSync(store)) return;\n try {\n ({ done: this.#done, undone: this.#undone } = JSON.parse(readFileSync(store, 'utf8')) as { done: Change[]; undone: Change[] });\n } catch {\n // A history that doesn't read is one we start over, not one to stop the dev server for.\n }\n }\n\n /** Writes each file's new text and records it as one change. A redo after it, in its scope, is gone, as in any editor. */\n commit(label: string, texts: Map<string, string>, scope?: Scope): Summary {\n const files: FileChange[] = [];\n for (const [file, after] of texts) {\n const path = resolveFile(this.#root, file);\n const before = existsSync(path) ? readFileSync(path, 'utf8') : null;\n if (before !== after) files.push({ file, before, after });\n }\n if (files.length === 0) throw new Refusal('nothing to change: the source already says that');\n for (const f of files) write(resolveFile(this.#root, f.file), f.after);\n return this.#push({ label, files }, scope);\n }\n\n /** Records a change `plugin` made itself, with what its `undo` needs. */\n record(label: string, plugin: string, record: unknown, scope?: Scope): Summary {\n return this.#push({ label, plugin, record }, scope);\n }\n\n /** Takes back the latest change, of a scope where one is given. */\n async undo(scope?: Scope): Promise<Summary> {\n const change = this.#done.findLast(within(scope));\n if (change === undefined) throw new Refusal(scope === undefined ? 'nothing to undo' : 'nothing to undo here');\n if ('files' in change) this.#put(change, 'after', 'before');\n else change.record = (await this.#pluginOf(change, 'undo').undo!(change.record)) ?? change.record;\n this.#done = this.#done.filter((c) => c !== change);\n this.#undone.push(change);\n this.#save();\n return summary(change);\n }\n\n /** Makes the change last undone again, of a scope where one is given. */\n async redo(scope?: Scope): Promise<Summary> {\n const change = this.#undone.findLast(within(scope));\n if (change === undefined) throw new Refusal(scope === undefined ? 'nothing to redo' : 'nothing to redo here');\n if ('files' in change) this.#put(change, 'before', 'after');\n else change.record = await this.#pluginOf(change, 'redo').redo!(change.record);\n this.#undone = this.#undone.filter((c) => c !== change);\n this.#done.push(change);\n this.#save();\n return summary(change);\n }\n\n list(scope?: Scope): { done: Summary[]; undone: Summary[] } {\n return { done: this.#done.filter(within(scope)).map(summary), undone: this.#undone.filter(within(scope)).map(summary) };\n }\n\n #push(change: Omit<Base, 'id' | 'at'> & ({ files: FileChange[] } | { plugin: string; record: unknown }), scope?: Scope): Summary {\n const id = Math.max(0, ...[...this.#done, ...this.#undone].map((c) => c.id)) + 1;\n const made = { id, at: new Date().toISOString(), ...change, ...(scope === undefined ? {} : { scope }) };\n this.#done = [...this.#done, made].slice(-LIMIT);\n // What was undone in this scope can't be redone over the new change; another scope's still can.\n this.#undone = this.#undone.filter((c) => !within(scope)(c));\n this.#save();\n return summary(made);\n }\n\n #pluginOf(change: { label: string; plugin: string }, step: 'undo' | 'redo'): ServerPlugin {\n const plugin = this.#plugins.get(change.plugin);\n if (plugin?.[step] === undefined) {\n throw new Refusal(\n `can't ${step} \"${change.label}\": the ${change.plugin} plugin that made it isn't loaded, so add it back to \\`plugins\\``,\n );\n }\n return plugin;\n }\n\n /**\n * Puts each file's `to` text back, once every one of them still reads as its `from`, or still has the\n * lines that differ as `from` has them: then those lines alone change, and the rest stays as it is now.\n */\n #put(change: Base & { files: FileChange[] }, from: 'before' | 'after', to: 'before' | 'after'): void {\n const paths = change.files.map((f) => resolveFile(this.#root, f.file));\n const texts = change.files.map((f, i) => {\n const now = existsSync(paths[i]!) ? readFileSync(paths[i]!, 'utf8') : null;\n if (now === f[from]) return f[to];\n const text = now === null || f[from] === null || f[to] === null ? undefined : swapped(now, f[from], f[to]);\n if (text === undefined) {\n throw new Refusal(\n `${f.file} changed since \"${change.label}\" ${from === 'after' ? 'was made' : 'was undone'}: use the editor's undo there`,\n );\n }\n return text;\n });\n texts.forEach((text, i) => {\n if (text === null) rmSync(paths[i]!);\n else write(paths[i]!, text);\n });\n }\n\n #save(): void {\n write(this.#store, JSON.stringify({ done: this.#done, undone: this.#undone }));\n }\n}\n\n/**\n * `now` with the lines that differ between `from` and `to` put as `to` has them, where `now` has them as\n * `from` does, in one place only. Nothing where it doesn't (they were edited, or there are two of them), or\n * where `from` has no such lines to find (the change only removed some).\n */\nfunction swapped(now: string, from: string, to: string): string | undefined {\n const [a, b, lines] = [from.split('\\n'), to.split('\\n'), now.split('\\n')];\n let head = 0;\n while (head < a.length && head < b.length && a[head] === b[head]) head++;\n let tail = 0;\n while (tail < a.length - head && tail < b.length - head && a.at(-1 - tail) === b.at(-1 - tail)) tail++;\n const theirs = a.slice(head, a.length - tail);\n if (theirs.length === 0) return undefined;\n const found = lines.flatMap((_, i) => (theirs.every((line, j) => lines[i + j] === line) ? [i] : []));\n if (found.length !== 1) return undefined;\n return [...lines.slice(0, found[0]), ...b.slice(head, b.length - tail), ...lines.slice(found[0]! + theirs.length)].join('\\n');\n}\n\nfunction write(path: string, text: string): void {\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, text);\n}\n","/**\n * The dev server's half of deictic, under `/__deictic/`: `read` and `apply` an op through a\n * plugin, `undo`, `redo` and `history`, and `open`, which opens a place in the editor. Written over\n * `Request` and `Response`, so each integration mounts them its own way (Vite as middleware), and\n * served from the page's own origin, so no token travels to the page. `undo`, `redo` and `history` are a\n * plugin's on an element where the request names them (as the popup does: its tab, its element), and\n * the whole history's where it doesn't.\n *\n * Everything but `open` and `history` writes or may, so only the page itself may send it: a POST of\n * JSON from the same origin, which a form or a script on another site can't send without asking first.\n *\n * Each plugin's own `routes` are under `plugins/<name>/`. A `GET` there reaches the plugin as it\n * comes; anything else only from the page's own origin, in whatever type it sends (an image, say).\n * Nothing is answered before every plugin's `setup` has run.\n */\nimport type { IncomingMessage, ServerResponse } from 'node:http';\n\nimport { type Loc, Refusal, type ServerPlugin, type Target } from '#src/index.ts';\n\nimport { History, type Scope } from './history.ts';\nimport { setUp } from './plugins.ts';\nimport { applyEdits, resolveFile, sourceAt } from './source.ts';\n\nexport interface EndpointOptions {\n root: string;\n plugins: ServerPlugin[];\n /** The path the endpoints sit under, ending in `/`: `/` by default. */\n base?: string;\n /** Opens a place in the editor: a redirect to the dev server's own launcher. */\n open: (path: string, loc: Loc) => Response | Promise<Response>;\n history?: History;\n}\n\ninterface Body {\n plugin: string;\n target: Target;\n op?: unknown;\n}\n\nconst scopeOf = (plugin: string, { file, line, column }: Loc): Scope => ({ plugin, target: `${file}:${line}:${column}` });\n/** The scope an undo or a redo names, or none for the whole history. */\nconst scopeIn = ({ plugin, target }: Partial<Body>) =>\n plugin === undefined || target === undefined ? undefined : scopeOf(plugin, target.loc);\n\n/** Answers deictic's requests, and nothing for any other path. */\nexport function endpoints({ root, plugins, base = '/', open, history = new History(root, { plugins }) }: EndpointOptions) {\n const byName = new Map(plugins.map((p) => [p.name, p]));\n const prefix = `${base}__deictic/`;\n // Started now, awaited by every request: a plugin's API is there before anything asks for it.\n const ready = setUp(root, plugins);\n\n const pluginOf = (name: string) => {\n const plugin = byName.get(name);\n if (plugin === undefined) throw new Refusal(`no plugin \"${name}\" on the server: is it in the bundler plugin's \\`plugins\\`?`);\n return plugin;\n };\n\n const routes: Record<string, (body: Body) => Promise<unknown>> = {\n read: async ({ plugin, target }) => ({ model: await readOf(pluginOf(plugin), target) }),\n apply: async ({ plugin: name, target, op }) => {\n const plugin = pluginOf(name);\n if (plugin.apply === undefined) throw new Refusal(`${name} changes nothing from its panel: it has no \\`apply\\``);\n const source = sourceAt(root, target);\n const before = await readOf(plugin, target);\n const { file, line } = target.loc;\n const label = `${name} ${file}:${line}: ${plugin.describe?.(op, before) ?? 'edit'}`;\n const result = await plugin.apply(source, target, op);\n const scope = scopeOf(name, target.loc);\n const change = Array.isArray(result)\n ? history.commit(label, applyEdits(source, result), scope)\n : history.record(label, name, result.done, scope);\n return { model: await readOf(plugin, target), change };\n },\n undo: async (body) => ({ change: await history.undo(scopeIn(body)) }),\n redo: async (body) => ({ change: await history.redo(scopeIn(body)) }),\n };\n // A plugin without `read` has no model, and no need for its element to be where the page says.\n const readOf = (plugin: ServerPlugin, target: Target) => (plugin.read === undefined ? null : plugin.read(sourceAt(root, target), target));\n // One write at a time: a plugin's change may wait on the network, and an undo sent meanwhile must\n // take back that change, not the one before it.\n let queue: Promise<unknown> = Promise.resolve();\n const serially = <T>(run: () => Promise<T>): Promise<T> => {\n const next = queue.then(run, run);\n queue = next.catch(() => {});\n return next;\n };\n\n return async (req: Request): Promise<Response | undefined> => {\n const url = new URL(req.url);\n if (!url.pathname.startsWith(prefix)) return undefined;\n const route = url.pathname.slice(prefix.length);\n const origin = req.headers.get('origin');\n const sameOrigin = origin !== null && new URL(origin).host === url.host;\n try {\n const context = await ready;\n if (route.startsWith('plugins/')) {\n const [name = '', first = ''] = route.slice('plugins/'.length).split('/');\n const handle = byName.get(name)?.routes?.[first];\n if (handle === undefined) return new Response(`no endpoint ${url.pathname}`, { status: 404 });\n if (req.method !== 'GET' && req.method !== 'HEAD' && !sameOrigin)\n return Response.json({ problem: `only the page itself may ${req.method} to ${name}` }, { status: 403 });\n return await handle(req, context);\n }\n const loc = {\n file: url.searchParams.get('file') ?? '',\n line: Number(url.searchParams.get('line')),\n column: Number(url.searchParams.get('column')),\n };\n if (route === 'history') {\n const plugin = url.searchParams.get('plugin');\n return Response.json(history.list(plugin === null ? undefined : scopeOf(plugin, loc)));\n }\n if (route === 'open') return await open(resolveFile(root, loc.file), loc);\n const handler = routes[route];\n if (handler === undefined) return new Response(`no endpoint ${url.pathname}`, { status: 404 });\n if (req.method !== 'POST' || !sameOrigin || req.headers.get('content-type')?.startsWith('application/json') !== true)\n return Response.json({ problem: 'edits come from the page, as JSON' }, { status: 403 });\n const body = (await req.json()) as Body;\n return Response.json(await (route === 'read' ? handler(body) : serially(() => handler(body))));\n } catch (e) {\n if (e instanceof Refusal) return Response.json({ problem: e.message }, { status: 422 });\n return Response.json({ problem: e instanceof Error ? (e.stack ?? e.message) : String(e) }, { status: 500 });\n }\n };\n}\n\n/** A redirect within the page's origin, to a launcher the dev server answers itself. */\nexport const redirect = (path: string) => new Response(null, { status: 307, headers: { Location: path } });\n\n/**\n * The endpoints as Node middleware, for Vite's server. The request's host is the one the page was\n * served from: a proxy's `x-forwarded-host` before its own.\n */\nexport function nodeMiddleware(\n handle: (req: Request) => Promise<Response | undefined>,\n): (req: IncomingMessage, res: ServerResponse, next: () => void) => void {\n return (req, res, next) => {\n // Before reading the body, which a request for anything else leaves to whoever answers it.\n if (req.url?.includes('/__deictic/') !== true) return next();\n const forwarded = req.headers['x-forwarded-host'];\n const host = (Array.isArray(forwarded) ? forwarded[0] : forwarded) ?? req.headers.host ?? 'localhost';\n const headers = new Headers();\n for (const [name, value] of Object.entries(req.headers))\n for (const v of Array.isArray(value) ? value : value === undefined ? [] : [value]) headers.append(name, v);\n\n const chunks: Buffer[] = [];\n req.on('data', (chunk: Buffer) => chunks.push(chunk));\n req.on('end', () => {\n const body = req.method === 'GET' || req.method === 'HEAD' ? undefined : Buffer.concat(chunks);\n handle(new Request(`http://${host}${req.url}`, { method: req.method, headers, body }))\n .then(async (response) => {\n if (response === undefined) return next();\n res.statusCode = response.status;\n response.headers.forEach((value, name) => res.setHeader(name, value));\n res.end(Buffer.from(await response.arrayBuffer()));\n })\n .catch((e: unknown) => {\n res.statusCode = 500;\n res.end(e instanceof Error ? e.message : String(e));\n });\n });\n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,iBAAiB,cAAc;;EAE3D;;EAEA;;;;;EAKA,OAAO,SAAS,gBAAgB;;EAEhC,SAAS,OAAO,aAAa,SAAS,aAAa,OAAO;;cAG/C,qBAAsB,OAAO,IAAI,eAAa,QAAU,aAAa,OAAO,IAAI,SAAO,aAAa,OAAO,IAAI"}
package/dist/index2.d.ts DELETED
@@ -1,23 +0,0 @@
1
- /**
2
- * `deictic`: what a plugin is. Every plugin is optional: deictic itself is the glue (the
3
- * transform that ties elements to source, the dev server's endpoints, the history, shortcuts and the
4
- * overlay's panel), and each plugin adds what it does on top.
5
- *
6
- * A plugin has two halves, each optional that meet over the dev server's endpoints (`tools/endpoints.ts`). The
7
- * server half runs beside the bundler and is the only one that reads source: it turns the element
8
- * under the pointer into a model its panel can show, and an op from that panel into text edits. It
9
- * never writes files; deictic does, so every plugin's changes land in one history and undo the
10
- * same way. A change that isn't to a file (a task added to a board) the plugin makes itself and
11
- * answers with what it did (`Done`): the history keeps that beside the files' changes and hands it
12
- * back to the plugin's own `undo` and `redo`.
13
- * The client half is a module the page loads, named by the server half's `client`, which draws the
14
- * panel and previews an op on the page before it is applied.
15
- *
16
- * A plugin may have no panel at all, only an API for others (screenshots, a recording) and routes of
17
- * its own on the dev server. Each half's `setup` answers its API, and `use(name)` reaches another
18
- * plugin's, on the same side; `needs` names the plugins it can't do without.
19
- *
20
- * Both halves import from here, so the parser is imported for its types only: the browser must not load it.
21
- */
22
- import { C as Shortcut, S as Modifier, _ as Source, a as Done, b as defineClientPlugin, c as LightboxOptions, d as Refusal, f as Resumed, g as ServerPlugin, h as ServerContext, i as ClientPlugin, l as Loc, m as ServerApis, n as ClientApis, o as LightboxAction, p as Route, r as ClientContext, s as LightboxItem, t as ApiOf, u as PanelContext, v as Target, x as definePlugin, y as TextEdit } from "./index.js";
23
- export { ApiOf, ClientApis, ClientContext, ClientPlugin, Done, LightboxAction, LightboxItem, LightboxOptions, Loc, type Modifier, PanelContext, Refusal, Resumed, Route, ServerApis, ServerContext, ServerPlugin, type Shortcut, Source, Target, TextEdit, defineClientPlugin, definePlugin };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index3.d.ts","names":[],"sources":["../src/plugins/screenshots/index.ts"],"mappings":";UAqBiB;EACf;EACA;EACA;EACA;;;UAIe;EACf;EACA;;EAEA,KAAK;;EAEL;IAAQ;IAAe;;;UAGR;;EAEf;;;UAIe;EACf,QAAQ,SAAS,SAAS,UAAU,iBAAiB,QAAQ;;EAE7D,OAAO,KAAK,MAAM,IAAI,KAAK,wBAAwB,QAAQ;;;UAI5C;;EAEf,KAAK;IAAe,MAAM,WAAW;IAAc;IAAc;;;;YAIvD;IACR,aAAa;;YAEL;IACR,aAAa;;;;;;;UAQA;;EAEf;EACA;;EAEA;EACA;;EAEA;;;KAIU,kBAAkB,SAAS,KAAK,8DAA8D;;;;;;UAOzF;EACf;;EAEA;EACA,QAAQ,iBAAiB,QAAQ;;;UAIlB;;EAEf;;EAEA;;;cAIW,WAAU;;;;;cAMV,QAAK,UAAa,mBAAsB;UAMpC,2BAA2B;;EAE1C,WAAW;;EAEX;;EAEA;;iBAOc,YAAY,UAAS,uCAAuB,kCAAA"}
package/dist/index4.d.ts DELETED
@@ -1,74 +0,0 @@
1
- import { a as Masking } from "./index3.js";
2
- /**
3
- * The custom event's tag the marks go in: the page's annotations, as an SVG in page coordinates (`svg`),
4
- * and as the annotations themselves (`annotations`, absent from recordings made before it was added).
5
- */
6
- declare const MARKS = "deictic.annotations";
7
- /** A recording as the page knows it: its ID, where it plays back, and how long it ran, in milliseconds. */
8
- interface Recording {
9
- id: string;
10
- url: string;
11
- duration: number;
12
- /** What the mic took while it was on, where the voice plugin is loaded. */
13
- voice?: VoiceClip[];
14
- }
15
- /** A stretch of the mic in a recording: the voice plugin's clip, and when it starts in the recording, in milliseconds. */
16
- interface VoiceClip {
17
- id: string;
18
- at: number;
19
- duration: number;
20
- }
21
- /** The page's half, for other plugins' page halves. */
22
- interface Recorder {
23
- /**
24
- * Records the page, with the toolbar, until Stop: answers the recording, kept by the dev server, or
25
- * nothing when it's discarded. Rejects while another is going, or when it couldn't be kept.
26
- */
27
- record(): Promise<Recording | undefined>;
28
- /** Whether one is going. */
29
- recording(): boolean;
30
- }
31
- /** The server's half, for other plugins' server halves. */
32
- interface Recordings {
33
- /** A recording's JSON, or nothing for one not kept (any more). */
34
- read(id: string): {
35
- data: Uint8Array<ArrayBuffer>;
36
- name: string;
37
- type: 'application/json';
38
- } | undefined;
39
- }
40
- /** What the page sends, and what's kept: rrweb's events and what they can't say. */
41
- interface Kept {
42
- page: string;
43
- viewport: {
44
- width: number;
45
- height: number;
46
- };
47
- /**
48
- * The colour scheme the page was in, which rrweb doesn't record: the replay shows it in the same, or a
49
- * page styled by `prefers-color-scheme` would take the replay's.
50
- */
51
- colorScheme?: 'light' | 'dark';
52
- startedAt: number;
53
- duration: number;
54
- events: unknown[];
55
- /** The mic's clips, played along with the replay. */
56
- voice?: VoiceClip[];
57
- }
58
- declare module 'deictic' {
59
- interface ServerApis {
60
- recordings: Recordings;
61
- }
62
- interface ClientApis {
63
- recordings: Recorder;
64
- }
65
- }
66
- interface RecordingsOptions extends Masking {
67
- /** How many recordings to keep, the latest: 20 by default. */
68
- keep?: number;
69
- /** Where they're kept, from the project's root: `.deictic/recordings` by default. */
70
- dir?: string;
71
- }
72
- declare function recordings(options?: RecordingsOptions): import("deictic").ServerPlugin<never, never, never, Recordings>;
73
- export { RecordingsOptions as a, MARKS as c, Recordings as i, Recorder as n, VoiceClip as o, Recording as r, recordings as s, Kept as t };
74
- //# sourceMappingURL=index4.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index4.d.ts","names":[],"sources":["../src/plugins/recordings/marks.ts","../src/plugins/recordings/index.ts"],"mappings":";;;;;cAIa;;UCkBI;EACf;EACA;EACA;;EAEA,QAAQ;;;UAIO;EACf;EACA;EACA;;;UAIe;;;;;EAKf,UAAU,QAAQ;;EAElB;;;UAIe;;EAEf,KAAK;IAAe,MAAM,WAAW;IAAc;IAAc;;;;UAIlD;EACf;EACA;IAAY;IAAe;;;;;;EAK3B;EACA;EACA;EACA;;EAEA,QAAQ;;;YAIE;IACR,YAAY;;YAEJ;IACR,YAAY;;;UAIC,0BAA0B;;EAEzC;;EAEA;;iBAiBc,WAAW,UAAS,sCAAsB,kCAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index5.d.ts","names":[],"sources":["../src/plugins/tailwind/catalog.ts","../src/plugins/tailwind/index.ts"],"mappings":";;UAeiB;EACf;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;EACA,OAAO;;EAEP;IAAW;IAAgB;IAAe;;;UCf3B;;EAEf;;EAEA;;;;;EAKA;;EAEA,WAAW;;KAGD;EAEN;EACA;;EAEA,SAAS;;EAET;EAAiB;;;UAGN;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;UAGe;EACf;;EAEA;;iBASc,SAAS,UAAS,oCAAoB,aAAA,OAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"integration.d.ts","names":[],"sources":["../src/tools/integration.ts"],"mappings":";;;UAmBiB;;EAEf,UAAU;;;;;EAKV,WAAW;;;;;;cAcA,eAAY,SAAa,gBAAc,cAAc,MAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"integration.js","names":["OWN","OWN"],"sources":["../src/tools/locate.ts","../src/tools/astro.ts","../src/tools/plugins.ts","../src/tools/integration.ts"],"sourcesContent":["/**\n * Marks each host element in a JSX module with where its opening tag starts:\n * `<div data-deictic=\"src/App.tsx:12:5\">`. The page reads it back to know what was clicked.\n *\n * At build time and not from React's fibers at runtime: it works for any framework that compiles JSX,\n * for server components (which have no fiber in the browser), and it names the element's own tag\n * rather than the component that rendered it. Only host elements (`div`, `button`) are marked, since a\n * component may not pass the attribute on; a component's call site is reached from its elements.\n *\n * The transform must run on the source as written (`enforce: 'pre'` under Vite), so lines and columns\n * are the file's. It runs alike on the server and in the browser, so a hydrated page matches its HTML.\n */\nimport MagicString from 'magic-string';\nimport { type JSXOpeningElement, parseSync, type Program, Visitor } from 'oxc-parser';\n\nexport const ATTRIBUTE = 'data-deictic';\n/** Modules that may hold JSX: `.jsx` and `.tsx`, and plain `.js`, as many React projects write theirs. */\nexport const JSX = /\\.[cm]?(?:[jt]sx|js)$/;\n\n/** A module parsed, with JSX read in a `.js` file too, which the parser reads there only when told. */\nexport const parse = (file: string, code: string) => parseSync(file, code, /\\.[cm]?js$/.test(file) ? { lang: 'jsx' } : undefined);\n\nexport interface Located {\n code: string;\n map: ReturnType<MagicString['generateMap']>;\n}\n\n/** Whether an opening tag is a host element's, `<div>` or `<svg>`, not a component's or a namespaced one. */\nexport const isHost = (el: JSXOpeningElement) => el.name.type === 'JSXIdentifier' && /^[a-z]/.test(el.name.name);\n\n/**\n * `code` with every host element marked, `file` being its path from the project's root, and `append`\n * after it (the client's import, in the browser); nothing when there is nothing to mark, or the module\n * doesn't parse, which the framework's own transform reports better.\n */\nexport function locate(code: string, file: string, append = ''): Located | undefined {\n // No tag, no parse: most `.js` modules have none, and every one of the project's comes through here.\n if (!/<[a-z]/.test(code)) return undefined;\n const { program, errors } = parse(file, code);\n if (errors.length > 0) return undefined;\n return marked(code, file, openingsIn(program), append);\n}\n\n/** Every opening tag in a module, in its order. */\nexport function openingsIn(program: Program): JSXOpeningElement[] {\n const elements: JSXOpeningElement[] = [];\n new Visitor({ JSXOpeningElement: (el) => void elements.push(el) }).visit(program);\n return elements;\n}\n\n/**\n * `code` with a mark in each of `elements` that is a host element's and has none yet, and `append` after\n * it; nothing with none to mark.\n */\nexport function marked(code: string, file: string, elements: JSXOpeningElement[], append = ''): Located | undefined {\n const lines = lineStarts(code);\n const s = new MagicString(code);\n for (const el of elements) {\n if (!isHost(el) || el.attributes.some((a) => a.type === 'JSXAttribute' && nameOf(a.name) === ATTRIBUTE)) continue;\n const { line, column } = position(lines, el.start);\n s.appendLeft(el.name.end, ` ${ATTRIBUTE}=\"${file}:${line}:${column}\"`);\n }\n if (!s.hasChanged()) return undefined;\n if (append !== '') s.append(append);\n // A map's source is read from the module's own folder, so it's the file's name, not its path from the root.\n return { code: s.toString(), map: s.generateMap({ source: file.slice(file.lastIndexOf('/') + 1), hires: 'boundary' }) };\n}\n\nconst nameOf = (name: { type: string; name?: unknown }) => (name.type === 'JSXIdentifier' ? name.name : undefined);\n\n/** Where each line starts, by offset. */\nexport function lineStarts(code: string): number[] {\n const starts = [0];\n for (let i = code.indexOf('\\n'); i !== -1; i = code.indexOf('\\n', i + 1)) starts.push(i + 1);\n return starts;\n}\n\n/** An offset's line and column, from 1. */\nexport function position(lines: number[], offset: number): { line: number; column: number } {\n let lo = 0;\n let hi = lines.length - 1;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (lines[mid]! <= offset) lo = mid;\n else hi = mid - 1;\n }\n return { line: lo + 1, column: offset - lines[lo]! + 1 };\n}\n\n/** A line and column's offset, or nothing past the file's end. */\nexport function offsetOf(lines: number[], line: number, column: number): number | undefined {\n const start = lines[line - 1];\n return start === undefined ? undefined : start + column - 1;\n}\n","/**\n * `.astro` components. They aren't JSX modules, but Astro 7's own parser reads a template as JSX, into the\n * tree oxc makes (offsets in UTF-16, as ours are), so its host elements are marked as a JSX module's are,\n * before Astro compiles the file. The parser is the project's own Astro's (`@astrojs/compiler-rs`, found\n * through `astro`), so it reads a file exactly as the compiler will; an Astro before 7 has none like it,\n * and its `.astro` files are left unmarked.\n */\nimport { createRequire } from 'node:module';\nimport { join } from 'node:path';\n\nimport type { JSXOpeningElement, Program } from 'oxc-parser';\n\nimport { type Located, marked } from './locate.ts';\n\nexport const ASTRO = /\\.astro$/;\n\n/** A file parsed: its module (an `.astro` file's frontmatter), and each opening tag in it, in the file's order. */\nexport interface Parsed {\n program: Program;\n elements: JSXOpeningElement[];\n}\n\ninterface Tree {\n ast: { frontmatter: { program: Program }; body: unknown };\n diagnostics: { severity: string; text: string }[];\n}\ntype Parse = (code: string) => Tree;\n\nconst parsers = new Map<string, Parse | undefined>();\n\n/** The parser of the Astro installed for the project at `root`, loaded once; nothing without Astro 7. */\nfunction parserOf(root: string): Parse | undefined {\n if (!parsers.has(root)) parsers.set(root, load(root));\n return parsers.get(root);\n}\n\nfunction load(root: string): Parse | undefined {\n try {\n // Astro's own dependency, which a strict package manager doesn't put where the project could import it.\n const astro = createRequire(createRequire(join(root, 'package.json')).resolve('astro/package.json'));\n // An ES module, required: every Node that runs Astro 7 can, and reading a source stays synchronous.\n const compiler: { parse?: Parse } = astro('@astrojs/compiler-rs');\n return compiler.parse;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Astro gives a `<script>` or `<style>` with an attribute it doesn't know to the page as it is, unbundled and\n * unscoped, and a `<slot>` isn't an element at all: none of them can be pointed at, so none is marked.\n */\nconst OWN = new Set(['script', 'style', 'slot']);\n\nconst isOpening = (node: object): node is JSXOpeningElement => 'type' in node && node.type === 'JSXOpeningElement';\n\n/** An `.astro` file's text parsed, or the `problem` with it: no parser (an older Astro), or text that doesn't parse. */\nexport function parseAstro(root: string, code: string): Parsed | { problem: string } {\n const parse = parserOf(root);\n if (parse === undefined) return { problem: 'reading an .astro file takes Astro 7 or later, so update astro' };\n const { ast, diagnostics } = parse(code);\n const error = diagnostics.find((d) => d.severity === 'error');\n if (error !== undefined) return { problem: `fix it first (${error.text})` };\n const elements: JSXOpeningElement[] = [];\n const walk = (node: unknown): void => {\n if (Array.isArray(node)) return node.forEach(walk);\n if (node === null || typeof node !== 'object') return;\n if (isOpening(node) && !(node.name.type === 'JSXIdentifier' && OWN.has(node.name.name))) elements.push(node);\n Object.values(node).forEach(walk);\n };\n walk(ast.body);\n return { program: ast.frontmatter.program, elements };\n}\n\n/** An `.astro` file's text with every host element marked, as `locate` marks a JSX module; nothing where it can't be read. */\nexport function locateAstro(code: string, file: string, root: string): Located | undefined {\n // No tag, no parse.\n if (!/<[a-z]/.test(code)) return undefined;\n const parsed = parseAstro(root, code);\n return 'problem' in parsed ? undefined : marked(code, file, parsed.elements);\n}\n","/**\n * The plugins an integration was given: checked as it starts, so a wrong set fails the dev server with\n * what to write instead, and set up once before the endpoints answer anything.\n */\nimport type { ServerContext, ServerPlugin } from '#src/index.ts';\nimport { checkShortcuts, OWN, ownShortcut, type Shortcut } from '#src/shortcut.ts';\n\nconst NAME = /^[a-z][a-z0-9-]*$/;\n\n/** Throws what to fix in a set of plugins: names, what they need, and their shortcuts, beside deictic's own. */\nexport function checkPlugins(plugins: readonly ServerPlugin[], own?: Shortcut | false): void {\n const names = new Set<string>();\n for (const { name, client, shortcut } of plugins) {\n if (!NAME.test(name)) throw new Error(`deictic: a plugin is named \"${name}\": name it in lowercase letters, digits and -`);\n if (names.has(name)) throw new Error(`deictic: two plugins are named ${name}: load each once`);\n if (shortcut !== undefined && client === undefined)\n throw new Error(`deictic: ${name} has a shortcut but no \\`client\\` to draw its panel: give it one, or leave out its shortcut`);\n names.add(name);\n }\n for (const { name, needs = [] } of plugins) {\n const missing = needs.find((other) => !names.has(other));\n if (missing !== undefined) throw new Error(`deictic: ${name} needs the ${missing} plugin: add it to \\`plugins\\``);\n }\n checkShortcuts([{ name: OWN, shortcut: ownShortcut(own) }, ...plugins]);\n}\n\n/**\n * Runs every plugin's `setup`, all at once, and answers the context they share: `use` reads an API\n * when it's asked for, so setups may `use` each other's only after they've all run, from a route or an\n * op, never in `setup` itself.\n */\nexport async function setUp(root: string, plugins: readonly ServerPlugin[]): Promise<ServerContext> {\n const apis = new Map<string, unknown>();\n const context: ServerContext = { root, use: (name) => apis.get(name) as never };\n await Promise.all(\n plugins.map(async (p) => {\n if (p.setup !== undefined) apis.set(p.name, await p.setup(context));\n }),\n );\n return context;\n}\n","/**\n * What every bundler's integration shares: the options, the client module that starts the overlay, and\n * the transform that marks a JSX module. Each integration adds what its bundler does its own way: how a\n * module is transformed (a hook, a loader, `onLoad`), how the page loads the client (a virtual module\n * under Vite, a file in `.deictic/` elsewhere, as webpack, Turbopack and Bun have none), where the\n * endpoints are served, and what opens the editor.\n */\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, isAbsolute, relative } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { ServerPlugin } from '#src/index.ts';\nimport { checkShortcuts, OWN, ownShortcut, type Shortcut } from '#src/shortcut.ts';\n\nimport { ASTRO, locateAstro } from './astro.ts';\nimport { keptIn } from './kept.ts';\nimport { JSX, locate, type Located } from './locate.ts';\nimport { checkPlugins } from './plugins.ts';\n\nexport interface DeicticOptions {\n /** The plugins to load, server halves: `tailwind()`, `tasks()`, your own. None by default. */\n plugins?: ServerPlugin[];\n /**\n * What opens the popup on any plugin, at the tab used last: Alt and the left button by default, or\n * `false` for none, leaving only plugins' own shortcuts.\n */\n shortcut?: Shortcut | false;\n}\n\n/** The options with their defaults, checked now, so a wrong set stops the dev server as it starts, not the page. */\nexport function prepare(options: DeicticOptions): { plugins: ServerPlugin[]; shortcut: Shortcut | false | undefined } {\n const plugins = options.plugins ?? [];\n checkPlugins(plugins, options.shortcut);\n return { plugins, shortcut: options.shortcut };\n}\n\n/**\n * The client module: the overlay, started with deictic's own shortcut and each plugin that has a half\n * in the page, with its shortcut, checked.\n */\nexport const clientModule = (plugins: ServerPlugin[], base: string, own?: Shortcut | false) => {\n const [shortcut, ...shortcuts] = checkShortcuts([{ name: OWN, shortcut: ownShortcut(own) }, ...plugins]);\n const paged = plugins.flatMap((p, i) =>\n p.client === undefined ? [] : [{ client: p.client, rest: { shortcut: shortcuts[i], options: p.clientOptions } }],\n );\n return [\n `import { start } from 'deictic/client';`,\n ...paged.map((p, i) => `import p${i} from ${JSON.stringify(p.client)};`),\n // Its shortcut and options as JSON, where it has them: `JSON.stringify` leaves out what's undefined.\n `start({ base: ${JSON.stringify(base)}, shortcut: ${JSON.stringify(shortcut) ?? 'undefined'}, plugins: [${paged.map((p, i) => `{ plugin: p${i}, ...${JSON.stringify(p.rest)} }`).join(', ')}] });`,\n ].join('\\n');\n};\n\n/**\n * Writes the client module to `.deictic/client.js` for a bundler without virtual modules, and answers\n * its path. Its imports are bare (`deictic/client`, each plugin's), found from the project as its own\n * are. Written only when it changed, so a watching bundler doesn't rebuild for nothing.\n */\nexport function writeClient(root: string, plugins: ServerPlugin[], base: string, own?: Shortcut | false): string {\n const code = `// Written by deictic as the dev server starts: it starts the overlay in the page.\\n${clientModule(plugins, base, own)}\\n`;\n // Its own package: an ES module that runs for its effect. An app whose package.json says\n // `\"sideEffects\": false` would otherwise have webpack drop the import, which is only for its effect.\n const manifest = `${JSON.stringify({ private: true, type: 'module', sideEffects: true }, null, 2)}\\n`;\n writeIfChanged(keptIn(root, 'package.json'), manifest);\n return writeIfChanged(keptIn(root, 'client.js'), code);\n}\n\nfunction writeIfChanged(path: string, text: string): string {\n if (!existsSync(path) || readFileSync(path, 'utf8') !== text) writeFileSync(path, text);\n return path;\n}\n\n/** A module beside `url`, by its name: `.ts` from the source, `.js` from `dist`, as `url` is. */\nexport const beside = (url: string, name: string) =>\n fileURLToPath(new URL(`./${name}${url.endsWith('.ts') ? '.ts' : '.js'}`, url)).replaceAll('\\\\', '/');\n\n/**\n * The import of the written client module in the module at `from`, by a relative path with forward\n * slashes: Turbopack can't import a Windows path, and every bundler takes a relative one.\n */\nexport function importOf(path: string, from: string): string {\n const to = relative(dirname(from), path).replaceAll('\\\\', '/');\n return `\\nimport ${JSON.stringify(to.startsWith('.') ? to : `./${to}`)};\\n`;\n}\n\n/**\n * A module marked, by its absolute path: its host elements, and `append` after it (the client's import,\n * in the browser). Nothing for a file that isn't JSX, is a dependency's, or is outside the project.\n */\nexport function mark(code: string, path: string, root: string, append = ''): Located | undefined {\n const file = JSX.test(path) ? fileIn(path, root) : undefined;\n return file === undefined ? undefined : locate(code, file, append);\n}\n\n/** An `.astro` component marked, by its absolute path, as `mark` does a module. It's no module of the browser's, so nothing is appended. */\nexport function markAstro(code: string, path: string, root: string): Located | undefined {\n const file = ASTRO.test(path) ? fileIn(path, root) : undefined;\n return file === undefined ? undefined : locateAstro(code, file, root);\n}\n\n/** A project file's path from the root, as a mark has it; nothing for a dependency's or one outside the project. */\nfunction fileIn(path: string, root: string): string | undefined {\n if (/[\\\\/]node_modules[\\\\/]/.test(path) || !isAbsolute(path)) return undefined;\n const file = relative(root, path).replaceAll('\\\\', '/');\n return file.startsWith('..') || isAbsolute(file) ? undefined : file;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,MAAa,YAAY;;AAEzB,MAAa,MAAM;;AAGnB,MAAa,SAAS,MAAc,SAAiB,UAAU,MAAM,MAAM,aAAa,KAAK,IAAI,IAAI,EAAE,MAAM,MAAM,IAAI,KAAA,CAAS;;AAQhI,MAAa,UAAU,OAA0B,GAAG,KAAK,SAAS,mBAAmB,SAAS,KAAK,GAAG,KAAK,IAAI;;;;;;AAO/G,SAAgB,OAAO,MAAc,MAAc,SAAS,IAAyB;CAEnF,IAAI,CAAC,SAAS,KAAK,IAAI,GAAG,OAAO,KAAA;CACjC,MAAM,EAAE,SAAS,WAAW,MAAM,MAAM,IAAI;CAC5C,IAAI,OAAO,SAAS,GAAG,OAAO,KAAA;CAC9B,OAAO,OAAO,MAAM,MAAM,WAAW,OAAO,GAAG,MAAM;AACvD;;AAGA,SAAgB,WAAW,SAAuC;CAChE,MAAM,WAAgC,CAAC;CACvC,IAAI,QAAQ,EAAE,oBAAoB,OAAO,KAAK,SAAS,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,OAAO;CAChF,OAAO;AACT;;;;;AAMA,SAAgB,OAAO,MAAc,MAAc,UAA+B,SAAS,IAAyB;CAClH,MAAM,QAAQ,WAAW,IAAI;CAC7B,MAAM,IAAI,IAAI,YAAY,IAAI;CAC9B,KAAK,MAAM,MAAM,UAAU;EACzB,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,WAAW,MAAM,MAAM,EAAE,SAAS,kBAAkB,OAAO,EAAE,IAAI,MAAA,cAAe,GAAG;EACzG,MAAM,EAAE,MAAM,WAAW,SAAS,OAAO,GAAG,KAAK;EACjD,E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CAC3D,MAAM,KAAK,SAAS,QAAQ,IAAI,GAAG,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG;CAC7D,OAAO,YAAY,KAAK,UAAU,GAAG,WAAW,GAAG,IAAI,KAAK,KAAK,IAAI,EAAE;AACzE;;;;;AAMA,SAAgB,KAAK,MAAc,MAAc,MAAc,SAAS,IAAyB;CAC/F,MAAM,OAAO,IAAI,KAAK,IAAI,IAAI,OAAO,MAAM,IAAI,IAAI,KAAA;CACnD,OAAO,SAAS,KAAA,IAAY,KAAA,IAAY,OAAO,MAAM,MAAM,MAAM;AACnE;;AAGA,SAAgB,UAAU,MAAc,MAAc,MAAmC;CACvF,MAAM,OAAO,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,IAAI,IAAI,KAAA;CACrD,OAAO,SAAS,KAAA,IAAY,KAAA,IAAY,YAAY,MAAM,MAAM,IAAI;AACtE;;AAGA,SAAS,OAAO,MAAc,MAAkC;CAC9D,IAAI,yBAAyB,KAAK,IAAI,KAAK,CAAC,WAAW,IAAI,GAAG,OAAO,KAAA;CACrE,MAAM,OAAO,SAAS,MAAM,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG;CACtD,OAAO,KAAK,WAAW,IAAI,KAAK,WAAW,IAAI,IAAI,KAAA,IAAY;AACjE"}
package/dist/kept.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"kept.js","names":[],"sources":["../src/tools/kept.ts"],"sourcesContent":["/**\n * Where deictic keeps what it makes for a project: `.deictic/` at its root, beside `.board/` and the like,\n * rather than in `node_modules`, which an install may clear. The history is there, and the shots,\n * recordings and voice clips plugins keep. It ignores itself in git: the history holds whole files, and\n * the rest is the page as it looked, neither of which belongs in a commit.\n */\nimport { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nconst IGNORE = \"# deictic's own: the history, and the shots, recordings and voice clips it keeps.\\n*\\n\";\n\n/** A path under the project's `.deictic/`, made with its `.gitignore` the first time. */\nexport function keptIn(root: string, ...parts: string[]): string {\n const dir = join(root, '.deictic');\n const ignore = join(dir, '.gitignore');\n if (!existsSync(ignore)) {\n mkdirSync(dir, { recursive: true });\n writeFileSync(ignore, IGNORE);\n }\n return join(dir, ...parts);\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,SAAS;;AAGf,SAAgB,OAAO,MAAc,GAAG,OAAyB;CAC/D,MAAM,MAAM,KAAK,MAAM,UAAU;CACjC,MAAM,SAAS,KAAK,KAAK,YAAY;CACrC,IAAI,CAAC,WAAW,MAAM,GAAG;EACvB,UAAU,KAAK,EAAE,WAAW,KAAK,CAAC;EAClC,cAAc,QAAQ,MAAM;CAC9B;CACA,OAAO,KAAK,KAAK,GAAG,KAAK;AAC3B"}
package/dist/marks.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"marks.js","names":[],"sources":["../src/plugins/recordings/marks.ts"],"sourcesContent":["/**\n * The custom event's tag the marks go in: the page's annotations, as an SVG in page coordinates (`svg`),\n * and as the annotations themselves (`annotations`, absent from recordings made before it was added).\n */\nexport const MARKS = 'deictic.annotations';\n\n/**\n * The custom event a recording ends with: rrweb's timeline lasts as long as its events, so without it a\n * recording of a still page (a voice-over, say) would replay as a moment, and its voice never play.\n */\nexport const END = 'deictic.end';\n"],"mappings":";;;;;AAIA,MAAa,QAAQ;;;;;AAMrB,MAAa,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"playwright.js","names":[],"sources":["../src/plugins/screenshots/playwright.ts"],"sourcesContent":["/**\n * The `rrweb()` renderer's server half: rebuilds a page's snapshot in a browser beside the dev server and\n * screenshots it at the page's viewport, scroll and pixel density, so text lays out as the page's does. The\n * browser is launched on the first shot and kept for the next; Playwright closes it with the process.\n *\n * The snapshot is rebuilt into a sandboxed iframe filling a blank page on the page's own origin, which\n * Playwright answers itself, so nothing asks the dev server for it: rrweb has made the snapshot's URLs\n * whole, and its stylesheets' fonts and images load from the dev server as the page's did.\n */\nimport { createRequire } from 'node:module';\n\nimport type { Browser } from 'playwright-core';\nimport type * as Rrweb from 'rrweb-snapshot';\n\nimport type { Box, BrowserOptions } from './index.ts';\n\n/** What the page sends: its snapshot and what's needed to show it as the page does. */\n/** A node of an rrweb snapshot, as `snapshot()` answers it. */\nexport type SnapshotNode = NonNullable<ReturnType<typeof Rrweb.snapshot>>;\n\nexport interface Snapshot {\n snapshot: SnapshotNode;\n url: string;\n viewport: { width: number; height: number };\n scroll: { x: number; y: number };\n scale: number;\n /** The part of the viewport to keep, for a shot of an element alone. */\n clip?: Box;\n /** An SVG the viewport's size, drawn over the page: the annotations, where there are any. */\n overlay?: string;\n}\n\nconst HOST = '<!doctype html><html><body style=\"margin:0\"></body></html>';\n\nconst browsers = new Map<string, Promise<Browser>>();\n\n/** A browser by the options, launched once: the one named, or Playwright's own Chromium, then Chrome, then Edge. */\nexport function browserOf(options: BrowserOptions): Promise<Browser> {\n const key = JSON.stringify(options);\n const known = browsers.get(key);\n if (known !== undefined) return known;\n const launched = launch(options);\n browsers.set(key, launched);\n // A launch that failed is tried again on the next shot, after the user installs what it said to.\n launched.catch(() => browsers.delete(key));\n return launched;\n}\n\nasync function launch({ executablePath, channel }: BrowserOptions): Promise<Browser> {\n const { chromium } = await import('playwright-core').catch((e: unknown) => {\n throw new Error('the rrweb() renderer needs playwright-core: add it to your devDependencies', { cause: e });\n });\n if (executablePath !== undefined || channel !== undefined) return chromium.launch({ executablePath, channel });\n const tried: string[] = [];\n for (const attempt of [{}, { channel: 'chrome' }, { channel: 'msedge' }]) {\n try {\n return await chromium.launch(attempt);\n } catch (e) {\n tried.push(\n `${'channel' in attempt ? attempt.channel : \"Playwright's Chromium\"}: ${(e instanceof Error ? e.message : String(e)).split('\\n', 1)[0]}`,\n );\n }\n }\n throw new Error(\n `the rrweb() renderer found no browser to render in (${tried.join('; ')}): run \\`npx playwright install chromium\\`, or pass rrweb({ executablePath })`,\n );\n}\n\n/** The rrweb-snapshot bundle that defines `rrwebSnapshot` in a page: its CommonJS entry is that bundle. */\nconst bundle = () => createRequire(import.meta.url).resolve('rrweb-snapshot');\n\nexport async function render(input: unknown, options: BrowserOptions): Promise<Uint8Array> {\n const shot = input as Snapshot;\n if (typeof shot?.url !== 'string' || typeof shot.snapshot !== 'object' || typeof shot.viewport?.width !== 'number')\n throw new Error('screenshots: that is not a snapshot the rrweb() renderer took');\n const browser = await browserOf(options);\n const context = await browser.newContext({ viewport: shot.viewport, deviceScaleFactor: shot.scale });\n try {\n const page = await context.newPage();\n const host = new URL('/__deictic/plugins/screenshots/host', shot.url).href;\n await page.route(host, (route) => route.fulfill({ contentType: 'text/html', body: HOST }));\n await page.goto(host);\n await page.addScriptTag({ path: bundle() });\n await page.evaluate(async ({ snapshot, scroll, overlay }) => {\n const { rebuildIntoSandboxedIframe, createCache, createMirror } = (globalThis as unknown as { rrwebSnapshot: typeof Rrweb })\n .rrwebSnapshot;\n const { iframe } = rebuildIntoSandboxedIframe(snapshot, {\n root: document.body,\n cache: createCache(),\n mirror: createMirror(),\n iframeAttributes: { style: 'border:0;position:fixed;inset:0;width:100vw;height:100vh' },\n });\n const doc = iframe.contentDocument;\n if (doc === null) throw new Error('screenshots: the snapshot was rebuilt where it cannot be read');\n await doc.fonts.ready;\n await Promise.all([...doc.images].map((img) => img.decode().catch(() => {})));\n iframe.contentWindow?.scrollTo(scroll.x, scroll.y);\n if (overlay === undefined) return;\n // Over the page and its scroll: the SVG is the viewport's, already where it scrolled to.\n const marks = document.createElement('div');\n marks.style.cssText = 'position:fixed;inset:0;z-index:1;pointer-events:none';\n marks.innerHTML = overlay;\n document.body.append(marks);\n }, shot);\n const clip = shot.clip === undefined ? undefined : clamp(shot.clip, shot.viewport);\n return new Uint8Array(await page.screenshot({ type: 'png', ...(clip === undefined ? {} : { clip }) }));\n } finally {\n await context.close();\n }\n}\n\n/** A box kept within the viewport: an element partly scrolled out of it shows only the part that's in. */\nfunction clamp(box: Box, viewport: { width: number; height: number }): Box | undefined {\n const x = Math.max(0, box.x);\n const y = Math.max(0, box.y);\n const width = Math.min(viewport.width, box.x + box.width) - x;\n const height = Math.min(viewport.height, box.y + box.height) - y;\n return width > 0 && height > 0 ? { x, y, width, height } : undefined;\n}\n"],"mappings":";;;;;;;;;;;AAgCA,MAAM,OAAO;AAEb,MAAM,2BAAW,IAAI,IAA8B;;AAGnD,SAAgB,UAAU,SAA2C;CACnE,MAAM,MAAM,KAAK,UAAU,OAAO;CAClC,MAAM,QAAQ,SAAS,IAAI,GAAG;CAC9B,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,WAAW,OAAO,OAAO;CAC/B,SAAS,IAAI,KAAK,QAAQ;CAE1B,SAAS,YAAY,SAAS,OAAO,GAAG,CAAC;CACzC,OAAO;AACT;AAEA,eAAe,OAAO,EAAE,gBAAgB,WAA6C;CACnF,MAAM,EAAE,aAAa,MAAM,OAAO,kBAAkB,CAAC,OAAO,MAAe;EACzE,MAAM,IAAI,MAAM,8EAA8E,EAAE,OAAO,EAAE,CAAC;CAC5G,CAAC;CACD,IAAI,mBAAmB,KAAA,KAAa,YAAY,KAAA,GAAW,OAAO,SAAS,OAAO;EAAE;EAAgB;CAAQ,CAAC;CAC7G,MAAM,QAAkB,CAAC;CACzB,KAAK,MAAM,WAAW;EAAC,CAAC;EAAG,EAAE,SAAS,SAAS;EAAG,EAAE,SAAS,SAAS;CAAC,GACrE,IAAI;EACF,OAAO,MAAM,SAAS,OAAO,OAAO;CACtC,SAAS,GAAG;EACV,MAAM,KACJ,GAAG,aAAa,UAAU,QAAQ,UAAU,wBAAwB,KAAK,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,EAAA,CAAG,MAAM,MAAM,CAAC,CAAC,CAAC,IACtI;CACF;CAEF,MAAM,IAAI,MACR,uDAAuD,MAAM,KAAK,IAAI,EAAE,8EAC1E;AACF;;AAGA,MAAM,eAAe,cAAc,YAAY,GAAG,CAAC,CAAC,QAAQ,gBAAgB;AAE5E,eAAsB,OAAO,OAAgB,SAA8C;CACzF,MAAM,OA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