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.
- package/API.md +303 -0
- package/README.md +56 -104
- package/dist/annotations/index.d.ts +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/bun.d.ts +1 -1
- package/dist/bun.js +2 -2
- package/dist/client/index.d.ts +4 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +130 -16
- package/dist/client/index.js.map +1 -1
- package/dist/index.d.ts +21 -218
- package/dist/index.js.map +1 -1
- package/dist/loader.js +1 -1
- package/dist/logs/client.d.ts +4 -0
- package/dist/logs/client.d.ts.map +1 -0
- package/dist/logs/client.js +16 -0
- package/dist/logs/client.js.map +1 -0
- package/dist/logs/index.d.ts +18 -0
- package/dist/logs/index.d.ts.map +1 -0
- package/dist/logs/index.js +21 -0
- package/dist/logs/index.js.map +1 -0
- package/dist/network/client.d.ts +4 -0
- package/dist/network/client.d.ts.map +1 -0
- package/dist/network/client.js +29 -0
- package/dist/network/client.js.map +1 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.js +39 -0
- package/dist/network/index.js.map +1 -0
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/recommended/index.d.ts +15 -5
- package/dist/recommended/index.d.ts.map +1 -1
- package/dist/recommended/index.js +10 -3
- package/dist/recommended/index.js.map +1 -1
- package/dist/recordings/client.d.ts +1 -1
- package/dist/recordings/client.d.ts.map +1 -1
- package/dist/recordings/client.js +177 -48
- package/dist/recordings/client.js.map +1 -1
- package/dist/recordings/index.d.ts +2 -2
- package/dist/recordings/index.js +3 -3
- package/dist/screenshots/client.d.ts +7 -1
- package/dist/screenshots/client.d.ts.map +1 -1
- package/dist/screenshots/client.js +36 -4
- package/dist/screenshots/client.js.map +1 -1
- package/dist/screenshots/dom.d.ts +1 -1
- package/dist/screenshots/dom.d.ts.map +1 -1
- package/dist/screenshots/dom.js +1 -28
- package/dist/screenshots/dom.js.map +1 -1
- package/dist/screenshots/index.d.ts +1 -1
- package/dist/screenshots/index.js +2 -2
- package/dist/screenshots/index.js.map +1 -1
- package/dist/screenshots/rrweb.d.ts +2 -2
- package/dist/screenshots/rrweb.js +5 -1
- package/dist/screenshots/rrweb.js.map +1 -1
- package/dist/{endpoints.js → shared/endpoints.js} +1 -1
- package/dist/shared/endpoints.js.map +1 -0
- package/dist/shared/index.d.ts +238 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/{index3.d.ts → shared/index2.d.ts} +3 -1
- package/dist/shared/index2.d.ts.map +1 -0
- package/dist/shared/index3.d.ts +112 -0
- package/dist/shared/index3.d.ts.map +1 -0
- package/dist/shared/index4.d.ts +64 -0
- package/dist/shared/index4.d.ts.map +1 -0
- package/dist/shared/index5.d.ts +220 -0
- package/dist/shared/index5.d.ts.map +1 -0
- package/dist/{index5.d.ts → shared/index6.d.ts} +2 -2
- package/dist/shared/index6.d.ts.map +1 -0
- package/dist/{integration.d.ts → shared/integration.d.ts} +4 -3
- package/dist/shared/integration.d.ts.map +1 -0
- package/dist/{integration.js → shared/integration.js} +5 -3
- package/dist/shared/integration.js.map +1 -0
- package/dist/{kept.js → shared/kept.js} +2 -2
- package/dist/shared/kept.js.map +1 -0
- package/dist/{marks.js → shared/marks.js} +6 -1
- package/dist/shared/marks.js.map +1 -0
- package/dist/shared/mask.js +107 -0
- package/dist/shared/mask.js.map +1 -0
- package/dist/{playwright.js → shared/playwright.js} +19 -4
- package/dist/shared/playwright.js.map +1 -0
- package/dist/shared/recordings.js +437 -0
- package/dist/shared/recordings.js.map +1 -0
- package/dist/shared/shortcut.js.map +1 -0
- package/dist/shared/tasks.js +632 -0
- package/dist/shared/tasks.js.map +1 -0
- package/dist/shared/waveform.js.map +1 -0
- package/dist/tailwind/client.d.ts +1 -1
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/tasks/client.d.ts +1 -1
- package/dist/tasks/client.d.ts.map +1 -1
- package/dist/tasks/client.js +272 -57
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.d.ts +2 -159
- package/dist/tasks/index.js +1 -348
- package/dist/vite.d.ts +11 -12
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +21 -4
- package/dist/vite.js.map +1 -1
- package/dist/voice/client.d.ts.map +1 -1
- package/dist/voice/client.js +36 -15
- package/dist/voice/client.js.map +1 -1
- package/dist/voice/index.d.ts +6 -1
- package/dist/voice/index.d.ts.map +1 -1
- package/dist/voice/index.js +13 -3
- package/dist/voice/index.js.map +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +2 -2
- package/package.json +41 -2
- package/skills/deictic/SKILL.md +20 -14
- package/skills/deictic/references/install.md +32 -10
- package/skills/deictic/references/recordings.md +29 -0
- package/skills/deictic/references/tasks.md +49 -21
- package/skills/deictic/references/watch.md +38 -11
- package/skills/deictic/scripts/lib.mjs +88 -4
- package/skills/deictic/scripts/recording.mjs +84 -4
- package/skills/deictic/scripts/task.mjs +36 -7
- package/skills/deictic/scripts/vb.mjs +12 -0
- package/skills/deictic/scripts/watch.mjs +74 -10
- package/src/client/away.ts +105 -0
- package/src/client/index.ts +60 -16
- package/src/client/style.ts +1 -0
- package/src/index.ts +21 -2
- package/src/plugins/logs/client.ts +18 -0
- package/src/plugins/logs/index.ts +55 -0
- package/src/plugins/network/client.ts +30 -0
- package/src/plugins/network/index.ts +69 -0
- package/src/plugins/network/mask.ts +133 -0
- package/src/plugins/recommended/index.ts +14 -1
- package/src/plugins/recordings/client.ts +220 -40
- package/src/plugins/recordings/index.ts +111 -25
- package/src/plugins/recordings/marks.ts +6 -0
- package/src/plugins/recordings/replay.ts +159 -10
- package/src/plugins/screenshots/client.ts +38 -2
- package/src/plugins/screenshots/dom.ts +1 -32
- package/src/plugins/screenshots/index.ts +2 -0
- package/src/plugins/screenshots/playwright.ts +15 -4
- package/src/plugins/screenshots/rrweb.ts +2 -1
- package/src/plugins/tasks/client.ts +273 -41
- package/src/plugins/tasks/index.ts +207 -47
- package/src/plugins/tasks/local.ts +170 -0
- package/src/plugins/tasks/watchers.ts +36 -0
- package/src/plugins/voice/client.ts +33 -10
- package/src/plugins/voice/index.ts +21 -4
- package/src/tools/integration.ts +5 -3
- package/src/tools/kept.ts +2 -2
- package/src/vite.ts +23 -4
- package/dist/endpoints.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index2.d.ts +0 -23
- package/dist/index3.d.ts.map +0 -1
- package/dist/index4.d.ts +0 -74
- package/dist/index4.d.ts.map +0 -1
- package/dist/index5.d.ts.map +0 -1
- package/dist/integration.d.ts.map +0 -1
- package/dist/integration.js.map +0 -1
- package/dist/kept.js.map +0 -1
- package/dist/marks.js.map +0 -1
- package/dist/playwright.js.map +0 -1
- package/dist/recordings.js +0 -235
- package/dist/recordings.js.map +0 -1
- package/dist/shortcut.js.map +0 -1
- package/dist/tasks/index.d.ts.map +0 -1
- package/dist/tasks/index.js.map +0 -1
- package/dist/waveform.js.map +0 -1
- /package/dist/{shortcut.js → shared/shortcut.js} +0 -0
- /package/dist/{waveform.js → shared/waveform.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,220 +1,23 @@
|
|
|
1
|
-
import { JSXOpeningElement, Program } from "oxc-parser";
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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.
|
|
9
21
|
*/
|
|
10
|
-
|
|
11
|
-
type Modifier
|
|
12
|
-
interface Shortcut {
|
|
13
|
-
/** Held, and no other, to outline elements. */
|
|
14
|
-
modifiers?: Modifier[];
|
|
15
|
-
/** Pressed with them to open the panel. `'left'` unset. */
|
|
16
|
-
button?: 'left' | 'middle' | 'right';
|
|
17
|
-
}
|
|
18
|
-
/** A place in the source: the file from the project's root, with `/`, and the line and column, from 1. */
|
|
19
|
-
interface Loc {
|
|
20
|
-
file: string;
|
|
21
|
-
line: number;
|
|
22
|
-
column: number;
|
|
23
|
-
}
|
|
24
|
-
/** An element the pointer picked: where its opening tag starts, and the tag, which the server checks is still there. */
|
|
25
|
-
interface Target {
|
|
26
|
-
loc: Loc;
|
|
27
|
-
tag: string;
|
|
28
|
-
}
|
|
29
|
-
/** Text in a file to replace, by UTF-16 offsets. `file` is the target's unless named, from the project's root. */
|
|
30
|
-
interface TextEdit {
|
|
31
|
-
file?: string;
|
|
32
|
-
start: number;
|
|
33
|
-
end: number;
|
|
34
|
-
text: string;
|
|
35
|
-
}
|
|
36
|
-
/** What a server half reads: the target's file, parsed, and its element. */
|
|
37
|
-
interface Source {
|
|
38
|
-
/** The target's file, from the project's root. */
|
|
39
|
-
file: string;
|
|
40
|
-
code: string;
|
|
41
|
-
/** The file's module; for an `.astro` component, its frontmatter's. */
|
|
42
|
-
program: Program;
|
|
43
|
-
/** The target's opening tag. */
|
|
44
|
-
element: JSXOpeningElement;
|
|
45
|
-
/** Another file under the project's root, for plugins whose edits go elsewhere (a locale's messages). */
|
|
46
|
-
read(file: string): string;
|
|
47
|
-
}
|
|
48
|
-
/** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */
|
|
49
|
-
declare class Refusal extends Error {
|
|
50
|
-
name: string;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* A change the plugin made itself, not to a file: what its `undo` and `redo` need to take it back and
|
|
54
|
-
* make it again. JSON, since the history keeps it on disk across restarts of the dev server.
|
|
55
|
-
*/
|
|
56
|
-
interface Done<Record = unknown> {
|
|
57
|
-
done: Record;
|
|
58
|
-
}
|
|
59
|
-
type Maybe<T> = T | Promise<T>;
|
|
60
|
-
/**
|
|
61
|
-
* Each plugin's API to the others on the server, by name. A plugin adds its own, so `use` knows its type:
|
|
62
|
-
* `declare module 'deictic' { interface ServerApis { screenshots: Screenshots } }`.
|
|
63
|
-
*/
|
|
64
|
-
interface ServerApis {}
|
|
65
|
-
/** The same, in the page: `declare module 'deictic' { interface ClientApis { screenshots: Capture } }`. */
|
|
66
|
-
interface ClientApis {}
|
|
67
|
-
/** A plugin's API, by its name: what its package declared, or `unknown` for one that declared none. */
|
|
68
|
-
type ApiOf<Apis, Name extends string> = Name extends keyof Apis ? Apis[Name] : unknown;
|
|
69
|
-
interface ServerContext {
|
|
70
|
-
/** The project's root, as an absolute path. */
|
|
71
|
-
root: string;
|
|
72
|
-
/**
|
|
73
|
-
* Another plugin's API, as its `setup` answered it, or nothing when it isn't loaded. One the plugin
|
|
74
|
-
* `needs` always is; any other may not be, so check.
|
|
75
|
-
*/
|
|
76
|
-
use: <Name extends string>(name: Name) => ApiOf<ServerApis, Name> | undefined;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* A route of the plugin's own, at `/__deictic/plugins/<name>/<route>`, and below it. A `GET` must
|
|
80
|
-
* change nothing: anything else reaches it only from the page itself, which deictic checks.
|
|
81
|
-
*/
|
|
82
|
-
type Route = (request: Request, context: ServerContext) => Maybe<Response>;
|
|
83
|
-
interface ServerPlugin<Model = unknown, Op = unknown, Record = unknown, Api = unknown> {
|
|
84
|
-
/** Ties the halves together; also the label of its changes in the history, and its routes' path. Lowercase, with `-`. */
|
|
85
|
-
name: string;
|
|
86
|
-
/** The module the page loads for this plugin's half there, which default-exports its `ClientPlugin`. */
|
|
87
|
-
client?: string;
|
|
88
|
-
/** What the page half gets as `context.options`: the user's options it needs there, as JSON. */
|
|
89
|
-
clientOptions?: unknown;
|
|
90
|
-
/** What opens its panel: its own default, which its options let the user change. A plugin with no panel has none. */
|
|
91
|
-
shortcut?: Shortcut;
|
|
92
|
-
/** The plugins it can't do without, by name: the dev server won't start without them. */
|
|
93
|
-
needs?: string[];
|
|
94
|
-
/** Runs once, as the dev server starts and before it answers anything. Answers the plugin's API to the others. */
|
|
95
|
-
setup?(context: ServerContext): Maybe<Api>;
|
|
96
|
-
/** Routes of its own, by their first segment under `/__deictic/plugins/<name>/`. */
|
|
97
|
-
routes?: {
|
|
98
|
-
[route: string]: Route;
|
|
99
|
-
};
|
|
100
|
-
/** The model its panel shows for an element. Without it, the panel gets none. */
|
|
101
|
-
read?(source: Source, target: Target): Maybe<Model>;
|
|
102
|
-
/** Text edits for deictic to write, or a change the plugin made itself. */
|
|
103
|
-
apply?(source: Source, target: Target, op: Op): Maybe<TextEdit[] | Done<Record>>;
|
|
104
|
-
/**
|
|
105
|
-
* Takes back a change `apply` made itself, or throws a `Refusal` saying why it can't any more. It may
|
|
106
|
-
* answer what the next redo needs, where that differs (what it put back has a new ID).
|
|
107
|
-
*/
|
|
108
|
-
undo?(record: Record): Maybe<void | Record>;
|
|
109
|
-
/** Makes it again after an undo, and answers what the next undo needs, which may differ (a new ID). */
|
|
110
|
-
redo?(record: Record): Maybe<Record>;
|
|
111
|
-
/** Says what an op does, for the history: `className: px-2 → px-4`. */
|
|
112
|
-
describe?(op: Op, before: Model): string;
|
|
113
|
-
}
|
|
114
|
-
declare const definePlugin: <Model, Op, Record = unknown, Api = unknown>(plugin: ServerPlugin<Model, Op, Record, Api>) => ServerPlugin<Model, Op, Record, Api>;
|
|
115
|
-
interface ClientContext {
|
|
116
|
-
/** The dev server's base URL, ending in `/`. */
|
|
117
|
-
base: string;
|
|
118
|
-
/** deictic's shadow root, to draw in: neither the page's styles nor the overlay's cross over. */
|
|
119
|
-
root: ShadowRoot;
|
|
120
|
-
/** The server half's `clientOptions`, or nothing. */
|
|
121
|
-
options: unknown;
|
|
122
|
-
/** Another plugin's API in the page, as its `setup` answered it, or nothing when it isn't loaded. */
|
|
123
|
-
use: <Name extends string>(name: Name) => ApiOf<ClientApis, Name> | undefined;
|
|
124
|
-
/** Asks one of this plugin's own routes, from the page: `request('shots', { method: 'POST', body: blob })`. */
|
|
125
|
-
request: (route: string, init?: RequestInit) => Promise<Response>;
|
|
126
|
-
/**
|
|
127
|
-
* Opens the popup on an element at a plugin's tab, as its shortcut would: after a recording, say. An
|
|
128
|
-
* element rendered again since stands in for one no longer on the page. False when there's no such tab
|
|
129
|
-
* or no such element any more. Not from `setup`, which runs before the popup can open.
|
|
130
|
-
*/
|
|
131
|
-
open: (plugin: string, element: Element) => boolean;
|
|
132
|
-
/**
|
|
133
|
-
* Shows `items` in the lightbox over everything, at `at` (the first by default), stepping between them with
|
|
134
|
-
* ← and →. With `from`, it grows out of that element (the chip clicked) and shrinks back into it on close.
|
|
135
|
-
*/
|
|
136
|
-
lightbox: (items: LightboxItem[], options?: LightboxOptions) => {
|
|
137
|
-
close: () => void;
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
/** What the lightbox shows: a picture, a page in a frame (a recording's replay), or a sound with its waveform. */
|
|
141
|
-
type LightboxItem = {
|
|
142
|
-
/** Its name, over it. */
|
|
143
|
-
title: string;
|
|
144
|
-
/** Buttons beside the name: each closes the lightbox and runs. */
|
|
145
|
-
actions?: LightboxAction[];
|
|
146
|
-
} & ({
|
|
147
|
-
kind: 'image';
|
|
148
|
-
url: string;
|
|
149
|
-
} | {
|
|
150
|
-
kind: 'page';
|
|
151
|
-
url: string;
|
|
152
|
-
} | {
|
|
153
|
-
kind: 'audio';
|
|
154
|
-
url: string;
|
|
155
|
-
});
|
|
156
|
-
interface LightboxAction {
|
|
157
|
-
label: string;
|
|
158
|
-
title?: string;
|
|
159
|
-
run: () => void;
|
|
160
|
-
}
|
|
161
|
-
interface LightboxOptions {
|
|
162
|
-
/** The item it opens at. */
|
|
163
|
-
at?: number;
|
|
164
|
-
/** The element it grows out of, and goes back into. */
|
|
165
|
-
from?: Element;
|
|
166
|
-
}
|
|
167
|
-
interface PanelContext<Model, Op> extends ClientContext {
|
|
168
|
-
/** The element clicked: the one the source marked, under the pointer or around what is. */
|
|
169
|
-
element: Element;
|
|
170
|
-
/**
|
|
171
|
-
* What was under the pointer, where it isn't `element` but inside it: markup nothing marked, as a
|
|
172
|
-
* dependency's, or in an open shadow root, as the popup's own on a page that shows it (`popupIn`).
|
|
173
|
-
*/
|
|
174
|
-
pointed?: Element;
|
|
175
|
-
/** Every element on the page from the same place in the source, the clicked one among them: the rows of a list. */
|
|
176
|
-
elements: Element[];
|
|
177
|
-
target: Target;
|
|
178
|
-
model: Model;
|
|
179
|
-
/** Applies an op on disk, and reads the model again. Rejects with the server's reason, which the panel also shows. */
|
|
180
|
-
apply(op: Op): Promise<Model>;
|
|
181
|
-
close: () => void;
|
|
182
|
-
/**
|
|
183
|
-
* Says there's something here that leaving would lose (words typed, a change tried on the page), and the button
|
|
184
|
-
* that keeps it: a click outside the popup then shakes that button, where it would have closed the popup.
|
|
185
|
-
* `undefined` once there's nothing to lose. Forgotten as the panel unmounts.
|
|
186
|
-
*/
|
|
187
|
-
unsaved: (action: HTMLElement | undefined) => void;
|
|
188
|
-
/**
|
|
189
|
-
* Leaves the popup to do something on the page, then comes back: closes it, runs `task` (a recording, a
|
|
190
|
-
* pick of another element), and opens it again at this tab on this element. The next mount gets
|
|
191
|
-
* `resumed`: the `state` kept now (what was typed, what's attached), and what `task` answered, or why
|
|
192
|
-
* it failed. The state stays in the page, as it is: no need for JSON.
|
|
193
|
-
*/
|
|
194
|
-
away: <T>(state: unknown, task: () => Promise<T>) => void;
|
|
195
|
-
/** Set when this mount is the panel coming back from `away`. */
|
|
196
|
-
resumed?: Resumed;
|
|
197
|
-
}
|
|
198
|
-
/** What a panel coming back from `away` gets: the state it kept, and the task's result or problem. */
|
|
199
|
-
interface Resumed {
|
|
200
|
-
state: unknown;
|
|
201
|
-
result?: unknown;
|
|
202
|
-
/** Why the task failed: its error's message. */
|
|
203
|
-
problem?: string;
|
|
204
|
-
}
|
|
205
|
-
interface ClientPlugin<Model = unknown, Op = unknown, Api = unknown> {
|
|
206
|
-
/** The server half's `name`. */
|
|
207
|
-
name: string;
|
|
208
|
-
/** Shown over the element while its shortcut's keys are held, and atop the panel. */
|
|
209
|
-
label?: string;
|
|
210
|
-
/**
|
|
211
|
-
* Runs once, as the page starts, before any panel opens (a recording starts here). Answers the
|
|
212
|
-
* plugin's API to the others in the page, at once: one that needs time keeps its promises inside it.
|
|
213
|
-
*/
|
|
214
|
-
setup?(context: ClientContext): Api;
|
|
215
|
-
/** Draws into `panel`, inside deictic's shadow root. Returns what to undo on the page when the panel closes. */
|
|
216
|
-
mount?: (panel: HTMLElement, context: PanelContext<Model, Op>) => (() => void) | void;
|
|
217
|
-
}
|
|
218
|
-
declare const defineClientPlugin: <Model, Op, Api = unknown>(plugin: ClientPlugin<Model, Op, Api>) => ClientPlugin<Model, Op, Api>;
|
|
219
|
-
export { Shortcut as C, Modifier as S, Source as _, Done as a, defineClientPlugin as b, LightboxOptions as c, Refusal as d, Resumed as f, ServerPlugin as g, ServerContext as h, ClientPlugin as i, Loc as l, ServerApis as m, ClientApis as n, LightboxAction as o, Route as p, ClientContext as r, LightboxItem as s, ApiOf as t, PanelContext as u, Target as v, definePlugin as x, TextEdit as y };
|
|
220
|
-
//# sourceMappingURL=index.d.ts.map
|
|
22
|
+
import { C as Modifier, S as definePlugin, _ as Source, a as Done, b as TextEdit, 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 Standalone, w as Shortcut, x as defineClientPlugin, y as Target } from "./shared/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, Standalone, Target, TextEdit, defineClientPlugin, definePlugin };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `deictic`: what a plugin is. Every plugin is optional: deictic itself is the glue (the\n * transform that ties elements to source, the dev server's endpoints, the history, shortcuts and the\n * overlay's panel), and each plugin adds what it does on top.\n *\n * A plugin has two halves, each optional that meet over the dev server's endpoints (`tools/endpoints.ts`). The\n * server half runs beside the bundler and is the only one that reads source: it turns the element\n * under the pointer into a model its panel can show, and an op from that panel into text edits. It\n * never writes files; deictic does, so every plugin's changes land in one history and undo the\n * same way. A change that isn't to a file (a task added to a board) the plugin makes itself and\n * answers with what it did (`Done`): the history keeps that beside the files' changes and hands it\n * back to the plugin's own `undo` and `redo`.\n * The client half is a module the page loads, named by the server half's `client`, which draws the\n * panel and previews an op on the page before it is applied.\n *\n * A plugin may have no panel at all, only an API for others (screenshots, a recording) and routes of\n * its own on the dev server. Each half's `setup` answers its API, and `use(name)` reaches another\n * plugin's, on the same side; `needs` names the plugins it can't do without.\n *\n * Both halves import from here, so the parser is imported for its types only: the browser must not load it.\n */\nimport type { JSXOpeningElement, Program } from 'oxc-parser';\n\nimport type { Shortcut } from './shortcut.ts';\n\nexport type { Modifier, Shortcut } from './shortcut.ts';\n\n/** A place in the source: the file from the project's root, with `/`, and the line and column, from 1. */\nexport interface Loc {\n file: string;\n line: number;\n column: number;\n}\n\n/** An element the pointer picked: where its opening tag starts, and the tag, which the server checks is still there. */\nexport interface Target {\n loc: Loc;\n tag: string;\n}\n\n/** Text in a file to replace, by UTF-16 offsets. `file` is the target's unless named, from the project's root. */\nexport interface TextEdit {\n file?: string;\n start: number;\n end: number;\n text: string;\n}\n\n/** What a server half reads: the target's file, parsed, and its element. */\nexport interface Source {\n /** The target's file, from the project's root. */\n file: string;\n code: string;\n /** The file's module; for an `.astro` component, its frontmatter's. */\n program: Program;\n /** The target's opening tag. */\n element: JSXOpeningElement;\n /** Another file under the project's root, for plugins whose edits go elsewhere (a locale's messages). */\n read(file: string): string;\n}\n\n/** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */\nexport class Refusal extends Error {\n override name = 'Refusal';\n}\n\n/**\n * A change the plugin made itself, not to a file: what its `undo` and `redo` need to take it back and\n * make it again. JSON, since the history keeps it on disk across restarts of the dev server.\n */\nexport interface Done<Record = unknown> {\n done: Record;\n}\n\ntype Maybe<T> = T | Promise<T>;\n\n/**\n * Each plugin's API to the others on the server, by name. A plugin adds its own, so `use` knows its type:\n * `declare module 'deictic' { interface ServerApis { screenshots: Screenshots } }`.\n */\n// oxlint-disable-next-line typescript/no-empty-interface -- filled by declaration merging\nexport interface ServerApis {}\n\n/** The same, in the page: `declare module 'deictic' { interface ClientApis { screenshots: Capture } }`. */\n// oxlint-disable-next-line typescript/no-empty-interface -- filled by declaration merging\nexport interface ClientApis {}\n\n/** A plugin's API, by its name: what its package declared, or `unknown` for one that declared none. */\nexport type ApiOf<Apis, Name extends string> = Name extends keyof Apis ? Apis[Name] : unknown;\n\nexport interface ServerContext {\n /** The project's root, as an absolute path. */\n root: string;\n /**\n * Another plugin's API, as its `setup` answered it, or nothing when it isn't loaded. One the plugin\n * `needs` always is; any other may not be, so check.\n */\n use: <Name extends string>(name: Name) => ApiOf<ServerApis, Name> | undefined;\n}\n\n/**\n * A route of the plugin's own, at `/__deictic/plugins/<name>/<route>`, and below it. A `GET` must\n * change nothing: anything else reaches it only from the page itself, which deictic checks.\n */\nexport type Route = (request: Request, context: ServerContext) => Maybe<Response>;\n\nexport interface ServerPlugin<Model = unknown, Op = unknown, Record = unknown, Api = unknown> {\n /** Ties the halves together; also the label of its changes in the history, and its routes' path. Lowercase, with `-`. */\n name: string;\n /** The module the page loads for this plugin's half there, which default-exports its `ClientPlugin`. */\n client?: string;\n /** What the page half gets as `context.options`: the user's options it needs there, as JSON. */\n clientOptions?: unknown;\n /** What opens its panel: its own default, which its options let the user change. A plugin with no panel has none. */\n shortcut?: Shortcut;\n /** The plugins it can't do without, by name: the dev server won't start without them. */\n needs?: string[];\n /** Runs once, as the dev server starts and before it answers anything. Answers the plugin's API to the others. */\n setup?(context: ServerContext): Maybe<Api>;\n /** Routes of its own, by their first segment under `/__deictic/plugins/<name>/`. */\n routes?: { [route: string]: Route };\n /** The model its panel shows for an element. Without it, the panel gets none. */\n read?(source: Source, target: Target): Maybe<Model>;\n /** Text edits for deictic to write, or a change the plugin made itself. */\n apply?(source: Source, target: Target, op: Op): Maybe<TextEdit[] | Done<Record>>;\n /**\n * Takes back a change `apply` made itself, or throws a `Refusal` saying why it can't any more. It may\n * answer what the next redo needs, where that differs (what it put back has a new ID).\n */\n undo?(record: Record): Maybe<void | Record>;\n /** Makes it again after an undo, and answers what the next undo needs, which may differ (a new ID). */\n redo?(record: Record): Maybe<Record>;\n /** Says what an op does, for the history: `className: px-2 → px-4`. */\n describe?(op: Op, before: Model): string;\n}\n\nexport const definePlugin = <Model, Op, Record = unknown, Api = unknown>(\n plugin: ServerPlugin<Model, Op, Record, Api>,\n): ServerPlugin<Model, Op, Record, Api> => plugin;\n\nexport interface ClientContext {\n /** The dev server's base URL, ending in `/`. */\n base: string;\n /** deictic's shadow root, to draw in: neither the page's styles nor the overlay's cross over. */\n root: ShadowRoot;\n /** The server half's `clientOptions`, or nothing. */\n options: unknown;\n /** Another plugin's API in the page, as its `setup` answered it, or nothing when it isn't loaded. */\n use: <Name extends string>(name: Name) => ApiOf<ClientApis, Name> | undefined;\n /** Asks one of this plugin's own routes, from the page: `request('shots', { method: 'POST', body: blob })`. */\n request: (route: string, init?: RequestInit) => Promise<Response>;\n /**\n * Opens the popup on an element at a plugin's tab, as its shortcut would: after a recording, say. An\n * element rendered again since stands in for one no longer on the page. False when there's no such tab\n * or no such element any more. Not from `setup`, which runs before the popup can open.\n */\n open: (plugin: string, element: Element) => boolean;\n /**\n * Shows `items` in the lightbox over everything, at `at` (the first by default), stepping between them with\n * ← and →. With `from`, it grows out of that element (the chip clicked) and shrinks back into it on close.\n */\n lightbox: (items: LightboxItem[], options?: LightboxOptions) => { close: () => void };\n}\n\n/** What the lightbox shows: a picture, a page in a frame (a recording's replay), or a sound with its waveform. */\nexport type LightboxItem = {\n /** Its name, over it. */\n title: string;\n /** Buttons beside the name: each closes the lightbox and runs. */\n actions?: LightboxAction[];\n} & ({ kind: 'image'; url: string } | { kind: 'page'; url: string } | { kind: 'audio'; url: string });\n\nexport interface LightboxAction {\n label: string;\n title?: string;\n run: () => void;\n}\n\nexport interface LightboxOptions {\n /** The item it opens at. */\n at?: number;\n /** The element it grows out of, and goes back into. */\n from?: Element;\n}\n\nexport interface PanelContext<Model, Op> extends ClientContext {\n /** The element clicked: the one the source marked, under the pointer or around what is. */\n element: Element;\n /**\n * What was under the pointer, where it isn't `element` but inside it: markup nothing marked, as a\n * dependency's, or in an open shadow root, as the popup's own on a page that shows it (`popupIn`).\n */\n pointed?: Element;\n /** Every element on the page from the same place in the source, the clicked one among them: the rows of a list. */\n elements: Element[];\n target: Target;\n model: Model;\n /** Applies an op on disk, and reads the model again. Rejects with the server's reason, which the panel also shows. */\n apply(op: Op): Promise<Model>;\n close: () => void;\n /**\n * Says there's something here that leaving would lose (words typed, a change tried on the page), and the button\n * that keeps it: a click outside the popup then shakes that button, where it would have closed the popup.\n * `undefined` once there's nothing to lose. Forgotten as the panel unmounts.\n */\n unsaved: (action: HTMLElement | undefined) => void;\n /**\n * Leaves the popup to do something on the page, then comes back: closes it, runs `task` (a recording, a\n * pick of another element), and opens it again at this tab on this element. The next mount gets\n * `resumed`: the `state` kept now (what was typed, what's attached), and what `task` answered, or why\n * it failed. The state stays in the page, as it is: no need for JSON.\n */\n away: <T>(state: unknown, task: () => Promise<T>) => void;\n /** Set when this mount is the panel coming back from `away`. */\n resumed?: Resumed;\n}\n\n/** What a panel coming back from `away` gets: the state it kept, and the task's result or problem. */\nexport interface Resumed {\n state: unknown;\n result?: unknown;\n /** Why the task failed: its error's message. */\n problem?: string;\n}\n\nexport interface ClientPlugin<Model = unknown, Op = unknown, Api = unknown> {\n /** The server half's `name`. */\n name: string;\n /** Shown over the element while its shortcut's keys are held, and atop the panel. */\n label?: string;\n /**\n * Runs once, as the page starts, before any panel opens (a recording starts here). Answers the\n * plugin's API to the others in the page, at once: one that needs time keeps its promises inside it.\n */\n setup?(context: ClientContext): Api;\n /** Draws into `panel`, inside deictic's shadow root. Returns what to undo on the page when the panel closes. */\n mount?: (panel: HTMLElement, context: PanelContext<Model, Op>) => (() => void) | void;\n}\n\nexport const defineClientPlugin = <Model, Op, Api = unknown>(plugin: ClientPlugin<Model, Op, Api>): ClientPlugin<Model, Op, Api> => plugin;\n"],"mappings":";;AA8DA,IAAa,UAAb,cAA6B,MAAM;CACxB,OAAO;AAClB;AAwEA,MAAa,gBACX,WACyC;AAqG3C,MAAa,sBAAgD,WAAuE"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `deictic`: what a plugin is. Every plugin is optional: deictic itself is the glue (the\n * transform that ties elements to source, the dev server's endpoints, the history, shortcuts and the\n * overlay's panel), and each plugin adds what it does on top.\n *\n * A plugin has two halves, each optional that meet over the dev server's endpoints (`tools/endpoints.ts`). The\n * server half runs beside the bundler and is the only one that reads source: it turns the element\n * under the pointer into a model its panel can show, and an op from that panel into text edits. It\n * never writes files; deictic does, so every plugin's changes land in one history and undo the\n * same way. A change that isn't to a file (a task added to a board) the plugin makes itself and\n * answers with what it did (`Done`): the history keeps that beside the files' changes and hands it\n * back to the plugin's own `undo` and `redo`.\n * The client half is a module the page loads, named by the server half's `client`, which draws the\n * panel and previews an op on the page before it is applied.\n *\n * A plugin may have no panel at all, only an API for others (screenshots, a recording) and routes of\n * its own on the dev server. Each half's `setup` answers its API, and `use(name)` reaches another\n * plugin's, on the same side; `needs` names the plugins it can't do without.\n *\n * Both halves import from here, so the parser is imported for its types only: the browser must not load it.\n */\nimport type { JSXOpeningElement, Program } from 'oxc-parser';\n\nimport type { Shortcut } from './shortcut.ts';\n\nexport type { Modifier, Shortcut } from './shortcut.ts';\n\n/** A place in the source: the file from the project's root, with `/`, and the line and column, from 1. */\nexport interface Loc {\n file: string;\n line: number;\n column: number;\n}\n\n/** An element the pointer picked: where its opening tag starts, and the tag, which the server checks is still there. */\nexport interface Target {\n loc: Loc;\n tag: string;\n}\n\n/** Text in a file to replace, by UTF-16 offsets. `file` is the target's unless named, from the project's root. */\nexport interface TextEdit {\n file?: string;\n start: number;\n end: number;\n text: string;\n}\n\n/** What a server half reads: the target's file, parsed, and its element. */\nexport interface Source {\n /** The target's file, from the project's root. */\n file: string;\n code: string;\n /** The file's module; for an `.astro` component, its frontmatter's. */\n program: Program;\n /** The target's opening tag. */\n element: JSXOpeningElement;\n /** Another file under the project's root, for plugins whose edits go elsewhere (a locale's messages). */\n read(file: string): string;\n}\n\n/**\n * What answers the overlay's requests in a page with no dev server behind it (`deictic/vite`'s `standalone`): the\n * default export of a module of the page's. A request is one the endpoints would get, under `<base>__deictic/`;\n * the answer is theirs too (`{ model }`, `{ model, change }`, `{ problem }` with a status that isn't ok).\n */\nexport type Standalone = (request: Request) => Response | Promise<Response>;\n\n/** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */\nexport class Refusal extends Error {\n override name = 'Refusal';\n}\n\n/**\n * A change the plugin made itself, not to a file: what its `undo` and `redo` need to take it back and\n * make it again. JSON, since the history keeps it on disk across restarts of the dev server.\n */\nexport interface Done<Record = unknown> {\n done: Record;\n}\n\ntype Maybe<T> = T | Promise<T>;\n\n/**\n * Each plugin's API to the others on the server, by name. A plugin adds its own, so `use` knows its type:\n * `declare module 'deictic' { interface ServerApis { screenshots: Screenshots } }`.\n */\n// oxlint-disable-next-line typescript/no-empty-interface -- filled by declaration merging\nexport interface ServerApis {}\n\n/** The same, in the page: `declare module 'deictic' { interface ClientApis { screenshots: Capture } }`. */\n// oxlint-disable-next-line typescript/no-empty-interface -- filled by declaration merging\nexport interface ClientApis {}\n\n/** A plugin's API, by its name: what its package declared, or `unknown` for one that declared none. */\nexport type ApiOf<Apis, Name extends string> = Name extends keyof Apis ? Apis[Name] : unknown;\n\nexport interface ServerContext {\n /** The project's root, as an absolute path. */\n root: string;\n /**\n * Another plugin's API, as its `setup` answered it, or nothing when it isn't loaded. One the plugin\n * `needs` always is; any other may not be, so check.\n */\n use: <Name extends string>(name: Name) => ApiOf<ServerApis, Name> | undefined;\n}\n\n/**\n * A route of the plugin's own, at `/__deictic/plugins/<name>/<route>`, and below it. A `GET` must\n * change nothing: anything else reaches it only from the page itself, which deictic checks.\n */\nexport type Route = (request: Request, context: ServerContext) => Maybe<Response>;\n\nexport interface ServerPlugin<Model = unknown, Op = unknown, Record = unknown, Api = unknown> {\n /** Ties the halves together; also the label of its changes in the history, and its routes' path. Lowercase, with `-`. */\n name: string;\n /** The module the page loads for this plugin's half there, which default-exports its `ClientPlugin`. */\n client?: string;\n /** What the page half gets as `context.options`: the user's options it needs there, as JSON. */\n clientOptions?: unknown;\n /** What opens its panel: its own default, which its options let the user change. A plugin with no panel has none. */\n shortcut?: Shortcut;\n /** The plugins it can't do without, by name: the dev server won't start without them. */\n needs?: string[];\n /** Runs once, as the dev server starts and before it answers anything. Answers the plugin's API to the others. */\n setup?(context: ServerContext): Maybe<Api>;\n /** Routes of its own, by their first segment under `/__deictic/plugins/<name>/`. */\n routes?: { [route: string]: Route };\n /** The model its panel shows for an element. Without it, the panel gets none. */\n read?(source: Source, target: Target): Maybe<Model>;\n /** Text edits for deictic to write, or a change the plugin made itself. */\n apply?(source: Source, target: Target, op: Op): Maybe<TextEdit[] | Done<Record>>;\n /**\n * Takes back a change `apply` made itself, or throws a `Refusal` saying why it can't any more. It may\n * answer what the next redo needs, where that differs (what it put back has a new ID).\n */\n undo?(record: Record): Maybe<void | Record>;\n /** Makes it again after an undo, and answers what the next undo needs, which may differ (a new ID). */\n redo?(record: Record): Maybe<Record>;\n /** Says what an op does, for the history: `className: px-2 → px-4`. */\n describe?(op: Op, before: Model): string;\n}\n\nexport const definePlugin = <Model, Op, Record = unknown, Api = unknown>(\n plugin: ServerPlugin<Model, Op, Record, Api>,\n): ServerPlugin<Model, Op, Record, Api> => plugin;\n\nexport interface ClientContext {\n /** The dev server's base URL, ending in `/`. */\n base: string;\n /** deictic's shadow root, to draw in: neither the page's styles nor the overlay's cross over. */\n root: ShadowRoot;\n /** The server half's `clientOptions`, or nothing. */\n options: unknown;\n /** Another plugin's API in the page, as its `setup` answered it, or nothing when it isn't loaded. */\n use: <Name extends string>(name: Name) => ApiOf<ClientApis, Name> | undefined;\n /** Asks one of this plugin's own routes, from the page: `request('shots', { method: 'POST', body: blob })`. */\n request: (route: string, init?: RequestInit) => Promise<Response>;\n /**\n * Opens the popup on an element at a plugin's tab, as its shortcut would: after a recording, say. An\n * element rendered again since stands in for one no longer on the page. False when there's no such tab\n * or no such element any more. Not from `setup`, which runs before the popup can open.\n */\n open: (plugin: string, element: Element) => boolean;\n /**\n * Shows `items` in the lightbox over everything, at `at` (the first by default), stepping between them with\n * ← and →. With `from`, it grows out of that element (the chip clicked) and shrinks back into it on close.\n */\n lightbox: (items: LightboxItem[], options?: LightboxOptions) => { close: () => void };\n}\n\n/** What the lightbox shows: a picture, a page in a frame (a recording's replay), or a sound with its waveform. */\nexport type LightboxItem = {\n /** Its name, over it. */\n title: string;\n /** Buttons beside the name: each closes the lightbox and runs. */\n actions?: LightboxAction[];\n} & ({ kind: 'image'; url: string } | { kind: 'page'; url: string } | { kind: 'audio'; url: string });\n\nexport interface LightboxAction {\n label: string;\n title?: string;\n run: () => void;\n}\n\nexport interface LightboxOptions {\n /** The item it opens at. */\n at?: number;\n /** The element it grows out of, and goes back into. */\n from?: Element;\n}\n\nexport interface PanelContext<Model, Op> extends ClientContext {\n /**\n * The element clicked: the one the source marked, under the pointer or around what is. Back from `away`\n * it may be off the page (`isConnected` is false), where the page moved on without it: the element as it\n * was left, or after a page load an empty one of its tag and mark. `elements` is then empty.\n */\n element: Element;\n /**\n * What was under the pointer, where it isn't `element` but inside it: markup nothing marked, as a\n * dependency's, or in an open shadow root, as the popup's own on a page that shows it (`popupIn`).\n */\n pointed?: Element;\n /** Every element on the page from the same place in the source, the clicked one among them: the rows of a list. */\n elements: Element[];\n target: Target;\n model: Model;\n /** Applies an op on disk, and reads the model again. Rejects with the server's reason, which the panel also shows. */\n apply(op: Op): Promise<Model>;\n close: () => void;\n /**\n * Says there's something here that leaving would lose (words typed, a change tried on the page), and the button\n * that keeps it: a click outside the popup then shakes that button, where it would have closed the popup.\n * `undefined` once there's nothing to lose. Forgotten as the panel unmounts.\n */\n unsaved: (action: HTMLElement | undefined) => void;\n /**\n * Leaves the popup to do something on the page, then comes back: closes it, runs `task` (a recording, a\n * pick of another element), and opens it again at this tab on this element. The next mount gets\n * `resumed`: the `state` kept now (what was typed, what's attached), and what `task` answered, or why\n * it failed. The state stays in the page, as it is: no need for JSON. It's also kept for the tab's next\n * page, as a structured clone, where it can be one: after a page load, the plugin's `resume` says whether\n * the task carries on, and the popup comes back there.\n */\n away: <T>(state: unknown, task: () => Promise<T>) => void;\n /** Set when this mount is the panel coming back from `away`. */\n resumed?: Resumed;\n}\n\n/** What a panel coming back from `away` gets: the state it kept, and the task's result or problem. */\nexport interface Resumed {\n state: unknown;\n result?: unknown;\n /** Why the task failed: its error's message. */\n problem?: string;\n}\n\nexport interface ClientPlugin<Model = unknown, Op = unknown, Api = unknown> {\n /** The server half's `name`. */\n name: string;\n /** Shown over the element while its shortcut's keys are held, and atop the panel. */\n label?: string;\n /**\n * Runs once, as the page starts, before any panel opens (a recording starts here). Answers the\n * plugin's API to the others in the page, at once: one that needs time keeps its promises inside it.\n */\n setup?(context: ClientContext): Api;\n /**\n * Asked as a page starts where the page before it left this plugin's panel `away`: the task it left for,\n * where that carries on in this page (a recording does), or nothing where it ended with the page. When it's\n * done the popup opens at this tab with `resumed`, on the element where this page has it and without where not.\n */\n resume?(context: ClientContext): Promise<unknown> | undefined;\n /** Draws into `panel`, inside deictic's shadow root. Returns what to undo on the page when the panel closes. */\n mount?: (panel: HTMLElement, context: PanelContext<Model, Op>) => (() => void) | void;\n}\n\nexport const defineClientPlugin = <Model, Op, Api = unknown>(plugin: ClientPlugin<Model, Op, Api>): ClientPlugin<Model, Op, Api> => plugin;\n"],"mappings":";;AAqEA,IAAa,UAAb,cAA6B,MAAM;CACxB,OAAO;AAClB;AAwEA,MAAa,gBACX,WACyC;AAiH3C,MAAa,sBAAgD,WAAuE"}
|
package/dist/loader.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/logs/client.ts"],"mappings":";cAMA,4B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineClientPlugin } from "../index.js";
|
|
2
|
+
// src/plugins/logs/client.ts
|
|
3
|
+
/** The logs plugin's page half: rrweb's console plugin, imported as a recording first asks for it. */
|
|
4
|
+
var client_default = defineClientPlugin({
|
|
5
|
+
name: "logs",
|
|
6
|
+
setup: ({ options }) => ({ plugin: async () => {
|
|
7
|
+
const { getRecordConsolePlugin } = await import("@rrweb/rrweb-plugin-console-record").catch((e) => {
|
|
8
|
+
throw new Error("logs needs @rrweb/rrweb-plugin-console-record: add it to your devDependencies", { cause: e });
|
|
9
|
+
});
|
|
10
|
+
const { levels } = options ?? {};
|
|
11
|
+
return getRecordConsolePlugin(levels === void 0 ? {} : { level: levels });
|
|
12
|
+
} })
|
|
13
|
+
});
|
|
14
|
+
export { client_default as default };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/logs/client.ts"],"sourcesContent":["/** The logs plugin's page half: rrweb's console plugin, imported as a recording first asks for it. */\nimport { defineClientPlugin } from '#src/index.ts';\nimport type { Recorded } from '#src/plugins/recordings/index.ts';\n\nimport type { Level } from './index.ts';\n\nexport default defineClientPlugin<never, never, Recorded>({\n name: 'logs',\n setup: ({ options }) => ({\n plugin: async () => {\n const { getRecordConsolePlugin } = await import('@rrweb/rrweb-plugin-console-record').catch((e: unknown) => {\n throw new Error('logs needs @rrweb/rrweb-plugin-console-record: add it to your devDependencies', { cause: e });\n });\n const { levels } = (options ?? {}) as { levels?: Level[] };\n return getRecordConsolePlugin(levels === undefined ? {} : { level: levels });\n },\n }),\n});\n"],"mappings":";;;AAMA,IAAA,iBAAe,mBAA2C;CACxD,MAAM;CACN,QAAQ,EAAE,eAAe,EACvB,QAAQ,YAAY;EAClB,MAAM,EAAE,2BAA2B,MAAM,OAAO,qCAAqC,CAAC,OAAO,MAAe;GAC1G,MAAM,IAAI,MAAM,iFAAiF,EAAE,OAAO,EAAE,CAAC;EAC/G,CAAC;EACD,MAAM,EAAE,WAAY,WAAW,CAAC;EAChC,OAAO,uBAAuB,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,OAAO,CAAC;CAC7E,EACF;AACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { i as Recorded } from "../shared/index3.js";
|
|
2
|
+
/** What of the console is kept: its methods, by name. */
|
|
3
|
+
export type Level = 'assert' | 'count' | 'countReset' | 'debug' | 'dir' | 'dirxml' | 'error' | 'group' | 'groupCollapsed' | 'info' | 'log' | 'table' | 'time' | 'timeEnd' | 'timeLog' | 'trace' | 'warn';
|
|
4
|
+
export interface LogsOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The console's methods kept, `['warn', 'error']` for the least: every one that says something by default. Errors
|
|
7
|
+
* nothing caught, and rejections nothing handled, come with `error`.
|
|
8
|
+
*/
|
|
9
|
+
levels?: Level[];
|
|
10
|
+
}
|
|
11
|
+
declare module 'deictic' {
|
|
12
|
+
interface ClientApis {
|
|
13
|
+
logs: Recorded;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export declare function logs(options?: LogsOptions): import("deictic").ServerPlugin<never, never, unknown, unknown>;
|
|
17
|
+
export { logs as default };
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugins/logs/index.ts"],"mappings":";;YAaY;iBAmBK;;;;;EAKf,SAAS;;;YAIC;IACR,MAAM;;;wBAIM,KAAK,UAAS,gCAAgB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { definePlugin } from "../index.js";
|
|
2
|
+
// src/plugins/logs/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* `deictic/logs`: what the page logs while it's recorded, and the errors nothing caught, in the recording, each at
|
|
5
|
+
* its moment. No tab, and nothing of its own: it hands the recordings plugin rrweb's console plugin
|
|
6
|
+
* (`@rrweb/rrweb-plugin-console-record`, an optional peer), whose events are rrweb's (`rrweb/console@1`).
|
|
7
|
+
*
|
|
8
|
+
* A wrapped console names the wrapper, not the caller, as each line's source in the browser's tools. rrweb wraps it
|
|
9
|
+
* as a recording starts and puts it back as it stops, so it's the page's own the rest of the time. Leave the plugin
|
|
10
|
+
* out and it never is.
|
|
11
|
+
*/
|
|
12
|
+
function logs(options = {}) {
|
|
13
|
+
return definePlugin({
|
|
14
|
+
name: "logs",
|
|
15
|
+
client: "deictic/logs/client",
|
|
16
|
+
clientOptions: { levels: options.levels }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export { logs as default, logs };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/plugins/logs/index.ts"],"sourcesContent":["/**\n * `deictic/logs`: what the page logs while it's recorded, and the errors nothing caught, in the recording, each at\n * its moment. No tab, and nothing of its own: it hands the recordings plugin rrweb's console plugin\n * (`@rrweb/rrweb-plugin-console-record`, an optional peer), whose events are rrweb's (`rrweb/console@1`).\n *\n * A wrapped console names the wrapper, not the caller, as each line's source in the browser's tools. rrweb wraps it\n * as a recording starts and puts it back as it stops, so it's the page's own the rest of the time. Leave the plugin\n * out and it never is.\n */\nimport { definePlugin } from '#src/index.ts';\nimport type { Recorded } from '#src/plugins/recordings/index.ts';\n\n/** What of the console is kept: its methods, by name. */\nexport type Level =\n | 'assert'\n | 'count'\n | 'countReset'\n | 'debug'\n | 'dir'\n | 'dirxml'\n | 'error'\n | 'group'\n | 'groupCollapsed'\n | 'info'\n | 'log'\n | 'table'\n | 'time'\n | 'timeEnd'\n | 'timeLog'\n | 'trace'\n | 'warn';\n\nexport interface LogsOptions {\n /**\n * The console's methods kept, `['warn', 'error']` for the least: every one that says something by default. Errors\n * nothing caught, and rejections nothing handled, come with `error`.\n */\n levels?: Level[];\n}\n\ndeclare module 'deictic' {\n interface ClientApis {\n logs: Recorded;\n }\n}\n\nexport function logs(options: LogsOptions = {}) {\n return definePlugin<never, never>({\n name: 'logs',\n client: 'deictic/logs/client',\n clientOptions: { levels: options.levels },\n });\n}\n\nexport default logs;\n"],"mappings":";;;;;;;;;;;AA8CA,SAAgB,KAAK,UAAuB,CAAC,GAAG;CAC9C,OAAO,aAA2B;EAChC,MAAM;EACN,QAAQ;EACR,eAAe,EAAE,QAAQ,QAAQ,OAAO;CAC1C,CAAC;AACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/network/client.ts"],"mappings":";cAUA,4B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineClientPlugin } from "../index.js";
|
|
2
|
+
import { i as maskRequest } from "../shared/mask.js";
|
|
3
|
+
// src/plugins/network/client.ts
|
|
4
|
+
/**
|
|
5
|
+
* The network plugin's page half: rrweb's network plugin, imported as a recording first asks for it, with every
|
|
6
|
+
* request masked before rrweb has it.
|
|
7
|
+
*/
|
|
8
|
+
var client_default = defineClientPlugin({
|
|
9
|
+
name: "network",
|
|
10
|
+
setup: ({ options }) => ({ plugin: async ({ sinceLoad }) => {
|
|
11
|
+
const { getRecordNetworkPlugin } = await import("@rrweb/rrweb-plugin-network-record").catch((e) => {
|
|
12
|
+
throw new Error("network needs @rrweb/rrweb-plugin-network-record: add it to your devDependencies", { cause: e });
|
|
13
|
+
});
|
|
14
|
+
const { initiators, headers, body, mask, ignore } = options;
|
|
15
|
+
return getRecordNetworkPlugin({
|
|
16
|
+
initiatorTypes: initiators,
|
|
17
|
+
recordHeaders: headers,
|
|
18
|
+
recordBody: body,
|
|
19
|
+
recordInitialRequests: sinceLoad,
|
|
20
|
+
transformRequestFn: (request) => maskRequest(request, {
|
|
21
|
+
mask,
|
|
22
|
+
ignore
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
} })
|
|
26
|
+
});
|
|
27
|
+
export { client_default as default };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/network/client.ts"],"sourcesContent":["/**\n * The network plugin's page half: rrweb's network plugin, imported as a recording first asks for it, with every\n * request masked before rrweb has it.\n */\nimport { defineClientPlugin } from '#src/index.ts';\nimport type { Recorded } from '#src/plugins/recordings/index.ts';\n\nimport type { Resolved } from './index.ts';\nimport { maskRequest } from './mask.ts';\n\nexport default defineClientPlugin<never, never, Recorded>({\n name: 'network',\n setup: ({ options }) => ({\n plugin: async ({ sinceLoad }) => {\n const { getRecordNetworkPlugin } = await import('@rrweb/rrweb-plugin-network-record').catch((e: unknown) => {\n throw new Error('network needs @rrweb/rrweb-plugin-network-record: add it to your devDependencies', { cause: e });\n });\n const { initiators, headers, body, mask, ignore } = options as Resolved;\n type Options = NonNullable<Parameters<typeof getRecordNetworkPlugin>[0]>;\n return getRecordNetworkPlugin({\n initiatorTypes: initiators as NonNullable<Options['initiatorTypes']>,\n recordHeaders: headers,\n recordBody: body,\n // What the page asked for as it loaded, where the recording was going by then: before, it's not the recording's.\n recordInitialRequests: sinceLoad,\n transformRequestFn: (request) => maskRequest(request, { mask, ignore }),\n });\n },\n }),\n});\n"],"mappings":";;;;;;;AAUA,IAAA,iBAAe,mBAA2C;CACxD,MAAM;CACN,QAAQ,EAAE,eAAe,EACvB,QAAQ,OAAO,EAAE,gBAAgB;EAC/B,MAAM,EAAE,2BAA2B,MAAM,OAAO,qCAAqC,CAAC,OAAO,MAAe;GAC1G,MAAM,IAAI,MAAM,oFAAoF,EAAE,OAAO,EAAE,CAAC;EAClH,CAAC;EACD,MAAM,EAAE,YAAY,SAAS,MAAM,MAAM,WAAW;EAEpD,OAAO,uBAAuB;GAC5B,gBAAgB;GAChB,eAAe;GACf,YAAY;GAEZ,uBAAuB;GACvB,qBAAqB,YAAY,YAAY,SAAS;IAAE;IAAM;GAAO,CAAC;EACxE,CAAC;CACH,EACF;AACF,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as maskBody, c as maskUrl, i as MASKED, l as sensitive, n as Resolved, o as maskHeaders, r as network, s as maskRequest, t as NetworkOptions } from "../shared/index4.js";
|
|
2
|
+
export { MASKED, NetworkOptions, Resolved, network as default, network, maskBody, maskHeaders, maskRequest, maskUrl, sensitive };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { definePlugin } from "../index.js";
|
|
2
|
+
import { a as maskUrl, i as maskRequest, n as maskBody, o as sensitive, r as maskHeaders, t as MASKED } from "../shared/mask.js";
|
|
3
|
+
// src/plugins/network/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* `deictic/network`: the requests the page makes while it's recorded, in the recording, each as it ends. No tab,
|
|
6
|
+
* and nothing of its own: it hands the recordings plugin rrweb's network plugin
|
|
7
|
+
* (`@rrweb/rrweb-plugin-network-record`, an optional peer), whose events are rrweb's (`rrweb/network@1`).
|
|
8
|
+
*
|
|
9
|
+
* By default a request is its URL, its status and its timing, which the browser reports of itself
|
|
10
|
+
* (`PerformanceObserver`): nothing of the page's is wrapped, and no method is known. `headers` and `body` add those
|
|
11
|
+
* and the method, for which rrweb wraps `fetch` and `XMLHttpRequest` while a recording is going, and only then.
|
|
12
|
+
*
|
|
13
|
+
* Everything kept is masked first (`mask.ts`): a secret in a URL's query, a header or a body's field is blanked by
|
|
14
|
+
* its name, and deictic's own requests are left out.
|
|
15
|
+
*/
|
|
16
|
+
/** The bodies kept with `body: true`: what reads as text. */
|
|
17
|
+
const TEXT = [
|
|
18
|
+
"application/json",
|
|
19
|
+
"+json",
|
|
20
|
+
"text/",
|
|
21
|
+
"application/x-www-form-urlencoded",
|
|
22
|
+
"application/xml"
|
|
23
|
+
];
|
|
24
|
+
function network(options = {}) {
|
|
25
|
+
return definePlugin({
|
|
26
|
+
name: "network",
|
|
27
|
+
client: "deictic/network/client",
|
|
28
|
+
clientOptions: {
|
|
29
|
+
initiators: options.initiators ?? ["fetch", "xmlhttprequest"],
|
|
30
|
+
headers: options.headers ?? false,
|
|
31
|
+
body: options.body === true ? TEXT : options.body ?? false,
|
|
32
|
+
mask: options.mask ?? [],
|
|
33
|
+
ignore: options.ignore ?? []
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export { MASKED, network as default, network, maskBody, maskHeaders, maskRequest, maskUrl, sensitive };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/plugins/network/index.ts"],"sourcesContent":["/**\n * `deictic/network`: the requests the page makes while it's recorded, in the recording, each as it ends. No tab,\n * and nothing of its own: it hands the recordings plugin rrweb's network plugin\n * (`@rrweb/rrweb-plugin-network-record`, an optional peer), whose events are rrweb's (`rrweb/network@1`).\n *\n * By default a request is its URL, its status and its timing, which the browser reports of itself\n * (`PerformanceObserver`): nothing of the page's is wrapped, and no method is known. `headers` and `body` add those\n * and the method, for which rrweb wraps `fetch` and `XMLHttpRequest` while a recording is going, and only then.\n *\n * Everything kept is masked first (`mask.ts`): a secret in a URL's query, a header or a body's field is blanked by\n * its name, and deictic's own requests are left out.\n */\nimport { definePlugin } from '#src/index.ts';\nimport type { Recorded } from '#src/plugins/recordings/index.ts';\n\nexport { MASKED, maskBody, maskHeaders, maskRequest, maskUrl, sensitive } from './mask.ts';\n\nexport interface NetworkOptions {\n /**\n * What made the requests kept, as the browser names it (a resource's `initiatorType`): `['fetch',\n * 'xmlhttprequest']` by default, the page's own calls. `'img'`, `'script'`, `'css'` and the like add what it loads.\n */\n initiators?: string[];\n /** Keeps each request's and response's headers, the secret ones blanked (`Authorization`, `Cookie`, …): not by default. */\n headers?: boolean;\n /**\n * Keeps each request's and response's body, cut at 10,000 characters, secrets blanked by name where it's JSON or a\n * form's fields: not by default. `true` is JSON, text and forms; a list names the content types, by a part of each.\n */\n body?: boolean | string[];\n /** More names whose values are blanked, in a query, a header or a body: a part of the name, in any case (`['email']`). */\n mask?: string[];\n /** Requests left out whole: a part of the URL (`['/analytics', 'sentry.io']`). */\n ignore?: string[];\n}\n\n/** The options as the page half gets them. */\nexport interface Resolved {\n initiators: string[];\n headers: boolean;\n body: false | string[];\n mask: string[];\n ignore: string[];\n}\n\ndeclare module 'deictic' {\n interface ClientApis {\n network: Recorded;\n }\n}\n\n/** The bodies kept with `body: true`: what reads as text. */\nconst TEXT = ['application/json', '+json', 'text/', 'application/x-www-form-urlencoded', 'application/xml'];\n\nexport function network(options: NetworkOptions = {}) {\n return definePlugin<never, never>({\n name: 'network',\n client: 'deictic/network/client',\n clientOptions: {\n initiators: options.initiators ?? ['fetch', 'xmlhttprequest'],\n headers: options.headers ?? false,\n body: options.body === true ? TEXT : (options.body ?? false),\n mask: options.mask ?? [],\n ignore: options.ignore ?? [],\n } satisfies Resolved,\n });\n}\n\nexport default network;\n"],"mappings":";;;;;;;;;;;;;;;;AAoDA,MAAM,OAAO;CAAC;CAAoB;CAAS;CAAS;CAAqC;AAAiB;AAE1G,SAAgB,QAAQ,UAA0B,CAAC,GAAG;CACpD,OAAO,aAA2B;EAChC,MAAM;EACN,QAAQ;EACR,eAAe;GACb,YAAY,QAAQ,cAAc,CAAC,SAAS,gBAAgB;GAC5D,SAAS,QAAQ,WAAW;GAC5B,MAAM,QAAQ,SAAS,OAAO,OAAQ,QAAQ,QAAQ;GACtD,MAAM,QAAQ,QAAQ,CAAC;GACvB,QAAQ,QAAQ,UAAU,CAAC;EAC7B;CACF,CAAC;AACH"}
|
package/dist/next.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DeicticOptions } from "./integration.js";
|
|
1
|
+
import { t as DeicticOptions } from "./shared/integration.js";
|
|
2
2
|
export interface DeicticNextOptions extends DeicticOptions {
|
|
3
3
|
/** The project's root, which marks and edits are from: the working directory `next dev` runs in by default. */
|
|
4
4
|
root?: string;
|
package/dist/next.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createServer } from "node:http";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
-
import { n as nodeMiddleware, r as redirect, t as endpoints } from "./endpoints.js";
|
|
4
|
-
import { d as JSX, o as prepare, s as writeClient, t as beside } from "./integration.js";
|
|
3
|
+
import { n as nodeMiddleware, r as redirect, t as endpoints } from "./shared/endpoints.js";
|
|
4
|
+
import { d as JSX, o as prepare, s as writeClient, t as beside } from "./shared/integration.js";
|
|
5
5
|
// src/next.ts
|
|
6
6
|
/**
|
|
7
7
|
* `deictic/next`: deictic in `next dev`, on Turbopack or webpack (`--webpack`). Nothing runs in `next build`.
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `deictic/recommended`: the plugins for describing a change rather than making it. Alt-click an element, say what
|
|
3
3
|
* should change, attach a screenshot to draw on, a screen recording or your voice, and it goes to a Vercel Board.
|
|
4
|
+
* A recording has the page's console and its requests in it too.
|
|
4
5
|
*
|
|
5
6
|
* Only the server halves, as every factory is: each names its page half, which the integration imports. A plugin
|
|
6
7
|
* outside the preset (Tailwind, your own) goes beside it: `plugins: [...recommended(), tailwind()]`.
|
|
7
8
|
*/
|
|
8
|
-
import { g as ServerPlugin } from "../index.js";
|
|
9
|
+
import { g as ServerPlugin } from "../shared/index.js";
|
|
9
10
|
import { AnnotationsOptions } from "../annotations/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { LogsOptions } from "../logs/index.js";
|
|
12
|
+
import { t as NetworkOptions } from "../shared/index4.js";
|
|
13
|
+
import { c as RecordingsOptions } from "../shared/index3.js";
|
|
14
|
+
import { l as ScreenshotsOptions } from "../shared/index2.js";
|
|
15
|
+
import { p as TasksOptions } from "../shared/index5.js";
|
|
13
16
|
import { VoiceOptions } from "../voice/index.js";
|
|
14
17
|
/** Each plugin's options, by its name, or `false` to leave it out. */
|
|
15
18
|
export interface RecommendedOptions {
|
|
@@ -18,8 +21,15 @@ export interface RecommendedOptions {
|
|
|
18
21
|
annotations?: AnnotationsOptions | false;
|
|
19
22
|
recordings?: RecordingsOptions | false;
|
|
20
23
|
voice?: VoiceOptions | false;
|
|
24
|
+
/** The console's lines in a recording. */
|
|
25
|
+
logs?: LogsOptions | false;
|
|
26
|
+
/** The page's requests in a recording, masked. */
|
|
27
|
+
network?: NetworkOptions | false;
|
|
21
28
|
}
|
|
22
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Tasks, screenshots, annotations, recordings and voice, in that order, the order of their tabs, then what a
|
|
31
|
+
* recording has besides the page: logs and network.
|
|
32
|
+
*/
|
|
23
33
|
export declare function recommended(options?: RecommendedOptions): ServerPlugin[];
|
|
24
34
|
export { recommended as default };
|
|
25
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugins/recommended/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugins/recommended/index.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAkBiB;EACf,QAAQ;EACR,cAAc;EACd,cAAc;EACd,aAAa;EACb,QAAQ;;EAER,OAAO;;EAEP,UAAU;;;;;;wBAOI,YAAY,UAAS,qBAA0B"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { annotations } from "../annotations/index.js";
|
|
2
|
-
import
|
|
2
|
+
import logs from "../logs/index.js";
|
|
3
|
+
import network from "../network/index.js";
|
|
4
|
+
import { t as recordings } from "../shared/recordings.js";
|
|
3
5
|
import screenshots from "../screenshots/index.js";
|
|
4
|
-
import tasks from "../tasks
|
|
6
|
+
import { t as tasks } from "../shared/tasks.js";
|
|
5
7
|
import voice from "../voice/index.js";
|
|
6
8
|
// src/plugins/recommended/index.ts
|
|
7
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* 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.
|
|
12
|
+
*/
|
|
8
13
|
function recommended(options = {}) {
|
|
9
14
|
const plugins = [];
|
|
10
15
|
if (options.tasks !== false) plugins.push(tasks(options.tasks));
|
|
@@ -12,6 +17,8 @@ function recommended(options = {}) {
|
|
|
12
17
|
if (options.annotations !== false) plugins.push(annotations(options.annotations));
|
|
13
18
|
if (options.recordings !== false) plugins.push(recordings(options.recordings));
|
|
14
19
|
if (options.voice !== false) plugins.push(voice(options.voice));
|
|
20
|
+
if (options.recordings !== false && options.logs !== false) plugins.push(logs(options.logs));
|
|
21
|
+
if (options.recordings !== false && options.network !== false) plugins.push(network(options.network));
|
|
15
22
|
return plugins;
|
|
16
23
|
}
|
|
17
24
|
export { recommended as default, recommended };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.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 *\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 { 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}\n\n
|
|
1
|
+
{"version":3,"file":"index.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"}
|