@tracelane/report 0.1.0-alpha.1 → 0.1.0-alpha.11
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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +4 -4
- package/dist/assets.d.ts +20 -0
- package/dist/assets.d.ts.map +1 -1
- package/dist/assets.js +60 -6
- package/dist/assets.js.map +1 -1
- package/dist/build-report.d.ts.map +1 -1
- package/dist/build-report.js +10 -0
- package/dist/build-report.js.map +1 -1
- package/dist/metadata.d.ts +21 -2
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +94 -27
- package/dist/metadata.js.map +1 -1
- package/dist/panels.d.ts +13 -3
- package/dist/panels.d.ts.map +1 -1
- package/dist/panels.js +76 -11
- package/dist/panels.js.map +1 -1
- package/dist/template.d.ts +7 -0
- package/dist/template.d.ts.map +1 -1
- package/dist/template.js +878 -72
- package/dist/template.js.map +1 -1
- package/package.json +31 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
CHANGED
|
@@ -10,6 +10,14 @@ This product includes software developed by:
|
|
|
10
10
|
rrweb-player 1.0.0-alpha.4 (MIT License) — UMD + CSS inlined into report HTML.
|
|
11
11
|
- fflate (https://github.com/101arrowz/fflate) 0.8.x (MIT License) —
|
|
12
12
|
browser gunzip build inlined into report HTML for offline decompression.
|
|
13
|
+
- Google Inc. + Universal Thirst — Fraunces (SIL Open Font License 1.1) —
|
|
14
|
+
variable serif font, latin charset (normal + italic styles), embedded
|
|
15
|
+
into report HTML as base64 woff2 inside @font-face rules. Used for the
|
|
16
|
+
hero headline + section heads. Source: @fontsource-variable/fraunces.
|
|
17
|
+
- Philipp Nurullin + JetBrains — JetBrains Mono (SIL Open Font License 1.1)
|
|
18
|
+
— variable monospace font, latin charset (normal style only), embedded
|
|
19
|
+
the same way. Used for all data rows + metadata. Source:
|
|
20
|
+
@fontsource-variable/jetbrains-mono.
|
|
13
21
|
|
|
14
22
|
This product is licensed under the Apache License, Version 2.0.
|
|
15
23
|
See the LICENSE file for details.
|
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# @tracelane/report
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
> The reporter for your WebdriverIO, Playwright, and Cypress tests. Self-contained HTML for every run — replay failures, audit successes, attach to any bug tracker. No SaaS, no dashboard, no signup.
|
|
4
|
+
|
|
5
|
+
The self-contained, offline HTML report builder for [`tracelane`](https://github.com/Cubenest/rrweb-stack). Given a captured rrweb event stream plus test metadata, it produces a **single `.html` file** that:
|
|
4
6
|
|
|
5
7
|
- opens in any browser, fully offline (no network fetch at view time);
|
|
6
8
|
- embeds the [`rrweb-player`](https://www.npmjs.com/package/rrweb-player) UMD + CSS inline;
|
|
7
9
|
- embeds the events as a gzipped, base64-encoded blob that is decompressed in-page with an inlined [`fflate`](https://github.com/101arrowz/fflate) gunzip;
|
|
8
10
|
- renders console + network panels, a metadata header, and a "Copy as Markdown for AI paste" button.
|
|
9
11
|
|
|
10
|
-
Not generally intended for direct consumption — depend on a product package (`@tracelane/wdio`) instead.
|
|
12
|
+
**Not generally intended for direct consumption** — depend on a product package (`@tracelane/wdio`) instead. See the [`@tracelane/wdio` README](https://github.com/Cubenest/rrweb-stack/tree/main/packages/tracelane-wdio) for the integration guide.
|
|
11
13
|
|
|
12
14
|
## Usage
|
|
13
15
|
|
|
@@ -30,8 +32,6 @@ const html = buildReport(events, {
|
|
|
30
32
|
|
|
31
33
|
## Design
|
|
32
34
|
|
|
33
|
-
See [P1 PRD §F](https://github.com/Cubenest/rrweb-stack/blob/main/prds/compass_artifact_wf-d53d32da-17e9-41b5-bb70-21dd1bf648c6_text_markdown.md) and [ADR-0005](https://github.com/Cubenest/rrweb-stack/blob/main/prds/adrs/0005-p1-failed-only-self-contained-html.md).
|
|
34
|
-
|
|
35
35
|
- **Player:** `rrweb-player@1.0.0-alpha.4` (upstream). `@posthog/rrweb-player` was the natural lineage match for the `@cubenest/rrweb-core` substrate fork, but every published version pins an unpublished dependency (`@posthog/rrweb-packer@0.0.0`, 404) and is therefore uninstallable. Upstream `rrweb-player` descends from the same rrweb 2.x line (`2.0.0-alpha.x`) that the substrate's `@posthog/rrweb@0.0.34` was forked from (`2.0.0-alpha.17`), so the recorded event shape replays correctly.
|
|
36
36
|
- **Decompression:** the build side uses `@cubenest/rrweb-core`'s `compress()` (fflate gzip); the view side inlines fflate's browser `gunzipSync` for a small (~8 KB) offline decompressor.
|
|
37
37
|
- **Asset inlining:** the player UMD/CSS and the fflate gunzip source are read from `node_modules` at build time (`fs.readFileSync`) — never hand-pasted into source.
|
package/dist/assets.d.ts
CHANGED
|
@@ -16,4 +16,24 @@ export declare function loadPlayerCss(): string;
|
|
|
16
16
|
* pako for consistency with `@cubenest/rrweb-core`'s fflate-based `compress()`.
|
|
17
17
|
*/
|
|
18
18
|
export declare function loadFflateGunzipSource(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Fraunces Variable (weight axis 100-900, latin charset, normal style).
|
|
21
|
+
* SIL OFL-1.1 — credited in NOTICE. ~36 KB raw → ~49 KB base64.
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadFrauncesNormal(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Fraunces Variable (weight axis 100-900, latin charset, italic style).
|
|
26
|
+
* Same package + license as the normal weight; ~45 KB raw → ~60 KB base64.
|
|
27
|
+
* Used for the headline's emphasized clause and the section heads.
|
|
28
|
+
*/
|
|
29
|
+
export declare function loadFrauncesItalic(): string;
|
|
30
|
+
/**
|
|
31
|
+
* JetBrains Mono Variable (weight axis 100-800, latin charset, normal style).
|
|
32
|
+
* SIL OFL-1.1 — credited in NOTICE. ~40 KB raw → ~54 KB base64.
|
|
33
|
+
*
|
|
34
|
+
* Italic intentionally NOT loaded — the data rows (console + network + meta
|
|
35
|
+
* strip + timestamps) never use italics, so the second 43 KB italic woff2
|
|
36
|
+
* would add weight to every report for no design benefit.
|
|
37
|
+
*/
|
|
38
|
+
export declare function loadJetBrainsMonoNormal(): string;
|
|
19
39
|
//# sourceMappingURL=assets.d.ts.map
|
package/dist/assets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAuDA;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AA8BD;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAKhD"}
|
package/dist/assets.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
// Build-time asset loaders (Task 2.8 + 2.9).
|
|
1
|
+
// Build-time asset loaders (Task 2.8 + 2.9 + Phase 6 report-revamp fonts).
|
|
2
2
|
//
|
|
3
|
-
// The self-contained report inlines
|
|
4
|
-
//
|
|
5
|
-
// 1. the rrweb-player UMD (defines `window.rrwebPlayer`)
|
|
6
|
-
// 2. the rrweb-player CSS
|
|
7
|
-
// 3. the fflate UMD gunzip (defines `window.fflate`)
|
|
3
|
+
// The self-contained report inlines vendored assets so it opens fully offline
|
|
4
|
+
// with nothing fetched at view time:
|
|
5
|
+
// 1. the rrweb-player UMD (defines `window.rrwebPlayer`) — Task 2.8
|
|
6
|
+
// 2. the rrweb-player CSS — Task 2.8
|
|
7
|
+
// 3. the fflate UMD gunzip (defines `window.fflate`) — Task 2.9
|
|
8
|
+
// 4. Fraunces Variable (latin, weight 100-900, normal + italic) — Phase 6
|
|
9
|
+
// 5. JetBrains Mono Variable (latin, weight 100-800, normal) — Phase 6
|
|
8
10
|
//
|
|
9
11
|
// Each is read from the installed package via `require.resolve`, NOT hand-pasted
|
|
10
12
|
// into source (the assets are large and would bloat/obscure the diff, and they
|
|
@@ -70,4 +72,56 @@ export function loadPlayerCss() {
|
|
|
70
72
|
export function loadFflateGunzipSource() {
|
|
71
73
|
return readUmdViaUnpkg('fflate');
|
|
72
74
|
}
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// Font assets (Phase 6 report-revamp).
|
|
77
|
+
//
|
|
78
|
+
// The new report design pairs Fraunces (serif, OFL-1.1) for the hero "what
|
|
79
|
+
// failed" headline + section heads with JetBrains Mono (mono, OFL-1.1) for all
|
|
80
|
+
// data rows. Both are read as variable-axis woff2 files from `@fontsource-
|
|
81
|
+
// variable/*` and embedded as base64 `url(data:font/woff2;base64,…)` inside the
|
|
82
|
+
// SHELL_CSS `@font-face` rules — same offline-first posture as the player UMD.
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
/**
|
|
85
|
+
* Read a woff2 file out of an `@fontsource-variable/*` package and return its
|
|
86
|
+
* base64-encoded contents. The fontsource packages don't expose the woff2
|
|
87
|
+
* files via their `exports` map directly (the `./files/*.woff2` mapping uses a
|
|
88
|
+
* glob), so we walk to the file via the package's own `package.json` path.
|
|
89
|
+
*/
|
|
90
|
+
function readFontBase64(packageName, fileName) {
|
|
91
|
+
const pkgJsonPath = localRequire.resolve(`${packageName}/package.json`);
|
|
92
|
+
const pkgDirUrl = pathToFileURL(pkgJsonPath.slice(0, pkgJsonPath.lastIndexOf('/') + 1));
|
|
93
|
+
const fontUrl = new URL(`./files/${fileName}`, pkgDirUrl);
|
|
94
|
+
const fontPath = fileURLToPath(fontUrl);
|
|
95
|
+
const pkgDirPath = fileURLToPath(pkgDirUrl);
|
|
96
|
+
if (!fontPath.startsWith(pkgDirPath)) {
|
|
97
|
+
throw new Error(`${packageName}: font file escapes the package directory`);
|
|
98
|
+
}
|
|
99
|
+
return readFileSync(fontPath).toString('base64');
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Fraunces Variable (weight axis 100-900, latin charset, normal style).
|
|
103
|
+
* SIL OFL-1.1 — credited in NOTICE. ~36 KB raw → ~49 KB base64.
|
|
104
|
+
*/
|
|
105
|
+
export function loadFrauncesNormal() {
|
|
106
|
+
return readFontBase64('@fontsource-variable/fraunces', 'fraunces-latin-wght-normal.woff2');
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Fraunces Variable (weight axis 100-900, latin charset, italic style).
|
|
110
|
+
* Same package + license as the normal weight; ~45 KB raw → ~60 KB base64.
|
|
111
|
+
* Used for the headline's emphasized clause and the section heads.
|
|
112
|
+
*/
|
|
113
|
+
export function loadFrauncesItalic() {
|
|
114
|
+
return readFontBase64('@fontsource-variable/fraunces', 'fraunces-latin-wght-italic.woff2');
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* JetBrains Mono Variable (weight axis 100-800, latin charset, normal style).
|
|
118
|
+
* SIL OFL-1.1 — credited in NOTICE. ~40 KB raw → ~54 KB base64.
|
|
119
|
+
*
|
|
120
|
+
* Italic intentionally NOT loaded — the data rows (console + network + meta
|
|
121
|
+
* strip + timestamps) never use italics, so the second 43 KB italic woff2
|
|
122
|
+
* would add weight to every report for no design benefit.
|
|
123
|
+
*/
|
|
124
|
+
export function loadJetBrainsMonoNormal() {
|
|
125
|
+
return readFontBase64('@fontsource-variable/jetbrains-mono', 'jetbrains-mono-latin-wght-normal.woff2');
|
|
126
|
+
}
|
|
73
127
|
//# sourceMappingURL=assets.js.map
|
package/dist/assets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,8EAA8E;AAC9E,qCAAqC;AACrC,kFAAkF;AAClF,mFAAmF;AACnF,mFAAmF;AACnF,kFAAkF;AAClF,kFAAkF;AAClF,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,mDAAmD;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAExD,6EAA6E;AAC7E,8EAA8E;AAC9E,iEAAiE;AACjE,MAAM,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEpD,SAAS,SAAS,CAAC,SAAiB;IAClC,OAAO,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,eAAe,CAAC,WAAmB;IAC1C,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,WAAW,eAAe,CAAC,CAAC;IACxE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAuB,CAAC;IAChF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACxB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,GAAG,WAAW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
1
|
+
{"version":3,"file":"build-report.d.ts","sourceRoot":"","sources":["../src/build-report.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAO1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,aAAa,EAAE,EACvB,IAAI,EAAE,UAAU,EAChB,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CAiCR"}
|
package/dist/build-report.js
CHANGED
|
@@ -37,6 +37,13 @@ export function buildReport(events, meta, options = {}) {
|
|
|
37
37
|
const networkRows = extractNetwork(sized);
|
|
38
38
|
const actions = extractActionLog(sized);
|
|
39
39
|
const markdown = buildMarkdown(resolvedMeta, consoleRows, networkRows, actions);
|
|
40
|
+
// First/last event timestamps drive the hero meta strip's "Events" item,
|
|
41
|
+
// the replay-header session-range label, and the failure marker on the
|
|
42
|
+
// custom timeline strip. `?? 0` fallback covers the crashed-before-
|
|
43
|
+
// recorder-snapshot path (sized empty) — optional chaining + nullish
|
|
44
|
+
// coalescing keep the type-safety without a non-null assertion.
|
|
45
|
+
const firstTs = sized[0]?.timestamp ?? 0;
|
|
46
|
+
const lastTs = sized[sized.length - 1]?.timestamp ?? 0;
|
|
40
47
|
return renderReportHtml({
|
|
41
48
|
meta: resolvedMeta,
|
|
42
49
|
eventsGzB64: encodeEventsBlob(sized),
|
|
@@ -44,6 +51,9 @@ export function buildReport(events, meta, options = {}) {
|
|
|
44
51
|
network: networkRows,
|
|
45
52
|
markdown,
|
|
46
53
|
pruned,
|
|
54
|
+
eventCount: sized.length,
|
|
55
|
+
firstTs,
|
|
56
|
+
lastTs,
|
|
47
57
|
});
|
|
48
58
|
}
|
|
49
59
|
//# sourceMappingURL=build-report.js.map
|
package/dist/build-report.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-report.js","sourceRoot":"","sources":["../src/build-report.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,yEAAyE;AACzE,8EAA8E;AAC9E,wCAAwC;AACxC,yEAAyE;AACzE,gEAAgE;AAChE,iEAAiE;AACjE,iEAAiE;AACjE,iEAAiE;AACjE,iDAAiD;AACjD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,kDAAkD;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAYjD;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,MAAuB,EACvB,IAAgB,EAChB,UAA8B,EAAE;IAEhC,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAE7C,2EAA2E;IAC3E,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,iBAAiB;QACjD,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC;QAC3B,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAE9B,MAAM,YAAY,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,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AM,EAAE,KAAK,EAAE,CAAC;IAE9B,MAAM,YAAY,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,aAAa,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAEhF,yEAAyE;IACzE,uEAAuE;IACvE,oEAAoE;IACpE,qEAAqE;IACrE,gEAAgE;IAChE,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,IAAI,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,SAAS,IAAI,CAAC,CAAC;IAEvD,OAAO,gBAAgB,CAAC;QACtB,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC;QACpC,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE,WAAW;QACpB,QAAQ;QACR,MAAM;QACN,UAAU,EAAE,KAAK,CAAC,MAAM;QACxB,OAAO;QACP,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
|
package/dist/metadata.d.ts
CHANGED
|
@@ -4,6 +4,25 @@ import type { ReportMeta } from './types.js';
|
|
|
4
4
|
* absent. Explicit values always win; auto-detection only fills gaps.
|
|
5
5
|
*/
|
|
6
6
|
export declare function resolveCiMetadata(meta: ReportMeta): ReportMeta;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Render the new hero + meta-strip (Phase 6).
|
|
9
|
+
*
|
|
10
|
+
* Replaces the old `<header class="meta">` shape. The visible structure:
|
|
11
|
+
*
|
|
12
|
+
* <section class="hero">
|
|
13
|
+
* <div class="eyebrow">…status pill + spec + duration + browser…</div>
|
|
14
|
+
* <h1 class="what">…title with <em> emphasized inside…</h1>
|
|
15
|
+
* <pre class="error-message">…verbatim error stack trace…</pre>
|
|
16
|
+
* <div class="meta-strip">…6 small key-value items…</div>
|
|
17
|
+
* </section>
|
|
18
|
+
*
|
|
19
|
+
* The status pill keeps `class="status <status>"` so existing test assertions
|
|
20
|
+
* for "class=\"status failed\"" still match; the commit value still ships
|
|
21
|
+
* inside `<code>` and the buildUrl still becomes an `<a href="…">` for safe
|
|
22
|
+
* URLs only.
|
|
23
|
+
*
|
|
24
|
+
* `eventCount` is rendered when non-undefined; the caller (template.ts) passes
|
|
25
|
+
* `events.length` after `pruneToSizeBudget` runs.
|
|
26
|
+
*/
|
|
27
|
+
export declare function renderHero(meta: ReportMeta, eventCount?: number, capturedAt?: Date): string;
|
|
9
28
|
//# sourceMappingURL=metadata.d.ts.map
|
package/dist/metadata.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA4B7C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAQ9D;AAwDD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,CAoD3F"}
|
package/dist/metadata.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
// Metadata header (Task 2.11).
|
|
1
|
+
// Metadata header (Task 2.11 + Phase 6 hero rewrite).
|
|
2
2
|
//
|
|
3
3
|
// Two responsibilities:
|
|
4
4
|
// • resolveCiMetadata — fill commit SHA + build URL from CI env vars when the
|
|
5
5
|
// caller didn't supply them (GITHUB_SHA / CI_COMMIT_SHA, and common build
|
|
6
6
|
// URL conventions for GitHub Actions + GitLab CI).
|
|
7
|
-
// •
|
|
8
|
-
//
|
|
7
|
+
// • renderHero — the new editorial-postmortem `<section class="hero">` markup:
|
|
8
|
+
// eyebrow strip (status + spec + duration + browser), serif headline with
|
|
9
|
+
// the test title + status framing, monospace error block, then the
|
|
10
|
+
// `.meta-strip` of small key-value pairs (spec / commit / build / captured /
|
|
11
|
+
// events). HTML-escaped throughout; javascript: URLs become text, not links.
|
|
9
12
|
import { escapeHtml } from './html.js';
|
|
10
13
|
/** Read an env var without a hard `@types/node` dependency (platform-light). */
|
|
11
14
|
function readEnv(name) {
|
|
@@ -54,9 +57,6 @@ function formatDuration(ms) {
|
|
|
54
57
|
const m = Math.floor(s / 60);
|
|
55
58
|
return `${m}m ${Math.round(s - m * 60)}s`;
|
|
56
59
|
}
|
|
57
|
-
function row(term, value) {
|
|
58
|
-
return `<dt>${escapeHtml(term)}</dt><dd>${value}</dd>`;
|
|
59
|
-
}
|
|
60
60
|
/**
|
|
61
61
|
* Whether `url` is safe to use as an `href`. Only http(s) — blocks `javascript:`,
|
|
62
62
|
* `data:`, `vbscript:` etc. The build URL is sourced from CI env vars
|
|
@@ -73,33 +73,100 @@ function isSafeUrl(url) {
|
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
/** A status's human-facing display verb in the headline ("failed" → "failed"). */
|
|
77
|
+
function statusVerb(status) {
|
|
78
|
+
switch (status) {
|
|
79
|
+
case 'failed':
|
|
80
|
+
return 'failed';
|
|
81
|
+
case 'broken':
|
|
82
|
+
return 'errored';
|
|
83
|
+
case 'passed':
|
|
84
|
+
return 'passed';
|
|
85
|
+
case 'skipped':
|
|
86
|
+
return 'was skipped';
|
|
87
|
+
default:
|
|
88
|
+
return status;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** Format an ISO timestamp into a compact "2026-05-30 18:47 UTC" rendering. */
|
|
92
|
+
function formatCapturedAt(d) {
|
|
93
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
94
|
+
return (`${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ` +
|
|
95
|
+
`${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())} UTC`);
|
|
96
|
+
}
|
|
97
|
+
/** Build one `.meta-strip .item` block: label + value, value may contain HTML. */
|
|
98
|
+
function stripItem(label, valueHtml) {
|
|
99
|
+
return `<div class="item"><span class="label">${escapeHtml(label)}</span><span class="value">${valueHtml}</span></div>`;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Render the new hero + meta-strip (Phase 6).
|
|
103
|
+
*
|
|
104
|
+
* Replaces the old `<header class="meta">` shape. The visible structure:
|
|
105
|
+
*
|
|
106
|
+
* <section class="hero">
|
|
107
|
+
* <div class="eyebrow">…status pill + spec + duration + browser…</div>
|
|
108
|
+
* <h1 class="what">…title with <em> emphasized inside…</h1>
|
|
109
|
+
* <pre class="error-message">…verbatim error stack trace…</pre>
|
|
110
|
+
* <div class="meta-strip">…6 small key-value items…</div>
|
|
111
|
+
* </section>
|
|
112
|
+
*
|
|
113
|
+
* The status pill keeps `class="status <status>"` so existing test assertions
|
|
114
|
+
* for "class=\"status failed\"" still match; the commit value still ships
|
|
115
|
+
* inside `<code>` and the buildUrl still becomes an `<a href="…">` for safe
|
|
116
|
+
* URLs only.
|
|
117
|
+
*
|
|
118
|
+
* `eventCount` is rendered when non-undefined; the caller (template.ts) passes
|
|
119
|
+
* `events.length` after `pruneToSizeBudget` runs.
|
|
120
|
+
*/
|
|
121
|
+
export function renderHero(meta, eventCount, capturedAt) {
|
|
122
|
+
// ---- Eyebrow row -------------------------------------------------------
|
|
123
|
+
// Status pill (always shown), then spec / duration / browser separated by
|
|
124
|
+
// thin dividers. Each piece is optional except the status.
|
|
125
|
+
const eyebrowBits = [
|
|
126
|
+
`<span class="dot" aria-hidden="true"></span><span class="status ${escapeHtml(meta.status)}">test ${escapeHtml(statusVerb(meta.status))}</span>`,
|
|
127
|
+
];
|
|
79
128
|
if (meta.spec)
|
|
80
|
-
|
|
129
|
+
eyebrowBits.push(`<span>${escapeHtml(meta.spec)}</span>`);
|
|
81
130
|
if (meta.durationMs !== undefined)
|
|
82
|
-
|
|
131
|
+
eyebrowBits.push(`<span>${escapeHtml(formatDuration(meta.durationMs))}</span>`);
|
|
83
132
|
const browser = [meta.browserName, meta.browserVersion].filter(Boolean).join(' ');
|
|
84
|
-
if (browser)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
133
|
+
if (browser || meta.viewport) {
|
|
134
|
+
const browserBits = [
|
|
135
|
+
browser,
|
|
136
|
+
meta.viewport ? `${meta.viewport.width}×${meta.viewport.height}` : '',
|
|
137
|
+
]
|
|
138
|
+
.filter(Boolean)
|
|
139
|
+
.join(' · ');
|
|
140
|
+
eyebrowBits.push(`<span>${escapeHtml(browserBits)}</span>`);
|
|
88
141
|
}
|
|
142
|
+
const eyebrow = `<div class="eyebrow">${eyebrowBits.join('<span class="sep" aria-hidden="true">/</span>')}</div>`;
|
|
143
|
+
// ---- Headline ----------------------------------------------------------
|
|
144
|
+
// Format: "<test title> — <emphasized status verb>." Always one sentence; the
|
|
145
|
+
// emphasized clause is the colour-of-the-failure-state moment.
|
|
146
|
+
const headline = `<h1 class="what">${escapeHtml(meta.title)} <em>${escapeHtml(statusVerb(meta.status))}</em>.</h1>`;
|
|
147
|
+
// ---- Error block (when present) ---------------------------------------
|
|
148
|
+
const errorBlock = meta.error ? `<pre class="error-message">${escapeHtml(meta.error)}</pre>` : '';
|
|
149
|
+
// ---- Meta strip --------------------------------------------------------
|
|
150
|
+
const stripItems = [];
|
|
151
|
+
if (meta.spec)
|
|
152
|
+
stripItems.push(stripItem('Spec', escapeHtml(meta.spec)));
|
|
153
|
+
if (meta.durationMs !== undefined)
|
|
154
|
+
stripItems.push(stripItem('Duration', escapeHtml(formatDuration(meta.durationMs))));
|
|
89
155
|
if (meta.commitSha)
|
|
90
|
-
|
|
156
|
+
stripItems.push(stripItem('Commit', `<code>${escapeHtml(meta.commitSha)}</code>`));
|
|
91
157
|
if (meta.buildUrl) {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
158
|
+
const escapedHref = escapeHtml(meta.buildUrl);
|
|
159
|
+
const value = isSafeUrl(meta.buildUrl)
|
|
160
|
+
? `<a href="${escapedHref}">${escapedHref}</a>`
|
|
161
|
+
: escapedHref;
|
|
162
|
+
stripItems.push(stripItem('Build', value));
|
|
163
|
+
}
|
|
164
|
+
const capturedDate = capturedAt ?? new Date();
|
|
165
|
+
stripItems.push(stripItem('Captured', escapeHtml(formatCapturedAt(capturedDate))));
|
|
166
|
+
if (eventCount !== undefined) {
|
|
167
|
+
stripItems.push(stripItem('Events', escapeHtml(eventCount.toLocaleString('en-US'))));
|
|
97
168
|
}
|
|
98
|
-
const
|
|
99
|
-
return `<
|
|
100
|
-
<h1>${escapeHtml(meta.title)} <span class="status ${escapeHtml(meta.status)}">${escapeHtml(meta.status)}</span></h1>
|
|
101
|
-
${rows.length ? `<dl>${rows.join('')}</dl>` : ''}
|
|
102
|
-
${error}
|
|
103
|
-
</header>`;
|
|
169
|
+
const strip = stripItems.length ? `<div class="meta-strip">${stripItems.join('')}</div>` : '';
|
|
170
|
+
return `<section class="hero">${eyebrow}${headline}${errorBlock}${strip}</section>`;
|
|
104
171
|
}
|
|
105
172
|
//# sourceMappingURL=metadata.js.map
|
package/dist/metadata.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.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