@ouo11y/kit 0.0.0-stage → 0.1.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/CHANGELOG.md +11 -0
- package/LICENSE +201 -0
- package/README.md +26 -2
- package/dist/index.d.ts +114 -0
- package/dist/index.js +182 -0
- package/dist/index.js.map +1 -0
- package/package.json +65 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog: kit
|
|
2
|
+
|
|
3
|
+
npm `@ouo11y/kit`, tag `kit-v<version>`. Policy: `docs/releasing.md`. Design: `docs/adr/0025-generic-libs-clients-own-plugin-and-access.md`.
|
|
4
|
+
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
## 0.1.0 - unreleased
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- First release of `@ouo11y/kit`: `ReplayPlayer` (plays a Muninn manifest with chunks from a fetcher the caller supplies; stream picker, playable runs from a keyframe to a gap, NDJSON joined across chunks), `RrwebPlayer` (React wrapper over `rrweb-player`), the format seam (`formatInfo`: `rrweb/2` plays, pixel and wireframe formats are named, unknown formats are stored, not playable) and the Muninn manifest types.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ouo11y/kit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Frontend building blocks for a client's own ouo11y plugin or app ([ADR-0025](../../docs/adr/0025-generic-libs-clients-own-plugin-and-access.md)): a replay player that plays a Muninn manifest, with chunks fetched by a function you supply. React and `rrweb-player` only: no Grafana dependency, and no backend of ours is assumed. Where the manifest and the chunks come from, and who may see them, is yours to decide.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { ReplayPlayer, type Manifest } from '@ouo11y/kit';
|
|
7
|
+
|
|
8
|
+
<ReplayPlayer
|
|
9
|
+
manifest={manifest} // Muninn spec 7.2, e.g. from ouo-go's Muninn.Manifest
|
|
10
|
+
fetchChunk={(stream, seq) => // decompressed bytes of one chunk, from your backend
|
|
11
|
+
fetch(`/my-backend/replays/${manifest.replay_id}/streams/${stream}/chunks/${seq}`).then((r) => r.arrayBuffer())}
|
|
12
|
+
/>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Your bundler must handle the CSS import of `rrweb-player/dist/style.css` (webpack with `css-loader`, Vite as is).
|
|
16
|
+
|
|
17
|
+
The player picks a stream (a picker when there are several), keeps the runs that start at a keyframe and stop at a gap (Muninn spec RDR-3), concatenates each run's chunks before parsing them (a chunk may end mid-line), and chooses a renderer by `ouo.replay.format`:
|
|
18
|
+
|
|
19
|
+
| Format | Here |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `rrweb/2` | Plays (`RrwebPlayer`) |
|
|
22
|
+
| `ouo-frames/3`, `ouo-video/1` | Shown as stored, not playable yet: the seam for the pixel players |
|
|
23
|
+
| `ouo-wireframe/1`, anything else | Stored, not playable (RPL-24) |
|
|
24
|
+
|
|
25
|
+
Key the player by replay id (`<ReplayPlayer key={replayId} …/>`) when one instance shows several replays, so its state starts fresh. The pieces are exported too: `playableRuns`, `primaryStream`, `parseNdjson`, `formatInfo`, and the manifest types.
|
|
26
|
+
|
|
27
|
+
Released with release-please as component `kit` (tag `kit-v<semver>`) and published by `release-npm.yml` ([releasing](../../docs/releasing.md)). `npm run build -w libs/ouo-kit` (tsup), `npm test -w libs/ouo-kit` (Vitest), `npm run typecheck -w libs/ouo-kit`. Licence Apache-2.0.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/** One entry of a session's replay list (Muninn spec 7.1). */
|
|
4
|
+
interface ReplaySummary {
|
|
5
|
+
replay_id: string;
|
|
6
|
+
/** `open`, `complete` or `partial`. */
|
|
7
|
+
state: string;
|
|
8
|
+
start_time: number;
|
|
9
|
+
end_time: number;
|
|
10
|
+
chunk_count: number;
|
|
11
|
+
byte_size: number;
|
|
12
|
+
formats: string[];
|
|
13
|
+
stream_count: number;
|
|
14
|
+
}
|
|
15
|
+
/** One chunk's entry in a manifest. */
|
|
16
|
+
interface ChunkEntry {
|
|
17
|
+
sequence: number;
|
|
18
|
+
segment_index: number;
|
|
19
|
+
keyframe: boolean;
|
|
20
|
+
start_time: number;
|
|
21
|
+
end_time: number;
|
|
22
|
+
/** `ouo.replay.format`, e.g. `rrweb/2`. */
|
|
23
|
+
format: string;
|
|
24
|
+
encoding: string;
|
|
25
|
+
byte_size: number;
|
|
26
|
+
sha256: string;
|
|
27
|
+
received_at: number;
|
|
28
|
+
/** Every stored chunk attribute without a field of its own; may carry identity. */
|
|
29
|
+
attributes: Record<string, unknown> | null;
|
|
30
|
+
}
|
|
31
|
+
/** One stream (a tab, a recording) of a replay. */
|
|
32
|
+
interface StreamEntry {
|
|
33
|
+
stream_id: string;
|
|
34
|
+
state: string;
|
|
35
|
+
start_time: number;
|
|
36
|
+
end_time: number;
|
|
37
|
+
/** How the stream ended (`ouo.replay.ended`), or null while open. */
|
|
38
|
+
end: unknown;
|
|
39
|
+
missing: Array<[number, number]> | null;
|
|
40
|
+
chunks: ChunkEntry[] | null;
|
|
41
|
+
}
|
|
42
|
+
/** One replay's manifest (Muninn spec 7.2). */
|
|
43
|
+
interface Manifest {
|
|
44
|
+
session_id: string;
|
|
45
|
+
replay_id: string;
|
|
46
|
+
project: string;
|
|
47
|
+
state: string;
|
|
48
|
+
start_time: number;
|
|
49
|
+
end_time: number;
|
|
50
|
+
chunk_count: number;
|
|
51
|
+
byte_size: number;
|
|
52
|
+
streams: StreamEntry[] | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns one chunk's bytes, decompressed. The caller decides where they come from (its own
|
|
56
|
+
* backend, Muninn through a proxy) and how the request is authorised.
|
|
57
|
+
*/
|
|
58
|
+
type ChunkFetcher = (streamId: string, sequence: number) => Promise<ArrayBuffer>;
|
|
59
|
+
|
|
60
|
+
interface ReplayPlayerProps {
|
|
61
|
+
manifest: Manifest;
|
|
62
|
+
/** Returns one chunk's decompressed bytes. */
|
|
63
|
+
fetchChunk: ChunkFetcher;
|
|
64
|
+
onTime?: (offsetMs: number) => void;
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Plays one replay from its manifest: picks a stream, assembles its playable runs, fetches the
|
|
69
|
+
* chunks and hands them to the renderer chosen by the chunks' format id. Several streams (two
|
|
70
|
+
* tabs) get a stream picker. Key it by replay id when one instance shows several replays.
|
|
71
|
+
*/
|
|
72
|
+
declare function ReplayPlayer({ manifest, fetchChunk, onTime, className }: ReplayPlayerProps): React.JSX.Element;
|
|
73
|
+
|
|
74
|
+
interface RrwebPlayerProps {
|
|
75
|
+
/** rrweb events, in order. */
|
|
76
|
+
events: unknown[];
|
|
77
|
+
/** Called with the current offset in ms from the replay start, throttled to 10 Hz. */
|
|
78
|
+
onTime?: (offsetMs: number) => void;
|
|
79
|
+
className?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* React wrapper over rrweb-player (Svelte), copied from the MVP plugin's ReplayPlayer without
|
|
83
|
+
* its Grafana styling. The replayer renders into an iframe with sandbox="allow-same-origin"
|
|
84
|
+
* (no scripts); do not change that.
|
|
85
|
+
*/
|
|
86
|
+
declare function RrwebPlayer({ events, onTime, className }: RrwebPlayerProps): React.JSX.Element;
|
|
87
|
+
|
|
88
|
+
type Renderer = 'rrweb';
|
|
89
|
+
interface FormatInfo {
|
|
90
|
+
/** Structure (DOM or wireframe) or pixel (frames or video). */
|
|
91
|
+
kind: 'structure' | 'pixel' | 'unknown';
|
|
92
|
+
/** Set when the kit can play the format. */
|
|
93
|
+
renderer?: Renderer;
|
|
94
|
+
/** Why it cannot be played here, when it cannot. */
|
|
95
|
+
reason?: string;
|
|
96
|
+
}
|
|
97
|
+
declare function formatInfo(format: string): FormatInfo;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The playable runs of a stream (Muninn spec RDR-3): chunks in sequence order, each run
|
|
101
|
+
* starting at a keyframe and ending before the first missing sequence. After a gap, play
|
|
102
|
+
* resumes at the next keyframe.
|
|
103
|
+
*/
|
|
104
|
+
declare function playableRuns(stream: StreamEntry): ChunkEntry[][];
|
|
105
|
+
/**
|
|
106
|
+
* Parses the newline-delimited JSON of a structure format. A chunk may end in the middle of a
|
|
107
|
+
* line, so the decompressed chunks of one run are concatenated before splitting. A line that is
|
|
108
|
+
* not valid JSON (a run cut short) is skipped.
|
|
109
|
+
*/
|
|
110
|
+
declare function parseNdjson<T = unknown>(parts: ArrayBuffer[]): T[];
|
|
111
|
+
/** The stream to play first: the earliest with a playable run. */
|
|
112
|
+
declare function primaryStream(streams: StreamEntry[]): StreamEntry | undefined;
|
|
113
|
+
|
|
114
|
+
export { type ChunkEntry, type ChunkFetcher, type FormatInfo, type Manifest, type Renderer, ReplayPlayer, type ReplayPlayerProps, type ReplaySummary, RrwebPlayer, type RrwebPlayerProps, type StreamEntry, formatInfo, parseNdjson, playableRuns, primaryStream };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// src/replay/ReplayPlayer.tsx
|
|
2
|
+
import React2, { useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState2 } from "react";
|
|
3
|
+
|
|
4
|
+
// src/replay/assemble.ts
|
|
5
|
+
function playableRuns(stream) {
|
|
6
|
+
const chunks = [...stream.chunks ?? []].sort((a, b) => a.sequence - b.sequence);
|
|
7
|
+
const runs = [];
|
|
8
|
+
let run = null;
|
|
9
|
+
let prev = -2;
|
|
10
|
+
for (const c of chunks) {
|
|
11
|
+
const contiguous = c.sequence === prev + 1;
|
|
12
|
+
prev = c.sequence;
|
|
13
|
+
if (run && contiguous) {
|
|
14
|
+
run.push(c);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
run = null;
|
|
18
|
+
if (c.keyframe) {
|
|
19
|
+
run = [c];
|
|
20
|
+
runs.push(run);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return runs;
|
|
24
|
+
}
|
|
25
|
+
function parseNdjson(parts) {
|
|
26
|
+
const total = parts.reduce((n, p) => n + p.byteLength, 0);
|
|
27
|
+
const all = new Uint8Array(total);
|
|
28
|
+
let off = 0;
|
|
29
|
+
for (const p of parts) {
|
|
30
|
+
all.set(new Uint8Array(p), off);
|
|
31
|
+
off += p.byteLength;
|
|
32
|
+
}
|
|
33
|
+
const out = [];
|
|
34
|
+
for (const line of new TextDecoder().decode(all).split("\n")) {
|
|
35
|
+
if (!line.trim()) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
out.push(JSON.parse(line));
|
|
40
|
+
} catch {
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
function primaryStream(streams) {
|
|
46
|
+
return [...streams].sort((a, b) => a.start_time - b.start_time).find((s) => playableRuns(s).length > 0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/replay/formats.ts
|
|
50
|
+
var FORMATS = {
|
|
51
|
+
"rrweb/2": { kind: "structure", renderer: "rrweb" },
|
|
52
|
+
// Seam for the pixel players: the MVP plugin's frame and video players read the MVP wire;
|
|
53
|
+
// porting them to these formats is the next slice.
|
|
54
|
+
"ouo-frames/3": { kind: "pixel", reason: "the frames player is not wired to ouo-frames/3 yet" },
|
|
55
|
+
"ouo-video/1": { kind: "pixel", reason: "the video player is not wired to ouo-video/1 yet" },
|
|
56
|
+
"ouo-wireframe/1": { kind: "structure", reason: "wireframe replays are not built yet" }
|
|
57
|
+
};
|
|
58
|
+
function formatInfo(format) {
|
|
59
|
+
return FORMATS[format] ?? { kind: "unknown", reason: `format ${format} is stored but this player cannot decode it` };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/replay/RrwebPlayer.tsx
|
|
63
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
64
|
+
import rrwebPlayer from "rrweb-player";
|
|
65
|
+
import "rrweb-player/dist/style.css";
|
|
66
|
+
function RrwebPlayer({ events, onTime, className }) {
|
|
67
|
+
const hostRef = useRef(null);
|
|
68
|
+
const onTimeRef = useRef(onTime);
|
|
69
|
+
onTimeRef.current = onTime;
|
|
70
|
+
const [error, setError] = useState(null);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const host = hostRef.current;
|
|
73
|
+
if (!host || events.length < 2) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
host.innerHTML = "";
|
|
77
|
+
const width = Math.max(320, Math.floor(host.clientWidth));
|
|
78
|
+
let player;
|
|
79
|
+
try {
|
|
80
|
+
player = new rrwebPlayer({
|
|
81
|
+
target: host,
|
|
82
|
+
props: {
|
|
83
|
+
events,
|
|
84
|
+
width,
|
|
85
|
+
height: Math.round(width * 9 / 16),
|
|
86
|
+
autoPlay: false,
|
|
87
|
+
showController: true,
|
|
88
|
+
skipInactive: true,
|
|
89
|
+
speedOption: [1, 2, 4, 8],
|
|
90
|
+
mouseTail: false
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
} catch (err) {
|
|
94
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
setError(null);
|
|
98
|
+
let last = 0;
|
|
99
|
+
player.addEventListener("ui-update-current-time", (payload) => {
|
|
100
|
+
const now = performance.now();
|
|
101
|
+
if (now - last < 100) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
last = now;
|
|
105
|
+
const p = payload;
|
|
106
|
+
onTimeRef.current?.(typeof p === "number" ? p : p?.payload ?? 0);
|
|
107
|
+
});
|
|
108
|
+
const ro = new ResizeObserver(() => {
|
|
109
|
+
const w = Math.max(320, Math.floor(host.clientWidth));
|
|
110
|
+
if (Math.abs(w - width) < 8) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
player.$set({ width: w, height: Math.round(w * 9 / 16) });
|
|
114
|
+
player.triggerResize();
|
|
115
|
+
});
|
|
116
|
+
ro.observe(host);
|
|
117
|
+
return () => {
|
|
118
|
+
ro.disconnect();
|
|
119
|
+
try {
|
|
120
|
+
player.pause();
|
|
121
|
+
player.$destroy();
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}, [events]);
|
|
126
|
+
if (events.length < 2) {
|
|
127
|
+
return /* @__PURE__ */ React.createElement("div", { className }, "The recording has no renderable events yet.");
|
|
128
|
+
}
|
|
129
|
+
return /* @__PURE__ */ React.createElement("div", { className }, error && /* @__PURE__ */ React.createElement("div", { role: "alert" }, "Replay failed to start: ", error), /* @__PURE__ */ React.createElement("div", { ref: hostRef, "data-testid": "ouo-replay-rrweb", style: { width: "100%", display: "flow-root" } }));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// src/replay/ReplayPlayer.tsx
|
|
133
|
+
function ReplayPlayer({ manifest, fetchChunk, onTime, className }) {
|
|
134
|
+
const streams = useMemo(() => manifest.streams ?? [], [manifest]);
|
|
135
|
+
const [streamId, setStreamId] = useState2();
|
|
136
|
+
const stream = streams.find((s) => s.stream_id === streamId) ?? primaryStream(streams);
|
|
137
|
+
const [loaded, setLoaded] = useState2({ state: "loading" });
|
|
138
|
+
const fetchRef = useRef2(fetchChunk);
|
|
139
|
+
fetchRef.current = fetchChunk;
|
|
140
|
+
useEffect2(() => {
|
|
141
|
+
let cancelled = false;
|
|
142
|
+
const set = (l) => !cancelled && setLoaded(l);
|
|
143
|
+
if (!stream) {
|
|
144
|
+
set({ state: "unplayable", message: "This replay has no chunk to start from (no keyframe held)." });
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const runs = playableRuns(stream);
|
|
148
|
+
const format = runs[0]?.[0]?.format ?? stream.chunks?.[0]?.format ?? "";
|
|
149
|
+
const streamId2 = stream.stream_id;
|
|
150
|
+
const info = formatInfo(format);
|
|
151
|
+
if (!info.renderer) {
|
|
152
|
+
set({ state: "unplayable", message: `Stored, not playable here: ${info.reason}.` });
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
set({ state: "loading" });
|
|
156
|
+
loadStructure(runs, (seq) => fetchRef.current(streamId2, seq)).then((events) => set({ state: "ready", events })).catch((err) => set({ state: "error", message: err instanceof Error ? err.message : String(err) }));
|
|
157
|
+
return () => {
|
|
158
|
+
cancelled = true;
|
|
159
|
+
};
|
|
160
|
+
}, [stream]);
|
|
161
|
+
return /* @__PURE__ */ React2.createElement("div", { className, "data-testid": "ouo-replay" }, streams.length > 1 && /* @__PURE__ */ React2.createElement("label", null, "Stream", " ", /* @__PURE__ */ React2.createElement("select", { value: stream?.stream_id, onChange: (e) => setStreamId(e.target.value) }, streams.map((s, i) => /* @__PURE__ */ React2.createElement("option", { key: s.stream_id, value: s.stream_id }, i + 1, ": ", new Date(s.start_time).toLocaleTimeString(), " (", s.state, ", ", s.chunks?.length ?? 0, " chunks)")))), loaded.state === "loading" && /* @__PURE__ */ React2.createElement("div", null, "Loading replay\u2026"), loaded.state === "error" && /* @__PURE__ */ React2.createElement("div", { role: "alert" }, "Replay failed to load: ", loaded.message), loaded.state === "unplayable" && /* @__PURE__ */ React2.createElement("div", null, loaded.message), loaded.state === "ready" && /* @__PURE__ */ React2.createElement(RrwebPlayer, { events: loaded.events, onTime }));
|
|
162
|
+
}
|
|
163
|
+
async function loadStructure(runs, fetch) {
|
|
164
|
+
const bodies = /* @__PURE__ */ new Map();
|
|
165
|
+
const queue = runs.flat().map((c) => c.sequence);
|
|
166
|
+
const worker = async () => {
|
|
167
|
+
for (let seq = queue.shift(); seq !== void 0; seq = queue.shift()) {
|
|
168
|
+
bodies.set(seq, await fetch(seq));
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
await Promise.all(Array.from({ length: Math.min(4, queue.length) }, worker));
|
|
172
|
+
return runs.flatMap((run) => parseNdjson(run.map((c) => bodies.get(c.sequence))));
|
|
173
|
+
}
|
|
174
|
+
export {
|
|
175
|
+
ReplayPlayer,
|
|
176
|
+
RrwebPlayer,
|
|
177
|
+
formatInfo,
|
|
178
|
+
parseNdjson,
|
|
179
|
+
playableRuns,
|
|
180
|
+
primaryStream
|
|
181
|
+
};
|
|
182
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/replay/ReplayPlayer.tsx","../src/replay/assemble.ts","../src/replay/formats.ts","../src/replay/RrwebPlayer.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from 'react';\nimport type { ChunkEntry, ChunkFetcher, Manifest } from '../manifest';\nimport { parseNdjson, playableRuns, primaryStream } from './assemble';\nimport { formatInfo } from './formats';\nimport { RrwebPlayer } from './RrwebPlayer';\n\nexport interface ReplayPlayerProps {\n manifest: Manifest;\n /** Returns one chunk's decompressed bytes. */\n fetchChunk: ChunkFetcher;\n onTime?: (offsetMs: number) => void;\n className?: string;\n}\n\ntype Loaded =\n | { state: 'loading' }\n | { state: 'error'; message: string }\n | { state: 'unplayable'; message: string }\n | { state: 'ready'; events: unknown[] };\n\n/**\n * Plays one replay from its manifest: picks a stream, assembles its playable runs, fetches the\n * chunks and hands them to the renderer chosen by the chunks' format id. Several streams (two\n * tabs) get a stream picker. Key it by replay id when one instance shows several replays.\n */\nexport function ReplayPlayer({ manifest, fetchChunk, onTime, className }: ReplayPlayerProps) {\n const streams = useMemo(() => manifest.streams ?? [], [manifest]);\n // The picked stream, or the primary one: a new manifest without the picked stream falls back.\n const [streamId, setStreamId] = useState<string>();\n const stream = streams.find((s) => s.stream_id === streamId) ?? primaryStream(streams);\n const [loaded, setLoaded] = useState<Loaded>({ state: 'loading' });\n // A ref, so a new fetcher identity (an inline arrow in a parent that re-renders, e.g. on\n // onTime) does not reload the replay; the stream alone decides what is loaded.\n const fetchRef = useRef(fetchChunk);\n fetchRef.current = fetchChunk;\n\n useEffect(() => {\n let cancelled = false;\n const set = (l: Loaded) => !cancelled && setLoaded(l);\n if (!stream) {\n set({ state: 'unplayable', message: 'This replay has no chunk to start from (no keyframe held).' });\n return;\n }\n const runs = playableRuns(stream);\n const format = runs[0]?.[0]?.format ?? stream.chunks?.[0]?.format ?? '';\n const streamId = stream.stream_id;\n const info = formatInfo(format);\n if (!info.renderer) {\n set({ state: 'unplayable', message: `Stored, not playable here: ${info.reason}.` });\n return;\n }\n set({ state: 'loading' });\n loadStructure(runs, (seq) => fetchRef.current(streamId, seq))\n .then((events) => set({ state: 'ready', events }))\n .catch((err: unknown) => set({ state: 'error', message: err instanceof Error ? err.message : String(err) }));\n return () => {\n cancelled = true;\n };\n }, [stream]);\n\n return (\n <div className={className} data-testid=\"ouo-replay\">\n {streams.length > 1 && (\n <label>\n Stream{' '}\n <select value={stream?.stream_id} onChange={(e) => setStreamId(e.target.value)}>\n {streams.map((s, i) => (\n <option key={s.stream_id} value={s.stream_id}>\n {i + 1}: {new Date(s.start_time).toLocaleTimeString()} ({s.state}, {s.chunks?.length ?? 0} chunks)\n </option>\n ))}\n </select>\n </label>\n )}\n {loaded.state === 'loading' && <div>Loading replay…</div>}\n {loaded.state === 'error' && <div role=\"alert\">Replay failed to load: {loaded.message}</div>}\n {loaded.state === 'unplayable' && <div>{loaded.message}</div>}\n {loaded.state === 'ready' && <RrwebPlayer events={loaded.events} onTime={onTime} />}\n </div>\n );\n}\n\n/** Fetches the chunks of the runs, a few at a time, and parses them run by run. */\nasync function loadStructure(runs: ChunkEntry[][], fetch: (seq: number) => Promise<ArrayBuffer>): Promise<unknown[]> {\n const bodies = new Map<number, ArrayBuffer>();\n const queue = runs.flat().map((c) => c.sequence);\n const worker = async () => {\n for (let seq = queue.shift(); seq !== undefined; seq = queue.shift()) {\n bodies.set(seq, await fetch(seq));\n }\n };\n await Promise.all(Array.from({ length: Math.min(4, queue.length) }, worker));\n return runs.flatMap((run) => parseNdjson(run.map((c) => bodies.get(c.sequence)!)));\n}\n","import type { ChunkEntry, StreamEntry } from '../manifest';\n\n/**\n * The playable runs of a stream (Muninn spec RDR-3): chunks in sequence order, each run\n * starting at a keyframe and ending before the first missing sequence. After a gap, play\n * resumes at the next keyframe.\n */\nexport function playableRuns(stream: StreamEntry): ChunkEntry[][] {\n const chunks = [...(stream.chunks ?? [])].sort((a, b) => a.sequence - b.sequence);\n const runs: ChunkEntry[][] = [];\n let run: ChunkEntry[] | null = null;\n let prev = -2;\n for (const c of chunks) {\n const contiguous = c.sequence === prev + 1;\n prev = c.sequence;\n if (run && contiguous) {\n run.push(c);\n continue;\n }\n run = null;\n if (c.keyframe) {\n run = [c];\n runs.push(run);\n }\n }\n return runs;\n}\n\n/**\n * Parses the newline-delimited JSON of a structure format. A chunk may end in the middle of a\n * line, so the decompressed chunks of one run are concatenated before splitting. A line that is\n * not valid JSON (a run cut short) is skipped.\n */\nexport function parseNdjson<T = unknown>(parts: ArrayBuffer[]): T[] {\n const total = parts.reduce((n, p) => n + p.byteLength, 0);\n const all = new Uint8Array(total);\n let off = 0;\n for (const p of parts) {\n all.set(new Uint8Array(p), off);\n off += p.byteLength;\n }\n const out: T[] = [];\n for (const line of new TextDecoder().decode(all).split('\\n')) {\n if (!line.trim()) {\n continue;\n }\n try {\n out.push(JSON.parse(line) as T);\n } catch {\n // the tail of a run that ends mid-line\n }\n }\n return out;\n}\n\n/** The stream to play first: the earliest with a playable run. */\nexport function primaryStream(streams: StreamEntry[]): StreamEntry | undefined {\n return [...streams].sort((a, b) => a.start_time - b.start_time).find((s) => playableRuns(s).length > 0);\n}\n","// Renderer choice by `ouo.replay.format` (SDK spec RPL-24, Muninn spec RDR-2). A format this\n// table does not know is stored but not playable, never an error.\n\nexport type Renderer = 'rrweb';\n\nexport interface FormatInfo {\n /** Structure (DOM or wireframe) or pixel (frames or video). */\n kind: 'structure' | 'pixel' | 'unknown';\n /** Set when the kit can play the format. */\n renderer?: Renderer;\n /** Why it cannot be played here, when it cannot. */\n reason?: string;\n}\n\nconst FORMATS: Record<string, FormatInfo> = {\n 'rrweb/2': { kind: 'structure', renderer: 'rrweb' },\n // Seam for the pixel players: the MVP plugin's frame and video players read the MVP wire;\n // porting them to these formats is the next slice.\n 'ouo-frames/3': { kind: 'pixel', reason: 'the frames player is not wired to ouo-frames/3 yet' },\n 'ouo-video/1': { kind: 'pixel', reason: 'the video player is not wired to ouo-video/1 yet' },\n 'ouo-wireframe/1': { kind: 'structure', reason: 'wireframe replays are not built yet' },\n};\n\nexport function formatInfo(format: string): FormatInfo {\n return FORMATS[format] ?? { kind: 'unknown', reason: `format ${format} is stored but this player cannot decode it` };\n}\n","import React, { useEffect, useRef, useState } from 'react';\nimport rrwebPlayer from 'rrweb-player';\nimport 'rrweb-player/dist/style.css';\n\n/** Svelte component methods rrweb-player inherits; `svelte` types are not installed. */\ninterface SvelteHandle {\n $set: (props: Record<string, unknown>) => void;\n $destroy: () => void;\n}\n\nexport interface RrwebPlayerProps {\n /** rrweb events, in order. */\n events: unknown[];\n /** Called with the current offset in ms from the replay start, throttled to 10 Hz. */\n onTime?: (offsetMs: number) => void;\n className?: string;\n}\n\n/**\n * React wrapper over rrweb-player (Svelte), copied from the MVP plugin's ReplayPlayer without\n * its Grafana styling. The replayer renders into an iframe with sandbox=\"allow-same-origin\"\n * (no scripts); do not change that.\n */\nexport function RrwebPlayer({ events, onTime, className }: RrwebPlayerProps) {\n const hostRef = useRef<HTMLDivElement | null>(null);\n const onTimeRef = useRef(onTime);\n onTimeRef.current = onTime;\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host || events.length < 2) {\n return;\n }\n host.innerHTML = '';\n const width = Math.max(320, Math.floor(host.clientWidth));\n let player: rrwebPlayer;\n try {\n player = new rrwebPlayer({\n target: host,\n props: {\n events: events as ConstructorParameters<typeof rrwebPlayer>[0]['props']['events'],\n width,\n height: Math.round((width * 9) / 16),\n autoPlay: false,\n showController: true,\n skipInactive: true,\n speedOption: [1, 2, 4, 8],\n mouseTail: false,\n },\n });\n } catch (err) {\n setError(err instanceof Error ? err.message : String(err));\n return;\n }\n setError(null);\n let last = 0;\n player.addEventListener('ui-update-current-time', (payload) => {\n const now = performance.now();\n if (now - last < 100) {\n return;\n }\n last = now;\n const p = payload as { payload?: number } | number;\n onTimeRef.current?.(typeof p === 'number' ? p : (p?.payload ?? 0));\n });\n const ro = new ResizeObserver(() => {\n const w = Math.max(320, Math.floor(host.clientWidth));\n if (Math.abs(w - width) < 8) {\n return;\n }\n (player as unknown as SvelteHandle).$set({ width: w, height: Math.round((w * 9) / 16) });\n player.triggerResize();\n });\n ro.observe(host);\n return () => {\n ro.disconnect();\n try {\n player.pause();\n (player as unknown as SvelteHandle).$destroy();\n } catch {\n // teardown errors from the Svelte component are not ours to report\n }\n };\n }, [events]);\n\n if (events.length < 2) {\n return <div className={className}>The recording has no renderable events yet.</div>;\n }\n return (\n <div className={className}>\n {error && <div role=\"alert\">Replay failed to start: {error}</div>}\n {/* rrweb-player floats .rr-player left, which collapses the host; flow-root contains it. */}\n <div ref={hostRef} data-testid=\"ouo-replay-rrweb\" style={{ width: '100%', display: 'flow-root' }} />\n </div>\n );\n}\n"],"mappings":";AAAA,OAAOA,UAAS,aAAAC,YAAW,SAAS,UAAAC,SAAQ,YAAAC,iBAAgB;;;ACOrD,SAAS,aAAa,QAAqC;AAChE,QAAM,SAAS,CAAC,GAAI,OAAO,UAAU,CAAC,CAAE,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,QAAQ;AAChF,QAAM,OAAuB,CAAC;AA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A,cAAC,SAAI,MAAK,WAAQ,2BAAwB,OAAO,OAAQ,GACrF,OAAO,UAAU,gBAAgB,gBAAAA,OAAA,cAAC,aAAK,OAAO,OAAQ,GACtD,OAAO,UAAU,WAAW,gBAAAA,OAAA,cAAC,eAAY,QAAQ,OAAO,QAAQ,QAAgB,CACnF;AAEJ;AAGA,eAAe,cAAc,MAAsB,OAAkE;AACnH,QAAM,SAAS,oBAAI,IAAyB;AAC5C,QAAM,QAAQ,KAAK,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ;AAC/C,QAAM,SAAS,YAAY;AACzB,aAAS,MAAM,MAAM,MAAM,GAAG,QAAQ,QAAW,MAAM,MAAM,MAAM,GAAG;AACpE,aAAO,IAAI,KAAK,MAAM,MAAM,GAAG,CAAC;AAAA,IAClC;AAAA,EACF;AACA,QAAM,QAAQ,IAAI,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,MAAM,MAAM,EAAE,GAAG,MAAM,CAAC;AAC3E,SAAO,KAAK,QAAQ,CAAC,QAAQ,YAAY,IAAI,IAAI,CAAC,MAAM,OAAO,IAAI,EAAE,QAAQ,CAAE,CAAC,CAAC;AACnF;","names":["React","useEffect","useRef","useState","useState","useRef","useEffect","streamId","React"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouo11y/kit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Frontend building blocks for ouo11y client plugins: a replay player that plays a Muninn manifest with chunks the caller fetches, and the replay format seam. React only; no Grafana and no backend of ours required.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/ouo11y/ouo11y.git",
|
|
9
|
+
"directory": "libs/ouo-kit"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/ouo11y/ouo11y/tree/main/libs/ouo-kit#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/ouo11y/ouo11y/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"opentelemetry",
|
|
17
|
+
"rum",
|
|
18
|
+
"session-replay",
|
|
19
|
+
"rrweb",
|
|
20
|
+
"react"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"module": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md",
|
|
40
|
+
"CHANGELOG.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsup",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"test": "vitest run"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=24"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"react": ">=18"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"rrweb-player": "2.1.7"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@testing-library/react": "^16.3.0",
|
|
59
|
+
"@types/react": "^19.0.0",
|
|
60
|
+
"jsdom": "^30.1.2",
|
|
61
|
+
"react": "^18.3.1",
|
|
62
|
+
"react-dom": "^18.3.1",
|
|
63
|
+
"tsup": "^8.5.1",
|
|
64
|
+
"typescript": "~5.9.3",
|
|
65
|
+
"vitest": "^5.0.3"
|
|
66
|
+
}
|
|
67
|
+
}
|